Skip to content

Commit d9b7515

Browse files
authored
Make cdac APIs public but experimental (dotnet#111180)
1 parent a9d67ec commit d9b7515

File tree

58 files changed

+191
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+191
-179
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
<Import Project="..\Directory.Build.props" />
3+
<ItemGroup>
4+
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExperimentalAttribute">
5+
<_Parameter1>NETCDAC0001</_Parameter1>
6+
</AssemblyAttribute>
7+
</ItemGroup>
8+
</Project>

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/ContractRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.Diagnostics.DataContractReader;
99
/// <summary>
1010
/// A registry of all the contracts that may be provided by a target.
1111
/// </summary>
12-
internal abstract class ContractRegistry
12+
public abstract class ContractRegistry
1313
{
1414
/// <summary>
1515
/// Gets an instance of the Exception contract for the target.

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/Extensions/ICodeVersionsExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
namespace Microsoft.Diagnostics.DataContractReader.Contracts.Extensions;
55

6-
internal static class ICodeVersionsExtensions
6+
public static class ICodeVersionsExtensions
77
{
8-
internal static NativeCodeVersionHandle GetActiveNativeCodeVersion(this ICodeVersions cv, TargetPointer methodDesc)
8+
public static NativeCodeVersionHandle GetActiveNativeCodeVersion(this ICodeVersions cv, TargetPointer methodDesc)
99
{
1010
ILCodeVersionHandle ilCodeVersionHandle = cv.GetActiveILCodeVersion(methodDesc);
1111
return cv.GetActiveNativeCodeVersionForILCodeVersion(methodDesc, ilCodeVersionHandle);

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/Extensions/IReJITExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Microsoft.Diagnostics.DataContractReader.Contracts.Extensions;
77

8-
internal static class IReJITExtensions
8+
public static class IReJITExtensions
99
{
1010
public static IEnumerable<TargetNUInt> GetRejitIds(this IReJIT rejit, Target target, TargetPointer methodDesc)
1111
{

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ICodeVersions.cs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Microsoft.Diagnostics.DataContractReader.Contracts;
88

9-
internal interface ICodeVersions : IContract
9+
public interface ICodeVersions : IContract
1010
{
1111
static string IContract.Name { get; } = nameof(CodeVersions);
1212

@@ -27,11 +27,12 @@ internal interface ICodeVersions : IContract
2727
public virtual bool CodeVersionManagerSupportsMethod(TargetPointer methodDesc) => throw new NotImplementedException();
2828
}
2929

30-
internal readonly struct ILCodeVersionHandle
30+
public readonly struct ILCodeVersionHandle
3131
{
32-
internal readonly TargetPointer Module;
33-
internal readonly uint MethodDefinition;
34-
internal readonly TargetPointer ILCodeVersionNode;
32+
// TODO-Layering: These members should be accessible only to contract implementations.
33+
public readonly TargetPointer Module;
34+
public readonly uint MethodDefinition;
35+
public readonly TargetPointer ILCodeVersionNode;
3536
private ILCodeVersionHandle(TargetPointer module, uint methodDef, TargetPointer ilCodeVersionNodeAddress)
3637
{
3738
if (module != TargetPointer.Null && ilCodeVersionNodeAddress != TargetPointer.Null)
@@ -49,23 +50,24 @@ private ILCodeVersionHandle(TargetPointer module, uint methodDef, TargetPointer
4950
}
5051

5152
// for more information on Explicit/Synthetic code versions see docs/design/features/code-versioning.md
52-
internal static ILCodeVersionHandle CreateExplicit(TargetPointer ilCodeVersionNodeAddress) =>
53+
public static ILCodeVersionHandle CreateExplicit(TargetPointer ilCodeVersionNodeAddress) =>
5354
new ILCodeVersionHandle(TargetPointer.Null, 0, ilCodeVersionNodeAddress);
54-
internal static ILCodeVersionHandle CreateSynthetic(TargetPointer module, uint methodDef) =>
55+
public static ILCodeVersionHandle CreateSynthetic(TargetPointer module, uint methodDef) =>
5556
new ILCodeVersionHandle(module, methodDef, TargetPointer.Null);
5657

5758
public static ILCodeVersionHandle Invalid { get; } = new(TargetPointer.Null, 0, TargetPointer.Null);
5859

5960
public bool IsValid => Module != TargetPointer.Null || ILCodeVersionNode != TargetPointer.Null;
6061

61-
internal bool IsExplicit => ILCodeVersionNode != TargetPointer.Null;
62+
public bool IsExplicit => ILCodeVersionNode != TargetPointer.Null;
6263
}
6364

64-
internal readonly struct NativeCodeVersionHandle
65+
public readonly struct NativeCodeVersionHandle
6566
{
6667
// no public constructors
67-
internal readonly TargetPointer MethodDescAddress;
68-
internal readonly TargetPointer CodeVersionNodeAddress;
68+
// TODO-Layering: These members should be accessible only to contract implementations.
69+
public readonly TargetPointer MethodDescAddress;
70+
public readonly TargetPointer CodeVersionNodeAddress;
6971
private NativeCodeVersionHandle(TargetPointer methodDescAddress, TargetPointer codeVersionNodeAddress)
7072
{
7173
if (methodDescAddress != TargetPointer.Null && codeVersionNodeAddress != TargetPointer.Null)
@@ -77,19 +79,19 @@ private NativeCodeVersionHandle(TargetPointer methodDescAddress, TargetPointer c
7779
}
7880

7981
// for more information on Explicit/Synthetic code versions see docs/design/features/code-versioning.md
80-
internal static NativeCodeVersionHandle CreateExplicit(TargetPointer codeVersionNodeAddress) =>
82+
public static NativeCodeVersionHandle CreateExplicit(TargetPointer codeVersionNodeAddress) =>
8183
new NativeCodeVersionHandle(TargetPointer.Null, codeVersionNodeAddress);
82-
internal static NativeCodeVersionHandle CreateSynthetic(TargetPointer methodDescAddress) =>
84+
public static NativeCodeVersionHandle CreateSynthetic(TargetPointer methodDescAddress) =>
8385
new NativeCodeVersionHandle(methodDescAddress, TargetPointer.Null);
8486

8587
public static NativeCodeVersionHandle Invalid { get; } = new(TargetPointer.Null, TargetPointer.Null);
8688

8789
public bool Valid => MethodDescAddress != TargetPointer.Null || CodeVersionNodeAddress != TargetPointer.Null;
8890

89-
internal bool IsExplicit => CodeVersionNodeAddress != TargetPointer.Null;
91+
public bool IsExplicit => CodeVersionNodeAddress != TargetPointer.Null;
9092
}
9193

92-
internal readonly struct CodeVersions : ICodeVersions
94+
public readonly struct CodeVersions : ICodeVersions
9395
{
9496
// throws NotImplementedException for all methods
9597
}

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IContract.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Microsoft.Diagnostics.DataContractReader.Contracts;
77

8-
internal interface IContract
8+
public interface IContract
99
{
1010
static virtual string Name => throw new NotImplementedException();
1111
}

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IDacStreams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
namespace Microsoft.Diagnostics.DataContractReader.Contracts;
77

8-
internal interface IDacStreams : IContract
8+
public interface IDacStreams : IContract
99
{
1010
static string IContract.Name { get; } = nameof(DacStreams);
1111
public virtual string? StringFromEEAddress(TargetPointer address) => throw new NotImplementedException();
1212
}
1313

14-
internal readonly struct DacStreams : IDacStreams
14+
public readonly struct DacStreams : IDacStreams
1515
{
1616
// Everything throws NotImplementedException
1717
}

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IEcmaMetadata.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
namespace Microsoft.Diagnostics.DataContractReader.Contracts;
88

9-
internal interface IEcmaMetadata : IContract
9+
public interface IEcmaMetadata : IContract
1010
{
1111
static string IContract.Name { get; } = nameof(EcmaMetadata);
1212
public virtual TargetSpan GetReadOnlyMetadataAddress(ModuleHandle handle) => throw new NotImplementedException();
1313
public virtual MetadataReader? GetMetadata(ModuleHandle module) => throw new NotImplementedException();
1414
}
1515

16-
internal readonly struct EcmaMetadata : IEcmaMetadata
16+
public readonly struct EcmaMetadata : IEcmaMetadata
1717
{
1818
// Everything throws NotImplementedException
1919
}

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Microsoft.Diagnostics.DataContractReader.Contracts;
77

8-
internal record struct ExceptionData(
8+
public record struct ExceptionData(
99
TargetPointer Message,
1010
TargetPointer InnerException,
1111
TargetPointer StackTrace,
@@ -15,15 +15,15 @@ internal record struct ExceptionData(
1515
int HResult,
1616
int XCode);
1717

18-
internal interface IException : IContract
18+
public interface IException : IContract
1919
{
2020
static string IContract.Name { get; } = nameof(Exception);
2121

2222
public virtual TargetPointer GetNestedExceptionInfo(TargetPointer exception, out TargetPointer nextNestedException) => throw new NotImplementedException();
2323
public virtual ExceptionData GetExceptionData(TargetPointer managedException) => throw new NotImplementedException();
2424
}
2525

26-
internal readonly struct Exception : IException
26+
public readonly struct Exception : IException
2727
{
2828
// Everything throws NotImplementedException
2929
}

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IExecutionManager.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55

66
namespace Microsoft.Diagnostics.DataContractReader.Contracts;
77

8-
internal struct CodeBlockHandle
8+
public struct CodeBlockHandle
99
{
10+
// TODO-Layering: These members should be accessible only to contract implementations.
1011
public readonly TargetPointer Address;
11-
internal CodeBlockHandle(TargetPointer address) => Address = address;
12+
public CodeBlockHandle(TargetPointer address) => Address = address;
1213
}
1314

14-
internal interface IExecutionManager : IContract
15+
public interface IExecutionManager : IContract
1516
{
1617
static string IContract.Name { get; } = nameof(ExecutionManager);
1718
CodeBlockHandle? GetCodeBlockHandle(TargetCodePointer ip) => throw new NotImplementedException();
1819
TargetPointer GetMethodDesc(CodeBlockHandle codeInfoHandle) => throw new NotImplementedException();
1920
TargetCodePointer GetStartAddress(CodeBlockHandle codeInfoHandle) => throw new NotImplementedException();
2021
}
2122

22-
internal readonly struct ExecutionManager : IExecutionManager
23+
public readonly struct ExecutionManager : IExecutionManager
2324
{
2425

2526
}

0 commit comments

Comments
 (0)