Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/coreclr/vm/codeversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ struct cdac_data<NativeCodeVersionNode>
#ifdef HAVE_GCCOVER
static constexpr size_t GCCoverageInfo = offsetof(NativeCodeVersionNode, m_gcCover);
#endif // HAVE_GCCOVER
#ifdef FEATURE_TIERED_COMPILATION
static constexpr size_t OptimizationTier = offsetof(NativeCodeVersionNode, m_optTier);
#endif // FEATURE_TIERED_COMPILATION
};

class NativeCodeVersionCollection
Expand Down
13 changes: 13 additions & 0 deletions src/coreclr/vm/datadescriptor/datadescriptor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ CDAC_TYPE_INDETERMINATE(MethodDescCodeData)
CDAC_TYPE_FIELD(MethodDescCodeData, /*CodePointer*/, TemporaryEntryPoint, offsetof(MethodDescCodeData,TemporaryEntryPoint))
#ifdef FEATURE_CODE_VERSIONING
CDAC_TYPE_FIELD(MethodDescCodeData, /*pointer*/, VersioningState, offsetof(MethodDescCodeData,VersioningState))
CDAC_TYPE_FIELD(MethodDescCodeData, /*uint32*/, OptimizationTier, offsetof(MethodDescCodeData,OptimizationTier))
#endif // FEATURE_CODE_VERSIONING
CDAC_TYPE_END(MethodDescCodeData)

Expand Down Expand Up @@ -845,6 +846,9 @@ CDAC_TYPE_FIELD(NativeCodeVersionNode, /*nuint*/, ILVersionId, cdac_data<NativeC
#ifdef HAVE_GCCOVER
CDAC_TYPE_FIELD(NativeCodeVersionNode, /*pointer*/, GCCoverageInfo, cdac_data<NativeCodeVersionNode>::GCCoverageInfo)
#endif // HAVE_GCCOVER
#ifdef FEATURE_TIERED_COMPILATION
CDAC_TYPE_FIELD(NativeCodeVersionNode, /*uint32*/, OptimizationTier, cdac_data<NativeCodeVersionNode>::OptimizationTier)
#endif // FEATURE_TIERED_COMPILATION
CDAC_TYPE_END(NativeCodeVersionNode)

CDAC_TYPE_BEGIN(ILCodeVersionNode)
Expand Down Expand Up @@ -1240,6 +1244,13 @@ CDAC_TYPE_FIELD(WebcilSectionHeader, /*uint32*/, PointerToRawData, offsetof(Webc
CDAC_TYPE_END(WebcilSectionHeader)
#endif

CDAC_TYPE_BEGIN(EEConfig)
CDAC_TYPE_INDETERMINATE(EEConfig)
CDAC_TYPE_FIELD(EEConfig, /*uint8*/, JitMinOpts, cdac_data<EEConfig>::JitMinOpts)
CDAC_TYPE_FIELD(EEConfig, /*uint8*/, GenDebuggable, cdac_data<EEConfig>::GenDebuggable)
CDAC_TYPE_FIELD(EEConfig, /*uint32*/, TieredCompilation_DefaultTier, cdac_data<EEConfig>::TieredCompilation_DefaultTier)
CDAC_TYPE_END(EEConfig)

CDAC_TYPES_END()

CDAC_GLOBALS_BEGIN()
Expand Down Expand Up @@ -1285,6 +1296,7 @@ CDAC_GLOBAL_STRING(RID, RID_STRING)

CDAC_GLOBAL(GCInfoVersion, uint32, GCINFO_VERSION)

CDAC_GLOBAL_POINTER(EEConfig, &::g_pConfig)
CDAC_GLOBAL_POINTER(AppDomain, &AppDomain::m_pTheAppDomain)
CDAC_GLOBAL_POINTER(SystemDomain, cdac_data<SystemDomain>::SystemDomainPtr)
CDAC_GLOBAL_POINTER(ThreadStore, &ThreadStore::s_pThreadStore)
Expand All @@ -1299,6 +1311,7 @@ CDAC_GLOBAL_POINTER(GCThread, &::g_pSuspensionThread)
#undef FRAME_TYPE_NAME

CDAC_GLOBAL(MethodDescTokenRemainderBitCount, uint8, METHOD_TOKEN_REMAINDER_BIT_COUNT)
CDAC_GLOBAL_POINTER(CORDebuggerControlFlags, &g_CORDebuggerControlFlags)
#if FEATURE_COMINTEROP
CDAC_GLOBAL(FeatureCOMInterop, uint8, 1)
#else
Expand Down
12 changes: 11 additions & 1 deletion src/coreclr/vm/eeconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class EEConfig
bool TieredCompilation_UseCallCountingStubs() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_UseCallCountingStubs; }
DWORD TieredCompilation_DeleteCallCountingStubsAfter() const { LIMITED_METHOD_CONTRACT; return tieredCompilation_DeleteCallCountingStubsAfter; }
#endif // FEATURE_TIERED_COMPILATION
DWORD TieredCompilation_DefaultTier() const
DWORD TieredCompilation_DefaultTier() const
{
LIMITED_METHOD_CONTRACT;
return tieredCompilation_DefaultTier;
Expand Down Expand Up @@ -713,6 +713,16 @@ class EEConfig
public:
DWORD GetSleepOnExit()
{ return dwSleepOnExit; }

friend struct ::cdac_data<EEConfig>;
};

template<>
struct cdac_data<EEConfig>
{
static constexpr size_t JitMinOpts = offsetof(EEConfig, fJitMinOpts);
static constexpr size_t GenDebuggable = offsetof(EEConfig, fDebuggable);
static constexpr size_t TieredCompilation_DefaultTier = offsetof(EEConfig, tieredCompilation_DefaultTier);
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public interface ICodeVersions : IContract

public virtual TargetPointer GetIL(ILCodeVersionHandle ilCodeVersionHandle) => throw new NotImplementedException();
public virtual bool HasDefaultIL(ILCodeVersionHandle ilCodeVersionHandle) => throw new NotImplementedException();
public virtual NativeCodeVersionOptimizationTier GetOptimizationTier(NativeCodeVersionHandle codeVersionHandle)
=> throw new NotImplementedException();
}

public readonly struct ILCodeVersionHandle
Expand Down Expand Up @@ -100,3 +102,14 @@ public static NativeCodeVersionHandle CreateSynthetic(TargetPointer methodDescAd
{
// throws NotImplementedException for all methods
}

public enum NativeCodeVersionOptimizationTier : uint
{
OptimizationTier0,
OptimizationTier1,
OptimizationTier1OSR,
OptimizationTierOptimized,
OptimizationTier0Instrumented,
OptimizationTier1Instrumented,
OptimizationTierUnknown = 0xFFFFFFFF
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ public enum ModuleFlags
Tenured = 0x1, // Set once we know for sure the Module will not be freed until the appdomain itself exits
EditAndContinue = 0x8, // Edit and Continue is enabled for this module
ReflectionEmit = 0x40, // Reflection.Emit was used to create this module
ProfilerDisableOpt = 0x80, // Profiler disabled JIT optimizations when module was loaded
Copy link
Contributor

@rcj1 rcj1 Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with the enum. Since these are not included in the data descriptor we have to ensure that anyone who decides to change these also changes the cDAC contract

}

[Flags]
public enum DebuggerAssemblyControlFlags
{
DACF_USER_OVERRIDE = 0x01,
DACF_ALLOW_JIT_OPTS = 0x02,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding these flags that mirror enums, please add comments in the native enum of the format [cDAC] [insert whichever contract depends on it] : cDAC depends on this value. See

Slot_Basic = 0, // [cDAC] [BuiltInCOM]: Contract depends on this value

}

[Flags]
Expand Down Expand Up @@ -75,6 +83,8 @@ public interface ILoader : IContract

bool IsProbeExtensionResultValid(ModuleHandle handle) => throw new NotImplementedException();
ModuleFlags GetFlags(ModuleHandle handle) => throw new NotImplementedException();
bool IsReadyToRun(ModuleHandle handle) => throw new NotImplementedException();
DebuggerAssemblyControlFlags GetDebuggerInfoBits(ModuleHandle handle) => throw new NotImplementedException();
bool TryGetSimpleName(ModuleHandle handle, out string simpleName) => throw new NotImplementedException();
string GetPath(ModuleHandle handle) => throw new NotImplementedException();
string GetFileName(ModuleHandle handle) => throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public enum ArrayFunctionType
Constructor = 3
}

[Flags]
public enum DebuggerControlFlag
{
DBCF_ALLOW_JIT_OPT = 0x0008,
}

public interface IRuntimeTypeSystem : IContract
{
static string IContract.Name => nameof(RuntimeTypeSystem);
Expand Down Expand Up @@ -207,6 +213,11 @@ public interface IRuntimeTypeSystem : IContract
TargetPointer GetAddressOfNativeCodeSlot(MethodDescHandle methodDesc) => throw new NotImplementedException();

TargetPointer GetGCStressCodeCopy(MethodDescHandle methodDesc) => throw new NotImplementedException();

NativeCodeVersionOptimizationTier GetMethodDescOptimizationTier(MethodDescHandle methodDescHandle) => throw new NotImplementedException();
NativeCodeVersionOptimizationTier GetInitialOptimizationTier(MethodDescHandle methodDescHandle) => throw new NotImplementedException();
bool IsEligibleForTieredCompilation(MethodDescHandle methodDescHandle) => throw new NotImplementedException();
bool IsJitOptimizationDisabled(MethodDescHandle methodDescHandle) => throw new NotImplementedException();
#endregion MethodDesc inspection APIs
#region FieldDesc inspection APIs
TargetPointer GetMTOfEnclosingClass(TargetPointer fieldDescPointer) => throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public enum DataType
PatchpointInfo,
PortableEntryPoint,
VirtualCallStubManager,
EEConfig,

TransitionBlock,
DebuggerEval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public static class Globals
public const string SizeOfGenericModeBlock = nameof(SizeOfGenericModeBlock);

public const string MethodDescTokenRemainderBitCount = nameof(MethodDescTokenRemainderBitCount);
public const string CORDebuggerControlFlags = nameof(CORDebuggerControlFlags);
public const string DirectorySeparator = nameof(DirectorySeparator);

public const string ExecutionManagerCodeRangeMapAddress = nameof(ExecutionManagerCodeRangeMapAddress);
Expand Down Expand Up @@ -154,6 +155,7 @@ public static class Globals
public const string HandlesPerBlock = nameof(HandlesPerBlock);
public const string BlockInvalid = nameof(BlockInvalid);
public const string TotalCpuCount = nameof(TotalCpuCount);
public const string EEConfig = nameof(EEConfig);
}
public static class FieldNames
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,4 +413,31 @@ bool ICodeVersions.HasDefaultIL(ILCodeVersionHandle iLCodeVersionHandle)
{
return iLCodeVersionHandle.IsExplicit ? AsNode(iLCodeVersionHandle).ILAddress == TargetPointer.Null : true;
}

NativeCodeVersionOptimizationTier ICodeVersions.GetOptimizationTier(NativeCodeVersionHandle codeVersionHandle)
{
if (!codeVersionHandle.Valid)
{
throw new ArgumentException("Invalid NativeCodeVersionHandle");
}

if (codeVersionHandle.IsExplicit)
{
NativeCodeVersionNode nativeCodeVersionNode = _target.ProcessedData.GetOrAdd<NativeCodeVersionNode>(codeVersionHandle.CodeVersionNodeAddress);
return nativeCodeVersionNode.OptimizationTier is null
? NativeCodeVersionOptimizationTier.OptimizationTierUnknown
: (NativeCodeVersionOptimizationTier) nativeCodeVersionNode.OptimizationTier;
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit-handle branch is casting a nullable uint (OptimizationTier is uint?) directly to NativeCodeVersionOptimizationTier. This won’t compile; use the nullable’s Value (after the null check) when performing the cast.

Suggested change
: (NativeCodeVersionOptimizationTier) nativeCodeVersionNode.OptimizationTier;
: (NativeCodeVersionOptimizationTier) nativeCodeVersionNode.OptimizationTier.Value;

Copilot uses AI. Check for mistakes.
}
else
{
IRuntimeTypeSystem rtsContract = _target.Contracts.RuntimeTypeSystem;
MethodDescHandle methodDescHandle = rtsContract.GetMethodDescHandle(codeVersionHandle.MethodDescAddress);
NativeCodeVersionOptimizationTier optimizationTier = rtsContract.GetMethodDescOptimizationTier(methodDescHandle);
if (optimizationTier == NativeCodeVersionOptimizationTier.OptimizationTierUnknown)
{
return rtsContract.GetInitialOptimizationTier(methodDescHandle);
}
return optimizationTier;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ namespace Microsoft.Diagnostics.DataContractReader.Contracts;
{
private const string DefaultDomainFriendlyName = "DefaultDomain";
private const uint ASSEMBLY_NOTIFYFLAGS_PROFILER_NOTIFIED = 0x1; // Assembly Notify Flag for profiler notification
private const uint DEBUGGER_INFO_MASK_PRIV = 0x0000FC00;
private const int DEBUGGER_INFO_SHIFT_PRIV = 10;
private const ushort MaxWebcilSections = 16; // Must stay in sync with native WEBCIL_MAX_SECTIONS.

private enum ModuleFlags_1 : uint
{
Tenured = 0x1, // Set once we know for sure the Module will not be freed until the appdomain itself exits
EditAndContinue = 0x8, // Edit and Continue is enabled for this module
ReflectionEmit = 0x40, // Reflection.Emit was used to create this module
ProfilerDisableOpt = 0x80, // Profiler disabled JIT optimizations when module was loaded
}

private enum PEImageFlags : uint
Expand Down Expand Up @@ -366,6 +369,8 @@ private static ModuleFlags GetFlags(Data.Module module)
flags |= ModuleFlags.EditAndContinue;
if (runtimeFlags.HasFlag(ModuleFlags_1.ReflectionEmit))
flags |= ModuleFlags.ReflectionEmit;
if (runtimeFlags.HasFlag(ModuleFlags_1.ProfilerDisableOpt))
flags |= ModuleFlags.ProfilerDisableOpt;

return flags;
}
Expand All @@ -376,6 +381,18 @@ ModuleFlags ILoader.GetFlags(ModuleHandle handle)
return GetFlags(module);
}

bool ILoader.IsReadyToRun(ModuleHandle handle)
{
Data.Module module = _target.ProcessedData.GetOrAdd<Data.Module>(handle.Address);
return module.ReadyToRunInfo != TargetPointer.Null;
}

DebuggerAssemblyControlFlags ILoader.GetDebuggerInfoBits(ModuleHandle handle)
{
Data.Module module = _target.ProcessedData.GetOrAdd<Data.Module>(handle.Address);
return (DebuggerAssemblyControlFlags)((module.Flags & DEBUGGER_INFO_MASK_PRIV) >> DEBUGGER_INFO_SHIFT_PRIV);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be in an enum

}

bool ILoader.TryGetSimpleName(ModuleHandle handle, out string simpleName)
{
simpleName = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,86 @@ TargetPointer IRuntimeTypeSystem.GetGCStressCodeCopy(MethodDescHandle methodDesc
return TargetPointer.Null;
}

NativeCodeVersionOptimizationTier IRuntimeTypeSystem.GetMethodDescOptimizationTier(MethodDescHandle methodDescHandle)
Comment on lines 1645 to +1648
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In GetMethodDescOptimizationTier just above this block, the code returns (NativeCodeVersionOptimizationTier)codeData.OptimizationTier, but OptimizationTier is a uint? on MethodDescCodeData. Casting a nullable numeric directly to a non-nullable enum won’t compile; cast codeData.OptimizationTier.Value after the null check.

Copilot uses AI. Check for mistakes.
{
MethodDesc methodDesc = _methodDescs[methodDescHandle.Address];
TargetPointer codeDataAddress = methodDesc.CodeData;
if (codeDataAddress == TargetPointer.Null)
return NativeCodeVersionOptimizationTier.OptimizationTierUnknown;

Data.MethodDescCodeData codeData = _target.ProcessedData.GetOrAdd<Data.MethodDescCodeData>(codeDataAddress);
return codeData.OptimizationTier is null
? NativeCodeVersionOptimizationTier.OptimizationTierUnknown
: (NativeCodeVersionOptimizationTier)codeData.OptimizationTier;
}

bool IRuntimeTypeSystem.IsEligibleForTieredCompilation(MethodDescHandle methodDescHandle)
{
MethodDesc methodDesc = _methodDescs[methodDescHandle.Address];
return methodDesc.IsEligibleForTieredCompilation;
}

private bool IsJitOptimizationDisabledForSpecificMethod(MethodDescHandle methodDescHandle)
{
MethodDesc methodDesc = _methodDescs[methodDescHandle.Address];
MethodTable methodTable = GetOrCreateMethodTable(methodDesc);
Comment on lines +1654 to +1670
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsJitOptimizationDisabledForSpecificMethod throws when metadata isn’t available (mdReader is null) for non-dynamic methods. In dumps/minidumps this can happen and would cause GetTieredVersions to fail; native behavior treats missing metadata as ‘no NoOptimization flag’ rather than throwing. Consider returning false (or otherwise falling back) instead of throwing here.

Copilot uses AI. Check for mistakes.
ModuleHandle moduleHandle = _target.Contracts.Loader.GetModuleHandleFromModulePtr(methodTable.Module);
MetadataReader? mdReader = _target.Contracts.EcmaMetadata.GetMetadata(moduleHandle);

bool isNoMetadata = methodDesc.Classification == MethodClassification.Dynamic;
bool isMiNoOptimization = false;
if (mdReader is not null)
{
MethodDefinitionHandle methodDefHandle = MetadataTokens.MethodDefinitionHandle((int)methodDesc.Token);
MethodDefinition methodDef = mdReader.GetMethodDefinition(methodDefHandle);
MethodImplAttributes implAttrs = methodDef.ImplAttributes;
isMiNoOptimization = (implAttrs & MethodImplAttributes.NoOptimization) != 0;
}
else if (!isNoMetadata)
Comment on lines +1679 to +1683
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These reads assume the new globals (CORDebuggerControlFlags / EEConfig) are always present in the target’s contract metadata. ReadGlobalPointer throws if the global isn’t available, which would break tier classification on older runtimes/dumps. Consider using TryReadGlobalPointer (and a safe default) so IsJitOptimizationDisabled can degrade gracefully when the globals aren’t exposed.

Copilot uses AI. Check for mistakes.
{
throw new InvalidOperationException("Failed to get metadata for method");
}

return !isNoMetadata && isMiNoOptimization;
}

private bool IsJitOptimizationDisabledForAllMethodsInChunk(MethodDescHandle methodDescHandle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to call this IsJitOptimizationDisabledForModule and maybe have a dedicated bit on Module for this so that cDAC does not need to reimplement the runtime policy to compute the value from various inputs.

{
MethodDesc methodDesc = _methodDescs[methodDescHandle.Address];
MethodTable methodTable = GetOrCreateMethodTable(methodDesc);
ModuleHandle moduleHandle = _target.Contracts.Loader.GetModuleHandleFromModulePtr(methodTable.Module);
DebuggerAssemblyControlFlags debuggerInfoBits = _target.Contracts.Loader.GetDebuggerInfoBits(moduleHandle);
DebuggerControlFlag corDebuggerControlFlags = (DebuggerControlFlag)_target.Read<uint>(_target.ReadGlobalPointer(Constants.Globals.CORDebuggerControlFlags));
TargetPointer eeConfigPtr = _target.ReadPointer(_target.ReadGlobalPointer(Constants.Globals.EEConfig));
Data.EEConfig eeConfig = _target.ProcessedData.GetOrAdd<Data.EEConfig>(eeConfigPtr);

bool corDebuggerAllowJITOpts = debuggerInfoBits.HasFlag(DebuggerAssemblyControlFlags.DACF_ALLOW_JIT_OPTS)
|| (corDebuggerControlFlags.HasFlag(DebuggerControlFlag.DBCF_ALLOW_JIT_OPT)
&& !debuggerInfoBits.HasFlag(DebuggerAssemblyControlFlags.DACF_USER_OVERRIDE));
bool profilerDisabledOptimizations = _target.Contracts.Loader.GetFlags(moduleHandle).HasFlag(ModuleFlags.ProfilerDisableOpt);
bool areJITOptimizationsDisabled = !corDebuggerAllowJITOpts || profilerDisabledOptimizations;

return eeConfig.JitMinOpts || eeConfig.GenDebuggable || areJITOptimizationsDisabled;
}

bool IRuntimeTypeSystem.IsJitOptimizationDisabled(MethodDescHandle methodDescHandle)
Comment on lines +1699 to +1710
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetInitialOptimizationTier also unconditionally reads the EEConfig global via ReadGlobalPointer/ReadPointer. If the EEConfig global isn’t present in a target’s contract metadata (older runtime/dump), this will throw and bubble up through GetOptimizationTier/GetTieredVersions. Consider TryReadGlobalPointer + fallback (e.g., Optimized or Unknown) to keep the API usable across contract versions.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not care about these things.

{
return IsJitOptimizationDisabledForAllMethodsInChunk(methodDescHandle) || IsJitOptimizationDisabledForSpecificMethod(methodDescHandle);
}

NativeCodeVersionOptimizationTier IRuntimeTypeSystem.GetInitialOptimizationTier(MethodDescHandle methodDescHandle)
{
MethodDesc methodDesc = _methodDescs[methodDescHandle.Address];
if (!methodDesc.IsEligibleForTieredCompilation)
{
return NativeCodeVersionOptimizationTier.OptimizationTierOptimized;
}

TargetPointer eeConfigPtr = _target.ReadPointer(_target.ReadGlobalPointer(Constants.Globals.EEConfig));
Data.EEConfig eeConfig = _target.ProcessedData.GetOrAdd<Data.EEConfig>(eeConfigPtr);
return (NativeCodeVersionOptimizationTier)eeConfig.TieredCompilation_DefaultTier;
}

private sealed class NonValidatedMethodTableQueries : MethodValidation.IMethodTableQueries
{
private readonly RuntimeTypeSystem_1 _rts;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.Data;

internal sealed class EEConfig : IData<EEConfig>
{
static EEConfig IData<EEConfig>.Create(Target target, TargetPointer address)
=> new EEConfig(target, address);

public EEConfig(Target target, TargetPointer address)
{
Target.TypeInfo type = target.GetTypeInfo(DataType.EEConfig);

JitMinOpts = target.Read<byte>(address + (ulong)type.Fields[nameof(JitMinOpts)].Offset) != 0;
GenDebuggable = target.Read<byte>(address + (ulong)type.Fields[nameof(GenDebuggable)].Offset) != 0;
TieredCompilation_DefaultTier = target.Read<uint>(address + (ulong)type.Fields[nameof(TieredCompilation_DefaultTier)].Offset);
}

public bool JitMinOpts { get; init; }
public bool GenDebuggable { get; init; }
public uint TieredCompilation_DefaultTier { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ public MethodDescCodeData(Target target, TargetPointer address)

TemporaryEntryPoint = target.ReadCodePointer(address + (ulong)type.Fields[nameof(TemporaryEntryPoint)].Offset);
VersioningState = target.ReadPointer(address + (ulong)type.Fields[nameof(VersioningState)].Offset);
if (type.Fields.ContainsKey(nameof(OptimizationTier)))
{
OptimizationTier = target.Read<uint>(address + (ulong)type.Fields[nameof(OptimizationTier)].Offset);
}
}

public TargetCodePointer TemporaryEntryPoint { get; set; }
public TargetPointer VersioningState { get; set; }
public uint? OptimizationTier { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public NativeCodeVersionNode(Target target, TargetPointer address)
{
GCCoverageInfo = target.ReadPointer(address + (ulong)type.Fields[nameof(GCCoverageInfo)].Offset);
}
if (type.Fields.ContainsKey(nameof(OptimizationTier)))
{
OptimizationTier = target.Read<uint>(address + (ulong)type.Fields[nameof(OptimizationTier)].Offset);
}
}

public TargetPointer Next { get; init; }
Expand All @@ -31,4 +35,5 @@ public NativeCodeVersionNode(Target target, TargetPointer address)
public TargetNUInt ILVersionId { get; init; }

public TargetPointer? GCCoverageInfo { get; init; }
public uint? OptimizationTier { get; init; }
}
Loading