Skip to content

Commit

Permalink
Merge pull request #1 from BruceForstall/FixSPMI
Browse files Browse the repository at this point in the history
Fix SuperPMI for new altjit jit flag
  • Loading branch information
davidwrighton authored Nov 16, 2020
2 parents b191fba + 962cc86 commit 6c4ede5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,16 @@ void MyICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bo
DWORD MyICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
{
jitInstance->mc->cr->AddCall("getJitFlags");
return jitInstance->mc->repGetJitFlags(jitFlags, sizeInBytes);
DWORD ret = jitInstance->mc->repGetJitFlags(jitFlags, sizeInBytes);
if (jitInstance->forceClearAltJitFlag)
{
jitFlags->Clear(CORJIT_FLAGS::CORJIT_FLAG_ALT_JIT);
}
else if (jitInstance->forceSetAltJitFlag)
{
jitFlags->Set(CORJIT_FLAGS::CORJIT_FLAG_ALT_JIT);
}
return ret;
}

// Runs the given function with the given parameter under an error trap
Expand Down
31 changes: 30 additions & 1 deletion src/coreclr/src/ToolBox/superpmi/superpmi/jitinstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,38 @@ JitInstance* JitInstance::InitJit(char* nameOfJit,
}

jit->forceOptions = forceOptions;

jit->options = options;

// The flag to cause the JIT to be invoked as an altjit is stored in the jit flags, not in
// the environment. If the user uses the "-jitoption force" flag to force AltJit off (it was
// probably on during collection), or to force it on, then propagate that to the jit flags.
jit->forceClearAltJitFlag = false;
jit->forceSetAltJitFlag = false;
const WCHAR* altJitFlag = jit->getForceOption(W("AltJit"));
if (altJitFlag != nullptr)
{
if (wcscmp(altJitFlag, W("")) == 0)
{
jit->forceClearAltJitFlag = true;
}
else
{
jit->forceSetAltJitFlag = true;
}
}
const WCHAR* altJitNgenFlag = jit->getForceOption(W("AltJitNgen"));
if (altJitNgenFlag != nullptr)
{
if (wcscmp(altJitNgenFlag, W("")) == 0)
{
jit->forceClearAltJitFlag = true;
}
else
{
jit->forceSetAltJitFlag = true;
}
}

jit->environment.getIntConfigValue = nullptr;
jit->environment.getStingConfigValue = nullptr;

Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/src/ToolBox/superpmi/superpmi/jitinstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class JitInstance
void timeResult(CORINFO_METHOD_INFO info, unsigned flags);

public:

bool forceClearAltJitFlag;
bool forceSetAltJitFlag;

enum Result
{
RESULT_ERROR,
Expand Down

0 comments on commit 6c4ede5

Please sign in to comment.