-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Put HasNativeCodeReJITAware into GetFunctionAddress #90049
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
Changes from all commits
0872883
3fe7c02
8a9d0b1
49697d0
d69d33d
86e84bd
aaa2f7b
31529d5
e4d8bfe
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 |
|---|---|---|
|
|
@@ -913,7 +913,6 @@ PCODE MethodDesc::GetNativeCode() | |
| WRAPPER_NO_CONTRACT; | ||
| SUPPORTS_DAC; | ||
| _ASSERTE(!IsDefaultInterfaceMethod() || HasNativeCodeSlot()); | ||
|
|
||
| if (HasNativeCodeSlot()) | ||
| { | ||
| // When profiler is enabled, profiler may ask to rejit a code even though we | ||
|
|
@@ -935,7 +934,7 @@ PCODE MethodDesc::GetNativeCode() | |
| return GetStableEntryPoint(); | ||
| } | ||
|
|
||
| PCODE MethodDesc::GetNativeCodeReJITAware() | ||
| PCODE MethodDesc::GetNativeCodeAnyVersion() | ||
| { | ||
| WRAPPER_NO_CONTRACT; | ||
| SUPPORTS_DAC; | ||
|
|
@@ -946,19 +945,23 @@ PCODE MethodDesc::GetNativeCodeReJITAware() | |
| return pDefaultCode; | ||
| } | ||
|
|
||
| else | ||
| { | ||
| CodeVersionManager *pCodeVersionManager = GetCodeVersionManager(); | ||
| CodeVersionManager::LockHolder codeVersioningLockHolder; | ||
| ILCodeVersion ilVersion = pCodeVersionManager->GetActiveILCodeVersion(PTR_MethodDesc(this)); | ||
| if (!ilVersion.IsDefaultVersion()) | ||
| ILCodeVersionCollection ilVersionCollection = pCodeVersionManager->GetILCodeVersions(PTR_MethodDesc(this)); | ||
|
Member
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. Before you were getting the current IL version's address. Is there any guarantee of what order you get this in? Does it return in order of IL version and descend until a native body is found? For things like deoptimization, is that what we want?
Member
Author
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. There is no guarantee of order, however, the work has been done to look through everything that calls this code, and make adjustments to allow this behavior to be safe. GetNativeCodeAnyVersion is only used in HasNativeCodeAnyVersion, which is used in EnumMethodInstances::Next and CdStart. It is only used to see whether or not there is a native code body. The reason it was changed is with the addition of deoptimization, there is a possibility that the user asks the code to be deoptimized before it has a default and active version (before the method is jitted). Thus, the code could have a native code version even though it did not have an active nor default native code version. @davmason @noahfalk |
||
| for (ILCodeVersionIterator curIL = ilVersionCollection.Begin(), endIL = ilVersionCollection.End(); curIL != endIL; curIL++) | ||
| { | ||
| NativeCodeVersion activeNativeCodeVersion = ilVersion.GetActiveNativeCodeVersion(PTR_MethodDesc(this)); | ||
| if (!activeNativeCodeVersion.IsNull()) | ||
| NativeCodeVersionCollection nativeCollection = curIL->GetNativeCodeVersions(PTR_MethodDesc(this)); | ||
| for (NativeCodeVersionIterator curNative = nativeCollection.Begin(), endNative = nativeCollection.End(); curNative != endNative; curNative++) | ||
| { | ||
| return activeNativeCodeVersion.GetNativeCode(); | ||
| PCODE native = curNative->GetNativeCode(); | ||
| if(native != NULL) | ||
| { | ||
| return native; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return NULL; | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.