-
Couldn't load subscription status.
- Fork 5.2k
Move GenTreeIntCon::gtCompileTimeHandle field to be a global map #115542
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5e6e387
remove unused JIT-EE APIs
EgorBo 991347b
clean up
EgorBo a8a58bc
Fix the issue
EgorBo ab5c1c0
Update jiteeversionguid.h
EgorBo 8ad1bec
Update jiteeversionguid.h
EgorBo f886f7e
Address feedback
EgorBo 5cdcb09
Merge branch 'main' into remove-compile-time-handle-fld
EgorBo 8c8f8d9
Merge branch 'main' into remove-compile-time-handle-fld
EgorBo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1489,13 +1489,7 @@ inline GenTreeIntCon* Compiler::gtNewIconHandleNode(size_t value, GenTreeFlags f | |
|
|
||
| inline GenTree* Compiler::gtNewIconEmbScpHndNode(CORINFO_MODULE_HANDLE scpHnd) | ||
| { | ||
| void *embedScpHnd, *pEmbedScpHnd; | ||
|
|
||
| embedScpHnd = (void*)info.compCompHnd->embedModuleHandle(scpHnd, &pEmbedScpHnd); | ||
|
|
||
| assert((!embedScpHnd) != (!pEmbedScpHnd)); | ||
|
|
||
| return gtNewIconEmbHndNode(embedScpHnd, pEmbedScpHnd, GTF_ICON_SCOPE_HDL, scpHnd); | ||
| return gtNewIconEmbHndNode((void*)scpHnd, nullptr, GTF_ICON_SCOPE_HDL, scpHnd); | ||
| } | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
|
|
@@ -1513,6 +1507,13 @@ inline GenTree* Compiler::gtNewIconEmbClsHndNode(CORINFO_CLASS_HANDLE clsHnd) | |
|
|
||
| //----------------------------------------------------------------------------- | ||
|
|
||
| inline GenTree* Compiler::gtNewIconEmbObjHndNode(CORINFO_OBJECT_HANDLE objHnd) | ||
| { | ||
| return gtNewIconEmbHndNode((void*)objHnd, nullptr, GTF_ICON_OBJ_HDL, nullptr); | ||
| } | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
|
|
||
| inline GenTree* Compiler::gtNewIconEmbMethHndNode(CORINFO_METHOD_HANDLE methHnd) | ||
| { | ||
| void *embedMethHnd, *pEmbedMethHnd; | ||
|
|
@@ -1528,13 +1529,7 @@ inline GenTree* Compiler::gtNewIconEmbMethHndNode(CORINFO_METHOD_HANDLE methHnd) | |
|
|
||
| inline GenTree* Compiler::gtNewIconEmbFldHndNode(CORINFO_FIELD_HANDLE fldHnd) | ||
| { | ||
| void *embedFldHnd, *pEmbedFldHnd; | ||
|
|
||
| embedFldHnd = (void*)info.compCompHnd->embedFieldHandle(fldHnd, &pEmbedFldHnd); | ||
|
|
||
| assert((!embedFldHnd) != (!pEmbedFldHnd)); | ||
|
|
||
| return gtNewIconEmbHndNode(embedFldHnd, pEmbedFldHnd, GTF_ICON_FIELD_HDL, fldHnd); | ||
| return gtNewIconEmbHndNode((void*)fldHnd, nullptr, GTF_ICON_FIELD_HDL, fldHnd); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
| } | ||
|
|
||
| /*****************************************************************************/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't this introducing an abstraction violation?
CORINFO_XXX_HANDLEs are not meant to be embedded in the code. We have an intentional distinction between theCORINFO_XXX_HANDLEhandles used to represent type system entities on JIT/EE interface and how these values get embedded into the code.It happens to work since these module handles are only used with JIT currently, but this change does not look like an improvement to me.
Uh oh!
There was an error while loading. Please reload this page.
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.
@jkotas I just assumed that almost 300 LOC is too much for an API that is just no-op (and CoreCLR only), I can revert this part.
Looks like the only case where we need to embed a field handle is CoreCLR jitting a method that accesses a field it has no access for, so JIT emits an exception telling about the field access violation. Isn't part of the IL verification that we got rid some time ago?
As for the modules, I presume they're only used to embed strings as helper calls, so JIT only.
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.
It is more like 20 lines of actual code. The rest is boiler plate.
I think the part that's introducing JIT/EE interface abstraction violations should be reverted.
We have not removed visibility checks to enforce good hygiene.
CORINFO_HELPER_DESC/impInsertHelperCallis meant to be a general-purpose facility to replace a method call or field access with a call to a helper that throws an exception. Doing it this way allows debugger to stop at the line that failed the visibility check.If we were to fail the JITing of the whole method instead, the user would just see that there is a visibility problem somewhere in method, without seeing the precise location.
There is a TODO to implement this optimization for R2R
runtime/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Lines 3591 to 3592 in 8df4955
Where possible, we should be building JIT/EE interactions such that they are JIT/AOT agnostic even if it is not needed at the moment.