mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 18:20:04 +00:00
aotfilemanager to ecma_vm
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I93VWQ Signed-off-by: luobinghao <luobinghao@huawei.com> Change-Id: Ief1039da35f816f41fe3015406c5cfa797baafbc
This commit is contained in:
parent
80d4e62825
commit
9f1a4193fc
@ -416,7 +416,7 @@ void CpuProfiler::GetStackSignalHandler(int signal, [[maybe_unused]] siginfo_t *
|
||||
// If the attempt fails, the callback will be terminated directly to avoid the reentrancy deadlock,
|
||||
// and a sampling will be abandoned. Failures are rare, so the impact on the overall sampling results
|
||||
// is very limited.
|
||||
if (!thread->GetCurrentEcmaContext()->GetAOTFileManager()->TryReadLock()) {
|
||||
if (!thread->GetEcmaVM()->GetAOTFileManager()->TryReadLock()) {
|
||||
if (profiler->generator_->SemPost(0) != 0) {
|
||||
LOG_ECMA(ERROR) << "sem_[0] post failed";
|
||||
}
|
||||
@ -519,7 +519,7 @@ uint64_t CpuProfiler::GetPcFromContext(void *context)
|
||||
|
||||
bool CpuProfiler::IsAddrAtStubOrAot(uint64_t pc) const
|
||||
{
|
||||
AOTFileManager *loader = vm_->GetJSThread()->GetCurrentEcmaContext()->GetAOTFileManager();
|
||||
AOTFileManager *loader = vm_->GetAOTFileManager();
|
||||
return loader->InsideStub(pc) || loader->InsideAOT(pc);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,8 @@ using PathHelper = base::PathHelper;
|
||||
EcmaContext::EcmaContext(JSThread *thread)
|
||||
: thread_(thread),
|
||||
vm_(thread->GetEcmaVM()),
|
||||
factory_(vm_->GetFactory())
|
||||
factory_(vm_->GetFactory()),
|
||||
aotFileManager_(vm_->GetAOTFileManager())
|
||||
{
|
||||
}
|
||||
|
||||
@ -90,7 +91,6 @@ bool EcmaContext::Initialize()
|
||||
LOG_ECMA(DEBUG) << "EcmaContext::Initialize";
|
||||
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "EcmaContext::Initialize");
|
||||
[[maybe_unused]] EcmaHandleScope scope(thread_);
|
||||
aotFileManager_ = new AOTFileManager(vm_);
|
||||
propertiesCache_ = new PropertiesCache();
|
||||
regExpParserCache_ = new RegExpParserCache();
|
||||
|
||||
@ -234,7 +234,6 @@ EcmaContext::~EcmaContext()
|
||||
regExpParserCache_ = nullptr;
|
||||
}
|
||||
if (aotFileManager_ != nullptr) {
|
||||
delete aotFileManager_;
|
||||
aotFileManager_ = nullptr;
|
||||
}
|
||||
if (propertiesCache_ != nullptr) {
|
||||
@ -479,7 +478,7 @@ JSTaggedValue EcmaContext::FindConstpoolWithAOT(const JSPandaFile *jsPandaFile,
|
||||
// A constpool is created when a Function is serialized. Slowpath, the default deserialized constpool,
|
||||
// string is non-lazy load mode. A hole is returned if you access the constpool of the serialized Function
|
||||
if (constpool.IsHole() && ecmascript::AnFileDataManager::GetInstance()->IsEnable()) {
|
||||
bool result = GetAOTFileManager()->LoadAiFile(jsPandaFile);
|
||||
bool result = aotFileManager_->LoadAiFile(jsPandaFile);
|
||||
if (result) {
|
||||
constpool = FindConstpool(jsPandaFile, index);
|
||||
}
|
||||
@ -1001,7 +1000,7 @@ void EcmaContext::JoinStackPop(JSHandle<JSTaggedValue> receiver)
|
||||
std::tuple<uint64_t, uint8_t *, int, kungfu::CalleeRegAndOffsetVec> EcmaContext::CalCallSiteInfo(
|
||||
uintptr_t retAddr) const
|
||||
{
|
||||
auto loader = GetAOTFileManager();
|
||||
auto loader = aotFileManager_;
|
||||
auto callSiteInfo = loader->CalCallSiteInfo(retAddr);
|
||||
if (std::get<1>(callSiteInfo) != nullptr) {
|
||||
return callSiteInfo;
|
||||
|
@ -327,11 +327,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
AOTFileManager *GetAOTFileManager() const
|
||||
{
|
||||
return aotFileManager_;
|
||||
}
|
||||
|
||||
EcmaRuntimeStat *GetRuntimeStat() const
|
||||
{
|
||||
return runtimeStat_;
|
||||
|
@ -114,7 +114,7 @@ EcmaVM *EcmaVM::Create(const JSRuntimeOptions &options, EcmaParamConfiguration &
|
||||
vm->thread_ = jsThread;
|
||||
vm->Initialize();
|
||||
if (JsStackInfo::loader == nullptr) {
|
||||
JsStackInfo::loader = vm->GetJSThread()->GetCurrentEcmaContext()->GetAOTFileManager();
|
||||
JsStackInfo::loader = vm->GetAOTFileManager();
|
||||
}
|
||||
#if defined(__aarch64__) && !defined(PANDA_TARGET_MACOS) && !defined(PANDA_TARGET_IOS)
|
||||
if (SetThreadInfoCallback != nullptr) {
|
||||
@ -229,6 +229,7 @@ bool EcmaVM::Initialize()
|
||||
UNREACHABLE();
|
||||
}
|
||||
debuggerManager_ = chunk_.New<tooling::JsDebuggerManager>(this);
|
||||
aotFileManager_ = new AOTFileManager(this);
|
||||
auto context = new EcmaContext(thread_);
|
||||
thread_->PushContext(context);
|
||||
[[maybe_unused]] EcmaHandleScope scope(thread_);
|
||||
@ -312,7 +313,7 @@ EcmaVM::~EcmaVM()
|
||||
gcStats_ = nullptr;
|
||||
}
|
||||
|
||||
if (JsStackInfo::loader == GetJSThread()->GetCurrentEcmaContext()->GetAOTFileManager()) {
|
||||
if (JsStackInfo::loader == aotFileManager_) {
|
||||
JsStackInfo::loader = nullptr;
|
||||
}
|
||||
|
||||
@ -327,6 +328,11 @@ EcmaVM::~EcmaVM()
|
||||
debuggerManager_ = nullptr;
|
||||
}
|
||||
|
||||
if (aotFileManager_ != nullptr) {
|
||||
delete aotFileManager_;
|
||||
aotFileManager_ = nullptr;
|
||||
}
|
||||
|
||||
if (factory_ != nullptr) {
|
||||
chunk_.Delete(factory_);
|
||||
factory_ = nullptr;
|
||||
|
@ -589,6 +589,11 @@ public:
|
||||
{
|
||||
overLimit_ = state;
|
||||
}
|
||||
|
||||
AOTFileManager *GetAOTFileManager() const
|
||||
{
|
||||
return aotFileManager_;
|
||||
}
|
||||
protected:
|
||||
|
||||
void PrintJSErrorInfo(const JSHandle<JSTaggedValue> &exceptionInfo) const;
|
||||
@ -675,6 +680,10 @@ private:
|
||||
|
||||
// PGO Profiler
|
||||
std::shared_ptr<PGOProfiler> pgoProfiler_ {nullptr};
|
||||
|
||||
//AOT File Manager
|
||||
AOTFileManager *aotFileManager_ {nullptr};
|
||||
|
||||
// c++ call js
|
||||
size_t callDepth_ {0};
|
||||
|
||||
|
@ -28,7 +28,7 @@ FrameIterator::FrameIterator(JSTaggedType *sp, const JSThread *thread) : current
|
||||
{
|
||||
if (thread != nullptr) {
|
||||
arkStackMapParser_ =
|
||||
const_cast<JSThread *>(thread)->GetCurrentEcmaContext()->GetAOTFileManager()->GetStackMapParser();
|
||||
const_cast<JSThread *>(thread)->GetEcmaVM()->GetAOTFileManager()->GetStackMapParser();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ void FrameHandler::Iterate(const RootVisitor &visitor, const RootRangeVisitor &r
|
||||
// lazy assignment: only Iterate need arkStackMapParser_ in order to high improve performance
|
||||
if (arkStackMapParser_ == nullptr) {
|
||||
arkStackMapParser_ =
|
||||
const_cast<JSThread *>(thread_)->GetCurrentEcmaContext()->GetAOTFileManager()->GetStackMapParser();
|
||||
const_cast<JSThread *>(thread_)->GetEcmaVM()->GetAOTFileManager()->GetStackMapParser();
|
||||
}
|
||||
IterateFrameChain(current, visitor, rangeVisitor, derivedVisitor);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ void JSPandaFileExecutor::BindPandaFilesForAot(EcmaVM *vm, [[maybe_unused]]JSPan
|
||||
{
|
||||
if (vm->GetJSOptions().GetEnableAsmInterpreter()) {
|
||||
std::string aotFileBaseName(vm->GetModuleName());
|
||||
auto *aotFM = vm->GetJSThread()->GetCurrentEcmaContext()->GetAOTFileManager();
|
||||
auto *aotFM = vm->GetAOTFileManager();
|
||||
if (vm->GetJSOptions().WasAOTOutputFileSet()) {
|
||||
std::string aotFilename = vm->GetJSOptions().GetAOTOutputFile();
|
||||
aotFileBaseName = JSFilePath::GetBaseName(aotFilename);
|
||||
|
@ -19,7 +19,7 @@ namespace panda::ecmascript {
|
||||
JSHandle<ConstantPool> ConstantPool::GetDeserializedConstantPool(EcmaVM *vm, const JSPandaFile *jsPandaFile,
|
||||
int32_t cpID)
|
||||
{
|
||||
auto context = vm->GetJSThread()->GetCurrentEcmaContext();
|
||||
return JSHandle<ConstantPool>(context->GetAOTFileManager()->GetDeserializedConstantPool(jsPandaFile, cpID));
|
||||
auto aotFileManager = vm->GetAOTFileManager();
|
||||
return JSHandle<ConstantPool>(aotFileManager->GetDeserializedConstantPool(jsPandaFile, cpID));
|
||||
}
|
||||
}
|
@ -1840,7 +1840,7 @@ JSHandle<Method> ObjectFactory::NewMethod(const JSPandaFile *jsPandaFile, Method
|
||||
method->SetModule(thread_, module);
|
||||
}
|
||||
if (needSetAotFlag) {
|
||||
thread_->GetCurrentEcmaContext()->GetAOTFileManager()->
|
||||
thread_->GetEcmaVM()->GetAOTFileManager()->
|
||||
SetAOTFuncEntry(jsPandaFile, *method, entryIndex, canFastCall);
|
||||
}
|
||||
return method;
|
||||
|
@ -1453,7 +1453,7 @@ void SnapshotProcessor::AddRootObjectToAOTFileManager(SnapshotType type, const C
|
||||
{
|
||||
if (type == SnapshotType::AI) {
|
||||
ASSERT(!root_.IsHole());
|
||||
AOTFileManager *aotFileManager = vm_->GetJSThread()->GetCurrentEcmaContext()->GetAOTFileManager();
|
||||
AOTFileManager *aotFileManager = vm_->GetAOTFileManager();
|
||||
aotFileManager->ParseDeserializedData(fileName, root_);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user