diff --git a/src/bin/jbc2mpl b/src/bin/jbc2mpl index a4cfb2595a988853a2fba76f35d57ccc25f9714f..cb8383274363bb38961c5bdfe264c1c3efeb3e44 100755 Binary files a/src/bin/jbc2mpl and b/src/bin/jbc2mpl differ diff --git a/src/bin/maple b/src/bin/maple index 330fdb14d288c78591fbab87e7f3feead2171bb0..5f52c5e53e589b5fde42fee0a60b10501dd23ee2 100755 Binary files a/src/bin/maple and b/src/bin/maple differ diff --git a/src/maple_driver/src/mpl_options.cpp b/src/maple_driver/src/mpl_options.cpp index 1b9dbe0ba7de761d32a938527e4989319eddc189..9c6e9cbbe1e7c53e7b988e3a402a0257407e83cf 100644 --- a/src/maple_driver/src/mpl_options.cpp +++ b/src/maple_driver/src/mpl_options.cpp @@ -996,6 +996,10 @@ int MplOptions::Parse(int argc, char **argv) { if (runMode == RunMode::kUnkownRun) { optimizationLevel = kO0; } + // Make sure in Auto mode + if (runMode != RunMode::kCustomRun) { + setDefaultLevel = true; + } // Check whether the input files were valid ret = CheckInputFileValidity(); diff --git a/src/maple_me/src/me_lower_globals.cpp b/src/maple_me/src/me_lower_globals.cpp index e873350b02bf1cf4611392cd925f7e40dddf5040..298b0bed700a595069190153d04bac0f83ae0ddd 100644 --- a/src/maple_me/src/me_lower_globals.cpp +++ b/src/maple_me/src/me_lower_globals.cpp @@ -119,7 +119,9 @@ void MeLowerGlobals::Run() { MeExpr *addrof = irMap->CreateAddrofMeExpr(baseOst->GetIndex()); MIRPtrType ptrType(baseOst->GetTyIdx(), PTY_ptr); TyIdx addrTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); - auto *lhsIvar = static_cast(irMap->CreateIvarMeExpr(*dass.GetLHS(), addrTyIdx, *addrof)); + MeExpr *lhs = dass.GetLHS(); + CHECK_NULL_FATAL(lhs); + auto *lhsIvar = static_cast(irMap->CreateIvarMeExpr(*lhs, addrTyIdx, *addrof)); IassignMeStmt *iass = irMap->NewInPool(addrTyIdx, lhsIvar, dass.GetRHS(), &*dass.GetChiList()); iass->SetBB(bb); iass->SetSrcPos(dass.GetSrcPosition()); diff --git a/src/maple_me/src/me_ssa_lpre.cpp b/src/maple_me/src/me_ssa_lpre.cpp index 7eb2b1795656eedb28fa4bbbb15133c2e903f2fb..e96fc7443baaa3c76c32a481e0463423ad399619 100644 --- a/src/maple_me/src/me_ssa_lpre.cpp +++ b/src/maple_me/src/me_ssa_lpre.cpp @@ -21,6 +21,7 @@ void MeSSALPre::GenerateSaveRealOcc(MeRealOcc *realOcc) { ASSERT(GetPUIdx() == workCand->GetPUIdx() || workCand->GetPUIdx() == 0, "GenerateSaveRealOcc: inconsistent puIdx"); MeExpr *regOrVar = CreateNewCurTemp(realOcc->GetMeExpr()); + CHECK_NULL_FATAL(regOrVar); if (!realOcc->IsLHS()) { // create a new meStmt before realOcc->GetMeStmt() MeStmt *newMeStmt = irMap->CreateRegassignMeStmt(*regOrVar, *realOcc->GetMeExpr(), *realOcc->GetMeStmt()->GetBB()); @@ -78,7 +79,7 @@ void MeSSALPre::GenerateSaveRealOcc(MeRealOcc *realOcc) { "LHS real occurrence has unrecognized stmt type"); MapleVector *mustDefList = realOcc->GetMeStmt()->GetMustDefList(); CHECK_NULL_FATAL(mustDefList); - ASSERT(!mustDefList->empty(), "empty mustdef in callassigned stmt"); + CHECK_FATAL(!mustDefList->empty(), "empty mustdef in callassigned stmt"); MustDefMeNode *mustDefMeNode = &mustDefList->front(); if (regOrVar->GetMeOp() == kMeOpReg) { auto *theLHS = static_cast(mustDefMeNode->GetLHS()); diff --git a/src/mpl2mpl/include/reflection_analysis.h b/src/mpl2mpl/include/reflection_analysis.h index 52ba34e6a61e0df07a61a9c9bcf10de029134f62..565d064a7808507d2fff53bb920e001769f79607 100644 --- a/src/mpl2mpl/include/reflection_analysis.h +++ b/src/mpl2mpl/include/reflection_analysis.h @@ -218,7 +218,7 @@ class ReflectionAnalysis : public AnalysisResult { int GetDeflateStringIdx(const std::string &subStr, bool needSpecialFlag); uint32 GetAnnoCstrIndex(std::map &idxNumMap, const std::string &annoArr, bool isField); - uint32 GetMethodInVtabIndex(const Klass &clazz, const MIRFunction &func) const; + uint16 GetMethodInVtabIndex(const Klass &clazz, const MIRFunction &func) const; void GetSignatureTypeNames(std::string &signature, std::vector &typeNames); MIRSymbol *GetClinitFuncSymbol(const Klass &klass); int SolveAnnotation(MIRClassType &classType, MIRFunction &func); diff --git a/src/mpl2mpl/src/muid_replacement.cpp b/src/mpl2mpl/src/muid_replacement.cpp index a96a7c70467a964f498adb2c0ec055d28a0b94bc..57a312d51328bfa2fdbe34b086c8f4af7b8041bc 100644 --- a/src/mpl2mpl/src/muid_replacement.cpp +++ b/src/mpl2mpl/src/muid_replacement.cpp @@ -25,6 +25,7 @@ constexpr char kMuidSymPtrStr[] = "__muid_symptr"; constexpr maple::uint64 kFromUndefIndexMask = 0x4000000000000000; constexpr maple::uint64 kFromDefIndexMask = 0x2000000000000000; + } // namespace // MUIDReplacement diff --git a/src/mpl2mpl/src/reflection_analysis.cpp b/src/mpl2mpl/src/reflection_analysis.cpp index 06d581943cab3334129f920ac7fa5cfcff181341..212c05f49a72aee74ca62413588c8f8f1c4a8aab 100644 --- a/src/mpl2mpl/src/reflection_analysis.cpp +++ b/src/mpl2mpl/src/reflection_analysis.cpp @@ -35,7 +35,6 @@ constexpr uint64 kMethodNotVirtual = 0x00000001; constexpr uint64 kMethodFinalize = 0x00000002; constexpr uint64 kMethodAbstract = 0x00000010; constexpr uint64 kFieldOffsetIspOffset = 0x00000001; -constexpr int32 kMethodNotFound = -10; constexpr int kModPublic = 1; // 0x00000001 constexpr int kModPrivate = 2; // 0x00000002 @@ -66,6 +65,7 @@ constexpr uint32 kMetaDataKlassFieldID = static_cast(ClassProperty::kSha constexpr bool kRADebug = false; constexpr uint32 kMethodFieldHashSize = 1022; constexpr uint16 kHashConflictFlag = 1023; +constexpr int16 kMethodNotFound = -10; constexpr char kModStr[] = "mod"; constexpr char kAddrStr[] = "addr"; @@ -477,15 +477,6 @@ void ReflectionAnalysis::GenAllMethodHash(std::vectorSetHashCode(h); hashVector.push_back(h); } - for (auto &methodInfo : methodInfoVec) { - MIRSymbol *funcSym = GlobalTables::GetGsymTable().GetSymbolFromStidx(methodInfo.first->first.Idx()); - MIRFunction *func = funcSym->GetFunction(); - uint16 h = func->GetHashCode(); - int c = std::count(hashVector.begin(), hashVector.end(), h); - if (c > 1) { - func->SetHashCode(kHashConflictFlag); // conflict flag - } - } } void ReflectionAnalysis::GenAllFieldHash(std::vector> &fieldV) const { @@ -583,8 +574,8 @@ bool RtRetentionPolicyCheck(const MIRSymbol &clInfo) { return false; } -uint32 ReflectionAnalysis::GetMethodInVtabIndex(const Klass &klass, const MIRFunction &func) const { - int methodInVtabIndex = 0; +uint16 ReflectionAnalysis::GetMethodInVtabIndex(const Klass &klass, const MIRFunction &func) const { + uint16 methodInVtabIndex = 0; bool findMethod = false; const MIRClassType *classType = klass.GetMIRClassType(); const MIRSymbol *vtableSymbol = GlobalTables::GetGsymTable().GetSymbolFromStrIdx( @@ -615,16 +606,9 @@ uint32 ReflectionAnalysis::GetMethodInVtabIndex(const Klass &klass, const MIRFun } } if (!findMethod) { - constexpr int notFoundMethod = kMethodNotFound; - methodInVtabIndex = notFoundMethod; + methodInVtabIndex = static_cast(kMethodNotFound); } - // Check VtabIndex, int16. - CHECK_FATAL((methodInVtabIndex > std::numeric_limits::min()) && - (methodInVtabIndex < std::numeric_limits::max()), - "Error:the methodInVtabIndex is too large"); - // clean up high 16bit - uint32 vtabIndex = static_cast(methodInVtabIndex) & 0xFFFF; - return vtabIndex; + return methodInVtabIndex; } void ReflectionAnalysis::GetSignatureTypeNames(std::string &signature, std::vector &typeNames) { @@ -689,7 +673,7 @@ struct HashCodeComparator { CHECK_FATAL(fullNameB.find("|") != std::string::npos, "not found |"); const std::string &signatureB = fullNameB.substr(fullNameB.find("|") + 1); // Make bridge the end. - if ((funcA->GetHashCode() == kHashConflictFlag) && (funcB->GetHashCode() == kHashConflictFlag)) { + if (funcA->GetHashCode() == funcB->GetHashCode() && funcA->GetBaseFuncName() == funcB->GetBaseFuncName()) { // Only deal with return type is different. if ((funcA->GetAttr(FUNCATTR_bridge)) && !(funcB->GetAttr(FUNCATTR_bridge))) { return true;