Move Thread::m_pInterpThreadContext near top of Thread class for stable asm offset#126684
Move Thread::m_pInterpThreadContext near top of Thread class for stable asm offset#126684
Thread::m_pInterpThreadContext near top of Thread class for stable asm offset#126684Conversation
…thAllocContextObj This makes the offset more stable for asm code. The field is no longer at the end of the class (offsets were 0x290-0xaf8 depending on config), and is now at a stable offset of 0x30 (64-bit) or 0x1c (32-bit) near the top of the class. Update OFFSETOF__Thread__m_pInterpThreadContext in all asmconstants.h files (amd64, arm64, arm, loongarch64, riscv64) to the new stable values. The conditional compilation guards for _DEBUG and TARGET_UNIX are removed since the value is now the same in all configurations for each architecture. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/21a58369-8e3e-4715-98ba-f11a627ecdfe Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
…r near top of Thread class Move the entire #ifdef FEATURE_INTERPRETER block (public: access specifier, m_pInterpThreadContext field, and both method declarations) from the end of the Thread class to just after m_thAllocContextObj. This consolidates all interpreter-related declarations into a single #ifdef block near the top of the class, while keeping the stable offset for m_pInterpThreadContext. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b426d848-547f-405d-97e3-1e21bf94368d Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the assembly-visible offset of Thread::m_pInterpThreadContext by moving the FEATURE_INTERPRETER field/method declarations near the top of Thread, avoiding large layout drift across OS and debug/release builds.
Changes:
- Relocated the
FEATURE_INTERPRETERblock (field + access specifier + method declarations) to immediately followm_thAllocContextObjinsrc/coreclr/vm/threads.h. - Updated architecture-specific
OFFSETOF__Thread__m_pInterpThreadContextconstants to match the new layout, removing per-OS/per-debug variants where no longer needed.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/threads.h | Moves the interpreter thread-context field/method declarations near the top of Thread to stabilize its offset. |
| src/coreclr/vm/amd64/asmconstants.h | Updates OFFSETOF__Thread__m_pInterpThreadContext to the new stable value and removes configuration conditionals. |
| src/coreclr/vm/arm64/asmconstants.h | Same offset update/conditional removal for arm64. |
| src/coreclr/vm/arm/asmconstants.h | Same offset update/conditional removal for arm (32-bit). |
| src/coreclr/vm/loongarch64/asmconstants.h | Same offset update for loongarch64. |
| src/coreclr/vm/riscv64/asmconstants.h | Same offset update for riscv64. |
|
This should fix build breaks in some of the runtime-extra-platforms legs: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1370910&view=logs&jobId=fbbe6d24-ec94-5563-68e4-47df2fb4f886&j=fbbe6d24-ec94-5563-68e4-47df2fb4f886&t=fd24ffdb-b6c4-50de-7ee2-f1794d18b0a7 |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
🤖 Copilot Code Review — PR #126684Note This review was generated by Copilot. Holistic AssessmentMotivation: Moving Approach: Relocating the field after Summary: ✅ LGTM. Clean, well-scoped field relocation with correct offset updates across all architectures. Detailed Findings✅ Correctness — Offset safety verified by compile-time assertsAll ✅ cDAC compatibility — No impact
✅ Layout impact — Minimal and safeWhen ✅ Scope — Appropriately focusedThe PR touches only the necessary files: 💡 Style — Redundant
|
|
/ba-g other extra platforms failures are being worked on |
Thread::m_pInterpThreadContextwas declared at the very end of theThreadclass, making its offset highly volatile across build configurations. Moving it towards the top of theThreadclass to a small set of stable, always-present fields at the top of theThreadclass will make it a lot more stable, and less prone to build breaks.