Fix gc crash caused by weakref

Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAJRR3
Description
Fix gc crash caused by weakref

Signed-off-by: l00799755 <lujiahui4@huawei.com>
Change-Id: I5f6253203e1f865b2602d658f0169ff8ba448a9b
This commit is contained in:
l00799755 2024-08-13 17:46:30 +08:00
parent f6f6857973
commit aa756f01fe
7 changed files with 319 additions and 4 deletions

View File

@ -80,8 +80,7 @@ public:
{
JSHandle<JSTaggedValue> info(thread->GetEcmaVM()->GetFactory()->NewExtraProfileTypeInfo());
JSHandle<ExtraProfileTypeInfo> infoHandle(info);
receiverHClassHandle->CreateWeakRef();
infoHandle->SetReceiver(thread, receiverHClassHandle.GetTaggedValue());
infoHandle->SetReceiver(thread, receiverHClassHandle.GetTaggedValue().CreateAndGetWeakRef());
infoHandle->SetHolder(thread, holderHClassHandle.GetTaggedValue());
JSHandle<NumberDictionary> dict = NumberDictionary::PutIfAbsent(thread,
dictJShandle,

View File

@ -234,9 +234,8 @@ void PGOProfiler::ProfileDefineGetterSetter(JSHClass* receiverHClass,
holderHClassHandle, profileTypeInfoCell);
return;
}
receiverHClassHandle->CreateWeakRef();
ExtraProfileTypeInfo *mapInfoObj = ExtraProfileTypeInfo::Cast(dictJShandle->GetValue(entry).GetTaggedObject());
if (mapInfoObj->GetReceiver() == receiverHClassHandle.GetTaggedValue() &&
if (mapInfoObj->GetReceiver() == receiverHClassHandle.GetTaggedValue().CreateAndGetWeakRef() &&
mapInfoObj->GetHolder() == holderHClassHandle.GetTaggedValue()) {
return;
}

View File

@ -226,6 +226,7 @@ group("ark_aot_ts_test") {
"pgo_forof_typed_array",
"pgo_function_prototype",
"pgo_gettersetter",
"pgo_extrainfomap_expand",
"pgo_inherited_function_operation",
"pgo_ldobjbyvalue_array",
"pgo_ldobjbyvalue_string",

View File

@ -0,0 +1,19 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("pgo_extrainfomap_expand") {
deps = []
is_enable_pgo = true
}

View File

@ -0,0 +1,12 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View File

@ -0,0 +1,12 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View File

@ -0,0 +1,273 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class C1 {
set e(a1) {}
}
class C2 {
set e(a2) {}
}
class C3 {
set e(a3) {}
}
class C4 {
set e(a4) {}
}
class C5 {
set e(a5) {}
}
class C6 {
set e(a6) {}
}
class C7 {
set e(a7) {}
}
class C8 {
set e(a8) {}
}
class C9 {
set e(a9) {}
}
class C10 {
set e(a10) {}
}
class C11 {
set e(a11) {}
}
class C12 {
set e(a12) {}
}
class C13 {
set e(a13) {}
}
class C14 {
set e(a14) {}
}
class C15 {
set e(a15) {}
}
class C16 {
set e(a16) {}
}
class C17 {
set e(a17) {}
}
class C18 {
set e(a18) {}
}
class C19 {
set e(a19) {}
}
class C20 {
set e(a20) {}
}
class C21 {
set e(a21) {}
}
class C22 {
set e(a22) {}
}
class C23 {
set e(a23) {}
}
class C24 {
set e(a24) {}
}
class C25 {
set e(a25) {}
}
class C26 {
set e(a26) {}
}
class C27 {
set e(a27) {}
}
class C28 {
set e(a28) {}
}
class C29 {
set e(a29) {}
}
class C30 {
set e(a30) {}
}
class C31 {
set e(a31) {}
}
class C32 {
set e(a32) {}
}
class C33 {
set e(a33) {}
}
class C34 {
set e(a34) {}
}
class C35 {
set e(a35) {}
}
class C36 {
set e(a36) {}
}
class C37 {
set e(a37) {}
}
class C38 {
set e(a38) {}
}
class C39 {
set e(a39) {}
}
class C40 {
set e(a40) {}
}
class C41 {
set e(a41) {}
}
class C42 {
set e(a42) {}
}
class C43 {
set e(a43) {}
}
class C44 {
set e(a44) {}
}
class C45 {
set e(a45) {}
}
class C46 {
set e(a46) {}
}
class C47 {
set e(a47) {}
}
class C48 {
set e(a48) {}
}
class C49 {
set e(a49) {}
}
class C50 {
set e(a50) {}
}
class C51 {
set e(a51) {}
}
class C52 {
set e(a52) {}
}
class C53 {
set e(a53) {}
}
class C54 {
set e(a54) {}
}
class C55 {
set e(a55) {}
}
class C56 {
set e(a56) {}
}
class C57 {
set e(a57) {}
}
class C58 {
set e(a58) {}
}
class C59 {
set e(a59) {}
}
class C60 {
set e(a60) {}
}
class C61 {
set e(a61) {}
}
class C62 {
set e(a62) {}
}
class C63 {
set e(a63) {}
}
class C64 {
set e(a64) {}
}
class C65 {
set e(a64) {}
}
class C66 {
set e(a66) {}
}
class C67 {
set e(a67) {}
}
class C68 {
set e(a68) {}
}
class C69 {
set e(a69) {}
}
class C70 {
set e(a70) {}
}
class C71 {
set e(a71) {}
}
class C72 {
set e(a72) {}
}
class C73 {
set e(a73) {}
}
class C74 {
set e(a74) {}
}
class C75 {
set e(a75) {}
}
class C76 {
set e(a76) {}
}
class C77 {
set e(a77) {}
}
class C78 {
set e(a78) {}
}
class C79 {
set e(a79) {}
}
class C80 {
set e(a80) {}
}
class C81 {
set e(a81) {}
}
class C82 {
set e(a82) {}
}
class C83 {
set e(a83) {}
}
class C84 {
set e(a84) {}
}
class C85 {
set e(a85) {}
}
class C86 {
set e(a86) {}
}