60 Commits

Author SHA1 Message Date
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
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
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
hjzhangcm c47eac9550 fix codeCheck warning
Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
Change-Id: Ie8ccede04ab2a7771439657fd8166b39c9dd0e4e
2022-05-12 09:50:21 +08:00
wuzhefeng f091b49f2c Refactor Compilaton Framework Part-1
Because the Stubs and CircuitBuilder share many common components like
Labels, Environment, and Variables, this PR remove the ones inside Stub
and replace them with CiircuitBuilder's.

Issue:https://e.gitee.com/open_harmony/dashboard?issue=I55P3C

Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: I5bc3672a371f7f2e749741e699b80fd466905dc8
2022-05-10 07:33:11 -07:00
Hailiang Hu f532af41e1 AOT Lowering bug fix for newlexenv and poplexenv
1. Add SetCurrentLabel on build loop to fix newlexenv and poplexenv test compile.
2. Add value input on CallRuntime to fix throwundefindeifhole lowering.

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

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: I5a4e9e026b86038153212bc6fa97cad8a54fbaea
2022-05-07 21:16:07 +08:00
lifansheng 295d5db32b issue:I55TH8
modify JSTaggedValue which disconnect TaggedValue inheritance

Signed-off-by: lifansheng <lifansheng1@huawei.com>
Change-Id: I13b990baf5284e58e83ab6b14847df076f42bed8
2022-05-05 16:54:26 +08:00
taohong d1bd1c9d29 test ldglobalvar && stlettoglobalrecord
Signed-off-by: taohong <hongtao11@huawei.com>
Change-Id: Iaab862583e6ba5505b0c87665292f410d53905f4
2022-04-27 16:12:05 +08: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 3f031e486a !1118 fix codex waring【part 2】
Merge pull request !1118 from zhaozhibo/master
2022-04-25 10:09:31 +00: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 ecf5fd6eb0 Refactor Logical shift operation
the logical shift does't care signed/unsigned.sometime using UINTxx/Intxx, which is very confusing.

logical operation don't distinguish with int/uint and remove Archxx function

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

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Idaf71b46227917d2cb08c35118e71c2a66b79fd3
2022-04-21 20:08:23 +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 c089b204e8 AOT Refactor for CircuitBuilder and Slowpath
1. Remove low level CircuitBuilder, make flat of this interface.
2. Move some interface of LabelManager to CircuitBuilder, and rename to Environment.
3. Refactor some interface of MergeMirCircuit, LowerHirToCall,
   LowerHirToConditionCall and so on.

Issue: #I52VPJ

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: Ib8f20e7137c8006a0735cefea9fe243513744652
2022-04-15 21:01:01 +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
lijincheng 98e9ee462d Aot Lowering
1.lower GETNEXTPROPNAME_PREF_V8, COPYDATAPROPERTIES_PREF_V8_V8, CREATEOBJECTWITHEXCLUDEDKEYS_PREF_IMM16_V8_V8
      CREATEREGEXPWITHLITERAL_PREF_ID32_IMM8, STOWNBYVALUE_PREF_V8_V8, STOWNBYINDEX_PREF_V8_IMM32, STOWNBYNAME_PREF_ID32_V8
      DEFINEGENERATORFUNC_PREF_ID16_IMM16_V8, DEFINEASYNCFUNC_PREF_ID16_IMM16_V8, COPYMODULE_PREF_V8

2.move CompilationConfig to CircuitBuilder. Enable aot's ability to identify platform differences.

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

Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-04-07 10:30:33 +08:00
wuzhefeng 1e2aa2a487 Refactor Code
Because there are some redundant/unused/improper functions, this PR
remove them and improve the readability.

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

Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: Ifa08f33a2819f3113234fdbf3ee2bb0e976d4071
2022-03-31 16:16:31 -07: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
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
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
openharmony_ci d1fab2d5ea !792 Refactor of runtime stub, optimizer stub and bytecode handler define mechanism
Merge pull request !792 from luochuhao/stubmoduleModify
2022-03-18 15:14:45 +00: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
Hailiang Hu e12e961b3e Add throw related lowering
Support GET_EXCEPTION, THROWDYN_PREF, THROWCONSTASSIGNMENT_PREF_V8, and so on.

Issue: I4XZXC

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: Ide2fff6dad1f9d7312db4b6133649a5fb651b14b
2022-03-18 15:16:46 +08:00
xujie 71bf2ff5c5 Add AOT call lowering and refactor trampoline function
lowering HIR related to call, including CallArg0Dyn, CallArg1Dyn, CallArgs2Dyn, CallArgs3Dyn,
CallIThisRangeDyn, CallSpreadDyn,CallIRangeDyn. Currently only native call are supported.
Inline slowpath function in trampoline file.

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

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: I4525f62c5b9307adb5cf323352695e4db98fae1b
2022-03-16 15:38:07 +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
openharmony_ci 0cc57d2d60 !697 Add JS Function Entry frame & LeaveFrame for arm32
Merge pull request !697 from getingke/arm32_js_frame
2022-03-10 05:13:13 +00:00
lijincheng a0c0ca7094 compile bugfix
add new file circuit_builder-inl for extracting methods from stub
fix code check
Signed-off-by: lijincheng <lijincheng13@huawei.com>

Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-03-09 10:57:44 +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
Mingliang Zeng 2c9fb31103 Related issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4VSUH
Modifications:

* Rename StubMachineType to VariableType
* Remove the information about signed/unsigned
* VariableType is a class that bundled MachineType and GateType (not an enumerator anymore)

Signed-off-by: Mingliang Zeng <zengmingliang1@huawei.com>
2022-03-01 18:54:11 +08:00
zhangyukun 992f3291a4 Fix generating .m error in debug mode
1. Add machineType when return type is FLEX
2. Cmp ops should have the same op type

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I3c0e417b8f9cd7f792e3ff909bf1fab8afabb238
2022-02-24 11:15:32 +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 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
luochuhao 3384df5edb Add new Gate opcode: relocatable data and related llvm IR translation.
issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4T3DT?from=project-issue
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I06b0a8d9da52f3197b50fcd9807f7f194502437d
2022-02-16 11:02:52 +08:00
songzhengchao 2f2525b90f implement machineType INT* FLOAT* rename to I* and F*
current machineType INT * FLOAT* confuse people to associate UINT*.
the INT* is simlar with LLVM IR too
we reanme  machineType INT* FLOAT* rename to I* and F*

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

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ie188e07039cd9f26aed436ce96618ea4143fccd6
2022-02-10 15:51:18 +08:00
wanyanglan 5fc124da79 Redefine the layout of TypeCode to accommodate MIR, TS types
The current TypeCode is only used to represent the type of the MIR
and cannot represent the TS type data type. The type derivation
process needs to get the TS type information from the circuit ir.

Redefining the layout of TypeCode

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

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I53292db81712b84210114f9f92c44b6236c356af
2022-01-30 11:03:57 +08:00
wanyanglan 01a613ecac independent running ts aot
ts aot should be a separate part that needs to generate the
corresponding file before executing xxx.abc and should not
depend on the execution of xxx.abc

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

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I4ed7d7ee5528dcb479e08486f332a48c16ea88d7
2022-01-26 15:22:50 +08:00
wanyanglan 51ecdc254f review comments revision
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4RP3H

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: Ic7edae930dc9e206c66cd453040c789f2a6b49d3
2022-01-26 11:33:05 +08:00
wanyanglan 4060601168 refactoring circuit ir
The current circuit ir is translated to llvm ir according to the type of opcode,
and depends on different platforms. circuit ir, as an intermediate state from MIR
to LLVM IR, only performs the conversion role and should not depend on different
platforms for different conversion operations.

The uniqueness of the opcode is removed, and the opcode is combined with a valuecode,
which indicates the uniqueness of each MIR.

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4RP3H
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I2804e7ba9be58fcc4acf3d95a417224b7984018a
2022-01-26 11:33:05 +08:00
Mingliang Zeng d8142ffc43 circuit builder
Implemented circuit ir builder based on the SSA information generated by
previous processes, according to the specification of circuit ir.

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

Signed-off-by: Mingliang Zeng <zengmingliang1@huawei.com>
Change-Id: I23d4f88d2f5b8164e6f31f0d0092a1dcbc55d976
2022-01-26 11:32:54 +08:00
xliu aa2409e00f 1.add arraylist and ArkPrivate. 2.add special container in stub. 3.fix Switch
Signed-off-by: xliu <liuxin259@huawei.com>
Change-Id: I4082326fa075bce0c5c7bf8e6873282086fe5d6e
2022-01-04 19:30:40 +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
songzhengchao bde47ee986 code review
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
2021-11-01 15:43:46 +08:00