74 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
wuzhefeng aa44e06513 Fix compilation errors
Because there are some macros that trigger compilation errors when
compiling stub-compiler and aot-compiler. The root cause is that several
classes declarations are missing from the associated macros. This PR
fixes the issues via adding the lost classes to the macros. Besides, we
also rename the FastStub to CommonStubs in order to make the stub-arch
more readable.

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

Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: I16263fef7deeadf8a9ce4e5252a6e9898a7742bc
2022-03-18 18:17:21 -07:00
luochuhao c705ce054b Refactor ID definition and callSignature initialization mechanism of stubs
Refactor ID definition and callSignature initialization mechanism of runtime stub,
optimizer stub and bytecode handler stub,
reduce amount and complexity of macro used in calling those stubs.

Add stubDes struct to classify stubs both in AOT file generation phase
and AOT file loading phase.

Fix some circular dependency problems in including header files.

Fix certain inline function declaration and definition format problems, which could lead to
compiling errors.

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4VMLD?from=project-issue
Test: stubTest(unit test), richards with asm interpreter enabled
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: Ibd5fcd963347b97f8dec227f3245d2064463b0b0
2022-03-18 22:01:52 +08:00
wupengyong dd9120a1c2 reason:call_trampolines_aarch64.S and leaveframe has bug
despription:fix leavefrmae and aarch64.S

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

Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: I0b866d41973cbac0613777c2c3ed1f2c974702e8
2022-03-15 14:27:50 +08:00
sunzhe23 57fe644984 refactor runtime trampoline id
Description:
add runtime_trace for runtime trampoline
mov runtime_trampolines.cpp info cmascript/trampoline/
rename FAST_STUB_ID as RUNTIME_CALL_ID

issue: #I4XBC9

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-03-11 02:17:24 -08:00
songzhengchao bfa3466139 issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4W0OI?from=project-issue
stub_test bug fix

Modifications:
1 call stub must call CallRuntimeTrampoline
2 bug fix amd64 save callersave register rdi

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I19d4815b9c2f88499f0aee16cb8b3fb0b2aa6b1c
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2022-03-02 18:14:04 +08:00
songzhengchao 2f99abd413 CallRuntimeTrampoline brige support aarch64
Description:
a Use two Bridge function, "InvokeJSFunctionEntry" and "CallRuntimeTrampoline" to Adapter the calling convention of Aot JSFunction & Runtime Stub, then Construct the Entry Frame in "InvokeJSFunctionEntry", Leave Frame in "CallRuntimeTrampoline"
b modify LLVM Calling Conversion, prologue push callee-saved gpr registers --> callee-saved fp/simd/SVE regs --> prev_fp, prev_lr .finally update x29 pointer to prev_fp

issue:https://gitee.com/openharmony/ark_js_runtime/pulls/630

Change-Id: I1df498f411e03c9887c4cad97bf82371c0b5f01a
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2022-03-01 11:07:25 +08:00
wupengyong a3023b7f78 modify call runtime
Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: Iae4050f3e61ba9e76cfedcdff00748c7d78d6ecd
2022-02-26 09:43:43 +08:00
zhangyukun ad7195057a Sync code from c_asm_interpreter to master
Use Stub to impl handlers of bytecodes and use tail call to impl
dispatch of handlers of bytecodes

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I7afabdc40ddfa11345aa1029059514aa4f55b9f8
2022-02-22 17:01:18 +08:00
getingke 438614ed9e fixed for revert test code
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I725d9f53d3666b74b9430857e3ac0c8c33b3892c
2022-02-19 13:32:14 +08:00
getingke d79f4071c4 fixed for x86 test double mod ok
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I347316cfbbdc8e2ca15b222e1149a41712b35fca
2022-02-18 14:03:24 +08:00
songzhengchao f7471106c0 code review
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: If2256b755c72dd5d6e3fd9f054ec98eab62ad204
2022-01-24 19:32:02 +08:00
wuzhefeng 5720a01a3a Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: Ic990c5f11caeb3075033719a13e759baaf6dfefb
2022-01-13 00:26:00 -08:00
songzhengchao d5b0bbb5a0 code review: function rename and namespace
Change-Id: I40e81947ba3b51bb5e2dc1103a985889ca78dada
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2022-01-01 11:20:10 +08:00
songzhengchao 0a5ec1abb2 review code
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I3fd21354d4c3080bee86351e2281183d8d42355a
2022-01-01 11:17:15 +08:00
songzhengchao e198f24ced 1 review code
2 visit gc ptr by patchpoint instead of pc
3 contruct frame for aot

Change-Id: I98d1f8e39803ef7e1ac6c2f88e08d3254c6ef6af
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2022-01-01 11:17:09 +08:00
luochuhao 7e16623f8c Fix debug mode compilation error
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I0a0426ae9429b68d5f0355a8b697dd3a5e861120
2021-12-30 16:02:48 +08:00
getingke 0b2bf052ce fixed for code style check
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I4a644610efc9e0689207818f07667e68e345552c
2021-12-23 17:32:43 +08:00
getingke c108665b1c fixed for add CompilationConfig Class to support all arch
Change-Id: Ifd5cbb143350ecb9c496d8c7cbc3ee3745e74399
Signed-off-by: getingke <getingke@huawei.com>
2021-12-23 15:00:19 +08:00
zhangyukun a97747fe18 Description:sync from code from wgr_master to ohos
Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: Ic66a9e649de8c0ce530483296fe323b8f50621fb
2021-12-21 09:36:03 +08:00
xujie e818a0ba9e Add FastEqual Stub
Signed-off-by: xujie <xujie101@huawei.com>
2021-11-01 20:09:17 +08:00
songzhengchao 31969332ab code review
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2021-10-30 14:59:00 +08:00
songzhengchao 8b166ee59f Merge remote-tracking branch 'open/master' into gc_x86_2
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2021-10-29 16:42:01 +08:00