代码拉取完成,页面将自动刷新
Compiler produces a store of 32-bit value to i8 and i16 fields in case of ets.stobj.name
Compiler should produce a 8-bit/16-bit store
Failing test:
diff --git a/static_core/plugins/ets/compiler/optimizer/ir_builder/ets_inst_builder.cpp b/static_core/plugins/ets/compiler/optimizer/ir_builder/ets_inst_builder.cpp
index 0f519097..c97724b3 100644
--- a/static_core/plugins/ets/compiler/optimizer/ir_builder/ets_inst_builder.cpp
+++ b/static_core/plugins/ets/compiler/optimizer/ir_builder/ets_inst_builder.cpp
@@ -150,8 +150,13 @@ void InstBuilder::BuildStObjByName(const BytecodeInstruction *bcInst, DataType::
break;
case DataType::UINT8:
case DataType::INT8:
+ id = RuntimeInterface::IntrinsicId::INTRINSIC_COMPILER_ETS_ST_OBJ_BY_NAME_I32;
+ type = DataType::INT8;
+ break;
case DataType::UINT16:
case DataType::INT16:
+ id = RuntimeInterface::IntrinsicId::INTRINSIC_COMPILER_ETS_ST_OBJ_BY_NAME_I32;
+ type = DataType::INT16;
case DataType::UINT32:
case DataType::INT32:
id = RuntimeInterface::IntrinsicId::INTRINSIC_COMPILER_ETS_ST_OBJ_BY_NAME_I32;
diff --git a/static_core/plugins/ets/tests/lookup_by_name/CMakeLists.txt b/static_core/plugins/ets/tests/lookup_by_name/CMakeLists.txt
index 9ed04f73..d7035204 100644
--- a/static_core/plugins/ets/tests/lookup_by_name/CMakeLists.txt
+++ b/static_core/plugins/ets/tests/lookup_by_name/CMakeLists.txt
@@ -32,6 +32,7 @@ set(LOOKUP_BY_NAME_TEST_LIST
"field_case_32bit"
"field_case_64bit"
"field_case_ref"
+ "peephole_8bit"
)
add_custom_target(ets_tests_lookup_by_name)
add_dependencies(ets_tests ets_tests_lookup_by_name)
diff --git a/static_core/plugins/ets/tests/lookup_by_name/peephole_8bit.pa b/static_core/plugins/ets/tests/lookup_by_name/peephole_8bit.pa
new file mode 100644
index 00000000..3fe02a80
--- /dev/null
+++ b/static_core/plugins/ets/tests/lookup_by_name/peephole_8bit.pa
@@ -0,0 +1,29 @@
+.language eTS
+
+.record std.core.Object
+.record A {
+ i8 bar
+ i8 baz
+}
+
+.union_field i8 bar
+.union_field i8 baz
+
+.function i32 load__noinline__(A a0) {
+ ets.ldobj.name a0, baz
+ return
+}
+
+.function i32 main() {
+ newobj v0, A
+ ldai -1
+ ets.stobj.name v0, bar
+
+ call.short load__noinline__, v0
+ jnez error1
+ ldai 0
+ return
+error1:
+ ldai 1
+ return
+}
感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 @godmiaozi @peijiajun @Ishin Pavel @Vyacheslav Cherkashin 。如果需要调整订阅PR、Issue的变更状态,请访问链接。
Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer @godmiaozi @peijiajun @Ishin Pavel @Vyacheslav Cherkashin for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论