Skip to content

Commit

Permalink
Don't do STRESS_PROFILER_CALLBACKS when pre-JITing (dotnet#2016)
Browse files Browse the repository at this point in the history
This leads us to generate an illegal relocation fixup.

Fixes dotnet#1789
  • Loading branch information
BruceForstall authored Jan 22, 2020
1 parent 5a948f1 commit 8861275
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/coreclr/src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3092,10 +3092,16 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
// Honour COMPlus_JitELTHookEnabled or STRESS_PROFILER_CALLBACKS stress mode
// only if VM has not asked us to generate profiler hooks in the first place.
// That is, override VM only if it hasn't asked for a profiler callback for this method.
if (!compProfilerHookNeeded &&
((JitConfig.JitELTHookEnabled() != 0) || compStressCompile(STRESS_PROFILER_CALLBACKS, 5)))
// Don't run this stress mode when pre-JITing, as we would need to emit a relocation
// for the call to the fake ELT hook, which wouldn't make sense, as we can't store that
// in the pre-JIT image.
if (!compProfilerHookNeeded)
{
opts.compJitELTHookEnabled = true;
if ((JitConfig.JitELTHookEnabled() != 0) ||
(!jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) && compStressCompile(STRESS_PROFILER_CALLBACKS, 5)))
{
opts.compJitELTHookEnabled = true;
}
}

// TBD: Exclude PInvoke stubs
Expand Down

0 comments on commit 8861275

Please sign in to comment.