!1589 Deal with the "use after free" error occurs while debugging ark_js_vm executable on windows.

Merge pull request !1589 from Gongyuhang/master
This commit is contained in:
openharmony_ci
2022-06-14 12:03:48 +00:00
committed by Gitee
2 changed files with 34 additions and 29 deletions
+23 -20
View File
@@ -110,29 +110,32 @@ int Main(const int argc, const char **argv)
return -1;
}
LocalScope scope(vm);
std::string entry = entrypoint.GetValue();
arg_list_t pandaFileNames = files.GetValue();
std::string triple = runtimeOptions.GetTargetTriple();
std::string outputFileName = runtimeOptions.GetAOTOutputFile();
size_t optLevel = runtimeOptions.GetOptLevel();
BytecodeStubCSigns::Initialize();
CommonStubCSigns::Initialize();
RuntimeStubCSigns::Initialize();
{
LocalScope scope(vm);
std::string entry = entrypoint.GetValue();
arg_list_t pandaFileNames = files.GetValue();
std::string triple = runtimeOptions.GetTargetTriple();
std::string outputFileName = runtimeOptions.GetAOTOutputFile();
size_t optLevel = runtimeOptions.GetOptLevel();
BytecodeStubCSigns::Initialize();
CommonStubCSigns::Initialize();
RuntimeStubCSigns::Initialize();
std::string logMethods = vm->GetJSOptions().GetlogCompiledMethods();
AotLog log(logMethods);
AOTFileGenerator generator(&log, vm);
PassManager passManager(vm, entry, triple, optLevel, &log);
for (const auto &fileName : pandaFileNames) {
COMPILER_LOG(INFO) << "AOT start to execute ark file: " << fileName;
if (passManager.Compile(fileName, generator) == false) {
ret = false;
break;
std::string logMethods = vm->GetJSOptions().GetlogCompiledMethods();
AotLog log(logMethods);
AOTFileGenerator generator(&log, vm);
PassManager passManager(vm, entry, triple, optLevel, &log);
for (const auto &fileName : pandaFileNames) {
COMPILER_LOG(INFO) << "AOT start to execute ark file: " << fileName;
if (passManager.Compile(fileName, generator) == false) {
ret = false;
break;
}
}
generator.SaveAOTFile(outputFileName);
generator.GenerateSnapshotFile();
}
generator.SaveAOTFile(outputFileName);
generator.GenerateSnapshotFile();
JSNApi::DestroyJSVM(vm);
paParser.DisableTail();
return ret ? 0 : -1;
+11 -9
View File
@@ -109,16 +109,18 @@ int Main(const int argc, const char **argv)
return -1;
}
LocalScope scope(vm);
std::string entry = entrypoint.GetValue();
{
LocalScope scope(vm);
std::string entry = entrypoint.GetValue();
arg_list_t fileNames = files.GetValue();
for (const auto &fileName : fileNames) {
auto res = JSNApi::Execute(vm, fileName, entry);
if (!res) {
std::cerr << "Cannot execute panda file '" << fileName << "' with entry '" << entry << "'" << std::endl;
ret = false;
break;
arg_list_t fileNames = files.GetValue();
for (const auto &fileName : fileNames) {
auto res = JSNApi::Execute(vm, fileName, entry);
if (!res) {
std::cerr << "Cannot execute panda file '" << fileName << "' with entry '" << entry << "'" << std::endl;
ret = false;
break;
}
}
}