From 2cd3eed131f21baf7c21a1dc8b3d3d3dfc7456fa Mon Sep 17 00:00:00 2001 From: chenqy930 Date: Thu, 29 Dec 2022 10:43:05 +0800 Subject: [PATCH] fixed 8fc60e2 from https://gitee.com/chenqy930/arkcompiler_ets_frontend_hotfix_dev/pulls/779 Fix patch_main_0 has redundant new function define ins Issue:I67ZVE Signed-off-by: chenqy930 Change-Id: I17670041ef3b4488366ae08d386cc506d71d7cb6 --- es2panda/util/hotfix.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/es2panda/util/hotfix.cpp b/es2panda/util/hotfix.cpp index ce21ad8158..b7aefc3c1d 100644 --- a/es2panda/util/hotfix.cpp +++ b/es2panda/util/hotfix.cpp @@ -261,6 +261,11 @@ bool IsFunctionOrClassDefineIns(panda::pandasm::Ins &ins) return false; } +bool IsStPatchVarIns(panda::pandasm::Ins &ins) +{ + return ins.opcode == panda::pandasm::Opcode::WIDE_STPATCHVAR; +} + void Hotfix::CollectFuncDefineIns(panda::pandasm::Function *func) { for (size_t i = 0; i < func->ins.size(); ++i) { @@ -329,7 +334,7 @@ void Hotfix::CreateFunctionPatchMain0AndMain1(panda::pandasm::Function &patchFun for (size_t i = 0; i < funcDefineIns_.size(); ++i) { if (IsFunctionOrClassDefineIns(funcDefineIns_[i])) { auto &name = funcDefineIns_[i].ids[0]; - if (newFuncNames_.count(name)) { + if (newFuncNames_.count(name) && IsStPatchVarIns(funcDefineIns_[i + 1])) { patchMain0DefineIns.push_back(funcDefineIns_[i]); patchMain0DefineIns.push_back(funcDefineIns_[i + 1]); continue; -- Gitee