Commit Graph

92 Commits

Author SHA1 Message Date
zhangyukun 78b91bf542 adapt newobjdynrange on arm64
1. fix getthis on x64
2. adapt optimization of newobjdynrange on arm64
3. add bridge frame to support GC of setter and getter

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

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I09c5fc89b2486d0b9988d9bef0af65f77dc2f684
2022-06-12 16:54:24 +08:00
xujie 6430e8f31e TSAOT Exception Handler
1. Throw JS exception in tsaot
2. Print bcoffset when occur JS exception

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

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: I046d76c092a399354ddcdedd859f0c1e622387c2
2022-06-11 16:36:16 +08:00
openharmony_ci cabfe1a62e !1345 Implement Prologue refactor and Add mulitple Optimized Frame In LLVM 12.0.1
Merge pull request !1345 from songzhengchao/optimizedjsfunction
2022-06-07 13:49:24 +00: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
Rtangyu 8ca37dcb29 JS stack printing supports native method pointer printing
Implement JS stack printing and support native method pointer printing

issue:https://gitee.com/openharmony/arkui_napi/issues/I5AOZC

Signed-off-by: Rtangyu <rentangyu@huawei.com>
2022-06-07 14:33:17 +08:00
songzhengchao e189c888a0 Merge remote-tracking branch 'szc/optimizedjsfunction'
Change-Id: I3451ce3ba039c43f4cebedbc6d5636bbf70d234c
2022-06-07 14:22:34 +08:00
songzhengchao dd4c6e829b debug
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ie19553066c5f038237c2f06b42dd2b2a64721a8e
2022-06-06 10:05:14 +08:00
songzhengchao ea9f7cc660 bug fix framehander should update optimizedReturnAddr_
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I78c1b054ca527f5fa3dd5f15a699114be9352ad3
2022-06-03 19:59:09 +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
lichenshuai a724508c73 Delete RSP macro and .S file
Rsp is used in future work, therefore .S file should be deleted.

Issue: #I5AGW3

Signed-off-by: lichenshuai <lichenshuai@huawei.com>
Change-Id: Ib1fb140d40d259bc4519fbf547857e5f80e9ee0c
2022-06-02 10:32:46 +08:00
lichenshuai a6bc94829b Fix C Interpreter Bug When Enabling rsp
Add case when ECMASCRIPT_ENABLE_ASM_INTERPRETER_RSP_STACK is true and asm-interpreter is false.

Issue: #I59UEB

Signed-off-by: lichenshuai <lichenshuai@huawei.com>
Change-Id: Ib0eb125dfdc7e0cdc34109fe810efd48861d443c
2022-05-30 10:16:13 +08:00
openharmony_ci aca7a57b0a !1376 Fix 262 of rsp on x64
Merge pull request !1376 from zhangyukun8/master
2022-05-23 11:24:51 +00:00
zhangyukun 9f15b59632 Fix 262 of rsp on x64
1. skip builtin frame and asm interpreter entry frame when upframe
2. skip push args when argc is 0
3. check thread exception, rather not ret value
4. deal with fp when entry Execute
5. deal with call class Constructor
Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I58I4H?from=project-issue

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I874f1437d5d21a8cf50a8d9ca73d7a92007f1bab
2022-05-23 18:42:48 +08:00
g00416891 ff9ad604fe optimize ExecuteNative frame
Change-Id: I2431fb150c160d8dc51d20a8dcc7ace74e09aa5b
Signed-off-by: g00416891 <guobingbing3@huawei.com>
2022-05-23 15:22:18 +08:00
hjzhangcm 7749f58a59 add test case for JSLocale and modify the file where the ICU configuration is located
Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
2022-05-19 11:36:54 +08:00
wengchangcheng 5585fc331a Descriptor: crash when death cycle
details: add default branch when frame type error
issue: https://gitee.com/openharmony/ark_js_runtime/issues/I57Y8Q

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: I857076e33f6b30d4fede33edf7e058cfba39b22f
2022-05-17 22:51:14 +08:00
zhangyukun 6e0a576021 Fix rsp frame callnative and generator
1. adaptor GetNumArgs
2. fix callnative irange
Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I57PDZ?from=project-issue

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: Ib9a07e2e05fae93eb169e69e79f0c91acca37600
2022-05-16 21:08:38 +08:00
sunzhe23 b2c4eeff24 Fix frame handler preInterpretedFrame bug
description:
preInterpretedFrame should skip non-interpreted frame first

issue: I57JNT

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-05-15 22:28:16 -07:00
sunzhe23 1984b8f251 Refactor asm interpreter call native
description:
use builtin frame refactor call native

issue: #I573S8

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-05-13 05:12:06 -07:00
zhangyukun ae2a7e5d9b exception handler supports rsp frame
1.add lastFp_ into GlueData to restore rsp in exception handler
2.add AsmInterpreterEntryFrame to exit Execute when use rsp
Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5733D?from=project-issue
Signed-off-by: zhangyukun <zhangyukun8@huawei.com>

Change-Id: Ia3c9301f3854b7d9cfb46dabbae82186b86348a3
2022-05-12 20:44:21 +08:00
guobingbing d8699d3ab9 modify annotation of InterpretedFrame
Signed-off-by: guobingbing <guobingbing3@huawei.com>
Change-Id: I1deb88080eb89e27252629d8501005d49fe76adf
2022-05-12 10:22:18 +08:00
guobingbing d91e970f3a fix frame handler cached function & pc bug
Signed-off-by: guobingbing <guobingbing3@huawei.com>
Change-Id: Icf4a8ae482fb0bfde28282050876ca33b72d2c6d
2022-05-10 20:33:27 +08:00
zhangyukun 48a3816571 Fix assembler rsp frame of x64 platform
1.Fix Andq error due to sign-extended of imm32
2.Enable asmInter option should be loaded before init stack
3.separate leave frame with interpreter frame
Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I56IZ4?from=project-issue

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I7bb4b5de71aab7dc8c6b657c70f97d738ebe1c2e
2022-05-10 10:18:14 +08: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
zhangyukun 25daaf26ef constuct entry frame of execute with rsp
1. add fp to support discontinuous frame gc and resume rsp
2. assemble execute and impl entry frame with rsp
3. use assembler to refactor .s
Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52BQE?from=project-issue

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I6966672dc065d63144fe7fa145ab76571189d540
2022-05-07 14:13:50 +08:00
hjzhangcm 3d42158184 fix codex waring
Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
2022-05-05 17:03:02 +08:00
openharmony_ci 70a73aac4f !1188 refactor class FrameHandler
Merge pull request !1188 from guobingbing/optimize
2022-05-04 07:24:17 +00:00
guobingbing 129ebdbf25 refactor class FrameHandler
Signed-off-by: guobingbing <guobingbing3@huawei.com>
Change-Id: I9f3ff0c04d34a31a34f21da637689eb61d4166f1
2022-05-04 10:36:44 +08:00
openharmony_ci 272cf6664d !1155 Refactor the GC related components - Part 4
Merge pull request !1155 from klooer/master
2022-04-30 09:45:48 +00:00
Yuqiang Xian c7e278f057 Tidy-up Heap class; re-organize the public methods by categories and add descriptions.
Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I551ZU

Signed-off-by: Yuqiang Xian <xianyuqiang@huawei.com>
2022-04-28 16:10:59 +08:00
sunzhe23 86a4019e1e BugFix for callNative's leave frame
description:
callNative build the wrong leave frame, witch will case gc crashed

issue: I55401

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-04-27 20:04:19 -07:00
openharmony_ci a22dcd4032 !1143 get prev interpreted frame of entry frame
Merge pull request !1143 from guobingbing/adapter-asm
2022-04-26 09:34:00 +00:00
guobingbing 3fcd42ecff get prev interpreted frame of entry frame
Signed-off-by: guobingbing <guobingbing3@huawei.com>
Change-Id: I6ed03ae55878790d4576499515a5973a700cd1ff
2022-04-26 15:59:03 +08: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
sunzhe23 528db23a05 Refactor leave&entry frame
issue: #I541LG

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
2022-04-23 23:35:51 -07:00
xiongluo 771d51b546 refactor jsMethod
1. Move necessary fileds in jsMethod
2. Make jsMethod inherit aligned struct
3. Change some function names for easy reading

Signed-off-by: xiongluo <xiongluo@huawei.com>
2022-04-20 23:17:00 -10:00
lichenshuai fdef2db319 Fix asm entry frame bug
Set leave frame to nullptr before Execute() and restore it after that to avoid endless loop.

Issue: #I53HAD

Signed-off-by: lichenshuai <lichenshuai@huawei.com>
Change-Id: Ib9504519c33932d4e0c7b0ad4a5a599a5564cbe0
2022-04-21 11:22:50 +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 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
guobingbing c01691c0bb entry frame adapter asm
Signed-off-by: guobingbing <guobingbing3@huawei.com>
Change-Id: Ied740af77e0f770e01f948c86b5f13d4877672ad
2022-04-15 18:23:40 +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 9af9aac86b !958 JSFunctionCall Trampoline
Merge pull request !958 from getingke/js_function_call_stub_formal
2022-04-11 14:03:09 +00: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
dingwen 1c70dfbc78 Add snapshot generation step for aot compiler and testing entry of aot compiled function.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4ZOXH
Signed-off-by: dingwen <dingwen6@huawei.com>

Change-Id: I2a52b06453f48407c418e57b3ce62e710042768b
2022-04-10 14:59:33 +08:00
Hailiang Hu c071531719 Add AOT Slowpath Lowering
Lowering for NEWLEXENVDYN, NEWLEXENVWITHNAMEDYN, POPLEXENVDYN.

Issue: I51VGS

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: I001c7bd23c03d2dbc0a1647a652c289204a8dc92
2022-04-09 19:35:17 +08:00
guobingbing 589234007e FFI optimization for call params
Signed-off-by: guobingbing <guobingbing3@huawei.com>
Change-Id: I61b820e91b85364e4f41d35ca0172ad059a1b916
2022-04-07 21:13:46 +08:00
lichenshuai fcda5bb413 Add AsmInterpreterFrame
Add AsmInterpreterFrame for ASM.

Issue: #I4YF9X

Signed-off-by: lichenshuai <lichenshuai@huawei.com>
Change-Id: I4efc781a9fca90de4a0aed5b6a91a8122cfa16ab
2022-03-30 10:51:05 +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 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