Fix the bug of AOT-PGO trackfield

fix the bug of AOT-PGO trackfield

Issue: https://gitee.com/open_harmony/dashboard?issue_id=I7WDU9
Signed-off-by: weng-xi <wengxi1@huawei.com>
Change-Id: I3dba3bd4fd5c0803d8ff582fb5f45bfda517ee2c
This commit is contained in:
weng-xi 2023-08-28 17:11:51 +08:00
parent 2f63cdec27
commit 3c9f152c12
3 changed files with 18 additions and 0 deletions

View File

@ -53,6 +53,9 @@ void TSHClassGenerator::UpdateTSHClassFromPGO(const kungfu::GateType &type, cons
if (!enableOptTrackField) { if (!enableOptTrackField) {
return; return;
} }
if (tsManager_->IsInSkipTrackFieldSet(desc.GetClassType())) {
return;
}
std::vector<JSHClass *> superHClasses; std::vector<JSHClass *> superHClasses;
kungfu::GateType current = type; kungfu::GateType current = type;

View File

@ -119,6 +119,10 @@ void PGOTypeInferHelper::CollectGateType(CollectedType &types, GateType tsType,
for (uint32_t i = 0; i < pgoTypes.GetCount(); i++) { for (uint32_t i = 0; i < pgoTypes.GetCount(); i++) {
ClassType classType = pgoTypes.GetObjectInfo(i).GetClassType(); ClassType classType = pgoTypes.GetObjectInfo(i).GetClassType();
GateType pgoType = tsManager_->GetGateTypeByPt(classType); GateType pgoType = tsManager_->GetGateTypeByPt(classType);
if (pgoType.IsAnyType()) {
tsManager_->AddToSkipTrackFieldSet(classType);
continue;
}
if (tsManager_->IsClassTypeKind(pgoType) && !pgoTypes.GetObjectInfo(i).InConstructor()) { if (tsManager_->IsClassTypeKind(pgoType) && !pgoTypes.GetObjectInfo(i).InConstructor()) {
pgoType = GateType(tsManager_->CreateClassInstanceType(pgoType)); pgoType = GateType(tsManager_->CreateClassInstanceType(pgoType));
} }

View File

@ -890,6 +890,16 @@ public:
return kungfu::GateType::AnyType(); return kungfu::GateType::AnyType();
} }
inline void AddToSkipTrackFieldSet(ClassType type)
{
skipTrackFieldSet_.insert(type);
}
inline bool IsInSkipTrackFieldSet(ClassType type)
{
return skipTrackFieldSet_.find(type) != skipTrackFieldSet_.end();
}
void PrintNumOfTypes() const; void PrintNumOfTypes() const;
void PrintTypeInfo(const JSPandaFile *jsPandaFile) const; void PrintTypeInfo(const JSPandaFile *jsPandaFile) const;
@ -1020,6 +1030,7 @@ private:
ObjectFactory *factory_ {nullptr}; ObjectFactory *factory_ {nullptr};
JSTaggedValue globalModuleTable_ {JSTaggedValue::Hole()}; JSTaggedValue globalModuleTable_ {JSTaggedValue::Hole()};
CMap<ClassType, const kungfu::GateType> ptToGtMap_ {}; CMap<ClassType, const kungfu::GateType> ptToGtMap_ {};
std::set<ClassType> skipTrackFieldSet_ {};
std::map<GlobalTSTypeRef, IHClassData> gtIhcMap_ {}; std::map<GlobalTSTypeRef, IHClassData> gtIhcMap_ {};
std::map<GlobalTSTypeRef, IHClassData> gtConstructorhcMap_ {}; std::map<GlobalTSTypeRef, IHClassData> gtConstructorhcMap_ {};
std::unordered_map<TypeLocation, GlobalTSTypeRef, HashTypeLocation> literalGTMap_ {}; std::unordered_map<TypeLocation, GlobalTSTypeRef, HashTypeLocation> literalGTMap_ {};