-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[interp][coreclr] Fix virtual generic calls in interpreter #122069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[interp][coreclr] Fix virtual generic calls in interpreter #122069
Conversation
Fix regression introduced in dotnet#121799 Force intrinsic expansion for new runtime helpers in the interpreter. Added the new methods and also NI_System_StubHelpers_NextCallReturnAddress, which has also `// Unconditionally expanded intrinsic` comment. This was happening on wasm and possibly on other platforms too, resulting in unhandled exception. Possibly only happening on platforms using generic instantiation IL stubs. ``` Unhandled exception. System.Diagnostics.UnreachableException: The program executed an instruction that was thought to be unreachable. at System.Runtime.CompilerServices.RuntimeHelpers.SetNextCallGenericContext(Void* value) in /Users/rodo/git/runtime-clean/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs:line 186 at InterpreterTest.TestVirtual() in /Users/rodo/git/runtime-clean/src/tests/JIT/interpreter/Interpreter.cs:line 1960 at InterpreterTest.RunInterpreterTests() in /Users/rodo/git/runtime-clean/src/tests/JIT/interpreter/Interpreter.cs:line 896 at InterpreterTest.Main(String[] args) in /Users/rodo/git/runtime-clean/src/tests/JIT/interpreter/Interpreter.cs:line 731 Aborted(native code called abort()) ```
|
I wonder if we can find better way to detect these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a regression in the interpreter where virtual generic calls were causing unhandled exceptions due to certain runtime helper intrinsics not being expanded. The fix ensures that intrinsics marked as "Unconditionally expanded" are always processed by the interpreter's intrinsic expansion logic.
Key Changes
- Added four runtime helper intrinsics to the
isMustExpandcondition in the interpreter's call emission code - These intrinsics must be unconditionally expanded to prevent infinite recursion and stack overflow
- The fix specifically addresses virtual generic method calls that were failing on WebAssembly and potentially other platforms using generic instantiation IL stubs
Fix regression introduced in #121799
Force intrinsic expansion for new runtime helpers in the interpreter.
Added the new methods and also
NI_System_StubHelpers_NextCallReturnAddress, which has also// Unconditionally expanded intrinsiccomment.This was happening on wasm and possibly on other platforms too, resulting in unhandled exception. Possibly only on platforms, which use generic instantiation IL stubs.