Commit Graph

77 Commits

Author SHA1 Message Date
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
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
y00576111 a1796a573e EcmaScript Standard Module Implementation
Delete the existing module implementation and
re implement the module function according to the ECMA 2018 specification

issue: #I4NZQT [https://gitee.com/openharmony/ark_ts2abc/issues/I4NZQT]

Signed-off-by: y00576111 <yaojian16@huawei.com>
Change-Id: I8d381db7f8bf2f3d6b2a5c21cbc3cbab1aef0b9b
2022-03-10 19:10:42 +08:00
songzhengchao 9b6965c724 delete patchpointid replace with return address
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I1a92f226571273e9ecdd713a378ad977a2f4667f
2022-03-08 17:28:21 +08:00
getingke b1f48f1332 fixed for debug js_frame ok and revert test code
issue:[Add JSFunction EntryFrame & LeaveFrame for arm32](https://gitee.com/openharmony/ark_js_runtime/issues/I4WRJP?from=project-issue)

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Ia688bbec9825ec9ebe0e7dcd7da47af1317f1fb8
2022-03-08 11:11:46 +08:00
getingke 3d7db6a563 fixed for get stackmap with returnaddress
issue:[Add JSFunction EntryFrame & LeaveFrame for arm32](https://gitee.com/openharmony/ark_js_runtime/issues/I4WRJP?from=project-issue)

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Ie034eebf3e1f3c461dc35168756564aaa708602d
2022-03-08 11:09:05 +08:00
getingke ce112c3182 fixed for arm32 js frame
issue:[Add JSFunction EntryFrame & LeaveFrame for arm32](https://gitee.com/openharmony/ark_js_runtime/issues/I4WRJP?from=project-issue)
Signed-off-by: getingke <getingke@huawei.com>

Change-Id: If65fd5064fa3c626f8f0ae3bae550465414af5e7
2022-03-08 11:01:20 +08:00
ding c2ad32ebcc Stackless optimalize new operation, including BuiltinsConstructor new and the most common new with callType is HAVE_THIS
Signed-off-by: ding <dingding5@huawei.com>
2022-03-01 20:10:20 +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
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 a8d17968e1 fixed for compile error
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Ia0a640d5dceb07faf18e8b383fde76fd272948f3
2022-02-21 17:13:33 +08:00
getingke 37a71fde93 fixed for rewrite patch id for runtime call
Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Ie4a76fb481a548d356450b79c55ed5d3c28b86b0
2022-02-21 15:32:29 +08:00
songzhengchao 4cb6be66ed fixed for arm64 test mod.abc slowpath ok
add set thread current sp when leave aot frame

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I18813879c9512a91f7f38ae07b211190d2e6daed
2022-02-18 17:58:06 +08:00
songzhengchao a34e803eba review modify
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: If645dd22a900cebb06c355d921389e90a2e516dc
2022-01-24 20:31:38 +08:00
songzhengchao 7c7ca08440 code review modify
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I1523067831240b65a442cf392327c5df4708a130
2022-01-24 15:36:24 +08:00
songzhengchao 23aba2a1bb frame refactor
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ic35799a8e6c61e51f72b0fa19d63ea1720033481
2022-01-22 16:46:01 +08:00