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
Codegen generates code referencing RuntimeType for __Canon[]
#101175
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
I don't see any issues in the codegen for CoreCLR here, I think the issue is in the NAOT's implementation for Because it's fine for VM internally to allocate cannonical type objects on FOH, isn't? it's just that JIT should never see raw constant handles for them |
Why does codegen even attempt to do this if there is a runtime lookup? Is it difficult to abort this if there is a runtime lookup? The (In theory, on native AOT side it would be easy to allow embedding these into generic dictionaries, so one could actually have a runtime lookup for a frozen RuntimeType instance.) |
I think it happens just because JIT doesn't expect EE for Here is the place where we create it for this case: runtime/src/coreclr/jit/valuenum.cpp Lines 11915 to 11922 in 3e569f5
|
OK, I'll add this on the VM side then. Can you quickly point me to where are the tests for these? |
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
I don't think there are dedicated tests for RuntimeType being frozen, but there are a lot of typeof(T) related tests in runtime tests. Typically, for bugs, we add new tests under https://github.com/dotnet/runtime/tree/main/src/tests/JIT/Regression/JitBlue with github Id as a name |
This may have a repro with JIT, but I hit this with PublishAot:
Codegen for
Foo..ctor
is:Notice an attempt to do a runtime lookup but then codegen changing it's mind and overwriting rcx with a const frozen object for
__Canon[]
RuntimeType
(which is non-sensical and will crash at runtime).I'm making the compiler assert on this #101173.
Cc @EgorBo
The text was updated successfully, but these errors were encountered: