Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
959ec51
Use explicit secret arguments in IL stubs
jkoritzinsky Aug 19, 2026
7c41793
Address secret argument review feedback
jkoritzinsky Aug 19, 2026
55bd04d
Fix secret argument stack homes
jkoritzinsky Aug 19, 2026
4cd669e
Clarify secret stub argument documentation
Copilot Aug 19, 2026
177d399
Address secret argument review feedback
jkoritzinsky Aug 21, 2026
35ac4b3
Simplify vararg PInvoke context handling
jkoritzinsky Aug 27, 2026
eb95c4c
Fix secret argument stack homes
jkoritzinsky Aug 19, 2026
248eee6
Address secret argument review feedback
jkoritzinsky Aug 21, 2026
82d4cbd
Update src/coreclr/inc/corjitflags.h
jkoritzinsky Aug 28, 2026
68ce9df
Home secret argument outside vararg save area
jkoritzinsky Sep 3, 2026
a7ace07
Merge main into secret stub arguments
jkoritzinsky Sep 4, 2026
d0dff1b
Merge remote-tracking branch 'origin/main' into dev/jkoritzinsky/secr…
jkoritzinsky Sep 4, 2026
3dde572
Merge remote-tracking branch 'origin/main' into dev/jkoritzinsky/secr…
jkoritzinsky Sep 4, 2026
445d5dd
Merge branch 'main' into dev/jkoritzinsky/secret-stub-arguments
jkotas Sep 13, 2026
e77c4df
Merge origin/main into secret stub arguments
jkoritzinsky Sep 15, 2026
30bbff6
Address secret argument review feedback
jkoritzinsky Sep 15, 2026
72f9770
Merge origin/main into secret stub arguments
jkoritzinsky Sep 18, 2026
8f78f24
Clarify secret stub argument ABI documentation
jkoritzinsky Sep 18, 2026
b89bc3b
Use dashes
jkoritzinsky Sep 18, 2026
2f12788
Address formatting
jkoritzinsky Sep 18, 2026
ca055dc
Preserve COM field stub transition tracking
jkoritzinsky Sep 22, 2026
24f79b8
Merge branch 'main' into dev/jkoritzinsky/secret-stub-arguments
jkoritzinsky Sep 22, 2026
1ef8722
Merge branch 'main' into dev/jkoritzinsky/secret-stub-arguments
jkoritzinsky Sep 23, 2026
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
5 changes: 4 additions & 1 deletion docs/design/coreclr/botr/clr-abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ ARM64-only: When a method returns a structure that is larger than 16 bytes the c

*Stub dispatch* - when a virtual call uses a VSD stub, rather than back-patching the calling code (or disassembling it), the JIT must place the address of the stub used to load the call target, the "stub indirection cell", in (x86) `EAX` / (AMD64) `R11` / (ARM) `R12` / (ARM64) `R11`. In the JIT, this is encapsulated in the `VirtualStubParamInfo` class.

*Normal PInvoke* - The VM shares IL stubs based on signatures, but wants the right method to show up in call stack and exceptions, so the MethodDesc for the exact PInvoke is passed in the (x86) `EAX` / (AMD64) `R10` / (ARM, ARM64) `R12` (in the JIT: `REG_SECRET_STUB_PARAM`). Then in the IL stub, when the JIT gets `CORJIT_FLG_PUBLISH_SECRET_PARAM`, it must move the register into a compiler temp. The value is returned for the intrinsic `NI_System_StubHelpers_GetStubContext`.
*Secret stub argument* - An explicit `native int` parameter with a required `System.Runtime.CompilerServices.SecretStubArgument` modifier tells the JIT to bind the parameter to (x86) `EAX` / (AMD64) `R10` / (ARM, ARM64) `R12` / (LoongArch64, RISC-V) `T2` (in the JIT: `REG_SECRET_STUB_PARAM`). Interop IL stubs use this parameter for the following values:
- Unmanaged CALLI stubs pass the unmanaged target address.
- Shared vararg PInvoke stubs pass the MethodDesc for the exact PInvoke.
- Native-to-managed method and delegate stubs pass the `UMEntryThunkData` used to recover the managed target or delegate.

Comment thread
jkoritzinsky marked this conversation as resolved.
## Small primitive returns

Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2549,9 +2549,6 @@ internal static void ValidateObject(object obj, IntPtr pMD)
[LibraryImport(RuntimeHelpers.QCall, EntryPoint="StubHelpers_ValidateByref")]
internal static partial void ValidateByref(IntPtr byref, IntPtr pMD); // the byref is pinned so we can safely "cast" it to IntPtr

[Intrinsic]
internal static IntPtr GetStubContext() => throw new UnreachableException(); // Unconditionally expanded intrinsic

[MethodImpl(MethodImplOptions.NoInlining)]
internal static void MulticastDebuggerTraceHelper(object o, int count)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/corjitflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CORJIT_FLAGS
CORJIT_FLAG_BBINSTR_IF_LOOPS = 19, // JIT must instrument current method if it has loops
CORJIT_FLAG_BBOPT = 20, // Optimize method based on profile information
CORJIT_FLAG_FRAMED = 21, // All methods have an EBP frame
CORJIT_FLAG_PUBLISH_SECRET_PARAM = 22, // JIT must place stub secret param into local 0. (used by IL stubs)
// UNUSED = 22,
CORJIT_FLAG_USE_PINVOKE_HELPERS = 23, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
Comment thread
jkoritzinsky marked this conversation as resolved.
CORJIT_FLAG_REVERSE_PINVOKE = 24, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
CORJIT_FLAG_TRACK_TRANSITIONS = 25, // The JIT should insert the helper variants that track transitions.
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@

#include <minipal/guid.h>

constexpr GUID JITEEVersionIdentifier = { /* 908b7061-5586-4975-82c6-9a4adfcce6da */
0x908b7061,
0x5586,
0x4975,
{0x82, 0xc6, 0x9a, 0x4a, 0xdf, 0xcc, 0xe6, 0xda}
constexpr GUID JITEEVersionIdentifier = { /* fa0c6a6f-b219-4b60-b928-042c72667eb3 */
0xfa0c6a6f,
0xb219,
0x4b60,
{0xb9, 0x28, 0x04, 0x2c, 0x72, 0x66, 0x7e, 0xb3}
};

#endif // JIT_EE_VERSIONING_GUID_H
34 changes: 19 additions & 15 deletions src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ void InterpCompiler::PrepareInterpMethod()
// Store method data for later finalization
m_initLocals = (m_methodInfo->options & CORINFO_OPT_INIT_LOCALS) != 0;
m_unmanagedCallersOnly = m_corJitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE);
m_publishSecretStubParam = m_corJitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_PUBLISH_SECRET_PARAM);
m_publishSecretStubParam = (m_hiddenArgumentVar >= 0) && m_unmanagedCallersOnly;

// Reserve space in the builder for each section
// Bytecode section
Expand Down Expand Up @@ -2547,7 +2547,22 @@ void InterpCompiler::CreateILVars()
for (int i = argIndexOffset; i < numArgs; i++)
{
CORINFO_CLASS_HANDLE argClass;
CorInfoType argCorType = strip(m_compHnd->getArgType(&m_methodInfo->args, sigArg, &argClass));
CorInfoTypeWithMod argCorTypeWithMod = m_compHnd->getArgType(&m_methodInfo->args, sigArg, &argClass);
CorInfoType argCorType = strip(argCorTypeWithMod);
if ((argCorTypeWithMod & CORINFO_TYPE_MOD_SECRET_STUB_ARGUMENT) != 0)
{
if (argCorType != CORINFO_TYPE_NATIVEINT)
{
BADCODE("SecretStubArgument modifier must be applied to a native int parameter");
}

if (m_hiddenArgumentVar >= 0)
{
BADCODE("Duplicate SecretStubArgument modifier");
}

m_hiddenArgumentVar = i;
}
InterpType interpType = GetInterpType(argCorType);
sigArg = m_compHnd->getArgNext(sigArg);
CreateNextLocalVar(i, argClass, interpType, &offset);
Expand Down Expand Up @@ -3881,16 +3896,6 @@ bool InterpCompiler::EmitNamedIntrinsicCall(NamedIntrinsic ni, bool nonVirtualCa
AddIns(INTOP_THROW_PNSE);
return true;
}
case NI_System_StubHelpers_GetStubContext:
{
assert(m_hiddenArgumentVar >= 0);
AddIns(INTOP_MOV_P);
PushStackType(StackTypeI, NULL);
m_pLastNewIns->SetSVar(m_hiddenArgumentVar);
m_pLastNewIns->SetDVar(m_pStackPointer[-1].var);
return true;
}

case NI_System_Runtime_CompilerServices_StaticsHelpers_VolatileReadAsByref:
{
CHECK_STACK(1);
Expand Down Expand Up @@ -5204,7 +5209,6 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
// This expansion can produce value that is inconsistent with the value seen by JIT/R2R code that can
// cause user code to misbehave. This is by design. One-off method Interpretation is for internal use only.
bool isMustExpand = (callInfo.hMethod == m_methodHnd) || (
ni == NI_System_StubHelpers_GetStubContext ||
ni == NI_System_StubHelpers_NextCallReturnAddress ||
ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_SetNextCallGenericContext ||
ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_SetNextCallAsyncContinuation ||
Expand Down Expand Up @@ -8862,12 +8866,12 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo)
m_pLastNewIns->SetSVar(m_continuationArgIndex);
}

if (m_corJitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_PUBLISH_SECRET_PARAM))
if ((m_hiddenArgumentVar >= 0) &&
m_corJitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE))
Comment thread
jkoritzinsky marked this conversation as resolved.
{
#ifdef FEATURE_PORTABLE_ENTRYPOINTS
assert(!"Generating INTOP_STORESTUBCONTEXT on invalid platform");
#else
m_hiddenArgumentVar = CreateVarExplicit(InterpTypeI, NULL, sizeof(void *));
AddIns(INTOP_STORESTUBCONTEXT);
m_pLastNewIns->SetDVar(m_hiddenArgumentVar);
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/interpreter/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ NamedIntrinsic GetNamedIntrinsic(COMP_HANDLE compHnd, CORINFO_METHOD_HANDLE comp
{
if (!strcmp(methodName, "NextCallReturnAddress"))
return NI_System_StubHelpers_NextCallReturnAddress;
else if (!strcmp(methodName, "GetStubContext"))
return NI_System_StubHelpers_GetStubContext;
}
}
else if (!strcmp(namespaceName, "System.Numerics"))
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ class CodeGen final : public CodeGenInterface
var_types genParamStackType(LclVarDsc* dsc, const ABIPassingSegment& seg);
void genSpillOrAddRegisterParam(
unsigned lclNum, unsigned offset, unsigned paramLclNum, const ABIPassingSegment& seg, class RegGraph* graph);
void genSpillOrAddNonStandardRegisterParam(unsigned lclNum, regNumber sourceReg, class RegGraph* graph);
void genEnregisterIncomingStackArgs();
void genEnregisterOSRArgsAndLocals(regNumber initReg, bool* pInitRegZeroed);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni

const target_size_t pageSize = m_compiler->eeGetPageSize();

assert(!m_compiler->info.compPublishStubParam || (REG_SECRET_STUB_PARAM != initReg));
assert(!m_compiler->compHasSecretStubArgument() || (REG_SECRET_STUB_PARAM != initReg));

if (frameSize < pageSize)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5808,7 +5808,7 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
// but we don't alter SP.
target_size_t lastTouchDelta = 0;

assert(!m_compiler->info.compPublishStubParam || (REG_SECRET_STUB_PARAM != initReg));
assert(!m_compiler->compHasSecretStubArgument() || (REG_SECRET_STUB_PARAM != initReg));

if (frameSize < pageSize)
{
Expand Down
40 changes: 0 additions & 40 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3421,34 +3421,6 @@ void CodeGen::genSpillOrAddRegisterParam(
}
}

// -----------------------------------------------------------------------------
// genSpillOrAddNonStandardRegisterParam: Handle a non-standard register parameter either
// by homing it to stack immediately, or by adding it to the register graph.
//
// Parameters:
// lclNum - Local that represents the non-standard parameter
// sourceReg - Register that the non-standard parameter is in on entry to the function
// graph - The register graph to add to
//
void CodeGen::genSpillOrAddNonStandardRegisterParam(unsigned lclNum, regNumber sourceReg, RegGraph* graph)
{
LclVarDsc* varDsc = m_compiler->lvaGetDesc(lclNum);
if (varDsc->lvOnFrame && (!varDsc->lvIsInReg() || varDsc->IsLiveInOutOfHandler()))
{
GetEmitter()->emitIns_S_R(ins_Store(varDsc->TypeGet()), emitActualTypeSize(varDsc), sourceReg, lclNum, 0);
}

if (varDsc->lvIsInReg())
{
RegNode* sourceRegNode = graph->GetOrAdd(sourceReg);
RegNode* destRegNode = graph->GetOrAdd(varDsc->GetRegNum());
if (sourceRegNode != destRegNode)
{
graph->AddEdge(sourceRegNode, destRegNode, TYP_I_IMPL, 0);
}
}
}

// -----------------------------------------------------------------------------
// genHomeRegisterParams: Move all register parameters to their initial
// assigned location.
Expand Down Expand Up @@ -3496,13 +3468,6 @@ void CodeGen::genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed)
}
}

if (m_compiler->info.compPublishStubParam && ((paramRegs & RBM_SECRET_STUB_PARAM) != RBM_NONE) &&
m_compiler->lvaGetDesc(m_compiler->lvaStubArgumentVar)->lvOnFrame)
{
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SECRET_STUB_PARAM,
m_compiler->lvaStubArgumentVar, 0);
}

return;
}

Expand Down Expand Up @@ -3564,11 +3529,6 @@ void CodeGen::genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed)
}
}

if (m_compiler->info.compPublishStubParam && ((paramRegs & RBM_SECRET_STUB_PARAM) != RBM_NONE))
{
genSpillOrAddNonStandardRegisterParam(m_compiler->lvaStubArgumentVar, REG_SECRET_STUB_PARAM, &graph);
}

Comment thread
jkoritzinsky marked this conversation as resolved.
DBEXEC(VERBOSE, graph.Dump());

INDEBUG(graph.Validate());
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6272,7 +6272,7 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
// but we don't alter SP.
target_size_t lastTouchDelta = 0;

assert(!m_compiler->info.compPublishStubParam || (REG_SECRET_STUB_PARAM != initReg));
assert(!m_compiler->compHasSecretStubArgument() || (REG_SECRET_STUB_PARAM != initReg));

if (frameSize < pageSize)
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2451,7 +2451,7 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
#ifdef TARGET_X86
int spOffset = -(int)frameSize;

if (m_compiler->info.compPublishStubParam)
if (m_compiler->compHasSecretStubArgument())
{
GetEmitter()->emitIns_R(INS_push, EA_PTRSIZE, REG_SECRET_STUB_PARAM);
spOffset += REGSIZE_BYTES;
Expand All @@ -2462,7 +2462,7 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni

genEmitHelperCall(CORINFO_HELP_STACK_PROBE, 0, EA_UNKNOWN);

if (m_compiler->info.compPublishStubParam)
if (m_compiler->compHasSecretStubArgument())
{
GetEmitter()->emitIns_R(INS_pop, EA_PTRSIZE, REG_SECRET_STUB_PARAM);
GetEmitter()->emitIns_R_I(INS_sub, EA_PTRSIZE, REG_SPBASE, frameSize);
Expand Down
10 changes: 0 additions & 10 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4312,14 +4312,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
hashBv::Init(this);

VarSetOps::AssignAllowUninitRhs(this, compCurLife, VarSetOps::UninitVal());

// The temp holding the secret stub argument is used by fgImport() when importing the intrinsic.
if (info.compPublishStubParam)
{
assert(lvaStubArgumentVar == BAD_VAR_NUM);
lvaStubArgumentVar = lvaGrabTempWithImplicitUse(false DEBUGARG("stub argument"));
lvaGetDesc(lvaStubArgumentVar)->lvType = TYP_I_IMPL;
}
};
DoPhase(this, PHASE_PRE_IMPORT, preImportPhase);

Expand Down Expand Up @@ -6800,8 +6792,6 @@ int Compiler::compCompileHelper(CORINFO_MODULE_HANDLE classPtr,

info.compIsStatic = (info.compFlags & CORINFO_FLG_STATIC) != 0;

info.compPublishStubParam = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PUBLISH_SECRET_PARAM);

if (opts.IsReversePInvoke())
{
bool unused;
Expand Down
12 changes: 10 additions & 2 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5034,7 +5034,16 @@ class Compiler
return lvaGetDesc(lclNum)->lvInSsa;
}

unsigned lvaStubArgumentVar = BAD_VAR_NUM; // variable representing the secret stub argument
bool compHasSecretStubArgument() const
{
return lvaSecretStubArg != BAD_VAR_NUM;
}

unsigned lvaGetSecretStubArgumentVar() const
{
assert(compHasSecretStubArgument());
return lvaSecretStubArg;
}

InlineInfo* impInlineInfo; // Only present for inlinees
InlineStrategy* m_inlineStrategy;
Expand Down Expand Up @@ -11943,7 +11952,6 @@ class Compiler
bool compIsVarArgs : 1; // Does the method have varargs parameters?
bool compInitMem : 1; // Is the CORINFO_OPT_INIT_LOCALS bit set in the method info options?
bool compProfilerCallback : 1; // JIT inserted a profiler Enter callback
bool compPublishStubParam : 1; // Hidden argument captured in prolog will be available through an intrinsic
bool compHasNextCallRetAddr : 1; // The NextCallReturnAddress intrinsic is used.
bool compUsesAsyncContinuation : 1; // The AsyncCallContinuation intrinsic is used.

Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4184,8 +4184,7 @@ bool Compiler::fgVarIsNeverZeroInitializedInProlog(unsigned varNum)
{
LclVarDsc* varDsc = lvaGetDesc(varNum);
bool result = varDsc->lvIsParam || varDsc->lvIsParamRegTarget || lvaIsOSRLocal(varNum) ||
(varNum == lvaGSSecurityCookie) || (varNum == lvaInlinedPInvokeFrameVar) ||
(varNum == lvaStubArgumentVar) || (varNum == lvaRetAddrVar);
(varNum == lvaGSSecurityCookie) || (varNum == lvaInlinedPInvokeFrameVar) || (varNum == lvaRetAddrVar);

#ifdef TARGET_ARM64
result = result || (varNum == lvaFfrRegister);
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2581,7 +2581,6 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod()
case NI_System_Threading_Interlocked_MemoryBarrier:
case NI_System_Threading_Volatile_ReadBarrier:
case NI_System_Threading_Volatile_WriteBarrier:
case NI_System_StubHelpers_GetStubContext:
case NI_System_StubHelpers_NextCallReturnAddress:
case NI_System_Activator_AllocatorOf:
case NI_System_Activator_DefaultConstructorOf:
Expand Down
15 changes: 7 additions & 8 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1864,12 +1864,10 @@ void Compiler::fgAddReversePInvokeEnterExit()
if (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TRACK_TRANSITIONS))
{
GenTree* stubArgument;
if (info.compPublishStubParam)
if (compHasSecretStubArgument())
{
// If we have a secret param for a Reverse P/Invoke, that means that we are in an IL stub.
// In this case, the method handle we pass down to the Reverse P/Invoke helper should be
// the target method, which is passed in the secret parameter.
stubArgument = gtNewLclvNode(lvaStubArgumentVar, TYP_I_IMPL);
// Reverse P/Invoke IL stubs receive UMEntryThunkData in the secret parameter.
stubArgument = gtNewLclvNode(lvaGetSecretStubArgumentVar(), TYP_I_IMPL);
}
else
{
Expand Down Expand Up @@ -2606,9 +2604,10 @@ PhaseStatus Compiler::fgAddInternal()

LclVarDsc* varDsc = lvaGetDesc(lvaInlinedPInvokeFrameVar);
// Make room for the inlined frame.
const CORINFO_EE_INFO* eeInfo = eeGetEEInfo();
unsigned frameSize = info.compPublishStubParam ? eeInfo->inlinedCallFrameInfo.sizeWithSecretStubArg
: eeInfo->inlinedCallFrameInfo.size;
const CORINFO_EE_INFO* eeInfo = eeGetEEInfo();
const bool hasMDContextArg = info.compIsVarArgs && opts.jitFlags->IsSet(JitFlags::JIT_FLAG_IL_STUB);
unsigned frameSize =
hasMDContextArg ? eeInfo->inlinedCallFrameInfo.sizeWithSecretStubArg : eeInfo->inlinedCallFrameInfo.size;
lvaSetStruct(lvaInlinedPInvokeFrameVar, typGetBlkLayout(frameSize), false);
}

Expand Down
12 changes: 1 addition & 11 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3546,12 +3546,6 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,

*pIntrinsicName = ni;

if (ni == NI_System_StubHelpers_GetStubContext)
{
// must be done regardless of DbgCode and MinOpts
return gtNewLclvNode(lvaStubArgumentVar, TYP_I_IMPL);
}

if (ni == NI_System_StubHelpers_NextCallReturnAddress)
{
// For now we just avoid inlining anything into these methods since
Expand Down Expand Up @@ -12638,11 +12632,7 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
{
if (strcmp(className, "StubHelpers") == 0)
{
if (strcmp(methodName, "GetStubContext") == 0)
{
result = NI_System_StubHelpers_GetStubContext;
}
else if (strcmp(methodName, "NextCallReturnAddress") == 0)
if (strcmp(methodName, "NextCallReturnAddress") == 0)
{
result = NI_System_StubHelpers_NextCallReturnAddress;
}
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/jitee.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class JitFlags
JIT_FLAG_BBINSTR_IF_LOOPS = 19, // JIT must instrument current method if it has loops
JIT_FLAG_BBOPT = 20, // Optimize method based on profile information
JIT_FLAG_FRAMED = 21, // All methods have an EBP frame
JIT_FLAG_PUBLISH_SECRET_PARAM = 22, // JIT must place stub secret param into local 0. (used by IL stubs)
JIT_FLAG_USE_PINVOKE_HELPERS = 23, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
JIT_FLAG_REVERSE_PINVOKE = 24, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
JIT_FLAG_TRACK_TRANSITIONS = 25, // The JIT should insert the helper variants that track transitions.
Expand Down Expand Up @@ -133,7 +132,6 @@ class JitFlags
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR_IF_LOOPS, JIT_FLAG_BBINSTR_IF_LOOPS);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_BBOPT, JIT_FLAG_BBOPT);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_FRAMED, JIT_FLAG_FRAMED);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PUBLISH_SECRET_PARAM, JIT_FLAG_PUBLISH_SECRET_PARAM);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_USE_PINVOKE_HELPERS, JIT_FLAG_USE_PINVOKE_HELPERS);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE, JIT_FLAG_REVERSE_PINVOKE);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TRACK_TRANSITIONS, JIT_FLAG_TRACK_TRANSITIONS);
Expand Down
Loading
Loading