Skip to content

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

Open
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:fix-igDataSize-assign
Open

JIT: Fix debug igDataSize assignment to use code size (so exclude gc vars)#128811
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:fix-igDataSize-assign

Conversation

@BoyBaykiller
Copy link
Copy Markdown
Contributor

@BoyBaykiller BoyBaykiller commented May 31, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

1 participant