105 Commits

Author SHA1 Message Date
openharmony_ci 981db37b8e !1726 fixed for assermbler stubs bug in mobile phone
Merge pull request !1726 from getingke/fix_aarch64_aottest
2022-07-07 02:18:36 +00:00
wengchangcheng cd90e396a7 Descriptor: ark hilog refactor
details:
1. use hilog in ohos device
2. use panda logger in host
issue:  https://gitee.com/openharmony/ark_js_runtime/issues/I5FR5J

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: I6f5de00751154bdb6aac3101515961a3a4432e80
2022-07-06 22:55:49 +08:00
getingke 3933c182ec fixed for rewrite assembler stub for aarch64
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I9b5982bc1268725e7882fd95eeb2ba07f2851b6d
2022-07-05 20:07:03 +08:00
xujie 690ca22d2a Support Lexenv In TSAOT
1. Support lexical env when running tsaot
2. fix getunmappedargs and copyrestargs bugs

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I5C1P2

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: Ia78ea4d89654d6924c0dee6f491cdf1e4fe718ee
2022-06-30 14:01:26 +08:00
wanghuan 733093439a stub.m binary file compiled into shared library
desc: stub.m binary file compiled into shared library

solu:
1. ark_stub_compiler executable not depend libark_jsruntime.so and libark_jsoptimizer.so, but depend libark_jsruntime_set and libark_jsoptimizer_set
2. python shell read stub.m binary data, and save to extern array of stub_m.cpp;
3. file_loader.cpp read stub data from array of stub_m.cpp.

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I5E4LW
Signed-off-by: wanghuan <wanghuan80@huawei.com>
Change-Id: I9c95c882b59438370523179dd5949aeca51faa10
2022-06-28 17:25:33 +08:00
wengchangcheng 6468341c72 Descriptor: delete some internal unused code
details: delete unused code
issue: https://gitee.com/openharmony/ark_js_runtime/issues/I5COHE

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: I5fe62c58353839d4aac1144fc99e2cf87f4374eb
2022-06-17 23:03:42 +08:00
songzhengchao 045c51360a refactor llvm_stackmap_parser
In the future, multiple vm may be existed such as multiple worker.each
vm should have one stackmap, while llvm_stackmap_parser is singleton
which is not good.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5BSW4

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I7501c656f27a2fd34225928079f23a196e7f0bbf
2022-06-11 14:22:00 +08:00
ding 8bfd16debf Refactor GateType
1.Change the implementation of gateType from enum to class.
2.Add some base type opeartions between GateType and GlobalTSTypeRef to simplify the code.
3.Delete class GateTypeCoder
4.Extract GlobalTSTypeRef as an independent file.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5A893

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: I3d80595ebccc9ac942af9b9bcc67c0974bb9b712
2022-06-09 17:32:43 +08:00
songzhengchao dfb9eeaa92 Revert "debug"
This reverts commit dd4c6e829b.

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Iafb4e81981e7b3eef79672684aa4dfc8e75f791a
2022-06-07 15:57:19 +08:00
songzhengchao dd4c6e829b debug
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ie19553066c5f038237c2f06b42dd2b2a64721a8e
2022-06-06 10:05:14 +08:00
songzhengchao 69ac5a27a9 Implement Prologue refactor and Add mulitple Optimized Frame In LLVM 12.0.1
1 refactor prologue reserve dynamic slots which is setted by LLVM IR
2 callsiteSp is calculated by current function's callee saved registers size
3 and Add mulitple Optimized Frame:
OPTIMIZED_JS_FUNCTION_FRAME:argv[n-1],..., argv[0], argc, ...., returnaddr, Fp, type. this frame need to visit args and stackmap.
OPTIMIZED_ASM_FRAME: jscall/jsentry construct frame which is implemented by assemble, this frame is only link to previou frame, it don't need to visit args and stackmap

4 stackmap support parse const pool and llvm patch add deopt interface LLVMBuildCall3

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I5AJ9U
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ie6a0067169805cc6043ea94936dd578489b56c7b
2022-06-03 15:51:19 +08:00
openharmony_ci 41d2d54a7d !1477 Fix usage of non-standard C++
Merge pull request !1477 from Mingliang Zeng/master
2022-05-31 13:37:15 +00:00
Mingliang Zeng 3c4b63cc73 https://gitee.com/openharmony/ark_js_runtime/issues/I5A969
Fix usage of non-standard C++

Signed-off-by: Mingliang Zeng <zengmingliang1@huawei.com>
2022-05-31 20:29:04 +08:00
openharmony_ci f17c1d64c2 !1459 Circuit IR optimizer frameworks
Merge pull request !1459 from Mingliang Zeng/master
2022-05-31 07:29:39 +00:00
Mingliang Zeng e419729e6c https://gitee.com/openharmony/ark_js_runtime/issues/I59TAQ
Circuit IR optimizer frameworks:
1. Lattice equations system solver framework
2. Subgraph rewrite framework

Signed-off-by: Mingliang Zeng <zengmingliang1@huawei.com>
Change-Id: I05e97c8b34be46d5689798ec24423228c8e14bee
2022-05-31 10:54:59 +08:00
luochuhao 7522f51989 Add multi-abc-file support in stub compiler and aot compiler and related adaptation.
Use methodId of func in pandafile as index for each aot func in llvmModule.

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I598P5
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I9646d6a80c8138744ebbd617837550b4661f27d3
2022-05-29 16:59:27 +08:00
openharmony_ci f5596f01bd !1405 fix mem leak problem from jsmethod
Merge pull request !1405 from xiongluo/mem_leak_from_method
2022-05-25 07:20:21 +00:00
xiongluo 2c14680bc6 Fix the mem leak from js method
Signed-off-by: xiongluo <xiongluo@huawei.com>
2022-05-25 10:53:36 +08:00
sunzhe23 b492ef605f Fix some asm interpreter bug
description:
1 add align up for rodata section, incase movdqa crash
2 set gc leaf function attribute for no gc all
3 fix mega ic run slowpath bug for asm interpreter
4 remove trampoline unused code

issue: #I58VFA

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-05-24 19:36:38 +08:00
openharmony_ci 7586ba396f !1379 modify taggedvalue encode
Merge pull request !1379 from wpy111/master
2022-05-21 04:40:02 +00:00
wupengyong 7c650ba015 reason:performance optimization
description:optimize taggedvalue encode
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I55ZVP?from=project-issue

Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: I747a60f5ea7348d3b0cfc041a3b010c52b1517c0
2022-05-21 09:33:44 +08:00
wuzhefeng 814c0d002c Remove/improve some unused data structures
Remove/improve some unused data structures like FrameConstants, which
should be moved to some arch-related places.

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I57TGW

Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: If6699f5916e5c289375f97995c8e2570b081cda8
2022-05-20 00:38:25 -07:00
getingke ff439ffc66 Merge branch 'master' of gitee.com:openharmony/ark_js_runtime into gtk_0506
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Id33a4dc77017b43b332d46e33c042c5114aa602b
2022-05-18 16:02:06 +08:00
getingke d3a73bc238 fixed for review comment by wuzhefeng
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Ie52314f22202735975972a7695797e566d97dd00
2022-05-18 14:49:38 +08:00
wanyanglan f0981feee7 Enable x86 Assembler
1. x86 assembler replaces JSCall, JSCallArgV, JSFunctionEntry,
OptimizedCallOptimized, CallNativeTrampoline assembly code of
x86 call.S debugged and enabled to the official code.
2. Delete the relevant code in call.S.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I57UHX

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I69b9aad1f52d486ba6d96248aa1a5a2d0a44f318
2022-05-18 09:42:00 +08:00
wanyanglan 404fc3fb09 fix part of the use case problem
1. AssemblerStubTest adapts to the latest llvm library
2. Fix aottest failure in heapverify open state
3. Shield createemptyarray, definefunc use cases.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I56AKK

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: Id8836d378832a68a3a17105809f2f4710918fc3a
2022-05-08 22:50:59 +08:00
openharmony_ci 9f9dd0b467 !1061 Assembler reloc & support arm64
Merge pull request !1061 from getingke/assembeler_reloc
2022-05-07 05:10:21 +00:00
getingke a2ab7afef1 Descriptor: fix for support assembler of aarch64
details: implements AssemblerAarch64 class, provide some apis for
generate code for arm64 instruction
issue: https://gitee.com/openharmony/ark_js_runtime/issues/I55WKH?from=project-issue

Change-Id: Id109528bcc62de1e0158131b6aa94042978c506d
Signed-off-by: getingke <getingke@huawei.com>
2022-05-06 16:23:20 +08:00
openharmony_ci bb260a0ad9 !1206 Fix ark_dev branch compiler error
Merge pull request !1206 from songzhengchao/bugfix0505
2022-05-06 07:42:15 +00:00
wanyanglan 290f0d3844 Replace x64 call.S with x64 assembler
Replace JSFunctionEntry, OptimizedCallOptimized, CallNativeTrampoline,
OptimizedCallRuntime, JSCall, JSCallWithArgV assembly functions with
x86 assembler

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I55O8Y

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I1970a5bfd032530ad791b5c91b96d35f7be9ac14
2022-05-06 14:10:27 +08:00
songzhengchao 9193718d48 Fix ark_dev branch compiler error
ark_dev branch prebuilt/ark_tools place llvm libraray.
thus gitee master is same with ark_dev

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I55WED?from=project-issue

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I8dcb27a87624cc2f036cd49518bbe2ee8372f3ea
2022-05-05 17:06:31 +08:00
luochuhao 90a5373327 First run of an TSAOT-define function Demo.
Record idx in const pool of aot function in llvmmodule and aotcodeinfo.

Tweak code in circuit builder for slowpath lowering scenario where
constpool is null.

New JSFunction object for main function in AOT file and new JSFunction object
for each defined function in lowerDefineFuncDyn.

Fix bug in call.S after JSMethod refactor.

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I545X0
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: Ie6448f8740caddf79c3b9ed3385ba5739c7eb76b
2022-04-25 12:00:12 +08:00
yingguofeng@huawei.com 6c5808fc28 Delete useless code dependencies
To reduce 'libark_ jsruntime.so' ROM size, delete useless code dependencies.

https://gitee.com/openharmony/ark_js_runtime/issues/I541H4?from=project-issue

Profit: libark_jsruntime.so size reduce from 3455(kb) to 2001(kb)

Change-Id: Ie7430fca6f539c9baff1f4aae7942da6fc9ef135
Signed-off-by: yingguofeng@huawei.com <yingguofeng@huawei.com>
2022-04-24 18:02:32 +08:00
lifansheng a725676a6c Runtime architecture adjustment
Description
  Cut out most of the initialization logic in Runtime::Create and disconnect the
  inheritance relationship of most classes such as JSThread.
Issue:
  #I53418: Runtime architecture adjustment

Signed-off-by: lifansheng <lifansheng1@huawei.com>
Change-Id: Ib9c1a40354f77d32e515e23334e7f4b4a4fa3259
2022-04-21 14:37:31 +08:00
songzhengchao fb35927a32 Implement Proxy Lowering on x86
when function need call another js function, it will lowering to call "JSCall" trampoline function
JSCall trampoline function will check calltarget function, then correct the arguments, finally jump
the native or optimized code address of the target function.

JSCall(glue, argc, calltarget, ....)
then proxy call(glue, argc, callTarget, argv[])
        if proxy->GetHandler is function
            tail call JSCall(glue, argc, callTarget, argv); // consider performance
        else
            //Call(trap, handler, «target, thisArgument, argArray»)
            call CreateArrayFromList(glue, argc, argv[]) ---> arrHandle  // maybe trigger GC, construct OptimizedWithArgvLeaveFrame, visitor argv[0]..argv[argc-1]
            call JSCall(glue, argc, method, argv[])
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52T6B?from=project-issue

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I994aae1eb9cbf51982348ae6e203c24c326f617e
2022-04-15 16:39:42 +08:00
ding d8f0399789 Control whether to print compiler logs through JSRuntime Options
Add option log-compiled-methods to print the compiler(both stub and aot) in units of methods.

Add class CompilerLog.

Refactor some compiler logs.

Unie the log invoked way(COMPILER_LOG or COMPILER_OPTIONAL_LOG).

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: I43ce61d0ba9d453713ab3e6349d07f6d9cde3e5e
2022-04-14 16:14:34 +08:00
openharmony_ci 91c467cb6b !984 Add X64 assembler
Merge pull request !984 from 孙哲/master
2022-04-14 05:54:27 +00:00
sunzhe23 44d2430c3c Add x64 assembler
1 Implements x64 assembler
2 Add Asm code generator framework
3 Generating AsmInterCallRuntime with the x64 assembler

issue: #I52Ak6

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-04-13 22:01:24 -07:00
getingke 7632585d64 fixed for jsbound function call
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I7d543a1784c017746d8afe3cad0d0bb9fc6011b3
2022-04-13 19:24:09 +08:00
openharmony_ci 9af9aac86b !958 JSFunctionCall Trampoline
Merge pull request !958 from getingke/js_function_call_stub_formal
2022-04-11 14:03:09 +00:00
getingke 0ae046c723 fixed for review comment by wuzhefeng
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Ic1d22d507c222871790cba1525200fcffa866154
2022-04-11 20:00:58 +08:00
getingke fd1719432b JSFunction call have 4 scenariso:
1.JSFunction
	call native code when method is native
	jump to compiled code for aot JSFunction
	call asm interpreter entry for BC method
2. JSBoundFunction
	Bind Arguments for Bound target function, then recursive call this trampoline function.
3. JSProxy
	Call proxy's target jsfunction.
4. NonCallable
	Throw typerror exception.

issue https://gitee.com/openharmony/ark_js_runtime/issues/I51OWV?from=project-issue

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I85917e3cf1ffec0cc1e39de5fc20bd606947c968
2022-04-11 15:49:51 +08:00
xliu 4fb9fcc443 ObjectFactory New Ecmastring Rectification
Description
  1. There are many kinds of interfaces to construct ecmastring from objectfactory
     in the virtual machine, and the name is not clear, so it is complex to use;
  2. Some of the unchecked interfaces are prone to errors during use. If there is
     no compression where compression is required, unpredictable errors will occur.
Issue:
  #I4ZL7X: ObjectFactory New Ecmastring Rectification

Signed-off-by: xliu <liuxin259@huawei.com>
Change-Id: I856f4e2e1df62823d928d738fa35affa97dbd3ed
2022-04-09 10:34:11 +08:00
songzhengchao ede3113e23 Implement CallingConv to compatible with Fast-Stub/ASM-INT/AOT
1 Current ASM-INT(GHCC)/Fast-Stub(WebKit_jscc) set different FrameType to distinguish with CallingConv.It's more friendly to add callingConv flag in CallSignature class.
2 Fast-Stub/Aot CallingConv is WebKit_jscc while LLVM Backend don't support it on arm32. we'll add padding paramets to JS-Relative paramter is placed on stack.

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZYPN?from=project-issue

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I93df6c1d605692941b1aa362ad4e07a202d76241
2022-03-29 11:51:39 +08:00
wengchangcheng 4f169b31a5 add -Werror -Wextra gn flag for 'compiler'
1. ignore llvm warning
2. fix warning of compiler module

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZHER

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: I09774e431743a26ea366ed28e3276ff027ae0d31
2022-03-25 15:31:59 +08:00
wengchangcheng 4804cd80d3 add Wextra and Werror in gn args
1. add -Wextra and -Werror to check code format error
2. modify all compiler error

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZDQE

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: If5fdd1980494269b4c06bf1bb38a8eba7952adea
2022-03-24 21:45:19 +08:00
luochuhao 8c6f8ef20d Implement aot file generated step for aot compiler
Implement llvmIRGeneration Pass in aot compiler pipeline.

Rename and reconstruct LLVMStubModule and LLVMModuleAssembler class. Move aot code infos
related to describe current (code size, begin addr, entry offset of each func etc.)  AOT
snippet and corresponding serialization/deserialization func to NEW class called AotCodeInfo.
Move functions related to file reading/writing to NEW class called AotFileManager.

Add new call opcode in circuit IR to differentiate call into common stubs and call into
runtime interfaces without GC.

Adapt js runtime option for above changes.

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZDY5
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: If0ab5927ad2551fe5567d1c7b18540fbcc38bc15
2022-03-24 15:44:26 +08:00
songzhengchao e8bfc2dc23 Refactor trampoline signature and name
1 JSFunctionEntry parameter passed by argv[] instead of variable
parameter
2 rename  RuntimeCallTrampolineAot/RuntimeCallTrampolineInterpreterAsm/AotCallAotTrampoline to OptimizedCallRuntime/AsmIntCallRuntime/OptimizedCallOptimized

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4Z2S1?from=project-issue

Change-Id: I66056a02ae2c9f616db82de4310e3391bfffeca7
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2022-03-22 21:43:00 +08:00
xujie 479b7c3785 Clean Code For CodeHub Issues #96-#123 And #250-#264
According to the problems pointed out by the issuer and the
specifications compiled by Huawei, modify the non-compliant
parts of jsruntime.

Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4YLCQ

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: Iceb771dfd9f3aa9017205068fc50ab1a63aae08b
2022-03-21 17:09:19 +08:00
songzhengchao 9ce60a4c1f Implement Aot call Aot runtimpoline for arm32/arm64/amd platform
AOT call AOT expectArgNumbers may larger than actualArgNums, we should
place undefined args.
1 it's difficult to add extral unfined args which is
implented by llvm ir
2 actualArgs may placed in memory discontinuity.
thus, we need aot call aot trampoline to implent place undefined args
and comply with webkitjs_cci

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4Y105?from=project-issue

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I3a5652863df217561b19a7b7bdca8d103f9502a0
2022-03-20 14:16:03 +08:00