Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1126,26 +1126,29 @@ unsigned Compiler::compMap2ILvarNum(unsigned varNum) const
return (unsigned)ICorDebugInfo::UNKNOWN_ILNUM;
}

unsigned originalVarNum = varNum;

// Now mutate varNum to remove extra parameters from the count.
if (((info.compMethodInfo->args.callConv & CORINFO_CALLCONV_PARAMTYPE) != 0) && (varNum > info.compTypeCtxtArg))
if (((info.compMethodInfo->args.callConv & CORINFO_CALLCONV_PARAMTYPE) != 0) &&
(originalVarNum > info.compTypeCtxtArg))
{
varNum--;
}

if (info.compIsVarArgs && (varNum > lvaVarargsHandleArg))
if (info.compIsVarArgs && (originalVarNum > lvaVarargsHandleArg))
{
varNum--;
}

if ((lvaAsyncContinuationArg != BAD_VAR_NUM) && (varNum > lvaAsyncContinuationArg))
if ((lvaAsyncContinuationArg != BAD_VAR_NUM) && (originalVarNum > lvaAsyncContinuationArg))
{
varNum--;
}

// Is there a hidden argument for the return buffer. Note that this code
// works because if the RetBuffArg is not present, compRetBuffArg will be
// BAD_VAR_NUM
if ((info.compRetBuffArg != BAD_VAR_NUM) && (varNum > info.compRetBuffArg))
if ((info.compRetBuffArg != BAD_VAR_NUM) && (originalVarNum > info.compRetBuffArg))
{
varNum--;
}
Expand Down
Loading