diff --git a/src/mapleall/bin/dex2mpl b/src/mapleall/bin/dex2mpl index b56b21ce93d518823371d99b4f1b0d2b8a0118db..5b18e255062f6a1a74f0129973a12194927b8efc 100755 Binary files a/src/mapleall/bin/dex2mpl and b/src/mapleall/bin/dex2mpl differ diff --git a/src/mapleall/bin/dex2mpl_android b/src/mapleall/bin/dex2mpl_android index 15066bad3f3b99fec652bbdd47147b6806d14504..c813a0a408a9b335ee306567ea2645f3330158fc 100755 Binary files a/src/mapleall/bin/dex2mpl_android and b/src/mapleall/bin/dex2mpl_android differ diff --git a/src/mapleall/bin/jbc2mpl b/src/mapleall/bin/jbc2mpl index 1c3c44417047e3d4a7c26c766a86fc8aa654caf1..d7553b22201c6789a6582976fa36b469b629f014 100755 Binary files a/src/mapleall/bin/jbc2mpl and b/src/mapleall/bin/jbc2mpl differ diff --git a/src/mapleall/maple_be/include/cg/emit.h b/src/mapleall/maple_be/include/cg/emit.h index 8a2cafd74e9e0488af5f73a7db4e8ae3a93661cc..05d31276bf99f9b6f1b2d45f1ff09429244d36db 100644 --- a/src/mapleall/maple_be/include/cg/emit.h +++ b/src/mapleall/maple_be/include/cg/emit.h @@ -153,7 +153,7 @@ class Emitter { uint64 fieldOffset); void EmitScalarConstant(MIRConst &mirConst, bool newLine = true, bool flag32 = false, bool isIndirect = false); void EmitStr(const std::string& mplStr, bool emitAscii = false, bool emitNewline = false); - void EmitStrConstant(const MIRStrConst &mirStrConst, bool isAscii = false, bool isIndirect = false); + void EmitStrConstant(const MIRStrConst &mirStrConst, bool isIndirect = false); void EmitStr16Constant(const MIRStr16Const &mirStr16Const); void EmitIntConst(const MIRSymbol &mirSymbol, MIRAggConst &aggConst, uint32 itabConflictIndex, const std::map &strIdx2Type, size_t idx); @@ -184,7 +184,7 @@ class Emitter { void MarkVtabOrItabEndFlag(const std::vector &mirSymbolVec); void EmitArrayConstant(MIRConst &mirConst); void EmitStructConstant(MIRConst &mirConst); - void EmitLocalVariable(CGFunc &cgFunc); + void EmitLocalVariable(const CGFunc &cgFunc); void EmitGlobalVariable(); void EmitGlobalRootList(const MIRSymbol &mirSymbol); void EmitMuidTable(const std::vector &vec, const std::map &strIdx2Type, diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_emitter.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_emitter.cpp index 96ea2a9a8cd749417cf526666519731c11020da0..00a6f7e1c4902e899ee0c82eb7c282b198c962ee 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_emitter.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_emitter.cpp @@ -255,6 +255,7 @@ void AArch64AsmEmitter::EmitFullLSDA(FuncEmitInfo &funcEmitInfo) { } void AArch64AsmEmitter::EmitBBHeaderLabel(FuncEmitInfo &funcEmitInfo, const std::string &name, LabelIdx labIdx) { + (void)name; CGFunc &cgFunc = funcEmitInfo.GetCGFunc(); AArch64CGFunc &aarchCGFunc = static_cast(cgFunc); CG *currCG = cgFunc.GetCG(); @@ -265,14 +266,13 @@ void AArch64AsmEmitter::EmitBBHeaderLabel(FuncEmitInfo &funcEmitInfo, const std: label.SetLabelOrder(currCG->GetLabelOrderCnt()); currCG->IncreaseLabelOrderCnt(); } - PUIdx pIdx = currCG->GetMIRModule()->CurFunction()->GetPuidx(); const char *puIdx = strdup(std::to_string(pIdx).c_str()); const std::string &labelName = cgFunc.GetFunction().GetLabelTab()->GetName(labIdx); if (currCG->GenerateVerboseCG()) { emitter.Emit(".L.").Emit(puIdx).Emit("__").Emit(labIdx).Emit(":\t//label order ").Emit(label.GetLabelOrder()); if (!labelName.empty() && labelName.at(0) != '@') { - //If label name has @ as its first char, it is not from MIR + /* If label name has @ as its first char, it is not from MIR */ emitter.Emit(", MIR: @").Emit(labelName).Emit("\n"); } else { emitter.Emit("\n"); @@ -381,7 +381,6 @@ void AArch64AsmEmitter::Run(FuncEmitInfo &funcEmitInfo) { LSDAHeader *lsdaHeader = ehFunc->GetLSDAHeader(); PUIdx pIdx = emitter.GetCG()->GetMIRModule()->CurFunction()->GetPuidx(); const std::string &idx = strdup(std::to_string(pIdx).c_str()); - /* .word .Label.lsda_label-func_start_label */ (void)emitter.Emit("\t.word .L." + idx).Emit("__").Emit(lsdaHeader->GetLSDALabel()->GetLabelIdx()); (void)emitter.Emit("-.L." + idx).Emit("__").Emit(cgFunc.GetStartLabel()->GetLabelIdx()).Emit("\n"); diff --git a/src/mapleall/maple_be/src/cg/cgfunc.cpp b/src/mapleall/maple_be/src/cg/cgfunc.cpp index 05c78e23cf3b38429c80a0b46088f6d55276d96f..f7302199b8a7b42381e3fa3ae5708c8bfe13d3c0 100644 --- a/src/mapleall/maple_be/src/cg/cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/cgfunc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2020-2021] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2020-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_be/src/cg/emit.cpp b/src/mapleall/maple_be/src/cg/emit.cpp index 262b41d0d895e20dc8a55afc5f4c26513237f1cc..c9451cea9a0a6e937c63330b7c13bbe30330b1ed 100644 --- a/src/mapleall/maple_be/src/cg/emit.cpp +++ b/src/mapleall/maple_be/src/cg/emit.cpp @@ -243,6 +243,7 @@ void Emitter::EmitAsmLabel(const MIRSymbol &mirSymbol, AsmLabel label) { } else { symName = mirSymbol.GetName(); } + if (Globals::GetInstance()->GetBECommon()->IsEmptyOfTypeAlignTable()) { ASSERT(false, "container empty check"); } @@ -320,9 +321,10 @@ void Emitter::EmitAsmLabel(const MIRSymbol &mirSymbol, AsmLabel label) { case kAsmSize: { std::string size; if (isFlexibleArray) { - size = std::to_string(Globals::GetInstance()->GetBECommon()->GetTypeSize(mirType->GetTypeIndex()) + arraySize); + size = std::to_string( + Globals::GetInstance()->GetBECommon()->GetTypeSize(mirType->GetTypeIndex()) + arraySize); } else { - size = std::to_string(Globals::GetInstance()->GetBECommon()->GetTypeSize(mirType->GetTypeIndex())); + size = std::to_string(Globals::GetInstance()->GetBECommon()->GetTypeSize(mirType->GetTypeIndex())); } Emit(asmInfo->GetSize()); Emit(symName); @@ -410,23 +412,29 @@ void Emitter::EmitStr(const std::string& mplStr, bool emitAscii, bool emitNewlin size_t len = mplStr.size(); if (emitAscii) { - Emit("\t.ascii\t\""); // Do not terminate with \0 + Emit("\t.ascii\t\""); /* Do not terminate with \0 */ } else { Emit("\t.string\t\""); } - // don't expand special character in a writeout to .s, - // convert all \s to \\s in string for storing in .string + /* + * don't expand special character in a writeout to .s, + * convert all \s to \\s in string for storing in .string + */ for (int i = 0; i < len; i++) { - // Referred to GNU AS: 3.6.1.1 Strings - char buf[5]; + /* Referred to GNU AS: 3.6.1.1 Strings */ + constexpr int kBufSize = 5; + constexpr int kSecondChar = 1; + constexpr int kThirdChar = 2; + constexpr int kLastChar = 4; + char buf[kBufSize]; if (isprint(*str)) { buf[0] = *str; - buf[1] = 0; + buf[kSecondChar] = 0; if (*str == '\\' || *str == '\"') { buf[0] = '\\'; - buf[1] = *str; - buf[2] = 0; + buf[kSecondChar] = *str; + buf[kThirdChar] = 0; } Emit(buf); } else if (*str == '\b') { @@ -439,16 +447,16 @@ void Emitter::EmitStr(const std::string& mplStr, bool emitAscii, bool emitNewlin Emit("\\t"); } else if (*str == '\0') { buf[0] = '\\'; - buf[1] = '0'; - buf[2] = 0; + buf[kSecondChar] = '0'; + buf[kThirdChar] = 0; Emit(buf); } else { - // all others, print as number - int ret = snprintf_s(buf, sizeof(buf), 4, "\\%03o", (*str) & 0xFF); + /* all others, print as number */ + int ret = snprintf_s(buf, sizeof(buf), k4BitSize, "\\%03o", (*str) & 0xFF); if (ret < 0) { FATAL(kLncFatal, "snprintf_s failed"); } - buf[4] = '\0'; + buf[kLastChar] = '\0'; Emit(buf); } str++; @@ -460,7 +468,7 @@ void Emitter::EmitStr(const std::string& mplStr, bool emitAscii, bool emitNewlin } } -void Emitter::EmitStrConstant(const MIRStrConst &mirStrConst, bool isAscii, bool isIndirect) { +void Emitter::EmitStrConstant(const MIRStrConst &mirStrConst, bool isIndirect) { if (isIndirect) { uint32 strId = mirStrConst.GetValue().GetIdx(); std::vector &sPtr = GetStringPtr(); @@ -579,7 +587,7 @@ void Emitter::EmitScalarConstant(MIRConst &mirConst, bool newLine, bool flag32, case kConstStrConst: { MIRStrConst &strCt = static_cast(mirConst); if (cg->GetMIRModule()->IsCModule()) { - EmitStrConstant(strCt, false, isIndirect); + EmitStrConstant(strCt, isIndirect); } else { EmitStrConstant(strCt); } @@ -594,7 +602,7 @@ void Emitter::EmitScalarConstant(MIRConst &mirConst, bool newLine, bool flag32, MIRAddrofConst &symAddr = static_cast(mirConst); StIdx stIdx = symAddr.GetSymbolIndex(); MIRSymbol *symAddrSym = stIdx.IsGlobal() ? GlobalTables::GetGsymTable().GetSymbolFromStidx(stIdx.Idx()) - : CG::GetCurCGFunc()->GetMirModule().CurFunction()->GetSymTab()->GetSymbolFromStIdx(stIdx.Idx()); + : CG::GetCurCGFunc()->GetMirModule().CurFunction()->GetSymTab()->GetSymbolFromStIdx(stIdx.Idx()); if (stIdx.IsGlobal() == false && symAddrSym->GetStorageClass() == kScPstatic) { PUIdx pIdx = GetCG()->GetMIRModule()->CurFunction()->GetPuidx(); Emit("\t.quad\t" + symAddrSym->GetName() + std::to_string(pIdx)); @@ -1838,18 +1846,20 @@ void Emitter::EmitStringPointers() { } } -void Emitter::EmitLocalVariable(CGFunc &cgfunc) { - // function local pstatic initialization +void Emitter::EmitLocalVariable(const CGFunc &cgfunc) { + /* function local pstatic initialization */ if (cg->GetMIRModule()->IsCModule()) { MIRSymbolTable *lSymTab = cgfunc.GetMirModule().CurFunction()->GetSymTab(); if (lSymTab != nullptr) { - // anything larger than is created by cg + /* anything larger than is created by cg */ size_t lsize = cgfunc.GetLSymSize(); for (size_t i = 0; i < lsize; i++) { MIRSymbol *st = lSymTab->GetSymbolFromStIdx(i); if (st != nullptr && st->GetStorageClass() == kScPstatic) { - // Local static names can repeat. - // Append the current program unit index to the name. + /* + * Local static names can repeat. + * Append the current program unit index to the name. + */ PUIdx pIdx = cgfunc.GetMirModule().CurFunction()->GetPuidx(); std::string localname = st->GetName() + std::to_string(pIdx); static std::vector emittedLocalSym; @@ -1874,7 +1884,7 @@ void Emitter::EmitLocalVariable(CGFunc &cgfunc) { EmitAsmLabel(*st, kAsmComm); } else { EmitAsmLabel(*st, kAsmSyname); - EmitScalarConstant(*ct, true, false, true/*isIndirect*/); + EmitScalarConstant(*ct, true, false, true /* isIndirect */); } } } @@ -2173,7 +2183,7 @@ void Emitter::EmitGlobalVariable() { if (IsPrimitiveScalar(mirType->GetPrimType())) { if (IsAddress(mirType->GetPrimType())) { uint32 sizeinbits = GetPrimTypeBitSize(mirConst->GetType().GetPrimType()); - CHECK_FATAL(sizeinbits == 64, "EmitGlobalVariable: pointer must be of size 8"); + CHECK_FATAL(sizeinbits == k64BitSize, "EmitGlobalVariable: pointer must be of size 8"); } if (cg->GetMIRModule()->IsCModule()) { EmitScalarConstant(*mirConst, true, false, true); diff --git a/src/mapleall/maple_driver/include/driver_option_common.h b/src/mapleall/maple_driver/include/driver_option_common.h index a0340ffc8ffd7058cf3f04d6aaa80e6ab1aba78f..b2cd14dae7a3d3aa2f0bc1884db37950eba04fe1 100644 --- a/src/mapleall/maple_driver/include/driver_option_common.h +++ b/src/mapleall/maple_driver/include/driver_option_common.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. @@ -24,7 +24,17 @@ enum DriverOptionIndex { kInFile, kInMplt, kOptimization0, + kOptimization1, kOptimization2, + kWithIpa, + kJbc2mplOpt, + kDex2mplOpt, + kMplipaOpt, + kVerify, + // Common options for each compiler + kDecoupleStatic, + // DAI2.0 + kDecoupleInit, kProfilePath, kGCOnly, kMplcgOpt, diff --git a/src/mapleall/maple_ir/include/bin_mplt.h b/src/mapleall/maple_ir/include/bin_mplt.h index fcc5230af56720e1b4423992a87f55652c11e57e..eed3a0642ac7505f9ff51133256897a6bd642511 100644 --- a/src/mapleall/maple_ir/include/bin_mplt.h +++ b/src/mapleall/maple_ir/include/bin_mplt.h @@ -24,6 +24,14 @@ namespace maple { class BinaryMplt { public: + std::vector seUsage = { + "out/soong/.intermediates/vendor/huawei/maple/Lib/core/libmaplecore-all/android_arm64_armv8-a_core_shared/obj/classes.mpl", + "out/soong/.intermediates/vendor/huawei/maple/Lib/services/libmapleservices/android_arm64_armv8-a_core_shared/obj/classes.mrg.mpl", + "out/target/product/generic_a15/obj/SHARED_LIBRARIES/libmaplehwServices_intermediates/classes.mpl", + "out/soong/.intermediates/vendor/huawei/maple/Lib/frameworks/libmapleframework/android_arm64_armv8-a_core_shared/obj/classes.mrg.mpl", + "libcore-all.mpl", + "./libcore-all.mpl" + }; explicit BinaryMplt(MIRModule &md) : mirModule(md), binImport(md), binExport(md) {} @@ -34,6 +42,22 @@ class BinaryMplt { } bool Import(const std::string &modID, bool readCG = false, bool readSE = false) { + bool found = true; + for (size_t i = 0; i < seUsage.size(); ++i) { + if (seUsage[i] == mirModule.GetFileName()) { + found = true; + break; + } + } + readSE = readSE && found; +#ifdef MPLT_DEBUG + if (readCG) { + LogInfo::MapleLogger() << "READING CG mpl file : " << _mod.fileName << '\n'; + } + if (readSE) { + LogInfo::MapleLogger() << "READING SE mpl file : " << _mod.fileName << '\n'; + } +#endif importFileName = modID; return binImport.Import(modID, readCG, readSE); } diff --git a/src/mapleall/maple_ir/include/dex2mpl/dexintrinsic.def b/src/mapleall/maple_ir/include/dex2mpl/dexintrinsic.def new file mode 100644 index 0000000000000000000000000000000000000000..9a338a28ca7828552a3d3d3c66bc250923ffc84b --- /dev/null +++ b/src/mapleall/maple_ir/include/dex2mpl/dexintrinsic.def @@ -0,0 +1,17 @@ +DEF_MIR_INTRINSIC(JAVA_INTERFACE_CALL,\ + "__dex_interface_call", INTRNISJAVA, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +DEF_MIR_INTRINSIC(JAVA_PRINT,\ + "printf", INTRNISJAVA, kArgTyVoid, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +DEF_MIR_INTRINSIC(JAVA_CLINIT_CHECK_SGET,\ + "__dex_clinit_check_sget", INTRNISJAVA, kArgTyVoid, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +DEF_MIR_INTRINSIC(JAVA_CLINIT_CHECK_SPUT,\ + "__dex__clinit_check_sput", INTRNISJAVA, kArgTyVoid, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +DEF_MIR_INTRINSIC(JAVA_CLINIT_CHECK_NEW,\ + "__dex_clinit_check_new", INTRNISJAVA, kArgTyVoid, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +DEF_MIR_INTRINSIC(JAVA_STR_TO_JSTR,\ + "__dex_str_to_jstr", INTRNISJAVA, kArgTyPtr, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +// __dex_random is used to generate a random value used in callback cfg +DEF_MIR_INTRINSIC(JAVA_RANDOM,\ + "__dex_random", INTRNISJAVA | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) +DEF_MIR_INTRINSIC(JAVA_THROW_CLASSCAST,\ + "MCC_ThrowClassCastException", INTRNISJAVA | INTRNNEVERRETURN, kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) diff --git a/src/mapleall/maple_ir/include/intrinsic_dai.def b/src/mapleall/maple_ir/include/intrinsic_dai.def new file mode 100644 index 0000000000000000000000000000000000000000..28c97ddfb22fad1643490dc94c00bafa6c5e4a8f --- /dev/null +++ b/src/mapleall/maple_ir/include/intrinsic_dai.def @@ -0,0 +1,20 @@ +DEF_MIR_INTRINSIC(MCC_DeferredConstClass,\ + "MCC_DeferredConstClass", INTRNISJAVA, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredInstanceOf,\ + "MCC_DeferredInstanceOf", INTRNISJAVA, kArgTyU1, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredCheckCast,\ + "MCC_DeferredCheckCast", INTRNISJAVA, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredNewInstance,\ + "MCC_DeferredNewInstance", INTRNISJAVA, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredNewArray,\ + "MCC_DeferredNewArray", INTRNISJAVA, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyI32) +DEF_MIR_INTRINSIC(MCC_DeferredFillNewArray,\ + "MCC_DeferredFillNewArray", INTRNISJAVA, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyI32, kArgTyDynany, kArgTyDynany) +DEF_MIR_INTRINSIC(MCC_DeferredLoadField,\ + "MCC_DeferredLoadField", INTRNISJAVA, kArgTyDynany, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredStoreField,\ + "MCC_DeferredStoreField", INTRNISJAVA, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredInvoke,\ + "MCC_DeferredInvoke", INTRNISJAVA, kArgTyDynany, kArgTyRef, kArgTyI32, kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) +DEF_MIR_INTRINSIC(MCC_DeferredClinitCheck,\ + "MCC_DeferredClinitCheck", INTRNISJAVA, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef) diff --git a/src/mapleall/maple_ir/include/intrinsics.def b/src/mapleall/maple_ir/include/intrinsics.def index 257d2af12efa51f3327623f4e5b55a3bd4fed938..57295370c60c45a22461aa064240cd535ad2c5ce 100644 --- a/src/mapleall/maple_ir/include/intrinsics.def +++ b/src/mapleall/maple_ir/include/intrinsics.def @@ -43,6 +43,8 @@ DEF_MIR_INTRINSIC(MPL_READ_ARRAYCLASS_CACHE_ENTRY,\ "__mpl_const_arrayclass_cache", kIntrnUndef, kArgTyPtr, kArgTyU32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef) // start of RC Intrinsics with one parameters +DEF_MIR_INTRINSIC(MCCSetPermanent,\ + "MCC_SetObjectPermanent", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef) DEF_MIR_INTRINSIC(MCCIncRef,\ "MCC_IncRef_NaiveRCFast", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef) DEF_MIR_INTRINSIC(MCCDecRef,\ @@ -57,6 +59,8 @@ DEF_MIR_INTRINSIC(MCCSetObjectPermanent,\ "MCC_SetObjectPermanent", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef) // start of RC Intrinsics with two parameters +DEF_MIR_INTRINSIC(MCCCheck,\ + "MCC_CheckRefCount", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyU32) DEF_MIR_INTRINSIC(MCCCheckArrayStore,\ "MCC_Reflect_Check_Arraystore", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef) DEF_MIR_INTRINSIC(MCCIncDecRef,\ @@ -127,6 +131,8 @@ DEF_MIR_INTRINSIC(MPL_CLEANUP_NORETESCOBJS,\ kArgTyRef, kArgTyRef, kArgTyRef, kArgTyRef) // start of GC Intrinsics +DEF_MIR_INTRINSIC(MCCGCCheck,\ + "MCC_CheckObjAllocated", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef) // start of Profile Intrinsics DEF_MIR_INTRINSIC(MCCSaveProf,\ @@ -137,5 +143,7 @@ DEF_MIR_INTRINSIC(MCCSaveProf,\ #include "intrinsic_c.def" #include "intrinsic_js.def" #include "intrinsic_js_eng.def" +#include "dex2mpl/dexintrinsic.def" +#include "intrinsic_dai.def" DEF_MIR_INTRINSIC(LAST,\ nullptr, kIntrnUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef) diff --git a/src/mapleall/maple_ir/include/mir_function.h b/src/mapleall/maple_ir/include/mir_function.h index 480bc57f32f3d8e199b21fa254e8f19c35933d3a..5adba4d16a89ed9fa678e032b27308ff768411e3 100644 --- a/src/mapleall/maple_ir/include/mir_function.h +++ b/src/mapleall/maple_ir/include/mir_function.h @@ -24,6 +24,7 @@ #include "mir_nodes.h" #include "profile.h" +#define DEBUGME true namespace maple { // mapping src (java) variable to mpl variables to display debug info @@ -95,6 +96,7 @@ class MIRFunction { const std::string &GetBaseFuncNameWithType() const; + const std::string &GetBaseFuncSig() const; const std::string &GetSignature() const; @@ -398,10 +400,23 @@ class MIRFunction { const MIRType *GetNodeType(const BaseNode &node) const; +#ifdef DEBUGME void SetUpGDBEnv(); void ResetGDBEnv(); +#endif + void ReleaseMemory() { + memPoolCtrler.DeleteMemPool(codeMemPoolTmp); + codeMemPoolTmp = nullptr; + } MemPool *GetCodeMempool() { + if (useTmpMemPool) { + if (codeMemPoolTmp == nullptr) { + codeMemPoolTmp = memPoolCtrler.NewMemPool("func code mempool"); + codeMemPoolTmpAllocator.SetMemPool(codeMemPoolTmp); + } + return codeMemPoolTmp; + } if (codeMemPool == nullptr) { codeMemPool = memPoolCtrler.NewMemPool("func code mempool"); codeMemPoolAllocator.SetMemPool(codeMemPool); @@ -411,6 +426,9 @@ class MIRFunction { MapleAllocator &GetCodeMemPoolAllocator() { GetCodeMempool(); + if (useTmpMemPool) { + return codeMemPoolTmpAllocator; + } return codeMemPoolAllocator; } @@ -450,6 +468,12 @@ class MIRFunction { symbolTableIdx = stIdx; } + int32 GetSCCId() const { + return sccID; + } + void SetSCCId(int32 id) { + sccID = id; + } MIRFuncType *GetMIRFuncType() { return funcType; @@ -603,6 +627,25 @@ class MIRFunction { (*aliasVarMap)[idx] = vars; } + bool HasVlaOrAlloca() const { + return hasVlaOrAlloca; + } + void SetVlaOrAlloca(bool has) { + hasVlaOrAlloca = has; + } + + bool HasFreqMap() { + return floatReqMap != nullptr; + } + const MapleMap &GetFreqMap() const { + return *floatReqMap; + } + void SetFreqMap(uint32 stmtID, uint32 freq) { + if (floatReqMap == nullptr) { + floatReqMap = module->GetMemPool()->New>(module->GetMPAllocator().Adapter()); + } + (*floatReqMap)[stmtID] = freq; + } bool WithLocInfo() const { return withLocInfo; @@ -611,6 +654,19 @@ class MIRFunction { withLocInfo = withInfo; } + bool IsDirty() const { + return isDirty; + } + void SetDirty(bool dirty) { + isDirty = dirty; + } + + bool IsFromMpltInline() const { + return fromMpltInline; + } + void SetFromMpltInline(bool isInline) { + fromMpltInline = isInline; + } uint8 GetLayoutType() const { return layoutType; @@ -846,6 +902,13 @@ class MIRFunction { return genericLocalVar[str]; } + MemPool *GetCodeMemPoolTmp() { + if (codeMemPoolTmp == nullptr) { + codeMemPoolTmp = memPoolCtrler.NewMemPool("func code mempool"); + codeMemPoolTmpAllocator.SetMemPool(codeMemPoolTmp); + } + return codeMemPoolTmp; + } void AddProfileDesc(uint64 hash, uint32 start, uint32 end) { profileDesc = module->GetMemPool()->New(hash, start, end); @@ -864,6 +927,7 @@ class MIRFunction { PUIdx puIdx = 0; // the PU index of this function PUIdx puIdxOrigin = 0; // the original puIdx when initial generation StIdx symbolTableIdx; // the symbol table index of this function + int32 sccID = -1; // the scc id of this function, for mplipa MIRFuncType *funcType = nullptr; TyIdx inferredReturnTyIdx{0}; // the actual return type of of this function (may be a // subclass of the above). 0 means can not be inferred. @@ -892,8 +956,12 @@ class MIRFunction { MapleVector infoIsString{module->GetMPAllocator().Adapter()}; // tells if an entry has string value MapleMap *aliasVarMap = nullptr; // source code alias variables // for debuginfo + MapleMap *floatReqMap = nullptr; // save bb frequency in its last_stmt. + bool hasVlaOrAlloca = false; bool withLocInfo = true; + bool isDirty = false; + bool fromMpltInline = false; // Whether this function is imported from mplt_inline file or not. uint8_t layoutType = kLayoutUnused; uint16 frameSize = 0; uint16 upFormalSize = 0; @@ -941,6 +1009,9 @@ class MIRFunction { // funcname + types of args, no type of retv GStrIdx baseFuncSigStrIdx{0}; GStrIdx signatureStrIdx{0}; + MemPool *codeMemPoolTmp{nullptr}; + MapleAllocator codeMemPoolTmpAllocator{nullptr}; + bool useTmpMemPool = false; void DumpFlavorLoweredThanMmpl() const; MIRFuncType *ReconstructFormals(const std::vector &symbols, bool clearOldArgs); diff --git a/src/mapleall/maple_ir/include/mir_parser.h b/src/mapleall/maple_ir/include/mir_parser.h index d427a9107e8fe34d8107081e2e277d512ca6a83d..0cae3f3896c0aa2ec965b6b03c5b4c6dd37e596e 100644 --- a/src/mapleall/maple_ir/include/mir_parser.h +++ b/src/mapleall/maple_ir/include/mir_parser.h @@ -194,6 +194,7 @@ class MIRParser { void PrepareParsingMplt(); bool ParseMIR(uint32 fileIdx = 0, uint32 option = 0, bool isIpa = false, bool isComb = false); bool ParseMIR(std::ifstream&); // the main entry point + bool ParseInlineFuncBody(std::ifstream&); bool ParseMPLT(std::ifstream&, const std::string&); bool ParseMPLTStandalone(std::ifstream &mpltfile, const std::string &importfilename); bool ParseTypeFromString(const std::string&, TyIdx&); diff --git a/src/mapleall/maple_ir/include/mir_symbol.h b/src/mapleall/maple_ir/include/mir_symbol.h index 962c488336b6b90f2fe617070e91bc0a06e35839..9a7df9db5a5130b441fab28e37eca31fa8e95f74 100644 --- a/src/mapleall/maple_ir/include/mir_symbol.h +++ b/src/mapleall/maple_ir/include/mir_symbol.h @@ -222,7 +222,9 @@ class MIRSymbol { } bool IsFinal() const { - return (typeAttrs.GetAttr(ATTR_final) || typeAttrs.GetAttr(ATTR_readonly)) || IsLiteral() || IsLiteralPtr(); + return ((typeAttrs.GetAttr(ATTR_final) || typeAttrs.GetAttr(ATTR_readonly)) && + staticFinalBlackList.find(GetName()) == staticFinalBlackList.end()) || + IsLiteral() || IsLiteralPtr(); } bool IsWeak() const { @@ -402,6 +404,8 @@ class MIRSymbol { bool IsMuidRangeTab() const; bool IsArrayClassCache() const; bool IsArrayClassCacheName() const; + bool IsForcedGlobalFunc() const; + bool IsForcedGlobalClassinfo() const; bool IsGctibSym() const; bool IsPrimordialObject() const; bool IgnoreRC() const; @@ -448,6 +452,8 @@ class MIRSymbol { GStrIdx nameStrIdx{ 0 }; SymbolType value = { nullptr }; SrcPosition srcPosition; // where the symbol is defined + // following cannot be assumed final even though they are declared final + static const std::set staticFinalBlackList; static GStrIdx reflectClassNameIdx; static GStrIdx reflectMethodNameIdx; static GStrIdx reflectFieldNameIdx; @@ -597,7 +603,11 @@ class MIRLabelTable { return labelTable; } - MapleUnorderedSet GetAddrTakenLabels() { + const MapleUnorderedSet &GetAddrTakenLabels() const { + return addrTakenLabels; + } + + MapleUnorderedSet &GetAddrTakenLabels() { return addrTakenLabels; } diff --git a/src/mapleall/maple_ir/include/option.h b/src/mapleall/maple_ir/include/option.h index d691172af44baaccc873b2de99c8eb420bbadccb..b69caa50fa1e38a8109a343b1d8975b388354421 100644 --- a/src/mapleall/maple_ir/include/option.h +++ b/src/mapleall/maple_ir/include/option.h @@ -89,6 +89,16 @@ class Options : public MapleDriverOptionBase { #if MIR_JAVA static bool skipVirtualMethod; #endif + // Ready to be deleted. + static bool noRC; + static bool analyzeCtor; + static bool strictNaiveRC; + static bool gcOnly; + static bool rcOpt1; + static std::string classMetaProFile; + static std::string methodMetaProfile; + static std::string fieldMetaProFile; + static std::string reflectStringProFile; static bool nativeOpt; static bool O2; static bool noDot; @@ -119,6 +129,15 @@ class Options : public MapleDriverOptionBase { static bool profileStaticFields; static bool genIRProfile; static bool profileTest; + static std::string classLoaderInvocationList; + static bool dumpClassLoaderInvocation; + static unsigned int warningLevel; + static bool lazyBinding; + static bool hotFix; + static bool compactMeta; + static bool genPGOReport; + static bool verify; + static uint32 inlineCache; static bool checkArrayStore; static bool noComment; private: diff --git a/src/mapleall/maple_ir/include/parser_opt.h b/src/mapleall/maple_ir/include/parser_opt.h index 90c532b432bc051a6899b1ba0ea02e9bd2d9103d..fa470b82d0a8932d93e9ab57b8cf2122e64fb1d6 100644 --- a/src/mapleall/maple_ir/include/parser_opt.h +++ b/src/mapleall/maple_ir/include/parser_opt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] 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. @@ -24,6 +24,7 @@ enum ParserOptions : uint8 { kKeepFirst = 0x2, // ignore second type def, not emit error kWithProfileInfo = 0x4, kParseOptFunc = 0x08, // parse optimized function mpl file + kParseInlineFuncBody = 0x10 // parse to-be-inlined function bodies }; } // namespace maple #endif // MAPLE_IR_INCLUDE_PARSER_OPT_H diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index cd879143e384edf93983d6e3d52955aae4b8ad54..1ea335b8a482e1b2d31eab5eba7782d91d3b3a7c 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -61,6 +61,9 @@ const std::string &MIRFunction::GetBaseFuncNameWithType() const { return GlobalTables::GetStrTable().GetStringFromStrIdx(baseFuncWithTypeStrIdx); } +const std::string &MIRFunction::GetBaseFuncSig() const { + return GlobalTables::GetStrTable().GetStringFromStrIdx(baseFuncSigStrIdx); +} const std::string &MIRFunction::GetSignature() const { return GlobalTables::GetStrTable().GetStringFromStrIdx(signatureStrIdx); @@ -598,6 +601,7 @@ void MIRFunction::NewBody() { } } +#ifdef DEBUGME void MIRFunction::SetUpGDBEnv() { if (codeMemPool != nullptr) { memPoolCtrler.DeleteMemPool(codeMemPool); @@ -610,4 +614,5 @@ void MIRFunction::ResetGDBEnv() { memPoolCtrler.DeleteMemPool(codeMemPool); codeMemPool = nullptr; } +#endif } // namespace maple diff --git a/src/mapleall/maple_ir/src/mir_symbol.cpp b/src/mapleall/maple_ir/src/mir_symbol.cpp index 7cb8a3a443258a53dec460f2b9eff88e3864cafa..da9d66e6c3593c407323aa351310cd232097b9e7 100644 --- a/src/mapleall/maple_ir/src/mir_symbol.cpp +++ b/src/mapleall/maple_ir/src/mir_symbol.cpp @@ -168,6 +168,21 @@ bool MIRSymbol::IsArrayClassCacheName() const { return StringUtils::StartsWith(GetName(), kArrayClassCacheNameTable); } +bool MIRSymbol::IsForcedGlobalFunc() const { + return StringUtils::StartsWith(GetName(), kJavaLangClassStr) || + StringUtils::StartsWith(GetName(), kReflectionClassesPrefixStr) || + StringUtils::StartsWith(GetName(), "Ljava_2Fnio_2FDirectByteBuffer_3B_7C_3Cinit_3E_7C_28JI_29V"); +} + +// mrt/maplert/include/mrt_classinfo.h +bool MIRSymbol::IsForcedGlobalClassinfo() const { + std::unordered_set mrtUse { +#include "mrt_direct_classinfo_list.def" + }; + return std::find(mrtUse.begin(), mrtUse.end(), GetName()) != mrtUse.end() || + StringUtils::StartsWith(GetName(), "__cinf_Llibcore_2Freflect_2FGenericSignatureParser_3B"); +} + bool MIRSymbol::IsClassInitBridge() const { return StringUtils::StartsWith(GetName(), CLASS_INIT_BRIDGE_PREFIX_STR); } @@ -356,6 +371,11 @@ void MIRSymbol::DumpAsLiteralVar() const { } } +const std::set MIRSymbol::staticFinalBlackList{ + "Ljava_2Flang_2FSystem_3B_7Cout", + "Ljava_2Flang_2FSystem_3B_7Cerr", + "Ljava_2Flang_2FSystem_3B_7Cin", +}; void MIRSymbolTable::Dump(bool isLocal, int32 indent, bool printDeleted) const { size_t size = symbolTable.size(); diff --git a/src/mapleall/maple_ir/src/option.cpp b/src/mapleall/maple_ir/src/option.cpp index f65a924c483a7325be0752533eaeb66e58f01cce..2bdce1eb8cb2e02233d49195c96459018a64f99a 100644 --- a/src/mapleall/maple_ir/src/option.cpp +++ b/src/mapleall/maple_ir/src/option.cpp @@ -56,6 +56,12 @@ bool Options::emitVtableImpl = false; #if MIR_JAVA bool Options::skipVirtualMethod = false; #endif +// Ready to be deleted. +bool Options::noRC = false; +bool Options::analyzeCtor = true; +bool Options::strictNaiveRC = false; +bool Options::gcOnly = false; +bool Options::rcOpt1 = true; bool Options::nativeOpt = true; bool Options::O2 = false; bool Options::noDot = false; @@ -86,6 +92,15 @@ bool Options::profileStaticFields = false; std::string Options::proFileData = ""; std::string Options::proFileFuncData = ""; std::string Options::proFileClassData = ""; +std::string Options::classLoaderInvocationList = ""; // maple/mrt/codetricks/profile.pv/classloaderInvocation.list +bool Options::dumpClassLoaderInvocation = false; +unsigned int Options::warningLevel = 0; +bool Options::lazyBinding = false; +bool Options::hotFix = false; +bool Options::compactMeta = false; +bool Options::genPGOReport = false; +bool Options::verify = false; +uint32 Options::inlineCache = 0; bool Options::checkArrayStore = false; bool Options::noComment = false; @@ -120,12 +135,43 @@ enum OptionIndex { kProfileColdCount, kProfileHotRate, kProfileColdRate, + // Ready to be deleted. + kMpl2MplUseRc, + kMpl2MplStrictNaiveRc, + kRcOpt1, + kMpl2MplNoReflec, // not used + kMpl2MplStubFunc, // not used kMpl2MplNativeOpt, kMpl2MplOptL0, kMpl2MplOptL2, kMpl2MplNoDot, kGenIRProfile, kProfileTest, + kCriticalnative, + kFastnative, + kMpl2MplBarrier, + kNativeFuncPropertyFile, + kMplnkNoLocal, + kBuildApp, + kPartialAot, + kSourceMuid, + kDeferredVisit, + kDeferredVisit2, + kDecoupleSuper, + kGenVtabAndItabForDecouple, + kProfileFunc, + kDumpDevirtual, + kReadDevirtual, + kPreloadedClass, + kAppPackageName, + kCheckClInvocation, + kDumpClInvocation, + kMpl2MplWarnLevel, + kMpl2MplLazyBinding, + kMpl2MplHotFix, + kMpl2MplCompactMeta, + kGenPGOReport, + kInlineCache, kNoComment }; @@ -412,6 +458,35 @@ const Descriptor kUsage[] = { "mpl2mpl", {} }, #endif + { kMpl2MplUseRc, + kEnable, + "", + "userc", + kBuildTypeExperimental, + kArgCheckPolicyBool, + " --userc \tEnable reference counting [default]\n" + " --no-userc \tDisable reference counting [default]\n", + "mpl2mpl", + {} }, + { kMpl2MplStrictNaiveRc, + kEnable, + "", + "strict-naiverc", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --strict-naiverc \tStrict Naive RC mode, assume no unsafe multi-thread read/write racing\n" + " --no-strict-naiverc \tDisable strict-naiverc\n", + "mpl2mpl", + {} }, + { kRcOpt1, + kEnable, + "", + "rc-opt1", + kBuildTypeExperimental, + kArgCheckPolicyNone, + " --rc-opt1 \tEnable RC optimization1 [default]\n", + "mpl2mpl", + {} }, { kMpl2MplNativeOpt, kEnable, "", @@ -440,6 +515,26 @@ const Descriptor kUsage[] = { " -O2 \tDo some optimization.\n", "mpl2mpl", {} }, + { kCriticalnative, + 0, + "", + "CriticalNative", + kBuildTypeExperimental, + kArgCheckPolicyRequired, + " --CriticalNative \tFor CriticalNative optimization\n" + " \t--CriticalNative=list_file\n", + "mpl2mpl", + {} }, + { kFastnative, + 0, + "", + "FastNative", + kBuildTypeExperimental, + kArgCheckPolicyRequired, + " --FastNative \tFor FastNative optimization\n" + " \t--FastNative=list_file\n", + "mpl2mpl", + {} }, { kMpl2MplNoDot, kEnable, "", @@ -470,6 +565,243 @@ const Descriptor kUsage[] = { " --no-profile-test \tDisable profile test\n", "mpl2mpl", {} }, + { kMpl2MplBarrier, + kEnable, + "", + "barrier", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --barrier \tEnable barrier insertion instead of RC insertion\n" + " --no-barrier \tDisable barrier insertion instead of RC insertion\n", + "mpl2mpl", + {} }, + { kNativeFuncPropertyFile, + 0, + "", + "nativefunc-property-list", + kBuildTypeExperimental, + kArgCheckPolicyRequired, + " --nativefunc-property-list \tGenerate native binding function stub\n" + " \t--nativefunc-property-list=file\n", + "mpl2mpl", + {} }, + { kMplnkNoLocal, + kEnable, + "", + "maplelinker-nolocal", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --maplelinker-nolocal \tDo not turn functions into local when maple linker is on\n" + " --no-maplelinker-nolocal\n", + "mpl2mpl", + {} }, + { kBuildApp, + 0, + "", + "build-app", + kBuildTypeProduct, + kArgCheckPolicyOptional, + " --build-app[=0,1,2] \tbuild the app dex 0:off, 1:method1, 2:method2, ignore:method1\n", + "mpl2mpl", + {} }, + { kPartialAot, + 0, + "", + "partialAot", + kBuildTypeProduct, + kArgCheckPolicyOptional, + " --partialAot \tenerate the detailed information for the partialAot\n", + "mpl2mpl", + {} }, + { kDecoupleInit, + 0, + "", + "decouple-init", + kBuildTypeProduct, + kArgCheckPolicyOptional, + " --decouple-init \tdecouple the constructor method\n", + "mpl2mpl", + {} }, + { kSourceMuid, + 0, + "", + "source-muid", + kBuildTypeProduct, + kArgCheckPolicyOptional, + " --source-muid="" \tWrite the source file muid into the mpl file\n", + "mpl2mpl", + {} }, + { kDeferredVisit, + kEnable, + "", + "deferred-visit", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --deferred-visit \tGenerate deferred MCC call for undefined type\n" + " --no-deferred-visit \tDont't generate deferred MCC call for undefined type\n", + "mpl2mpl", + {} }, + { kDeferredVisit2, + kEnable, + "", + "deferred-visit2", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --deferred-visit2 \tGenerate deferred MCC call(DAI2.0) for undefined type\n" + " --no-deferred-visit2 \tDon't generate deferred MCC call(DAI2.0) for undefined type\n", + "mpl2mpl", + {} }, + { kDecoupleSuper, + kEnable, + "", + "decouple-super", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --decouple-super \tGenerate deferred MCC call for undefined type\n" + " --no-decouple-super \tDon't generate deferred MCC call for undefined type\n", + "mpl2mpl", + {} }, + { kGenVtabAndItabForDecouple, + kEnable, + "", + "gen-decouple-vtab", + kBuildTypeExperimental, + kArgCheckPolicyBool, + " --gen-decouple-vtab \tGenerate the whole and complete vtab and itab\n" + " --no-gen-decouple-vtab \tDon't generate the whole and complete vtab and itab\n", + "mpl2mpl", + {} }, + { kProfileFunc, + kEnable, + "", + "profile-func", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --profile-func \tProfile function usage\n" + " --no-profile-func \tDisable profile function usage\n", + "mpl2mpl", + {} }, + { kDumpDevirtual, + 0, + "", + "dump-devirtual-list", + kBuildTypeExperimental, + kArgCheckPolicyRequired, + " --dump-devirtual-list \tDump candidates of devirtualization into a specified file\n" + " \t--dump-devirtual-list=\n", + "mpl2mpl", + {} }, + { kReadDevirtual, + 0, + "", + "read-devirtual-list", + kBuildTypeExperimental, + kArgCheckPolicyRequired, + " --read-devirtual-list \tRead in candidates of devirtualization from\n" + " \t a specified file and perform devirtualization\n" + " \t--read-devirtual-list=\n", + "mpl2mpl", + {} }, + { kPreloadedClass, + kEnable, + "", + "usewhiteclass", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --usewhiteclass \tEnable use preloaded class list to reducing clinit check\n" + " --no-usewhiteclass \tDisable use preloaded class list to reducing clinit check\n", + "mpl2mpl", + {} }, + { kAppPackageName, + 0, + "", + "app-package-name", + kBuildTypeExperimental, + kArgCheckPolicyOptional, + " --app-package-name \tSet APP package name\n" + " \t--app-package-name=package_name\n", + "mpl2mpl", + {} }, + { kCheckClInvocation, + 0, + "", + "check_cl_invocation", + kBuildTypeProduct, + kArgCheckPolicyRequired, + " --check_cl_invocation \tFor classloader invocation checking\n" + " \t--check_cl_invocation=list_file\n", + "mpl2mpl", + {} }, + { kDumpClInvocation, + kEnable, + "", + "dump_cl_invocation", + kBuildTypeExperimental, + kArgCheckPolicyBool, + " --dump_cl_invocation \tFor classloader invocation dumping.\n" + " \tWork only if already set --check_cl_invocation\n" + " --no-dump_cl_invocation \tDisable dump_cl_invocation\n", + "mpl2mpl", + {} }, + { kMpl2MplWarnLevel, + 0, + "", + "warning", + kBuildTypeExperimental, + kArgCheckPolicyNumeric, + " --warning=level \t--warning=level\n", + "mpl2mpl", + {} }, + { kMpl2MplLazyBinding, + kEnable, + "", + "lazy-binding", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --lazy-binding \tBind class symbols lazily[default off]\n" + " --no-lazy-binding \tDon't bind class symbols lazily\n", + "mpl2mpl", + {} }, + { kMpl2MplHotFix, + kEnable, + "", + "hot-fix", + kBuildTypeExperimental, + kArgCheckPolicyBool, + " --hot-fix \tOpen for App hot fix[default off]\n" + " --no-hot-fix \tDon't open for App hot fix\n", + "mpl2mpl", + {} }, + { kMpl2MplCompactMeta, + kEnable, + "", + "compact-meta", + kBuildTypeExperimental, + kArgCheckPolicyBool, + " --compact-meta \tEnable compact method and field meta\n" + " --no-compact-meta \tDisable compact method and field meta\n", + "mpl2mpl", + {} }, + { kGenPGOReport, + kEnable, + "", + "gen-pgo-report", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --gen-pgo-report \tDisplay pgo report\n" + " --no-gen-pgo-report\n", + "mpl2mpl", + {} }, + { kInlineCache, + 0, + "", + "inlineCache", + kBuildTypeProduct, + kArgCheckPolicyBool, + " --inlineCache \tbuild inlineCache 0:off, 1:open\n" + " --no-inlineCache\n", + "mpl2mpl", + {} }, { kNoComment, 0, "", @@ -669,12 +1001,30 @@ bool Options::SolveOptions(const std::vector