Skip to content

JIT: Fix debug igDataSize assignment to use code size (so exclude gc vars) - #128811

Merged
jakobbotsch merged 1 commit into
dotnet:mainfrom
BoyBaykiller:fix-igDataSize-assign
Jun 10, 2026
Merged

jakobbotsch merged 1 commit into
dotnet:mainfrom
BoyBaykiller:fix-igDataSize-assign

Conversation

@BoyBaykiller

@BoyBaykiller BoyBaykiller commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

This random method (and other) tells us at that igData points to after the gc vars.

VARSET_VALRET_TP igGCvars() const
{
assert(igFlags & IGF_GC_VARS);
BYTE* ptr = (BYTE*)igData;
ptr -= sizeof(VARSET_TP);
return *(VARSET_TP*)ptr;
}

More specifically it points to "addr of instruction descriptors". However the corresponding debug-only igDataSize was being assigned gs which is the size of the entire IG (including gc vars). It should use code size (sz) instead.

Fixes this assert I was hitting in #128536:

assert(emitLastInsIG->igData + emitLastInsIG->igDataSize == (BYTE*)emitLastIns + emitSizeOfInsDsc(emitLastIns));

@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 31, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 31, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@BoyBaykiller

Copy link
Copy Markdown
Contributor Author

@jakobbotsch PTAL.

@jakobbotsch

Copy link
Copy Markdown
Member

/azp run runtime-coreclr jitstress

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch jakobbotsch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jakobbotsch
jakobbotsch merged commit 592e138 into dotnet:main Jun 10, 2026
160 of 168 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 17, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…c vars) (#128811)

This random method (and other) tells us at that `igData` points to after
the gc vars.

https://github.com/dotnet/runtime/blob/f2d5042ceaea5642bac6bde8a1a5765afcbf2ef4/src/coreclr/jit/emit.h#L352-L360

More specifically it points to "addr of instruction descriptors".
However the corresponding debug-only `igDataSize` was being assigned
`gs` which is the size of the entire IG (including gc vars). It should
use code size (`sz`) instead.

Fixes this assert I was hitting in
#128536:

https://github.com/dotnet/runtime/blob/f2d5042ceaea5642bac6bde8a1a5765afcbf2ef4/src/coreclr/jit/emit.cpp#L10081
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants