diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 7bf00c5cc84d62..34334c6f2eaac5 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -6315,6 +6315,7 @@ class Compiler bool fgMayExplicitTailCall(); + template void fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, FixedBitVect* jumpTarget); void fgMarkBackwardJump(BasicBlock* startBlock, BasicBlock* endBlock); diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index da31f325424e40..f2c0f458c10505 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -1064,13 +1064,16 @@ class FgStack //------------------------------------------------------------------------ // fgFindJumpTargets: walk the IL stream, determining jump target offsets // +// Type arguments: +// makeInlineObservations - whether or not to record inline observations about the method +// // Arguments: // codeAddr - base address of the IL code buffer // codeSize - number of bytes in the IL code buffer // jumpTarget - [OUT] bit vector for flagging jump targets // // Notes: -// If inlining or prejitting the root, this method also makes +// If "makeInlineObservations" is true this method also makes // various observations about the method that factor into inline // decisions. // @@ -1080,6 +1083,7 @@ class FgStack // // Also sets m_addrExposed and lvHasILStoreOp, ilHasMultipleILStoreOp in lvaTable[]. // +template void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, FixedBitVect* jumpTarget) { const BYTE* codeBegp = codeAddr; @@ -1088,13 +1092,12 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed var_types varType = DUMMY_INIT(TYP_UNDEF); // TYP_ type bool typeIsNormed = false; FgStack pushedStack; - const bool isForceInline = (info.compFlags & CORINFO_FLG_FORCEINLINE) != 0; - const bool makeInlineObservations = (compInlineResult != nullptr); - const bool isInlining = compIsForInlining(); - unsigned retBlocks = 0; - int prefixFlags = 0; - bool preciseScan = makeInlineObservations && compInlineResult->GetPolicy()->RequiresPreciseScan(); - const bool resolveTokens = preciseScan; + const bool isForceInline = (info.compFlags & CORINFO_FLG_FORCEINLINE) != 0; + const bool isInlining = compIsForInlining(); + unsigned retBlocks = 0; + int prefixFlags = 0; + bool preciseScan = makeInlineObservations && compInlineResult->GetPolicy()->RequiresPreciseScan(); + const bool resolveTokens = preciseScan; // Track offsets where IL instructions begin in DEBUG builds. Used to // validate debug info generated by the JIT. @@ -3614,7 +3617,14 @@ void Compiler::fgFindBasicBlocks() FixedBitVect* jumpTarget = FixedBitVect::bitVectInit(info.compILCodeSize + 1, this); // Walk the instrs to find all jump targets - fgFindJumpTargets(info.compCode, info.compILCodeSize, jumpTarget); + if (compInlineResult != nullptr) + { + fgFindJumpTargets(info.compCode, info.compILCodeSize, jumpTarget); + } + else + { + fgFindJumpTargets(info.compCode, info.compILCodeSize, jumpTarget); + } if (compDonotInline()) { return;