Skip to content

Commit dc03c5e

Browse files
authored
Allow using P/Invoke helpers for IL stubs (#113824)
1 parent 2fe5b1b commit dc03c5e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/coreclr/jit/lower.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5943,7 +5943,7 @@ void Lowering::InsertPInvokeMethodProlog()
59435943
noway_assert(comp->info.compUnmanagedCallCountWithGCTransition);
59445944
noway_assert(comp->lvaInlinedPInvokeFrameVar != BAD_VAR_NUM);
59455945

5946-
if (comp->opts.ShouldUsePInvokeHelpers())
5946+
if (!comp->info.compPublishStubParam && comp->opts.ShouldUsePInvokeHelpers())
59475947
{
59485948
return;
59495949
}
@@ -5972,6 +5972,13 @@ void Lowering::InsertPInvokeMethodProlog()
59725972
DISPTREERANGE(firstBlockRange, store);
59735973
}
59745974

5975+
// If we use P/Invoke helper calls then the hidden stub initialization
5976+
// is all we need to do. Rest will get initialized by the helper.
5977+
if (comp->opts.ShouldUsePInvokeHelpers())
5978+
{
5979+
return;
5980+
}
5981+
59755982
// Call runtime helper to fill in our InlinedCallFrame and push it on the Frame list:
59765983
// TCB = CORINFO_HELP_INIT_PINVOKE_FRAME(&symFrameStart);
59775984
GenTree* frameAddr = comp->gtNewLclVarAddrNode(comp->lvaInlinedPInvokeFrameVar);

0 commit comments

Comments
 (0)