Optimize calculating dominator tree in bc2circuit builder and fix a bug.
Signed-off-by: Yuyicen <1790899756@qq.com>
Change-Id: I80b432ecf7099f3a50706d4971ff362f5c226ea4
1、Solve the IR error problem generated by Aot. Aot uses subgraphs to
replace HIR considering whether the current use node is value input,
if it is value input, replace value.
2、fix LDSUPERBYNAME_PREF_ID32_V8 and STSUPERBYNAME_PREF_ID32_V8
Instruction CallRuntime bug by aot jsFunc.
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5I300
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I87c4000a0b7fb2abe41b217364c5ace3d1129c1e
Description:
Currently the type system stores the typeId inside tsTypes,
where typeId is obtained directly from abc-file.
This causes many redundant operations and complicates the process.
In order to make the code more concise and to support
the builtin types and types from multiple files,
we need to make some changes on parsing tsTypes.
1. add the class TSTypeParser and hide the detail of the conversion from the typeId in abc-files to GlobalTSTypeRef in it
2. store GlobalTSTypeRef in tsTypes instead of storing typeId obtained directly from abc-files
3. remove typeKind from the raw data of GlobalTSTypeRef and modify the way to get the typeKind of a GlobalTSTypeRef to get from its tsType
4. uniform some naming and modify some interfaces to adapt the above changes
5. rename TSLoader to TSManager
Issue:
https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5ILFP
Tests:
tstype test, aot test, typeinfer test
Change-Id: Ic5e5edaf40ca5d6c260676111acdee6d4b86472a
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
1.Handle the situation which constant gate is at the end of current block
2.Handle import/export in Multiple files for TSAOT
3.Handle try-catch-finally
4.Handle conditionJump with only one successor
5.Handle try block without instructions which can throw exception
6.Handle LoopBack Verify Error
7.Add UT case for try-catch-finally
8.Handle getModule Error in Aot compile
9.Handle block endwith Constant gate
10.Bugfix for NewObj returnValue Error when need to throw Exception
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5F6JT
Signed-off-by: lijincheng <lijincheng13@huawei.com>
To make the architecture more clear, any operations of Gates should be
performed via GateAccessor rather than inovking the low-level interfaces
of class Circuit. Therefore, most of these low level interfaces will be
decorated with private, which are only allowed to access by the closed
friend classes Verify and GateAccessor.
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5HYU4
Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: Ied02743ee88b71d287bcfd1013487781e7adba6e
1. Modify the number of control streams and data streams at the same time.
2. handle phi generated from multiple control flow in the same source block
In the try catch block, add the phi node of the virtual register to resolve
the IR value input that is not reasonable due to the exception problem.
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5HEYR
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I98f25a0641338d778e1b53b18db47a171ad003cb
To make the architecture more clear, any operations of Gates should be
performed via GateAccessor rather than inovking the low-level interfaces
of class Circuit. Therefore, most of these low level interfaces will be
decorated with private, which are only allowed to access by the closed
friend classes Verify and GateAccessor.
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5HNQ4
Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com>
Change-Id: I184b5473ae179aedce83de59cd8f5a662b719d43
Description:
To adapt changes of type system in abc file
1.In TSLoader, change the key of the type map from virtual registers to instruction orders and get the whole table instead of getting one type at one time.
2.In BytecodeCircuitBuilder, extract the prosess of setting gate types into a separate module and get gate types from type table by instruction orders.
Issue:
https://gitee.com/openharmony/ark_js_runtime/issues/I5FNGC
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
Change-Id: Ia4683ddd7513e866a9abce5d98aed5c482946c96
Context is not saved when processing SUSPENDGENERATOR and RESUMEGENERASTOR
instructions, and contextual execution cannot be restored.
1、Add SAVE_REGISTER HIR for saving context
2、RESTORE_REGISTER HIR for restoring context
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5B2QO
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I16b73390c6f7ae7c295f0aa1a9c9df538c2a4fec
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
Description:
1.Fix the bug that Circuit IR args gates do not match the function args of the abc file.
2.Add class ArgumentAccessor to handle args gates of Circuit IR.
3.Modify to set the AOT function entry when constpool is being parsed.
4.For functions sharing the same instructions, add a map to collect duplicate infomation. The key of the map is the current method and the value is the first method with the same nstructions to be translated.
Issue:
https://gitee.com/openharmony/ark_js_runtime/issues/I5DA6V
Change-Id: I08e48444eb22c4fc2841e1cdae44b90286de84ac
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
1.For callee func with variable-length arguments,Aot only receive the first one in variable-length arguments.
So Change to get all args from OptimizedJsFunctionFrame in JsCall
2.Add path to get all args from OptimizedJsFunctionFrame to GetUnmappedArgs.
3.Fix ThrowIfNotObject error found in aottest case getiterator.ts
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I57L70
Signed-off-by: lijincheng <lijincheng13@huawei.com>
Fix AOT segfault issue
Two problems are identified and solved:
1. JS Bytecode to Circuit IR module:
A new bug was introduced from the recent refactoring. The sub-procedure NewPhi should create a new selector gate on the Circuit IR immediately (before calling the function RenameVariable), otherwise, the sub-procedure NewPhi (on the same basic block) could be called again after some recursions while nothing on that basic block is changed, leading to infinite recursion and stack overflow. The bug can be triggered when the CFG of the program to compile has a cycle and meet certain non-trivial conditions.
2. Circuit IR to LLVM IR module:
The signature of a stub function may have parameters with GC-related types (like JS_ANY) but the passed arguments can have not-GC-related types (like JS_NUMBER). The corresponding LLVM types of the passed arguments will be incompatible with the function signature in this case, so bit casts and address space casts should be used to convert the function arguments to match the types of parameters in the function signature.
Signed-off-by: Mingliang Zeng <zengmingliang1@huawei.com>
Description:
1.Add type infer test cases for bitwise_op, callfunctions, ldobjbyvalue and logic_op
Issue:
https://gitee.com/openharmony/ark_js_runtime/issues/I5B78L
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
Change-Id: I486f6f91a32e1c7caa2446b12b8e6b33db8d47fe
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
Add judement in DecodeTSTypes and GetGateType, to support compiling js
files in AOT.
Add pf_ as a member of BytecodeCircuitBuilder.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5AZJV
Signed-off-by: ding <dingding5@huawei.com>
Change-Id: Ia16039e0ba455c6618fec3691c3089067a508373
1.Re-write union type mechanism, store gt in components.
2.Refactor module tabale, now builtins type table and global infer table set in fixed index of 0 and 1.
3.Integrate some interfaces and logic.
Signed-off-by: ding <dingding5@huawei.com>
Change-Id: Ie709705798b21206f1f272fc5cacafb3781ed940
1.Fix aot newobjdynrange by call JSFunction::Construct.
2.Add native new test case(new non-native constructor depends on
`defineclass`).
3.Add StackAssertScope in debug mode.
4.Delete retired `call` code in runtime_stubs.
5.Refactor GetArg from macros to inline function in RuntimeStubs.
Signed-off-by: ding <dingding5@huawei.com>
Change-Id: Ic89b98af11f2e2fc97aaeba1704d27a95d2c0c7b
1. The unified callruntime parameter type is tagged.
2. Remove the glue parameter contained in callruntime.
3. Add Ldbigint support in bytecode circuitbuilder.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5640U
Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: If6fb9047dcb6f109e7c2e379415a968d438cb3ff
1.Add aot test case: CreateEmptyArray and CreateEmptyObject and add them to Aot UT-Test.
2.fix "thisobj and input args" bug of callIThisRangeDyn.
3.Update LowerLdGlobalVar and LowerLdObjByName in lowering.
4.fix "callruntime" bug in lowering of LowerStObjByIndex.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I550RE
Signed-off-by: lijincheng <lijincheng13@huawei.com>
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>
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
1.Fix bugs found in AOT Running Debug
2.Change GetObjectFromConstPool to " callRuntime LoadValueFromConstantStringTable "
in lowering for getting correct string in constpool when in-value-gate in irbuilder is "StringId"
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52SFH
Signed-off-by: lijincheng <lijincheng13@huawei.com>
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
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
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
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
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
The type of the circuit gate of the current ts aot is JS_ANY, which does
not bring the data type of the ts itself. It is necessary to fill in the
type information of the ts with the gate to facilitate the type derivation.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WLE8
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I5c72e3a918650840847fc965eafbb13b9475acd2
Replace all JS_BYTECODE in HIR. In order to simplify the code
implementation, no type judgment is made on the input, and the
slowpath is directly implemented by calling the trampoline function
without affecting the original function. For complex function
implementation, directly encapsulate the entire interpreted code as
a trampoline function.
Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: Icd24f7cebb496e4376170784ce1e2e2ef1a7ee71
The exception object is passed directly as a value inside the IR
will cause acc to generate many phi nodes (other vreg rarely generate
phi nodes when exceptions are handled). The current modification
is to add a GET_EXCEPTION directive (placed at the beginning of
the catch part) to indicate that the exception object is read after
an exception occurs, in this case lowering is simpler and does not
need to consider different value outputs, the logic is more concise
and the number of code instructions is reduced.
Replace ladi and fdai HIR with MIR: these two instructions to get
the immediate number, do not need to use HIR to handle, this will
increase the number of HIR instructions, simplify lowering.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4T6HX
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I751677e11b50976af4e2fc5a6cac4457fa9a44df
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
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
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