!1947 Change general aot file suffix and simplify related runtime option

Merge pull request !1947 from luochuhao/rename
This commit is contained in:
openharmony_ci 2022-08-02 02:30:16 +00:00 committed by Gitee
commit 9b62dc080b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 52 additions and 64 deletions

View File

@ -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" ]
}

View File

@ -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);

View File

@ -109,8 +109,8 @@ void AOTFileGenerator::SaveSnapshotFile()
CVector<JSTaggedType> staticHClassTable = tsManager->GetStaticHClassTable();
CVector<JSTaggedType> 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<uintptr_t>(tsManagerSerializeTable.data()), tsManagerSerializeTable.size(),
snapshotPath);
snapshotPath + ".etso");
}
} // namespace panda::ecmascript::kungfu

View File

@ -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)

View File

@ -14,5 +14,5 @@
*/
#include <cstdint>
extern const uint8_t _binary_stub_m_start[1] = {0x0};
extern const uint32_t _binary_stub_m_length = 1;
extern const uint8_t _binary_stub_aot_start[1] = {0x0};
extern const uint32_t _binary_stub_aot_length = 1;

View File

@ -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();

View File

@ -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);

View File

@ -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<bool> enableCpuprofiler_ {"enable-cpuprofiler", false,
R"(Enable cpuprofiler to sample call stack and output to json file. Default: false)"};
PandArg<std::string> 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<bool> enableForceGc_ {"enable-force-gc", true, R"(enable force gc when allocating object)"};
PandArg<bool> forceFullGc_ {"force-full-gc",
true,
@ -529,8 +518,8 @@ private:
PandArg<uint32_t> gcThreadNum_ {"gcThreadNum", 7, R"(set gcThreadNum. Default: 7)"};
PandArg<uint32_t> longPauseTime_ {"longPauseTime", 40, R"(set longPauseTime. Default: 40ms)"};
PandArg<std::string> 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<std::string> 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<std::string> 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<std::string> methodsListForLog_ {"mlist-for-log",
R"(none)",
R"(specific method list for compiler log output, only used when compiler-log)"};
PandArg<std::string> snapshotOutputFile_ {"snapshot-output-file",
R"(snapshot)",
R"(Path to snapshot output file. Default: "snapshot")"};
PandArg<bool> enableRuntimeStat_ {"enable-runtime-stat", false,
R"(enable statistics of runtime state. Default: false)"};
PandArg<bool> typeInferVerify_ {"typeinfer-verify", false,

View File

@ -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:

View File

@ -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) {