Fix bug of pgo crash when dumping IC by name

When updating transition for parent and child, if the parent layout information can not be found
in transition layout record, directly return false instead of updating to avoid segmentation fault.

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IALR0P

Signed-off-by: wangyuxin <wangyuxin53@huawei.com>
Change-Id: I0cbe003c91a26e5894d616642422aa1dfec15524
This commit is contained in:
wangyuxin 2024-08-22 18:56:17 +08:00
parent 5be332038b
commit d3e8863c3a
6 changed files with 80 additions and 0 deletions

View File

@ -163,6 +163,10 @@ bool PGOHClassTreeDesc::UpdateForTransition(
return false;
}
}
if (transitionLayout_.find(parentType) == transitionLayout_.end()) {
return false;
}
bool ret = DumpForChild(child, childType);
auto parentLayoutDesc = transitionLayout_.find(parentType)->second;
auto childLayoutDesc = transitionLayout_.find(childType)->second;

View File

@ -222,6 +222,7 @@ group("ark_aot_ts_test") {
"pgo_class_prototype",
"pgo_constant_value_deopt",
"pgo_constructor_number",
"pgo_element_transition",
"pgo_elimination_loadconstoffset",
"pgo_fast_call_bridge",
"pgo_fast_call_deopt_bridge",

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_element_transition") {
deps = []
is_enable_pgo = true
}

View File

@ -0,0 +1,15 @@
# 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.
1
1

View File

@ -0,0 +1,26 @@
/*
* 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.
*/
function foo(){
let res ={
3:1,
__proto__:{},
}
return res;
}
let obj = foo()
obj.d = 1
print(obj.d)
print(obj[3])

View File

@ -0,0 +1,15 @@
# 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.
1
1