mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
!7126 [JIT] 修复 jit pgo时的一些deopt问题
Merge pull request !7126 from zhouyong/deopt_issues
This commit is contained in:
commit
e729610d81
@ -136,7 +136,7 @@ void PGOTypeManager::GenHClassInfo()
|
||||
ObjectFactory* factory = thread_->GetEcmaVM()->GetFactory();
|
||||
JSHandle<TaggedArray> hclassInfo = factory->NewTaggedArray(count);
|
||||
uint32_t pos = 0;
|
||||
|
||||
profileTyperToHClassIndex_.clear();
|
||||
for (auto& root: hcData_) {
|
||||
ProfileType rootType = root.first;
|
||||
for (auto& child: root.second) {
|
||||
@ -151,27 +151,6 @@ void PGOTypeManager::GenHClassInfo()
|
||||
aotSnapshot_.StoreHClassInfo(hclassInfo);
|
||||
}
|
||||
|
||||
void PGOTypeManager::GenJITHClassInfoLocal()
|
||||
{
|
||||
LockHolder lock(mutex_);
|
||||
profileTyperToHClassIndex_.clear();
|
||||
hclassInfoLocal_.clear();
|
||||
uint32_t count = 0;
|
||||
for (auto &data : hcData_) {
|
||||
count += data.second.size();
|
||||
}
|
||||
uint32_t pos = 0;
|
||||
for (auto &x : hcData_) {
|
||||
ProfileType rootType = x.first;
|
||||
for (auto &y : x.second) {
|
||||
ProfileType childType = y.first;
|
||||
JSTaggedType hclass = y.second;
|
||||
ProfileTyper key = std::make_pair(rootType, childType);
|
||||
profileTyperToHClassIndex_.emplace(key, pos++);
|
||||
hclassInfoLocal_.emplace_back(JSTaggedValue(hclass));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSHandle<TaggedArray> PGOTypeManager::GenJITHClassInfo()
|
||||
{
|
||||
@ -214,6 +193,8 @@ void PGOTypeManager::RecordHClass(ProfileType rootType, ProfileType childType, J
|
||||
auto map = TransIdToHClass();
|
||||
map.emplace(childType, hclass);
|
||||
hcData_.emplace(rootType, map);
|
||||
profileTyperToHClassIndex_.emplace(std::make_pair(rootType, childType), pos_++);
|
||||
hclassInfoLocal_.emplace_back(JSTaggedValue(hclass));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -225,9 +206,14 @@ void PGOTypeManager::RecordHClass(ProfileType rootType, ProfileType childType, J
|
||||
return;
|
||||
} else {
|
||||
hclassMap[childType]= hclass;
|
||||
auto index = GetHClassIndexByProfileType(std::pair(rootType, childType));
|
||||
ASSERT(index >= 0);
|
||||
hclassInfoLocal_[index] = JSTaggedValue(hclass);
|
||||
return;
|
||||
}
|
||||
}
|
||||
profileTyperToHClassIndex_.emplace(std::make_pair(rootType, childType), pos_++);
|
||||
hclassInfoLocal_.emplace_back(JSTaggedValue(hclass));
|
||||
hclassMap.emplace(childType, hclass);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,6 @@ public:
|
||||
}
|
||||
|
||||
JSHandle<TaggedArray> GenJITHClassInfo();
|
||||
void GenJITHClassInfoLocal();
|
||||
|
||||
// symbol
|
||||
std::optional<uint64_t> PUBLIC_API GetSymbolIdByProfileType(ProfileTypeTuple type) const;
|
||||
@ -166,6 +165,7 @@ private:
|
||||
// so that subsequent passes (type_infer, ts_hcr_lowering) can obtain the correct constpool.
|
||||
JSTaggedValue curCP_ {JSTaggedValue::Hole()};
|
||||
int32_t curCPID_ {0};
|
||||
int32_t pos_ {0};
|
||||
};
|
||||
} // panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_PGO_TYPE_PGO_TYPE_MANAGER_H
|
||||
|
@ -254,7 +254,6 @@ void JITProfiler::ProfileBytecode(JSHandle<ProfileTypeInfo> &profileTypeInfo, En
|
||||
}
|
||||
bcIns = bcIns.GetNext();
|
||||
}
|
||||
ptManager_->GenJITHClassInfoLocal();
|
||||
}
|
||||
|
||||
// PGOSampleType
|
||||
@ -693,9 +692,10 @@ JSTaggedValue JITProfiler::TryFindKeyInPrototypeChain(TaggedObject *currObj, JSH
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
void JITProfiler::InsertProfileType(JSTaggedType root, JSTaggedType child, ProfileType rootType, ProfileType childType)
|
||||
void JITProfiler::InsertProfileType(JSTaggedType root, JSTaggedType child, ProfileType rootType, ProfileType childType,
|
||||
bool update)
|
||||
{
|
||||
ptManager_->RecordHClass(rootType, childType, child, true);
|
||||
ptManager_->RecordHClass(rootType, childType, child, update);
|
||||
LockHolder lock(mutex_);
|
||||
auto iter = tracedProfiles_.find(root);
|
||||
if (iter != tracedProfiles_.end()) {
|
||||
@ -755,15 +755,13 @@ void JITProfiler::UpdateRootProfileType(JSHClass *oldHClass, JSHClass *newHClass
|
||||
}
|
||||
auto generator = iter->second;
|
||||
auto rootProfileType = generator->GetProfileType(JSTaggedType(oldRootHClass));
|
||||
if (rootProfileType.IsNone()) {
|
||||
{
|
||||
vm_->GetNativeAreaAllocator()->Delete(iter->second);
|
||||
tracedProfiles_.erase(iter);
|
||||
return;
|
||||
}
|
||||
tracedProfiles_.erase(iter);
|
||||
InsertProfileType(JSTaggedType(newHClass), JSTaggedType(newHClass), rootProfileType, rootProfileType);
|
||||
InsertProfileType(JSTaggedType(newHClass), JSTaggedType(newHClass), rootProfileType, rootProfileType, true);
|
||||
}
|
||||
|
||||
|
||||
void JITProfiler::AddObjectInfoWithMega(int32_t bcOffset)
|
||||
{
|
||||
auto megaType = ProfileType::CreateMegeType();
|
||||
|
@ -61,7 +61,8 @@ public:
|
||||
{
|
||||
return bcOffsetPGODefOpTypeMap_;
|
||||
}
|
||||
void InsertProfileType(JSTaggedType root, JSTaggedType child, ProfileType rootType, ProfileType childType);
|
||||
void InsertProfileType(JSTaggedType root, JSTaggedType child, ProfileType rootType, ProfileType childType,
|
||||
bool update = false);
|
||||
void InitJITProfiler()
|
||||
{
|
||||
ptManager_ = vm_->GetJSThread()->GetCurrentEcmaContext()->GetPTManager();
|
||||
|
Loading…
Reference in New Issue
Block a user