Remove unused framework abc variables

Signed-off-by: g00416891 <guobingbing3@huawei.com>
Change-Id: Ifa7a18bfd4d36ff7d9140c30bcc45064d3bf5f27
This commit is contained in:
g00416891 2023-01-12 10:14:50 +08:00
parent 5e3e241a38
commit 1e7481bba8
9 changed files with 20 additions and 81 deletions

View File

@ -147,8 +147,6 @@ EcmaVM::EcmaVM(JSRuntimeOptions options, EcmaParamConfiguration config)
options_ = std::move(options); options_ = std::move(options);
icEnabled_ = options_.EnableIC(); icEnabled_ = options_.EnableIC();
optionalLogEnabled_ = options_.EnableOptionalLog(); optionalLogEnabled_ = options_.EnableOptionalLog();
snapshotFileName_ = options_.GetSnapshotFile().c_str();
frameworkAbcFileName_ = options_.GetFrameworkAbcFile().c_str();
options_.ParseAsmInterOption(); options_.ParseAsmInterOption();
} }
@ -445,15 +443,8 @@ JSTaggedValue EcmaVM::ExecuteAot(size_t actualNumArgs, JSTaggedType *args, const
Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *jsPandaFile, std::string_view entryPoint, Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *jsPandaFile, std::string_view entryPoint,
bool excuteFromJob) bool excuteFromJob)
{ {
JSTaggedValue result;
[[maybe_unused]] EcmaHandleScope scope(thread_); [[maybe_unused]] EcmaHandleScope scope(thread_);
JSHandle<Program> program; JSHandle<Program> program = JSPandaFileManager::GetInstance()->GenerateProgram(this, jsPandaFile, entryPoint);
if (jsPandaFile != frameworkPandaFile_) {
program = JSPandaFileManager::GetInstance()->GenerateProgram(this, jsPandaFile, entryPoint);
} else {
program = JSHandle<Program>(thread_, frameworkProgram_);
frameworkProgram_ = JSTaggedValue::Hole();
}
if (program.IsEmpty()) { if (program.IsEmpty()) {
LOG_ECMA(ERROR) << "program is empty, invoke entrypoint failed"; LOG_ECMA(ERROR) << "program is empty, invoke entrypoint failed";
return Unexpected(false); return Unexpected(false);
@ -463,8 +454,9 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
JSHandle<JSFunction> func = JSHandle<JSFunction>(thread_, program->GetMainFunction()); JSHandle<JSFunction> func = JSHandle<JSFunction>(thread_, program->GetMainFunction());
JSHandle<JSTaggedValue> global = GlobalEnv::Cast(globalEnv_.GetTaggedObject())->GetJSGlobalObject(); JSHandle<JSTaggedValue> global = GlobalEnv::Cast(globalEnv_.GetTaggedObject())->GetJSGlobalObject();
JSHandle<JSTaggedValue> undefined = thread_->GlobalConstants()->GetHandledUndefined();
if (jsPandaFile->IsModule(entryPoint.data())) { if (jsPandaFile->IsModule(entryPoint.data())) {
global = JSHandle<JSTaggedValue>(thread_, JSTaggedValue::Undefined()); global = undefined;
CString moduleName = jsPandaFile->GetJSPandaFileDesc(); CString moduleName = jsPandaFile->GetJSPandaFileDesc();
if (!jsPandaFile->IsBundlePack()) { if (!jsPandaFile->IsBundlePack()) {
moduleName = entryPoint.data(); moduleName = entryPoint.data();
@ -478,6 +470,7 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
func->SetModule(thread_, recordName); func->SetModule(thread_, recordName);
} }
JSTaggedValue result;
if (aotFileManager_->IsLoadMain(jsPandaFile, entryPoint.data())) { if (aotFileManager_->IsLoadMain(jsPandaFile, entryPoint.data())) {
thread_->SetPrintBCOffset(true); thread_->SetPrintBCOffset(true);
EcmaRuntimeStatScope runtimeStatScope(this); EcmaRuntimeStatScope runtimeStatScope(this);
@ -486,7 +479,6 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
if (jsPandaFile->IsCjs(entryPoint.data())) { if (jsPandaFile->IsCjs(entryPoint.data())) {
CJSExecution(func, global, jsPandaFile); CJSExecution(func, global, jsPandaFile);
} else { } else {
JSHandle<JSTaggedValue> undefined = thread_->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info = EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread_, JSHandle<JSTaggedValue>(func), global, undefined, 0); EcmaInterpreter::NewRuntimeCallInfo(thread_, JSHandle<JSTaggedValue>(func), global, undefined, 0);
EcmaRuntimeStatScope runtimeStatScope(this); EcmaRuntimeStatScope runtimeStatScope(this);
@ -500,8 +492,7 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
// print exception information // print exception information
if (!excuteFromJob && thread_->HasPendingException()) { if (!excuteFromJob && thread_->HasPendingException()) {
auto exception = thread_->GetException(); HandleUncaughtException(thread_->GetException());
HandleUncaughtException(exception.GetTaggedObject());
} }
return result; return result;
} }
@ -568,7 +559,7 @@ void EcmaVM::CJSExecution(JSHandle<JSFunction> &func, JSHandle<JSTaggedValue> &t
if (jsPandaFile->IsBundlePack()) { if (jsPandaFile->IsBundlePack()) {
RequireManager::ResolveCurrentPath(thread_, dirname, filename, jsPandaFile); RequireManager::ResolveCurrentPath(thread_, dirname, filename, jsPandaFile);
} else { } else {
filename.Update(JSFunction::Cast(func.GetTaggedValue().GetTaggedObject())->GetModule()); filename.Update(func->GetModule());
ASSERT(filename->IsString()); ASSERT(filename->IsString());
RequireManager::ResolveDirPath(thread_, dirname, filename); RequireManager::ResolveDirPath(thread_, dirname, filename);
} }
@ -600,8 +591,7 @@ void EcmaVM::CJSExecution(JSHandle<JSFunction> &func, JSHandle<JSTaggedValue> &t
// print exception information // print exception information
if (thread_->HasPendingException()) { if (thread_->HasPendingException()) {
auto exception = thread_->GetException(); HandleUncaughtException(thread_->GetException());
HandleUncaughtException(exception.GetTaggedObject());
} }
// Collecting module.exports : exports ---> module.exports --->Module._cache // Collecting module.exports : exports ---> module.exports --->Module._cache
RequireManager::CollectExecutedExp(thread_, cjsInfo); RequireManager::CollectExecutedExp(thread_, cjsInfo);
@ -640,13 +630,13 @@ void EcmaVM::EnableUserUncaughtErrorHandler()
isUncaughtExceptionRegistered_ = true; isUncaughtExceptionRegistered_ = true;
} }
void EcmaVM::HandleUncaughtException(TaggedObject *exception) void EcmaVM::HandleUncaughtException(JSTaggedValue exception)
{ {
if (isUncaughtExceptionRegistered_) { if (isUncaughtExceptionRegistered_) {
return; return;
} }
[[maybe_unused]] EcmaHandleScope handleScope(thread_); [[maybe_unused]] EcmaHandleScope handleScope(thread_);
JSHandle<JSTaggedValue> exceptionHandle(thread_, JSTaggedValue(exception)); JSHandle<JSTaggedValue> exceptionHandle(thread_, exception);
// if caught exceptionHandle type is JSError // if caught exceptionHandle type is JSError
thread_->ClearException(); thread_->ClearException();
if (exceptionHandle->IsJSError()) { if (exceptionHandle->IsJSError()) {
@ -829,7 +819,6 @@ void EcmaVM::Iterate(const RootVisitor &v, const RootRangeVisitor &rv)
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&globalEnv_))); v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&globalEnv_)));
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&microJobQueue_))); v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&microJobQueue_)));
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&regexpCache_))); v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&regexpCache_)));
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&frameworkProgram_)));
rv(Root::ROOT_VM, ObjectSlot(ToUintPtr(&internalNativeMethods_.front())), rv(Root::ROOT_VM, ObjectSlot(ToUintPtr(&internalNativeMethods_.front())),
ObjectSlot(ToUintPtr(&internalNativeMethods_.back()) + JSTaggedValue::TaggedTypeSize())); ObjectSlot(ToUintPtr(&internalNativeMethods_.back()) + JSTaggedValue::TaggedTypeSize()));
moduleManager_->Iterate(v); moduleManager_->Iterate(v);

View File

@ -591,7 +591,7 @@ public:
protected: protected:
void HandleUncaughtException(TaggedObject *exception); void HandleUncaughtException(JSTaggedValue exception);
void PrintJSErrorInfo(const JSHandle<JSTaggedValue> &exceptionInfo); void PrintJSErrorInfo(const JSHandle<JSTaggedValue> &exceptionInfo);
@ -655,11 +655,6 @@ private:
JSTaggedValue microJobQueue_ {JSTaggedValue::Hole()}; JSTaggedValue microJobQueue_ {JSTaggedValue::Hole()};
EcmaRuntimeStat *runtimeStat_ {nullptr}; EcmaRuntimeStat *runtimeStat_ {nullptr};
// For framewrok file snapshot.
CString snapshotFileName_;
CString frameworkAbcFileName_;
JSTaggedValue frameworkProgram_ {JSTaggedValue::Hole()};
const JSPandaFile *frameworkPandaFile_ {nullptr};
CMap<const JSPandaFile *, CMap<int32_t, JSTaggedValue>> cachedConstpools_ {}; CMap<const JSPandaFile *, CMap<int32_t, JSTaggedValue>> cachedConstpools_ {};
// VM resources. // VM resources.

View File

@ -138,7 +138,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
{"enable-type-lowering", required_argument, nullptr, OPTION_ENABLE_TYPE_LOWERING}, {"enable-type-lowering", required_argument, nullptr, OPTION_ENABLE_TYPE_LOWERING},
{"entry-point", required_argument, nullptr, OPTION_ENTRY_POINT}, {"entry-point", required_argument, nullptr, OPTION_ENTRY_POINT},
{"force-full-gc", required_argument, nullptr, OPTION_FORCE_FULL_GC}, {"force-full-gc", required_argument, nullptr, OPTION_FORCE_FULL_GC},
{"framework-abc-file", required_argument, nullptr, OPTION_FRAMEWORK_ABC_FILE},
{"gcThreadNum", required_argument, nullptr, OPTION_GC_THREADNUM}, {"gcThreadNum", required_argument, nullptr, OPTION_GC_THREADNUM},
{"heap-size-limit", required_argument, nullptr, OPTION_HEAP_SIZE_LIMIT}, {"heap-size-limit", required_argument, nullptr, OPTION_HEAP_SIZE_LIMIT},
{"help", no_argument, nullptr, OPTION_HELP}, {"help", no_argument, nullptr, OPTION_HELP},
@ -160,7 +159,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
{"print-any-types", required_argument, nullptr, OPTION_PRINT_ANY_TYPES}, {"print-any-types", required_argument, nullptr, OPTION_PRINT_ANY_TYPES},
{"reloc-mode", required_argument, nullptr, OPTION_RELOCATION_MODE}, {"reloc-mode", required_argument, nullptr, OPTION_RELOCATION_MODE},
{"serializer-buffer-size-limit", required_argument, nullptr, OPTION_SERIALIZER_BUFFER_SIZE_LIMIT}, {"serializer-buffer-size-limit", required_argument, nullptr, OPTION_SERIALIZER_BUFFER_SIZE_LIMIT},
{"snapshot-file", required_argument, nullptr, OPTION_SNAPSHOT_FILE},
{"startup-time", required_argument, nullptr, OPTION_STARTUP_TIME}, {"startup-time", required_argument, nullptr, OPTION_STARTUP_TIME},
{"stub-file", required_argument, nullptr, OPTION_STUB_FILE}, {"stub-file", required_argument, nullptr, OPTION_STUB_FILE},
{"target-triple", required_argument, nullptr, OPTION_TARGET_TRIPLE}, {"target-triple", required_argument, nullptr, OPTION_TARGET_TRIPLE},
@ -333,9 +331,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
return false; return false;
} }
break; break;
case OPTION_FRAMEWORK_ABC_FILE:
SetFrameworkAbcFile(optarg);
break;
case OPTION_GC_THREADNUM: case OPTION_GC_THREADNUM:
ret = ParseUint32Param("gcThreadNum", &argUint32); ret = ParseUint32Param("gcThreadNum", &argUint32);
if (ret) { if (ret) {
@ -479,9 +474,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
return false; return false;
} }
break; break;
case OPTION_SNAPSHOT_FILE:
SetSnapshotFile(optarg);
break;
case OPTION_STARTUP_TIME: case OPTION_STARTUP_TIME:
ret = ParseBoolParam(&argBool); ret = ParseBoolParam(&argBool);
if (ret) { if (ret) {

View File

@ -73,8 +73,6 @@ enum CommandValues {
OPTION_SERIALIZER_BUFFER_SIZE_LIMIT, OPTION_SERIALIZER_BUFFER_SIZE_LIMIT,
OPTION_HEAP_SIZE_LIMIT, OPTION_HEAP_SIZE_LIMIT,
OPTION_ENABLE_IC, OPTION_ENABLE_IC,
OPTION_SNAPSHOT_FILE,
OPTION_FRAMEWORK_ABC_FILE,
OPTION_ICU_DATA_PATH, OPTION_ICU_DATA_PATH,
OPTION_STARTUP_TIME, OPTION_STARTUP_TIME,
OPTION_COMPILER_LOG_OPT, OPTION_COMPILER_LOG_OPT,
@ -508,36 +506,6 @@ public:
return WasOptionSet(OPTION_ENABLE_IC); return WasOptionSet(OPTION_ENABLE_IC);
} }
std::string GetSnapshotFile() const
{
return snapshotFile_;
}
void SetSnapshotFile(std::string value)
{
snapshotFile_ = std::move(value);
}
bool WasSetSnapshotFile() const
{
return WasOptionSet(OPTION_SNAPSHOT_FILE);
}
std::string GetFrameworkAbcFile() const
{
return frameworkAbcFile_;
}
void SetFrameworkAbcFile(std::string value)
{
frameworkAbcFile_ = std::move(value);
}
bool WasSetFrameworkAbcFile() const
{
return WasOptionSet(OPTION_FRAMEWORK_ABC_FILE);
}
std::string GetIcuDataPath() const std::string GetIcuDataPath() const
{ {
return icuDataPath_; return icuDataPath_;
@ -879,8 +847,6 @@ private:
uint64_t serializerBufferSizeLimit_ {2_GB}; uint64_t serializerBufferSizeLimit_ {2_GB};
uint32_t heapSizeLimit_ {512_MB}; uint32_t heapSizeLimit_ {512_MB};
bool enableIC_ {true}; bool enableIC_ {true};
std::string snapshotFile_ {"/system/etc/snapshot"};
std::string frameworkAbcFile_ {"strip.native.min.abc"};
std::string icuDataPath_ {"default"}; std::string icuDataPath_ {"default"};
bool startupTime_ {false}; bool startupTime_ {false};
std::string compilerLogOpt_ {"none"}; std::string compilerLogOpt_ {"none"};

View File

@ -201,11 +201,11 @@ MethodLiteral *JSPandaFile::FindMethodLiteral(uint32_t offset) const
bool JSPandaFile::IsModule(const CString &recordName) const bool JSPandaFile::IsModule(const CString &recordName) const
{ {
if (IsBundlePack()) { if (IsBundlePack()) {
return jsRecordInfo_.begin()->second.moduleRecordIdx == -1 ? false : true; return jsRecordInfo_.begin()->second.moduleRecordIdx != -1;
} }
auto info = jsRecordInfo_.find(recordName); auto info = jsRecordInfo_.find(recordName);
if (info != jsRecordInfo_.end()) { if (info != jsRecordInfo_.end()) {
return info->second.moduleRecordIdx == -1 ? false : true; return info->second.moduleRecordIdx != -1;
} }
LOG_FULL(FATAL) << "find entryPoint failed: " << recordName; LOG_FULL(FATAL) << "find entryPoint failed: " << recordName;
UNREACHABLE(); UNREACHABLE();

View File

@ -59,8 +59,8 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromFile(JSThread *thr
entry = entryPoint.data(); entry = entryPoint.data();
} }
const JSPandaFile *jsPandaFile = JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, name, entry.c_str(), const JSPandaFile *jsPandaFile =
needUpdate); JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, name, entry.c_str(), needUpdate);
if (jsPandaFile == nullptr) { if (jsPandaFile == nullptr) {
return Unexpected(false); return Unexpected(false);
} }
@ -83,11 +83,11 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromFile(JSThread *thr
SourceTextModule::Instantiate(thread, moduleRecord); SourceTextModule::Instantiate(thread, moduleRecord);
if (thread->HasPendingException()) { if (thread->HasPendingException()) {
if (!excuteFromJob) { if (!excuteFromJob) {
auto exception = thread->GetException(); vm->HandleUncaughtException(thread->GetException());
vm->HandleUncaughtException(exception.GetTaggedObject());
} }
return JSTaggedValue::Undefined(); return JSTaggedValue::Undefined();
} }
moduleRecord->SetStatus(ModuleStatus::INSTANTIATED); moduleRecord->SetStatus(ModuleStatus::INSTANTIATED);
SourceTextModule::Evaluate(thread, moduleRecord, nullptr, 0, excuteFromJob); SourceTextModule::Evaluate(thread, moduleRecord, nullptr, 0, excuteFromJob);
return JSTaggedValue::Undefined(); return JSTaggedValue::Undefined();
@ -105,6 +105,7 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromBuffer(JSThread *t
if (jsPandaFile == nullptr) { if (jsPandaFile == nullptr) {
return Unexpected(false); return Unexpected(false);
} }
CString entry = entryPoint.data(); CString entry = entryPoint.data();
bool isModule = jsPandaFile->IsModule(entry); bool isModule = jsPandaFile->IsModule(entry);
bool isBundle = jsPandaFile->IsBundlePack(); bool isBundle = jsPandaFile->IsBundlePack();
@ -162,8 +163,7 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::CommonExecuteBuffer(JSThread
} }
SourceTextModule::Instantiate(thread, moduleRecord); SourceTextModule::Instantiate(thread, moduleRecord);
if (thread->HasPendingException()) { if (thread->HasPendingException()) {
auto exception = thread->GetException(); vm->HandleUncaughtException(thread->GetException());
vm->HandleUncaughtException(exception.GetTaggedObject());
return JSTaggedValue::Undefined(); return JSTaggedValue::Undefined();
} }
moduleRecord->SetStatus(ModuleStatus::INSTANTIATED); moduleRecord->SetStatus(ModuleStatus::INSTANTIATED);

View File

@ -16,7 +16,6 @@
#ifndef ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H #ifndef ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H
#define ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H #define ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H
#include "ecmascript/mem/c_containers.h"
#include "ecmascript/js_tagged_value.h" #include "ecmascript/js_tagged_value.h"
#include "ecmascript/js_thread.h" #include "ecmascript/js_thread.h"
#include "ecmascript/jspandafile/js_pandafile.h" #include "ecmascript/jspandafile/js_pandafile.h"

View File

@ -120,8 +120,7 @@ JSHandle<Program> JSPandaFileManager::GenerateProgram(
{ {
ASSERT(GetJSPandaFile(jsPandaFile->GetPandaFile()) != nullptr); ASSERT(GetJSPandaFile(jsPandaFile->GetPandaFile()) != nullptr);
vm->GetAOTFileManager()->LoadAiFile(jsPandaFile); vm->GetAOTFileManager()->LoadAiFile(jsPandaFile);
JSHandle<Program> program = PandaFileTranslator::GenerateProgram(vm, jsPandaFile, entryPoint); return PandaFileTranslator::GenerateProgram(vm, jsPandaFile, entryPoint);
return program;
} }
const JSPandaFile *JSPandaFileManager::FindJSPandaFileWithChecksum(const CString &filename, uint32_t checksum) const JSPandaFile *JSPandaFileManager::FindJSPandaFileWithChecksum(const CString &filename, uint32_t checksum)

View File

@ -2730,8 +2730,7 @@ bool JSNApi::InitForConcurrentFunction(EcmaVM *vm, Local<JSValueRef> function)
} }
ecmascript::SourceTextModule::Instantiate(thread, moduleRecord); ecmascript::SourceTextModule::Instantiate(thread, moduleRecord);
if (thread->HasPendingException()) { if (thread->HasPendingException()) {
auto exception = thread->GetException(); vm->HandleUncaughtException(thread->GetException());
vm->HandleUncaughtException(exception.GetTaggedObject());
return false; return false;
} }
moduleRecord->SetStatus(ecmascript::ModuleStatus::INSTANTIATED); moduleRecord->SetStatus(ecmascript::ModuleStatus::INSTANTIATED);