From 103b9069e96fa4632984d79d6d929087ec38c507 Mon Sep 17 00:00:00 2001 From: Wen HU Date: Fri, 22 Jan 2021 14:39:07 -0800 Subject: [PATCH 1/5] fix a bug in getting func signature string, which also assert debug testing --- src/mapleall/maple_ir/src/mir_function.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index 76bb6cbaaa..e18f980ef4 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -471,9 +471,11 @@ void MIRFunction::SetBaseClassFuncNames(GStrIdx strIdx) { std::string funcNameWithType = name.substr(pos + width, name.length() - pos - width); baseFuncWithTypeStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); size_t index = name.find(namemangler::kRigthBracketStr); - ASSERT(index != std::string::npos, "Invalid name, cannot find '_29' in name"); - size_t posEnd = index + (std::string(namemangler::kRigthBracketStr)).length(); - funcNameWithType = name.substr(pos + width, posEnd - pos - width); + if (index != std::string::npos) { + size_t posEnd = index + (std::string(namemangler::kRigthBracketStr)).length(); + funcNameWithType = name.substr(pos + width, posEnd - pos - width); + } + baseFuncSigStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); size_t newPos = name.find(delimiter, pos + width); while (newPos != std::string::npos && (name[newPos - 1] == '_' && name[newPos - 2] != '_')) { newPos = name.find(delimiter, newPos + width); -- Gitee From 3a32d99426af5400d1ce75da724de10340ed8284 Mon Sep 17 00:00:00 2001 From: Wen HU Date: Sat, 23 Jan 2021 16:10:51 -0500 Subject: [PATCH 2/5] fix a typo --- src/mapleall/maple_ir/src/mir_function.cpp | 4 ++-- src/mapleall/maple_util/include/namemangler.h | 2 +- src/mrt/compiler-rt/include/namemangler.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index e18f980ef4..3fb87d9704 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -470,9 +470,9 @@ void MIRFunction::SetBaseClassFuncNames(GStrIdx strIdx) { baseClassStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(className); std::string funcNameWithType = name.substr(pos + width, name.length() - pos - width); baseFuncWithTypeStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); - size_t index = name.find(namemangler::kRigthBracketStr); + size_t index = name.find(namemangler::kRightBracketStr); if (index != std::string::npos) { - size_t posEnd = index + (std::string(namemangler::kRigthBracketStr)).length(); + size_t posEnd = index + (std::string(namemangler::kRightBracketStr)).length(); funcNameWithType = name.substr(pos + width, posEnd - pos - width); } baseFuncSigStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); diff --git a/src/mapleall/maple_util/include/namemangler.h b/src/mapleall/maple_util/include/namemangler.h index d95e725b7d..eed254bc5b 100644 --- a/src/mapleall/maple_util/include/namemangler.h +++ b/src/mapleall/maple_util/include/namemangler.h @@ -133,7 +133,7 @@ static constexpr const char kClinvocation[] = ".clinvocation"; static constexpr const char kPackageNameSplitterStr[] = "_2F"; static constexpr const char kFileNameSplitterStr[] = "$$"; static constexpr const char kNameSplitterStr[] = "_7C"; // 7C is the ascii code for | -static constexpr const char kRigthBracketStr[] = "_29"; // 29 is the ascii code for ) +static constexpr const char kRightBracketStr[] = "_29"; // 29 is the ascii code for ) static constexpr const char kClassNameSplitterStr[] = "_3B_7C"; static constexpr const char kJavaLangClassStr[] = "Ljava_2Flang_2FClass_3B"; static constexpr const char kJavaLangObjectStr[] = "Ljava_2Flang_2FObject_3B"; diff --git a/src/mrt/compiler-rt/include/namemangler.h b/src/mrt/compiler-rt/include/namemangler.h index d95e725b7d..eed254bc5b 100644 --- a/src/mrt/compiler-rt/include/namemangler.h +++ b/src/mrt/compiler-rt/include/namemangler.h @@ -133,7 +133,7 @@ static constexpr const char kClinvocation[] = ".clinvocation"; static constexpr const char kPackageNameSplitterStr[] = "_2F"; static constexpr const char kFileNameSplitterStr[] = "$$"; static constexpr const char kNameSplitterStr[] = "_7C"; // 7C is the ascii code for | -static constexpr const char kRigthBracketStr[] = "_29"; // 29 is the ascii code for ) +static constexpr const char kRightBracketStr[] = "_29"; // 29 is the ascii code for ) static constexpr const char kClassNameSplitterStr[] = "_3B_7C"; static constexpr const char kJavaLangClassStr[] = "Ljava_2Flang_2FClass_3B"; static constexpr const char kJavaLangObjectStr[] = "Ljava_2Flang_2FObject_3B"; -- Gitee From dc850e31808beb71e9f8760820daf51361574a81 Mon Sep 17 00:00:00 2001 From: Wen HU Date: Tue, 26 Jan 2021 13:58:02 -0800 Subject: [PATCH 3/5] update license year --- src/mapleall/maple_ir/src/mir_function.cpp | 2 +- src/mapleall/maple_util/include/namemangler.h | 2 +- src/mrt/compiler-rt/include/namemangler.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index 3fb87d9704..3a432f2bdd 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2021] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. diff --git a/src/mapleall/maple_util/include/namemangler.h b/src/mapleall/maple_util/include/namemangler.h index eed254bc5b..d561f3ce90 100644 --- a/src/mapleall/maple_util/include/namemangler.h +++ b/src/mapleall/maple_util/include/namemangler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2021] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. diff --git a/src/mrt/compiler-rt/include/namemangler.h b/src/mrt/compiler-rt/include/namemangler.h index eed254bc5b..d561f3ce90 100644 --- a/src/mrt/compiler-rt/include/namemangler.h +++ b/src/mrt/compiler-rt/include/namemangler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2021] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. -- Gitee From c7d8a17021c5d6b798117684050bc8afe62e7660 Mon Sep 17 00:00:00 2001 From: Wen HU Date: Fri, 22 Jan 2021 14:39:07 -0800 Subject: [PATCH 4/5] fix a bug in getting func signature string, which also assert debug testing --- src/mapleall/maple_ir/src/mir_function.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index 02aaefedc3..24c226bf70 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -485,10 +485,12 @@ void MIRFunction::SetBaseClassFuncNames(GStrIdx strIdx) { baseClassStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(className); std::string funcNameWithType = name.substr(pos + width, name.length() - pos - width); baseFuncWithTypeStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); - size_t index = name.find(namemangler::kRightBracketStr); - ASSERT(index != std::string::npos, "Invalid name, cannot find '_29' in name"); - size_t posEnd = index + (std::string(namemangler::kRightBracketStr)).length(); - funcNameWithType = name.substr(pos + width, posEnd - pos - width); + size_t index = name.find(namemangler::kRigthBracketStr); + if (index != std::string::npos) { + size_t posEnd = index + (std::string(namemangler::kRigthBracketStr)).length(); + funcNameWithType = name.substr(pos + width, posEnd - pos - width); + } + baseFuncSigStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); size_t newPos = name.find(delimiter, pos + width); while (newPos != std::string::npos && (name[newPos - 1] == '_' && name[newPos - 2] != '_')) { newPos = name.find(delimiter, newPos + width); -- Gitee From b23822f8404ba3d5595347e0c7455acab335fac3 Mon Sep 17 00:00:00 2001 From: Wen HU Date: Sat, 23 Jan 2021 16:10:51 -0500 Subject: [PATCH 5/5] fix a typo --- src/mapleall/maple_ir/src/mir_function.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index 24c226bf70..cd879143e3 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -485,9 +485,9 @@ void MIRFunction::SetBaseClassFuncNames(GStrIdx strIdx) { baseClassStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(className); std::string funcNameWithType = name.substr(pos + width, name.length() - pos - width); baseFuncWithTypeStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); - size_t index = name.find(namemangler::kRigthBracketStr); + size_t index = name.find(namemangler::kRightBracketStr); if (index != std::string::npos) { - size_t posEnd = index + (std::string(namemangler::kRigthBracketStr)).length(); + size_t posEnd = index + (std::string(namemangler::kRightBracketStr)).length(); funcNameWithType = name.substr(pos + width, posEnd - pos - width); } baseFuncSigStrIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(funcNameWithType); -- Gitee