Commit Graph

117 Commits

Author SHA1 Message Date
getingke d667d9b5b9 fixed for code style check
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I3ff8ba9fbeaa282d02f4832a4b6a85e054670765
2022-05-18 20:55:17 +08:00
getingke 201322b1a1 fixed for aarch64 assembler bug
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I80bf1a50cfb8e1451db6744b1849a37d732e2cf9
2022-05-17 09:20:08 +08:00
wuzhefeng bf8671a948 Refactor Compilation Framework Part-3
There are many similar "call" in the CircuitBuilder and most of them can
be merged or removed. Merge the similar ones and remove the redundant
ones to improve the maintainability and readability.

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

Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: Ie575580a5d4d3eae67eff49efd8df126d96db48f
2022-05-14 20:21:38 -07:00
luochuhao 1a370607c9 Delete duplicated co stub generation and related conditional code.
Adapt call.S to current EcmaRuntimeCallInfo change.

Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I56JF1
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I117c6b088a82b15c2afcb18b4a74f47bfd705545
2022-05-12 17:24:57 +08:00
wuzhefeng 662f2b78a6 Refactor Compilation Framework Part-2
1. Rename IR builder to improve the readability.
2. Remove redundant Headers to decouple the relationships of components.

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

Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: I0c8da6cd55bb8e7f33421ba846bab89bd5e06c55
2022-05-11 04:28:10 -07:00
sunzhe23 c874c75894 Refactor asm interpreted frame
description:
1 remove macro ECMASCRIPT_COMPILE_ASM_INTERPRETER
2 add asm native frame type

issue: I569XH

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-05-08 20:40:24 -07:00
openharmony_ci 87a2cee24e !1085 add asmInter Debugger
Merge pull request !1085 from wanghuan2022/master
2022-04-26 08:06:13 +00:00
wanghuan 4d249dcb87 add asmInter Debugger
desc: add asmInter debugger to support ide debug.

solu:
1.add bc debugger stub entry;
2.check is or not debug mode in runInternal and switch release to debug or debug to release.

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I53Z4V
Signed-off-by: wanghuan <wanghuan80@huawei.com>
Change-Id: I3f61bed8b4e17c43d22b5e6f103fe897cd8b41c1
2022-04-25 21:38:27 +08:00
openharmony_ci 09715f883b !1119 Support calculate callsite sp for interpreter frame
Merge pull request !1119 from 孙哲/master
2022-04-25 12:06:25 +00:00
openharmony_ci 3f031e486a !1118 fix codex waring【part 2】
Merge pull request !1118 from zhaozhibo/master
2022-04-25 10:09:31 +00:00
sunzhe23 ad20a51cca Support calculate callsite sp for asm Interpreter
description:
Add SaveCurrentFrame for interpreter handler call stub and
get get callsite sp when gc run

issue: I54IMV

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-04-25 01:03:33 -07:00
zhaozhibo e0ad13d0c4 fix codex warning
Signed-off-by: zhaozhibo <zhaozhibo3@huawei.com>
2022-04-25 14:33:01 +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
sunzhe23 528db23a05 Refactor leave&entry frame
issue: #I541LG

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-04-23 23:35:51 -07:00
songzhengchao 9d944307ec Fix VisitBytecodeCall bug
VisitBytecodeCall generator asm error callq *0x20(%rax, %r13, 2)
correct asm:movq    32(%r13,%rax,8), %rax

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

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I225722612768dff0ab4b9d8ec0a6ca0c1b7235dd
2022-04-19 09:30:20 +08:00
songzhengchao e846617c23 1 bug fix compile bc/common stub vm setup load stub
2 rename glue type POINTER TO NATIVE_POINTER
3 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

Change-Id: I650ff10b35bc085ec81e7734ce35501ee23fbb62
2022-04-18 11:36:41 +08:00
songzhengchao 71dd7f53b9 refactor llvm_ir_builder.cpp call
bug fix OptimizedWithArgvLeaveFrameHandler::Iterate bug

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52T6B?from=project-issue
Signed-off-by: songzhengchao <surpassgoodchao@qq.com>
2022-04-17 22:32:54 +08:00
songzhengchao 56477d35de bug fix compile bc/common stub vm setup load stub
rename glue type POINTER TO NATIVE_POINTER

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

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ic50466ef1afd931268a649227458642f933b2360
2022-04-16 17:20:27 +08:00
songzhengchao e73e75786f Merge remote-tracking branch 'szc/proxy0413'
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I2a370b8803299c88109cbeb0f799acbdda53c2e9
2022-04-16 10:59:11 +08:00
Hailiang Hu 55d0b3b9a1 AOT Slowpath Refactor
Rename C_VALUE to NJS_VALUE, simplify using of RTSTUB_ID in
GetValueFromConstStringTable, rename LowerHirToMir to
ReplaceHirToSubCfg.

Issue: #I5311R

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: Ib9b8ea04b090c21569e1bffa2b63dd0ebf843ef1
2022-04-16 10:40:07 +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 ef35c0cad8 Lowering these call opcode of bytecode:
CALLARG0DYN_PREF_V8
CALLARG1DYN_PREF_V8_V8
CALLARGS2DYN_PREF_V8_V8_V8
CALLARGS3DYN_PREF_V8_V8_V8_V8
CALLITHISRANGEDYN_PREF_IMM16_V8
CALLIRANGEDYN_PREF_IMM16_V8

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

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

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I6be3f130b211ca7c51a557f9ace4bd20d46c4d04
2022-04-13 19:25:06 +08:00
openharmony_ci 7c000a7499 !973 fix codeDex warning
Merge pull request !973 from zhaozhibo/master
2022-04-12 08:41:37 +00:00
zhaozhibo aaf776aab5 fix code warning for codeDex
Signed-off-by: zhaozhibo <zhaozhibo3@huawei.com>
2022-04-12 14:27:50 +08:00
openharmony_ci d6fac85483 !849 Add STLETTOGLOBALRECORD slow path
Merge pull request !849 from taohong/DevLowering
2022-04-11 14:55:21 +00:00
taohong b82a13c5f1 Add STLETTOGLOBALRECORD etc slow path
Add STLETTOGLOBALRECORD bytecode slow path

Signed-off-by: hongtao <hongtao11@huawei.com>
Change-Id: Ie0f504b67b8fd8b9e1e339acdfb1831fbdeba601
2022-04-11 20:47:16 +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
zhangyukun 9139ca09c7 Add dispatch of call of x64 and construct frame with rsp in .S
1. use stub to dispatch fast,slow and native paths
2. use rsp to construct frame of x64
https://gitee.com/openharmony/ark_js_runtime/issues/I51G9L?from=project-issue
Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: Ib80540df5dbe531f155e5dd9fce556a207171494

Change-Id: I31e6705dd5555a0c2a9070a7ce73b26f77caef80
2022-04-07 14:32:38 +08:00
wanyanglan 6f99c9a3f6 Aot Lowering
lower NEWOBJDYNRANGE_PREF_IMM16_V8, JEQZ_IMM8, JEQZ_IMM16, JNEZ_IMM8, JNEZ_IMM16

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

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: Ia8ebbb51f39cce5b3be69c1a39aa39a0cd74ad81
2022-04-06 17:29:14 +08:00
luochuhao bef0e1d1fd Adaptation for aot framework helloworld test.
Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZL8V
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I32bf175d4aea43dab2d408ea0347a14a4b5903cb
2022-04-02 15:29:44 +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
wanghuan 5ec124e5bb refactor load stub in jsthread
description: refactor load stub in jsthread

solution:
1.change bcstub、costub、rtstub's name;
2.refactor load stub code, encapsulate adjust bcstub function according define or option

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

Signed-off-by: wanghuan <wanghuan80@huawei.com>
Change-Id: I8ff0192ff2c20f1625b4dea124532e8b9a0aa3e0
2022-03-28 18:02:36 +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
lijincheng 867175f50a fix compile error
Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-03-23 10:54:09 +08:00
lijincheng ae0aec3e6b add Circuit API to circuitbuilder and JsCircuitbuilder
Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-03-23 10:49:46 +08:00
openharmony_ci 3566ea621a !846 Refactor trampoline signature and name
Merge pull request !846 from songzhengchao/refactor0322
2022-03-23 02:42:33 +00: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
Hailiang Hu c99ea2b07d Modify for static check of handle issue
The same variable name in function, switch lack of default statement.

Issue: I4YXXP

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: Ia8b1fd6406bbc0f280482180a925d36ec358976f
2022-03-22 14:27:29 +08:00
sunzhe23 d74cdafe87 Add Instruction asr to implement shr2dyn bytecode handler
Description:
1 Shr2Dyn should use llvm asr
2 Rewrite shr/shl/ashr/or/xor/and slow path stubs

Issues: I4YVHA

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-03-21 05:38:04 -07:00
zhangyukun bb4208eef7 Refactor bytecode dispatch of bytecode in asm interpreter
1. add HandleOverflow in unused positions of bcHandlers
2. add bytecode helper at the end of bcHandlers
3. Refactor Dispatch
Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4YIQG?from=project-issue

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: Id51d1f2cc3c86f8fa1a59f6e79024bef406f7a21
2022-03-21 16:16:51 +08:00
sunzhe23 9dd906402c Fix some binary option handlers bug for c-interpreter and asm-interpreter
Description:
1 Fix and/or/xor CastToUint32 bug
2 Fix asm interpreter shr overflow bug

Issues: I4YPC6

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-03-20 20:03:59 -07:00
songzhengchao a898d654a0 Fix compile stub.m abort
LLVM IR handle i32/i1 mismatch

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4YNI8
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ia85b20aa786938251238e80bbbdecdcbf340ed1d
2022-03-20 17:00:25 +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
lichenshuai 915366d765 Add Call Stub
Change several structures for call stub.

Related issue: #I4XK12

Signed-off-by: lichenshuai <lichenshuai@huawei.com>
Change-Id: Ie7389ff96c619451304a3f0d352b271310c4b73e
2022-03-15 17:36:58 +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
wupengyong 756a285093 reason:enable interpreterAsm Gc
Description:save leaveframe on thread leaveframe and save pc before callruntime

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

Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: I770f18facaeb7e62f5dc02f280828a8f6a420b6f
2022-03-11 12:46:57 +08:00