-
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
[cDAC] Implement ReJIT portion of SOSDacImpl::GetMethodDescData #109936
Changes from 1 commit
d4de7c9
7ca17de
cb22d7b
2fcd31c
8ba821c
d43256f
60e577e
a76d85b
5aa1415
541066d
b4c7766
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.Diagnostics.DataContractReader.Contracts.Extensions; | ||
|
||
internal static class ICodeVersionsExtensions | ||
{ | ||
internal static NativeCodeVersionHandle GetActiveNativeCodeVersion(this ICodeVersions cv, TargetPointer methodDesc) | ||
{ | ||
ILCodeVersionHandle iLCodeVersionHandle = cv.GetActiveILCodeVersion(methodDesc); | ||
return cv.GetActiveNativeCodeVersionForILCodeVersion(methodDesc, iLCodeVersionHandle); | ||
max-charlamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Diagnostics.DataContractReader.Contracts.Extensions; | ||
|
||
internal static class IReJITExtensions | ||
{ | ||
public static IEnumerable<TargetNUInt> GetRejitIds(this IReJIT rejit, Target target, TargetPointer methodDesc) | ||
{ | ||
ICodeVersions cv = target.Contracts.CodeVersions; | ||
|
||
IEnumerable<ILCodeVersionHandle> ilCodeVersions = cv.GetILCodeVersions(methodDesc); | ||
|
||
foreach (ILCodeVersionHandle ilCodeVersionHandle in ilCodeVersions) | ||
{ | ||
if (rejit.GetRejitState(ilCodeVersionHandle) == RejitState.Active) | ||
{ | ||
yield return rejit.GetRejitId(ilCodeVersionHandle); | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,25 @@ | |
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Diagnostics.DataContractReader.Contracts; | ||
|
||
public enum RejitState | ||
{ | ||
Requested, | ||
Active | ||
} | ||
|
||
internal interface IReJIT : IContract | ||
{ | ||
static string IContract.Name { get; } = nameof(ReJIT); | ||
|
||
bool IsEnabled() => throw new NotImplementedException(); | ||
|
||
RejitState GetRejitState(ILCodeVersionHandle codeVersionHandle) => throw new NotImplementedException(); | ||
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. With the cdac I feel like we should either make an effort to make the data structures and algorithms match the runtime directly or make a conscious effort to have a higher level API that abstracts away some of the details. Putting Curious to know what other people's thoughts are here. 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. As far as I know, we do need contract methods to get this metadata (id/state) as the cDAC is setup to not allow users to access the marshalled data structures directly. Enforcing the use of contract methods allows for versioning independent of runtime changes. Another option would be to put these methods on the When TieredCompilation SOS APIs are implemented, I think we should create an Since I am also curious if other people have suggestions on better ways to implement the ReJIT cDAC functionality. 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 think there might be two levels we are talking about here
I do view the |
||
|
||
TargetNUInt GetRejitId(ILCodeVersionHandle codeVersionHandle) => throw new NotImplementedException(); | ||
} | ||
|
||
internal readonly struct ReJIT : IReJIT | ||
|
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.
Thoughts on removing these details from the
*CodeVersionHandle
in the contract doc? I see them more as opaque handles that get returned from / passed to different contracts, with the module / method definiton / node on them being implementation details that aren't part of the contract.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 agree. I think we should have only the publicly usable parts of the handle. I'll make that change.