Skip to content

Commit 2e60a4b

Browse files
committed
Throw the correct exception type
1 parent e9e406d commit 2e60a4b

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/coreclr/jit/importercalls.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
32473247

32483248
default:
32493249
{
3250-
return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, method, sig,
3250+
return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED, method, sig,
32513251
mustExpand);
32523252
}
32533253
}
@@ -5206,9 +5206,9 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
52065206
#ifdef TARGET_WASM
52075207
NYI_WASM("Unhandled must expand intrinsic");
52085208
#else
5209-
assert(!"Unhandled must expand intrinsic, throwing PlatformNotSupportedException");
5209+
assert(!"Unhandled must expand intrinsic, throwing NotImplementedException");
52105210
#endif
5211-
return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, method, sig, mustExpand);
5211+
return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_NOT_IMPLEMENTED, method, sig, mustExpand);
52125212
}
52135213

52145214
// Optionally report if this intrinsic is special
@@ -12028,6 +12028,19 @@ GenTree* Compiler::impUnsupportedNamedIntrinsic(unsigned helper,
1202812028

1202912029
if (mustExpand || opts.OptimizationEnabled())
1203012030
{
12031+
if ((helper == CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED) && IsReadyToRun())
12032+
{
12033+
if (!mustExpand)
12034+
{
12035+
return nullptr;
12036+
}
12037+
12038+
// If we're ready to run and must expand, we need to throw a PlatformNotSupportedException since
12039+
// there is no R2R helper for the regular NotSupportedException with the relevant
12040+
// type message.
12041+
helper = CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED;
12042+
}
12043+
1203112044
impSpillSideEffects(true, CHECK_SPILL_ALL DEBUGARG("impUnsupportedNamedIntrinsic"));
1203212045

1203312046
for (unsigned i = 0; i < sig->numArgs; i++)

0 commit comments

Comments
 (0)