diff --git a/ecmascript/compiler/BUILD.gn b/ecmascript/compiler/BUILD.gn index 6f2078e6ea..ec8005ace5 100644 --- a/ecmascript/compiler/BUILD.gn +++ b/ecmascript/compiler/BUILD.gn @@ -203,7 +203,7 @@ source_set("ark_aot_compiler_set") { source_set("libark_stub_set") { deps = [ ":build_stub_to_cpp" ] - sources = [ "$root_gen_dir/arkcompiler/ets_runtime/stub_m.cpp" ] + sources = [ "$root_gen_dir/arkcompiler/ets_runtime/stub_aot.cpp" ] public_configs = [ "$js_root:ark_jsruntime_common_config", @@ -212,7 +212,7 @@ source_set("libark_stub_set") { } source_set("libark_mock_stub_set") { - sources = [ "mock/mock_stub_m.cpp" ] + sources = [ "mock/mock_stub_aot.cpp" ] public_configs = [ "$js_root:ark_jsruntime_common_config", @@ -278,10 +278,10 @@ action("gen_stub_file") { get_label_info(":ark_stub_compiler(${host_toolchain})", "root_out_dir") if (current_toolchain == host_toolchain) { - stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.m" + stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.aot" } else { - stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.m" + - " --target-triple=aarch64-unknown-linux-gnu" + stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) + + "/stub.aot" + " --target-triple=aarch64-unknown-linux-gnu" } args = [ @@ -301,11 +301,11 @@ action("gen_stub_file") { rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] - outputs = [ "$stub_file_gen_dir/stub.m" ] + outputs = [ "$stub_file_gen_dir/stub.aot" ] } action("build_stub_to_cpp") { - sources = [ "$root_gen_dir/arkcompiler/ets_runtime/stub.m" ] + sources = [ "$root_gen_dir/arkcompiler/ets_runtime/stub.aot" ] script = "$js_root/script/build_resource_to_cpp.py" @@ -313,10 +313,10 @@ action("build_stub_to_cpp") { args = [ "--input", - rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.m"), + rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.aot"), "--output", - rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub_m.cpp"), + rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub_aot.cpp"), ] - outputs = [ "$root_gen_dir/arkcompiler/ets_runtime/stub_m.cpp" ] + outputs = [ "$root_gen_dir/arkcompiler/ets_runtime/stub_aot.cpp" ] } diff --git a/ecmascript/compiler/aot_compiler.cpp b/ecmascript/compiler/aot_compiler.cpp index 3ffb302bed..15fea2059a 100644 --- a/ecmascript/compiler/aot_compiler.cpp +++ b/ecmascript/compiler/aot_compiler.cpp @@ -111,7 +111,7 @@ int Main(const int argc, const char **argv) break; } } - generator.SaveAOTFile(outputFileName); + generator.SaveAOTFile(outputFileName + ".aot"); generator.SaveSnapshotFile(); JSNApi::DestroyJSVM(vm); diff --git a/ecmascript/compiler/file_generators.cpp b/ecmascript/compiler/file_generators.cpp index 98b0863594..0f50c5baf8 100644 --- a/ecmascript/compiler/file_generators.cpp +++ b/ecmascript/compiler/file_generators.cpp @@ -109,8 +109,8 @@ void AOTFileGenerator::SaveSnapshotFile() CVector staticHClassTable = tsManager->GetStaticHClassTable(); CVector tsManagerSerializeTable(constStringTable); tsManagerSerializeTable.insert(tsManagerSerializeTable.end(), staticHClassTable.begin(), staticHClassTable.end()); - const CString snapshotPath(vm_->GetJSOptions().GetSnapshotOutputFile().c_str()); + const CString snapshotPath(vm_->GetJSOptions().GetAOTOutputFile().c_str()); snapshot.Serialize(reinterpret_cast(tsManagerSerializeTable.data()), tsManagerSerializeTable.size(), - snapshotPath); + snapshotPath + ".etso"); } } // namespace panda::ecmascript::kungfu diff --git a/ecmascript/compiler/llvm_codegen.h b/ecmascript/compiler/llvm_codegen.h index dd2d47fdb9..16d41c12f4 100644 --- a/ecmascript/compiler/llvm_codegen.h +++ b/ecmascript/compiler/llvm_codegen.h @@ -172,8 +172,8 @@ struct CodeInfo { } private: - static constexpr size_t REQUIRED_SECS_LIMIT = (1 << 20); // 1M - static constexpr size_t UNREQUIRED_SECS_LIMIT = (1 << 19); // 512K + static constexpr size_t REQUIRED_SECS_LIMIT = (1 << 24); // 16M + static constexpr size_t UNREQUIRED_SECS_LIMIT = (1 << 23); // 8M static constexpr int protRWX = PROT_READ | PROT_WRITE | PROT_EXEC; // NOLINT(hicpp-signed-bitwise) static constexpr int protRW = PROT_READ | PROT_WRITE; // NOLINT(hicpp-signed-bitwise) static constexpr int flags = MAP_ANONYMOUS | MAP_SHARED; // NOLINT(hicpp-signed-bitwise) diff --git a/ecmascript/compiler/mock/mock_stub_m.cpp b/ecmascript/compiler/mock/mock_stub_aot.cpp similarity index 85% rename from ecmascript/compiler/mock/mock_stub_m.cpp rename to ecmascript/compiler/mock/mock_stub_aot.cpp index 398585a51c..e106494c34 100644 --- a/ecmascript/compiler/mock/mock_stub_m.cpp +++ b/ecmascript/compiler/mock/mock_stub_aot.cpp @@ -14,5 +14,5 @@ */ #include -extern const uint8_t _binary_stub_m_start[1] = {0x0}; -extern const uint32_t _binary_stub_m_length = 1; \ No newline at end of file +extern const uint8_t _binary_stub_aot_start[1] = {0x0}; +extern const uint32_t _binary_stub_aot_length = 1; \ No newline at end of file diff --git a/ecmascript/ecma_vm.cpp b/ecmascript/ecma_vm.cpp index 15d1b86167..2662fb6a98 100644 --- a/ecmascript/ecma_vm.cpp +++ b/ecmascript/ecma_vm.cpp @@ -699,7 +699,7 @@ void EcmaVM::LoadStubFile() void EcmaVM::LoadAOTFiles() { - std::string file = options_.GetAOTOutputFile(); + std::string file = options_.GetAOTOutputFile() + ".aot"; LOG_ECMA(INFO) << "Try to load aot file" << file.c_str(); fileLoader_->LoadAOTFile(file); fileLoader_->LoadSnapshotFile(); diff --git a/ecmascript/file_loader.cpp b/ecmascript/file_loader.cpp index 222defd808..0c91da72ff 100644 --- a/ecmascript/file_loader.cpp +++ b/ecmascript/file_loader.cpp @@ -30,8 +30,8 @@ #include "ecmascript/js_thread.h" #include "ecmascript/snapshot/mem/snapshot.h" -extern const uint8_t _binary_stub_m_start[]; -extern const uint32_t _binary_stub_m_length; +extern const uint8_t _binary_stub_aot_start[]; +extern const uint32_t _binary_stub_aot_length; namespace panda::ecmascript { void ModuleSectionDes::SaveSectionsInfo(std::ofstream &file) @@ -155,11 +155,11 @@ bool StubModulePackInfo::Load(EcmaVM *vm) // by calling NewMachineCodeObject. // then MachineCode will support movable, code is saved to MachineCode and stackmap is saved // to different heap which will be freed when stackmap is parsed by EcmaVM is started. - if (_binary_stub_m_length <= 1) { - LOG_FULL(FATAL) << "stub.m length <= 1, is default and invalid."; + if (_binary_stub_aot_length <= 1) { + LOG_FULL(FATAL) << "stub.aot length <= 1, is default and invalid."; return false; } - BinaryBufferParser binBufparser((uint8_t *)_binary_stub_m_start, _binary_stub_m_length); + BinaryBufferParser binBufparser((uint8_t *)_binary_stub_aot_start, _binary_stub_aot_length); binBufparser.ParseBuffer(&entryNum_, sizeof(entryNum_)); entries_.resize(entryNum_); binBufparser.ParseBuffer(entries_.data(), sizeof(FuncEntryDes) * entryNum_); @@ -327,7 +327,8 @@ void FileLoader::LoadAOTFile(const std::string &fileName) void FileLoader::LoadSnapshotFile() { - const CString snapshotPath(vm_->GetJSOptions().GetSnapshotOutputFile().c_str()); + CString snapshotArg(vm_->GetJSOptions().GetAOTOutputFile().c_str()); + CString snapshotPath = snapshotArg + ".etso"; Snapshot snapshot(vm_); #if !defined(PANDA_TARGET_WINDOWS) && !defined(PANDA_TARGET_MACOS) snapshot.Deserialize(SnapshotType::TS_LOADER, snapshotPath); diff --git a/ecmascript/js_runtime_options.h b/ecmascript/js_runtime_options.h index 5a6c05f454..a9f2bb049f 100644 --- a/ecmascript/js_runtime_options.h +++ b/ecmascript/js_runtime_options.h @@ -69,7 +69,6 @@ public: parser->Add(&frameworkAbcFile_); parser->Add(&icuDataPath_); parser->Add(&startupTime_); - parser->Add(&snapshotOutputFile_); parser->Add(&enableRuntimeStat_); parser->Add(&typeInferVerify_); parser->Add(&builtinsDTS_); @@ -469,16 +468,6 @@ public: return startupTime_.WasSet(); } - std::string GetSnapshotOutputFile() const - { - return snapshotOutputFile_.GetValue(); - } - - void SetSnapshotOutputFile(std::string value) - { - snapshotOutputFile_.SetValue(std::move(value)); - } - bool EnableTypeInferVerify() const { return typeInferVerify_.GetValue(); @@ -519,8 +508,8 @@ private: PandArg enableCpuprofiler_ {"enable-cpuprofiler", false, R"(Enable cpuprofiler to sample call stack and output to json file. Default: false)"}; PandArg stubFile_ {"stub-file", - R"(stub.m)", - R"(Path of file includes common stubs module compiled by stub compiler. Default: "stub.m")"}; + R"(stub.aot)", + R"(Path of file includes common stubs module compiled by stub compiler. Default: "stub.aot")"}; PandArg enableForceGc_ {"enable-force-gc", true, R"(enable force gc when allocating object)"}; PandArg forceFullGc_ {"force-full-gc", true, @@ -529,8 +518,8 @@ private: PandArg gcThreadNum_ {"gcThreadNum", 7, R"(set gcThreadNum. Default: 7)"}; PandArg longPauseTime_ {"longPauseTime", 40, R"(set longPauseTime. Default: 40ms)"}; PandArg aotOutputFile_ {"aot-file", - R"(aot_file.m)", - R"(Path to AOT output file. Default: "aot_file.m")"}; + R"(aot_file)", + R"(Path (file suffix not needed) to AOT output file. Default: "aot_file")"}; PandArg targetTriple_ {"target-triple", R"(x86_64-unknown-linux-gnu)", R"(target triple for aot compiler or stub compiler. Possible values: ["x86_64-unknown-linux-gnu", "arm-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]. @@ -563,17 +552,18 @@ private: PandArg compilerLogOpt_ {"compiler-log", R"(none)", R"(log Option For aot compiler and stub compiler, - "none": no log, "allllircirasm": print llIR file, CIR log and asm log for all methods, - "allasm" : print asm log for all methods, - "cerllircirasm": print llIR file, CIR log and asm log for certain method defined in log-method-list, - "cerasm": print asm log for certain method defined in log-method-list, + "none": no log, + "allllircirasm or all012": print llIR file, CIR log and asm log for all methods, + "allcir or all0" : print cir info for all methods, + "allllir or all1" : print llir info for all methods, + "allasm or all2" : print asm log for all methods, + "cerllircirasm or cer0112": print llIR file, CIR log and asm log for certain method defined in 'mlist-for-log', + "cercir or cer0": print cir info for certain method illustrated in 'mlist-for-log', + "cerasm or cer2": print asm log for certain method illustrated in 'mlist-for-log', Default: "none")"}; PandArg methodsListForLog_ {"mlist-for-log", R"(none)", R"(specific method list for compiler log output, only used when compiler-log)"}; - PandArg snapshotOutputFile_ {"snapshot-output-file", - R"(snapshot)", - R"(Path to snapshot output file. Default: "snapshot")"}; PandArg enableRuntimeStat_ {"enable-runtime-stat", false, R"(enable statistics of runtime state. Default: false)"}; PandArg typeInferVerify_ {"typeinfer-verify", false, diff --git a/test/aottest/makefile b/test/aottest/makefile index 255cb93c30..a19422510f 100644 --- a/test/aottest/makefile +++ b/test/aottest/makefile @@ -76,7 +76,7 @@ test_dir=$(root_dir)/arkcompiler/ets_runtime/test/aottest ts2abc=$(product_dir)/clang_x64/obj/arkcompiler/ets_frontend/ts2panda/build/src/index.js out_dir=$(product_dir)/clang_x64/aottest case_dir=$(out_dir)/$(test_name) -com_stub_args=--asm-interpreter=true --stub-file=$(out_dir)/stub.m +com_stub_args=--asm-interpreter=true --stub-file=$(out_dir)/stub.aot abc: mkdir -p $(case_dir) @@ -84,24 +84,24 @@ abc: stub: mkdir -p $(out_dir) - $(stub_compiler) $(compiler_args) $(args) --stub-file=$(out_dir)/stub.m - + $(stub_compiler) $(compiler_args) $(args) --stub-file=$(out_dir)/stub.aot + aot: - $(compiler) $(compiler_args) $(args) --aot-file=$(case_dir)/aot_file.m $(subst $(space),:,$(wildcard $(test_dir)/$(test_name)/*.abc)) + $(compiler) $(compiler_args) $(args) --aot-file=$(case_dir)/aot_file.aot $(subst $(space),:,$(wildcard $(test_dir)/$(test_name)/*.abc)) aotd: - gdb --args $(compiler) $(compiler_args) $(args) --aot-file=$(case_dir)/aot_file.m $(subst $(space),:,$(wildcard $(test_dir)/$(test_name)/*.abc)) + gdb --args $(compiler) $(compiler_args) $(args) --aot-file=$(case_dir)/aot_file.aot $(subst $(space),:,$(wildcard $(test_dir)/$(test_name)/*.abc)) run: - $(qemu) $(jsvm) $(args) --aot-file=$(case_dir)/aot_file.m $(com_stub_args) $(test_dir)/$(test_name)/$(test_name).abc + $(qemu) $(jsvm) $(args) --aot-file=$(case_dir)/aot_file.aot $(com_stub_args) $(test_dir)/$(test_name)/$(test_name).abc rund: ifeq ($(arm), no) - gdb --args $(jsvm) $(args) --aot-file=$(case_dir)/aot_file.m $(com_stub_args) $(test_dir)/$(test_name)/$(test_name).abc + gdb --args $(jsvm) $(args) --aot-file=$(case_dir)/aot_file.aot $(com_stub_args) $(test_dir)/$(test_name)/$(test_name).abc else @echo "gdb-client start: gdb-multiarch $(jsvm)" @echo "gdb-server connect: target remote:123456" - $(qemu) -cpu max,sve=off -g 123456 $(jsvm) $(args) --aot-file=$(case_dir)/aot_file.m $(com_stub_args) $(test_dir)/$(test_name)/$(test_name).abc + $(qemu) -cpu max,sve=off -g 123456 $(jsvm) $(args) --aot-file=$(case_dir)/aot_file.aot $(com_stub_args) $(test_dir)/$(test_name)/$(test_name).abc endif int: diff --git a/test/test_helper.gni b/test/test_helper.gni index d65473e116..3a6c404506 100644 --- a/test/test_helper.gni +++ b/test/test_helper.gni @@ -264,8 +264,9 @@ template("host_aot_test_action") { _test_ts_path_ = "./${_target_name_}.ts" _test_abc_path_ = "$target_out_dir/${_target_name_}.abc" - _test_m_path_ = "$target_out_dir/${_target_name_}.m" - _test_snapshot_path_ = "$target_out_dir/snapshot" + _test_aot_path_ = "$target_out_dir/${_target_name_}.aot" + _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.etso" + _test_aot_arg_ = "$target_out_dir/${_target_name_}" _test_expect_path_ = "./expect_output.txt" ts2abc_gen_abc("gen_${_target_name_}_abc") { @@ -297,9 +298,7 @@ template("host_aot_test_action") { script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" - _aot_compile_options_ = - " --aot-file=" + rebase_path(_test_m_path_) + - " --snapshot-output-file=" + rebase_path(_test_snapshot_path_) + _aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) args = [ "--script-file", @@ -320,8 +319,8 @@ template("host_aot_test_action") { inputs = [ _test_abc_path_ ] outputs = [ - _test_m_path_, - _test_snapshot_path_, + _test_aot_path_, + _test_aot_snapshot_path_, ] } @@ -341,9 +340,7 @@ template("host_aot_test_action") { script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = - " --aot-file=" + rebase_path(_test_m_path_) + - " --snapshot-output-file=" + rebase_path(_test_snapshot_path_) + - " --asm-interpreter=true" + " --aot-file=" + rebase_path(_test_aot_arg_) + " --asm-interpreter=true" if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) {