Skip to content

Commit 684e5d1

Browse files
[clr-interp] Cause compilation to be skipped when using function only used by tail-call helper (#123508)
The NextCallReturnAddress intrinsic is only actually used in a case inside of the tail-call helper function, and in some of our interp modes we occasionally try to interpreter this tail-call helper. Instead of allowing that to happen, just skip the compilation.
1 parent f49873c commit 684e5d1

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,13 @@ bool InterpCompiler::EmitNamedIntrinsicCall(NamedIntrinsic ni, bool nonVirtualCa
36683668
// These intrinsics are handled in the il peeps path, and do not need to produce warnings here.
36693669
return false;
36703670

3671+
case NI_System_StubHelpers_NextCallReturnAddress:
3672+
// This intrinsic can only reach here if it is not followed by a POP, and in that case it is not supported by the interpreter.
3673+
// So we must skip compiling it. It should only appear in the case of tail-call stubs, and those are currently only supported by the JIT, so
3674+
// we presumably have a JIT available to implement this intrinsic.
3675+
SKIPCODE("NextCallReturnAddress intrinsic not supported in interpreter when not followed by POP");
3676+
return false;
3677+
36713678
default:
36723679
{
36733680
FAIL_TO_EXPAND_INTRINSIC:

src/coreclr/interpreter/eeinterp.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ INTERPRETER_NORETURN void BADCODE(const char* message)
190190
throw InterpException(message, CORJIT_BADCODE);
191191
}
192192

193+
INTERPRETER_NORETURN void SKIPCODE(const char* message)
194+
{
195+
if (IsInterpDumpActive())
196+
printf("Skip during interpreter method compilation: %s\n", message ? message : "unknown error");
197+
throw InterpException(message, CORJIT_SKIPPED);
198+
}
199+
193200
INTERPRETER_NORETURN void NOMEM()
194201
{
195202
throw InterpException(NULL, CORJIT_OUTOFMEM);

src/coreclr/interpreter/failures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
INTERPRETER_NORETURN void NO_WAY(const char* message);
1414
INTERPRETER_NORETURN void BADCODE(const char* message);
1515
INTERPRETER_NORETURN void NOMEM();
16+
INTERPRETER_NORETURN void SKIPCODE(const char* message);
1617

1718
#endif

0 commit comments

Comments
 (0)