Aot 262 bugfix and test script modification

1. Aot avoid GetIterator to execute asm interpreter.
2. Modify file path in test script.

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5WCT0

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: Ibdf06e252817844987b7d1450d0d1d06a1ec8030
This commit is contained in:
xujie 2022-10-18 16:16:20 +08:00
parent 83e5d625b5
commit 7a6c625da5
4 changed files with 34 additions and 9 deletions

View File

@ -403,13 +403,24 @@ JSTaggedValue EcmaVM::InvokeEcmaAotEntrypoint(JSHandle<JSFunction> mainFunc, JSH
const JSPandaFile *jsPandaFile)
{
aotFileManager_->UpdateJSMethods(mainFunc, jsPandaFile);
std::vector<JSTaggedType> args(7, JSTaggedValue::Undefined().GetRawData()); // 7: number of para
args[0] = mainFunc.GetTaggedValue().GetRawData();
args[2] = thisArg.GetTaggedValue().GetRawData(); // 2: parameter of this
size_t argsNum = 7; // 7: number of para
JSTaggedType newTarget = thread_->GlobalConstants()->GetUndefined().GetRawData();
JSTaggedType thisValue = thisArg.GetTaggedValue().GetRawData();
JSTaggedValue res = ExecuteAot(argsNum, mainFunc, newTarget, thisValue);
return res;
}
JSTaggedValue EcmaVM::ExecuteAot(size_t argsNum, JSHandle<JSFunction> &callTarget, JSTaggedType newTarget,
JSTaggedType thisArg)
{
std::vector<JSTaggedType> args(argsNum, JSTaggedValue::Undefined().GetRawData());
args[0] = callTarget.GetTaggedValue().GetRawData();
args[1] = newTarget;
args[2] = thisArg; // 2: parameter of this
auto entry = thread_->GetRTInterface(kungfu::RuntimeStubCSigns::ID_JSFunctionEntry);
JSTaggedValue env = mainFunc->GetLexicalEnv();
Method *method = mainFunc->GetCallTarget();
args[6] = env.GetRawData(); // 6: last arg is env.
JSTaggedValue env = callTarget->GetLexicalEnv();
Method *method = callTarget->GetCallTarget();
args[argsNum - 1] = env.GetRawData();
auto res = reinterpret_cast<JSFunctionEntryType>(entry)(thread_->GetGlueAddr(),
reinterpret_cast<uintptr_t>(thread_->GetCurrentSPFrame()),
static_cast<uint32_t>(args.size()) - 1,

View File

@ -484,6 +484,9 @@ public:
{
return quickFixManager_;
}
JSTaggedValue ExecuteAot(size_t argsNum, JSHandle<JSFunction> &callTarget, JSTaggedType newTarget,
JSTaggedType thisArg);
protected:
void HandleUncaughtException(TaggedObject *exception);

View File

@ -1114,6 +1114,16 @@ JSTaggedValue RuntimeStubs::RuntimeGetIterator(JSThread *thread, const JSHandle<
if (!valuesFunc->IsCallable()) {
return valuesFunc.GetTaggedValue();
}
JSHandle<JSFunction> funcHandle = JSHandle<JSFunction>::Cast(valuesFunc);
Method *method = funcHandle->GetCallTarget();
if (method->IsAotWithCallField()) {
size_t argsNum = 4; // 4: number of args
JSTaggedType newTarget = thread->GlobalConstants()->GetUndefined().GetRawData();
JSTaggedType thisArg = obj.GetTaggedValue().GetRawData();
auto res = thread->GetEcmaVM()->ExecuteAot(argsNum, funcHandle, newTarget, thisArg);
return res;
}
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, valuesFunc, obj, undefined, 0);
return EcmaInterpreter::Execute(info);

View File

@ -135,11 +135,12 @@ class ArkTest():
f'{product_dir}/clang_x64/thirdparty/icu/:'
f'{product_dir}/clang_x64/arkcompiler/ets_runtime')
libs_dir = [[libs_dir_x64_release, libs_dir_x64_debug], [libs_dir_arm64_release, libs_dir_arm64_debug]]
bins_dir = [['clang_x64/ark', 'clang_x64/exe.unstripped/clang_x64/ark'], ['ark', 'exe.unstripped/ark']]
bins_dir = [['clang_x64/arkcompiler', 'clang_x64/exe.unstripped/clang_x64/arkcompiler'],
['arkcompiler', 'exe.unstripped/arkcompiler']]
icu_arg = f'--icu-data-path={self.ohdir}/third_party/icu/ohos_icu4j/data'
self.libs_dir = libs_dir[args.arm64][args.debug]
self.compiler = f'{product_dir}/{bins_dir[0][args.debug]}/ark_js_runtime/ark_aot_compiler'
self.jsvm = f'{product_dir}/{bins_dir[args.arm64][args.debug]}/ark_js_runtime/ark_js_vm'
self.compiler = f'{product_dir}/{bins_dir[0][args.debug]}/ets_runtime/ark_aot_compiler'
self.jsvm = f'{product_dir}/{bins_dir[args.arm64][args.debug]}/ets_runtime/ark_js_vm'
self.ts2abc = f'{product_dir}/clang_x64/arkcompiler/ets_frontend/build/src/index.js'
self.aot_args = ''
self.jsvm_args = icu_arg