-
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
CG2 Add lazy string literal loading support #47183
Changes from 3 commits
9dd7fc0
a29f31d
30660cc
8a56491
84ade17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -799,6 +799,9 @@ private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum) | |||||||||||||||||||||||||||||||
case CorInfoHelpFunc.CORINFO_HELP_JIT_REVERSE_PINVOKE_EXIT: | ||||||||||||||||||||||||||||||||
id = ReadyToRunHelper.ReversePInvokeExit; | ||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||
case CorInfoHelpFunc.CORINFO_HELP_STRCNS_CURRENT_MODULE: | ||||||||||||||||||||||||||||||||
id = ReadyToRunHelper.GetString; | ||||||||||||||||||||||||||||||||
nattress marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||
return _compilation.NodeFactory.ImportThunk(ReadyToRunHelper.GetString, _compilation.NodeFactory.HelperImports, useVirtualCall: false); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
case CorInfoHelpFunc.CORINFO_HELP_INITCLASS: | ||||||||||||||||||||||||||||||||
case CorInfoHelpFunc.CORINFO_HELP_INITINSTCLASS: | ||||||||||||||||||||||||||||||||
|
@@ -819,6 +822,11 @@ private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum) | |||||||||||||||||||||||||||||||
return _compilation.NodeFactory.GetReadyToRunHelperCell(id); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
private CorInfoHelpFunc getLazyStringLiteralHelper(CORINFO_MODULE_STRUCT_* handle) | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
return CorInfoHelpFunc.CORINFO_HELP_STRCNS_CURRENT_MODULE; | ||||||||||||||||||||||||||||||||
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. Is this right for strings from other modules? Crossgen1 version of this method has a check for current module in this method. 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. I believe that's a fragile ngen scenario. runtime/src/coreclr/jit/morph.cpp Lines 9287 to 9301 in 1390941
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. Does this all work well for large version bubble or composite mode cases? |
||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
private void getFunctionEntryPoint(CORINFO_METHOD_STRUCT_* ftn, ref CORINFO_CONST_LOOKUP pResult, CORINFO_ACCESS_FLAGS accessFlags) | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
throw new RequiresRuntimeJitException(HandleToObject(ftn).ToString()); | ||||||||||||||||||||||||||||||||
|
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 do not think it is as simple as this. There needs to be a code to add the current module argument for the helper (it is what
ZapLazyHelperThunk
does in crossgen1.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.
Ah, I thought the
CORINFO_HELP_STRCNS_CURRENT_MODULE
meant we didn't need that. I'll look into adding that lazy thunk.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 think that ImportThunk already has a Lazy variant that I think was supposed to cater for lazy strings, among others. Having said that, it hasn't been tested until now so there's a high chance of it being broken in some way.
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 Tomas - I corrected things to call the lazy thunk and fixed an x64 bug. I'll kick off a CG2 run to make sure we're okay on other architectures.