diff --git a/doc/Programming_Specifications.md b/doc/Programming_Specifications.md
index 826f0d99464e8a6f6e07e80e93ab1720a692d320..4a0fec8b6a338b0ee569fb263360871fdee9cbf8 100644
--- a/doc/Programming_Specifications.md
+++ b/doc/Programming_Specifications.md
@@ -557,7 +557,7 @@ default: // Bad: default 未缩进
// 假设下面第一行已经不满足行宽要求
```cpp
if (currentValue > threshold &&
- someConditionsion) {
+ someConditionsion) {
DoSomething();
...
}
@@ -612,14 +612,10 @@ const int rank[] = {
```
## 指针与引用
-### 建议3.12.1 指针类型"`*`"跟随变量名或者类型,不要两边都留有或者都没有空格
-指针命名: `*`靠左靠右都可以,但是不要两边都有或者都没有空格。
+### 建议3.12.1 指针类型"`*`"跟随变量名,并与类型之间有一个空格
+
```cpp
-int* p = nullptr; // Good
int *p = nullptr; // Good
-
-int*p = nullptr; // Bad
-int * p = nullptr; // Bad
```
例外:当变量被 const 修饰时,"`*`" 无法跟随变量,此时也不要跟随类型。
@@ -627,16 +623,12 @@ int * p = nullptr; // Bad
char * const VERSION = "V100";
```
-### 建议3.12.2 引用类型"`&`"跟随变量名或者类型,不要两边都留有或者都没有空格
-引用命名:`&`靠左靠右都可以,但是不要两边都有或者都没有空格。
+### 建议3.12.2 引用类型"`&`"跟随变量名,并与类型之间有一个空格
+
```cpp
int i = 8;
-int& p = i; // Good
int &p = i; // Good
-
-int & p = i; // Bad
-int&p = i; // Bad
```
## 编译预处理
@@ -861,8 +853,13 @@ class MyClass : public BaseClass {
void SomeFunctionThatDoesNothing() {
}
- void SetVar(int var) { someVar = var; }
- int GetVar() const { return someVar; }
+ void SetVar(int var) {
+ someVar = var;
+ }
+
+ int GetVar() const {
+ return someVar;
+ }
private:
bool SomeInternalFunction();
@@ -1097,8 +1094,7 @@ class Foo {
#include "Foo.h"
namespace { // Good: 对内函数的声明放在.cpp文件的头部,并声明为匿名namespace或者static限制其作用域
-void Bar()
-{
+void Bar() {
}
}
diff --git a/src/bin/maple b/src/bin/maple
index 43bd7e27a7ea7779beadbe98790f55001e6bec5f..e03b0269da540e6d572e9e23c171b77f6829727e 100755
Binary files a/src/bin/maple and b/src/bin/maple differ
diff --git a/src/bin/mplcg b/src/bin/mplcg
index 6f58063b8f211db814ea07c31fac5c648743ce58..944794d30c14c2f68c9b38bc22928726a77b2563 100755
Binary files a/src/bin/mplcg and b/src/bin/mplcg differ
diff --git a/src/maple_driver/include/compiler.h b/src/maple_driver/include/compiler.h
index d51c10c50823ca2823c5f7ee0bad0c1074e030dd..3e98a31229009ae18c731222e9c428507fe5078f 100644
--- a/src/maple_driver/include/compiler.h
+++ b/src/maple_driver/include/compiler.h
@@ -24,11 +24,11 @@
#include "mir_parser.h"
namespace maple {
-static constexpr char kBinNameJbc2mpl[] = "jbc2mpl";
-static constexpr char kBinNameMe[] = "me";
-static constexpr char kBinNameMpl2mpl[] = "mpl2mpl";
-static constexpr char kBinNameMplcg[] = "mplcg";
-static constexpr char kBinNameMapleComb[] = "maplecomb";
+static const std::string kBinNameJbc2mpl = "jbc2mpl";
+static const std::string kBinNameMe = "me";
+static const std::string kBinNameMpl2mpl = "mpl2mpl";
+static const std::string kBinNameMplcg = "mplcg";
+static const std::string kBinNameMapleComb = "maplecomb";
class Compiler {
public:
diff --git a/src/maple_driver/include/driver_runner.h b/src/maple_driver/include/driver_runner.h
index 95121c081af984ae48830a81f9b11cf7ecd23902..729c2c4768b4dc754a87217e5dac7a9072692f73 100644
--- a/src/maple_driver/include/driver_runner.h
+++ b/src/maple_driver/include/driver_runner.h
@@ -93,7 +93,6 @@ class DriverRunner final {
void AddPhase(std::vector &phases, std::string phase, const PhaseManager &phaseManager) const;
};
-
} // namespace maple
#endif // MAPLE_DRIVER_INCLUDE_DRIVER_RUNNER_H
diff --git a/src/maple_driver/include/safe_exe.h b/src/maple_driver/include/safe_exe.h
index e47c8952f82c42d19acc53966d2adde4e77154e8..a48f5331a10c514909b239a99c10248de7087b9a 100644
--- a/src/maple_driver/include/safe_exe.h
+++ b/src/maple_driver/include/safe_exe.h
@@ -34,15 +34,8 @@ class SafeExe {
/**
* Current tool is for linux only
*/
- static int Exe(const std::string &cmd, const std::string &args) {
- LogInfo::MapleLogger() << "Starting:" << cmd << args << '\n';
- int ret = ErrorCode::kErrorNoError;
- if (StringUtils::HasCommandInjectionChar(cmd) || StringUtils::HasCommandInjectionChar(args)) {
- LogInfo::MapleLogger() << "Error while Exe, cmd: " << cmd << " args: " << args << '\n';
- return -1;
- }
-
#if __linux__ or __linux
+ static ErrorCode HandleCommand(const std::string &cmd, const std::string &args) {
std::vector tmpArgs;
StringUtils::Split(args, tmpArgs, ' ');
// remove ' ' in vector
@@ -67,6 +60,7 @@ class SafeExe {
// end of arguments sentinel is NULL
argv[tmpArgs.size()] = NULL;
pid_t pid = fork();
+ ErrorCode ret = ErrorCode::kErrorNoError;
if (pid == 0) {
// child process
fflush(NULL);
@@ -94,8 +88,21 @@ class SafeExe {
}
delete [] argv;
return ret;
+ }
+#endif
+
+ static ErrorCode Exe(const std::string &cmd, const std::string &args) {
+ LogInfo::MapleLogger() << "Starting:" << cmd << args << '\n';
+ if (StringUtils::HasCommandInjectionChar(cmd) || StringUtils::HasCommandInjectionChar(args)) {
+ LogInfo::MapleLogger() << "Error while Exe, cmd: " << cmd << " args: " << args << '\n';
+ return ErrorCode::kErrorCompileFail;
+ }
+
+#if __linux__ or __linux
+ ErrorCode ret = HandleCommand(cmd, args);
+ return ret;
#else
- return -1;
+ return ErrorCode::kErrorNotImplement;
#endif
}
};
diff --git a/src/mpl2mpl/include/class_hierarchy.h b/src/mpl2mpl/include/class_hierarchy.h
index 5a7bd575abc896ce307da7de8d195a79b7269d5d..6f45868f5bd62b091b903402520adb91fb3ed540 100644
--- a/src/mpl2mpl/include/class_hierarchy.h
+++ b/src/mpl2mpl/include/class_hierarchy.h
@@ -47,41 +47,6 @@ class Klass {
}
};
- private:
- // structType can be class or interface
- MIRStructType *structType;
- MapleAllocator *alloc;
- // A collection of super classes.
- // superklass is nullptr if it is not defined in the module.
- MapleList superKlasses;
- // A collection of sub classes
- MapleSet subKlasses;
- // a collection of classes which implement the current interface
- MapleSet implKlasses;
- // a collection of interfaces which is implemented by the current klass
- MapleSet implInterfaces;
- // A collection of class member methods
- MapleList methods;
- // A mapping to track every method to its baseFuncNameWithType
- MapleMap strIdx2Method;
- MIRFunction *clinitMethod;
- MIRSymbol *classInitBridge;
- // A mapping to track possible implementations for each virtual function
- MapleMap*> strIdx2CandidateMap;
- // flags of this class.
- // Now contains whether this class is exception, reference or has finalizer.
- uint32 flags;
- bool isPrivateInnerAndNoSubClassFlag;
- bool hasNativeMethods;
- bool needDecoupling;
- void DumpKlassImplInterfaces() const;
- void DumpKlassImplKlasses() const;
- void DumpKlassSuperKlasses() const;
- void DumpKlassSubKlasses() const;
- void DumpKlassMethods() const;
- bool IsVirtualMethod(const MIRFunction &func) const;
-
- public:
Klass(MIRStructType *type, MapleAllocator *alc);
~Klass() = default;
@@ -277,6 +242,40 @@ class Klass {
// Count the virtual methods for subclasses and merge with itself
void CountVirtMethBottomUp();
void Dump() const;
+
+ private:
+ // structType can be class or interface
+ MIRStructType *structType;
+ MapleAllocator *alloc;
+ // A collection of super classes.
+ // superklass is nullptr if it is not defined in the module.
+ MapleList superKlasses;
+ // A collection of sub classes
+ MapleSet subKlasses;
+ // a collection of classes which implement the current interface
+ MapleSet implKlasses;
+ // a collection of interfaces which is implemented by the current klass
+ MapleSet implInterfaces;
+ // A collection of class member methods
+ MapleList methods;
+ // A mapping to track every method to its baseFuncNameWithType
+ MapleMap strIdx2Method;
+ MIRFunction *clinitMethod;
+ MIRSymbol *classInitBridge;
+ // A mapping to track possible implementations for each virtual function
+ MapleMap*> strIdx2CandidateMap;
+ // flags of this class.
+ // Now contains whether this class is exception, reference or has finalizer.
+ uint32 flags;
+ bool isPrivateInnerAndNoSubClassFlag;
+ bool hasNativeMethods;
+ bool needDecoupling;
+ void DumpKlassImplInterfaces() const;
+ void DumpKlassImplKlasses() const;
+ void DumpKlassSuperKlasses() const;
+ void DumpKlassSubKlasses() const;
+ void DumpKlassMethods() const;
+ bool IsVirtualMethod(const MIRFunction &func) const;
};
// Some well known types like java.lang.Object. They may be commonly referenced.
@@ -345,11 +344,11 @@ class KlassHierarchy : public AnalysisResult {
bool UpdateFieldID(TyIdx baseTypeIdx, TyIdx targetTypeIdx, FieldID &fldID) const;
// return true if class, its super or interfaces have at least one clinit function
bool NeedClinitCheckRecursively(Klass &kl);
- void TopologicalSortKlasses();
- void MarkClassFlags();
+
void CountVirtualMethods();
void BuildHierarchy();
void Dump() const;
+
const MapleVector &GetTopoSortedKlasses() const {
return topoWorkList;
}
@@ -383,6 +382,8 @@ class KlassHierarchy : public AnalysisResult {
void ExceptionFlagProp(Klass &klass);
Klass *AddClassFlag(const std::string &name, uint32 flag);
int GetFieldIDOffsetBetweenClasses(const Klass &super, const Klass &base) const;
+ void TopologicalSortKlasses();
+ void MarkClassFlags();
};
} // namespace maple
#endif // MPL2MPL_INCLUDE_CLASS_HIERARCHY_H
diff --git a/src/mpl2mpl/include/class_init.h b/src/mpl2mpl/include/class_init.h
index 2fb5d3ce35791f1b4987e9f66ee49449e322e498..946ce2a9b22c6967f002d6f2742077475eeeb512 100644
--- a/src/mpl2mpl/include/class_init.h
+++ b/src/mpl2mpl/include/class_init.h
@@ -27,7 +27,7 @@ class ClassInit : public FuncOptimizeImpl {
~ClassInit() = default;
FuncOptimizeImpl *Clone() override {
- return new (std::nothrow) ClassInit(*this);
+ return new ClassInit(*this);
}
void ProcessFunc(MIRFunction *func) override;
diff --git a/src/mpl2mpl/include/gen_check_cast.h b/src/mpl2mpl/include/gen_check_cast.h
index 9136b9ac1710ff731137c77bf409f1b4e036a706..8a827114775b70a6c55f4d4f049a80227796dd29 100644
--- a/src/mpl2mpl/include/gen_check_cast.h
+++ b/src/mpl2mpl/include/gen_check_cast.h
@@ -30,7 +30,7 @@ class CheckCastGenerator : public FuncOptimizeImpl {
~CheckCastGenerator() {}
FuncOptimizeImpl *Clone() override {
- return new (std::nothrow) CheckCastGenerator(*this);
+ return new CheckCastGenerator(*this);
}
void ProcessFunc(MIRFunction *func) override;
diff --git a/src/mpl2mpl/include/muid_replacement.h b/src/mpl2mpl/include/muid_replacement.h
index d22a4b8c6348e5dab2c5b9d2b8a165a2d08eb105..bb13143b86eb0b65e15880c0f27198e074794f9b 100644
--- a/src/mpl2mpl/include/muid_replacement.h
+++ b/src/mpl2mpl/include/muid_replacement.h
@@ -61,7 +61,7 @@ class MUIDReplacement : public FuncOptimizeImpl {
~MUIDReplacement() = default;
FuncOptimizeImpl *Clone() override {
- return new (std::nothrow) MUIDReplacement(*this);
+ return new MUIDReplacement(*this);
}
void ProcessFunc(MIRFunction *func) override;
diff --git a/src/mpl2mpl/include/native_stub_func.h b/src/mpl2mpl/include/native_stub_func.h
index 4dd5ac59dac80475cb831838ee499d30d04918bd..fb421c5b0baf94bace3014d9e181da406e7bd941 100644
--- a/src/mpl2mpl/include/native_stub_func.h
+++ b/src/mpl2mpl/include/native_stub_func.h
@@ -58,7 +58,7 @@ class GenericNativeStubFunc : public FuncOptimizeImpl {
void ProcessFunc(MIRFunction *func) override;
void Finish() override;
FuncOptimizeImpl *Clone() override {
- return new (std::nothrow) GenericNativeStubFunc(*this);
+ return new GenericNativeStubFunc(*this);
}
private:
diff --git a/src/mpl2mpl/include/reflection_analysis.h b/src/mpl2mpl/include/reflection_analysis.h
index 0bf8e7006310f588e7ff2e668bbb83ac3c287036..5dccf08d193851714d0037bc3b3100ff0c9421af 100644
--- a/src/mpl2mpl/include/reflection_analysis.h
+++ b/src/mpl2mpl/include/reflection_analysis.h
@@ -229,10 +229,38 @@ class ReflectionAnalysis : public AnalysisResult {
static void GenStrTab(MIRModule &mirmodule);
static uint32 FindOrInsertRepeatString(const std::string &str, bool isHot = false, uint8 hotType = kLayoutUnused);
static BaseNode *GenClassInfoAddr(BaseNode *obj, MIRBuilder &builder);
+ void Run();
+ static void ConvertMethodSig(std::string &signature);
static TyIdx GetClassMetaDataTyIdx() {
return classMetadataTyIdx;
}
+ private:
+ MIRModule *mirModule;
+ MapleAllocator allocator;
+ KlassHierarchy *klassh;
+ MIRBuilder &mirBuilder;
+ MapleVector classTab;
+ int isLibcore;
+ std::map highFrequencyStrMap;
+ std::string reflectionMuidStr;
+ static const char *klassPtrName;
+ static TyIdx classMetadataTyIdx;
+ static TyIdx classMetadataRoTyIdx;
+ static TyIdx methodsInfoTyIdx;
+ static TyIdx methodsInfoCompactTyIdx;
+ static TyIdx fieldsInfoTyIdx;
+ static TyIdx fieldsInfoCompactTyIdx;
+ static TyIdx superclassMetadataTyIdx;
+ static std::string strTab;
+ static std::unordered_map str2IdxMap;
+ static std::string strTabStartHot;
+ static std::string strTabBothHot;
+ static std::string strTabRunHot;
+ static bool strTabInited;
+ static TyIdx invalidIdx;
+ static constexpr uint16 kNoHashBits = 6u;
+
static std::unordered_map &GetStr2IdxMap() {
return str2IdxMap;
}
@@ -273,6 +301,7 @@ class ReflectionAnalysis : public AnalysisResult {
strTabRunHot += str;
}
+ static uint32 FirstFindOrInsertRepeatString(const std::string &str, bool isHot, uint8 hotType);
MIRSymbol *GetOrCreateSymbol(const std::string &name, TyIdx tyIdx, bool needInit);
MIRSymbol *GetSymbol(const std::string &name, TyIdx tyIdx);
MIRSymbol *CreateSymbol(GStrIdx strIdx, TyIdx tyIdx);
@@ -295,7 +324,7 @@ class ReflectionAnalysis : public AnalysisResult {
int64 BKDRHash(const std::string &strname, uint32 seed);
void GenClassHashMetaData();
void MarkWeakMethods();
- void Run();
+
bool VtableFunc(const MIRFunction &func) const;
void GenPrimitiveClass();
bool RootClassDefined(); // wether current module defines root classes
@@ -313,7 +342,7 @@ class ReflectionAnalysis : public AnalysisResult {
bool IsStaticClass(MIRClassType &classType);
void CheckPrivateInnerAndNoSubClass(Klass &clazz, const std::string &annoArr);
void ConvertMapleClassName(const std::string &mplClassName, std::string &javaDsp);
- static void ConvertMethodSig(std::string &signature);
+
int GetDeflateStringIdx(const std::string &subStr);
uint32 GetAnnoCstrIndex(std::map &idxNumMap, const std::string &annoArr);
int16 GetMethodInVtabIndex(const Klass &clazz, const MIRFunction &func);
@@ -321,32 +350,6 @@ class ReflectionAnalysis : public AnalysisResult {
MIRSymbol *GetClinitFuncSymbol(const Klass &klass);
int SolveAnnotation(MIRClassType &classType, MIRFunction &func);
uint32 GetTypeNameIdxFromType(MIRType &type, const Klass &klass, const std::string &fieldName);
-
- private:
- MIRModule *mirModule;
- MapleAllocator allocator;
- KlassHierarchy *klassh;
- MIRBuilder &mirBuilder;
- MapleVector classTab;
- int isLibcore;
- std::map highFrequencyStrMap;
- std::string reflectionMuidStr;
- static const char *klassPtrName;
- static TyIdx classMetadataTyIdx;
- static TyIdx classMetadataRoTyIdx;
- static TyIdx methodsInfoTyIdx;
- static TyIdx methodsInfoCompactTyIdx;
- static TyIdx fieldsInfoTyIdx;
- static TyIdx fieldsInfoCompactTyIdx;
- static TyIdx superclassMetadataTyIdx;
- static std::string strTab;
- static std::unordered_map str2IdxMap;
- static std::string strTabStartHot;
- static std::string strTabBothHot;
- static std::string strTabRunHot;
- static bool strTabInited;
- static TyIdx invalidIdx;
- static constexpr uint16 kNoHashBits = 6u;
};
class DoReflectionAnalysis : public ModulePhase {
diff --git a/src/mpl2mpl/include/vtable_analysis.h b/src/mpl2mpl/include/vtable_analysis.h
index fccba681d4ff72eb3b2acac67afb7a06b6a4449c..dd015136ef5dde2a5c1a059f85982540cbb87de7 100644
--- a/src/mpl2mpl/include/vtable_analysis.h
+++ b/src/mpl2mpl/include/vtable_analysis.h
@@ -35,7 +35,7 @@ class VtableAnalysis : public FuncOptimizeImpl {
static std::string DecodeBaseNameWithType(const MIRFunction &func);
void ProcessFunc(MIRFunction *func) override;
FuncOptimizeImpl *Clone() override {
- return new (std::nothrow) VtableAnalysis(*this);
+ return new VtableAnalysis(*this);
}
private:
diff --git a/src/mpl2mpl/include/vtable_impl.h b/src/mpl2mpl/include/vtable_impl.h
index 90a60e6440959b3787266c659541b669d4264e22..e5faab35a8393564110925b9246c952dbeb9f802 100644
--- a/src/mpl2mpl/include/vtable_impl.h
+++ b/src/mpl2mpl/include/vtable_impl.h
@@ -38,7 +38,7 @@ class VtableImpl : public FuncOptimizeImpl {
void ProcessFunc(MIRFunction *func) override;
FuncOptimizeImpl *Clone() override {
- return new (std::nothrow) VtableImpl(*this);
+ return new VtableImpl(*this);
}
private:
diff --git a/src/mpl2mpl/src/gen_check_cast.cpp b/src/mpl2mpl/src/gen_check_cast.cpp
index f2fb139ce667897c401be555c678dee96e4bd11b..aef6e80c46b44ebb712f805031ca1ac14b32a8a8 100644
--- a/src/mpl2mpl/src/gen_check_cast.cpp
+++ b/src/mpl2mpl/src/gen_check_cast.cpp
@@ -38,7 +38,8 @@ CheckCastGenerator::CheckCastGenerator(MIRModule *mod, KlassHierarchy *kh, bool
void CheckCastGenerator::InitTypes() {
pointerObjType = GlobalTables::GetTypeTable().GetOrCreatePointerType(*WKTypes::Util::GetJavaLangObjectType());
- classinfoType = GlobalTables::GetTypeTable().GetOrCreateClassType(NameMangler::kClassMetadataTypeName, GetMIRModule());
+ classinfoType = GlobalTables::GetTypeTable().GetOrCreateClassType(NameMangler::kClassMetadataTypeName,
+ GetMIRModule());
pointerClassMetaType = GlobalTables::GetTypeTable().GetOrCreatePointerType(*classinfoType);
}
diff --git a/src/mpl2mpl/src/muid_replacement.cpp b/src/mpl2mpl/src/muid_replacement.cpp
index 04b1c1610e56c9259d7bef9dc4a20d489e71dac4..7b1b580be7230294c158d700bdf02095d49de3a6 100644
--- a/src/mpl2mpl/src/muid_replacement.cpp
+++ b/src/mpl2mpl/src/muid_replacement.cpp
@@ -336,9 +336,11 @@ void MUIDReplacement::GenericFuncDefTable() {
MUID muid = keyVal.second;
MIRAggConst *entryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), *funcDefTabEntryType);
uint32 fieldID = 1;
- MIRAggConst *funcInfEntryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), *funcInfTabEntryType);
+ MIRAggConst *funcInfEntryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(),
+ *funcInfTabEntryType);
uint32 funcInfFieldID = 1;
- MIRAggConst *muidEntryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), *funcDefMuidTabEntryType);
+ MIRAggConst *muidEntryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(),
+ *funcDefMuidTabEntryType);
uint32 muidFieldID = 1;
// To be processed by runtime
builder->AddAddroffuncFieldConst(*funcDefTabEntryType, *entryConst, fieldID++, *funcSymbol);
@@ -422,7 +424,8 @@ void MUIDReplacement::GenericDataDefTable() {
MIRAggConst *entryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), *dataDefTabEntryType);
uint32 fieldID = 1;
MUID muid = keyVal.first;
- MIRAggConst *muidEntryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), *dataDefMuidTabEntryType);
+ MIRAggConst *muidEntryConst = GetMIRModule().GetMemPool()->New(GetMIRModule(),
+ *dataDefMuidTabEntryType);
uint32 muidFieldID = 1;
// Will be emitted as 0 and processed by runtime
builder->AddAddrofFieldConst(*dataDefTabEntryType, *entryConst, fieldID++, *mirSymbol);
@@ -494,7 +497,8 @@ void MUIDReplacement::GenericUnifiedUndefTable() {
static_cast(GlobalTables::GetTypeTable().GetOrCreateStructType(
"MUIDUnifiedUndefMuidTabEntry", muidFields, parentFields, GetMIRModule()));
size_t arraySize = funcUndefMap.size();
- MIRArrayType &funcArrayType = *GlobalTables::GetTypeTable().GetOrCreateArrayType(*unifiedUndefTabEntryType, arraySize);
+ MIRArrayType &funcArrayType = *GlobalTables::GetTypeTable().GetOrCreateArrayType(*unifiedUndefTabEntryType,
+ arraySize);
MIRAggConst *funcUndefTabConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), funcArrayType);
MIRArrayType &funcMuidArrayType =
*GlobalTables::GetTypeTable().GetOrCreateArrayType(*unifiedUndefMuidTabEntryType, arraySize);
@@ -534,7 +538,8 @@ void MUIDReplacement::GenericUnifiedUndefTable() {
}
// Continue to generate dataUndefTab
arraySize = dataUndefMap.size();
- MIRArrayType &dataArrayType = *GlobalTables::GetTypeTable().GetOrCreateArrayType(*unifiedUndefTabEntryType, arraySize);
+ MIRArrayType &dataArrayType = *GlobalTables::GetTypeTable().GetOrCreateArrayType(*unifiedUndefTabEntryType,
+ arraySize);
MIRAggConst *dataUndefTabConst = GetMIRModule().GetMemPool()->New(GetMIRModule(), dataArrayType);
MIRArrayType &dataMuidArrayType =
*GlobalTables::GetTypeTable().GetOrCreateArrayType(*unifiedUndefMuidTabEntryType, arraySize);
diff --git a/src/mpl2mpl/src/native_stub_func.cpp b/src/mpl2mpl/src/native_stub_func.cpp
index ecedfbb6b5918dd3019d36ab7e3a63140e67b239..68f2678fc2db9014c84e45b93f5c835e813dfa58 100644
--- a/src/mpl2mpl/src/native_stub_func.cpp
+++ b/src/mpl2mpl/src/native_stub_func.cpp
@@ -325,7 +325,8 @@ void GenericNativeStubFunc::GenericRegTabEntry(const MIRFunction &func) {
MIRConst *baseConst =
GetMIRModule().GetMemPool()->New(classIdx, *GlobalTables::GetTypeTable().GetVoidPtr());
regTableConst->GetConstVec().push_back(baseConst);
- MIRConst *newConst = GetMIRModule().GetMemPool()->New(nameIdx, *GlobalTables::GetTypeTable().GetVoidPtr());
+ MIRConst *newConst = GetMIRModule().GetMemPool()->New(nameIdx,
+ *GlobalTables::GetTypeTable().GetVoidPtr());
regTableConst->GetConstVec().push_back(newConst);
}
@@ -591,7 +592,8 @@ void GenericNativeStubFunc::GenericHelperFuncDecl() {
ArgVector postArgs(GetMIRModule().GetMPAllocator().Adapter());
postArgs.push_back(ArgPair("env", voidPointerType));
MRTPostNativeFunc = builder->CreateFunction(kPostNativeFunc, *voidType, postArgs);
- CHECK_FATAL(MRTPostNativeFunc != nullptr, "MRTPostNativeFunc is null in GenericNativeStubFunc::GenericHelperFuncDecl");
+ CHECK_FATAL(MRTPostNativeFunc != nullptr,
+ "MRTPostNativeFunc is null in GenericNativeStubFunc::GenericHelperFuncDecl");
MRTPostNativeFunc->SetBody(nullptr);
// MRT_DecodeReference
ArgVector decodeArgs(GetMIRModule().GetMPAllocator().Adapter());
diff --git a/src/mpl2mpl/src/reflection_analysis.cpp b/src/mpl2mpl/src/reflection_analysis.cpp
index 721fdb94be869ac7ec351cfb72f41fcc76d57d31..e38b6d9e3e29dfb1aebcdbc1def6b95c38b39113 100644
--- a/src/mpl2mpl/src/reflection_analysis.cpp
+++ b/src/mpl2mpl/src/reflection_analysis.cpp
@@ -48,7 +48,7 @@ int ReflectionAnalysis::GetDeflateStringIdx(const std::string &subStr) {
return FindOrInsertReflectString("0!" + subStr);
}
-static uint32 FirstFindOrInsertRepeatString(const std::string &str, bool isHot, uint8 hotType) {
+uint32 ReflectionAnalysis::FirstFindOrInsertRepeatString(const std::string &str, bool isHot, uint8 hotType) {
uint32 index = 0;
constexpr uint32 lengthShift = 2u;
auto it = ReflectionAnalysis::GetStr2IdxMap().find(str);
@@ -949,7 +949,7 @@ std::string ReflectionAnalysis::GetAnnotationValue(MapleVectorGetU64Val());
std::string t = GlobalTables::GetStrTable().GetStringFromStrIdx(strIdx);
DelimeterConvert(t);
- ReflectionAnalysis::CompressHighFrequencyStr(t);
+ CompressHighFrequencyStr(t);
annoArray += t;
} else if (arrayElem->GetType() == kValueBoolean || arrayElem->GetType() == kValueChar) {
annoArray += std::to_string(arrayElem->GetU64Val());
@@ -990,7 +990,7 @@ std::string ReflectionAnalysis::GetArrayValue(MapleVector sub
std::string javaDsp;
ConvertMapleClassName(GlobalTables::GetStrTable().GetStringFromStrIdx(arrayElem->GetTypeStrIdx()), javaDsp);
std::string typeStr = javaDsp;
- ReflectionAnalysis::CompressHighFrequencyStr(typeStr);
+ CompressHighFrequencyStr(typeStr);
annoArray += typeStr;
annoArray += '!';
std::string type;
@@ -1025,7 +1025,7 @@ std::string ReflectionAnalysis::GetArrayValue(MapleVector sub
strIdx.SetIdx(arrayElem->GetU64Val());
std::string t = GlobalTables::GetStrTable().GetStringFromStrIdx(strIdx);
DelimeterConvert(t);
- ReflectionAnalysis::CompressHighFrequencyStr(t);
+ CompressHighFrequencyStr(t);
if (arrayElem->GetType() == kValueString && isSN && t.size() > kMaxOptimiseThreshold) {
uint32 idx = ReflectionAnalysis::FindOrInsertReflectString(t);
t = "`" + std::to_string(idx);
@@ -1375,7 +1375,7 @@ void ReflectionAnalysis::GeneAnnotation(std::map &idxNumMap, std::stri
std::string pregTypeString = GlobalTables::GetStrTable().GetStringFromStrIdx(gindex);
std::string klassJavaDescriptor;
ConvertMapleClassName(pregTypeString, klassJavaDescriptor);
- ReflectionAnalysis::CompressHighFrequencyStr(klassJavaDescriptor);
+ CompressHighFrequencyStr(klassJavaDescriptor);
annoArr += klassJavaDescriptor;
annoArr += "!";
if (paramnumArray != nullptr) {
@@ -1386,7 +1386,7 @@ void ReflectionAnalysis::GeneAnnotation(std::map &idxNumMap, std::stri
idxNumMap[annoNum - 1]++;
std::string convertTmp =
NameMangler::DecodeName(GlobalTables::GetStrTable().GetStringFromStrIdx(elem->GetNameStrIdx()));
- ReflectionAnalysis::CompressHighFrequencyStr(convertTmp);
+ CompressHighFrequencyStr(convertTmp);
annoArr += convertTmp;
GStrIdx stridx;
annoArr += "!";
diff --git a/src/mpl2mpl/src/vtable_analysis.cpp b/src/mpl2mpl/src/vtable_analysis.cpp
index 0ef5c4f4d3df3495870fa05236c08b771bc4a52e..58776900aad024582c27ff8b7e201e187033dc46 100644
--- a/src/mpl2mpl/src/vtable_analysis.cpp
+++ b/src/mpl2mpl/src/vtable_analysis.cpp
@@ -167,7 +167,8 @@ void VtableAnalysis::GenVtableDefinition(const Klass &klass) {
MIRFunction *vtabMethod = builder->GetFunctionFromStidx(methodPair->first);
ASSERT(vtabMethod != nullptr, "null ptr check!");
AddroffuncNode *addrofFuncNode = builder->CreateExprAddroffunc(vtabMethod->GetPuidx(), GetMIRModule().GetMemPool());
- MIRConst *constNode = GetMIRModule().GetMemPool()->New(addrofFuncNode->GetPUIdx(), *voidPtrType);
+ MIRConst *constNode = GetMIRModule().GetMemPool()->New(addrofFuncNode->GetPUIdx(),
+ *voidPtrType);
newconst->GetConstVec().push_back(constNode);
}
// We also need to generate vtable and itable even if the class does not
@@ -309,7 +310,8 @@ void VtableAnalysis::GenItableDefinition(const Klass &klass) {
ASSERT(func != nullptr, "null ptr check!");
const std::string &signatureName = DecodeBaseNameWithType(*func);
uint32 nameIdx = ReflectionAnalysis::FindOrInsertRepeatString(signatureName);
- secondItabEmitArray->GetConstVec().push_back(GetMIRModule().GetMemPool()->New(nameIdx, *voidPtrType));
+ secondItabEmitArray->GetConstVec().push_back(GetMIRModule().GetMemPool()->New(nameIdx,
+ *voidPtrType));
secondItabEmitArray->GetConstVec().push_back(
GetMIRModule().GetMemPool()->New(func->GetPuidx(), *voidPtrType));
}
@@ -318,7 +320,8 @@ void VtableAnalysis::GenItableDefinition(const Klass &klass) {
// push the conflict symbol to the first-level itable
StIdx symIdx = GlobalTables::GetGsymTable().GetStIdxFromStrIdx(
GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(ITAB_CONFLICT_PREFIX_STR + klass.GetKlassName()));
- firstItabEmitArray->GetConstVec().push_back(GetMIRModule().GetMemPool()->New(symIdx, 0, *voidPtrType));
+ firstItabEmitArray->GetConstVec().push_back(GetMIRModule().GetMemPool()->New(symIdx, 0,
+ *voidPtrType));
}
GenTableSymbol(ITAB_PREFIX_STR, klass.GetKlassName(), *firstItabEmitArray);
}