mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
fix skipctormethodid cause data race
Signed-off-by: Like <zhenglike@huawei.com> Change-Id: I01e873b6ab04e1b6d7287f0be9814d63247d875c
This commit is contained in:
parent
d7eea8e2be
commit
5173e29071
@ -182,7 +182,7 @@ bool JSFunction::PrototypeSetter(JSThread *thread, const JSHandle<JSObject> &sel
|
||||
// in order to avoid subsequent Deopt, PGO gives up collecting this type.
|
||||
if (thread->GetEcmaVM()->IsEnablePGOProfiler()) {
|
||||
EntityId ctorMethodId = Method::Cast(func->GetMethod())->GetMethodId();
|
||||
thread->GetEcmaVM()->GetPGOProfiler()->InsertSkipCtorMethodId(ctorMethodId);
|
||||
thread->GetEcmaVM()->GetPGOProfiler()->InsertSkipCtorMethodIdSafe(ctorMethodId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1671,7 +1671,7 @@ ProfileType PGOProfiler::GetProfileType(JSTaggedType root, JSTaggedType child)
|
||||
}
|
||||
auto generator = iter->second;
|
||||
auto result = generator->GetProfileType(child);
|
||||
if (IsSkippableObjectType(result)) {
|
||||
if (IsSkippableObjectTypeSafe(result)) {
|
||||
return ProfileType::PROFILE_TYPE_NONE;
|
||||
}
|
||||
return result;
|
||||
|
@ -95,8 +95,9 @@ public:
|
||||
|
||||
JSTaggedValue TryFindKeyInPrototypeChain(TaggedObject *currObj, JSHClass *currHC, JSTaggedValue key);
|
||||
|
||||
void InsertSkipCtorMethodId(EntityId ctorMethodId)
|
||||
void InsertSkipCtorMethodIdSafe(EntityId ctorMethodId)
|
||||
{
|
||||
LockHolder lock(skipCtorMethodIdMutex_);
|
||||
skipCtorMethodId_.insert(ctorMethodId.GetOffset());
|
||||
}
|
||||
|
||||
@ -473,10 +474,11 @@ private:
|
||||
ProfileType GetRecordProfileType(const std::shared_ptr<JSPandaFile> &pf, ApEntityId abcId,
|
||||
const CString &recordName);
|
||||
|
||||
bool IsSkippableObjectType(ProfileType type)
|
||||
bool IsSkippableObjectTypeSafe(ProfileType type)
|
||||
{
|
||||
if (type.IsClassType() || type.IsConstructor() || type.IsPrototype()) {
|
||||
uint32_t ctorId = type.GetId();
|
||||
LockHolder lock(skipCtorMethodIdMutex_);
|
||||
return skipCtorMethodId_.find(ctorId) != skipCtorMethodId_.end();
|
||||
}
|
||||
return false;
|
||||
@ -498,6 +500,7 @@ private:
|
||||
CMap<JSTaggedType, PGOTypeGenerator *> tracedProfiles_;
|
||||
std::unique_ptr<PGORecordDetailInfos> recordInfos_;
|
||||
CUnorderedSet<uint32_t> skipCtorMethodId_;
|
||||
Mutex skipCtorMethodIdMutex_;
|
||||
JITProfiler *jitProfiler_ {nullptr};
|
||||
friend class PGOProfilerManager;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user