Skip to content

Commit 9c2ee7a

Browse files
committed
Change DLT opt level based on option
Before this change one could force the optimization level of a particular DLT compilation through a command line option (dltOptLevel=...) only if the TR_DebugDLT env var was defined. This was done to avoid the overhead of searching the option subsets for a given method. This commit allows one to specify the optimization level of DLT compilations without the need of an env var. Examples: -Xjit:dltOptLevel=hot -Xjit:{myMethod}(dltOptLevel=cold) The overhead for searching option sets has been eliminated if no option subset uses the dltOptlevel= option Depends on eclipse-omr/omr#7596 Signed-off-by: Marius Pirvu <[email protected]>
1 parent 9f1f2aa commit 9c2ee7a

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

runtime/compiler/control/HookedByTheJit.cpp

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,6 @@ static void emptyJitGCMapCheck(J9VMThread * currentThread, J9StackWalkState * wa
938938

939939
static void jitGCMapCheck(J9VMThread* vmThread, IDATA handlerKey, void* userData)
940940
{
941-
942941
J9StackWalkState walkState;
943942
walkState.flags = J9_STACKWALK_ITERATE_O_SLOTS | J9_STACKWALK_ITERATE_HIDDEN_JIT_FRAMES | J9_STACKWALK_CHECK_I_SLOTS_FOR_OBJECTS;
944943
walkState.objectSlotWalkFunction = emptyJitGCMapCheck;
@@ -1067,33 +1066,42 @@ void DLTLogic(J9VMThread* vmThread, TR::CompilationInfo *compInfo)
10671066
TR_J9VMBase * vm = TR_J9VMBase::get(jitConfig, vmThread);
10681067

10691068
static char *enableDebugDLT = feGetEnv("TR_DebugDLT");
1070-
bool dltMostOnce = false;
10711069
int32_t enableDLTidx = -1;
10721070
int32_t disableDLTidx = -1;
1073-
int32_t dltOptLevel = -1;
10741071

1075-
if (enableDebugDLT!=NULL)
1072+
TR::Options *options = TR::Options::getCmdLineOptions();
1073+
TR::OptionSet *optionSet = NULL;
1074+
bool dltMostOnce = options->getOption(TR_DLTMostOnce);
1075+
if (options->anOptionSetContainsADltOptLevel())
10761076
{
1077-
TR::OptionSet *optionSet = findOptionSet(walkState.method, false);
1078-
TR::Options *options = optionSet ? optionSet->getOptions() : NULL;
1079-
1080-
enableDLTidx = options ? options->getEnableDLTBytecodeIndex() : -1;
1081-
disableDLTidx = options ? options->getDisableDLTBytecodeIndex() : -1;
1077+
optionSet = findOptionSet(walkState.method, false/*AOT*/);
1078+
if (optionSet)
1079+
options = optionSet->getOptions();
1080+
}
1081+
int32_t dltOptLevel = options->getDLTOptLevel();
10821082

1083-
if (enableDLTidx != -1)
1083+
if (enableDebugDLT != NULL)
1084+
{
1085+
if (!optionSet)
1086+
optionSet = findOptionSet(walkState.method, false);
1087+
// If option set exist, extract DLT related options from it
1088+
if (optionSet)
10841089
{
1085-
J9ROMMethod * romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(walkState.method);
1086-
bcIndex = enableDLTidx;
1087-
if (enableDLTidx >= (J9_BYTECODE_END_FROM_ROM_METHOD(romMethod)) - (J9_BYTECODE_START_FROM_ROM_METHOD(romMethod)))
1090+
TR::Options *options = optionSet->getOptions();
1091+
enableDLTidx = options->getEnableDLTBytecodeIndex();
1092+
disableDLTidx = options->getDisableDLTBytecodeIndex();
1093+
if (enableDLTidx != -1)
1094+
{
1095+
J9ROMMethod * romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(walkState.method);
1096+
bcIndex = enableDLTidx;
1097+
if (enableDLTidx >= (J9_BYTECODE_END_FROM_ROM_METHOD(romMethod)) - (J9_BYTECODE_START_FROM_ROM_METHOD(romMethod)))
1098+
return;
1099+
dltBlock->bcIndex[idx] = enableDLTidx;
1100+
}
1101+
if (disableDLTidx != -1 && disableDLTidx == bcIndex)
10881102
return;
1089-
dltBlock->bcIndex[idx] = enableDLTidx;
1103+
dltMostOnce = options->getOption(TR_DLTMostOnce);
10901104
}
1091-
if (disableDLTidx != -1 && disableDLTidx == bcIndex) return;
1092-
1093-
dltMostOnce = options ? options->getOption(TR_DLTMostOnce) :
1094-
TR::Options::getCmdLineOptions()->getOption(TR_DLTMostOnce);
1095-
dltOptLevel = options ? options->getDLTOptLevel() :
1096-
TR::Options::getCmdLineOptions()->getDLTOptLevel();
10971105
}
10981106

10991107
// This setup is for matching dltEntry to the right transfer point. It can be an issue only

0 commit comments

Comments
 (0)