-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
XArch: Trim the code block to match the actual code length #61523
Conversation
@jkotas @davidwrighton @dotnet/jit-contrib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Also realized that this is only applicable for xarch. For arm64, we also include the size of ro data and hence checking the unused memory is not even possible. |
Mention this in the comment? |
Sure, I have included some more explanation about armarch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment at
runtime/src/coreclr/inc/corjit.h
Lines 184 to 187 in 16b970a
// JIT to resolve tokens, and make any other callbacks needed to create the code. nativeEntry, and | |
// nativeSizeOfCode are just for convenience because the JIT asks the EE for the memory to emit code into | |
// (see code:ICorJitInfo.allocMem), so really the EE already knows where the method starts and how big | |
// it is (in fact, it could be in more than one chunk). |
for compileMethod is no longer quite true, as now the returned nativeEntry
has specific semantics... for some platforms.
That's somewhat unsatisfying.
Failure related to #61548 @BruceForstall - Do you mind taking another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not fond of the fact this creates an implicit contract that isn't documented (in corjit.h), and not for all platforms. But ok...
@BruceForstall and me discussed a possible follow-up work of implementing a new JITEE interface for |
RyuJIT sometimes over-estimate the instruction sizes leading to allocating more code memory than actually utilized. This PR reads the actual code size value and trims the code block array so that the real code size bytes are embedded in the R2RImage.
Related: #57368