Remove NativeAOT debug handle tagging#129034
Conversation
Ensure RyuJIT keeps host-sized handle values when cross-targeting from 64-bit to 32-bit builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR adjusts RyuJIT’s constant/handle plumbing so that, in cross-target scenarios (e.g., 64-bit host compiling 32-bit target), handle values are treated as host-pointer-sized where required, avoiding truncation of the upper bits during constant import/propagation and preventing incorrect folding.
Changes:
- Update static-readonly constant import to request
sizeof(ssize_t)bytes forTYP_REFsogtNewGenericCon(TYP_REF, ...)reads a complete host-sized handle. - Tighten/extend handle constant preservation in JIT assertion propagation and constant bashing so handle VNs don’t lose upper bits on 32-bit targets.
- Re-enable/strengthen coverage by removing test workarounds/skips that were masking the issue.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/Regressions/coreclr/15647/interfacestatics.ilproj | Removes TrimMode workaround so the test exercises the problematic optimization again. |
| src/tests/JIT/Methodical/jitinterface/bug603649.cs | Re-enables the test by removing the ActiveIssue skip. |
| src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | Adds a DEBUG invariant check to catch truncated/invalid handles early. |
| src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs | Adjusts getStaticFieldContent object-handle buffer handling for cross-target correctness. |
| src/coreclr/jit/importer.cpp | Requests host-sized bytes for TYP_REF static-readonly constants to avoid truncation. |
| src/coreclr/jit/compiler.hpp | Avoids incorrect debug-time “fits in int32” assertions for GC-typed constants. |
| src/coreclr/jit/assertionprop.cpp | Preserves host-sized handle constants/printing when VNs represent handles. |
🤖 Copilot Code Review — PR #129034Note This review was generated by Copilot. Holistic AssessmentMotivation: Real bug, well-documented in #122013. When cross-compiling from a 64-bit host to a 32-bit target, handle values (host-process-sized Approach: Multi-site fix that addresses the specific paths where truncation occurs: the importer's Summary: Detailed Findings✅ Primary fix path — Correct end-to-endThe chain from Verified in ✅
|
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
I assume CI failures are related? e.g. |
I only checked x86, so arm32 still not working is not completely surprising. Before I spend time setting up environment so that copilot can have a go at it, does the change so far make sense? I see the issue is now assigned to me... but I'm not a JIT dev, just someone who prompted GPT to make things compile with the added assert in CorInfoImpl.cs and GPT did its thing. |
I can take a look tomorrow. I'm not sure I fully understand the problem so will have to look deeply. Meanwhole sent a PR to clean up one of the offender from your PR - #129144 |
|
@copilot undo all the non-test changes. Instead of those, delete the |
Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Done in |
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Remove the debug-only high-bit tag from NativeAOT JIT interface handles. This avoids rejecting valid handles on targets where the tag bit is not preserved.
Also re-enables the affected regression coverage by removing the NativeAOT workaround/skip from the existing tests.
Cc @EgorBo