diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 16b159d6e..84d7dbfa0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0.x + dotnet-version: 10.0.x - name: Restore bXES dependencies run: dotnet restore All.sln - name: Build bXES @@ -43,7 +43,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 9.0.x + 10.0.x 8.0.x 6.0.x - name: Build and unit test Procfiler diff --git a/Directory.Packages.props b/Directory.Packages.props index 84bb16acc..fa41122e0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ - + @@ -25,16 +25,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/Ficus/docker/run/Run.FicusDashboard.Dockerfile b/Ficus/docker/run/Run.FicusDashboard.Dockerfile index 2e9c18d7d..d364053b4 100644 --- a/Ficus/docker/run/Run.FicusDashboard.Dockerfile +++ b/Ficus/docker/run/Run.FicusDashboard.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release ARG PROJECT_NAME=FicusDashboard diff --git a/Ficus/docker/run/Run.FicusDashboardBackend.Dockerfile b/Ficus/docker/run/Run.FicusDashboardBackend.Dockerfile index 6048f102c..496d9507b 100644 --- a/Ficus/docker/run/Run.FicusDashboardBackend.Dockerfile +++ b/Ficus/docker/run/Run.FicusDashboardBackend.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release ARG PROJECT_NAME=FicusDashboardBackend @@ -10,9 +10,9 @@ COPY Directory.Packages.props ./Directory.Packages.props RUN dotnet restore ./Ficus/src/front/FicusFrontend/$PROJECT_NAME/$PROJECT_NAME.csproj WORKDIR /app/Ficus/src/front/FicusFrontend/$PROJECT_NAME -RUN dotnet build $PROJECT_NAME.csproj -c $BUILD_CONFIGURATION -o /app/build +RUN dotnet build $PROJECT_NAME.csproj -c $BUILD_CONFIGURATION -o /app/build -v d -FROM mcr.microsoft.com/dotnet/aspnet:9.0 +FROM mcr.microsoft.com/dotnet/aspnet:10.0 ARG PROJECT_NAME=FicusDashboardBackend EXPOSE 8080 diff --git a/Ficus/docker/tests/Tests.KafkaIntegrationTests.Dockerfile b/Ficus/docker/tests/Tests.KafkaIntegrationTests.Dockerfile index 2b758f2d8..29602a77e 100644 --- a/Ficus/docker/tests/Tests.KafkaIntegrationTests.Dockerfile +++ b/Ficus/docker/tests/Tests.KafkaIntegrationTests.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env RUN apt update -y && apt upgrade -y RUN apt install nodejs -y @@ -10,7 +10,7 @@ COPY ./bxes ./bxes COPY ./FicusBxes.sln ./FicusBxes.sln COPY Directory.Packages.props ./Directory.Packages.props -RUN dotnet build . -c Release +RUN dotnet build . -c Release -v d FROM build-env as test ENTRYPOINT [ "dotnet", "test", "/app/Ficus/test/IntegrationTests/IntegrationTests/IntegrationTests.csproj", "-c", "Release" ] \ No newline at end of file diff --git a/Ficus/protos/pipelines_and_context.proto b/Ficus/protos/pipelines_and_context.proto index 52061824d..253ba5867 100644 --- a/Ficus/protos/pipelines_and_context.proto +++ b/Ficus/protos/pipelines_and_context.proto @@ -45,9 +45,36 @@ message GrpcContextValue { GrpcUintArray uint_array = 24; string json = 25; GrpcSimpleEventLog event_log = 26; + GrpcOcelModelAnnotation ocel_annotation = 27; } } +message GrpcOcelModelAnnotation { + repeated GrpcModelElementOcelAnnotation annotations = 1; +} + +message GrpcModelElementOcelAnnotation { + uint64 element_id = 1; + optional GrpcOcelState initial_state = 2; + GrpcOcelState final_state = 3; + repeated GrpcOcelStateObjectRelation relations = 4; +} + +message GrpcOcelStateObjectRelation { + string object_id = 1; + uint64 element_id = 2; + repeated string related_objects_ids = 3; +} + +message GrpcOcelState { + repeated GrpcOcelObjectTypeState type_states = 1; +} + +message GrpcOcelObjectTypeState { + string type = 1; + repeated string object_ids = 2; +} + message GrpcFloatArray { repeated double items = 1; } @@ -201,6 +228,7 @@ message GrpcComplexContextRequestPipelinePart { enum GrpcGraphKind { None = 0; DAG = 1; + DagLCS = 2; } message GrpcGraph { @@ -255,6 +283,35 @@ message GrpcSoftwareData { repeated GrpcGeneralHistogramData histogram_data = 13; repeated GrpcSimpleCounterData simple_counter_data = 14; repeated GrpcActivityDurationData activities_durations_data = 15; + repeated GrpcOcelData ocel_data = 16; +} + +message GrpcOcelObjectTypeData { + optional string type = 1; +} + +message GrpcOcelAllocateMerge { + optional string type = 1; + repeated string merged_objects_ids = 2; +} + +message GrpcOcelProducedObject { + string id = 1; + optional string type = 2; +} + +message GrpcOcelConsumeProduce { + repeated GrpcOcelProducedObject produced_objects = 1; +} + +message GrpcOcelData { + string object_id = 1; + oneof action { + GrpcOcelObjectTypeData allocate = 2; + GrpcOcelObjectTypeData consume = 3; + GrpcOcelAllocateMerge merged_object_allocation = 4; + GrpcOcelConsumeProduce produce_object_consumption = 5; + } } message GrpcActivityDurationData { diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/CaseInfo.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/CaseInfo.razor index 8be28964f..5b15a0f1f 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/CaseInfo.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/CaseInfo.razor @@ -1,4 +1,4 @@ -@using BlazorBootstrap +@using FicusDashboard.Components.Utils @using FicusDashboard.Layout.Models @using FicusDashboard.Services.Cases @using JetBrains.Lifetimes @@ -21,7 +21,7 @@ @if (myIsLoading) {
- +
return; diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor index d7325ea58..13465eea5 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor @@ -1,16 +1,18 @@ -@using BlazorBootstrap; +@using FicusDashboard.Components.Utils @inherits ComponentBase @inject IJSRuntime Js -@if (myIsDrawing) -{ - -} +
+ @if (myIsDrawing) + { + + } +
-
-
+
+
@@ -39,7 +41,7 @@ return Task.CompletedTask; } - public Task ExportGraph(string fileName) => + public Task ExportGraph(string fileName) => Js.InvokeVoidAsync("exportCytoscapeToSvg", myCytoscapeReference, fileName).AsTask(); private void ReRenderCanvasInternal() @@ -48,7 +50,7 @@ StateHasChanged(); //some hacks in order to make it work after changing to full screen from JS side - Task.Delay(100).ContinueWith(_ => + Task.Delay(200).ContinueWith(_ => { InvokeAsync(async () => { @@ -64,5 +66,4 @@ myRequestedToRerender = true; ReRenderCanvasInternal(); } - } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor.css b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor.css index cab05e8ac..916dfee69 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor.css +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/CanvasComponent.razor.css @@ -1,20 +1,16 @@ .canvas-container { min-width: 800px; min-height: 650px; - width: 100%; - height: 100%; background-color: var(--cv-section-content-color); padding: 5px; -} - -.canvas-container-fullscreen { - width: 100%; - height: 100%; - padding: 5px; + flex-grow: 1; + display: flex; + flex-direction: column; } .cytoscape-canvas { width: 100%; height: 100%; padding: 5px; + flex-grow: 1; } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/AggregatedDataModels.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/AggregatedDataModels.cs index 4eec3a53b..6ade26f18 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/AggregatedDataModels.cs +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/AggregatedDataModels.cs @@ -11,6 +11,21 @@ public class AggregatedData public bool IsEmpty => GlobalSoftwareData.IsEmpty; } +public class EnhancedGraphEntity +{ + public ulong Id { get; set; } + public string? Html { get; set; } + public string Color { get; set; } + public string ExecutionTimeStringRepr { get; set; } +} + +public class EnhancedEdge : EnhancedGraphEntity +{ + public int NumberOfExecutions { get; set; } +} + +public class EnhancedNode : EnhancedGraphEntity; + public class MergedSoftwareData { public Dictionary>> Histograms { get; set; } = new(); diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/EnhancementsSettings.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/EnhancementsSettings.razor index eaa221d71..03fab72eb 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/EnhancementsSettings.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/EnhancementsSettings.razor @@ -1,5 +1,14 @@ -@if (myEnhancements is { }) +@using FicusDashboard.Components.Utils + +@if (myEnhancements is not null) { +
+ +
+ @foreach (var group in myEnhancements.GroupBy(e => e.Group).OrderBy(e => e.Key)) {
@@ -7,16 +16,15 @@ @(string.IsNullOrWhiteSpace(group.Key) ? "Ungrouped" : group.Key)
- @foreach (var enhancement in group) - { -
- - -
@enhancement.DisplayName
-
- } +
+ @foreach (var enhancement in group) + { + + } +
} } @@ -34,7 +42,7 @@ [Parameter] public required List? Enhancements { get; init; } - + private bool myNextState = true; private List? myEnhancements; private HashSet mySelectedEnhancements = null!; @@ -48,7 +56,7 @@ myEnhancements = Enhancements; - if (myEnhancements is not { }) return; + if (myEnhancements is null) return; mySelectedEnhancements = myEnhancements.ToHashSet(); } @@ -65,4 +73,25 @@ } } + private void SelectOrDeselectAll() + { + if (myEnhancements is null) return; + + if (!myNextState) + { + foreach (var name in myEnhancements) + { + mySelectedEnhancements.Add(name); + } + } + else + { + mySelectedEnhancements.Clear(); + } + + myNextState = !myNextState; + + StateHasChanged(); + } + } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/BasicBlock.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/BasicBlock.cs new file mode 100644 index 000000000..9221b292b --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/BasicBlock.cs @@ -0,0 +1,69 @@ +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph; + +public static class ModelSizes +{ + public const int Base = 1; + public const int Separtor = Base; + public const int NodeHeight = 6 * Base; + public const int EdgeBlock = NodeHeight; +} + +public abstract class BasicBlock +{ + public abstract int CalculateMainDim(); + + public virtual ulong? GetFirstNode() => null; + public virtual ulong? GetLastNode() => null; +} + +public abstract class CompositeBlockBase : BasicBlock +{ + public List InnerBlocks { get; } = []; +} + +public class HorizontalCompositeBlock : CompositeBlockBase +{ + public override int CalculateMainDim() => InnerBlocks.Select(b => b.CalculateMainDim()).Max(); + + public override ulong? GetFirstNode() => InnerBlocks.Count is 0 ? null : InnerBlocks[0].GetFirstNode(); + public override ulong? GetLastNode() => InnerBlocks.Count is 0 ? null : InnerBlocks[^1].GetLastNode(); +} + +public class VerticalCompositeBlock : CompositeBlockBase +{ + public required ulong FromNode { get; init; } + public required ulong ToNode { get; init; } + + + public override int CalculateMainDim() => InnerBlocks.Sum(b => b.CalculateMainDim()); +} + +public class EdgeBlock : BasicBlock +{ + public required ulong FromNode { get; init; } + public required ulong ToNode { get; init; } + + + public override int CalculateMainDim() + { + return ModelSizes.EdgeBlock; + } +} + +public class SeparatorBlock : BasicBlock +{ + public override int CalculateMainDim() => ModelSizes.Separtor; +} + +public class SequentialBasicBlock : BasicBlock +{ + public required List NodesSequence { get; init; } + + public override int CalculateMainDim() + { + return ModelSizes.NodeHeight; + } + + public override ulong? GetFirstNode() => NodesSequence.Count == 0 ? null : NodesSequence[0]; + public override ulong? GetLastNode() => NodesSequence.Count == 0 ? null : NodesSequence[^1]; +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/CompositeBlockRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/CompositeBlockRenderer.razor new file mode 100644 index 000000000..d142e201d --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/CompositeBlockRenderer.razor @@ -0,0 +1,111 @@ +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context + +@{ + var minWidth = @SpecifyMinWidth ? $"{Context.MinMainDim}: 100%" : string.Empty; +} + +
+ @switch (Block) + { + case HorizontalCompositeBlock: + { +
+ @foreach (var (index, block) in Block.InnerBlocks.Index()) + { + @RenderBlock(block) + + if (index < Block.InnerBlocks.Count - 1 && + block is not VerticalCompositeBlock && + Block.InnerBlocks[index + 1] is HorizontalCompositeBlock or SequentialBasicBlock) + { + EnhancedEdge? edge = null; + if (block.GetLastNode() is { } lastNode && Block.InnerBlocks[index + 1].GetFirstNode() is { } nextNode) + { + edge = Context.GetEnhancedEdge(lastNode, nextNode); + } + + var (edgeWidth, edgeHeight) = Context.AdjustWidthAndHeight(null, "100%"); + + } + } +
+ + break; + } + case VerticalCompositeBlock verticalBlock: + { +
+ @foreach (var block in Block.InnerBlocks) + { + switch (block) + { + case EdgeBlock edgeBlock: + var enhancedEdge = Context.GetEnhancedEdge(edgeBlock.FromNode, edgeBlock.ToNode); + + var (edgeWidth, edgeHeight) = Context.AdjustWidthAndHeight(null, $"{FlamegraphConstants.MainDimPx * block.CalculateMainDim()}px"); + + + break; + case SeparatorBlock: +
+
+ + break; + case CompositeBlockBase compositeBlock: + { + EnhancedEdge? edge; + +
+ @if (compositeBlock is HorizontalCompositeBlock { InnerBlocks: { Count: > 0 } items } horizontalBlock && + items[0] is not VerticalCompositeBlock) + { + edge = null; + if (horizontalBlock.GetFirstNode() is { } firstNode) + { + edge = Context.GetEnhancedEdge(verticalBlock.FromNode, firstNode); + } + + (edgeWidth, edgeHeight) = Context.AdjustWidthAndHeight(null, "100%"); + + } + + @RenderBlock(block) + + @{ + edge = null; + if (block.GetLastNode() is { } lastNode) + { + edge = Context.GetEnhancedEdge(lastNode, verticalBlock.ToNode); + } + } + +
+ +
+
+ + break; + } + } + } +
+ break; + } + } +
+ +@code { + [Parameter] public required CompositeBlockBase Block { get; init; } + [Parameter] public required FlamegraphRenderingContext Context { get; init; } + [Parameter] public bool SpecifyMinWidth { get; init; } = true; + + private RenderFragment RenderBlock(BasicBlock block) => block switch + { + CompositeBlockBase compositeBlock => @, + SequentialBasicBlock sequentialBasicBlock => @, + _ => throw new ArgumentOutOfRangeException(nameof(block)) + }; + +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContext.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContext.cs new file mode 100644 index 000000000..3f0e677ad --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContext.cs @@ -0,0 +1,172 @@ +using Ficus; + +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +public class FlamegraphContext +{ + public static FlamegraphContext? TryCreate(GrpcGraph graph) + { + try + { + return new FlamegraphContext(graph); + } + catch + { + return null; + } + } + + public GrpcGraph Graph { get; } + public HorizontalCompositeBlock Layout { get; } + public IReadOnlyDictionary IdsToNodes { get; } + public IReadOnlyDictionary<(ulong, ulong), GrpcGraphEdge> NodePairsToIds { get; } + + private FlamegraphContext(GrpcGraph graph) + { + Graph = graph; + var data = new FlamegraphContextData(); + + FlamegraphContextInitializer.Execute(graph, data); + new NodePairsFinder().Find(data); + + Layout = new FlamegraphLayoutCreator().Create(data); + + IdsToNodes = data.IdsToNodes; + NodePairsToIds = data.NodePairsToEdges; + } +} + +public class ObjectRelations +{ + public required string Id { get; init; } + public required ulong FromElementId { get; init; } + public required List RelatedObjectsIds { get; init; } +} + +public class TypeObjects +{ + public required string TypeName { get; init; } + public required List ObjectIds { get; init; } +} + +public class NodeObjectsState +{ + public List? InitialState { get; } + public List? FinalState { get; } + public List InitialStateObjectsRelations { get; } + + public NodeObjectsState(GrpcModelElementOcelAnnotation annotation) + { + InitialState = CreateTypeObjectsState(annotation.InitialState); + FinalState = CreateTypeObjectsState(annotation.FinalState); + + InitialStateObjectsRelations = annotation.Relations.Select(r => new ObjectRelations + { + Id = r.ObjectId, + FromElementId = r.ElementId, + RelatedObjectsIds = r.RelatedObjectsIds.ToList() + }).ToList(); + + return; + + List? CreateTypeObjectsState(GrpcOcelState? state) => + state?.TypeStates? + .Select(ts => new TypeObjects + { + TypeName = ts.Type, + ObjectIds = ts.ObjectIds.ToList() + }) + .ToList(); + } +} + +public class EnhancedNodeDto +{ + public required EnhancedNode Node { get; init; } + public required NodeObjectsState? Objects { get; init; } +} + +public class FlamegraphRenderingContext +{ + private const string ObjectIdBasePart = "ocel-object-id"; + + private static int ourNextContextId; + + + public required FlamegraphContext Context { get; init; } + public required Dictionary EnhancedEdges { get; init; } + public required Dictionary EnhancedNodes { get; init; } + public required bool EventClassesAsName { get; init; } + public required bool LeftToRight { get; init; } + public required bool RenderOcelAnnotation { get; init; } + public required bool RenderOcelTypeNames { get; init; } + + public string MainDim => LeftToRight ? "height" : "width"; + public string SecondDim => LeftToRight ? "width" : "height"; + + public string MinMainDim => "min-" + MainDim; + public string MinSecondDim => "min-" + SecondDim; + + public string MaxMainDim => "max-" + MainDim; + public string MaxSecondDim => "max-" + SecondDim; + + public string SecondFlexDirection => LeftToRight ? "column" : "row"; + public string MainFlexDirection => LeftToRight ? "row" : "column"; + + public string WritingMode => LeftToRight ? "writing-mode: vertical-rl;" : string.Empty; + + public int ContextId { get; } = Interlocked.Increment(ref ourNextContextId); + public string ObjectIdStart { get; } + + + public FlamegraphRenderingContext() + { + ObjectIdStart = $"{ObjectIdBasePart}-{ContextId}"; + } + + + public string GenerateOcelObjectsContainerId(ulong fromElementId, string objectId, bool initialState) => + $"{ObjectIdStart}-{fromElementId}-{GetObjectSite(initialState)}-{objectId}"; + + private static string GetObjectSite(bool initialState) => initialState switch + { + true => "initial", + false => "final" + }; + + public EnhancedEdge GetEnhancedEdge(ulong fromNode, ulong toNode) + { + var edge = Context.NodePairsToIds[(fromNode, toNode)]; + return EnhancedEdges[edge.Id]; + } + + public EnhancedNode GetEnhancedNode(ulong node) => EnhancedNodes[node].Node; + public NodeObjectsState? GetNodeObjectsState(ulong node) => EnhancedNodes[node].Objects; + + public List GetNodeName(ulong nodeId) => EventClassesAsName switch + { + true => GetTopThreeEventClasses(nodeId), + false => GetDefaultNodeName(nodeId) + }; + + public (string?, string?) AdjustWidthAndHeight(string? originalWidth, string? originalHeight) + { + return !LeftToRight ? (originalHeight, originalWidth) : (originalWidth, originalHeight); + } + + private List GetDefaultNodeName(ulong nodeId) => [Context.IdsToNodes[nodeId].Data]; + + private List GetTopThreeEventClasses(ulong nodeId) => + Context.IdsToNodes[nodeId].AdditionalData + .Where(x => x.SoftwareData?.Histogram is { }) + .SelectMany(x => x.SoftwareData.Histogram.Select(h => h.Name)) + .Where(x => x is { }) + .Distinct() + .Order() + .Take(3) + .ToList() switch + { + { Count: > 0 } eventClasses => eventClasses, + _ => GetDefaultNodeName(nodeId) + }; +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContextData.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContextData.cs new file mode 100644 index 000000000..e198e9f95 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContextData.cs @@ -0,0 +1,28 @@ +using Ficus; + +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +internal class FlamegraphPath(ulong? syncNode = null) +{ + public List PathNodes { get; } = []; + public ulong? SyncNode { get; } = syncNode; +} + +internal class NodePair(ulong pairedNode, List paths) +{ + internal List Paths { get; } = paths; + internal ulong PairedNode { get; } = pairedNode; +} + +internal class FlamegraphContextData +{ + public Dictionary IdsToNodes { get; } = []; + public Dictionary<(ulong, ulong), GrpcGraphEdge> NodePairsToEdges { get; } = []; + + public Dictionary> Edges { get; } = []; + public Dictionary> ReversedEdges { get; } = []; + public Dictionary NodePairs { get; } = []; + + public ulong StartNode { get; set; } + public ulong EndNode { get; set; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContextInitializer.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContextInitializer.cs new file mode 100644 index 000000000..9ea68e32d --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphContextInitializer.cs @@ -0,0 +1,42 @@ +using Ficus; + +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +internal static class FlamegraphContextInitializer +{ + public static void Execute(GrpcGraph graph, FlamegraphContextData data) + { + foreach (var edge in graph.Edges) + { + AddEdge(data.Edges, edge.FromNode, edge.ToNode); + AddEdge(data.ReversedEdges, edge.ToNode, edge.FromNode); + + data.NodePairsToEdges[(edge.FromNode, edge.ToNode)] = edge; + } + + foreach (var node in graph.Nodes) + { + data.IdsToNodes[node.Id] = node; + } + + var startNode = graph.Nodes.FirstOrDefault(n => !data.ReversedEdges.ContainsKey(n.Id)); + if (startNode is null) throw new Exception("Graph does not contain a start node"); + + var endNode = graph.Nodes.FirstOrDefault(n => !data.Edges.ContainsKey(n.Id)); + if (endNode is null) throw new Exception("Graph does not contain an end node"); + + data.StartNode = startNode.Id; + data.EndNode = endNode.Id; + } + + private static void AddEdge(Dictionary> map, ulong from, ulong to) + { + if (!map.TryGetValue(from, out var toNodes)) + { + toNodes = []; + map[from] = toNodes; + } + + toNodes.Add(to); + } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphLayoutCreator.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphLayoutCreator.cs new file mode 100644 index 000000000..3528e3451 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/FlamegraphLayoutCreator.cs @@ -0,0 +1,174 @@ +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +internal class FlamegraphLayoutCreator +{ + private readonly HashSet myAddedNodes = []; + + + public HorizontalCompositeBlock Create(FlamegraphContextData data) + { + var layout = CreateBlockLayoutEndNodeNotInclusive(data, data.StartNode, data.EndNode); + + AddSingleNodeSequentialBlockIfNeeded(layout, data.EndNode); + + return layout; + } + + private HorizontalCompositeBlock CreateBlockLayoutEndNodeNotInclusive( + FlamegraphContextData data, ulong startNode, ulong endNode) + { + var hBlock = new HorizontalCompositeBlock(); + var node = startNode; + + while (node != endNode) + { + if (data.NodePairs.TryGetValue(node, out var nodePair)) + { + AddSingleNodeSequentialBlockIfNeeded(hBlock, node); + + var block = CreateVerticalBlock(data, node, nodePair); + + hBlock.InnerBlocks.Add(block); + node = nodePair.PairedNode; + } + else + { + var (block, blockEndNode) = CreateSequentialBlock(data, node, endNode); + hBlock.InnerBlocks.Add(block); + node = blockEndNode; + } + } + + if (hBlock.InnerBlocks.Count > 0 && hBlock.InnerBlocks.Last() is VerticalCompositeBlock) + { + AddSingleNodeSequentialBlockIfNeeded(hBlock, endNode); + } + + return hBlock; + } + + private VerticalCompositeBlock CreateVerticalBlock(FlamegraphContextData data, ulong node, NodePair nodePair) + { + var block = new VerticalCompositeBlock + { + FromNode = node, + ToNode = nodePair.PairedNode + }; + + foreach (var (index, path) in nodePair.Paths.Index()) + { + if (path.PathNodes.Count > 1) + { + if (!path.SyncNode.HasValue) + { + throw new Exception("SyncNode was null when path contains several starting nodes"); + } + + var innerVerticalBlock = new VerticalCompositeBlock + { + FromNode = node, + ToNode = path.SyncNode.Value + }; + + foreach (var (pathNodesIndex, pathNode) in path.PathNodes.Index()) + { + innerVerticalBlock.InnerBlocks.Add((pathNode == path.SyncNode.Value) switch + { + true => new EdgeBlock + { + FromNode = node, + ToNode = pathNode + }, + false => CreateBlockLayoutEndNodeNotInclusive(data, pathNode, path.SyncNode.Value) + }); + + if (pathNodesIndex < path.PathNodes.Count - 1) + { + innerVerticalBlock.InnerBlocks.Add(new SeparatorBlock()); + } + } + + var nextHorizontalBlock = CreateBlockLayoutEndNodeNotInclusive(data, path.SyncNode.Value, nodePair.PairedNode); + + var innerHorizontalBlock = new HorizontalCompositeBlock + { + InnerBlocks = + { + innerVerticalBlock, + nextHorizontalBlock, + } + }; + + block.InnerBlocks.Add(innerHorizontalBlock); + + continue; + } + + var outgoingNode = path.PathNodes[0]; + if (outgoingNode == nodePair.PairedNode) + { + block.InnerBlocks.Add(new EdgeBlock + { + FromNode = node, + ToNode = outgoingNode + }); + } + else + { + var outgoingNodeEndNode = data.NodePairs.TryGetValue(outgoingNode, out var outgoingNodePair) switch + { + true => outgoingNodePair, + false => nodePair + }; + + block.InnerBlocks.Add(CreateBlockLayoutEndNodeNotInclusive(data, outgoingNode, outgoingNodeEndNode.PairedNode)); + } + + if (index < nodePair.Paths.Count - 1) + { + block.InnerBlocks.Add(new SeparatorBlock()); + } + } + + return block; + } + + private (SequentialBasicBlock Block, ulong NextNode) CreateSequentialBlock(FlamegraphContextData data, ulong node, ulong endNode) + { + var currentNode = node; + var nodesSequence = new List(); + + while (currentNode != endNode && + !data.NodePairs.ContainsKey(currentNode) && + data.Edges.ContainsKey(currentNode)) + { + nodesSequence.Add(currentNode); + currentNode = data.Edges[currentNode].First(); + } + + var block = CreateSequentialBlock(nodesSequence); + + return (block, currentNode); + } + + private void AddSingleNodeSequentialBlockIfNeeded(HorizontalCompositeBlock block, ulong node) + { + if (!myAddedNodes.Contains(node)) + { + block.InnerBlocks.Add(CreateSequentialBlock([node])); + } + } + + private SequentialBasicBlock CreateSequentialBlock(List nodes) + { + foreach (var node in nodes) + { + myAddedNodes.Add(node); + } + + return new SequentialBasicBlock + { + NodesSequence = nodes.ToList() + }; + } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/IssuedTokens.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/IssuedTokens.cs new file mode 100644 index 000000000..c93323469 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/IssuedTokens.cs @@ -0,0 +1,67 @@ +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +internal class IssuedTokens(int startToken, int rightBorder) +{ + private int myNextIndex; + + private readonly List mySyncNodes = []; + private readonly int?[] myMergedTokens = new int?[rightBorder - startToken]; + + + public bool FoundPairNode { get; set; } + public int StartToken { get; } = startToken; + public int RightBorder { get; } = rightBorder; + + + public void AddTokensGroup(List tokens, ulong syncNode) + { + if (tokens.Count < 2 || tokens.Count == RightBorder - StartToken) return; + + foreach (var index in tokens.Select(token => token - StartToken)) + { + if (myMergedTokens[index] is { }) + { + throw new Exception("Some of the tokens already merged, can not merge twice"); + } + + myMergedTokens[index] = myNextIndex; + } + + mySyncNodes.Add(syncNode); + myNextIndex++; + } + + public List GroupOutgoingNodesByPaths(List outgoingNodes) + { + if (myNextIndex is 0) + { + return outgoingNodes.Select(n => + { + var path = new FlamegraphPath(); + path.PathNodes.Add(n); + return path; + }).ToList(); + } + + var result = new List(); + var groupsLists = Enumerable.Range(0, myNextIndex).Zip(mySyncNodes).Select(n => new FlamegraphPath(n.Second)).ToArray(); + foreach (var (mergedToken, node) in myMergedTokens.Zip(outgoingNodes)) + { + if (mergedToken is not { } token) + { + var path = new FlamegraphPath(); + path.PathNodes.Add(node); + + result.Add(path); + + continue; + } + + groupsLists[token].PathNodes.Add(node); + } + + result.AddRange(groupsLists); + + return result; + } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/NodePairsFinder.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/NodePairsFinder.cs new file mode 100644 index 000000000..9b9ebc320 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Context/NodePairsFinder.cs @@ -0,0 +1,153 @@ +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +internal class NodePairsFinder +{ + private readonly HashSet myProcessedNodes = []; + private readonly Queue<(ulong Node, HashSet Tokens)> myQueue = []; + private readonly Dictionary myNodesToIssuedTokens = []; + private readonly Dictionary> myNodesToQueuedHashSets = []; + + private int myNextToken; + + + public void Find(FlamegraphContextData data) + { + myQueue.Enqueue((data.StartNode, [])); + + while (myQueue.Count > 0) + { + if (myQueue.All(pair => AnyIncomingNodesUnprocessed(data, pair.Node))) + { + throw new Exception("Queue contains only waiting for processing nodes, will livelock"); + } + + var (node, tokens) = myQueue.Dequeue(); + + if (AnyIncomingNodesUnprocessed(data, node)) + { + myQueue.Enqueue((node, tokens)); + continue; + } + + AssertNoTokensFromPairedNodes(data, node, tokens); + + ProcessNode(data, node, tokens); + EnqueueOutgoingNodes(data, node, tokens); + } + + if (myProcessedNodes.Count != data.IdsToNodes.Count) + { + throw new Exception("There are several components in the graph, can not handle it"); + } + } + + private void AssertNoTokensFromPairedNodes(FlamegraphContextData data, ulong node, HashSet tokens) + { + foreach (var (issuedNode, issuedTokens) in myNodesToIssuedTokens.Where(p => p.Value.FoundPairNode)) + { + for (var t = issuedTokens.StartToken; t < issuedTokens.RightBorder; t++) + { + if (!tokens.Contains(t)) continue; + + var issuedNodeName = data.IdsToNodes[issuedNode].Data; + var currentNodeName = data.IdsToNodes[node].Data; + + throw new Exception( + $"Node {currentNodeName} contains token {t} issued from node {issuedNodeName} when it has already found its parent"); + } + } + } + + private bool AnyIncomingNodesUnprocessed(FlamegraphContextData data, ulong node) + { + var anyIncomingNodeUnprocessed = false; + if (data.ReversedEdges.TryGetValue(node, out var incomingNodes)) + { + anyIncomingNodeUnprocessed = incomingNodes.Any(incomingNode => !myProcessedNodes.Contains(incomingNode)); + } + + return anyIncomingNodeUnprocessed; + } + + private void ProcessNode(FlamegraphContextData data, ulong node, HashSet tokens) + { + myProcessedNodes.Add(node); + myNodesToQueuedHashSets.Remove(node); + + if (!data.ReversedEdges.TryGetValue(node, out var incomingNodes) || incomingNodes.Count < 2) return; + + foreach (var (issuedNode, issuedTokens) in myNodesToIssuedTokens.Where(it => !it.Value.FoundPairNode)) + { + var containedTokens = new List(); + for (var t = issuedTokens.StartToken; t < issuedTokens.RightBorder; t++) + { + if (tokens.Contains(t)) + { + containedTokens.Add(t); + } + } + + issuedTokens.AddTokensGroup(containedTokens, node); + + var isPairedNode = containedTokens.Count == issuedTokens.RightBorder - issuedTokens.StartToken; + if (!isPairedNode) continue; + + var issuedNodeOutgoingNodes = data.Edges.GetValueOrDefault(issuedNode) ?? []; + data.NodePairs[issuedNode] = new NodePair(node, issuedTokens.GroupOutgoingNodesByPaths(issuedNodeOutgoingNodes)); + + for (var t = issuedTokens.StartToken; t < issuedTokens.RightBorder; t++) + { + tokens.Remove(t); + } + + issuedTokens.FoundPairNode = true; + } + } + + private void EnqueueOutgoingNodes(FlamegraphContextData data, ulong node, HashSet tokens) + { + if (!data.Edges.TryGetValue(node, out var outgoingNodes)) return; + + if (outgoingNodes.Count == 1) + { + EnqueueOutgoingNode(outgoingNodes[0], tokens, null); + } + else + { + myNodesToIssuedTokens[node] = new IssuedTokens(myNextToken, myNextToken + outgoingNodes.Count); + foreach (var outgoingNode in outgoingNodes) + { + EnqueueOutgoingNode(outgoingNode, tokens, myNextToken); + myNextToken++; + } + } + } + + private void EnqueueOutgoingNode(ulong outgoingNode, HashSet tokens, int? newToken) + { + if (myNodesToQueuedHashSets.TryGetValue(outgoingNode, out var existingTokensSet)) + { + foreach (var token in tokens) + { + existingTokensSet.Add(token); + } + + if (newToken.HasValue) + { + existingTokensSet.Add(newToken.Value); + } + } + else + { + var newSet = new HashSet(tokens); + + if (newToken.HasValue) + { + newSet.Add(newToken.Value); + } + + myNodesToQueuedHashSets[outgoingNode] = newSet; + myQueue.Enqueue((outgoingNode, newSet)); + } + } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/EdgeRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/EdgeRenderer.razor new file mode 100644 index 000000000..dcf7959be --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/EdgeRenderer.razor @@ -0,0 +1,43 @@ +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context + +@{ + var style = string.Empty; + if (Height is { }) style += $"height: {Height};"; + if (Width is { }) style += $"width: {Width};"; + + if (!Context.RenderOcelAnnotation) + { + style += $"background: {EnhancedEdge?.Color} !important;"; + } +} + +
+ + @if (!@Context.RenderOcelAnnotation && EnhancedEdge is { }) + { +
+
+ @EnhancedEdge.ExecutionTimeStringRepr +
+
+ @EnhancedEdge.NumberOfExecutions times +
+
+ + @if (EnhancedEdge.Html is { }) + { +
+ @((MarkupString)EnhancedEdge.Html) +
+ } + } + +
+ +@code { + [Parameter] public required string? Height { get; init; } + [Parameter] public required string? Width { get; init; } + [Parameter] public required EnhancedEdge? EnhancedEdge { get; init; } + [Parameter] public required FlamegraphRenderingContext Context { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/FlamegraphConstants.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/FlamegraphConstants.cs new file mode 100644 index 000000000..bf4342331 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/FlamegraphConstants.cs @@ -0,0 +1,8 @@ +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph; + +internal static class FlamegraphConstants +{ + public const int MainDimPx = 35; + public const int NodeWidthPx = 65; + public const int EdgeWidthPx = 40; +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/FlamegraphGraphRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/FlamegraphGraphRenderer.razor new file mode 100644 index 000000000..5c969e1dd --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/FlamegraphGraphRenderer.razor @@ -0,0 +1,114 @@ +@using Ficus +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context +@using FicusDashboard.Components.Utils +@using JetBrains.Threading + +@inject IJSRuntime Js; + +@if (myRenderingContext is not null) +{ +
+ +
+} +else +{ + var dim = Context.Layout.CalculateMainDim() * FlamegraphConstants.MainDimPx; + +
+ +
+} + +@code { + [Parameter] public required FlamegraphContext Context { get; init; } + [Parameter] public required GraphLikeEntitySettings Settings { get; init; } + [Parameter] public required AggregatedData AggregatedData { get; init; } + [Parameter] public required GrpcAnnotation? Annotation { get; init; } + [Parameter] public required GrpcOcelModelAnnotation? OcelAnnotation { get; init; } + + + private readonly Guid myContainerId = Guid.NewGuid(); + + private FlamegraphRenderingContext? myRenderingContext; + + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (myRenderingContext is null) return; + + var relations = myRenderingContext.EnhancedNodes.Values + .Where(dto => dto.Objects is not null) + .SelectMany(dto => dto.Objects!.InitialStateObjectsRelations.Select(r => new + { + CurrentNodeId = dto.Node.Id, + Id = r.Id, + FromNodeId = r.FromElementId, + RelatedObjectsIds = r.RelatedObjectsIds + })) + .ToList(); + + await Js.InvokeVoidAsync( + "createOcelSankeyConnections", + myContainerId.ToString(), + myRenderingContext.ObjectIdStart, + relations, + !Settings.UseLROrientation + ); + } + + protected override void OnParametersSet() + { + myRenderingContext = null; + StateHasChanged(); + + Task.Run(async () => + { + var enhancedEdges = await Js.InvokeAsync( + "createEnhancedEdges", Context.Graph, Annotation, AggregatedData, Settings.SelectedEnhancements, Settings.Filter); + + var enhancedNodes = await Js.InvokeAsync( + "createEnhancedNodes", Context.Graph, AggregatedData, Settings.SelectedEnhancements, Settings.Filter); + + var ocelAnnotationsMap = CreateOcelAnnotationMap(); + myRenderingContext = new FlamegraphRenderingContext + { + Context = Context, + EnhancedEdges = enhancedEdges.ToDictionary(e => e.Id, e => e), + EnhancedNodes = enhancedNodes.ToDictionary(e => e.Id, e => CreateEnhancedNodeDto(e, ocelAnnotationsMap)), + EventClassesAsName = Settings.UseEventClassesAsLabels, + LeftToRight = Settings.UseLROrientation, + RenderOcelAnnotation = Settings.RenderOcelAnnotation, + RenderOcelTypeNames = Settings.RenderOcelTypeNames + }; + + StateHasChanged(); + }).NoAwait(); + } + + private Dictionary? CreateOcelAnnotationMap() + { + if (OcelAnnotation is null) return null; + + Dictionary map = []; + foreach (var elementAnnotation in OcelAnnotation.Annotations) + { + map[elementAnnotation.ElementId] = elementAnnotation; + } + + return map; + } + + private static EnhancedNodeDto CreateEnhancedNodeDto( + EnhancedNode node, + Dictionary? ocelAnnotationsMap) => new() + { + Node = node, + Objects = ocelAnnotationsMap switch + { + null => null, + not null => new NodeObjectsState(ocelAnnotationsMap[node.Id]) + } + }; + +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeObjectsStateObjectsBlock.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeObjectsStateObjectsBlock.razor new file mode 100644 index 000000000..77c03c3e6 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeObjectsStateObjectsBlock.razor @@ -0,0 +1,31 @@ +@inject IEntitiesColors Colors; + +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context +@using FicusDashboard.Services + +
+ @foreach (var (index, id) in ObjectsIds.Order().Index()) + { + var isLast = index == ObjectsIds.Count - 1 && IsLastObjectsBlock; + var borderStyle = NodeRenderingUtils.GetBorderStyle(Context, IsInitialState, isLast, addTopBorder: false); + +
+ @id +
+ } +
+ +@code { + [Parameter] public required FlamegraphRenderingContext Context { get; init; } + [Parameter] public required ulong NodeId { get; init; } + [Parameter] public required string TypeName { get; init; } + [Parameter] public required List ObjectsIds { get; init; } + [Parameter] public required bool IsInitialState { get; init; } + [Parameter] public required bool IsLastObjectsBlock { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeObjectsStateTypeBlock.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeObjectsStateTypeBlock.razor new file mode 100644 index 000000000..2d0ae2e94 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeObjectsStateTypeBlock.razor @@ -0,0 +1,21 @@ +@inject IEntitiesColors Colors; + +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context +@using FicusDashboard.Services + +
+
+ @TypeName +
+
+ +@code { + [Parameter] public required FlamegraphRenderingContext Context { get; init; } + [Parameter] public required string TypeName { get; init; } + [Parameter] public required bool IsLast { get; init; } + [Parameter] public required bool IsLeftSide { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeRenderer.razor new file mode 100644 index 000000000..b5c7c695b --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeRenderer.razor @@ -0,0 +1,50 @@ +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context + +@{ + var mainDim = FlamegraphConstants.MainDimPx * MainDim; + var objectsState = Context.GetNodeObjectsState(Node); + var initialState = objectsState?.InitialState; + var finalState = objectsState?.FinalState; +} + +
+ @if (Context.RenderOcelAnnotation) + { + + } + +
+ @foreach (var eventClass in Context.GetNodeName(Node)) + { +
+ @eventClass +
+ } +
+ + @if (Context.RenderOcelAnnotation) + { + + } +
+ +@code { + [Parameter] public required FlamegraphRenderingContext Context { get; init; } + [Parameter] public required ulong Node { get; init; } + [Parameter] public required double MainDim { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeRenderingUtils.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeRenderingUtils.cs new file mode 100644 index 000000000..e4e9787be --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodeRenderingUtils.cs @@ -0,0 +1,42 @@ +using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context; + +namespace FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Node; + +internal class NodeRenderingUtils +{ + private const string BorderStyle = "solid 1px white;"; + + public static string GetBorderStyle( + FlamegraphRenderingContext context, + bool isLeftSide, + bool isLast, + bool addTopBorder = true + ) + { + var firstPart = GetFirstPartOfBorderStyle(context, isLeftSide, addTopBorder); + var secondPart = GetSecondPartOfBorderStyle(context, isLast); + + return firstPart + secondPart; + } + + private static string GetSecondPartOfBorderStyle(FlamegraphRenderingContext context, bool isLast) => isLast switch + { + true => string.Empty, + false => context.LeftToRight switch + { + true => $"border-bottom: {BorderStyle}", + false => $"border-right: {BorderStyle}" + } + }; + + private static string GetFirstPartOfBorderStyle(FlamegraphRenderingContext context, bool isLeftSide, bool addTopBorder) => + addTopBorder switch + { + false => string.Empty, + true => context.LeftToRight switch + { + true => $"border-{(isLeftSide ? "left" : "right")}: {BorderStyle}", + false => $"border-{(isLeftSide ? "top" : "bottom")}: {BorderStyle}" + }, + }; +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodesObjectStateRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodesObjectStateRenderer.razor new file mode 100644 index 000000000..7055166d1 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/Node/NodesObjectStateRenderer.razor @@ -0,0 +1,65 @@ +@using System.Globalization +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context + +@if (State is null) +{ + return; +} + +@{ + var overallObjectsCount = State.Select(t => t.ObjectIds.Count).Sum(); + var typeStates = State + .OrderBy(t => t.TypeName) + .Where(t => t.ObjectIds.Count > 0) + .Select(ts => + { + var width = (double)ts.ObjectIds.Count * 100 / overallObjectsCount; + var widthStr = $"{width.ToString(CultureInfo.InvariantCulture)}%"; + return (ts.TypeName, widthStr, ts.ObjectIds); + }) + .ToList(); +} + +
+ @foreach (var (index, (name, width, objectsIds)) in typeStates.Index()) + { + var isLast = index == typeStates.Count - 1; +
+ @if (IsInitialState) + { + + } + + @if (Context.RenderOcelTypeNames) + { + + } + + @if (!IsInitialState) + { + + } +
+ } +
+ +@code { + [Parameter] public required FlamegraphRenderingContext Context { get; init; } + [Parameter] public required ulong NodeId { get; init; } + [Parameter] public required bool IsInitialState { get; init; } + [Parameter] public required List? State { get; init; } + [Parameter] public required bool TypeNamesFirst { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/SequentialBlockRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/SequentialBlockRenderer.razor new file mode 100644 index 000000000..b61dda675 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/Flamegraph/SequentialBlockRenderer.razor @@ -0,0 +1,22 @@ +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Node + + +
+ @foreach (var (index, node) in Block.NodesSequence.Index()) + { + + + @if (index >= Block.NodesSequence.Count - 1) continue; + + var enhancedEdge = Context.GetEnhancedEdge(node, Block.NodesSequence[index + 1]); + + var (edgeWidth, edgeHeight) = Context.AdjustWidthAndHeight(null, "100%"); + + } +
+ +@code { + [Parameter] public required SequentialBasicBlock Block { get; init; } + [Parameter] public required FlamegraphRenderingContext Context { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphLikeEntitySettings.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphLikeEntitySettings.razor index 932ee8b2d..828dc72d2 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphLikeEntitySettings.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphLikeEntitySettings.razor @@ -1,14 +1,22 @@ -@using Radzen +@using FicusDashboard.Components.Utils +@using Radzen @using Radzen.Blazor -
+
@if (Enhancements is { Count: > 0 }) {
Filter:
- + } @{ @@ -16,22 +24,39 @@ }
Spacing factor:
- + -
- + -
Event Classes as Name
-
+ @if (CanRenderFlamegraph) + { + + +
+ + +
+ } + Style="margin-top: 10px;"> - + @@ -41,16 +66,18 @@ @code { [Parameter] public required List? Enhancements { get; init; } [Parameter] public RenderFragment? ChildContent { get; init; } + [Parameter] public required bool CanRenderFlamegraph { get; init; } - private string? myFilterValue; - private bool myUseLROrientation = true; - private string mySpacingFactor = "1.4"; - private bool myUseEventClassesAsLabels; private EnhancementsSettings? myEnhancementsSettings; - public string? Filter => myFilterValue; - public bool UseLROrientation => myUseLROrientation; - public string SpacingFactor => mySpacingFactor; - public bool UseEventClassesAsLabels => myUseEventClassesAsLabels; + public bool RenderDagLcsInFlamegraphMode { get; private set; } + public bool RenderOcelAnnotation { get; private set; } + public bool RenderOcelTypeNames { get; private set; } + + public string? Filter { get; private set; } + public bool UseLROrientation { get; private set; } = true; + public string SpacingFactor { get; private set; } = "1.4"; + public bool UseEventClassesAsLabels { get; private set; } + public List SelectedEnhancements => myEnhancementsSettings?.SelectedEnhancements ?? []; } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphRenderer.razor index 2a14559da..e135f2c65 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphRenderer.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/Canvas/Graph/GraphRenderer.razor @@ -1,23 +1,38 @@ @using System.Globalization @using Ficus +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph +@using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph.Flamegraph.Context @using FicusDashboard.Layout.Models @using Radzen.Blazor @inject IJSRuntime Js
-
- +
+ Rerender Export to SVG -
- +
+ @if (mySettings is { RenderDagLcsInFlamegraphMode: true }) + { + + } + else + { + + }
-
+
@if (myAggregatedData is { IsEmpty: false } data) { @@ -30,18 +45,21 @@ [Parameter] public required bool IsFullScreen { get; init; } [Parameter] public required GrpcGraph Graph { get; init; } [Parameter] public required ProcessCaseData ProcessCaseData { get; init; } - [Parameter] public GrpcAnnotation? Annotation { get; set; } + [Parameter] public GrpcAnnotation? Annotation { get; init; } + [Parameter] public GrpcOcelModelAnnotation? OcelModelAnnotation { get; init; } private GraphLikeEntitySettings mySettings = null!; private List? myEnhancements; private CanvasComponent? myCanvasComponent; private AggregatedData? myAggregatedData; + private FlamegraphContext? myContext; protected override void OnParametersSet() { myEnhancements = FindAllEnhancements(Graph); + myContext = FlamegraphContext.TryCreate(Graph); } private List FindAllEnhancements(GrpcGraph graph) @@ -91,7 +109,7 @@ { AddCustomEnhancements(data, enhancements); } - + private static void AddCustomEnhancements(GrpcSoftwareData? data, HashSet enhancements) { if (data is null) return; @@ -157,7 +175,13 @@ private string CreateExportFileName() => ProcessCaseData.ProcessData.ProcessName + "_" + ProcessCaseData.Case.DisplayName + "_graph"; - private void ReRenderCanvas() => myCanvasComponent?.ReRenderCanvas(); + private void ReRenderCanvas() + { + if (!mySettings.RenderDagLcsInFlamegraphMode) + { + myCanvasComponent?.ReRenderCanvas(); + } + } private Task ExportGraph() => myCanvasComponent is { } ? myCanvasComponent.ExportGraph(CreateExportFileName()) : Task.CompletedTask; diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/ColorsLog/ColorsEventLogRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/ColorsLog/ColorsEventLogRenderer.razor index 1514c77ed..cc4f4d8f6 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/ColorsLog/ColorsEventLogRenderer.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/ContextValues/ColorsLog/ColorsEventLogRenderer.razor @@ -1,12 +1,13 @@ @using BlazorBootstrap @using Ficus +@using FicusDashboard.Components.Utils @inject IJSRuntime Js;
@if (!myFinishedCanvasDrawings) { - + } @if (mySuggestedAdjustment is var (suggestedWidthScale, suggestedHeightScale)) diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor index 3b6c06fba..68bbd480e 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor @@ -7,6 +7,7 @@ @using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.PetriNet @using FicusDashboard.Components.CaseInfo.ContextValues.Canvas.Graph @using FicusDashboard.Components.CaseInfo.ContextValues +@using FicusDashboard.Components.Utils @using FicusDashboard.Layout.Models @using JetBrains.Lifetimes @@ -14,7 +15,12 @@ @inject ILogger Logger
-
+ @if (myIsLoading) + { + + } + +
@(Index + 1) @@ -26,6 +32,7 @@ @Results.PipelinePartName
+ @if (myIsFullScreen) {
@@ -94,6 +101,7 @@ private bool myIsFullScreen; + private bool myIsLoading; private int mySelectedExecutionResultIndex; @@ -141,7 +149,7 @@ StateHasChanged(); } - private bool IsExpanded(PipelinePartExecutionResults results) + private static bool IsExpanded(PipelinePartExecutionResults results) { return results.UserData.GetOrCreate(ourExpandedKey, static () => true); } @@ -207,6 +215,7 @@ { var graphPair = Logger.TryGetContextValue(pipelinePartName, contextValues, GrpcContextValue.ContextValueOneofCase.Graph, c => c.Graph); var annotationPair = Logger.TryGetContextValue(pipelinePartName, contextValues, GrpcContextValue.ContextValueOneofCase.Annotation, c => c.Annotation); + var ocelAnnotationPair = Logger.TryGetContextValue(pipelinePartName, contextValues, GrpcContextValue.ContextValueOneofCase.OcelAnnotation, c => c.OcelAnnotation); if (graphPair is not var (graphId, graph)) return null; @@ -216,10 +225,11 @@ IsFullScreen="@myIsFullScreen" Graph="graph" ProcessCaseData="ProcessCaseData" - Annotation="annotationPair?.Item2"/>; + Annotation="annotationPair?.Item2" + OcelModelAnnotation="ocelAnnotationPair?.Item2"/>; } - private string CreateEntityAnnotationId(Guid id, (Guid, GrpcAnnotation)? annotationPair) + private static string CreateEntityAnnotationId(Guid id, (Guid, GrpcAnnotation)? annotationPair) { return annotationPair switch { @@ -243,7 +253,12 @@ private async Task OpenElementInFullscreen() { + myIsLoading = true; + StateHasChanged(); + await Js.InvokeVoidAsync("openFullScreen", Lifetime, myContainerId, DotNetObjectReference.Create(this)); + + myIsLoading = false; myIsFullScreen = true; StateHasChanged(); } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor.css b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor.css index 082b960c1..f68a00bd5 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor.css +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/CaseInfo/PipelinePartResultsRenderer.razor.css @@ -1,5 +1,6 @@ .pipeline-parts-context-values-inner-container { width: fit-content; + max-width: 1200px; margin-top: 20px; margin-right: 20px; } @@ -60,29 +61,27 @@ } .pipeline-part-context-values-outer-container { - display: grid; - grid-template-rows: 0fr; + background-color: var(--cv-section-content-color); + height: 1px; overflow: hidden; - transition: grid-template-rows 1s; } .pipeline-part-context-values-inner-container { + width: 100%; align-self: end; min-height: 0; - transition: visibility 1s; - visibility: hidden; + height: 1px; background-color: var(--cv-section-content-color); color: var(--cv-section-content-text-color); } .outer-container-checked { - grid-template-rows: 1fr; - visibility: visible; + height: auto; } .inner-container-checked { - visibility: visible; + height: auto; } .pipeline-part-result-selection-buttons-container { diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/Utils/BoolCheckbox.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/Utils/BoolCheckbox.razor new file mode 100644 index 000000000..2725903f4 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/Utils/BoolCheckbox.razor @@ -0,0 +1,24 @@ +@typeparam T + +
+ @if (Checked) + { + + } + else + { + + } + +
@Title
+
+ +@code { + [Parameter] public required string Title { get; init; } + [Parameter] public required Action Handler { get; init; } + [Parameter] public bool Checked { get; init; } + [Parameter] public T? Data { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Components/Utils/Loader.razor b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/Utils/Loader.razor new file mode 100644 index 000000000..853d23ead --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Components/Utils/Loader.razor @@ -0,0 +1,15 @@ +@using BlazorBootstrap + +@{ + var style = LeftUpMargin switch + { + false => string.Empty, + true => "margin-top: 10px; margin-left: 10px;" + }; +} + + + +@code { + [Parameter] public required bool LeftUpMargin { get; init; } +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/FicusDashboard.csproj b/Ficus/src/front/FicusFrontend/FicusDashboard/FicusDashboard.csproj index 4f92f3c09..4403f74e1 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/FicusDashboard.csproj +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/FicusDashboard.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable Linux diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/colors_log/event_handlers.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/colors_log/event_handlers.ts index 2d96b795a..03262f155 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/colors_log/event_handlers.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/colors_log/event_handlers.ts @@ -54,7 +54,7 @@ function findSelectedEvent(mouseEvent: MouseEvent, return 0; } - return x - event.x; + return event.x - x; }); if (index > -1 && index < trace.length) { diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_elements.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_elements.ts index 8df1a5223..69f98f2e7 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_elements.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_elements.ts @@ -5,14 +5,24 @@ import { calculateOverallExecutionTime, createEmptySoftwareData, getEdgeEnhancementDataOrNull, getNodeEnhancementDataOrNull, - getPerformanceAnnotationColor, increment, + getPerformanceAnnotationColor, increment, preprocessForCSharpInterop, preprocessFromCSharpInterop, } from "./util"; import {GrpcGraph} from "../protos/ficus/GrpcGraph"; import {GrpcAnnotation} from "../protos/ficus/GrpcAnnotation"; import {GrpcGraphNode} from "../protos/ficus/GrpcGraphNode"; import {GrpcGraphEdge} from "../protos/ficus/GrpcGraphEdge"; import cytoscape from "cytoscape"; -import {AggregatedData, CountAndSum, MergedSoftwareData, ValueWithUnits} from "./types"; +import { + AggregatedData, CytoscapeElementDef, + GraphEdge, GraphNode, + MergedSoftwareData, + SoftwareEnhancementKind, + ValueWithUnits +} from "./types"; +import {createEdgeStandaloneEnhancements} from "./labels/edge_html_label"; +import {createTimeSpanString} from "./labels/util"; +import {GrpcDurationKind} from "../protos/ficus/GrpcDurationKind"; +import {createNodeStandaloneEnhancements} from "./labels/node_html_label"; const graphColor = graphColors(darkTheme); @@ -26,13 +36,9 @@ export function createGraphElements( let performanceEdgesMap = buildEdgesTimeAnnotationMap(annotation); - elements.push(...createGraphNodesElements(graph.nodes, filter)); + elements.push(...createGraphNodesElements(graph.nodes, aggregatedData, filter)); elements.push(...createGraphEdgesElements(graph.edges, performanceEdgesMap, aggregatedData, filter)); - for (let element of elements) { - (element).data.aggregatedData = aggregatedData; - } - return elements; } @@ -62,29 +68,6 @@ export function createAggregatedData(graph: GrpcGraph, annotation: GrpcAnnotatio } } -function preprocessForCSharpInterop(data: AggregatedData): AggregatedData { - //JS Map can not be converted to C# Dictionary - data.globalSoftwareData.counters = toObjectCsharpInterop(data.globalSoftwareData.counters); - data.globalSoftwareData.activitiesDurations = toObjectCsharpInterop(data.globalSoftwareData.activitiesDurations); - - for (let [key, map] of data.globalSoftwareData.histograms) { - data.globalSoftwareData.histograms.set(key, { - units: map.units, - value: toObjectCsharpInterop(map.value), - group: map.group - }); - } - - data.globalSoftwareData.histograms = toObjectCsharpInterop(data.globalSoftwareData.histograms); - - return data; -} - -function toObjectCsharpInterop(map: Map): Map { - // @ts-ignore - return Object.fromEntries(map); -} - function processNodesAggregatedData(nodes: GrpcGraphNode[], aggregatedData: AggregatedData, filter: RegExp | null) { for (let node of nodes) { let enhancementData = getNodeEnhancementDataOrNull(node, filter); @@ -122,8 +105,12 @@ function buildEdgesTimeAnnotationMap(annotation: GrpcAnnotation): Record[] { + let elements: CytoscapeElementDef[] = []; for (let node of nodes) { elements.push({ @@ -133,8 +120,9 @@ function createGraphNodesElements(nodes: GrpcGraphNode[], filter: RegExp | null) id: node.id.toString(), additionalData: node.additionalData, innerGraph: node.innerGraph, - executionTime: calculateOverallExecutionTime(node), + executionTimeNs: calculateOverallExecutionTime(node), enhancementData: getNodeEnhancementDataOrNull(node, filter), + aggregatedData: aggregatedData } }) } @@ -169,7 +157,7 @@ function updateAggregatedData(aggregatedData: AggregatedData, softwareData: Merg } }) } - + aggregatedData.globalSoftwareData.activitiesDurations.get(name).value.value += duration.value.value; } } @@ -195,13 +183,65 @@ function mergeMaps(first: Map, second: Map) { } } -export function createGraphEdgesElements( +export function createEnhancedEdges( + graph: GrpcGraph, + annotation: GrpcAnnotation, + aggregatedData: AggregatedData, + enhancements: SoftwareEnhancementKind[], + filter: RegExp | null, +) { + aggregatedData = preprocessFromCSharpInterop(aggregatedData); + let performanceEdgesMap = buildEdgesTimeAnnotationMap(annotation); + let elements = createGraphEdgesElements(graph.edges, performanceEdgesMap, aggregatedData, filter); + + return elements.map(e => { + + let enhancementHtml = ""; + if (e.data.enhancementData != null) { + enhancementHtml = createEdgeStandaloneEnhancements(enhancements, e.data.enhancementData, aggregatedData); + } + + return { + id: Number.parseInt(e.data.id), + html: enhancementHtml, + color: e.data.color, + executionTimeStringRepr: createTimeSpanString(e.data.executionTimeNs, GrpcDurationKind.Nanos), + numberOfExecutions: e.data.weight + } + }); +} + +export function createEnhancedNodes( + graph: GrpcGraph, + aggregatedData: AggregatedData, + enhancements: SoftwareEnhancementKind[], + filter: RegExp | null, +) { + aggregatedData = preprocessFromCSharpInterop(aggregatedData); + let elements = createGraphNodesElements(graph.nodes, aggregatedData, filter); + + return elements.map(e => { + let enhancementHtml = null; + if (e.data.enhancementData != null) { + enhancementHtml = createNodeStandaloneEnhancements(enhancements, e.data.enhancementData, aggregatedData); + } + + return { + id: Number.parseInt(e.data.id), + html: enhancementHtml, + color: getPerformanceAnnotationColor(e.data.executionTimeNs / aggregatedData.totalExecutionTimeNs), + executionTimeStringRepr: createTimeSpanString(e.data.executionTimeNs, GrpcDurationKind.Nanos), + } + }); +} + +function createGraphEdgesElements( edges: GrpcGraphEdge[], performanceMap: Record, aggregatedData: AggregatedData, filter: RegExp | null -): cytoscape.ElementDefinition[] { - let elements: cytoscape.ElementDefinition[] = []; +): CytoscapeElementDef[] { + let elements: CytoscapeElementDef[] = []; let maxWeight = Math.max(...edges.map(e => e.weight)); const minWidth = 5; @@ -239,10 +279,11 @@ export function createGraphEdgesElements( target: edge.toNode.toString(), additionalData: edge.additionalData, enhancementData: getEdgeEnhancementDataOrNull(edge, filter), - executionTime: executionTime, + executionTimeNs: executionTime, weight: edge.weight, width: width, - color: color + color: color, + aggregatedData: aggregatedData } }) } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_renderer.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_renderer.ts index 3d30004b0..609a4fb23 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_renderer.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/graph_renderer.ts @@ -2,11 +2,14 @@ import cytoscape from 'cytoscape'; import {darkTheme, graphColors} from "../colors"; import {createNodeHtmlLabel, createNodeHtmlLabelId} from "./labels/node_html_label"; import {createEdgeHtmlLabel} from "./labels/edge_html_label"; -import {createAggregatedData, createGraphElements} from "./graph_elements"; +import { + createAggregatedData, createEnhancedEdges, createEnhancedNodes, + createGraphElements +} from "./graph_elements"; import {GrpcGraph} from "../protos/ficus/GrpcGraph"; import {GrpcAnnotation} from "../protos/ficus/GrpcAnnotation"; import {AggregatedData, GraphEdge, GraphNode, SoftwareEnhancementKind} from "./types"; -import {createLayout} from "./util"; +import {createLayout, preprocessFromCSharpInterop} from "./util"; import {GrpcGraphKind} from "../protos/ficus/GrpcGraphKind"; import {nodeHeightPx, nodeWidthPx} from "./constants"; @@ -20,6 +23,8 @@ export default setDrawGraph; function setDrawGraph() { (window).drawGraph = drawGraph; (window).createAggregatedData = createAggregatedData; + (window).createEnhancedEdges = createEnhancedEdges; + (window).createEnhancedNodes = createEnhancedNodes; } function drawGraph( @@ -53,27 +58,6 @@ function drawGraph( } } -function preprocessFromCSharpInterop(data: AggregatedData): AggregatedData { - data.globalSoftwareData.counters = toMapCSharpInterop(data.globalSoftwareData.counters); - data.globalSoftwareData.activitiesDurations = toMapCSharpInterop(data.globalSoftwareData.activitiesDurations); - data.globalSoftwareData.histograms = toMapCSharpInterop(data.globalSoftwareData.histograms); - - for (let [key, map] of data.globalSoftwareData.histograms) { - data.globalSoftwareData.histograms.set(key, { - units: map.units, - value: toMapCSharpInterop(map.value), - group: map.group - }); - } - - return data; -} - -function toMapCSharpInterop(map: Map): Map { - // @ts-ignore - return new Map(Object.entries(map)); -} - function updateNodesDimensions(cy: cytoscape.Core, kind: GrpcGraphKind, spacingFactor: number, useLROrientation: boolean) { cy.nodes().forEach(node => { let element = document.getElementById(createNodeHtmlLabelId(node.data().frontendId)); diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/edge_html_label.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/edge_html_label.ts index 925150922..6a7773cdd 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/edge_html_label.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/edge_html_label.ts @@ -1,6 +1,6 @@ -import {AggregatedData, GraphEdge, MergedSoftwareData, SoftwareEnhancementKind} from "../types"; +import {AggregatedData, GraphEdge, MergedEnhancementData, MergedSoftwareData, SoftwareEnhancementKind} from "../types"; import { - createEnhancementContainer, createGroupedEnhancements, createNumberInformation, + createGroupedEnhancements, createNumberInformation, createRectangleHistogram, createTimeSpanString, EnhancementCreationResult, getPercentExecutionTime, @@ -21,14 +21,24 @@ export function createEdgeHtmlLabel(edge: GraphEdge, enhancements: SoftwareEnhan return `
-
- ${createGroupedEnhancements(enhancements, enhancementData, edge.aggregatedData, true, createEdgeEnhancement, true)} -
+ ${createEdgeStandaloneEnhancements(enhancements, enhancementData, edge.aggregatedData)} ${createEdgeExecutionInfo(edge)}
` } +export function createEdgeStandaloneEnhancements( + enhancements: SoftwareEnhancementKind[], + enhancementData: MergedEnhancementData, + aggregatedData: AggregatedData +) { + return ` +
+ ${createGroupedEnhancements(enhancements, enhancementData, aggregatedData, true, createEdgeEnhancement, true)} +
+ ` +} + function createEdgeExecutionInfo(edge: GraphEdge): string { let executionInfo = `
@@ -80,7 +90,7 @@ function createEdgeEnhancement( false, ); - return new EnhancementCreationResult(html, counter.group, false); + return new EnhancementCreationResult(html, counter.group, true); } if (softwareData.activitiesDurations.has(enhancement)) { @@ -95,7 +105,7 @@ function createEdgeEnhancement( false, ); - return new EnhancementCreationResult(html, duration.group, false); + return new EnhancementCreationResult(html, duration.group, true); } return new EnhancementCreationResult("", null); @@ -115,21 +125,19 @@ function createEdgeSoftwareEnhancementPart( let percent = totalSum != null ? ((valuesSum / totalSum) * 100).toFixed(2) : null; return ` -
-
-
-
- ${title} -
-
- ${valuesSum}${units != null ? ` ${units}` : ""} -
-
- ${percent != null ? `${percent}%` : ""} -
+
+
+
+ ${title} +
+
+ ${valuesSum}${units != null ? ` ${units}` : ""} +
+
+ ${percent != null ? `${percent}%` : ""}
- ${createRectangleHistogram(toSortedArray(data), totalSum)}
+ ${createRectangleHistogram(toSortedArray(data), totalSum)}
` } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/node_html_label.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/node_html_label.ts index 62dd1c701..02698b366 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/node_html_label.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/node_html_label.ts @@ -6,7 +6,7 @@ import { import {darkTheme, graphColors} from "../../colors"; import {nodeHeightPx, nodeWidthPx} from "../constants"; import {getOrCreateColor, isNullOrEmpty} from "../../utils"; -import {AggregatedData, GraphNode, MergedSoftwareData, SoftwareEnhancementKind} from "../types"; +import {AggregatedData, GraphNode, MergedEnhancementData, MergedSoftwareData, SoftwareEnhancementKind} from "../types"; import {GrpcUnderlyingPatternKind} from "../../protos/ficus/GrpcUnderlyingPatternKind"; import { createGroupedEnhancements, createNumberInformation, @@ -77,7 +77,22 @@ export function createNodeHtmlLabel( `; } -function createNodeExecutionTimeString(node: GraphNode) { +export function createNodeStandaloneEnhancements( + enhancements: SoftwareEnhancementKind[], + enhancementData: MergedEnhancementData, + aggregatedData: AggregatedData +): string | null { + let groupedEnhancements = createGroupedEnhancements(enhancements, enhancementData, aggregatedData, true, createNodeEnhancement, false); + if (groupedEnhancements.length == 0) return null; + + return ` +
+ ${groupedEnhancements} +
+ ` +} + +function createNodeExecutionTimeString(node: GraphNode): string { return TimeSpan.fromNanoseconds(BigInt(node.executionTimeNs)).toString(); } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/util.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/util.ts index 7f3b852f7..69e5f152f 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/util.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/labels/util.ts @@ -40,7 +40,7 @@ export function createEnhancementContainer( return `
${title}
-
+
${content}
@@ -82,7 +82,7 @@ export function createRectangleHistogram(sortedHistogramEntries: [string, number let borderWidthPx = 6; return ` -
+
+ style="background-color: ${getPerformanceAnnotationColor(value / totalValue)} !important; border-radius: 5px;">
${createNumberInfoHtml(category, displayValue, units, percentString, horizontal)}
diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/types.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/types.ts index f0f90a211..d14a7bef0 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/types.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/types.ts @@ -2,25 +2,33 @@ import {GrpcNodeAdditionalData} from "../protos/ficus/GrpcNodeAdditionalData"; import {GrpcGraph} from "../protos/ficus/GrpcGraph"; import {GrpcTimelineDiagramFragment} from "../protos/ficus/GrpcTimelineDiagramFragment"; import {GrpcDurationKind} from "../protos/ficus/GrpcDurationKind"; +import {GrpcGraphEdgeAdditionalData} from "../protos/ficus/GrpcGraphEdgeAdditionalData"; -export interface GraphNode { - frontendId: number, - label: string, - id: string, - innerGraph?: GrpcGraph, - executionTimeNs: number, - additionalData: GrpcNodeAdditionalData[], - enhancementData: MergedEnhancementData, - aggregatedData: AggregatedData, +export interface CytoscapeElementDef extends cytoscape.ElementDefinition { + data: T } -export interface GraphEdge { +export interface GraphEntity { + label: string, frontendId: number, - additionalData: GrpcNodeAdditionalData[] + id: string, enhancementData: MergedEnhancementData, aggregatedData: AggregatedData, executionTimeNs: number, - weight: number +} + +export interface GraphNode extends GraphEntity { + innerGraph?: GrpcGraph, + additionalData: GrpcNodeAdditionalData[], +} + +export interface GraphEdge extends GraphEntity { + source: string, + target: string, + weight: number, + color: string, + width: number, + additionalData: GrpcGraphEdgeAdditionalData[], } export interface AggregatedData { diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/util.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/util.ts index f486590c2..8cbdb3772 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/util.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/graph/util.ts @@ -1,12 +1,11 @@ import {darkTheme, performanceColors} from "../colors"; import {GrpcNodeAdditionalData} from "../protos/ficus/GrpcNodeAdditionalData"; -import {CountAndSum, GraphEdge, GraphNode, MergedEnhancementData, MergedSoftwareData} from "./types"; +import {AggregatedData, CountAndSum, GraphEdge, GraphNode, MergedEnhancementData, MergedSoftwareData} from "./types"; import {GrpcGraphNode} from "../protos/ficus/GrpcGraphNode"; import {GrpcSoftwareData} from "../protos/ficus/GrpcSoftwareData"; import {GrpcUnderlyingPatternInfo} from "../protos/ficus/GrpcUnderlyingPatternInfo"; import {GrpcGraphEdgeAdditionalData} from "../protos/ficus/GrpcGraphEdgeAdditionalData"; import {GrpcGraphEdge} from "../protos/ficus/GrpcGraphEdge"; -import {GrpcMethodNameParts} from "../protos/ficus/GrpcMethodNameParts"; import {GrpcGraphKind} from "../protos/ficus/GrpcGraphKind"; import cytoscape from "cytoscape"; import dagre from 'cytoscape-dagre'; @@ -22,6 +21,8 @@ export function createLayout(kind: GrpcGraphKind, spacingFactor: number = 1, use return createGridLayout(spacingFactor, useLROrientation); case GrpcGraphKind.DAG: return createDagreLayout(spacingFactor, useLROrientation); + case GrpcGraphKind.DagLCS: + return createDagreLayout(spacingFactor, useLROrientation); } } @@ -254,4 +255,48 @@ const performanceColor = performanceColors(darkTheme); export function getPerformanceAnnotationColor(relativeExecutionTime: number) { let colorName = `color${(Math.floor(relativeExecutionTime * 10) % 100).toString()}`; return performanceColor[colorName]; +} + +export function preprocessFromCSharpInterop(data: AggregatedData): AggregatedData { + data.globalSoftwareData.counters = toMapCSharpInterop(data.globalSoftwareData.counters); + data.globalSoftwareData.activitiesDurations = toMapCSharpInterop(data.globalSoftwareData.activitiesDurations); + data.globalSoftwareData.histograms = toMapCSharpInterop(data.globalSoftwareData.histograms); + + for (let [key, map] of data.globalSoftwareData.histograms) { + data.globalSoftwareData.histograms.set(key, { + units: map.units, + value: toMapCSharpInterop(map.value), + group: map.group + }); + } + + return data; +} + +function toMapCSharpInterop(map: Map): Map { + // @ts-ignore + return new Map(Object.entries(map)); +} + +export function preprocessForCSharpInterop(data: AggregatedData): AggregatedData { + //JS Map can not be converted to C# Dictionary + data.globalSoftwareData.counters = toObjectCsharpInterop(data.globalSoftwareData.counters); + data.globalSoftwareData.activitiesDurations = toObjectCsharpInterop(data.globalSoftwareData.activitiesDurations); + + for (let [key, map] of data.globalSoftwareData.histograms) { + data.globalSoftwareData.histograms.set(key, { + units: map.units, + value: toObjectCsharpInterop(map.value), + group: map.group + }); + } + + data.globalSoftwareData.histograms = toObjectCsharpInterop(data.globalSoftwareData.histograms); + + return data; +} + +function toObjectCsharpInterop(map: Map): Map { + // @ts-ignore + return Object.fromEntries(map); } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/index.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/index.ts index ed0ea9b6f..478cff993 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/index.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/index.ts @@ -7,6 +7,7 @@ import {setCanvasSizeFunctions} from "./canvas_size"; import {setFullscreenFunctions} from "./full_screen"; import {addPieChartCustomElements} from "./piechart"; import {setGraphEventListeners} from "./graph/event_listeners"; +import {setOcelSankeyFunctions} from "./ocel/ocel_sankey_divs"; setFullscreenFunctions(); setDrawPetriNet(); @@ -15,6 +16,7 @@ setUtilitiesFunctions(); setCssLoaderFunctions(); setDrawColorsLog(); setCanvasSizeFunctions(); +setOcelSankeyFunctions(); addPieChartCustomElements(); diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/ocel/ocel_sankey_divs.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/ocel/ocel_sankey_divs.ts new file mode 100644 index 000000000..383bfe950 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/ocel/ocel_sankey_divs.ts @@ -0,0 +1,111 @@ +export function setOcelSankeyFunctions() { + (window).createOcelSankeyConnections = createOcelSankeyConnections; +} + +interface ObjectsRelation { + id: string + currentNodeId: number + fromNodeId: number + relatedObjectsIds: string[] +} + +interface Position { + left: number + top: number + width: number + height: number +} + +function createOcelSankeyConnections( + parentContainerId: string, + baseIdPart: string, + relations: ObjectsRelation[], + topToBottom: boolean, +) { + let getInitialClass = (isInitialState: boolean) => isInitialState ? "initial" : "final"; + let createId = (nodeId: number, objectId: string, isInitialState: boolean) => { + const Delimiter = "-"; + return baseIdPart + Delimiter + nodeId + Delimiter + getInitialClass(isInitialState) + Delimiter + objectId; + }; + + let offsetsMap = new Map(); + + let getElementPosition = (nodeId: number, objectId: string, isInitialState: boolean): Position | null => { + let id = createId(nodeId, objectId, isInitialState); + if (!offsetsMap.has(id)) { + let element = document.getElementById(id); + + if (element == null) { + console.warn(`Failed to get element with id ${id}`); + return null; + } + + offsetsMap.set(id, getPosition(element)); + } + + return offsetsMap.get(id); + }; + + let parentContainer = document.getElementById(parentContainerId); + if (parentContainer == null) return; + + for (let relation of relations) { + let firstPos = getElementPosition(relation.currentNodeId, relation.id, true); + if (firstPos == null) continue; + + for (let relatedId of relation.relatedObjectsIds) { + let secondPos = getElementPosition(relation.fromNodeId, relatedId, false); + if (secondPos == null) continue; + + connect(parentContainer, firstPos, secondPos, "#918e8e", 1, topToBottom); + } + } +} + +function getPosition(el: HTMLElement): Position { + return { + left: el.offsetLeft, + top: el.offsetTop, + width: el.offsetWidth, + height: el.offsetHeight, + }; +} + +function connect( + parentContainer: HTMLElement, + firstPos: Position, + secondPos: Position, + color: string, + thickness: number, + topToBottom: boolean +) { + let firstX = firstPos.left + (topToBottom ? firstPos.width / 2 : 0); + let firstY = firstPos.top + (topToBottom ? 0 : firstPos.height / 2); + + let secondX = secondPos.left + (topToBottom ? secondPos.width / 2 : secondPos.width); + let secondY = secondPos.top + (topToBottom ? secondPos.height : secondPos.height / 2); + + let length = Math.sqrt(((secondX - firstX) * (secondX - firstX)) + ((secondY - firstY) * (secondY - firstY))); + + let cx = ((firstX + secondX) / 2) - (length / 2); + let cy = ((firstY + secondY) / 2) - (thickness / 2); + + let angle = Math.atan2((firstY - secondY), (firstX - secondX)) * (180 / Math.PI); + + let html = ` +
+
+ `; + + parentContainer.innerHTML += html; +} \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/backend_service.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/backend_service.ts index a66cec612..0fe6250e0 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/backend_service.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/backend_service.ts @@ -69,12 +69,22 @@ export interface ProtoGrpcType { GrpcMatrixRow: MessageTypeDefinition GrpcMethodInliningInfo: MessageTypeDefinition GrpcMethodNameParts: MessageTypeDefinition + GrpcModelElementOcelAnnotation: MessageTypeDefinition GrpcMultithreadedFragment: MessageTypeDefinition GrpcNamesEventLog: MessageTypeDefinition GrpcNamesEventLogContextValue: MessageTypeDefinition GrpcNamesTrace: MessageTypeDefinition GrpcNodeAdditionalData: MessageTypeDefinition GrpcNodeCorrespondingTraceData: MessageTypeDefinition + GrpcOcelAllocateMerge: MessageTypeDefinition + GrpcOcelConsumeProduce: MessageTypeDefinition + GrpcOcelData: MessageTypeDefinition + GrpcOcelModelAnnotation: MessageTypeDefinition + GrpcOcelObjectTypeData: MessageTypeDefinition + GrpcOcelObjectTypeState: MessageTypeDefinition + GrpcOcelProducedObject: MessageTypeDefinition + GrpcOcelState: MessageTypeDefinition + GrpcOcelStateObjectRelation: MessageTypeDefinition GrpcParallelPipelinePart: MessageTypeDefinition GrpcParallelPipelineParts: MessageTypeDefinition GrpcPetriNet: MessageTypeDefinition diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/context_values_service.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/context_values_service.ts index 0c0e13021..4a4e99887 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/context_values_service.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/context_values_service.ts @@ -66,12 +66,22 @@ export interface ProtoGrpcType { GrpcMatrixRow: MessageTypeDefinition GrpcMethodInliningInfo: MessageTypeDefinition GrpcMethodNameParts: MessageTypeDefinition + GrpcModelElementOcelAnnotation: MessageTypeDefinition GrpcMultithreadedFragment: MessageTypeDefinition GrpcNamesEventLog: MessageTypeDefinition GrpcNamesEventLogContextValue: MessageTypeDefinition GrpcNamesTrace: MessageTypeDefinition GrpcNodeAdditionalData: MessageTypeDefinition GrpcNodeCorrespondingTraceData: MessageTypeDefinition + GrpcOcelAllocateMerge: MessageTypeDefinition + GrpcOcelConsumeProduce: MessageTypeDefinition + GrpcOcelData: MessageTypeDefinition + GrpcOcelModelAnnotation: MessageTypeDefinition + GrpcOcelObjectTypeData: MessageTypeDefinition + GrpcOcelObjectTypeState: MessageTypeDefinition + GrpcOcelProducedObject: MessageTypeDefinition + GrpcOcelState: MessageTypeDefinition + GrpcOcelStateObjectRelation: MessageTypeDefinition GrpcParallelPipelinePart: MessageTypeDefinition GrpcParallelPipelineParts: MessageTypeDefinition GrpcPetriNet: MessageTypeDefinition diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcContextValue.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcContextValue.ts index 167041bb8..fb8cedc88 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcContextValue.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcContextValue.ts @@ -20,6 +20,7 @@ import type { GrpcFloatArray_DONTUSE as _ficus_GrpcFloatArray_DONTUSE, GrpcFloat import type { GrpcIntArray_DONTUSE as _ficus_GrpcIntArray_DONTUSE, GrpcIntArray as _ficus_GrpcIntArray } from '../ficus/GrpcIntArray'; import type { GrpcUintArray_DONTUSE as _ficus_GrpcUintArray_DONTUSE, GrpcUintArray as _ficus_GrpcUintArray } from '../ficus/GrpcUintArray'; import type { GrpcSimpleEventLog_DONTUSE as _ficus_GrpcSimpleEventLog_DONTUSE, GrpcSimpleEventLog as _ficus_GrpcSimpleEventLog } from '../ficus/GrpcSimpleEventLog'; +import type { GrpcOcelModelAnnotation_DONTUSE as _ficus_GrpcOcelModelAnnotation_DONTUSE, GrpcOcelModelAnnotation as _ficus_GrpcOcelModelAnnotation } from '../ficus/GrpcOcelModelAnnotation'; export interface GrpcContextValue_DONTUSE { 'string'?: (string); @@ -48,7 +49,8 @@ export interface GrpcContextValue_DONTUSE { 'uintArray'?: (_ficus_GrpcUintArray_DONTUSE | null); 'json'?: (string); 'eventLog'?: (_ficus_GrpcSimpleEventLog_DONTUSE | null); - 'contextValue'?: "string"|"hashesLog"|"namesLog"|"uint32"|"tracesSubArrays"|"traceIndexSubArrays"|"bool"|"xesEventLog"|"colorsLog"|"enum"|"eventLogInfo"|"strings"|"pipeline"|"petriNet"|"graph"|"float"|"annotation"|"dataset"|"labeledDataset"|"bytes"|"logTimelineDiagram"|"floatArray"|"intArray"|"uintArray"|"json"|"eventLog"; + 'ocelAnnotation'?: (_ficus_GrpcOcelModelAnnotation_DONTUSE | null); + 'contextValue'?: "string"|"hashesLog"|"namesLog"|"uint32"|"tracesSubArrays"|"traceIndexSubArrays"|"bool"|"xesEventLog"|"colorsLog"|"enum"|"eventLogInfo"|"strings"|"pipeline"|"petriNet"|"graph"|"float"|"annotation"|"dataset"|"labeledDataset"|"bytes"|"logTimelineDiagram"|"floatArray"|"intArray"|"uintArray"|"json"|"eventLog"|"ocelAnnotation"; } export interface GrpcContextValue { @@ -78,5 +80,6 @@ export interface GrpcContextValue { 'uintArray'?: (_ficus_GrpcUintArray | null); 'json'?: (string); 'eventLog'?: (_ficus_GrpcSimpleEventLog | null); - 'contextValue': "string"|"hashesLog"|"namesLog"|"uint32"|"tracesSubArrays"|"traceIndexSubArrays"|"bool"|"xesEventLog"|"colorsLog"|"enum"|"eventLogInfo"|"strings"|"pipeline"|"petriNet"|"graph"|"float"|"annotation"|"dataset"|"labeledDataset"|"bytes"|"logTimelineDiagram"|"floatArray"|"intArray"|"uintArray"|"json"|"eventLog"; + 'ocelAnnotation'?: (_ficus_GrpcOcelModelAnnotation | null); + 'contextValue': "string"|"hashesLog"|"namesLog"|"uint32"|"tracesSubArrays"|"traceIndexSubArrays"|"bool"|"xesEventLog"|"colorsLog"|"enum"|"eventLogInfo"|"strings"|"pipeline"|"petriNet"|"graph"|"float"|"annotation"|"dataset"|"labeledDataset"|"bytes"|"logTimelineDiagram"|"floatArray"|"intArray"|"uintArray"|"json"|"eventLog"|"ocelAnnotation"; } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcGraphKind.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcGraphKind.ts index ddbd093c8..79ff35742 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcGraphKind.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcGraphKind.ts @@ -3,6 +3,7 @@ export const GrpcGraphKind = { None: 0, DAG: 1, + DagLCS: 2, } as const; export type GrpcGraphKind_DONTUSE = @@ -10,5 +11,7 @@ export type GrpcGraphKind_DONTUSE = | 0 | 'DAG' | 1 + | 'DagLCS' + | 2 export type GrpcGraphKind = typeof GrpcGraphKind[keyof typeof GrpcGraphKind] diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcMergedObjectAllocation.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcMergedObjectAllocation.ts new file mode 100644 index 000000000..e80644bb3 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcMergedObjectAllocation.ts @@ -0,0 +1,10 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcMergedObjectAllocation_DONTUSE { + 'consumedObjectsIds'?: (string)[]; +} + +export interface GrpcMergedObjectAllocation { + 'consumedObjectsIds': (string)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcModelElementOcelAnnotation.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcModelElementOcelAnnotation.ts new file mode 100644 index 000000000..abe794cc7 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcModelElementOcelAnnotation.ts @@ -0,0 +1,21 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { GrpcOcelState_DONTUSE as _ficus_GrpcOcelState_DONTUSE, GrpcOcelState as _ficus_GrpcOcelState } from '../ficus/GrpcOcelState'; +import type { GrpcOcelStateObjectRelation_DONTUSE as _ficus_GrpcOcelStateObjectRelation_DONTUSE, GrpcOcelStateObjectRelation as _ficus_GrpcOcelStateObjectRelation } from '../ficus/GrpcOcelStateObjectRelation'; +import type { Long } from '@grpc/proto-loader'; + +export interface GrpcModelElementOcelAnnotation_DONTUSE { + 'elementId'?: (number | string | Long); + 'initialState'?: (_ficus_GrpcOcelState_DONTUSE | null); + 'finalState'?: (_ficus_GrpcOcelState_DONTUSE | null); + 'relations'?: (_ficus_GrpcOcelStateObjectRelation_DONTUSE)[]; + '_initialState'?: "initialState"; +} + +export interface GrpcModelElementOcelAnnotation { + 'elementId': (number); + 'initialState'?: (_ficus_GrpcOcelState | null); + 'finalState': (_ficus_GrpcOcelState | null); + 'relations': (_ficus_GrpcOcelStateObjectRelation)[]; + '_initialState': "initialState"; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelAllocateMerge.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelAllocateMerge.ts new file mode 100644 index 000000000..116e889cd --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelAllocateMerge.ts @@ -0,0 +1,14 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcOcelAllocateMerge_DONTUSE { + 'type'?: (string); + 'mergedObjectsIds'?: (string)[]; + '_type'?: "type"; +} + +export interface GrpcOcelAllocateMerge { + 'type'?: (string); + 'mergedObjectsIds': (string)[]; + '_type': "type"; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelConsumeProduce.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelConsumeProduce.ts new file mode 100644 index 000000000..1ee261c08 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelConsumeProduce.ts @@ -0,0 +1,11 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { GrpcOcelProducedObject_DONTUSE as _ficus_GrpcOcelProducedObject_DONTUSE, GrpcOcelProducedObject as _ficus_GrpcOcelProducedObject } from '../ficus/GrpcOcelProducedObject'; + +export interface GrpcOcelConsumeProduce_DONTUSE { + 'producedObjects'?: (_ficus_GrpcOcelProducedObject_DONTUSE)[]; +} + +export interface GrpcOcelConsumeProduce { + 'producedObjects': (_ficus_GrpcOcelProducedObject)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelData.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelData.ts new file mode 100644 index 000000000..f7510f019 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelData.ts @@ -0,0 +1,23 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { GrpcOcelObjectTypeData_DONTUSE as _ficus_GrpcOcelObjectTypeData_DONTUSE, GrpcOcelObjectTypeData as _ficus_GrpcOcelObjectTypeData } from '../ficus/GrpcOcelObjectTypeData'; +import type { GrpcOcelAllocateMerge_DONTUSE as _ficus_GrpcOcelAllocateMerge_DONTUSE, GrpcOcelAllocateMerge as _ficus_GrpcOcelAllocateMerge } from '../ficus/GrpcOcelAllocateMerge'; +import type { GrpcOcelConsumeProduce_DONTUSE as _ficus_GrpcOcelConsumeProduce_DONTUSE, GrpcOcelConsumeProduce as _ficus_GrpcOcelConsumeProduce } from '../ficus/GrpcOcelConsumeProduce'; + +export interface GrpcOcelData_DONTUSE { + 'objectId'?: (string); + 'allocate'?: (_ficus_GrpcOcelObjectTypeData_DONTUSE | null); + 'consume'?: (_ficus_GrpcOcelObjectTypeData_DONTUSE | null); + 'mergedObjectAllocation'?: (_ficus_GrpcOcelAllocateMerge_DONTUSE | null); + 'produceObjectConsumption'?: (_ficus_GrpcOcelConsumeProduce_DONTUSE | null); + 'action'?: "allocate"|"consume"|"mergedObjectAllocation"|"produceObjectConsumption"; +} + +export interface GrpcOcelData { + 'objectId': (string); + 'allocate'?: (_ficus_GrpcOcelObjectTypeData | null); + 'consume'?: (_ficus_GrpcOcelObjectTypeData | null); + 'mergedObjectAllocation'?: (_ficus_GrpcOcelAllocateMerge | null); + 'produceObjectConsumption'?: (_ficus_GrpcOcelConsumeProduce | null); + 'action': "allocate"|"consume"|"mergedObjectAllocation"|"produceObjectConsumption"; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelModelAnnotation.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelModelAnnotation.ts new file mode 100644 index 000000000..dc0b06227 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelModelAnnotation.ts @@ -0,0 +1,11 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { GrpcModelElementOcelAnnotation_DONTUSE as _ficus_GrpcModelElementOcelAnnotation_DONTUSE, GrpcModelElementOcelAnnotation as _ficus_GrpcModelElementOcelAnnotation } from '../ficus/GrpcModelElementOcelAnnotation'; + +export interface GrpcOcelModelAnnotation_DONTUSE { + 'annotations'?: (_ficus_GrpcModelElementOcelAnnotation_DONTUSE)[]; +} + +export interface GrpcOcelModelAnnotation { + 'annotations': (_ficus_GrpcModelElementOcelAnnotation)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectTypeData.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectTypeData.ts new file mode 100644 index 000000000..ae0876800 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectTypeData.ts @@ -0,0 +1,12 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcOcelObjectTypeData_DONTUSE { + 'type'?: (string); + '_type'?: "type"; +} + +export interface GrpcOcelObjectTypeData { + 'type'?: (string); + '_type': "type"; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectTypeState.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectTypeState.ts new file mode 100644 index 000000000..41fe64afa --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectTypeState.ts @@ -0,0 +1,12 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcOcelObjectTypeState_DONTUSE { + 'type'?: (string); + 'objectIds'?: (string)[]; +} + +export interface GrpcOcelObjectTypeState { + 'type': (string); + 'objectIds': (string)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectsRelation.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectsRelation.ts new file mode 100644 index 000000000..5e3d14635 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelObjectsRelation.ts @@ -0,0 +1,13 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { Long } from '@grpc/proto-loader'; + +export interface GrpcOcelObjectsRelation_DONTUSE { + 'fromElementId'?: (number | string | Long); + 'objectId'?: (string); +} + +export interface GrpcOcelObjectsRelation { + 'fromElementId': (number); + 'objectId': (string); +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelProducedObject.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelProducedObject.ts new file mode 100644 index 000000000..68d2d6731 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelProducedObject.ts @@ -0,0 +1,14 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcOcelProducedObject_DONTUSE { + 'id'?: (string); + 'type'?: (string); + '_type'?: "type"; +} + +export interface GrpcOcelProducedObject { + 'id': (string); + 'type'?: (string); + '_type': "type"; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelSingleElementObjectsRelation.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelSingleElementObjectsRelation.ts new file mode 100644 index 000000000..1bcd70cd3 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelSingleElementObjectsRelation.ts @@ -0,0 +1,13 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { Long } from '@grpc/proto-loader'; + +export interface GrpcOcelSingleElementObjectsRelation_DONTUSE { + 'elementId'?: (number | string | Long); + 'ids'?: (string)[]; +} + +export interface GrpcOcelSingleElementObjectsRelation { + 'elementId': (number); + 'ids': (string)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelState.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelState.ts new file mode 100644 index 000000000..f2c0b6cb2 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelState.ts @@ -0,0 +1,11 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { GrpcOcelObjectTypeState_DONTUSE as _ficus_GrpcOcelObjectTypeState_DONTUSE, GrpcOcelObjectTypeState as _ficus_GrpcOcelObjectTypeState } from '../ficus/GrpcOcelObjectTypeState'; + +export interface GrpcOcelState_DONTUSE { + 'typeStates'?: (_ficus_GrpcOcelObjectTypeState_DONTUSE)[]; +} + +export interface GrpcOcelState { + 'typeStates': (_ficus_GrpcOcelObjectTypeState)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelStateObjectMapping.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelStateObjectMapping.ts new file mode 100644 index 000000000..49edc275f --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelStateObjectMapping.ts @@ -0,0 +1,12 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcOcelStateObjectMapping_DONTUSE { + 'objectId'?: (string); + 'relatedObjectsIds'?: (string)[]; +} + +export interface GrpcOcelStateObjectMapping { + 'objectId': (string); + 'relatedObjectsIds': (string)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelStateObjectRelation.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelStateObjectRelation.ts new file mode 100644 index 000000000..3b2270329 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcOcelStateObjectRelation.ts @@ -0,0 +1,15 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + +import type { Long } from '@grpc/proto-loader'; + +export interface GrpcOcelStateObjectRelation_DONTUSE { + 'objectId'?: (string); + 'elementId'?: (number | string | Long); + 'relatedObjectsIds'?: (string)[]; +} + +export interface GrpcOcelStateObjectRelation { + 'objectId': (string); + 'elementId': (number); + 'relatedObjectsIds': (string)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcProduceObjectConsumption.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcProduceObjectConsumption.ts new file mode 100644 index 000000000..c6339c166 --- /dev/null +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcProduceObjectConsumption.ts @@ -0,0 +1,10 @@ +// Original file: ../../../../../protos/pipelines_and_context.proto + + +export interface GrpcProduceObjectConsumption_DONTUSE { + 'producedObjectsIds'?: (string)[]; +} + +export interface GrpcProduceObjectConsumption { + 'producedObjectsIds': (string)[]; +} diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcSoftwareData.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcSoftwareData.ts index 2e8b1f248..1b4ebcc27 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcSoftwareData.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/ficus/GrpcSoftwareData.ts @@ -5,6 +5,7 @@ import type { GrpcTimelineDiagramFragment_DONTUSE as _ficus_GrpcTimelineDiagramF import type { GrpcGeneralHistogramData_DONTUSE as _ficus_GrpcGeneralHistogramData_DONTUSE, GrpcGeneralHistogramData as _ficus_GrpcGeneralHistogramData } from '../ficus/GrpcGeneralHistogramData'; import type { GrpcSimpleCounterData_DONTUSE as _ficus_GrpcSimpleCounterData_DONTUSE, GrpcSimpleCounterData as _ficus_GrpcSimpleCounterData } from '../ficus/GrpcSimpleCounterData'; import type { GrpcActivityDurationData_DONTUSE as _ficus_GrpcActivityDurationData_DONTUSE, GrpcActivityDurationData as _ficus_GrpcActivityDurationData } from '../ficus/GrpcActivityDurationData'; +import type { GrpcOcelData_DONTUSE as _ficus_GrpcOcelData_DONTUSE, GrpcOcelData as _ficus_GrpcOcelData } from '../ficus/GrpcOcelData'; export interface GrpcSoftwareData_DONTUSE { 'histogram'?: (_ficus_GrpcHistogramEntry_DONTUSE)[]; @@ -12,6 +13,7 @@ export interface GrpcSoftwareData_DONTUSE { 'histogramData'?: (_ficus_GrpcGeneralHistogramData_DONTUSE)[]; 'simpleCounterData'?: (_ficus_GrpcSimpleCounterData_DONTUSE)[]; 'activitiesDurationsData'?: (_ficus_GrpcActivityDurationData_DONTUSE)[]; + 'ocelData'?: (_ficus_GrpcOcelData_DONTUSE)[]; } export interface GrpcSoftwareData { @@ -20,4 +22,5 @@ export interface GrpcSoftwareData { 'histogramData': (_ficus_GrpcGeneralHistogramData)[]; 'simpleCounterData': (_ficus_GrpcSimpleCounterData)[]; 'activitiesDurationsData': (_ficus_GrpcActivityDurationData)[]; + 'ocelData': (_ficus_GrpcOcelData)[]; } diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/front_contract.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/front_contract.ts index a58538381..095dad5cb 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/front_contract.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/front_contract.ts @@ -68,12 +68,22 @@ export interface ProtoGrpcType { GrpcMatrixRow: MessageTypeDefinition GrpcMethodInliningInfo: MessageTypeDefinition GrpcMethodNameParts: MessageTypeDefinition + GrpcModelElementOcelAnnotation: MessageTypeDefinition GrpcMultithreadedFragment: MessageTypeDefinition GrpcNamesEventLog: MessageTypeDefinition GrpcNamesEventLogContextValue: MessageTypeDefinition GrpcNamesTrace: MessageTypeDefinition GrpcNodeAdditionalData: MessageTypeDefinition GrpcNodeCorrespondingTraceData: MessageTypeDefinition + GrpcOcelAllocateMerge: MessageTypeDefinition + GrpcOcelConsumeProduce: MessageTypeDefinition + GrpcOcelData: MessageTypeDefinition + GrpcOcelModelAnnotation: MessageTypeDefinition + GrpcOcelObjectTypeData: MessageTypeDefinition + GrpcOcelObjectTypeState: MessageTypeDefinition + GrpcOcelProducedObject: MessageTypeDefinition + GrpcOcelState: MessageTypeDefinition + GrpcOcelStateObjectRelation: MessageTypeDefinition GrpcParallelPipelinePart: MessageTypeDefinition GrpcParallelPipelineParts: MessageTypeDefinition GrpcPetriNet: MessageTypeDefinition diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/kafka_service.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/kafka_service.ts index 75d6e7fbc..96c3cba07 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/kafka_service.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/kafka_service.ts @@ -83,12 +83,22 @@ export interface ProtoGrpcType { GrpcMatrixRow: MessageTypeDefinition GrpcMethodInliningInfo: MessageTypeDefinition GrpcMethodNameParts: MessageTypeDefinition + GrpcModelElementOcelAnnotation: MessageTypeDefinition GrpcMultithreadedFragment: MessageTypeDefinition GrpcNamesEventLog: MessageTypeDefinition GrpcNamesEventLogContextValue: MessageTypeDefinition GrpcNamesTrace: MessageTypeDefinition GrpcNodeAdditionalData: MessageTypeDefinition GrpcNodeCorrespondingTraceData: MessageTypeDefinition + GrpcOcelAllocateMerge: MessageTypeDefinition + GrpcOcelConsumeProduce: MessageTypeDefinition + GrpcOcelData: MessageTypeDefinition + GrpcOcelModelAnnotation: MessageTypeDefinition + GrpcOcelObjectTypeData: MessageTypeDefinition + GrpcOcelObjectTypeState: MessageTypeDefinition + GrpcOcelProducedObject: MessageTypeDefinition + GrpcOcelState: MessageTypeDefinition + GrpcOcelStateObjectRelation: MessageTypeDefinition GrpcParallelPipelinePart: MessageTypeDefinition GrpcParallelPipelineParts: MessageTypeDefinition GrpcPetriNet: MessageTypeDefinition diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/pipelines_and_context.ts b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/pipelines_and_context.ts index 9d98744fc..4a45d651c 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/pipelines_and_context.ts +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Npm/src/protos/pipelines_and_context.ts @@ -62,12 +62,22 @@ export interface ProtoGrpcType { GrpcMatrixRow: MessageTypeDefinition GrpcMethodInliningInfo: MessageTypeDefinition GrpcMethodNameParts: MessageTypeDefinition + GrpcModelElementOcelAnnotation: MessageTypeDefinition GrpcMultithreadedFragment: MessageTypeDefinition GrpcNamesEventLog: MessageTypeDefinition GrpcNamesEventLogContextValue: MessageTypeDefinition GrpcNamesTrace: MessageTypeDefinition GrpcNodeAdditionalData: MessageTypeDefinition GrpcNodeCorrespondingTraceData: MessageTypeDefinition + GrpcOcelAllocateMerge: MessageTypeDefinition + GrpcOcelConsumeProduce: MessageTypeDefinition + GrpcOcelData: MessageTypeDefinition + GrpcOcelModelAnnotation: MessageTypeDefinition + GrpcOcelObjectTypeData: MessageTypeDefinition + GrpcOcelObjectTypeState: MessageTypeDefinition + GrpcOcelProducedObject: MessageTypeDefinition + GrpcOcelState: MessageTypeDefinition + GrpcOcelStateObjectRelation: MessageTypeDefinition GrpcParallelPipelinePart: MessageTypeDefinition GrpcParallelPipelineParts: MessageTypeDefinition GrpcPetriNet: MessageTypeDefinition diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Services/EntitiesColors.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Services/EntitiesColors.cs index 98ccd60aa..84fa1d887 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Services/EntitiesColors.cs +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Services/EntitiesColors.cs @@ -1,4 +1,6 @@ -namespace FicusDashboard.Services; +using System.Text; + +namespace FicusDashboard.Services; public interface IEntitiesColors { @@ -34,5 +36,16 @@ private string NextColor(string key) return color; } - private static string GenerateRandomColor() => $"#{Random.Shared.Next(0x1000000):X6}"; + private static string GenerateRandomColor() + { + var sb = new StringBuilder(); + sb.Append('#'); + + for (var i = 0; i < 6; ++i) + { + sb.Append(Math.Floor(Random.Shared.NextDouble() * 8)); + } + + return sb.ToString(); + } } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/Utils/UserData.cs b/Ficus/src/front/FicusFrontend/FicusDashboard/Utils/UserData.cs index e15eb2725..f7492899b 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/Utils/UserData.cs +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/Utils/UserData.cs @@ -40,22 +40,25 @@ public sealed class UserDataHolder : UserDataHolderBase public static class ExtensionsForUserData { - public static T GetOrCreate(this UserDataHolder holder, Key key, Func valueFactory) where T : notnull + extension(UserDataHolder holder) { - if (holder.TryGetData(key, out var existingValue)) + public T GetOrCreate(Key key, Func valueFactory) where T : notnull { - return existingValue; - } + if (holder.TryGetData(key, out var existingValue)) + { + return existingValue; + } - var createdValue = valueFactory(); - holder.PutData(key, createdValue); - return createdValue; - } + var createdValue = valueFactory(); + holder.PutData(key, createdValue); + return createdValue; + } - public static T GetOrThrow(this UserDataHolder holder, Key key) - { - if (holder.TryGetData(key, out var value)) return value; + public T GetOrThrow(Key key) + { + if (holder.TryGetData(key, out var value)) return value; - throw new KeyNotFoundException(key.Name); + throw new KeyNotFoundException(key.Name); + } } } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboard/wwwroot/css/app.css b/Ficus/src/front/FicusFrontend/FicusDashboard/wwwroot/css/app.css index 6e36d7e00..58b9262bf 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboard/wwwroot/css/app.css +++ b/Ficus/src/front/FicusFrontend/FicusDashboard/wwwroot/css/app.css @@ -29,21 +29,24 @@ html, body { --processes-section-case-background-darker: #2e3333; --processes-section-case-background-hovered-darker: #383e3e; --processes-section-cases-collapsed-bakground-darker: #272b2b; - + --input-background: #323232; --input-foreground: #ffffff; --input-border-color: #101010; - + --aggregated-data-background: #202020; --aggregated-stat-item-background: #404040; --aggregated-stat-item-value-background: #303030; - + --tree-view-notification-container-color: #151515; - + --new-notification-color: greenyellow; --updated--notification-color: yellow; --seen-notification-color: grey; + --flamegraph-node-background: #595959; + --flamegraph-edge-background: #3b3b3b; + -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer */ -khtml-user-select: none; /* KHTML browsers (e.g. Konqueror) */ @@ -60,12 +63,32 @@ input { padding: 5px !important; } -::-webkit-scrollbar { width: 10px; height: 10px;} -::-webkit-scrollbar-button { background-color: #666; } -::-webkit-scrollbar-track { background-color: #999;} -::-webkit-scrollbar-track-piece { background-color: #252525;} -::-webkit-scrollbar-thumb { height: 50px; background-color: #666; border-radius: 3px;} -::-webkit-resizer { background-color: #666;} +::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +::-webkit-scrollbar-button { + background-color: #666; +} + +::-webkit-scrollbar-track { + background-color: #999; +} + +::-webkit-scrollbar-track-piece { + background-color: #252525; +} + +::-webkit-scrollbar-thumb { + height: 50px; + background-color: #666; + border-radius: 3px; +} + +::-webkit-resizer { + background-color: #666; +} ::-webkit-scrollbar { display: none; @@ -85,6 +108,12 @@ input { justify-content: flex-start; } +.flex-centered { + display: flex; + align-items: center; + justify-content: center; +} + h1:focus { outline: none; } @@ -207,7 +236,7 @@ svg-pie-chart svg { .graph-title-label { background: #3b3b3b; border-radius: 3px; - width: fit-content; + width: 100%; color: white; padding: 2px; display: flex; @@ -222,9 +251,10 @@ svg-pie-chart svg { .graph-content-container { background: #5d5d5d; width: fit-content; - height: fit-content; padding: 5px; - border-radius: 5px; + display: flex; + flex-direction: column; + justify-content: center; } .update-notification { @@ -237,4 +267,32 @@ svg-pie-chart svg { .seen-notification { background-color: var(--seen-notification-color); +} + +.flamegraph-node { + background: var(--flamegraph-node-background); + text-align: center; + display: flex; + flex-direction: column; +} + +.flamegraph-edge { + background: var(--flamegraph-edge-background); + padding: 2px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.flamegraph-separator-edge { + background: transparent; +} + +.flamegraph-node-title { + font-size: 18px; +} + +.flamegraph-ocel-annotation { + font-size: 14px; } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusDashboardBackend/FicusDashboardBackend.csproj b/Ficus/src/front/FicusFrontend/FicusDashboardBackend/FicusDashboardBackend.csproj index 8546418e5..c45ce1760 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboardBackend/FicusDashboardBackend.csproj +++ b/Ficus/src/front/FicusFrontend/FicusDashboardBackend/FicusDashboardBackend.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable Linux diff --git a/Ficus/src/front/FicusFrontend/FicusDashboardBackend/Utils/SemaphoreSlimExtensions.cs b/Ficus/src/front/FicusFrontend/FicusDashboardBackend/Utils/SemaphoreSlimExtensions.cs index 14320e199..5a8980f05 100644 --- a/Ficus/src/front/FicusFrontend/FicusDashboardBackend/Utils/SemaphoreSlimExtensions.cs +++ b/Ficus/src/front/FicusFrontend/FicusDashboardBackend/Utils/SemaphoreSlimExtensions.cs @@ -2,29 +2,32 @@ namespace FicusDashboardBackend.Utils; public static class SemaphoreSlimExtensions { - public static async Task Execute(this SemaphoreSlim semaphoreSlim, Func action) + extension(SemaphoreSlim semaphoreSlim) { - try + public async Task Execute(Func action) { - await semaphoreSlim.WaitAsync(); - await action(); + try + { + await semaphoreSlim.WaitAsync(); + await action(); + } + finally + { + semaphoreSlim.Release(); + } } - finally - { - semaphoreSlim.Release(); - } - } - public static async Task Execute(this SemaphoreSlim semaphoreSlim, Func> action) - { - try - { - await semaphoreSlim.WaitAsync(); - return await action(); - } - finally + public async Task Execute(Func> action) { - semaphoreSlim.Release(); + try + { + await semaphoreSlim.WaitAsync(); + return await action(); + } + finally + { + semaphoreSlim.Release(); + } } } } \ No newline at end of file diff --git a/Ficus/src/front/FicusFrontend/FicusKafkaConstants/FicusKafkaConstants.csproj b/Ficus/src/front/FicusFrontend/FicusKafkaConstants/FicusKafkaConstants.csproj index 66ff8f14f..00b9359e9 100644 --- a/Ficus/src/front/FicusFrontend/FicusKafkaConstants/FicusKafkaConstants.csproj +++ b/Ficus/src/front/FicusFrontend/FicusKafkaConstants/FicusKafkaConstants.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 diff --git a/Ficus/src/front/FicusFrontend/FicusKafkaIntegration/FicusKafkaIntegration.csproj b/Ficus/src/front/FicusFrontend/FicusKafkaIntegration/FicusKafkaIntegration.csproj index 5a08215c1..65f9a277a 100644 --- a/Ficus/src/front/FicusFrontend/FicusKafkaIntegration/FicusKafkaIntegration.csproj +++ b/Ficus/src/front/FicusFrontend/FicusKafkaIntegration/FicusKafkaIntegration.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/Ficus/src/front/FicusFrontend/GrpcModels/GrpcModels.csproj b/Ficus/src/front/FicusFrontend/GrpcModels/GrpcModels.csproj index 0ac200607..80c5948e3 100644 --- a/Ficus/src/front/FicusFrontend/GrpcModels/GrpcModels.csproj +++ b/Ficus/src/front/FicusFrontend/GrpcModels/GrpcModels.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/Ficus/src/go/grpcmodels/pipelines_and_context.pb.go b/Ficus/src/go/grpcmodels/pipelines_and_context.pb.go index 1858d71f7..17436f3b0 100644 --- a/Ficus/src/go/grpcmodels/pipelines_and_context.pb.go +++ b/Ficus/src/go/grpcmodels/pipelines_and_context.pb.go @@ -25,8 +25,9 @@ const ( type GrpcGraphKind int32 const ( - GrpcGraphKind_None GrpcGraphKind = 0 - GrpcGraphKind_DAG GrpcGraphKind = 1 + GrpcGraphKind_None GrpcGraphKind = 0 + GrpcGraphKind_DAG GrpcGraphKind = 1 + GrpcGraphKind_DagLCS GrpcGraphKind = 2 ) // Enum value maps for GrpcGraphKind. @@ -34,10 +35,12 @@ var ( GrpcGraphKind_name = map[int32]string{ 0: "None", 1: "DAG", + 2: "DagLCS", } GrpcGraphKind_value = map[string]int32{ - "None": 0, - "DAG": 1, + "None": 0, + "DAG": 1, + "DagLCS": 2, } ) @@ -319,6 +322,7 @@ type GrpcContextValue struct { // *GrpcContextValue_UintArray // *GrpcContextValue_Json // *GrpcContextValue_EventLog + // *GrpcContextValue_OcelAnnotation ContextValue isGrpcContextValue_ContextValue `protobuf_oneof:"contextValue"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -595,6 +599,15 @@ func (x *GrpcContextValue) GetEventLog() *GrpcSimpleEventLog { return nil } +func (x *GrpcContextValue) GetOcelAnnotation() *GrpcOcelModelAnnotation { + if x != nil { + if x, ok := x.ContextValue.(*GrpcContextValue_OcelAnnotation); ok { + return x.OcelAnnotation + } + } + return nil +} + type isGrpcContextValue_ContextValue interface { isGrpcContextValue_ContextValue() } @@ -703,6 +716,10 @@ type GrpcContextValue_EventLog struct { EventLog *GrpcSimpleEventLog `protobuf:"bytes,26,opt,name=event_log,json=eventLog,proto3,oneof"` } +type GrpcContextValue_OcelAnnotation struct { + OcelAnnotation *GrpcOcelModelAnnotation `protobuf:"bytes,27,opt,name=ocel_annotation,json=ocelAnnotation,proto3,oneof"` +} + func (*GrpcContextValue_String_) isGrpcContextValue_ContextValue() {} func (*GrpcContextValue_HashesLog) isGrpcContextValue_ContextValue() {} @@ -755,6 +772,276 @@ func (*GrpcContextValue_Json) isGrpcContextValue_ContextValue() {} func (*GrpcContextValue_EventLog) isGrpcContextValue_ContextValue() {} +func (*GrpcContextValue_OcelAnnotation) isGrpcContextValue_ContextValue() {} + +type GrpcOcelModelAnnotation struct { + state protoimpl.MessageState `protogen:"open.v1"` + Annotations []*GrpcModelElementOcelAnnotation `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcOcelModelAnnotation) Reset() { + *x = GrpcOcelModelAnnotation{} + mi := &file_pipelines_and_context_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcOcelModelAnnotation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcOcelModelAnnotation) ProtoMessage() {} + +func (x *GrpcOcelModelAnnotation) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcOcelModelAnnotation.ProtoReflect.Descriptor instead. +func (*GrpcOcelModelAnnotation) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{3} +} + +func (x *GrpcOcelModelAnnotation) GetAnnotations() []*GrpcModelElementOcelAnnotation { + if x != nil { + return x.Annotations + } + return nil +} + +type GrpcModelElementOcelAnnotation struct { + state protoimpl.MessageState `protogen:"open.v1"` + ElementId uint64 `protobuf:"varint,1,opt,name=element_id,json=elementId,proto3" json:"element_id,omitempty"` + InitialState *GrpcOcelState `protobuf:"bytes,2,opt,name=initial_state,json=initialState,proto3,oneof" json:"initial_state,omitempty"` + FinalState *GrpcOcelState `protobuf:"bytes,3,opt,name=final_state,json=finalState,proto3" json:"final_state,omitempty"` + Relations []*GrpcOcelStateObjectRelation `protobuf:"bytes,4,rep,name=relations,proto3" json:"relations,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcModelElementOcelAnnotation) Reset() { + *x = GrpcModelElementOcelAnnotation{} + mi := &file_pipelines_and_context_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcModelElementOcelAnnotation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcModelElementOcelAnnotation) ProtoMessage() {} + +func (x *GrpcModelElementOcelAnnotation) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcModelElementOcelAnnotation.ProtoReflect.Descriptor instead. +func (*GrpcModelElementOcelAnnotation) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{4} +} + +func (x *GrpcModelElementOcelAnnotation) GetElementId() uint64 { + if x != nil { + return x.ElementId + } + return 0 +} + +func (x *GrpcModelElementOcelAnnotation) GetInitialState() *GrpcOcelState { + if x != nil { + return x.InitialState + } + return nil +} + +func (x *GrpcModelElementOcelAnnotation) GetFinalState() *GrpcOcelState { + if x != nil { + return x.FinalState + } + return nil +} + +func (x *GrpcModelElementOcelAnnotation) GetRelations() []*GrpcOcelStateObjectRelation { + if x != nil { + return x.Relations + } + return nil +} + +type GrpcOcelStateObjectRelation struct { + state protoimpl.MessageState `protogen:"open.v1"` + ObjectId string `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + ElementId uint64 `protobuf:"varint,2,opt,name=element_id,json=elementId,proto3" json:"element_id,omitempty"` + RelatedObjectsIds []string `protobuf:"bytes,3,rep,name=related_objects_ids,json=relatedObjectsIds,proto3" json:"related_objects_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcOcelStateObjectRelation) Reset() { + *x = GrpcOcelStateObjectRelation{} + mi := &file_pipelines_and_context_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcOcelStateObjectRelation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcOcelStateObjectRelation) ProtoMessage() {} + +func (x *GrpcOcelStateObjectRelation) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcOcelStateObjectRelation.ProtoReflect.Descriptor instead. +func (*GrpcOcelStateObjectRelation) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{5} +} + +func (x *GrpcOcelStateObjectRelation) GetObjectId() string { + if x != nil { + return x.ObjectId + } + return "" +} + +func (x *GrpcOcelStateObjectRelation) GetElementId() uint64 { + if x != nil { + return x.ElementId + } + return 0 +} + +func (x *GrpcOcelStateObjectRelation) GetRelatedObjectsIds() []string { + if x != nil { + return x.RelatedObjectsIds + } + return nil +} + +type GrpcOcelState struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeStates []*GrpcOcelObjectTypeState `protobuf:"bytes,1,rep,name=type_states,json=typeStates,proto3" json:"type_states,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcOcelState) Reset() { + *x = GrpcOcelState{} + mi := &file_pipelines_and_context_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcOcelState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcOcelState) ProtoMessage() {} + +func (x *GrpcOcelState) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcOcelState.ProtoReflect.Descriptor instead. +func (*GrpcOcelState) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{6} +} + +func (x *GrpcOcelState) GetTypeStates() []*GrpcOcelObjectTypeState { + if x != nil { + return x.TypeStates + } + return nil +} + +type GrpcOcelObjectTypeState struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + ObjectIds []string `protobuf:"bytes,2,rep,name=object_ids,json=objectIds,proto3" json:"object_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcOcelObjectTypeState) Reset() { + *x = GrpcOcelObjectTypeState{} + mi := &file_pipelines_and_context_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcOcelObjectTypeState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcOcelObjectTypeState) ProtoMessage() {} + +func (x *GrpcOcelObjectTypeState) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcOcelObjectTypeState.ProtoReflect.Descriptor instead. +func (*GrpcOcelObjectTypeState) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{7} +} + +func (x *GrpcOcelObjectTypeState) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *GrpcOcelObjectTypeState) GetObjectIds() []string { + if x != nil { + return x.ObjectIds + } + return nil +} + type GrpcFloatArray struct { state protoimpl.MessageState `protogen:"open.v1"` Items []float64 `protobuf:"fixed64,1,rep,packed,name=items,proto3" json:"items,omitempty"` @@ -764,7 +1051,7 @@ type GrpcFloatArray struct { func (x *GrpcFloatArray) Reset() { *x = GrpcFloatArray{} - mi := &file_pipelines_and_context_proto_msgTypes[3] + mi := &file_pipelines_and_context_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -776,7 +1063,7 @@ func (x *GrpcFloatArray) String() string { func (*GrpcFloatArray) ProtoMessage() {} func (x *GrpcFloatArray) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[3] + mi := &file_pipelines_and_context_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -789,7 +1076,7 @@ func (x *GrpcFloatArray) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcFloatArray.ProtoReflect.Descriptor instead. func (*GrpcFloatArray) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{3} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{8} } func (x *GrpcFloatArray) GetItems() []float64 { @@ -808,7 +1095,7 @@ type GrpcIntArray struct { func (x *GrpcIntArray) Reset() { *x = GrpcIntArray{} - mi := &file_pipelines_and_context_proto_msgTypes[4] + mi := &file_pipelines_and_context_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -820,7 +1107,7 @@ func (x *GrpcIntArray) String() string { func (*GrpcIntArray) ProtoMessage() {} func (x *GrpcIntArray) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[4] + mi := &file_pipelines_and_context_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -833,7 +1120,7 @@ func (x *GrpcIntArray) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcIntArray.ProtoReflect.Descriptor instead. func (*GrpcIntArray) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{4} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{9} } func (x *GrpcIntArray) GetItems() []int64 { @@ -852,7 +1139,7 @@ type GrpcUintArray struct { func (x *GrpcUintArray) Reset() { *x = GrpcUintArray{} - mi := &file_pipelines_and_context_proto_msgTypes[5] + mi := &file_pipelines_and_context_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -864,7 +1151,7 @@ func (x *GrpcUintArray) String() string { func (*GrpcUintArray) ProtoMessage() {} func (x *GrpcUintArray) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[5] + mi := &file_pipelines_and_context_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -877,7 +1164,7 @@ func (x *GrpcUintArray) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcUintArray.ProtoReflect.Descriptor instead. func (*GrpcUintArray) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{5} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{10} } func (x *GrpcUintArray) GetItems() []uint64 { @@ -897,7 +1184,7 @@ type GrpcContextKeyValue struct { func (x *GrpcContextKeyValue) Reset() { *x = GrpcContextKeyValue{} - mi := &file_pipelines_and_context_proto_msgTypes[6] + mi := &file_pipelines_and_context_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -909,7 +1196,7 @@ func (x *GrpcContextKeyValue) String() string { func (*GrpcContextKeyValue) ProtoMessage() {} func (x *GrpcContextKeyValue) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[6] + mi := &file_pipelines_and_context_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -922,7 +1209,7 @@ func (x *GrpcContextKeyValue) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcContextKeyValue.ProtoReflect.Descriptor instead. func (*GrpcContextKeyValue) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{6} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{11} } func (x *GrpcContextKeyValue) GetKey() *GrpcContextKey { @@ -948,7 +1235,7 @@ type GrpcHashesEventLogContextValue struct { func (x *GrpcHashesEventLogContextValue) Reset() { *x = GrpcHashesEventLogContextValue{} - mi := &file_pipelines_and_context_proto_msgTypes[7] + mi := &file_pipelines_and_context_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -960,7 +1247,7 @@ func (x *GrpcHashesEventLogContextValue) String() string { func (*GrpcHashesEventLogContextValue) ProtoMessage() {} func (x *GrpcHashesEventLogContextValue) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[7] + mi := &file_pipelines_and_context_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -973,7 +1260,7 @@ func (x *GrpcHashesEventLogContextValue) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcHashesEventLogContextValue.ProtoReflect.Descriptor instead. func (*GrpcHashesEventLogContextValue) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{7} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{12} } func (x *GrpcHashesEventLogContextValue) GetLog() *GrpcHashesEventLog { @@ -992,7 +1279,7 @@ type GrpcNamesEventLogContextValue struct { func (x *GrpcNamesEventLogContextValue) Reset() { *x = GrpcNamesEventLogContextValue{} - mi := &file_pipelines_and_context_proto_msgTypes[8] + mi := &file_pipelines_and_context_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1004,7 +1291,7 @@ func (x *GrpcNamesEventLogContextValue) String() string { func (*GrpcNamesEventLogContextValue) ProtoMessage() {} func (x *GrpcNamesEventLogContextValue) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[8] + mi := &file_pipelines_and_context_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1017,7 +1304,7 @@ func (x *GrpcNamesEventLogContextValue) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcNamesEventLogContextValue.ProtoReflect.Descriptor instead. func (*GrpcNamesEventLogContextValue) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{8} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{13} } func (x *GrpcNamesEventLogContextValue) GetLog() *GrpcNamesEventLog { @@ -1036,7 +1323,7 @@ type GrpcEventLogTraceSubArraysContextValue struct { func (x *GrpcEventLogTraceSubArraysContextValue) Reset() { *x = GrpcEventLogTraceSubArraysContextValue{} - mi := &file_pipelines_and_context_proto_msgTypes[9] + mi := &file_pipelines_and_context_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1048,7 +1335,7 @@ func (x *GrpcEventLogTraceSubArraysContextValue) String() string { func (*GrpcEventLogTraceSubArraysContextValue) ProtoMessage() {} func (x *GrpcEventLogTraceSubArraysContextValue) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[9] + mi := &file_pipelines_and_context_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1061,7 +1348,7 @@ func (x *GrpcEventLogTraceSubArraysContextValue) ProtoReflect() protoreflect.Mes // Deprecated: Use GrpcEventLogTraceSubArraysContextValue.ProtoReflect.Descriptor instead. func (*GrpcEventLogTraceSubArraysContextValue) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{9} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{14} } func (x *GrpcEventLogTraceSubArraysContextValue) GetTracesSubArrays() []*GrpcTraceSubArrays { @@ -1081,7 +1368,7 @@ type GrpcTraceSubArray struct { func (x *GrpcTraceSubArray) Reset() { *x = GrpcTraceSubArray{} - mi := &file_pipelines_and_context_proto_msgTypes[10] + mi := &file_pipelines_and_context_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1093,7 +1380,7 @@ func (x *GrpcTraceSubArray) String() string { func (*GrpcTraceSubArray) ProtoMessage() {} func (x *GrpcTraceSubArray) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[10] + mi := &file_pipelines_and_context_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1106,7 +1393,7 @@ func (x *GrpcTraceSubArray) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcTraceSubArray.ProtoReflect.Descriptor instead. func (*GrpcTraceSubArray) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{10} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{15} } func (x *GrpcTraceSubArray) GetStart() uint32 { @@ -1132,7 +1419,7 @@ type GrpcTraceSubArrays struct { func (x *GrpcTraceSubArrays) Reset() { *x = GrpcTraceSubArrays{} - mi := &file_pipelines_and_context_proto_msgTypes[11] + mi := &file_pipelines_and_context_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1144,7 +1431,7 @@ func (x *GrpcTraceSubArrays) String() string { func (*GrpcTraceSubArrays) ProtoMessage() {} func (x *GrpcTraceSubArrays) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[11] + mi := &file_pipelines_and_context_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1157,7 +1444,7 @@ func (x *GrpcTraceSubArrays) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcTraceSubArrays.ProtoReflect.Descriptor instead. func (*GrpcTraceSubArrays) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{11} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{16} } func (x *GrpcTraceSubArrays) GetSubArrays() []*GrpcTraceSubArray { @@ -1177,7 +1464,7 @@ type GrpcSubArrayWithTraceIndex struct { func (x *GrpcSubArrayWithTraceIndex) Reset() { *x = GrpcSubArrayWithTraceIndex{} - mi := &file_pipelines_and_context_proto_msgTypes[12] + mi := &file_pipelines_and_context_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1189,7 +1476,7 @@ func (x *GrpcSubArrayWithTraceIndex) String() string { func (*GrpcSubArrayWithTraceIndex) ProtoMessage() {} func (x *GrpcSubArrayWithTraceIndex) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[12] + mi := &file_pipelines_and_context_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1202,7 +1489,7 @@ func (x *GrpcSubArrayWithTraceIndex) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcSubArrayWithTraceIndex.ProtoReflect.Descriptor instead. func (*GrpcSubArrayWithTraceIndex) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{12} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{17} } func (x *GrpcSubArrayWithTraceIndex) GetSubArray() *GrpcTraceSubArray { @@ -1228,7 +1515,7 @@ type GrpcSubArraysWithTraceIndexContextValue struct { func (x *GrpcSubArraysWithTraceIndexContextValue) Reset() { *x = GrpcSubArraysWithTraceIndexContextValue{} - mi := &file_pipelines_and_context_proto_msgTypes[13] + mi := &file_pipelines_and_context_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1240,7 +1527,7 @@ func (x *GrpcSubArraysWithTraceIndexContextValue) String() string { func (*GrpcSubArraysWithTraceIndexContextValue) ProtoMessage() {} func (x *GrpcSubArraysWithTraceIndexContextValue) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[13] + mi := &file_pipelines_and_context_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1253,7 +1540,7 @@ func (x *GrpcSubArraysWithTraceIndexContextValue) ProtoReflect() protoreflect.Me // Deprecated: Use GrpcSubArraysWithTraceIndexContextValue.ProtoReflect.Descriptor instead. func (*GrpcSubArraysWithTraceIndexContextValue) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{13} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{18} } func (x *GrpcSubArraysWithTraceIndexContextValue) GetSubArrays() []*GrpcSubArrayWithTraceIndex { @@ -1274,7 +1561,7 @@ type GrpcColorsEventLog struct { func (x *GrpcColorsEventLog) Reset() { *x = GrpcColorsEventLog{} - mi := &file_pipelines_and_context_proto_msgTypes[14] + mi := &file_pipelines_and_context_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1286,7 +1573,7 @@ func (x *GrpcColorsEventLog) String() string { func (*GrpcColorsEventLog) ProtoMessage() {} func (x *GrpcColorsEventLog) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[14] + mi := &file_pipelines_and_context_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1299,7 +1586,7 @@ func (x *GrpcColorsEventLog) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcColorsEventLog.ProtoReflect.Descriptor instead. func (*GrpcColorsEventLog) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{14} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{19} } func (x *GrpcColorsEventLog) GetMapping() []*GrpcColorsEventLogMapping { @@ -1336,7 +1623,7 @@ type GrpcColorsLogAdjustment struct { func (x *GrpcColorsLogAdjustment) Reset() { *x = GrpcColorsLogAdjustment{} - mi := &file_pipelines_and_context_proto_msgTypes[15] + mi := &file_pipelines_and_context_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1348,7 +1635,7 @@ func (x *GrpcColorsLogAdjustment) String() string { func (*GrpcColorsLogAdjustment) ProtoMessage() {} func (x *GrpcColorsLogAdjustment) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[15] + mi := &file_pipelines_and_context_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1361,7 +1648,7 @@ func (x *GrpcColorsLogAdjustment) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcColorsLogAdjustment.ProtoReflect.Descriptor instead. func (*GrpcColorsLogAdjustment) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{15} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{20} } func (x *GrpcColorsLogAdjustment) GetSelection() isGrpcColorsLogAdjustment_Selection { @@ -1416,7 +1703,7 @@ type GrpcColorsLogRectangleAdjustment struct { func (x *GrpcColorsLogRectangleAdjustment) Reset() { *x = GrpcColorsLogRectangleAdjustment{} - mi := &file_pipelines_and_context_proto_msgTypes[16] + mi := &file_pipelines_and_context_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1428,7 +1715,7 @@ func (x *GrpcColorsLogRectangleAdjustment) String() string { func (*GrpcColorsLogRectangleAdjustment) ProtoMessage() {} func (x *GrpcColorsLogRectangleAdjustment) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[16] + mi := &file_pipelines_and_context_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1441,7 +1728,7 @@ func (x *GrpcColorsLogRectangleAdjustment) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcColorsLogRectangleAdjustment.ProtoReflect.Descriptor instead. func (*GrpcColorsLogRectangleAdjustment) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{16} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{21} } func (x *GrpcColorsLogRectangleAdjustment) GetUpLeftPoint() *GrpcLogPoint { @@ -1475,7 +1762,7 @@ type GrpcLogPoint struct { func (x *GrpcLogPoint) Reset() { *x = GrpcLogPoint{} - mi := &file_pipelines_and_context_proto_msgTypes[17] + mi := &file_pipelines_and_context_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1487,7 +1774,7 @@ func (x *GrpcLogPoint) String() string { func (*GrpcLogPoint) ProtoMessage() {} func (x *GrpcLogPoint) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[17] + mi := &file_pipelines_and_context_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1500,7 +1787,7 @@ func (x *GrpcLogPoint) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcLogPoint.ProtoReflect.Descriptor instead. func (*GrpcLogPoint) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{17} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{22} } func (x *GrpcLogPoint) GetTraceIndex() uint64 { @@ -1526,7 +1813,7 @@ type GrpcColorsLogXAxisAfterTraceAdjustment struct { func (x *GrpcColorsLogXAxisAfterTraceAdjustment) Reset() { *x = GrpcColorsLogXAxisAfterTraceAdjustment{} - mi := &file_pipelines_and_context_proto_msgTypes[18] + mi := &file_pipelines_and_context_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1538,7 +1825,7 @@ func (x *GrpcColorsLogXAxisAfterTraceAdjustment) String() string { func (*GrpcColorsLogXAxisAfterTraceAdjustment) ProtoMessage() {} func (x *GrpcColorsLogXAxisAfterTraceAdjustment) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[18] + mi := &file_pipelines_and_context_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1551,7 +1838,7 @@ func (x *GrpcColorsLogXAxisAfterTraceAdjustment) ProtoReflect() protoreflect.Mes // Deprecated: Use GrpcColorsLogXAxisAfterTraceAdjustment.ProtoReflect.Descriptor instead. func (*GrpcColorsLogXAxisAfterTraceAdjustment) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{18} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{23} } func (x *GrpcColorsLogXAxisAfterTraceAdjustment) GetTraceIndex() uint64 { @@ -1571,7 +1858,7 @@ type GrpcColorsEventLogMapping struct { func (x *GrpcColorsEventLogMapping) Reset() { *x = GrpcColorsEventLogMapping{} - mi := &file_pipelines_and_context_proto_msgTypes[19] + mi := &file_pipelines_and_context_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1583,7 +1870,7 @@ func (x *GrpcColorsEventLogMapping) String() string { func (*GrpcColorsEventLogMapping) ProtoMessage() {} func (x *GrpcColorsEventLogMapping) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[19] + mi := &file_pipelines_and_context_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1596,7 +1883,7 @@ func (x *GrpcColorsEventLogMapping) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcColorsEventLogMapping.ProtoReflect.Descriptor instead. func (*GrpcColorsEventLogMapping) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{19} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{24} } func (x *GrpcColorsEventLogMapping) GetName() string { @@ -1623,7 +1910,7 @@ type GrpcColorsTrace struct { func (x *GrpcColorsTrace) Reset() { *x = GrpcColorsTrace{} - mi := &file_pipelines_and_context_proto_msgTypes[20] + mi := &file_pipelines_and_context_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1635,7 +1922,7 @@ func (x *GrpcColorsTrace) String() string { func (*GrpcColorsTrace) ProtoMessage() {} func (x *GrpcColorsTrace) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[20] + mi := &file_pipelines_and_context_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1648,7 +1935,7 @@ func (x *GrpcColorsTrace) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcColorsTrace.ProtoReflect.Descriptor instead. func (*GrpcColorsTrace) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{20} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{25} } func (x *GrpcColorsTrace) GetEventColors() []*GrpcColoredRectangle { @@ -1676,7 +1963,7 @@ type GrpcColoredRectangle struct { func (x *GrpcColoredRectangle) Reset() { *x = GrpcColoredRectangle{} - mi := &file_pipelines_and_context_proto_msgTypes[21] + mi := &file_pipelines_and_context_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1688,7 +1975,7 @@ func (x *GrpcColoredRectangle) String() string { func (*GrpcColoredRectangle) ProtoMessage() {} func (x *GrpcColoredRectangle) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[21] + mi := &file_pipelines_and_context_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1701,7 +1988,7 @@ func (x *GrpcColoredRectangle) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcColoredRectangle.ProtoReflect.Descriptor instead. func (*GrpcColoredRectangle) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{21} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{26} } func (x *GrpcColoredRectangle) GetColorIndex() uint32 { @@ -1735,7 +2022,7 @@ type GrpcEnum struct { func (x *GrpcEnum) Reset() { *x = GrpcEnum{} - mi := &file_pipelines_and_context_proto_msgTypes[22] + mi := &file_pipelines_and_context_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1747,7 +2034,7 @@ func (x *GrpcEnum) String() string { func (*GrpcEnum) ProtoMessage() {} func (x *GrpcEnum) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[22] + mi := &file_pipelines_and_context_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1760,7 +2047,7 @@ func (x *GrpcEnum) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcEnum.ProtoReflect.Descriptor instead. func (*GrpcEnum) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{22} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{27} } func (x *GrpcEnum) GetEnumType() string { @@ -1788,7 +2075,7 @@ type GrpcEventLogInfo struct { func (x *GrpcEventLogInfo) Reset() { *x = GrpcEventLogInfo{} - mi := &file_pipelines_and_context_proto_msgTypes[23] + mi := &file_pipelines_and_context_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1800,7 +2087,7 @@ func (x *GrpcEventLogInfo) String() string { func (*GrpcEventLogInfo) ProtoMessage() {} func (x *GrpcEventLogInfo) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[23] + mi := &file_pipelines_and_context_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1813,7 +2100,7 @@ func (x *GrpcEventLogInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcEventLogInfo.ProtoReflect.Descriptor instead. func (*GrpcEventLogInfo) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{23} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{28} } func (x *GrpcEventLogInfo) GetEventsCount() uint32 { @@ -1846,7 +2133,7 @@ type GrpcStrings struct { func (x *GrpcStrings) Reset() { *x = GrpcStrings{} - mi := &file_pipelines_and_context_proto_msgTypes[24] + mi := &file_pipelines_and_context_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1858,7 +2145,7 @@ func (x *GrpcStrings) String() string { func (*GrpcStrings) ProtoMessage() {} func (x *GrpcStrings) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[24] + mi := &file_pipelines_and_context_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1871,7 +2158,7 @@ func (x *GrpcStrings) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcStrings.ProtoReflect.Descriptor instead. func (*GrpcStrings) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{24} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{29} } func (x *GrpcStrings) GetStrings() []string { @@ -1890,7 +2177,7 @@ type GrpcPipeline struct { func (x *GrpcPipeline) Reset() { *x = GrpcPipeline{} - mi := &file_pipelines_and_context_proto_msgTypes[25] + mi := &file_pipelines_and_context_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1902,7 +2189,7 @@ func (x *GrpcPipeline) String() string { func (*GrpcPipeline) ProtoMessage() {} func (x *GrpcPipeline) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[25] + mi := &file_pipelines_and_context_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1915,7 +2202,7 @@ func (x *GrpcPipeline) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcPipeline.ProtoReflect.Descriptor instead. func (*GrpcPipeline) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{25} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{30} } func (x *GrpcPipeline) GetParts() []*GrpcPipelinePartBase { @@ -1940,7 +2227,7 @@ type GrpcPipelinePartBase struct { func (x *GrpcPipelinePartBase) Reset() { *x = GrpcPipelinePartBase{} - mi := &file_pipelines_and_context_proto_msgTypes[26] + mi := &file_pipelines_and_context_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1952,7 +2239,7 @@ func (x *GrpcPipelinePartBase) String() string { func (*GrpcPipelinePartBase) ProtoMessage() {} func (x *GrpcPipelinePartBase) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[26] + mi := &file_pipelines_and_context_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1965,7 +2252,7 @@ func (x *GrpcPipelinePartBase) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcPipelinePartBase.ProtoReflect.Descriptor instead. func (*GrpcPipelinePartBase) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{26} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{31} } func (x *GrpcPipelinePartBase) GetPart() isGrpcPipelinePartBase_Part { @@ -2049,7 +2336,7 @@ type GrpcPipelinePart struct { func (x *GrpcPipelinePart) Reset() { *x = GrpcPipelinePart{} - mi := &file_pipelines_and_context_proto_msgTypes[27] + mi := &file_pipelines_and_context_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2061,7 +2348,7 @@ func (x *GrpcPipelinePart) String() string { func (*GrpcPipelinePart) ProtoMessage() {} func (x *GrpcPipelinePart) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[27] + mi := &file_pipelines_and_context_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2074,7 +2361,7 @@ func (x *GrpcPipelinePart) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcPipelinePart.ProtoReflect.Descriptor instead. func (*GrpcPipelinePart) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{27} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{32} } func (x *GrpcPipelinePart) GetName() string { @@ -2100,7 +2387,7 @@ type GrpcPipelinePartConfiguration struct { func (x *GrpcPipelinePartConfiguration) Reset() { *x = GrpcPipelinePartConfiguration{} - mi := &file_pipelines_and_context_proto_msgTypes[28] + mi := &file_pipelines_and_context_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2112,7 +2399,7 @@ func (x *GrpcPipelinePartConfiguration) String() string { func (*GrpcPipelinePartConfiguration) ProtoMessage() {} func (x *GrpcPipelinePartConfiguration) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[28] + mi := &file_pipelines_and_context_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2125,7 +2412,7 @@ func (x *GrpcPipelinePartConfiguration) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcPipelinePartConfiguration.ProtoReflect.Descriptor instead. func (*GrpcPipelinePartConfiguration) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{28} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{33} } func (x *GrpcPipelinePartConfiguration) GetConfigurationParameters() []*GrpcContextKeyValue { @@ -2144,7 +2431,7 @@ type GrpcParallelPipelinePart struct { func (x *GrpcParallelPipelinePart) Reset() { *x = GrpcParallelPipelinePart{} - mi := &file_pipelines_and_context_proto_msgTypes[29] + mi := &file_pipelines_and_context_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2156,7 +2443,7 @@ func (x *GrpcParallelPipelinePart) String() string { func (*GrpcParallelPipelinePart) ProtoMessage() {} func (x *GrpcParallelPipelinePart) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[29] + mi := &file_pipelines_and_context_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2169,7 +2456,7 @@ func (x *GrpcParallelPipelinePart) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcParallelPipelinePart.ProtoReflect.Descriptor instead. func (*GrpcParallelPipelinePart) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{29} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{34} } func (x *GrpcParallelPipelinePart) GetPipelineParts() []*GrpcPipelinePartBase { @@ -2188,7 +2475,7 @@ type GrpcParallelPipelineParts struct { func (x *GrpcParallelPipelineParts) Reset() { *x = GrpcParallelPipelineParts{} - mi := &file_pipelines_and_context_proto_msgTypes[30] + mi := &file_pipelines_and_context_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2200,7 +2487,7 @@ func (x *GrpcParallelPipelineParts) String() string { func (*GrpcParallelPipelineParts) ProtoMessage() {} func (x *GrpcParallelPipelineParts) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[30] + mi := &file_pipelines_and_context_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2213,7 +2500,7 @@ func (x *GrpcParallelPipelineParts) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcParallelPipelineParts.ProtoReflect.Descriptor instead. func (*GrpcParallelPipelineParts) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{30} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{35} } func (x *GrpcParallelPipelineParts) GetPipeline() []*GrpcParallelPipelinePart { @@ -2234,7 +2521,7 @@ type GrpcSimpleContextRequestPipelinePart struct { func (x *GrpcSimpleContextRequestPipelinePart) Reset() { *x = GrpcSimpleContextRequestPipelinePart{} - mi := &file_pipelines_and_context_proto_msgTypes[31] + mi := &file_pipelines_and_context_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2246,7 +2533,7 @@ func (x *GrpcSimpleContextRequestPipelinePart) String() string { func (*GrpcSimpleContextRequestPipelinePart) ProtoMessage() {} func (x *GrpcSimpleContextRequestPipelinePart) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[31] + mi := &file_pipelines_and_context_proto_msgTypes[36] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2259,7 +2546,7 @@ func (x *GrpcSimpleContextRequestPipelinePart) ProtoReflect() protoreflect.Messa // Deprecated: Use GrpcSimpleContextRequestPipelinePart.ProtoReflect.Descriptor instead. func (*GrpcSimpleContextRequestPipelinePart) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{31} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{36} } func (x *GrpcSimpleContextRequestPipelinePart) GetKey() *GrpcContextKey { @@ -2295,7 +2582,7 @@ type GrpcComplexContextRequestPipelinePart struct { func (x *GrpcComplexContextRequestPipelinePart) Reset() { *x = GrpcComplexContextRequestPipelinePart{} - mi := &file_pipelines_and_context_proto_msgTypes[32] + mi := &file_pipelines_and_context_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2307,7 +2594,7 @@ func (x *GrpcComplexContextRequestPipelinePart) String() string { func (*GrpcComplexContextRequestPipelinePart) ProtoMessage() {} func (x *GrpcComplexContextRequestPipelinePart) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[32] + mi := &file_pipelines_and_context_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2320,7 +2607,7 @@ func (x *GrpcComplexContextRequestPipelinePart) ProtoReflect() protoreflect.Mess // Deprecated: Use GrpcComplexContextRequestPipelinePart.ProtoReflect.Descriptor instead. func (*GrpcComplexContextRequestPipelinePart) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{32} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{37} } func (x *GrpcComplexContextRequestPipelinePart) GetKeys() []*GrpcContextKey { @@ -2362,7 +2649,7 @@ type GrpcGraph struct { func (x *GrpcGraph) Reset() { *x = GrpcGraph{} - mi := &file_pipelines_and_context_proto_msgTypes[33] + mi := &file_pipelines_and_context_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2374,7 +2661,7 @@ func (x *GrpcGraph) String() string { func (*GrpcGraph) ProtoMessage() {} func (x *GrpcGraph) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[33] + mi := &file_pipelines_and_context_proto_msgTypes[38] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2387,7 +2674,7 @@ func (x *GrpcGraph) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcGraph.ProtoReflect.Descriptor instead. func (*GrpcGraph) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{33} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{38} } func (x *GrpcGraph) GetNodes() []*GrpcGraphNode { @@ -2423,7 +2710,7 @@ type GrpcGraphNode struct { func (x *GrpcGraphNode) Reset() { *x = GrpcGraphNode{} - mi := &file_pipelines_and_context_proto_msgTypes[34] + mi := &file_pipelines_and_context_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2435,7 +2722,7 @@ func (x *GrpcGraphNode) String() string { func (*GrpcGraphNode) ProtoMessage() {} func (x *GrpcGraphNode) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[34] + mi := &file_pipelines_and_context_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2448,7 +2735,7 @@ func (x *GrpcGraphNode) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcGraphNode.ProtoReflect.Descriptor instead. func (*GrpcGraphNode) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{34} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{39} } func (x *GrpcGraphNode) GetId() uint64 { @@ -2498,7 +2785,7 @@ type GrpcNodeAdditionalData struct { func (x *GrpcNodeAdditionalData) Reset() { *x = GrpcNodeAdditionalData{} - mi := &file_pipelines_and_context_proto_msgTypes[35] + mi := &file_pipelines_and_context_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2510,7 +2797,7 @@ func (x *GrpcNodeAdditionalData) String() string { func (*GrpcNodeAdditionalData) ProtoMessage() {} func (x *GrpcNodeAdditionalData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[35] + mi := &file_pipelines_and_context_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2523,7 +2810,7 @@ func (x *GrpcNodeAdditionalData) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcNodeAdditionalData.ProtoReflect.Descriptor instead. func (*GrpcNodeAdditionalData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{35} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{40} } func (x *GrpcNodeAdditionalData) GetData() isGrpcNodeAdditionalData_Data { @@ -2634,28 +2921,304 @@ func (*GrpcNodeAdditionalData_TimeData) isGrpcNodeAdditionalData_Data() {} func (*GrpcNodeAdditionalData_MultithreadedFragment) isGrpcNodeAdditionalData_Data() {} -type GrpcMultithreadedFragment struct { - state protoimpl.MessageState `protogen:"open.v1"` - MultithreadedLog *GrpcSimpleEventLog `protobuf:"bytes,1,opt,name=multithreaded_log,json=multithreadedLog,proto3" json:"multithreaded_log,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type GrpcMultithreadedFragment struct { + state protoimpl.MessageState `protogen:"open.v1"` + MultithreadedLog *GrpcSimpleEventLog `protobuf:"bytes,1,opt,name=multithreaded_log,json=multithreadedLog,proto3" json:"multithreaded_log,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcMultithreadedFragment) Reset() { + *x = GrpcMultithreadedFragment{} + mi := &file_pipelines_and_context_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcMultithreadedFragment) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcMultithreadedFragment) ProtoMessage() {} + +func (x *GrpcMultithreadedFragment) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcMultithreadedFragment.ProtoReflect.Descriptor instead. +func (*GrpcMultithreadedFragment) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{41} +} + +func (x *GrpcMultithreadedFragment) GetMultithreadedLog() *GrpcSimpleEventLog { + if x != nil { + return x.MultithreadedLog + } + return nil +} + +type GrpcActivityStartEndData struct { + state protoimpl.MessageState `protogen:"open.v1"` + StartTime int64 `protobuf:"varint,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime int64 `protobuf:"varint,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcActivityStartEndData) Reset() { + *x = GrpcActivityStartEndData{} + mi := &file_pipelines_and_context_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcActivityStartEndData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcActivityStartEndData) ProtoMessage() {} + +func (x *GrpcActivityStartEndData) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcActivityStartEndData.ProtoReflect.Descriptor instead. +func (*GrpcActivityStartEndData) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{42} +} + +func (x *GrpcActivityStartEndData) GetStartTime() int64 { + if x != nil { + return x.StartTime + } + return 0 +} + +func (x *GrpcActivityStartEndData) GetEndTime() int64 { + if x != nil { + return x.EndTime + } + return 0 +} + +type GrpcEventCoordinates struct { + state protoimpl.MessageState `protogen:"open.v1"` + TraceId uint64 `protobuf:"varint,2,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + EventIndex uint64 `protobuf:"varint,3,opt,name=event_index,json=eventIndex,proto3" json:"event_index,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcEventCoordinates) Reset() { + *x = GrpcEventCoordinates{} + mi := &file_pipelines_and_context_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcEventCoordinates) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcEventCoordinates) ProtoMessage() {} + +func (x *GrpcEventCoordinates) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcEventCoordinates.ProtoReflect.Descriptor instead. +func (*GrpcEventCoordinates) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{43} +} + +func (x *GrpcEventCoordinates) GetTraceId() uint64 { + if x != nil { + return x.TraceId + } + return 0 +} + +func (x *GrpcEventCoordinates) GetEventIndex() uint64 { + if x != nil { + return x.EventIndex + } + return 0 +} + +type GrpcNodeCorrespondingTraceData struct { + state protoimpl.MessageState `protogen:"open.v1"` + BelongsToRootSequence bool `protobuf:"varint,1,opt,name=belongs_to_root_sequence,json=belongsToRootSequence,proto3" json:"belongs_to_root_sequence,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcNodeCorrespondingTraceData) Reset() { + *x = GrpcNodeCorrespondingTraceData{} + mi := &file_pipelines_and_context_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcNodeCorrespondingTraceData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcNodeCorrespondingTraceData) ProtoMessage() {} + +func (x *GrpcNodeCorrespondingTraceData) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcNodeCorrespondingTraceData.ProtoReflect.Descriptor instead. +func (*GrpcNodeCorrespondingTraceData) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{44} +} + +func (x *GrpcNodeCorrespondingTraceData) GetBelongsToRootSequence() bool { + if x != nil { + return x.BelongsToRootSequence + } + return false +} + +type GrpcSoftwareData struct { + state protoimpl.MessageState `protogen:"open.v1"` + Histogram []*GrpcHistogramEntry `protobuf:"bytes,1,rep,name=histogram,proto3" json:"histogram,omitempty"` + TimelineDiagramFragment *GrpcTimelineDiagramFragment `protobuf:"bytes,2,opt,name=timeline_diagram_fragment,json=timelineDiagramFragment,proto3" json:"timeline_diagram_fragment,omitempty"` + HistogramData []*GrpcGeneralHistogramData `protobuf:"bytes,13,rep,name=histogram_data,json=histogramData,proto3" json:"histogram_data,omitempty"` + SimpleCounterData []*GrpcSimpleCounterData `protobuf:"bytes,14,rep,name=simple_counter_data,json=simpleCounterData,proto3" json:"simple_counter_data,omitempty"` + ActivitiesDurationsData []*GrpcActivityDurationData `protobuf:"bytes,15,rep,name=activities_durations_data,json=activitiesDurationsData,proto3" json:"activities_durations_data,omitempty"` + OcelData []*GrpcOcelData `protobuf:"bytes,16,rep,name=ocel_data,json=ocelData,proto3" json:"ocel_data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrpcSoftwareData) Reset() { + *x = GrpcSoftwareData{} + mi := &file_pipelines_and_context_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrpcSoftwareData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcSoftwareData) ProtoMessage() {} + +func (x *GrpcSoftwareData) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcSoftwareData.ProtoReflect.Descriptor instead. +func (*GrpcSoftwareData) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{45} +} + +func (x *GrpcSoftwareData) GetHistogram() []*GrpcHistogramEntry { + if x != nil { + return x.Histogram + } + return nil +} + +func (x *GrpcSoftwareData) GetTimelineDiagramFragment() *GrpcTimelineDiagramFragment { + if x != nil { + return x.TimelineDiagramFragment + } + return nil +} + +func (x *GrpcSoftwareData) GetHistogramData() []*GrpcGeneralHistogramData { + if x != nil { + return x.HistogramData + } + return nil +} + +func (x *GrpcSoftwareData) GetSimpleCounterData() []*GrpcSimpleCounterData { + if x != nil { + return x.SimpleCounterData + } + return nil +} + +func (x *GrpcSoftwareData) GetActivitiesDurationsData() []*GrpcActivityDurationData { + if x != nil { + return x.ActivitiesDurationsData + } + return nil +} + +func (x *GrpcSoftwareData) GetOcelData() []*GrpcOcelData { + if x != nil { + return x.OcelData + } + return nil +} + +type GrpcOcelObjectTypeData struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type *string `protobuf:"bytes,1,opt,name=type,proto3,oneof" json:"type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *GrpcMultithreadedFragment) Reset() { - *x = GrpcMultithreadedFragment{} - mi := &file_pipelines_and_context_proto_msgTypes[36] +func (x *GrpcOcelObjectTypeData) Reset() { + *x = GrpcOcelObjectTypeData{} + mi := &file_pipelines_and_context_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GrpcMultithreadedFragment) String() string { +func (x *GrpcOcelObjectTypeData) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GrpcMultithreadedFragment) ProtoMessage() {} +func (*GrpcOcelObjectTypeData) ProtoMessage() {} -func (x *GrpcMultithreadedFragment) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[36] +func (x *GrpcOcelObjectTypeData) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[46] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2666,41 +3229,41 @@ func (x *GrpcMultithreadedFragment) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GrpcMultithreadedFragment.ProtoReflect.Descriptor instead. -func (*GrpcMultithreadedFragment) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{36} +// Deprecated: Use GrpcOcelObjectTypeData.ProtoReflect.Descriptor instead. +func (*GrpcOcelObjectTypeData) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{46} } -func (x *GrpcMultithreadedFragment) GetMultithreadedLog() *GrpcSimpleEventLog { - if x != nil { - return x.MultithreadedLog +func (x *GrpcOcelObjectTypeData) GetType() string { + if x != nil && x.Type != nil { + return *x.Type } - return nil + return "" } -type GrpcActivityStartEndData struct { - state protoimpl.MessageState `protogen:"open.v1"` - StartTime int64 `protobuf:"varint,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` - EndTime int64 `protobuf:"varint,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type GrpcOcelAllocateMerge struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type *string `protobuf:"bytes,1,opt,name=type,proto3,oneof" json:"type,omitempty"` + MergedObjectsIds []string `protobuf:"bytes,2,rep,name=merged_objects_ids,json=mergedObjectsIds,proto3" json:"merged_objects_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *GrpcActivityStartEndData) Reset() { - *x = GrpcActivityStartEndData{} - mi := &file_pipelines_and_context_proto_msgTypes[37] +func (x *GrpcOcelAllocateMerge) Reset() { + *x = GrpcOcelAllocateMerge{} + mi := &file_pipelines_and_context_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GrpcActivityStartEndData) String() string { +func (x *GrpcOcelAllocateMerge) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GrpcActivityStartEndData) ProtoMessage() {} +func (*GrpcOcelAllocateMerge) ProtoMessage() {} -func (x *GrpcActivityStartEndData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[37] +func (x *GrpcOcelAllocateMerge) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2711,48 +3274,48 @@ func (x *GrpcActivityStartEndData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GrpcActivityStartEndData.ProtoReflect.Descriptor instead. -func (*GrpcActivityStartEndData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{37} +// Deprecated: Use GrpcOcelAllocateMerge.ProtoReflect.Descriptor instead. +func (*GrpcOcelAllocateMerge) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{47} } -func (x *GrpcActivityStartEndData) GetStartTime() int64 { - if x != nil { - return x.StartTime +func (x *GrpcOcelAllocateMerge) GetType() string { + if x != nil && x.Type != nil { + return *x.Type } - return 0 + return "" } -func (x *GrpcActivityStartEndData) GetEndTime() int64 { +func (x *GrpcOcelAllocateMerge) GetMergedObjectsIds() []string { if x != nil { - return x.EndTime + return x.MergedObjectsIds } - return 0 + return nil } -type GrpcEventCoordinates struct { +type GrpcOcelProducedObject struct { state protoimpl.MessageState `protogen:"open.v1"` - TraceId uint64 `protobuf:"varint,2,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` - EventIndex uint64 `protobuf:"varint,3,opt,name=event_index,json=eventIndex,proto3" json:"event_index,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type *string `protobuf:"bytes,2,opt,name=type,proto3,oneof" json:"type,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GrpcEventCoordinates) Reset() { - *x = GrpcEventCoordinates{} - mi := &file_pipelines_and_context_proto_msgTypes[38] +func (x *GrpcOcelProducedObject) Reset() { + *x = GrpcOcelProducedObject{} + mi := &file_pipelines_and_context_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GrpcEventCoordinates) String() string { +func (x *GrpcOcelProducedObject) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GrpcEventCoordinates) ProtoMessage() {} +func (*GrpcOcelProducedObject) ProtoMessage() {} -func (x *GrpcEventCoordinates) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[38] +func (x *GrpcOcelProducedObject) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[48] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2763,47 +3326,47 @@ func (x *GrpcEventCoordinates) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GrpcEventCoordinates.ProtoReflect.Descriptor instead. -func (*GrpcEventCoordinates) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{38} +// Deprecated: Use GrpcOcelProducedObject.ProtoReflect.Descriptor instead. +func (*GrpcOcelProducedObject) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{48} } -func (x *GrpcEventCoordinates) GetTraceId() uint64 { +func (x *GrpcOcelProducedObject) GetId() string { if x != nil { - return x.TraceId + return x.Id } - return 0 + return "" } -func (x *GrpcEventCoordinates) GetEventIndex() uint64 { - if x != nil { - return x.EventIndex +func (x *GrpcOcelProducedObject) GetType() string { + if x != nil && x.Type != nil { + return *x.Type } - return 0 + return "" } -type GrpcNodeCorrespondingTraceData struct { - state protoimpl.MessageState `protogen:"open.v1"` - BelongsToRootSequence bool `protobuf:"varint,1,opt,name=belongs_to_root_sequence,json=belongsToRootSequence,proto3" json:"belongs_to_root_sequence,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type GrpcOcelConsumeProduce struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProducedObjects []*GrpcOcelProducedObject `protobuf:"bytes,1,rep,name=produced_objects,json=producedObjects,proto3" json:"produced_objects,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *GrpcNodeCorrespondingTraceData) Reset() { - *x = GrpcNodeCorrespondingTraceData{} - mi := &file_pipelines_and_context_proto_msgTypes[39] +func (x *GrpcOcelConsumeProduce) Reset() { + *x = GrpcOcelConsumeProduce{} + mi := &file_pipelines_and_context_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GrpcNodeCorrespondingTraceData) String() string { +func (x *GrpcOcelConsumeProduce) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GrpcNodeCorrespondingTraceData) ProtoMessage() {} +func (*GrpcOcelConsumeProduce) ProtoMessage() {} -func (x *GrpcNodeCorrespondingTraceData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[39] +func (x *GrpcOcelConsumeProduce) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[49] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2814,44 +3377,47 @@ func (x *GrpcNodeCorrespondingTraceData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GrpcNodeCorrespondingTraceData.ProtoReflect.Descriptor instead. -func (*GrpcNodeCorrespondingTraceData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{39} +// Deprecated: Use GrpcOcelConsumeProduce.ProtoReflect.Descriptor instead. +func (*GrpcOcelConsumeProduce) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{49} } -func (x *GrpcNodeCorrespondingTraceData) GetBelongsToRootSequence() bool { +func (x *GrpcOcelConsumeProduce) GetProducedObjects() []*GrpcOcelProducedObject { if x != nil { - return x.BelongsToRootSequence + return x.ProducedObjects } - return false + return nil } -type GrpcSoftwareData struct { - state protoimpl.MessageState `protogen:"open.v1"` - Histogram []*GrpcHistogramEntry `protobuf:"bytes,1,rep,name=histogram,proto3" json:"histogram,omitempty"` - TimelineDiagramFragment *GrpcTimelineDiagramFragment `protobuf:"bytes,2,opt,name=timeline_diagram_fragment,json=timelineDiagramFragment,proto3" json:"timeline_diagram_fragment,omitempty"` - HistogramData []*GrpcGeneralHistogramData `protobuf:"bytes,13,rep,name=histogram_data,json=histogramData,proto3" json:"histogram_data,omitempty"` - SimpleCounterData []*GrpcSimpleCounterData `protobuf:"bytes,14,rep,name=simple_counter_data,json=simpleCounterData,proto3" json:"simple_counter_data,omitempty"` - ActivitiesDurationsData []*GrpcActivityDurationData `protobuf:"bytes,15,rep,name=activities_durations_data,json=activitiesDurationsData,proto3" json:"activities_durations_data,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type GrpcOcelData struct { + state protoimpl.MessageState `protogen:"open.v1"` + ObjectId string `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` + // Types that are valid to be assigned to Action: + // + // *GrpcOcelData_Allocate + // *GrpcOcelData_Consume + // *GrpcOcelData_MergedObjectAllocation + // *GrpcOcelData_ProduceObjectConsumption + Action isGrpcOcelData_Action `protobuf_oneof:"action"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *GrpcSoftwareData) Reset() { - *x = GrpcSoftwareData{} - mi := &file_pipelines_and_context_proto_msgTypes[40] +func (x *GrpcOcelData) Reset() { + *x = GrpcOcelData{} + mi := &file_pipelines_and_context_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GrpcSoftwareData) String() string { +func (x *GrpcOcelData) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GrpcSoftwareData) ProtoMessage() {} +func (*GrpcOcelData) ProtoMessage() {} -func (x *GrpcSoftwareData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[40] +func (x *GrpcOcelData) ProtoReflect() protoreflect.Message { + mi := &file_pipelines_and_context_proto_msgTypes[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2862,46 +3428,89 @@ func (x *GrpcSoftwareData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GrpcSoftwareData.ProtoReflect.Descriptor instead. -func (*GrpcSoftwareData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{40} +// Deprecated: Use GrpcOcelData.ProtoReflect.Descriptor instead. +func (*GrpcOcelData) Descriptor() ([]byte, []int) { + return file_pipelines_and_context_proto_rawDescGZIP(), []int{50} } -func (x *GrpcSoftwareData) GetHistogram() []*GrpcHistogramEntry { +func (x *GrpcOcelData) GetObjectId() string { if x != nil { - return x.Histogram + return x.ObjectId + } + return "" +} + +func (x *GrpcOcelData) GetAction() isGrpcOcelData_Action { + if x != nil { + return x.Action } return nil } -func (x *GrpcSoftwareData) GetTimelineDiagramFragment() *GrpcTimelineDiagramFragment { +func (x *GrpcOcelData) GetAllocate() *GrpcOcelObjectTypeData { if x != nil { - return x.TimelineDiagramFragment + if x, ok := x.Action.(*GrpcOcelData_Allocate); ok { + return x.Allocate + } } return nil } -func (x *GrpcSoftwareData) GetHistogramData() []*GrpcGeneralHistogramData { +func (x *GrpcOcelData) GetConsume() *GrpcOcelObjectTypeData { if x != nil { - return x.HistogramData + if x, ok := x.Action.(*GrpcOcelData_Consume); ok { + return x.Consume + } } return nil } -func (x *GrpcSoftwareData) GetSimpleCounterData() []*GrpcSimpleCounterData { +func (x *GrpcOcelData) GetMergedObjectAllocation() *GrpcOcelAllocateMerge { if x != nil { - return x.SimpleCounterData + if x, ok := x.Action.(*GrpcOcelData_MergedObjectAllocation); ok { + return x.MergedObjectAllocation + } } return nil } -func (x *GrpcSoftwareData) GetActivitiesDurationsData() []*GrpcActivityDurationData { +func (x *GrpcOcelData) GetProduceObjectConsumption() *GrpcOcelConsumeProduce { if x != nil { - return x.ActivitiesDurationsData + if x, ok := x.Action.(*GrpcOcelData_ProduceObjectConsumption); ok { + return x.ProduceObjectConsumption + } } return nil } +type isGrpcOcelData_Action interface { + isGrpcOcelData_Action() +} + +type GrpcOcelData_Allocate struct { + Allocate *GrpcOcelObjectTypeData `protobuf:"bytes,2,opt,name=allocate,proto3,oneof"` +} + +type GrpcOcelData_Consume struct { + Consume *GrpcOcelObjectTypeData `protobuf:"bytes,3,opt,name=consume,proto3,oneof"` +} + +type GrpcOcelData_MergedObjectAllocation struct { + MergedObjectAllocation *GrpcOcelAllocateMerge `protobuf:"bytes,4,opt,name=merged_object_allocation,json=mergedObjectAllocation,proto3,oneof"` +} + +type GrpcOcelData_ProduceObjectConsumption struct { + ProduceObjectConsumption *GrpcOcelConsumeProduce `protobuf:"bytes,5,opt,name=produce_object_consumption,json=produceObjectConsumption,proto3,oneof"` +} + +func (*GrpcOcelData_Allocate) isGrpcOcelData_Action() {} + +func (*GrpcOcelData_Consume) isGrpcOcelData_Action() {} + +func (*GrpcOcelData_MergedObjectAllocation) isGrpcOcelData_Action() {} + +func (*GrpcOcelData_ProduceObjectConsumption) isGrpcOcelData_Action() {} + type GrpcActivityDurationData struct { state protoimpl.MessageState `protogen:"open.v1"` Base *GrpcGenericEnhancementBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` @@ -2913,7 +3522,7 @@ type GrpcActivityDurationData struct { func (x *GrpcActivityDurationData) Reset() { *x = GrpcActivityDurationData{} - mi := &file_pipelines_and_context_proto_msgTypes[41] + mi := &file_pipelines_and_context_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2925,7 +3534,7 @@ func (x *GrpcActivityDurationData) String() string { func (*GrpcActivityDurationData) ProtoMessage() {} func (x *GrpcActivityDurationData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[41] + mi := &file_pipelines_and_context_proto_msgTypes[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2938,7 +3547,7 @@ func (x *GrpcActivityDurationData) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcActivityDurationData.ProtoReflect.Descriptor instead. func (*GrpcActivityDurationData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{41} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{51} } func (x *GrpcActivityDurationData) GetBase() *GrpcGenericEnhancementBase { @@ -2973,7 +3582,7 @@ type GrpcGenericEnhancementBase struct { func (x *GrpcGenericEnhancementBase) Reset() { *x = GrpcGenericEnhancementBase{} - mi := &file_pipelines_and_context_proto_msgTypes[42] + mi := &file_pipelines_and_context_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2985,7 +3594,7 @@ func (x *GrpcGenericEnhancementBase) String() string { func (*GrpcGenericEnhancementBase) ProtoMessage() {} func (x *GrpcGenericEnhancementBase) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[42] + mi := &file_pipelines_and_context_proto_msgTypes[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2998,7 +3607,7 @@ func (x *GrpcGenericEnhancementBase) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcGenericEnhancementBase.ProtoReflect.Descriptor instead. func (*GrpcGenericEnhancementBase) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{42} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{52} } func (x *GrpcGenericEnhancementBase) GetName() string { @@ -3032,7 +3641,7 @@ type GrpcGeneralHistogramData struct { func (x *GrpcGeneralHistogramData) Reset() { *x = GrpcGeneralHistogramData{} - mi := &file_pipelines_and_context_proto_msgTypes[43] + mi := &file_pipelines_and_context_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3044,7 +3653,7 @@ func (x *GrpcGeneralHistogramData) String() string { func (*GrpcGeneralHistogramData) ProtoMessage() {} func (x *GrpcGeneralHistogramData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[43] + mi := &file_pipelines_and_context_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3057,7 +3666,7 @@ func (x *GrpcGeneralHistogramData) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcGeneralHistogramData.ProtoReflect.Descriptor instead. func (*GrpcGeneralHistogramData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{43} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{53} } func (x *GrpcGeneralHistogramData) GetBase() *GrpcGenericEnhancementBase { @@ -3084,7 +3693,7 @@ type GrpcSimpleCounterData struct { func (x *GrpcSimpleCounterData) Reset() { *x = GrpcSimpleCounterData{} - mi := &file_pipelines_and_context_proto_msgTypes[44] + mi := &file_pipelines_and_context_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3096,7 +3705,7 @@ func (x *GrpcSimpleCounterData) String() string { func (*GrpcSimpleCounterData) ProtoMessage() {} func (x *GrpcSimpleCounterData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[44] + mi := &file_pipelines_and_context_proto_msgTypes[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3109,7 +3718,7 @@ func (x *GrpcSimpleCounterData) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcSimpleCounterData.ProtoReflect.Descriptor instead. func (*GrpcSimpleCounterData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{44} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{54} } func (x *GrpcSimpleCounterData) GetBase() *GrpcGenericEnhancementBase { @@ -3136,7 +3745,7 @@ type GrpcMethodInliningInfo struct { func (x *GrpcMethodInliningInfo) Reset() { *x = GrpcMethodInliningInfo{} - mi := &file_pipelines_and_context_proto_msgTypes[45] + mi := &file_pipelines_and_context_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3148,7 +3757,7 @@ func (x *GrpcMethodInliningInfo) String() string { func (*GrpcMethodInliningInfo) ProtoMessage() {} func (x *GrpcMethodInliningInfo) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[45] + mi := &file_pipelines_and_context_proto_msgTypes[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3161,7 +3770,7 @@ func (x *GrpcMethodInliningInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcMethodInliningInfo.ProtoReflect.Descriptor instead. func (*GrpcMethodInliningInfo) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{45} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{55} } func (x *GrpcMethodInliningInfo) GetInlineeInfo() *GrpcMethodNameParts { @@ -3189,7 +3798,7 @@ type GrpcMethodNameParts struct { func (x *GrpcMethodNameParts) Reset() { *x = GrpcMethodNameParts{} - mi := &file_pipelines_and_context_proto_msgTypes[46] + mi := &file_pipelines_and_context_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3201,7 +3810,7 @@ func (x *GrpcMethodNameParts) String() string { func (*GrpcMethodNameParts) ProtoMessage() {} func (x *GrpcMethodNameParts) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[46] + mi := &file_pipelines_and_context_proto_msgTypes[56] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3214,7 +3823,7 @@ func (x *GrpcMethodNameParts) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcMethodNameParts.ProtoReflect.Descriptor instead. func (*GrpcMethodNameParts) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{46} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{56} } func (x *GrpcMethodNameParts) GetName() string { @@ -3248,7 +3857,7 @@ type GrpcHistogramEntry struct { func (x *GrpcHistogramEntry) Reset() { *x = GrpcHistogramEntry{} - mi := &file_pipelines_and_context_proto_msgTypes[47] + mi := &file_pipelines_and_context_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3260,7 +3869,7 @@ func (x *GrpcHistogramEntry) String() string { func (*GrpcHistogramEntry) ProtoMessage() {} func (x *GrpcHistogramEntry) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[47] + mi := &file_pipelines_and_context_proto_msgTypes[57] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3273,7 +3882,7 @@ func (x *GrpcHistogramEntry) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcHistogramEntry.ProtoReflect.Descriptor instead. func (*GrpcHistogramEntry) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{47} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{57} } func (x *GrpcHistogramEntry) GetName() string { @@ -3299,7 +3908,7 @@ type GrpcTimelineDiagramFragment struct { func (x *GrpcTimelineDiagramFragment) Reset() { *x = GrpcTimelineDiagramFragment{} - mi := &file_pipelines_and_context_proto_msgTypes[48] + mi := &file_pipelines_and_context_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3311,7 +3920,7 @@ func (x *GrpcTimelineDiagramFragment) String() string { func (*GrpcTimelineDiagramFragment) ProtoMessage() {} func (x *GrpcTimelineDiagramFragment) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[48] + mi := &file_pipelines_and_context_proto_msgTypes[58] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3324,7 +3933,7 @@ func (x *GrpcTimelineDiagramFragment) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcTimelineDiagramFragment.ProtoReflect.Descriptor instead. func (*GrpcTimelineDiagramFragment) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{48} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{58} } func (x *GrpcTimelineDiagramFragment) GetThreads() []*GrpcThread { @@ -3345,7 +3954,7 @@ type GrpcAllocationInfo struct { func (x *GrpcAllocationInfo) Reset() { *x = GrpcAllocationInfo{} - mi := &file_pipelines_and_context_proto_msgTypes[49] + mi := &file_pipelines_and_context_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3357,7 +3966,7 @@ func (x *GrpcAllocationInfo) String() string { func (*GrpcAllocationInfo) ProtoMessage() {} func (x *GrpcAllocationInfo) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[49] + mi := &file_pipelines_and_context_proto_msgTypes[59] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3370,7 +3979,7 @@ func (x *GrpcAllocationInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcAllocationInfo.ProtoReflect.Descriptor instead. func (*GrpcAllocationInfo) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{49} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{59} } func (x *GrpcAllocationInfo) GetTypeName() string { @@ -3405,7 +4014,7 @@ type GrpcUnderlyingPatternInfo struct { func (x *GrpcUnderlyingPatternInfo) Reset() { *x = GrpcUnderlyingPatternInfo{} - mi := &file_pipelines_and_context_proto_msgTypes[50] + mi := &file_pipelines_and_context_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3417,7 +4026,7 @@ func (x *GrpcUnderlyingPatternInfo) String() string { func (*GrpcUnderlyingPatternInfo) ProtoMessage() {} func (x *GrpcUnderlyingPatternInfo) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[50] + mi := &file_pipelines_and_context_proto_msgTypes[60] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3430,7 +4039,7 @@ func (x *GrpcUnderlyingPatternInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcUnderlyingPatternInfo.ProtoReflect.Descriptor instead. func (*GrpcUnderlyingPatternInfo) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{50} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{60} } func (x *GrpcUnderlyingPatternInfo) GetPatternKind() GrpcUnderlyingPatternKind { @@ -3468,7 +4077,7 @@ type GrpcGraphEdge struct { func (x *GrpcGraphEdge) Reset() { *x = GrpcGraphEdge{} - mi := &file_pipelines_and_context_proto_msgTypes[51] + mi := &file_pipelines_and_context_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3480,7 +4089,7 @@ func (x *GrpcGraphEdge) String() string { func (*GrpcGraphEdge) ProtoMessage() {} func (x *GrpcGraphEdge) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[51] + mi := &file_pipelines_and_context_proto_msgTypes[61] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3493,7 +4102,7 @@ func (x *GrpcGraphEdge) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcGraphEdge.ProtoReflect.Descriptor instead. func (*GrpcGraphEdge) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{51} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{61} } func (x *GrpcGraphEdge) GetId() uint64 { @@ -3552,7 +4161,7 @@ type GrpcGraphEdgeAdditionalData struct { func (x *GrpcGraphEdgeAdditionalData) Reset() { *x = GrpcGraphEdgeAdditionalData{} - mi := &file_pipelines_and_context_proto_msgTypes[52] + mi := &file_pipelines_and_context_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3564,7 +4173,7 @@ func (x *GrpcGraphEdgeAdditionalData) String() string { func (*GrpcGraphEdgeAdditionalData) ProtoMessage() {} func (x *GrpcGraphEdgeAdditionalData) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[52] + mi := &file_pipelines_and_context_proto_msgTypes[62] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3577,7 +4186,7 @@ func (x *GrpcGraphEdgeAdditionalData) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcGraphEdgeAdditionalData.ProtoReflect.Descriptor instead. func (*GrpcGraphEdgeAdditionalData) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{52} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{62} } func (x *GrpcGraphEdgeAdditionalData) GetData() isGrpcGraphEdgeAdditionalData_Data { @@ -3645,7 +4254,7 @@ type GrpcEdgeExecutionInfo struct { func (x *GrpcEdgeExecutionInfo) Reset() { *x = GrpcEdgeExecutionInfo{} - mi := &file_pipelines_and_context_proto_msgTypes[53] + mi := &file_pipelines_and_context_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3657,7 +4266,7 @@ func (x *GrpcEdgeExecutionInfo) String() string { func (*GrpcEdgeExecutionInfo) ProtoMessage() {} func (x *GrpcEdgeExecutionInfo) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[53] + mi := &file_pipelines_and_context_proto_msgTypes[63] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3670,7 +4279,7 @@ func (x *GrpcEdgeExecutionInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcEdgeExecutionInfo.ProtoReflect.Descriptor instead. func (*GrpcEdgeExecutionInfo) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{53} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{63} } func (x *GrpcEdgeExecutionInfo) GetTraceId() uint64 { @@ -3689,7 +4298,7 @@ type GrpcBytes struct { func (x *GrpcBytes) Reset() { *x = GrpcBytes{} - mi := &file_pipelines_and_context_proto_msgTypes[54] + mi := &file_pipelines_and_context_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3701,7 +4310,7 @@ func (x *GrpcBytes) String() string { func (*GrpcBytes) ProtoMessage() {} func (x *GrpcBytes) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[54] + mi := &file_pipelines_and_context_proto_msgTypes[64] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3714,7 +4323,7 @@ func (x *GrpcBytes) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcBytes.ProtoReflect.Descriptor instead. func (*GrpcBytes) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{54} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{64} } func (x *GrpcBytes) GetBytes() []byte { @@ -3733,7 +4342,7 @@ type GrpcLogTimelineDiagram struct { func (x *GrpcLogTimelineDiagram) Reset() { *x = GrpcLogTimelineDiagram{} - mi := &file_pipelines_and_context_proto_msgTypes[55] + mi := &file_pipelines_and_context_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3745,7 +4354,7 @@ func (x *GrpcLogTimelineDiagram) String() string { func (*GrpcLogTimelineDiagram) ProtoMessage() {} func (x *GrpcLogTimelineDiagram) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[55] + mi := &file_pipelines_and_context_proto_msgTypes[65] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3758,7 +4367,7 @@ func (x *GrpcLogTimelineDiagram) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcLogTimelineDiagram.ProtoReflect.Descriptor instead. func (*GrpcLogTimelineDiagram) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{55} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{65} } func (x *GrpcLogTimelineDiagram) GetTraces() []*GrpcTraceTimelineDiagram { @@ -3778,7 +4387,7 @@ type GrpcTimelineTraceEventsGroup struct { func (x *GrpcTimelineTraceEventsGroup) Reset() { *x = GrpcTimelineTraceEventsGroup{} - mi := &file_pipelines_and_context_proto_msgTypes[56] + mi := &file_pipelines_and_context_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3790,7 +4399,7 @@ func (x *GrpcTimelineTraceEventsGroup) String() string { func (*GrpcTimelineTraceEventsGroup) ProtoMessage() {} func (x *GrpcTimelineTraceEventsGroup) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[56] + mi := &file_pipelines_and_context_proto_msgTypes[66] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3803,7 +4412,7 @@ func (x *GrpcTimelineTraceEventsGroup) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcTimelineTraceEventsGroup.ProtoReflect.Descriptor instead. func (*GrpcTimelineTraceEventsGroup) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{56} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{66} } func (x *GrpcTimelineTraceEventsGroup) GetStartPoint() *GrpcLogPoint { @@ -3830,7 +4439,7 @@ type GrpcTraceTimelineDiagram struct { func (x *GrpcTraceTimelineDiagram) Reset() { *x = GrpcTraceTimelineDiagram{} - mi := &file_pipelines_and_context_proto_msgTypes[57] + mi := &file_pipelines_and_context_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3842,7 +4451,7 @@ func (x *GrpcTraceTimelineDiagram) String() string { func (*GrpcTraceTimelineDiagram) ProtoMessage() {} func (x *GrpcTraceTimelineDiagram) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[57] + mi := &file_pipelines_and_context_proto_msgTypes[67] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3855,7 +4464,7 @@ func (x *GrpcTraceTimelineDiagram) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcTraceTimelineDiagram.ProtoReflect.Descriptor instead. func (*GrpcTraceTimelineDiagram) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{57} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{67} } func (x *GrpcTraceTimelineDiagram) GetThreads() []*GrpcThread { @@ -3881,7 +4490,7 @@ type GrpcThread struct { func (x *GrpcThread) Reset() { *x = GrpcThread{} - mi := &file_pipelines_and_context_proto_msgTypes[58] + mi := &file_pipelines_and_context_proto_msgTypes[68] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3893,7 +4502,7 @@ func (x *GrpcThread) String() string { func (*GrpcThread) ProtoMessage() {} func (x *GrpcThread) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[58] + mi := &file_pipelines_and_context_proto_msgTypes[68] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3906,7 +4515,7 @@ func (x *GrpcThread) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcThread.ProtoReflect.Descriptor instead. func (*GrpcThread) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{58} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{68} } func (x *GrpcThread) GetEvents() []*GrpcThreadEvent { @@ -3926,7 +4535,7 @@ type GrpcThreadEvent struct { func (x *GrpcThreadEvent) Reset() { *x = GrpcThreadEvent{} - mi := &file_pipelines_and_context_proto_msgTypes[59] + mi := &file_pipelines_and_context_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3938,7 +4547,7 @@ func (x *GrpcThreadEvent) String() string { func (*GrpcThreadEvent) ProtoMessage() {} func (x *GrpcThreadEvent) ProtoReflect() protoreflect.Message { - mi := &file_pipelines_and_context_proto_msgTypes[59] + mi := &file_pipelines_and_context_proto_msgTypes[69] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3951,7 +4560,7 @@ func (x *GrpcThreadEvent) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcThreadEvent.ProtoReflect.Descriptor instead. func (*GrpcThreadEvent) Descriptor() ([]byte, []int) { - return file_pipelines_and_context_proto_rawDescGZIP(), []int{59} + return file_pipelines_and_context_proto_rawDescGZIP(), []int{69} } func (x *GrpcThreadEvent) GetName() string { @@ -3978,7 +4587,7 @@ const file_pipelines_and_context_proto_rawDesc = "" + "\x04name\x18\x01 \x01(\tR\x04name\"g\n" + "\x1bGrpcContextValueWithKeyName\x12\x19\n" + "\bkey_name\x18\x01 \x01(\tR\akeyName\x12-\n" + - "\x05value\x18\x02 \x01(\v2\x17.ficus.GrpcContextValueR\x05value\"\xa4\v\n" + + "\x05value\x18\x02 \x01(\v2\x17.ficus.GrpcContextValueR\x05value\"\xef\v\n" + "\x10GrpcContextValue\x12\x18\n" + "\x06string\x18\x01 \x01(\tH\x00R\x06string\x12F\n" + "\n" + @@ -4012,8 +4621,31 @@ const file_pipelines_and_context_proto_rawDesc = "" + "\n" + "uint_array\x18\x18 \x01(\v2\x14.ficus.GrpcUintArrayH\x00R\tuintArray\x12\x14\n" + "\x04json\x18\x19 \x01(\tH\x00R\x04json\x128\n" + - "\tevent_log\x18\x1a \x01(\v2\x19.ficus.GrpcSimpleEventLogH\x00R\beventLogB\x0e\n" + - "\fcontextValue\"&\n" + + "\tevent_log\x18\x1a \x01(\v2\x19.ficus.GrpcSimpleEventLogH\x00R\beventLog\x12I\n" + + "\x0focel_annotation\x18\x1b \x01(\v2\x1e.ficus.GrpcOcelModelAnnotationH\x00R\x0eocelAnnotationB\x0e\n" + + "\fcontextValue\"b\n" + + "\x17GrpcOcelModelAnnotation\x12G\n" + + "\vannotations\x18\x01 \x03(\v2%.ficus.GrpcModelElementOcelAnnotationR\vannotations\"\x8a\x02\n" + + "\x1eGrpcModelElementOcelAnnotation\x12\x1d\n" + + "\n" + + "element_id\x18\x01 \x01(\x04R\telementId\x12>\n" + + "\rinitial_state\x18\x02 \x01(\v2\x14.ficus.GrpcOcelStateH\x00R\finitialState\x88\x01\x01\x125\n" + + "\vfinal_state\x18\x03 \x01(\v2\x14.ficus.GrpcOcelStateR\n" + + "finalState\x12@\n" + + "\trelations\x18\x04 \x03(\v2\".ficus.GrpcOcelStateObjectRelationR\trelationsB\x10\n" + + "\x0e_initial_state\"\x89\x01\n" + + "\x1bGrpcOcelStateObjectRelation\x12\x1b\n" + + "\tobject_id\x18\x01 \x01(\tR\bobjectId\x12\x1d\n" + + "\n" + + "element_id\x18\x02 \x01(\x04R\telementId\x12.\n" + + "\x13related_objects_ids\x18\x03 \x03(\tR\x11relatedObjectsIds\"P\n" + + "\rGrpcOcelState\x12?\n" + + "\vtype_states\x18\x01 \x03(\v2\x1e.ficus.GrpcOcelObjectTypeStateR\n" + + "typeStates\"L\n" + + "\x17GrpcOcelObjectTypeState\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x1d\n" + + "\n" + + "object_ids\x18\x02 \x03(\tR\tobjectIds\"&\n" + "\x0eGrpcFloatArray\x12\x14\n" + "\x05items\x18\x01 \x03(\x01R\x05items\"$\n" + "\fGrpcIntArray\x12\x14\n" + @@ -4139,13 +4771,34 @@ const file_pipelines_and_context_proto_rawDesc = "" + "\vevent_index\x18\x03 \x01(\x04R\n" + "eventIndex\"Y\n" + "\x1eGrpcNodeCorrespondingTraceData\x127\n" + - "\x18belongs_to_root_sequence\x18\x01 \x01(\bR\x15belongsToRootSequence\"\x9e\x03\n" + + "\x18belongs_to_root_sequence\x18\x01 \x01(\bR\x15belongsToRootSequence\"\xd0\x03\n" + "\x10GrpcSoftwareData\x127\n" + "\thistogram\x18\x01 \x03(\v2\x19.ficus.GrpcHistogramEntryR\thistogram\x12^\n" + "\x19timeline_diagram_fragment\x18\x02 \x01(\v2\".ficus.GrpcTimelineDiagramFragmentR\x17timelineDiagramFragment\x12F\n" + "\x0ehistogram_data\x18\r \x03(\v2\x1f.ficus.GrpcGeneralHistogramDataR\rhistogramData\x12L\n" + "\x13simple_counter_data\x18\x0e \x03(\v2\x1c.ficus.GrpcSimpleCounterDataR\x11simpleCounterData\x12[\n" + - "\x19activities_durations_data\x18\x0f \x03(\v2\x1f.ficus.GrpcActivityDurationDataR\x17activitiesDurationsData\"\x9a\x01\n" + + "\x19activities_durations_data\x18\x0f \x03(\v2\x1f.ficus.GrpcActivityDurationDataR\x17activitiesDurationsData\x120\n" + + "\tocel_data\x18\x10 \x03(\v2\x13.ficus.GrpcOcelDataR\bocelData\":\n" + + "\x16GrpcOcelObjectTypeData\x12\x17\n" + + "\x04type\x18\x01 \x01(\tH\x00R\x04type\x88\x01\x01B\a\n" + + "\x05_type\"g\n" + + "\x15GrpcOcelAllocateMerge\x12\x17\n" + + "\x04type\x18\x01 \x01(\tH\x00R\x04type\x88\x01\x01\x12,\n" + + "\x12merged_objects_ids\x18\x02 \x03(\tR\x10mergedObjectsIdsB\a\n" + + "\x05_type\"J\n" + + "\x16GrpcOcelProducedObject\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\x04type\x18\x02 \x01(\tH\x00R\x04type\x88\x01\x01B\a\n" + + "\x05_type\"b\n" + + "\x16GrpcOcelConsumeProduce\x12H\n" + + "\x10produced_objects\x18\x01 \x03(\v2\x1d.ficus.GrpcOcelProducedObjectR\x0fproducedObjects\"\xe6\x02\n" + + "\fGrpcOcelData\x12\x1b\n" + + "\tobject_id\x18\x01 \x01(\tR\bobjectId\x12;\n" + + "\ballocate\x18\x02 \x01(\v2\x1d.ficus.GrpcOcelObjectTypeDataH\x00R\ballocate\x129\n" + + "\aconsume\x18\x03 \x01(\v2\x1d.ficus.GrpcOcelObjectTypeDataH\x00R\aconsume\x12X\n" + + "\x18merged_object_allocation\x18\x04 \x01(\v2\x1c.ficus.GrpcOcelAllocateMergeH\x00R\x16mergedObjectAllocation\x12]\n" + + "\x1aproduce_object_consumption\x18\x05 \x01(\v2\x1d.ficus.GrpcOcelConsumeProduceH\x00R\x18produceObjectConsumptionB\b\n" + + "\x06action\"\x9a\x01\n" + "\x18GrpcActivityDurationData\x125\n" + "\x04base\x18\x01 \x01(\v2!.ficus.GrpcGenericEnhancementBaseR\x04base\x12\x1a\n" + "\bduration\x18\x02 \x01(\x04R\bduration\x12+\n" + @@ -4211,10 +4864,12 @@ const file_pipelines_and_context_proto_rawDesc = "" + "\x06events\x18\x01 \x03(\v2\x16.ficus.GrpcThreadEventR\x06events\";\n" + "\x0fGrpcThreadEvent\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + - "\x05stamp\x18\x02 \x01(\x03R\x05stamp*\"\n" + + "\x05stamp\x18\x02 \x01(\x03R\x05stamp*.\n" + "\rGrpcGraphKind\x12\b\n" + "\x04None\x10\x00\x12\a\n" + - "\x03DAG\x10\x01*u\n" + + "\x03DAG\x10\x01\x12\n" + + "\n" + + "\x06DagLCS\x10\x02*u\n" + "\x10GrpcDurationKind\x12\x0f\n" + "\vUnspecified\x10\x00\x12\t\n" + "\x05Nanos\x10\x01\x12\n" + @@ -4249,7 +4904,7 @@ func file_pipelines_and_context_proto_rawDescGZIP() []byte { } var file_pipelines_and_context_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_pipelines_and_context_proto_msgTypes = make([]protoimpl.MessageInfo, 60) +var file_pipelines_and_context_proto_msgTypes = make([]protoimpl.MessageInfo, 70) var file_pipelines_and_context_proto_goTypes = []any{ (GrpcGraphKind)(0), // 0: ficus.GrpcGraphKind (GrpcDurationKind)(0), // 1: ficus.GrpcDurationKind @@ -4257,171 +4912,193 @@ var file_pipelines_and_context_proto_goTypes = []any{ (*GrpcContextKey)(nil), // 3: ficus.GrpcContextKey (*GrpcContextValueWithKeyName)(nil), // 4: ficus.GrpcContextValueWithKeyName (*GrpcContextValue)(nil), // 5: ficus.GrpcContextValue - (*GrpcFloatArray)(nil), // 6: ficus.GrpcFloatArray - (*GrpcIntArray)(nil), // 7: ficus.GrpcIntArray - (*GrpcUintArray)(nil), // 8: ficus.GrpcUintArray - (*GrpcContextKeyValue)(nil), // 9: ficus.GrpcContextKeyValue - (*GrpcHashesEventLogContextValue)(nil), // 10: ficus.GrpcHashesEventLogContextValue - (*GrpcNamesEventLogContextValue)(nil), // 11: ficus.GrpcNamesEventLogContextValue - (*GrpcEventLogTraceSubArraysContextValue)(nil), // 12: ficus.GrpcEventLogTraceSubArraysContextValue - (*GrpcTraceSubArray)(nil), // 13: ficus.GrpcTraceSubArray - (*GrpcTraceSubArrays)(nil), // 14: ficus.GrpcTraceSubArrays - (*GrpcSubArrayWithTraceIndex)(nil), // 15: ficus.GrpcSubArrayWithTraceIndex - (*GrpcSubArraysWithTraceIndexContextValue)(nil), // 16: ficus.GrpcSubArraysWithTraceIndexContextValue - (*GrpcColorsEventLog)(nil), // 17: ficus.GrpcColorsEventLog - (*GrpcColorsLogAdjustment)(nil), // 18: ficus.GrpcColorsLogAdjustment - (*GrpcColorsLogRectangleAdjustment)(nil), // 19: ficus.GrpcColorsLogRectangleAdjustment - (*GrpcLogPoint)(nil), // 20: ficus.GrpcLogPoint - (*GrpcColorsLogXAxisAfterTraceAdjustment)(nil), // 21: ficus.GrpcColorsLogXAxisAfterTraceAdjustment - (*GrpcColorsEventLogMapping)(nil), // 22: ficus.GrpcColorsEventLogMapping - (*GrpcColorsTrace)(nil), // 23: ficus.GrpcColorsTrace - (*GrpcColoredRectangle)(nil), // 24: ficus.GrpcColoredRectangle - (*GrpcEnum)(nil), // 25: ficus.GrpcEnum - (*GrpcEventLogInfo)(nil), // 26: ficus.GrpcEventLogInfo - (*GrpcStrings)(nil), // 27: ficus.GrpcStrings - (*GrpcPipeline)(nil), // 28: ficus.GrpcPipeline - (*GrpcPipelinePartBase)(nil), // 29: ficus.GrpcPipelinePartBase - (*GrpcPipelinePart)(nil), // 30: ficus.GrpcPipelinePart - (*GrpcPipelinePartConfiguration)(nil), // 31: ficus.GrpcPipelinePartConfiguration - (*GrpcParallelPipelinePart)(nil), // 32: ficus.GrpcParallelPipelinePart - (*GrpcParallelPipelineParts)(nil), // 33: ficus.GrpcParallelPipelineParts - (*GrpcSimpleContextRequestPipelinePart)(nil), // 34: ficus.GrpcSimpleContextRequestPipelinePart - (*GrpcComplexContextRequestPipelinePart)(nil), // 35: ficus.GrpcComplexContextRequestPipelinePart - (*GrpcGraph)(nil), // 36: ficus.GrpcGraph - (*GrpcGraphNode)(nil), // 37: ficus.GrpcGraphNode - (*GrpcNodeAdditionalData)(nil), // 38: ficus.GrpcNodeAdditionalData - (*GrpcMultithreadedFragment)(nil), // 39: ficus.GrpcMultithreadedFragment - (*GrpcActivityStartEndData)(nil), // 40: ficus.GrpcActivityStartEndData - (*GrpcEventCoordinates)(nil), // 41: ficus.GrpcEventCoordinates - (*GrpcNodeCorrespondingTraceData)(nil), // 42: ficus.GrpcNodeCorrespondingTraceData - (*GrpcSoftwareData)(nil), // 43: ficus.GrpcSoftwareData - (*GrpcActivityDurationData)(nil), // 44: ficus.GrpcActivityDurationData - (*GrpcGenericEnhancementBase)(nil), // 45: ficus.GrpcGenericEnhancementBase - (*GrpcGeneralHistogramData)(nil), // 46: ficus.GrpcGeneralHistogramData - (*GrpcSimpleCounterData)(nil), // 47: ficus.GrpcSimpleCounterData - (*GrpcMethodInliningInfo)(nil), // 48: ficus.GrpcMethodInliningInfo - (*GrpcMethodNameParts)(nil), // 49: ficus.GrpcMethodNameParts - (*GrpcHistogramEntry)(nil), // 50: ficus.GrpcHistogramEntry - (*GrpcTimelineDiagramFragment)(nil), // 51: ficus.GrpcTimelineDiagramFragment - (*GrpcAllocationInfo)(nil), // 52: ficus.GrpcAllocationInfo - (*GrpcUnderlyingPatternInfo)(nil), // 53: ficus.GrpcUnderlyingPatternInfo - (*GrpcGraphEdge)(nil), // 54: ficus.GrpcGraphEdge - (*GrpcGraphEdgeAdditionalData)(nil), // 55: ficus.GrpcGraphEdgeAdditionalData - (*GrpcEdgeExecutionInfo)(nil), // 56: ficus.GrpcEdgeExecutionInfo - (*GrpcBytes)(nil), // 57: ficus.GrpcBytes - (*GrpcLogTimelineDiagram)(nil), // 58: ficus.GrpcLogTimelineDiagram - (*GrpcTimelineTraceEventsGroup)(nil), // 59: ficus.GrpcTimelineTraceEventsGroup - (*GrpcTraceTimelineDiagram)(nil), // 60: ficus.GrpcTraceTimelineDiagram - (*GrpcThread)(nil), // 61: ficus.GrpcThread - (*GrpcThreadEvent)(nil), // 62: ficus.GrpcThreadEvent - (*GrpcPetriNet)(nil), // 63: ficus.GrpcPetriNet - (*GrpcAnnotation)(nil), // 64: ficus.GrpcAnnotation - (*GrpcDataset)(nil), // 65: ficus.GrpcDataset - (*GrpcLabeledDataset)(nil), // 66: ficus.GrpcLabeledDataset - (*GrpcSimpleEventLog)(nil), // 67: ficus.GrpcSimpleEventLog - (*GrpcHashesEventLog)(nil), // 68: ficus.GrpcHashesEventLog - (*GrpcNamesEventLog)(nil), // 69: ficus.GrpcNamesEventLog - (*GrpcColor)(nil), // 70: ficus.GrpcColor - (*GrpcGuid)(nil), // 71: ficus.GrpcGuid - (*emptypb.Empty)(nil), // 72: google.protobuf.Empty + (*GrpcOcelModelAnnotation)(nil), // 6: ficus.GrpcOcelModelAnnotation + (*GrpcModelElementOcelAnnotation)(nil), // 7: ficus.GrpcModelElementOcelAnnotation + (*GrpcOcelStateObjectRelation)(nil), // 8: ficus.GrpcOcelStateObjectRelation + (*GrpcOcelState)(nil), // 9: ficus.GrpcOcelState + (*GrpcOcelObjectTypeState)(nil), // 10: ficus.GrpcOcelObjectTypeState + (*GrpcFloatArray)(nil), // 11: ficus.GrpcFloatArray + (*GrpcIntArray)(nil), // 12: ficus.GrpcIntArray + (*GrpcUintArray)(nil), // 13: ficus.GrpcUintArray + (*GrpcContextKeyValue)(nil), // 14: ficus.GrpcContextKeyValue + (*GrpcHashesEventLogContextValue)(nil), // 15: ficus.GrpcHashesEventLogContextValue + (*GrpcNamesEventLogContextValue)(nil), // 16: ficus.GrpcNamesEventLogContextValue + (*GrpcEventLogTraceSubArraysContextValue)(nil), // 17: ficus.GrpcEventLogTraceSubArraysContextValue + (*GrpcTraceSubArray)(nil), // 18: ficus.GrpcTraceSubArray + (*GrpcTraceSubArrays)(nil), // 19: ficus.GrpcTraceSubArrays + (*GrpcSubArrayWithTraceIndex)(nil), // 20: ficus.GrpcSubArrayWithTraceIndex + (*GrpcSubArraysWithTraceIndexContextValue)(nil), // 21: ficus.GrpcSubArraysWithTraceIndexContextValue + (*GrpcColorsEventLog)(nil), // 22: ficus.GrpcColorsEventLog + (*GrpcColorsLogAdjustment)(nil), // 23: ficus.GrpcColorsLogAdjustment + (*GrpcColorsLogRectangleAdjustment)(nil), // 24: ficus.GrpcColorsLogRectangleAdjustment + (*GrpcLogPoint)(nil), // 25: ficus.GrpcLogPoint + (*GrpcColorsLogXAxisAfterTraceAdjustment)(nil), // 26: ficus.GrpcColorsLogXAxisAfterTraceAdjustment + (*GrpcColorsEventLogMapping)(nil), // 27: ficus.GrpcColorsEventLogMapping + (*GrpcColorsTrace)(nil), // 28: ficus.GrpcColorsTrace + (*GrpcColoredRectangle)(nil), // 29: ficus.GrpcColoredRectangle + (*GrpcEnum)(nil), // 30: ficus.GrpcEnum + (*GrpcEventLogInfo)(nil), // 31: ficus.GrpcEventLogInfo + (*GrpcStrings)(nil), // 32: ficus.GrpcStrings + (*GrpcPipeline)(nil), // 33: ficus.GrpcPipeline + (*GrpcPipelinePartBase)(nil), // 34: ficus.GrpcPipelinePartBase + (*GrpcPipelinePart)(nil), // 35: ficus.GrpcPipelinePart + (*GrpcPipelinePartConfiguration)(nil), // 36: ficus.GrpcPipelinePartConfiguration + (*GrpcParallelPipelinePart)(nil), // 37: ficus.GrpcParallelPipelinePart + (*GrpcParallelPipelineParts)(nil), // 38: ficus.GrpcParallelPipelineParts + (*GrpcSimpleContextRequestPipelinePart)(nil), // 39: ficus.GrpcSimpleContextRequestPipelinePart + (*GrpcComplexContextRequestPipelinePart)(nil), // 40: ficus.GrpcComplexContextRequestPipelinePart + (*GrpcGraph)(nil), // 41: ficus.GrpcGraph + (*GrpcGraphNode)(nil), // 42: ficus.GrpcGraphNode + (*GrpcNodeAdditionalData)(nil), // 43: ficus.GrpcNodeAdditionalData + (*GrpcMultithreadedFragment)(nil), // 44: ficus.GrpcMultithreadedFragment + (*GrpcActivityStartEndData)(nil), // 45: ficus.GrpcActivityStartEndData + (*GrpcEventCoordinates)(nil), // 46: ficus.GrpcEventCoordinates + (*GrpcNodeCorrespondingTraceData)(nil), // 47: ficus.GrpcNodeCorrespondingTraceData + (*GrpcSoftwareData)(nil), // 48: ficus.GrpcSoftwareData + (*GrpcOcelObjectTypeData)(nil), // 49: ficus.GrpcOcelObjectTypeData + (*GrpcOcelAllocateMerge)(nil), // 50: ficus.GrpcOcelAllocateMerge + (*GrpcOcelProducedObject)(nil), // 51: ficus.GrpcOcelProducedObject + (*GrpcOcelConsumeProduce)(nil), // 52: ficus.GrpcOcelConsumeProduce + (*GrpcOcelData)(nil), // 53: ficus.GrpcOcelData + (*GrpcActivityDurationData)(nil), // 54: ficus.GrpcActivityDurationData + (*GrpcGenericEnhancementBase)(nil), // 55: ficus.GrpcGenericEnhancementBase + (*GrpcGeneralHistogramData)(nil), // 56: ficus.GrpcGeneralHistogramData + (*GrpcSimpleCounterData)(nil), // 57: ficus.GrpcSimpleCounterData + (*GrpcMethodInliningInfo)(nil), // 58: ficus.GrpcMethodInliningInfo + (*GrpcMethodNameParts)(nil), // 59: ficus.GrpcMethodNameParts + (*GrpcHistogramEntry)(nil), // 60: ficus.GrpcHistogramEntry + (*GrpcTimelineDiagramFragment)(nil), // 61: ficus.GrpcTimelineDiagramFragment + (*GrpcAllocationInfo)(nil), // 62: ficus.GrpcAllocationInfo + (*GrpcUnderlyingPatternInfo)(nil), // 63: ficus.GrpcUnderlyingPatternInfo + (*GrpcGraphEdge)(nil), // 64: ficus.GrpcGraphEdge + (*GrpcGraphEdgeAdditionalData)(nil), // 65: ficus.GrpcGraphEdgeAdditionalData + (*GrpcEdgeExecutionInfo)(nil), // 66: ficus.GrpcEdgeExecutionInfo + (*GrpcBytes)(nil), // 67: ficus.GrpcBytes + (*GrpcLogTimelineDiagram)(nil), // 68: ficus.GrpcLogTimelineDiagram + (*GrpcTimelineTraceEventsGroup)(nil), // 69: ficus.GrpcTimelineTraceEventsGroup + (*GrpcTraceTimelineDiagram)(nil), // 70: ficus.GrpcTraceTimelineDiagram + (*GrpcThread)(nil), // 71: ficus.GrpcThread + (*GrpcThreadEvent)(nil), // 72: ficus.GrpcThreadEvent + (*GrpcPetriNet)(nil), // 73: ficus.GrpcPetriNet + (*GrpcAnnotation)(nil), // 74: ficus.GrpcAnnotation + (*GrpcDataset)(nil), // 75: ficus.GrpcDataset + (*GrpcLabeledDataset)(nil), // 76: ficus.GrpcLabeledDataset + (*GrpcSimpleEventLog)(nil), // 77: ficus.GrpcSimpleEventLog + (*GrpcHashesEventLog)(nil), // 78: ficus.GrpcHashesEventLog + (*GrpcNamesEventLog)(nil), // 79: ficus.GrpcNamesEventLog + (*GrpcColor)(nil), // 80: ficus.GrpcColor + (*GrpcGuid)(nil), // 81: ficus.GrpcGuid + (*emptypb.Empty)(nil), // 82: google.protobuf.Empty } var file_pipelines_and_context_proto_depIdxs = []int32{ - 5, // 0: ficus.GrpcContextValueWithKeyName.value:type_name -> ficus.GrpcContextValue - 10, // 1: ficus.GrpcContextValue.hashes_log:type_name -> ficus.GrpcHashesEventLogContextValue - 11, // 2: ficus.GrpcContextValue.names_log:type_name -> ficus.GrpcNamesEventLogContextValue - 12, // 3: ficus.GrpcContextValue.traces_sub_arrays:type_name -> ficus.GrpcEventLogTraceSubArraysContextValue - 16, // 4: ficus.GrpcContextValue.trace_index_sub_arrays:type_name -> ficus.GrpcSubArraysWithTraceIndexContextValue - 11, // 5: ficus.GrpcContextValue.xes_event_log:type_name -> ficus.GrpcNamesEventLogContextValue - 17, // 6: ficus.GrpcContextValue.colors_log:type_name -> ficus.GrpcColorsEventLog - 25, // 7: ficus.GrpcContextValue.enum:type_name -> ficus.GrpcEnum - 26, // 8: ficus.GrpcContextValue.event_log_info:type_name -> ficus.GrpcEventLogInfo - 27, // 9: ficus.GrpcContextValue.strings:type_name -> ficus.GrpcStrings - 28, // 10: ficus.GrpcContextValue.pipeline:type_name -> ficus.GrpcPipeline - 63, // 11: ficus.GrpcContextValue.petriNet:type_name -> ficus.GrpcPetriNet - 36, // 12: ficus.GrpcContextValue.graph:type_name -> ficus.GrpcGraph - 64, // 13: ficus.GrpcContextValue.annotation:type_name -> ficus.GrpcAnnotation - 65, // 14: ficus.GrpcContextValue.dataset:type_name -> ficus.GrpcDataset - 66, // 15: ficus.GrpcContextValue.labeled_dataset:type_name -> ficus.GrpcLabeledDataset - 57, // 16: ficus.GrpcContextValue.bytes:type_name -> ficus.GrpcBytes - 58, // 17: ficus.GrpcContextValue.logTimelineDiagram:type_name -> ficus.GrpcLogTimelineDiagram - 6, // 18: ficus.GrpcContextValue.float_array:type_name -> ficus.GrpcFloatArray - 7, // 19: ficus.GrpcContextValue.int_array:type_name -> ficus.GrpcIntArray - 8, // 20: ficus.GrpcContextValue.uint_array:type_name -> ficus.GrpcUintArray - 67, // 21: ficus.GrpcContextValue.event_log:type_name -> ficus.GrpcSimpleEventLog - 3, // 22: ficus.GrpcContextKeyValue.key:type_name -> ficus.GrpcContextKey - 5, // 23: ficus.GrpcContextKeyValue.value:type_name -> ficus.GrpcContextValue - 68, // 24: ficus.GrpcHashesEventLogContextValue.log:type_name -> ficus.GrpcHashesEventLog - 69, // 25: ficus.GrpcNamesEventLogContextValue.log:type_name -> ficus.GrpcNamesEventLog - 14, // 26: ficus.GrpcEventLogTraceSubArraysContextValue.traces_sub_arrays:type_name -> ficus.GrpcTraceSubArrays - 13, // 27: ficus.GrpcTraceSubArrays.sub_arrays:type_name -> ficus.GrpcTraceSubArray - 13, // 28: ficus.GrpcSubArrayWithTraceIndex.sub_array:type_name -> ficus.GrpcTraceSubArray - 15, // 29: ficus.GrpcSubArraysWithTraceIndexContextValue.sub_arrays:type_name -> ficus.GrpcSubArrayWithTraceIndex - 22, // 30: ficus.GrpcColorsEventLog.mapping:type_name -> ficus.GrpcColorsEventLogMapping - 23, // 31: ficus.GrpcColorsEventLog.traces:type_name -> ficus.GrpcColorsTrace - 18, // 32: ficus.GrpcColorsEventLog.adjustments:type_name -> ficus.GrpcColorsLogAdjustment - 19, // 33: ficus.GrpcColorsLogAdjustment.rectangle_adjustment:type_name -> ficus.GrpcColorsLogRectangleAdjustment - 21, // 34: ficus.GrpcColorsLogAdjustment.axis_after_trace:type_name -> ficus.GrpcColorsLogXAxisAfterTraceAdjustment - 20, // 35: ficus.GrpcColorsLogRectangleAdjustment.up_left_point:type_name -> ficus.GrpcLogPoint - 20, // 36: ficus.GrpcColorsLogRectangleAdjustment.down_right_point:type_name -> ficus.GrpcLogPoint - 70, // 37: ficus.GrpcColorsEventLogMapping.color:type_name -> ficus.GrpcColor - 24, // 38: ficus.GrpcColorsTrace.event_colors:type_name -> ficus.GrpcColoredRectangle - 29, // 39: ficus.GrpcPipeline.parts:type_name -> ficus.GrpcPipelinePartBase - 30, // 40: ficus.GrpcPipelinePartBase.defaultPart:type_name -> ficus.GrpcPipelinePart - 32, // 41: ficus.GrpcPipelinePartBase.parallelPart:type_name -> ficus.GrpcParallelPipelinePart - 34, // 42: ficus.GrpcPipelinePartBase.simpleContextRequestPart:type_name -> ficus.GrpcSimpleContextRequestPipelinePart - 35, // 43: ficus.GrpcPipelinePartBase.complexContextRequestPart:type_name -> ficus.GrpcComplexContextRequestPipelinePart - 31, // 44: ficus.GrpcPipelinePart.configuration:type_name -> ficus.GrpcPipelinePartConfiguration - 9, // 45: ficus.GrpcPipelinePartConfiguration.configurationParameters:type_name -> ficus.GrpcContextKeyValue - 29, // 46: ficus.GrpcParallelPipelinePart.pipelineParts:type_name -> ficus.GrpcPipelinePartBase - 32, // 47: ficus.GrpcParallelPipelineParts.pipeline:type_name -> ficus.GrpcParallelPipelinePart - 3, // 48: ficus.GrpcSimpleContextRequestPipelinePart.key:type_name -> ficus.GrpcContextKey - 71, // 49: ficus.GrpcSimpleContextRequestPipelinePart.frontendPartUuid:type_name -> ficus.GrpcGuid - 3, // 50: ficus.GrpcComplexContextRequestPipelinePart.keys:type_name -> ficus.GrpcContextKey - 30, // 51: ficus.GrpcComplexContextRequestPipelinePart.beforePipelinePart:type_name -> ficus.GrpcPipelinePart - 71, // 52: ficus.GrpcComplexContextRequestPipelinePart.frontendPartUuid:type_name -> ficus.GrpcGuid - 37, // 53: ficus.GrpcGraph.nodes:type_name -> ficus.GrpcGraphNode - 54, // 54: ficus.GrpcGraph.edges:type_name -> ficus.GrpcGraphEdge - 0, // 55: ficus.GrpcGraph.kind:type_name -> ficus.GrpcGraphKind - 38, // 56: ficus.GrpcGraphNode.additional_data:type_name -> ficus.GrpcNodeAdditionalData - 36, // 57: ficus.GrpcGraphNode.inner_graph:type_name -> ficus.GrpcGraph - 72, // 58: ficus.GrpcNodeAdditionalData.none:type_name -> google.protobuf.Empty - 43, // 59: ficus.GrpcNodeAdditionalData.software_data:type_name -> ficus.GrpcSoftwareData - 53, // 60: ficus.GrpcNodeAdditionalData.pattern_info:type_name -> ficus.GrpcUnderlyingPatternInfo - 42, // 61: ficus.GrpcNodeAdditionalData.trace_data:type_name -> ficus.GrpcNodeCorrespondingTraceData - 40, // 62: ficus.GrpcNodeAdditionalData.time_data:type_name -> ficus.GrpcActivityStartEndData - 39, // 63: ficus.GrpcNodeAdditionalData.multithreaded_fragment:type_name -> ficus.GrpcMultithreadedFragment - 41, // 64: ficus.GrpcNodeAdditionalData.original_event_coordinates:type_name -> ficus.GrpcEventCoordinates - 67, // 65: ficus.GrpcMultithreadedFragment.multithreaded_log:type_name -> ficus.GrpcSimpleEventLog - 50, // 66: ficus.GrpcSoftwareData.histogram:type_name -> ficus.GrpcHistogramEntry - 51, // 67: ficus.GrpcSoftwareData.timeline_diagram_fragment:type_name -> ficus.GrpcTimelineDiagramFragment - 46, // 68: ficus.GrpcSoftwareData.histogram_data:type_name -> ficus.GrpcGeneralHistogramData - 47, // 69: ficus.GrpcSoftwareData.simple_counter_data:type_name -> ficus.GrpcSimpleCounterData - 44, // 70: ficus.GrpcSoftwareData.activities_durations_data:type_name -> ficus.GrpcActivityDurationData - 45, // 71: ficus.GrpcActivityDurationData.base:type_name -> ficus.GrpcGenericEnhancementBase - 1, // 72: ficus.GrpcActivityDurationData.kind:type_name -> ficus.GrpcDurationKind - 45, // 73: ficus.GrpcGeneralHistogramData.base:type_name -> ficus.GrpcGenericEnhancementBase - 50, // 74: ficus.GrpcGeneralHistogramData.entries:type_name -> ficus.GrpcHistogramEntry - 45, // 75: ficus.GrpcSimpleCounterData.base:type_name -> ficus.GrpcGenericEnhancementBase - 49, // 76: ficus.GrpcMethodInliningInfo.inlinee_info:type_name -> ficus.GrpcMethodNameParts - 49, // 77: ficus.GrpcMethodInliningInfo.inliner_info:type_name -> ficus.GrpcMethodNameParts - 61, // 78: ficus.GrpcTimelineDiagramFragment.threads:type_name -> ficus.GrpcThread - 2, // 79: ficus.GrpcUnderlyingPatternInfo.pattern_kind:type_name -> ficus.GrpcUnderlyingPatternKind - 36, // 80: ficus.GrpcUnderlyingPatternInfo.graph:type_name -> ficus.GrpcGraph - 55, // 81: ficus.GrpcGraphEdge.additional_data:type_name -> ficus.GrpcGraphEdgeAdditionalData - 43, // 82: ficus.GrpcGraphEdgeAdditionalData.software_data:type_name -> ficus.GrpcSoftwareData - 56, // 83: ficus.GrpcGraphEdgeAdditionalData.execution_info:type_name -> ficus.GrpcEdgeExecutionInfo - 40, // 84: ficus.GrpcGraphEdgeAdditionalData.time_data:type_name -> ficus.GrpcActivityStartEndData - 60, // 85: ficus.GrpcLogTimelineDiagram.traces:type_name -> ficus.GrpcTraceTimelineDiagram - 20, // 86: ficus.GrpcTimelineTraceEventsGroup.start_point:type_name -> ficus.GrpcLogPoint - 20, // 87: ficus.GrpcTimelineTraceEventsGroup.end_point:type_name -> ficus.GrpcLogPoint - 61, // 88: ficus.GrpcTraceTimelineDiagram.threads:type_name -> ficus.GrpcThread - 59, // 89: ficus.GrpcTraceTimelineDiagram.events_groups:type_name -> ficus.GrpcTimelineTraceEventsGroup - 62, // 90: ficus.GrpcThread.events:type_name -> ficus.GrpcThreadEvent - 91, // [91:91] is the sub-list for method output_type - 91, // [91:91] is the sub-list for method input_type - 91, // [91:91] is the sub-list for extension type_name - 91, // [91:91] is the sub-list for extension extendee - 0, // [0:91] is the sub-list for field type_name + 5, // 0: ficus.GrpcContextValueWithKeyName.value:type_name -> ficus.GrpcContextValue + 15, // 1: ficus.GrpcContextValue.hashes_log:type_name -> ficus.GrpcHashesEventLogContextValue + 16, // 2: ficus.GrpcContextValue.names_log:type_name -> ficus.GrpcNamesEventLogContextValue + 17, // 3: ficus.GrpcContextValue.traces_sub_arrays:type_name -> ficus.GrpcEventLogTraceSubArraysContextValue + 21, // 4: ficus.GrpcContextValue.trace_index_sub_arrays:type_name -> ficus.GrpcSubArraysWithTraceIndexContextValue + 16, // 5: ficus.GrpcContextValue.xes_event_log:type_name -> ficus.GrpcNamesEventLogContextValue + 22, // 6: ficus.GrpcContextValue.colors_log:type_name -> ficus.GrpcColorsEventLog + 30, // 7: ficus.GrpcContextValue.enum:type_name -> ficus.GrpcEnum + 31, // 8: ficus.GrpcContextValue.event_log_info:type_name -> ficus.GrpcEventLogInfo + 32, // 9: ficus.GrpcContextValue.strings:type_name -> ficus.GrpcStrings + 33, // 10: ficus.GrpcContextValue.pipeline:type_name -> ficus.GrpcPipeline + 73, // 11: ficus.GrpcContextValue.petriNet:type_name -> ficus.GrpcPetriNet + 41, // 12: ficus.GrpcContextValue.graph:type_name -> ficus.GrpcGraph + 74, // 13: ficus.GrpcContextValue.annotation:type_name -> ficus.GrpcAnnotation + 75, // 14: ficus.GrpcContextValue.dataset:type_name -> ficus.GrpcDataset + 76, // 15: ficus.GrpcContextValue.labeled_dataset:type_name -> ficus.GrpcLabeledDataset + 67, // 16: ficus.GrpcContextValue.bytes:type_name -> ficus.GrpcBytes + 68, // 17: ficus.GrpcContextValue.logTimelineDiagram:type_name -> ficus.GrpcLogTimelineDiagram + 11, // 18: ficus.GrpcContextValue.float_array:type_name -> ficus.GrpcFloatArray + 12, // 19: ficus.GrpcContextValue.int_array:type_name -> ficus.GrpcIntArray + 13, // 20: ficus.GrpcContextValue.uint_array:type_name -> ficus.GrpcUintArray + 77, // 21: ficus.GrpcContextValue.event_log:type_name -> ficus.GrpcSimpleEventLog + 6, // 22: ficus.GrpcContextValue.ocel_annotation:type_name -> ficus.GrpcOcelModelAnnotation + 7, // 23: ficus.GrpcOcelModelAnnotation.annotations:type_name -> ficus.GrpcModelElementOcelAnnotation + 9, // 24: ficus.GrpcModelElementOcelAnnotation.initial_state:type_name -> ficus.GrpcOcelState + 9, // 25: ficus.GrpcModelElementOcelAnnotation.final_state:type_name -> ficus.GrpcOcelState + 8, // 26: ficus.GrpcModelElementOcelAnnotation.relations:type_name -> ficus.GrpcOcelStateObjectRelation + 10, // 27: ficus.GrpcOcelState.type_states:type_name -> ficus.GrpcOcelObjectTypeState + 3, // 28: ficus.GrpcContextKeyValue.key:type_name -> ficus.GrpcContextKey + 5, // 29: ficus.GrpcContextKeyValue.value:type_name -> ficus.GrpcContextValue + 78, // 30: ficus.GrpcHashesEventLogContextValue.log:type_name -> ficus.GrpcHashesEventLog + 79, // 31: ficus.GrpcNamesEventLogContextValue.log:type_name -> ficus.GrpcNamesEventLog + 19, // 32: ficus.GrpcEventLogTraceSubArraysContextValue.traces_sub_arrays:type_name -> ficus.GrpcTraceSubArrays + 18, // 33: ficus.GrpcTraceSubArrays.sub_arrays:type_name -> ficus.GrpcTraceSubArray + 18, // 34: ficus.GrpcSubArrayWithTraceIndex.sub_array:type_name -> ficus.GrpcTraceSubArray + 20, // 35: ficus.GrpcSubArraysWithTraceIndexContextValue.sub_arrays:type_name -> ficus.GrpcSubArrayWithTraceIndex + 27, // 36: ficus.GrpcColorsEventLog.mapping:type_name -> ficus.GrpcColorsEventLogMapping + 28, // 37: ficus.GrpcColorsEventLog.traces:type_name -> ficus.GrpcColorsTrace + 23, // 38: ficus.GrpcColorsEventLog.adjustments:type_name -> ficus.GrpcColorsLogAdjustment + 24, // 39: ficus.GrpcColorsLogAdjustment.rectangle_adjustment:type_name -> ficus.GrpcColorsLogRectangleAdjustment + 26, // 40: ficus.GrpcColorsLogAdjustment.axis_after_trace:type_name -> ficus.GrpcColorsLogXAxisAfterTraceAdjustment + 25, // 41: ficus.GrpcColorsLogRectangleAdjustment.up_left_point:type_name -> ficus.GrpcLogPoint + 25, // 42: ficus.GrpcColorsLogRectangleAdjustment.down_right_point:type_name -> ficus.GrpcLogPoint + 80, // 43: ficus.GrpcColorsEventLogMapping.color:type_name -> ficus.GrpcColor + 29, // 44: ficus.GrpcColorsTrace.event_colors:type_name -> ficus.GrpcColoredRectangle + 34, // 45: ficus.GrpcPipeline.parts:type_name -> ficus.GrpcPipelinePartBase + 35, // 46: ficus.GrpcPipelinePartBase.defaultPart:type_name -> ficus.GrpcPipelinePart + 37, // 47: ficus.GrpcPipelinePartBase.parallelPart:type_name -> ficus.GrpcParallelPipelinePart + 39, // 48: ficus.GrpcPipelinePartBase.simpleContextRequestPart:type_name -> ficus.GrpcSimpleContextRequestPipelinePart + 40, // 49: ficus.GrpcPipelinePartBase.complexContextRequestPart:type_name -> ficus.GrpcComplexContextRequestPipelinePart + 36, // 50: ficus.GrpcPipelinePart.configuration:type_name -> ficus.GrpcPipelinePartConfiguration + 14, // 51: ficus.GrpcPipelinePartConfiguration.configurationParameters:type_name -> ficus.GrpcContextKeyValue + 34, // 52: ficus.GrpcParallelPipelinePart.pipelineParts:type_name -> ficus.GrpcPipelinePartBase + 37, // 53: ficus.GrpcParallelPipelineParts.pipeline:type_name -> ficus.GrpcParallelPipelinePart + 3, // 54: ficus.GrpcSimpleContextRequestPipelinePart.key:type_name -> ficus.GrpcContextKey + 81, // 55: ficus.GrpcSimpleContextRequestPipelinePart.frontendPartUuid:type_name -> ficus.GrpcGuid + 3, // 56: ficus.GrpcComplexContextRequestPipelinePart.keys:type_name -> ficus.GrpcContextKey + 35, // 57: ficus.GrpcComplexContextRequestPipelinePart.beforePipelinePart:type_name -> ficus.GrpcPipelinePart + 81, // 58: ficus.GrpcComplexContextRequestPipelinePart.frontendPartUuid:type_name -> ficus.GrpcGuid + 42, // 59: ficus.GrpcGraph.nodes:type_name -> ficus.GrpcGraphNode + 64, // 60: ficus.GrpcGraph.edges:type_name -> ficus.GrpcGraphEdge + 0, // 61: ficus.GrpcGraph.kind:type_name -> ficus.GrpcGraphKind + 43, // 62: ficus.GrpcGraphNode.additional_data:type_name -> ficus.GrpcNodeAdditionalData + 41, // 63: ficus.GrpcGraphNode.inner_graph:type_name -> ficus.GrpcGraph + 82, // 64: ficus.GrpcNodeAdditionalData.none:type_name -> google.protobuf.Empty + 48, // 65: ficus.GrpcNodeAdditionalData.software_data:type_name -> ficus.GrpcSoftwareData + 63, // 66: ficus.GrpcNodeAdditionalData.pattern_info:type_name -> ficus.GrpcUnderlyingPatternInfo + 47, // 67: ficus.GrpcNodeAdditionalData.trace_data:type_name -> ficus.GrpcNodeCorrespondingTraceData + 45, // 68: ficus.GrpcNodeAdditionalData.time_data:type_name -> ficus.GrpcActivityStartEndData + 44, // 69: ficus.GrpcNodeAdditionalData.multithreaded_fragment:type_name -> ficus.GrpcMultithreadedFragment + 46, // 70: ficus.GrpcNodeAdditionalData.original_event_coordinates:type_name -> ficus.GrpcEventCoordinates + 77, // 71: ficus.GrpcMultithreadedFragment.multithreaded_log:type_name -> ficus.GrpcSimpleEventLog + 60, // 72: ficus.GrpcSoftwareData.histogram:type_name -> ficus.GrpcHistogramEntry + 61, // 73: ficus.GrpcSoftwareData.timeline_diagram_fragment:type_name -> ficus.GrpcTimelineDiagramFragment + 56, // 74: ficus.GrpcSoftwareData.histogram_data:type_name -> ficus.GrpcGeneralHistogramData + 57, // 75: ficus.GrpcSoftwareData.simple_counter_data:type_name -> ficus.GrpcSimpleCounterData + 54, // 76: ficus.GrpcSoftwareData.activities_durations_data:type_name -> ficus.GrpcActivityDurationData + 53, // 77: ficus.GrpcSoftwareData.ocel_data:type_name -> ficus.GrpcOcelData + 51, // 78: ficus.GrpcOcelConsumeProduce.produced_objects:type_name -> ficus.GrpcOcelProducedObject + 49, // 79: ficus.GrpcOcelData.allocate:type_name -> ficus.GrpcOcelObjectTypeData + 49, // 80: ficus.GrpcOcelData.consume:type_name -> ficus.GrpcOcelObjectTypeData + 50, // 81: ficus.GrpcOcelData.merged_object_allocation:type_name -> ficus.GrpcOcelAllocateMerge + 52, // 82: ficus.GrpcOcelData.produce_object_consumption:type_name -> ficus.GrpcOcelConsumeProduce + 55, // 83: ficus.GrpcActivityDurationData.base:type_name -> ficus.GrpcGenericEnhancementBase + 1, // 84: ficus.GrpcActivityDurationData.kind:type_name -> ficus.GrpcDurationKind + 55, // 85: ficus.GrpcGeneralHistogramData.base:type_name -> ficus.GrpcGenericEnhancementBase + 60, // 86: ficus.GrpcGeneralHistogramData.entries:type_name -> ficus.GrpcHistogramEntry + 55, // 87: ficus.GrpcSimpleCounterData.base:type_name -> ficus.GrpcGenericEnhancementBase + 59, // 88: ficus.GrpcMethodInliningInfo.inlinee_info:type_name -> ficus.GrpcMethodNameParts + 59, // 89: ficus.GrpcMethodInliningInfo.inliner_info:type_name -> ficus.GrpcMethodNameParts + 71, // 90: ficus.GrpcTimelineDiagramFragment.threads:type_name -> ficus.GrpcThread + 2, // 91: ficus.GrpcUnderlyingPatternInfo.pattern_kind:type_name -> ficus.GrpcUnderlyingPatternKind + 41, // 92: ficus.GrpcUnderlyingPatternInfo.graph:type_name -> ficus.GrpcGraph + 65, // 93: ficus.GrpcGraphEdge.additional_data:type_name -> ficus.GrpcGraphEdgeAdditionalData + 48, // 94: ficus.GrpcGraphEdgeAdditionalData.software_data:type_name -> ficus.GrpcSoftwareData + 66, // 95: ficus.GrpcGraphEdgeAdditionalData.execution_info:type_name -> ficus.GrpcEdgeExecutionInfo + 45, // 96: ficus.GrpcGraphEdgeAdditionalData.time_data:type_name -> ficus.GrpcActivityStartEndData + 70, // 97: ficus.GrpcLogTimelineDiagram.traces:type_name -> ficus.GrpcTraceTimelineDiagram + 25, // 98: ficus.GrpcTimelineTraceEventsGroup.start_point:type_name -> ficus.GrpcLogPoint + 25, // 99: ficus.GrpcTimelineTraceEventsGroup.end_point:type_name -> ficus.GrpcLogPoint + 71, // 100: ficus.GrpcTraceTimelineDiagram.threads:type_name -> ficus.GrpcThread + 69, // 101: ficus.GrpcTraceTimelineDiagram.events_groups:type_name -> ficus.GrpcTimelineTraceEventsGroup + 72, // 102: ficus.GrpcThread.events:type_name -> ficus.GrpcThreadEvent + 103, // [103:103] is the sub-list for method output_type + 103, // [103:103] is the sub-list for method input_type + 103, // [103:103] is the sub-list for extension type_name + 103, // [103:103] is the sub-list for extension extendee + 0, // [0:103] is the sub-list for field type_name } func init() { file_pipelines_and_context_proto_init() } @@ -4458,18 +5135,20 @@ func file_pipelines_and_context_proto_init() { (*GrpcContextValue_UintArray)(nil), (*GrpcContextValue_Json)(nil), (*GrpcContextValue_EventLog)(nil), + (*GrpcContextValue_OcelAnnotation)(nil), } - file_pipelines_and_context_proto_msgTypes[15].OneofWrappers = []any{ + file_pipelines_and_context_proto_msgTypes[4].OneofWrappers = []any{} + file_pipelines_and_context_proto_msgTypes[20].OneofWrappers = []any{ (*GrpcColorsLogAdjustment_RectangleAdjustment)(nil), (*GrpcColorsLogAdjustment_AxisAfterTrace)(nil), } - file_pipelines_and_context_proto_msgTypes[26].OneofWrappers = []any{ + file_pipelines_and_context_proto_msgTypes[31].OneofWrappers = []any{ (*GrpcPipelinePartBase_DefaultPart)(nil), (*GrpcPipelinePartBase_ParallelPart)(nil), (*GrpcPipelinePartBase_SimpleContextRequestPart)(nil), (*GrpcPipelinePartBase_ComplexContextRequestPart)(nil), } - file_pipelines_and_context_proto_msgTypes[35].OneofWrappers = []any{ + file_pipelines_and_context_proto_msgTypes[40].OneofWrappers = []any{ (*GrpcNodeAdditionalData_None)(nil), (*GrpcNodeAdditionalData_SoftwareData)(nil), (*GrpcNodeAdditionalData_PatternInfo)(nil), @@ -4477,8 +5156,17 @@ func file_pipelines_and_context_proto_init() { (*GrpcNodeAdditionalData_TimeData)(nil), (*GrpcNodeAdditionalData_MultithreadedFragment)(nil), } - file_pipelines_and_context_proto_msgTypes[42].OneofWrappers = []any{} - file_pipelines_and_context_proto_msgTypes[52].OneofWrappers = []any{ + file_pipelines_and_context_proto_msgTypes[46].OneofWrappers = []any{} + file_pipelines_and_context_proto_msgTypes[47].OneofWrappers = []any{} + file_pipelines_and_context_proto_msgTypes[48].OneofWrappers = []any{} + file_pipelines_and_context_proto_msgTypes[50].OneofWrappers = []any{ + (*GrpcOcelData_Allocate)(nil), + (*GrpcOcelData_Consume)(nil), + (*GrpcOcelData_MergedObjectAllocation)(nil), + (*GrpcOcelData_ProduceObjectConsumption)(nil), + } + file_pipelines_and_context_proto_msgTypes[52].OneofWrappers = []any{} + file_pipelines_and_context_proto_msgTypes[62].OneofWrappers = []any{ (*GrpcGraphEdgeAdditionalData_SoftwareData)(nil), (*GrpcGraphEdgeAdditionalData_ExecutionInfo)(nil), (*GrpcGraphEdgeAdditionalData_TimeData)(nil), @@ -4489,7 +5177,7 @@ func file_pipelines_and_context_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_pipelines_and_context_proto_rawDesc), len(file_pipelines_and_context_proto_rawDesc)), NumEnums: 3, - NumMessages: 60, + NumMessages: 70, NumExtensions: 0, NumServices: 0, }, diff --git a/Ficus/src/python/ficus/grpc_pipelines/annotations.py b/Ficus/src/python/ficus/grpc_pipelines/annotations.py index b38295f4c..447e42707 100644 --- a/Ficus/src/python/ficus/grpc_pipelines/annotations.py +++ b/Ficus/src/python/ficus/grpc_pipelines/annotations.py @@ -112,19 +112,31 @@ def __init__(self, background_color: str = 'white', engine='dot', export_path: Optional[str] = None, - rankdir: str = 'LR'): + rankdir: str = 'LR', + add_ocel_annotation: bool = False): super().__init__(name, background_color, engine, export_path, rankdir) self.annotation_kind = annotation_kind + self.add_ocel_annotation = add_ocel_annotation def to_grpc_part(self) -> GrpcPipelinePartBase: config = GrpcPipelinePartConfiguration() append_enum_value(config, const_time_annotation_kind, const_time_annotation_kind_enum_name, self.annotation_kind.name) + keys = [const_graph, const_graph_time_annotation] + if self.add_ocel_annotation: + keys.append(const_ocel_annotation) + part = create_complex_get_context_part(self.uuid, self.__class__.__name__, - [const_graph, const_graph_time_annotation], + keys, const_annotate_graph_with_time, config) return GrpcPipelinePartBase(complexContextRequestPart=part) + + +class CreateDagOcelAnnotation(PipelinePart): + def to_grpc_part(self) -> GrpcPipelinePartBase: + config = GrpcPipelinePartConfiguration() + return GrpcPipelinePartBase(defaultPart=create_default_pipeline_part(const_create_ocel_annotation_for_dag, config)) diff --git a/Ficus/src/python/ficus/grpc_pipelines/constants.py b/Ficus/src/python/ficus/grpc_pipelines/constants.py index b18e3ea56..6a3edaebe 100644 --- a/Ficus/src/python/ficus/grpc_pipelines/constants.py +++ b/Ficus/src/python/ficus/grpc_pipelines/constants.py @@ -76,6 +76,7 @@ const_software_data_extraction_config = 'software_data_extraction_config' const_discover_activities_instances_strict = 'discover_activity_instances_strict' const_put_noise_events_in_one_cluster = 'put_noise_events_in_one_cluster' +const_ocel_annotation = "ocel_annotation" const_draw_placement_of_event_by_regex = 'DrawPlacementOfEventsByRegex' const_draw_full_activities_diagram = 'DrawFullActivitiesDiagram' @@ -165,6 +166,7 @@ const_add_graph_to_graphs = 'AddGraphToGraphs' const_clear_graphs = 'ClearGraphs' const_terminate_if_empty_log = 'TerminateIfEmptyLog' +const_create_ocel_annotation_for_dag = 'CreateOcelAnnotationForDag' const_pattern_discovery_strategy_enum_name = 'PatternsDiscoveryStrategy' const_patterns_kind_enum_name = 'PatternsKindDto' diff --git a/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.py b/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.py index 9931fcdbf..66ebcb412 100644 --- a/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.py +++ b/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.py @@ -34,7 +34,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bpipelines_and_context.proto\x12\x05\x66icus\x1a\x0fpm_models.proto\x1a\nutil.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x1e\n\x0eGrpcContextKey\x12\x0c\n\x04name\x18\x01 \x01(\t\"W\n\x1bGrpcContextValueWithKeyName\x12\x10\n\x08key_name\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcContextValue\"\x8b\t\n\x10GrpcContextValue\x12\x10\n\x06string\x18\x01 \x01(\tH\x00\x12;\n\nhashes_log\x18\x02 \x01(\x0b\x32%.ficus.GrpcHashesEventLogContextValueH\x00\x12\x39\n\tnames_log\x18\x03 \x01(\x0b\x32$.ficus.GrpcNamesEventLogContextValueH\x00\x12\x10\n\x06uint32\x18\x04 \x01(\rH\x00\x12J\n\x11traces_sub_arrays\x18\x05 \x01(\x0b\x32-.ficus.GrpcEventLogTraceSubArraysContextValueH\x00\x12P\n\x16trace_index_sub_arrays\x18\x06 \x01(\x0b\x32..ficus.GrpcSubArraysWithTraceIndexContextValueH\x00\x12\x0e\n\x04\x62ool\x18\x07 \x01(\x08H\x00\x12=\n\rxes_event_log\x18\x08 \x01(\x0b\x32$.ficus.GrpcNamesEventLogContextValueH\x00\x12/\n\ncolors_log\x18\t \x01(\x0b\x32\x19.ficus.GrpcColorsEventLogH\x00\x12\x1f\n\x04\x65num\x18\n \x01(\x0b\x32\x0f.ficus.GrpcEnumH\x00\x12\x31\n\x0e\x65vent_log_info\x18\x0b \x01(\x0b\x32\x17.ficus.GrpcEventLogInfoH\x00\x12%\n\x07strings\x18\x0c \x01(\x0b\x32\x12.ficus.GrpcStringsH\x00\x12\'\n\x08pipeline\x18\r \x01(\x0b\x32\x13.ficus.GrpcPipelineH\x00\x12\'\n\x08petriNet\x18\x0e \x01(\x0b\x32\x13.ficus.GrpcPetriNetH\x00\x12!\n\x05graph\x18\x0f \x01(\x0b\x32\x10.ficus.GrpcGraphH\x00\x12\x0f\n\x05\x66loat\x18\x10 \x01(\x02H\x00\x12+\n\nannotation\x18\x11 \x01(\x0b\x32\x15.ficus.GrpcAnnotationH\x00\x12%\n\x07\x64\x61taset\x18\x12 \x01(\x0b\x32\x12.ficus.GrpcDatasetH\x00\x12\x34\n\x0flabeled_dataset\x18\x13 \x01(\x0b\x32\x19.ficus.GrpcLabeledDatasetH\x00\x12!\n\x05\x62ytes\x18\x14 \x01(\x0b\x32\x10.ficus.GrpcBytesH\x00\x12;\n\x12logTimelineDiagram\x18\x15 \x01(\x0b\x32\x1d.ficus.GrpcLogTimelineDiagramH\x00\x12,\n\x0b\x66loat_array\x18\x16 \x01(\x0b\x32\x15.ficus.GrpcFloatArrayH\x00\x12(\n\tint_array\x18\x17 \x01(\x0b\x32\x13.ficus.GrpcIntArrayH\x00\x12*\n\nuint_array\x18\x18 \x01(\x0b\x32\x14.ficus.GrpcUintArrayH\x00\x12\x0e\n\x04json\x18\x19 \x01(\tH\x00\x12.\n\tevent_log\x18\x1a \x01(\x0b\x32\x19.ficus.GrpcSimpleEventLogH\x00\x42\x0e\n\x0c\x63ontextValue\"\x1f\n\x0eGrpcFloatArray\x12\r\n\x05items\x18\x01 \x03(\x01\"\x1d\n\x0cGrpcIntArray\x12\r\n\x05items\x18\x01 \x03(\x03\"\x1e\n\rGrpcUintArray\x12\r\n\x05items\x18\x01 \x03(\x04\"a\n\x13GrpcContextKeyValue\x12\"\n\x03key\x18\x01 \x01(\x0b\x32\x15.ficus.GrpcContextKey\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcContextValue\"H\n\x1eGrpcHashesEventLogContextValue\x12&\n\x03log\x18\x01 \x01(\x0b\x32\x19.ficus.GrpcHashesEventLog\"F\n\x1dGrpcNamesEventLogContextValue\x12%\n\x03log\x18\x01 \x01(\x0b\x32\x18.ficus.GrpcNamesEventLog\"^\n&GrpcEventLogTraceSubArraysContextValue\x12\x34\n\x11traces_sub_arrays\x18\x01 \x03(\x0b\x32\x19.ficus.GrpcTraceSubArrays\"/\n\x11GrpcTraceSubArray\x12\r\n\x05start\x18\x01 \x01(\r\x12\x0b\n\x03\x65nd\x18\x02 \x01(\r\"B\n\x12GrpcTraceSubArrays\x12,\n\nsub_arrays\x18\x01 \x03(\x0b\x32\x18.ficus.GrpcTraceSubArray\"^\n\x1aGrpcSubArrayWithTraceIndex\x12+\n\tsub_array\x18\x01 \x01(\x0b\x32\x18.ficus.GrpcTraceSubArray\x12\x13\n\x0btrace_index\x18\x02 \x01(\r\"`\n\'GrpcSubArraysWithTraceIndexContextValue\x12\x35\n\nsub_arrays\x18\x01 \x03(\x0b\x32!.ficus.GrpcSubArrayWithTraceIndex\"\xa4\x01\n\x12GrpcColorsEventLog\x12\x31\n\x07mapping\x18\x01 \x03(\x0b\x32 .ficus.GrpcColorsEventLogMapping\x12&\n\x06traces\x18\x02 \x03(\x0b\x32\x16.ficus.GrpcColorsTrace\x12\x33\n\x0b\x61\x64justments\x18\x03 \x03(\x0b\x32\x1e.ficus.GrpcColorsLogAdjustment\"\xba\x01\n\x17GrpcColorsLogAdjustment\x12G\n\x14rectangle_adjustment\x18\x01 \x01(\x0b\x32\'.ficus.GrpcColorsLogRectangleAdjustmentH\x00\x12I\n\x10\x61xis_after_trace\x18\x02 \x01(\x0b\x32-.ficus.GrpcColorsLogXAxisAfterTraceAdjustmentH\x00\x42\x0b\n\tselection\"\xa9\x01\n GrpcColorsLogRectangleAdjustment\x12*\n\rup_left_point\x18\x01 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\x12-\n\x10\x64own_right_point\x18\x02 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\x12*\n\"extend_to_nearest_vertical_borders\x18\x03 \x01(\x08\"8\n\x0cGrpcLogPoint\x12\x13\n\x0btrace_index\x18\x01 \x01(\x04\x12\x13\n\x0b\x65vent_index\x18\x02 \x01(\x04\"=\n&GrpcColorsLogXAxisAfterTraceAdjustment\x12\x13\n\x0btrace_index\x18\x01 \x01(\x04\"J\n\x19GrpcColorsEventLogMapping\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1f\n\x05\x63olor\x18\x02 \x01(\x0b\x32\x10.ficus.GrpcColor\"\\\n\x0fGrpcColorsTrace\x12\x31\n\x0c\x65vent_colors\x18\x01 \x03(\x0b\x32\x1b.ficus.GrpcColoredRectangle\x12\x16\n\x0e\x63onstant_width\x18\x02 \x01(\x08\"L\n\x14GrpcColoredRectangle\x12\x13\n\x0b\x63olor_index\x18\x01 \x01(\r\x12\x0f\n\x07start_x\x18\x02 \x01(\x01\x12\x0e\n\x06length\x18\x03 \x01(\x01\"+\n\x08GrpcEnum\x12\x10\n\x08\x65numType\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"[\n\x10GrpcEventLogInfo\x12\x14\n\x0c\x65vents_count\x18\x01 \x01(\r\x12\x14\n\x0ctraces_count\x18\x02 \x01(\r\x12\x1b\n\x13\x65vent_classes_count\x18\x03 \x01(\r\"\x1e\n\x0bGrpcStrings\x12\x0f\n\x07strings\x18\x01 \x03(\t\":\n\x0cGrpcPipeline\x12*\n\x05parts\x18\x01 \x03(\x0b\x32\x1b.ficus.GrpcPipelinePartBase\"\xab\x02\n\x14GrpcPipelinePartBase\x12.\n\x0b\x64\x65\x66\x61ultPart\x18\x01 \x01(\x0b\x32\x17.ficus.GrpcPipelinePartH\x00\x12\x37\n\x0cparallelPart\x18\x02 \x01(\x0b\x32\x1f.ficus.GrpcParallelPipelinePartH\x00\x12O\n\x18simpleContextRequestPart\x18\x03 \x01(\x0b\x32+.ficus.GrpcSimpleContextRequestPipelinePartH\x00\x12Q\n\x19\x63omplexContextRequestPart\x18\x04 \x01(\x0b\x32,.ficus.GrpcComplexContextRequestPipelinePartH\x00\x42\x06\n\x04part\"]\n\x10GrpcPipelinePart\x12\x0c\n\x04name\x18\x01 \x01(\t\x12;\n\rconfiguration\x18\x02 \x01(\x0b\x32$.ficus.GrpcPipelinePartConfiguration\"\\\n\x1dGrpcPipelinePartConfiguration\x12;\n\x17\x63onfigurationParameters\x18\x01 \x03(\x0b\x32\x1a.ficus.GrpcContextKeyValue\"N\n\x18GrpcParallelPipelinePart\x12\x32\n\rpipelineParts\x18\x01 \x03(\x0b\x32\x1b.ficus.GrpcPipelinePartBase\"N\n\x19GrpcParallelPipelineParts\x12\x31\n\x08pipeline\x18\x01 \x03(\x0b\x32\x1f.ficus.GrpcParallelPipelinePart\"\x97\x01\n$GrpcSimpleContextRequestPipelinePart\x12\"\n\x03key\x18\x01 \x01(\x0b\x32\x15.ficus.GrpcContextKey\x12)\n\x10\x66rontendPartUuid\x18\x02 \x01(\x0b\x32\x0f.ficus.GrpcGuid\x12 \n\x18\x66rontendPipelinePartName\x18\x03 \x01(\t\"\xce\x01\n%GrpcComplexContextRequestPipelinePart\x12#\n\x04keys\x18\x01 \x03(\x0b\x32\x15.ficus.GrpcContextKey\x12\x33\n\x12\x62\x65\x66orePipelinePart\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcPipelinePart\x12)\n\x10\x66rontendPartUuid\x18\x03 \x01(\x0b\x32\x0f.ficus.GrpcGuid\x12 \n\x18\x66rontendPipelinePartName\x18\x04 \x01(\t\"y\n\tGrpcGraph\x12#\n\x05nodes\x18\x01 \x03(\x0b\x32\x14.ficus.GrpcGraphNode\x12#\n\x05\x65\x64ges\x18\x02 \x03(\x0b\x32\x14.ficus.GrpcGraphEdge\x12\"\n\x04kind\x18\x03 \x01(\x0e\x32\x14.ficus.GrpcGraphKind\"\x88\x01\n\rGrpcGraphNode\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x36\n\x0f\x61\x64\x64itional_data\x18\x03 \x03(\x0b\x32\x1d.ficus.GrpcNodeAdditionalData\x12%\n\x0binner_graph\x18\x04 \x01(\x0b\x32\x10.ficus.GrpcGraph\"\xac\x03\n\x16GrpcNodeAdditionalData\x12&\n\x04none\x18\x01 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00\x12\x30\n\rsoftware_data\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcSoftwareDataH\x00\x12\x38\n\x0cpattern_info\x18\x03 \x01(\x0b\x32 .ficus.GrpcUnderlyingPatternInfoH\x00\x12;\n\ntrace_data\x18\x04 \x01(\x0b\x32%.ficus.GrpcNodeCorrespondingTraceDataH\x00\x12\x34\n\ttime_data\x18\x05 \x01(\x0b\x32\x1f.ficus.GrpcActivityStartEndDataH\x00\x12\x42\n\x16multithreaded_fragment\x18\x07 \x01(\x0b\x32 .ficus.GrpcMultithreadedFragmentH\x00\x12?\n\x1aoriginal_event_coordinates\x18\x06 \x01(\x0b\x32\x1b.ficus.GrpcEventCoordinatesB\x06\n\x04\x64\x61ta\"Q\n\x19GrpcMultithreadedFragment\x12\x34\n\x11multithreaded_log\x18\x01 \x01(\x0b\x32\x19.ficus.GrpcSimpleEventLog\"@\n\x18GrpcActivityStartEndData\x12\x12\n\nstart_time\x18\x01 \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x02 \x01(\x03\"=\n\x14GrpcEventCoordinates\x12\x10\n\x08trace_id\x18\x02 \x01(\x04\x12\x13\n\x0b\x65vent_index\x18\x03 \x01(\x04\"B\n\x1eGrpcNodeCorrespondingTraceData\x12 \n\x18\x62\x65longs_to_root_sequence\x18\x01 \x01(\x08\"\xbf\x02\n\x10GrpcSoftwareData\x12,\n\thistogram\x18\x01 \x03(\x0b\x32\x19.ficus.GrpcHistogramEntry\x12\x45\n\x19timeline_diagram_fragment\x18\x02 \x01(\x0b\x32\".ficus.GrpcTimelineDiagramFragment\x12\x37\n\x0ehistogram_data\x18\r \x03(\x0b\x32\x1f.ficus.GrpcGeneralHistogramData\x12\x39\n\x13simple_counter_data\x18\x0e \x03(\x0b\x32\x1c.ficus.GrpcSimpleCounterData\x12\x42\n\x19\x61\x63tivities_durations_data\x18\x0f \x03(\x0b\x32\x1f.ficus.GrpcActivityDurationData\"\x84\x01\n\x18GrpcActivityDurationData\x12/\n\x04\x62\x61se\x18\x01 \x01(\x0b\x32!.ficus.GrpcGenericEnhancementBase\x12\x10\n\x08\x64uration\x18\x02 \x01(\x04\x12%\n\x04kind\x18\x03 \x01(\x0e\x32\x17.ficus.GrpcDurationKind\"W\n\x1aGrpcGenericEnhancementBase\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05units\x18\x02 \x01(\t\x12\x12\n\x05group\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_group\"w\n\x18GrpcGeneralHistogramData\x12/\n\x04\x62\x61se\x18\x01 \x01(\x0b\x32!.ficus.GrpcGenericEnhancementBase\x12*\n\x07\x65ntries\x18\x02 \x03(\x0b\x32\x19.ficus.GrpcHistogramEntry\"W\n\x15GrpcSimpleCounterData\x12/\n\x04\x62\x61se\x18\x01 \x01(\x0b\x32!.ficus.GrpcGenericEnhancementBase\x12\r\n\x05\x63ount\x18\x02 \x01(\x01\"|\n\x16GrpcMethodInliningInfo\x12\x30\n\x0cinlinee_info\x18\x01 \x01(\x0b\x32\x1a.ficus.GrpcMethodNameParts\x12\x30\n\x0cinliner_info\x18\x02 \x01(\x0b\x32\x1a.ficus.GrpcMethodNameParts\"I\n\x13GrpcMethodNameParts\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x11\n\tsignature\x18\x03 \x01(\t\"1\n\x12GrpcHistogramEntry\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\x01\"A\n\x1bGrpcTimelineDiagramFragment\x12\"\n\x07threads\x18\x01 \x03(\x0b\x32\x11.ficus.GrpcThread\"a\n\x12GrpcAllocationInfo\x12\x11\n\ttype_name\x18\x01 \x01(\t\x12\x1f\n\x17\x61llocated_objects_count\x18\x02 \x01(\x04\x12\x17\n\x0f\x61llocated_bytes\x18\x03 \x01(\x04\"\x8b\x01\n\x19GrpcUnderlyingPatternInfo\x12\x36\n\x0cpattern_kind\x18\x01 \x01(\x0e\x32 .ficus.GrpcUnderlyingPatternKind\x12\x15\n\rbase_sequence\x18\x02 \x03(\t\x12\x1f\n\x05graph\x18\x03 \x01(\x0b\x32\x10.ficus.GrpcGraph\"\x9a\x01\n\rGrpcGraphEdge\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x11\n\tfrom_node\x18\x02 \x01(\x04\x12\x0f\n\x07to_node\x18\x03 \x01(\x04\x12\x0e\n\x06weight\x18\x04 \x01(\x01\x12\x0c\n\x04\x64\x61ta\x18\x05 \x01(\t\x12;\n\x0f\x61\x64\x64itional_data\x18\x06 \x03(\x0b\x32\".ficus.GrpcGraphEdgeAdditionalData\"\xc5\x01\n\x1bGrpcGraphEdgeAdditionalData\x12\x30\n\rsoftware_data\x18\x01 \x01(\x0b\x32\x17.ficus.GrpcSoftwareDataH\x00\x12\x36\n\x0e\x65xecution_info\x18\x02 \x01(\x0b\x32\x1c.ficus.GrpcEdgeExecutionInfoH\x00\x12\x34\n\ttime_data\x18\x03 \x01(\x0b\x32\x1f.ficus.GrpcActivityStartEndDataH\x00\x42\x06\n\x04\x64\x61ta\"(\n\x15GrpcEdgeExecutionInfo\x12\x0f\n\x07traceId\x18\x01 \x01(\x04\"\x1a\n\tGrpcBytes\x12\r\n\x05\x62ytes\x18\x01 \x01(\x0c\"I\n\x16GrpcLogTimelineDiagram\x12/\n\x06traces\x18\x01 \x03(\x0b\x32\x1f.ficus.GrpcTraceTimelineDiagram\"p\n\x1cGrpcTimelineTraceEventsGroup\x12(\n\x0bstart_point\x18\x01 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\x12&\n\tend_point\x18\x02 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\"z\n\x18GrpcTraceTimelineDiagram\x12\"\n\x07threads\x18\x01 \x03(\x0b\x32\x11.ficus.GrpcThread\x12:\n\revents_groups\x18\x02 \x03(\x0b\x32#.ficus.GrpcTimelineTraceEventsGroup\"4\n\nGrpcThread\x12&\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x16.ficus.GrpcThreadEvent\".\n\x0fGrpcThreadEvent\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05stamp\x18\x02 \x01(\x03*\"\n\rGrpcGraphKind\x12\x08\n\x04None\x10\x00\x12\x07\n\x03\x44\x41G\x10\x01*u\n\x10GrpcDurationKind\x12\x0f\n\x0bUnspecified\x10\x00\x12\t\n\x05Nanos\x10\x01\x12\n\n\x06Micros\x10\x02\x12\n\n\x06Millis\x10\x03\x12\x0b\n\x07Seconds\x10\x04\x12\x0b\n\x07Minutes\x10\x05\x12\t\n\x05Hours\x10\x06\x12\x08\n\x04\x44\x61ys\x10\x07*\xb1\x01\n\x19GrpcUnderlyingPatternKind\x12\x0e\n\nStrictLoop\x10\x00\x12\x18\n\x14PrimitiveTandemArray\x10\x01\x12\x16\n\x12MaximalTandemArray\x10\x02\x12\x11\n\rMaximalRepeat\x10\x03\x12\x16\n\x12SuperMaximalRepeat\x10\x04\x12\x1a\n\x16NearSuperMaximalRepeat\x10\x05\x12\x0b\n\x07Unknown\x10\x06\x42\x0fZ\r./;grpcmodelsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bpipelines_and_context.proto\x12\x05\x66icus\x1a\x0fpm_models.proto\x1a\nutil.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x1e\n\x0eGrpcContextKey\x12\x0c\n\x04name\x18\x01 \x01(\t\"W\n\x1bGrpcContextValueWithKeyName\x12\x10\n\x08key_name\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcContextValue\"\xc6\t\n\x10GrpcContextValue\x12\x10\n\x06string\x18\x01 \x01(\tH\x00\x12;\n\nhashes_log\x18\x02 \x01(\x0b\x32%.ficus.GrpcHashesEventLogContextValueH\x00\x12\x39\n\tnames_log\x18\x03 \x01(\x0b\x32$.ficus.GrpcNamesEventLogContextValueH\x00\x12\x10\n\x06uint32\x18\x04 \x01(\rH\x00\x12J\n\x11traces_sub_arrays\x18\x05 \x01(\x0b\x32-.ficus.GrpcEventLogTraceSubArraysContextValueH\x00\x12P\n\x16trace_index_sub_arrays\x18\x06 \x01(\x0b\x32..ficus.GrpcSubArraysWithTraceIndexContextValueH\x00\x12\x0e\n\x04\x62ool\x18\x07 \x01(\x08H\x00\x12=\n\rxes_event_log\x18\x08 \x01(\x0b\x32$.ficus.GrpcNamesEventLogContextValueH\x00\x12/\n\ncolors_log\x18\t \x01(\x0b\x32\x19.ficus.GrpcColorsEventLogH\x00\x12\x1f\n\x04\x65num\x18\n \x01(\x0b\x32\x0f.ficus.GrpcEnumH\x00\x12\x31\n\x0e\x65vent_log_info\x18\x0b \x01(\x0b\x32\x17.ficus.GrpcEventLogInfoH\x00\x12%\n\x07strings\x18\x0c \x01(\x0b\x32\x12.ficus.GrpcStringsH\x00\x12\'\n\x08pipeline\x18\r \x01(\x0b\x32\x13.ficus.GrpcPipelineH\x00\x12\'\n\x08petriNet\x18\x0e \x01(\x0b\x32\x13.ficus.GrpcPetriNetH\x00\x12!\n\x05graph\x18\x0f \x01(\x0b\x32\x10.ficus.GrpcGraphH\x00\x12\x0f\n\x05\x66loat\x18\x10 \x01(\x02H\x00\x12+\n\nannotation\x18\x11 \x01(\x0b\x32\x15.ficus.GrpcAnnotationH\x00\x12%\n\x07\x64\x61taset\x18\x12 \x01(\x0b\x32\x12.ficus.GrpcDatasetH\x00\x12\x34\n\x0flabeled_dataset\x18\x13 \x01(\x0b\x32\x19.ficus.GrpcLabeledDatasetH\x00\x12!\n\x05\x62ytes\x18\x14 \x01(\x0b\x32\x10.ficus.GrpcBytesH\x00\x12;\n\x12logTimelineDiagram\x18\x15 \x01(\x0b\x32\x1d.ficus.GrpcLogTimelineDiagramH\x00\x12,\n\x0b\x66loat_array\x18\x16 \x01(\x0b\x32\x15.ficus.GrpcFloatArrayH\x00\x12(\n\tint_array\x18\x17 \x01(\x0b\x32\x13.ficus.GrpcIntArrayH\x00\x12*\n\nuint_array\x18\x18 \x01(\x0b\x32\x14.ficus.GrpcUintArrayH\x00\x12\x0e\n\x04json\x18\x19 \x01(\tH\x00\x12.\n\tevent_log\x18\x1a \x01(\x0b\x32\x19.ficus.GrpcSimpleEventLogH\x00\x12\x39\n\x0focel_annotation\x18\x1b \x01(\x0b\x32\x1e.ficus.GrpcOcelModelAnnotationH\x00\x42\x0e\n\x0c\x63ontextValue\"U\n\x17GrpcOcelModelAnnotation\x12:\n\x0b\x61nnotations\x18\x01 \x03(\x0b\x32%.ficus.GrpcModelElementOcelAnnotation\"\xda\x01\n\x1eGrpcModelElementOcelAnnotation\x12\x12\n\nelement_id\x18\x01 \x01(\x04\x12\x30\n\rinitial_state\x18\x02 \x01(\x0b\x32\x14.ficus.GrpcOcelStateH\x00\x88\x01\x01\x12)\n\x0b\x66inal_state\x18\x03 \x01(\x0b\x32\x14.ficus.GrpcOcelState\x12\x35\n\trelations\x18\x04 \x03(\x0b\x32\".ficus.GrpcOcelStateObjectRelationB\x10\n\x0e_initial_state\"a\n\x1bGrpcOcelStateObjectRelation\x12\x11\n\tobject_id\x18\x01 \x01(\t\x12\x12\n\nelement_id\x18\x02 \x01(\x04\x12\x1b\n\x13related_objects_ids\x18\x03 \x03(\t\"D\n\rGrpcOcelState\x12\x33\n\x0btype_states\x18\x01 \x03(\x0b\x32\x1e.ficus.GrpcOcelObjectTypeState\";\n\x17GrpcOcelObjectTypeState\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x12\n\nobject_ids\x18\x02 \x03(\t\"\x1f\n\x0eGrpcFloatArray\x12\r\n\x05items\x18\x01 \x03(\x01\"\x1d\n\x0cGrpcIntArray\x12\r\n\x05items\x18\x01 \x03(\x03\"\x1e\n\rGrpcUintArray\x12\r\n\x05items\x18\x01 \x03(\x04\"a\n\x13GrpcContextKeyValue\x12\"\n\x03key\x18\x01 \x01(\x0b\x32\x15.ficus.GrpcContextKey\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcContextValue\"H\n\x1eGrpcHashesEventLogContextValue\x12&\n\x03log\x18\x01 \x01(\x0b\x32\x19.ficus.GrpcHashesEventLog\"F\n\x1dGrpcNamesEventLogContextValue\x12%\n\x03log\x18\x01 \x01(\x0b\x32\x18.ficus.GrpcNamesEventLog\"^\n&GrpcEventLogTraceSubArraysContextValue\x12\x34\n\x11traces_sub_arrays\x18\x01 \x03(\x0b\x32\x19.ficus.GrpcTraceSubArrays\"/\n\x11GrpcTraceSubArray\x12\r\n\x05start\x18\x01 \x01(\r\x12\x0b\n\x03\x65nd\x18\x02 \x01(\r\"B\n\x12GrpcTraceSubArrays\x12,\n\nsub_arrays\x18\x01 \x03(\x0b\x32\x18.ficus.GrpcTraceSubArray\"^\n\x1aGrpcSubArrayWithTraceIndex\x12+\n\tsub_array\x18\x01 \x01(\x0b\x32\x18.ficus.GrpcTraceSubArray\x12\x13\n\x0btrace_index\x18\x02 \x01(\r\"`\n\'GrpcSubArraysWithTraceIndexContextValue\x12\x35\n\nsub_arrays\x18\x01 \x03(\x0b\x32!.ficus.GrpcSubArrayWithTraceIndex\"\xa4\x01\n\x12GrpcColorsEventLog\x12\x31\n\x07mapping\x18\x01 \x03(\x0b\x32 .ficus.GrpcColorsEventLogMapping\x12&\n\x06traces\x18\x02 \x03(\x0b\x32\x16.ficus.GrpcColorsTrace\x12\x33\n\x0b\x61\x64justments\x18\x03 \x03(\x0b\x32\x1e.ficus.GrpcColorsLogAdjustment\"\xba\x01\n\x17GrpcColorsLogAdjustment\x12G\n\x14rectangle_adjustment\x18\x01 \x01(\x0b\x32\'.ficus.GrpcColorsLogRectangleAdjustmentH\x00\x12I\n\x10\x61xis_after_trace\x18\x02 \x01(\x0b\x32-.ficus.GrpcColorsLogXAxisAfterTraceAdjustmentH\x00\x42\x0b\n\tselection\"\xa9\x01\n GrpcColorsLogRectangleAdjustment\x12*\n\rup_left_point\x18\x01 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\x12-\n\x10\x64own_right_point\x18\x02 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\x12*\n\"extend_to_nearest_vertical_borders\x18\x03 \x01(\x08\"8\n\x0cGrpcLogPoint\x12\x13\n\x0btrace_index\x18\x01 \x01(\x04\x12\x13\n\x0b\x65vent_index\x18\x02 \x01(\x04\"=\n&GrpcColorsLogXAxisAfterTraceAdjustment\x12\x13\n\x0btrace_index\x18\x01 \x01(\x04\"J\n\x19GrpcColorsEventLogMapping\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1f\n\x05\x63olor\x18\x02 \x01(\x0b\x32\x10.ficus.GrpcColor\"\\\n\x0fGrpcColorsTrace\x12\x31\n\x0c\x65vent_colors\x18\x01 \x03(\x0b\x32\x1b.ficus.GrpcColoredRectangle\x12\x16\n\x0e\x63onstant_width\x18\x02 \x01(\x08\"L\n\x14GrpcColoredRectangle\x12\x13\n\x0b\x63olor_index\x18\x01 \x01(\r\x12\x0f\n\x07start_x\x18\x02 \x01(\x01\x12\x0e\n\x06length\x18\x03 \x01(\x01\"+\n\x08GrpcEnum\x12\x10\n\x08\x65numType\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"[\n\x10GrpcEventLogInfo\x12\x14\n\x0c\x65vents_count\x18\x01 \x01(\r\x12\x14\n\x0ctraces_count\x18\x02 \x01(\r\x12\x1b\n\x13\x65vent_classes_count\x18\x03 \x01(\r\"\x1e\n\x0bGrpcStrings\x12\x0f\n\x07strings\x18\x01 \x03(\t\":\n\x0cGrpcPipeline\x12*\n\x05parts\x18\x01 \x03(\x0b\x32\x1b.ficus.GrpcPipelinePartBase\"\xab\x02\n\x14GrpcPipelinePartBase\x12.\n\x0b\x64\x65\x66\x61ultPart\x18\x01 \x01(\x0b\x32\x17.ficus.GrpcPipelinePartH\x00\x12\x37\n\x0cparallelPart\x18\x02 \x01(\x0b\x32\x1f.ficus.GrpcParallelPipelinePartH\x00\x12O\n\x18simpleContextRequestPart\x18\x03 \x01(\x0b\x32+.ficus.GrpcSimpleContextRequestPipelinePartH\x00\x12Q\n\x19\x63omplexContextRequestPart\x18\x04 \x01(\x0b\x32,.ficus.GrpcComplexContextRequestPipelinePartH\x00\x42\x06\n\x04part\"]\n\x10GrpcPipelinePart\x12\x0c\n\x04name\x18\x01 \x01(\t\x12;\n\rconfiguration\x18\x02 \x01(\x0b\x32$.ficus.GrpcPipelinePartConfiguration\"\\\n\x1dGrpcPipelinePartConfiguration\x12;\n\x17\x63onfigurationParameters\x18\x01 \x03(\x0b\x32\x1a.ficus.GrpcContextKeyValue\"N\n\x18GrpcParallelPipelinePart\x12\x32\n\rpipelineParts\x18\x01 \x03(\x0b\x32\x1b.ficus.GrpcPipelinePartBase\"N\n\x19GrpcParallelPipelineParts\x12\x31\n\x08pipeline\x18\x01 \x03(\x0b\x32\x1f.ficus.GrpcParallelPipelinePart\"\x97\x01\n$GrpcSimpleContextRequestPipelinePart\x12\"\n\x03key\x18\x01 \x01(\x0b\x32\x15.ficus.GrpcContextKey\x12)\n\x10\x66rontendPartUuid\x18\x02 \x01(\x0b\x32\x0f.ficus.GrpcGuid\x12 \n\x18\x66rontendPipelinePartName\x18\x03 \x01(\t\"\xce\x01\n%GrpcComplexContextRequestPipelinePart\x12#\n\x04keys\x18\x01 \x03(\x0b\x32\x15.ficus.GrpcContextKey\x12\x33\n\x12\x62\x65\x66orePipelinePart\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcPipelinePart\x12)\n\x10\x66rontendPartUuid\x18\x03 \x01(\x0b\x32\x0f.ficus.GrpcGuid\x12 \n\x18\x66rontendPipelinePartName\x18\x04 \x01(\t\"y\n\tGrpcGraph\x12#\n\x05nodes\x18\x01 \x03(\x0b\x32\x14.ficus.GrpcGraphNode\x12#\n\x05\x65\x64ges\x18\x02 \x03(\x0b\x32\x14.ficus.GrpcGraphEdge\x12\"\n\x04kind\x18\x03 \x01(\x0e\x32\x14.ficus.GrpcGraphKind\"\x88\x01\n\rGrpcGraphNode\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x36\n\x0f\x61\x64\x64itional_data\x18\x03 \x03(\x0b\x32\x1d.ficus.GrpcNodeAdditionalData\x12%\n\x0binner_graph\x18\x04 \x01(\x0b\x32\x10.ficus.GrpcGraph\"\xac\x03\n\x16GrpcNodeAdditionalData\x12&\n\x04none\x18\x01 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00\x12\x30\n\rsoftware_data\x18\x02 \x01(\x0b\x32\x17.ficus.GrpcSoftwareDataH\x00\x12\x38\n\x0cpattern_info\x18\x03 \x01(\x0b\x32 .ficus.GrpcUnderlyingPatternInfoH\x00\x12;\n\ntrace_data\x18\x04 \x01(\x0b\x32%.ficus.GrpcNodeCorrespondingTraceDataH\x00\x12\x34\n\ttime_data\x18\x05 \x01(\x0b\x32\x1f.ficus.GrpcActivityStartEndDataH\x00\x12\x42\n\x16multithreaded_fragment\x18\x07 \x01(\x0b\x32 .ficus.GrpcMultithreadedFragmentH\x00\x12?\n\x1aoriginal_event_coordinates\x18\x06 \x01(\x0b\x32\x1b.ficus.GrpcEventCoordinatesB\x06\n\x04\x64\x61ta\"Q\n\x19GrpcMultithreadedFragment\x12\x34\n\x11multithreaded_log\x18\x01 \x01(\x0b\x32\x19.ficus.GrpcSimpleEventLog\"@\n\x18GrpcActivityStartEndData\x12\x12\n\nstart_time\x18\x01 \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x02 \x01(\x03\"=\n\x14GrpcEventCoordinates\x12\x10\n\x08trace_id\x18\x02 \x01(\x04\x12\x13\n\x0b\x65vent_index\x18\x03 \x01(\x04\"B\n\x1eGrpcNodeCorrespondingTraceData\x12 \n\x18\x62\x65longs_to_root_sequence\x18\x01 \x01(\x08\"\xe7\x02\n\x10GrpcSoftwareData\x12,\n\thistogram\x18\x01 \x03(\x0b\x32\x19.ficus.GrpcHistogramEntry\x12\x45\n\x19timeline_diagram_fragment\x18\x02 \x01(\x0b\x32\".ficus.GrpcTimelineDiagramFragment\x12\x37\n\x0ehistogram_data\x18\r \x03(\x0b\x32\x1f.ficus.GrpcGeneralHistogramData\x12\x39\n\x13simple_counter_data\x18\x0e \x03(\x0b\x32\x1c.ficus.GrpcSimpleCounterData\x12\x42\n\x19\x61\x63tivities_durations_data\x18\x0f \x03(\x0b\x32\x1f.ficus.GrpcActivityDurationData\x12&\n\tocel_data\x18\x10 \x03(\x0b\x32\x13.ficus.GrpcOcelData\"4\n\x16GrpcOcelObjectTypeData\x12\x11\n\x04type\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_type\"O\n\x15GrpcOcelAllocateMerge\x12\x11\n\x04type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\x12merged_objects_ids\x18\x02 \x03(\tB\x07\n\x05_type\"@\n\x16GrpcOcelProducedObject\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\x04type\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_type\"Q\n\x16GrpcOcelConsumeProduce\x12\x37\n\x10produced_objects\x18\x01 \x03(\x0b\x32\x1d.ficus.GrpcOcelProducedObject\"\x97\x02\n\x0cGrpcOcelData\x12\x11\n\tobject_id\x18\x01 \x01(\t\x12\x31\n\x08\x61llocate\x18\x02 \x01(\x0b\x32\x1d.ficus.GrpcOcelObjectTypeDataH\x00\x12\x30\n\x07\x63onsume\x18\x03 \x01(\x0b\x32\x1d.ficus.GrpcOcelObjectTypeDataH\x00\x12@\n\x18merged_object_allocation\x18\x04 \x01(\x0b\x32\x1c.ficus.GrpcOcelAllocateMergeH\x00\x12\x43\n\x1aproduce_object_consumption\x18\x05 \x01(\x0b\x32\x1d.ficus.GrpcOcelConsumeProduceH\x00\x42\x08\n\x06\x61\x63tion\"\x84\x01\n\x18GrpcActivityDurationData\x12/\n\x04\x62\x61se\x18\x01 \x01(\x0b\x32!.ficus.GrpcGenericEnhancementBase\x12\x10\n\x08\x64uration\x18\x02 \x01(\x04\x12%\n\x04kind\x18\x03 \x01(\x0e\x32\x17.ficus.GrpcDurationKind\"W\n\x1aGrpcGenericEnhancementBase\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05units\x18\x02 \x01(\t\x12\x12\n\x05group\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_group\"w\n\x18GrpcGeneralHistogramData\x12/\n\x04\x62\x61se\x18\x01 \x01(\x0b\x32!.ficus.GrpcGenericEnhancementBase\x12*\n\x07\x65ntries\x18\x02 \x03(\x0b\x32\x19.ficus.GrpcHistogramEntry\"W\n\x15GrpcSimpleCounterData\x12/\n\x04\x62\x61se\x18\x01 \x01(\x0b\x32!.ficus.GrpcGenericEnhancementBase\x12\r\n\x05\x63ount\x18\x02 \x01(\x01\"|\n\x16GrpcMethodInliningInfo\x12\x30\n\x0cinlinee_info\x18\x01 \x01(\x0b\x32\x1a.ficus.GrpcMethodNameParts\x12\x30\n\x0cinliner_info\x18\x02 \x01(\x0b\x32\x1a.ficus.GrpcMethodNameParts\"I\n\x13GrpcMethodNameParts\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x11\n\tsignature\x18\x03 \x01(\t\"1\n\x12GrpcHistogramEntry\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\x01\"A\n\x1bGrpcTimelineDiagramFragment\x12\"\n\x07threads\x18\x01 \x03(\x0b\x32\x11.ficus.GrpcThread\"a\n\x12GrpcAllocationInfo\x12\x11\n\ttype_name\x18\x01 \x01(\t\x12\x1f\n\x17\x61llocated_objects_count\x18\x02 \x01(\x04\x12\x17\n\x0f\x61llocated_bytes\x18\x03 \x01(\x04\"\x8b\x01\n\x19GrpcUnderlyingPatternInfo\x12\x36\n\x0cpattern_kind\x18\x01 \x01(\x0e\x32 .ficus.GrpcUnderlyingPatternKind\x12\x15\n\rbase_sequence\x18\x02 \x03(\t\x12\x1f\n\x05graph\x18\x03 \x01(\x0b\x32\x10.ficus.GrpcGraph\"\x9a\x01\n\rGrpcGraphEdge\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x11\n\tfrom_node\x18\x02 \x01(\x04\x12\x0f\n\x07to_node\x18\x03 \x01(\x04\x12\x0e\n\x06weight\x18\x04 \x01(\x01\x12\x0c\n\x04\x64\x61ta\x18\x05 \x01(\t\x12;\n\x0f\x61\x64\x64itional_data\x18\x06 \x03(\x0b\x32\".ficus.GrpcGraphEdgeAdditionalData\"\xc5\x01\n\x1bGrpcGraphEdgeAdditionalData\x12\x30\n\rsoftware_data\x18\x01 \x01(\x0b\x32\x17.ficus.GrpcSoftwareDataH\x00\x12\x36\n\x0e\x65xecution_info\x18\x02 \x01(\x0b\x32\x1c.ficus.GrpcEdgeExecutionInfoH\x00\x12\x34\n\ttime_data\x18\x03 \x01(\x0b\x32\x1f.ficus.GrpcActivityStartEndDataH\x00\x42\x06\n\x04\x64\x61ta\"(\n\x15GrpcEdgeExecutionInfo\x12\x0f\n\x07traceId\x18\x01 \x01(\x04\"\x1a\n\tGrpcBytes\x12\r\n\x05\x62ytes\x18\x01 \x01(\x0c\"I\n\x16GrpcLogTimelineDiagram\x12/\n\x06traces\x18\x01 \x03(\x0b\x32\x1f.ficus.GrpcTraceTimelineDiagram\"p\n\x1cGrpcTimelineTraceEventsGroup\x12(\n\x0bstart_point\x18\x01 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\x12&\n\tend_point\x18\x02 \x01(\x0b\x32\x13.ficus.GrpcLogPoint\"z\n\x18GrpcTraceTimelineDiagram\x12\"\n\x07threads\x18\x01 \x03(\x0b\x32\x11.ficus.GrpcThread\x12:\n\revents_groups\x18\x02 \x03(\x0b\x32#.ficus.GrpcTimelineTraceEventsGroup\"4\n\nGrpcThread\x12&\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x16.ficus.GrpcThreadEvent\".\n\x0fGrpcThreadEvent\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05stamp\x18\x02 \x01(\x03*.\n\rGrpcGraphKind\x12\x08\n\x04None\x10\x00\x12\x07\n\x03\x44\x41G\x10\x01\x12\n\n\x06\x44\x61gLCS\x10\x02*u\n\x10GrpcDurationKind\x12\x0f\n\x0bUnspecified\x10\x00\x12\t\n\x05Nanos\x10\x01\x12\n\n\x06Micros\x10\x02\x12\n\n\x06Millis\x10\x03\x12\x0b\n\x07Seconds\x10\x04\x12\x0b\n\x07Minutes\x10\x05\x12\t\n\x05Hours\x10\x06\x12\x08\n\x04\x44\x61ys\x10\x07*\xb1\x01\n\x19GrpcUnderlyingPatternKind\x12\x0e\n\nStrictLoop\x10\x00\x12\x18\n\x14PrimitiveTandemArray\x10\x01\x12\x16\n\x12MaximalTandemArray\x10\x02\x12\x11\n\rMaximalRepeat\x10\x03\x12\x16\n\x12SuperMaximalRepeat\x10\x04\x12\x1a\n\x16NearSuperMaximalRepeat\x10\x05\x12\x0b\n\x07Unknown\x10\x06\x42\x0fZ\r./;grpcmodelsb\x06proto3') @@ -50,17 +50,17 @@ DESCRIPTOR._serialized_options = b'Z\r./;grpcmodels' - _globals['_GRPCGRAPHKIND']._serialized_start=7403 + _globals['_GRPCGRAPHKIND']._serialized_start=8606 - _globals['_GRPCGRAPHKIND']._serialized_end=7437 + _globals['_GRPCGRAPHKIND']._serialized_end=8652 - _globals['_GRPCDURATIONKIND']._serialized_start=7439 + _globals['_GRPCDURATIONKIND']._serialized_start=8654 - _globals['_GRPCDURATIONKIND']._serialized_end=7556 + _globals['_GRPCDURATIONKIND']._serialized_end=8771 - _globals['_GRPCUNDERLYINGPATTERNKIND']._serialized_start=7559 + _globals['_GRPCUNDERLYINGPATTERNKIND']._serialized_start=8774 - _globals['_GRPCUNDERLYINGPATTERNKIND']._serialized_end=7736 + _globals['_GRPCUNDERLYINGPATTERNKIND']._serialized_end=8951 _globals['_GRPCCONTEXTKEY']._serialized_start=96 @@ -72,234 +72,274 @@ _globals['_GRPCCONTEXTVALUE']._serialized_start=218 - _globals['_GRPCCONTEXTVALUE']._serialized_end=1381 + _globals['_GRPCCONTEXTVALUE']._serialized_end=1440 - _globals['_GRPCFLOATARRAY']._serialized_start=1383 + _globals['_GRPCOCELMODELANNOTATION']._serialized_start=1442 - _globals['_GRPCFLOATARRAY']._serialized_end=1414 + _globals['_GRPCOCELMODELANNOTATION']._serialized_end=1527 - _globals['_GRPCINTARRAY']._serialized_start=1416 + _globals['_GRPCMODELELEMENTOCELANNOTATION']._serialized_start=1530 - _globals['_GRPCINTARRAY']._serialized_end=1445 + _globals['_GRPCMODELELEMENTOCELANNOTATION']._serialized_end=1748 - _globals['_GRPCUINTARRAY']._serialized_start=1447 + _globals['_GRPCOCELSTATEOBJECTRELATION']._serialized_start=1750 - _globals['_GRPCUINTARRAY']._serialized_end=1477 + _globals['_GRPCOCELSTATEOBJECTRELATION']._serialized_end=1847 - _globals['_GRPCCONTEXTKEYVALUE']._serialized_start=1479 + _globals['_GRPCOCELSTATE']._serialized_start=1849 - _globals['_GRPCCONTEXTKEYVALUE']._serialized_end=1576 + _globals['_GRPCOCELSTATE']._serialized_end=1917 - _globals['_GRPCHASHESEVENTLOGCONTEXTVALUE']._serialized_start=1578 + _globals['_GRPCOCELOBJECTTYPESTATE']._serialized_start=1919 - _globals['_GRPCHASHESEVENTLOGCONTEXTVALUE']._serialized_end=1650 + _globals['_GRPCOCELOBJECTTYPESTATE']._serialized_end=1978 - _globals['_GRPCNAMESEVENTLOGCONTEXTVALUE']._serialized_start=1652 + _globals['_GRPCFLOATARRAY']._serialized_start=1980 - _globals['_GRPCNAMESEVENTLOGCONTEXTVALUE']._serialized_end=1722 + _globals['_GRPCFLOATARRAY']._serialized_end=2011 - _globals['_GRPCEVENTLOGTRACESUBARRAYSCONTEXTVALUE']._serialized_start=1724 + _globals['_GRPCINTARRAY']._serialized_start=2013 - _globals['_GRPCEVENTLOGTRACESUBARRAYSCONTEXTVALUE']._serialized_end=1818 + _globals['_GRPCINTARRAY']._serialized_end=2042 - _globals['_GRPCTRACESUBARRAY']._serialized_start=1820 + _globals['_GRPCUINTARRAY']._serialized_start=2044 - _globals['_GRPCTRACESUBARRAY']._serialized_end=1867 + _globals['_GRPCUINTARRAY']._serialized_end=2074 - _globals['_GRPCTRACESUBARRAYS']._serialized_start=1869 + _globals['_GRPCCONTEXTKEYVALUE']._serialized_start=2076 - _globals['_GRPCTRACESUBARRAYS']._serialized_end=1935 + _globals['_GRPCCONTEXTKEYVALUE']._serialized_end=2173 - _globals['_GRPCSUBARRAYWITHTRACEINDEX']._serialized_start=1937 + _globals['_GRPCHASHESEVENTLOGCONTEXTVALUE']._serialized_start=2175 - _globals['_GRPCSUBARRAYWITHTRACEINDEX']._serialized_end=2031 + _globals['_GRPCHASHESEVENTLOGCONTEXTVALUE']._serialized_end=2247 - _globals['_GRPCSUBARRAYSWITHTRACEINDEXCONTEXTVALUE']._serialized_start=2033 + _globals['_GRPCNAMESEVENTLOGCONTEXTVALUE']._serialized_start=2249 - _globals['_GRPCSUBARRAYSWITHTRACEINDEXCONTEXTVALUE']._serialized_end=2129 + _globals['_GRPCNAMESEVENTLOGCONTEXTVALUE']._serialized_end=2319 - _globals['_GRPCCOLORSEVENTLOG']._serialized_start=2132 + _globals['_GRPCEVENTLOGTRACESUBARRAYSCONTEXTVALUE']._serialized_start=2321 - _globals['_GRPCCOLORSEVENTLOG']._serialized_end=2296 + _globals['_GRPCEVENTLOGTRACESUBARRAYSCONTEXTVALUE']._serialized_end=2415 - _globals['_GRPCCOLORSLOGADJUSTMENT']._serialized_start=2299 + _globals['_GRPCTRACESUBARRAY']._serialized_start=2417 - _globals['_GRPCCOLORSLOGADJUSTMENT']._serialized_end=2485 + _globals['_GRPCTRACESUBARRAY']._serialized_end=2464 - _globals['_GRPCCOLORSLOGRECTANGLEADJUSTMENT']._serialized_start=2488 + _globals['_GRPCTRACESUBARRAYS']._serialized_start=2466 - _globals['_GRPCCOLORSLOGRECTANGLEADJUSTMENT']._serialized_end=2657 + _globals['_GRPCTRACESUBARRAYS']._serialized_end=2532 - _globals['_GRPCLOGPOINT']._serialized_start=2659 + _globals['_GRPCSUBARRAYWITHTRACEINDEX']._serialized_start=2534 - _globals['_GRPCLOGPOINT']._serialized_end=2715 + _globals['_GRPCSUBARRAYWITHTRACEINDEX']._serialized_end=2628 - _globals['_GRPCCOLORSLOGXAXISAFTERTRACEADJUSTMENT']._serialized_start=2717 + _globals['_GRPCSUBARRAYSWITHTRACEINDEXCONTEXTVALUE']._serialized_start=2630 - _globals['_GRPCCOLORSLOGXAXISAFTERTRACEADJUSTMENT']._serialized_end=2778 + _globals['_GRPCSUBARRAYSWITHTRACEINDEXCONTEXTVALUE']._serialized_end=2726 - _globals['_GRPCCOLORSEVENTLOGMAPPING']._serialized_start=2780 + _globals['_GRPCCOLORSEVENTLOG']._serialized_start=2729 - _globals['_GRPCCOLORSEVENTLOGMAPPING']._serialized_end=2854 + _globals['_GRPCCOLORSEVENTLOG']._serialized_end=2893 - _globals['_GRPCCOLORSTRACE']._serialized_start=2856 + _globals['_GRPCCOLORSLOGADJUSTMENT']._serialized_start=2896 - _globals['_GRPCCOLORSTRACE']._serialized_end=2948 + _globals['_GRPCCOLORSLOGADJUSTMENT']._serialized_end=3082 - _globals['_GRPCCOLOREDRECTANGLE']._serialized_start=2950 + _globals['_GRPCCOLORSLOGRECTANGLEADJUSTMENT']._serialized_start=3085 - _globals['_GRPCCOLOREDRECTANGLE']._serialized_end=3026 + _globals['_GRPCCOLORSLOGRECTANGLEADJUSTMENT']._serialized_end=3254 - _globals['_GRPCENUM']._serialized_start=3028 + _globals['_GRPCLOGPOINT']._serialized_start=3256 - _globals['_GRPCENUM']._serialized_end=3071 + _globals['_GRPCLOGPOINT']._serialized_end=3312 - _globals['_GRPCEVENTLOGINFO']._serialized_start=3073 + _globals['_GRPCCOLORSLOGXAXISAFTERTRACEADJUSTMENT']._serialized_start=3314 - _globals['_GRPCEVENTLOGINFO']._serialized_end=3164 + _globals['_GRPCCOLORSLOGXAXISAFTERTRACEADJUSTMENT']._serialized_end=3375 - _globals['_GRPCSTRINGS']._serialized_start=3166 + _globals['_GRPCCOLORSEVENTLOGMAPPING']._serialized_start=3377 - _globals['_GRPCSTRINGS']._serialized_end=3196 + _globals['_GRPCCOLORSEVENTLOGMAPPING']._serialized_end=3451 - _globals['_GRPCPIPELINE']._serialized_start=3198 + _globals['_GRPCCOLORSTRACE']._serialized_start=3453 - _globals['_GRPCPIPELINE']._serialized_end=3256 + _globals['_GRPCCOLORSTRACE']._serialized_end=3545 - _globals['_GRPCPIPELINEPARTBASE']._serialized_start=3259 + _globals['_GRPCCOLOREDRECTANGLE']._serialized_start=3547 - _globals['_GRPCPIPELINEPARTBASE']._serialized_end=3558 + _globals['_GRPCCOLOREDRECTANGLE']._serialized_end=3623 - _globals['_GRPCPIPELINEPART']._serialized_start=3560 + _globals['_GRPCENUM']._serialized_start=3625 - _globals['_GRPCPIPELINEPART']._serialized_end=3653 + _globals['_GRPCENUM']._serialized_end=3668 - _globals['_GRPCPIPELINEPARTCONFIGURATION']._serialized_start=3655 + _globals['_GRPCEVENTLOGINFO']._serialized_start=3670 - _globals['_GRPCPIPELINEPARTCONFIGURATION']._serialized_end=3747 + _globals['_GRPCEVENTLOGINFO']._serialized_end=3761 - _globals['_GRPCPARALLELPIPELINEPART']._serialized_start=3749 + _globals['_GRPCSTRINGS']._serialized_start=3763 - _globals['_GRPCPARALLELPIPELINEPART']._serialized_end=3827 + _globals['_GRPCSTRINGS']._serialized_end=3793 - _globals['_GRPCPARALLELPIPELINEPARTS']._serialized_start=3829 + _globals['_GRPCPIPELINE']._serialized_start=3795 - _globals['_GRPCPARALLELPIPELINEPARTS']._serialized_end=3907 + _globals['_GRPCPIPELINE']._serialized_end=3853 - _globals['_GRPCSIMPLECONTEXTREQUESTPIPELINEPART']._serialized_start=3910 + _globals['_GRPCPIPELINEPARTBASE']._serialized_start=3856 - _globals['_GRPCSIMPLECONTEXTREQUESTPIPELINEPART']._serialized_end=4061 + _globals['_GRPCPIPELINEPARTBASE']._serialized_end=4155 - _globals['_GRPCCOMPLEXCONTEXTREQUESTPIPELINEPART']._serialized_start=4064 + _globals['_GRPCPIPELINEPART']._serialized_start=4157 - _globals['_GRPCCOMPLEXCONTEXTREQUESTPIPELINEPART']._serialized_end=4270 + _globals['_GRPCPIPELINEPART']._serialized_end=4250 - _globals['_GRPCGRAPH']._serialized_start=4272 + _globals['_GRPCPIPELINEPARTCONFIGURATION']._serialized_start=4252 - _globals['_GRPCGRAPH']._serialized_end=4393 + _globals['_GRPCPIPELINEPARTCONFIGURATION']._serialized_end=4344 - _globals['_GRPCGRAPHNODE']._serialized_start=4396 + _globals['_GRPCPARALLELPIPELINEPART']._serialized_start=4346 - _globals['_GRPCGRAPHNODE']._serialized_end=4532 + _globals['_GRPCPARALLELPIPELINEPART']._serialized_end=4424 - _globals['_GRPCNODEADDITIONALDATA']._serialized_start=4535 + _globals['_GRPCPARALLELPIPELINEPARTS']._serialized_start=4426 - _globals['_GRPCNODEADDITIONALDATA']._serialized_end=4963 + _globals['_GRPCPARALLELPIPELINEPARTS']._serialized_end=4504 - _globals['_GRPCMULTITHREADEDFRAGMENT']._serialized_start=4965 + _globals['_GRPCSIMPLECONTEXTREQUESTPIPELINEPART']._serialized_start=4507 - _globals['_GRPCMULTITHREADEDFRAGMENT']._serialized_end=5046 + _globals['_GRPCSIMPLECONTEXTREQUESTPIPELINEPART']._serialized_end=4658 - _globals['_GRPCACTIVITYSTARTENDDATA']._serialized_start=5048 + _globals['_GRPCCOMPLEXCONTEXTREQUESTPIPELINEPART']._serialized_start=4661 - _globals['_GRPCACTIVITYSTARTENDDATA']._serialized_end=5112 + _globals['_GRPCCOMPLEXCONTEXTREQUESTPIPELINEPART']._serialized_end=4867 - _globals['_GRPCEVENTCOORDINATES']._serialized_start=5114 + _globals['_GRPCGRAPH']._serialized_start=4869 - _globals['_GRPCEVENTCOORDINATES']._serialized_end=5175 + _globals['_GRPCGRAPH']._serialized_end=4990 - _globals['_GRPCNODECORRESPONDINGTRACEDATA']._serialized_start=5177 + _globals['_GRPCGRAPHNODE']._serialized_start=4993 - _globals['_GRPCNODECORRESPONDINGTRACEDATA']._serialized_end=5243 + _globals['_GRPCGRAPHNODE']._serialized_end=5129 - _globals['_GRPCSOFTWAREDATA']._serialized_start=5246 + _globals['_GRPCNODEADDITIONALDATA']._serialized_start=5132 - _globals['_GRPCSOFTWAREDATA']._serialized_end=5565 + _globals['_GRPCNODEADDITIONALDATA']._serialized_end=5560 - _globals['_GRPCACTIVITYDURATIONDATA']._serialized_start=5568 + _globals['_GRPCMULTITHREADEDFRAGMENT']._serialized_start=5562 - _globals['_GRPCACTIVITYDURATIONDATA']._serialized_end=5700 + _globals['_GRPCMULTITHREADEDFRAGMENT']._serialized_end=5643 - _globals['_GRPCGENERICENHANCEMENTBASE']._serialized_start=5702 + _globals['_GRPCACTIVITYSTARTENDDATA']._serialized_start=5645 - _globals['_GRPCGENERICENHANCEMENTBASE']._serialized_end=5789 + _globals['_GRPCACTIVITYSTARTENDDATA']._serialized_end=5709 - _globals['_GRPCGENERALHISTOGRAMDATA']._serialized_start=5791 + _globals['_GRPCEVENTCOORDINATES']._serialized_start=5711 - _globals['_GRPCGENERALHISTOGRAMDATA']._serialized_end=5910 + _globals['_GRPCEVENTCOORDINATES']._serialized_end=5772 - _globals['_GRPCSIMPLECOUNTERDATA']._serialized_start=5912 + _globals['_GRPCNODECORRESPONDINGTRACEDATA']._serialized_start=5774 - _globals['_GRPCSIMPLECOUNTERDATA']._serialized_end=5999 + _globals['_GRPCNODECORRESPONDINGTRACEDATA']._serialized_end=5840 - _globals['_GRPCMETHODINLININGINFO']._serialized_start=6001 + _globals['_GRPCSOFTWAREDATA']._serialized_start=5843 - _globals['_GRPCMETHODINLININGINFO']._serialized_end=6125 + _globals['_GRPCSOFTWAREDATA']._serialized_end=6202 - _globals['_GRPCMETHODNAMEPARTS']._serialized_start=6127 + _globals['_GRPCOCELOBJECTTYPEDATA']._serialized_start=6204 - _globals['_GRPCMETHODNAMEPARTS']._serialized_end=6200 + _globals['_GRPCOCELOBJECTTYPEDATA']._serialized_end=6256 - _globals['_GRPCHISTOGRAMENTRY']._serialized_start=6202 + _globals['_GRPCOCELALLOCATEMERGE']._serialized_start=6258 - _globals['_GRPCHISTOGRAMENTRY']._serialized_end=6251 + _globals['_GRPCOCELALLOCATEMERGE']._serialized_end=6337 - _globals['_GRPCTIMELINEDIAGRAMFRAGMENT']._serialized_start=6253 + _globals['_GRPCOCELPRODUCEDOBJECT']._serialized_start=6339 - _globals['_GRPCTIMELINEDIAGRAMFRAGMENT']._serialized_end=6318 + _globals['_GRPCOCELPRODUCEDOBJECT']._serialized_end=6403 - _globals['_GRPCALLOCATIONINFO']._serialized_start=6320 + _globals['_GRPCOCELCONSUMEPRODUCE']._serialized_start=6405 - _globals['_GRPCALLOCATIONINFO']._serialized_end=6417 + _globals['_GRPCOCELCONSUMEPRODUCE']._serialized_end=6486 - _globals['_GRPCUNDERLYINGPATTERNINFO']._serialized_start=6420 + _globals['_GRPCOCELDATA']._serialized_start=6489 - _globals['_GRPCUNDERLYINGPATTERNINFO']._serialized_end=6559 + _globals['_GRPCOCELDATA']._serialized_end=6768 - _globals['_GRPCGRAPHEDGE']._serialized_start=6562 + _globals['_GRPCACTIVITYDURATIONDATA']._serialized_start=6771 - _globals['_GRPCGRAPHEDGE']._serialized_end=6716 + _globals['_GRPCACTIVITYDURATIONDATA']._serialized_end=6903 - _globals['_GRPCGRAPHEDGEADDITIONALDATA']._serialized_start=6719 + _globals['_GRPCGENERICENHANCEMENTBASE']._serialized_start=6905 - _globals['_GRPCGRAPHEDGEADDITIONALDATA']._serialized_end=6916 + _globals['_GRPCGENERICENHANCEMENTBASE']._serialized_end=6992 - _globals['_GRPCEDGEEXECUTIONINFO']._serialized_start=6918 + _globals['_GRPCGENERALHISTOGRAMDATA']._serialized_start=6994 - _globals['_GRPCEDGEEXECUTIONINFO']._serialized_end=6958 + _globals['_GRPCGENERALHISTOGRAMDATA']._serialized_end=7113 - _globals['_GRPCBYTES']._serialized_start=6960 + _globals['_GRPCSIMPLECOUNTERDATA']._serialized_start=7115 - _globals['_GRPCBYTES']._serialized_end=6986 + _globals['_GRPCSIMPLECOUNTERDATA']._serialized_end=7202 - _globals['_GRPCLOGTIMELINEDIAGRAM']._serialized_start=6988 + _globals['_GRPCMETHODINLININGINFO']._serialized_start=7204 - _globals['_GRPCLOGTIMELINEDIAGRAM']._serialized_end=7061 + _globals['_GRPCMETHODINLININGINFO']._serialized_end=7328 - _globals['_GRPCTIMELINETRACEEVENTSGROUP']._serialized_start=7063 + _globals['_GRPCMETHODNAMEPARTS']._serialized_start=7330 - _globals['_GRPCTIMELINETRACEEVENTSGROUP']._serialized_end=7175 + _globals['_GRPCMETHODNAMEPARTS']._serialized_end=7403 - _globals['_GRPCTRACETIMELINEDIAGRAM']._serialized_start=7177 + _globals['_GRPCHISTOGRAMENTRY']._serialized_start=7405 - _globals['_GRPCTRACETIMELINEDIAGRAM']._serialized_end=7299 + _globals['_GRPCHISTOGRAMENTRY']._serialized_end=7454 - _globals['_GRPCTHREAD']._serialized_start=7301 + _globals['_GRPCTIMELINEDIAGRAMFRAGMENT']._serialized_start=7456 - _globals['_GRPCTHREAD']._serialized_end=7353 + _globals['_GRPCTIMELINEDIAGRAMFRAGMENT']._serialized_end=7521 - _globals['_GRPCTHREADEVENT']._serialized_start=7355 + _globals['_GRPCALLOCATIONINFO']._serialized_start=7523 - _globals['_GRPCTHREADEVENT']._serialized_end=7401 + _globals['_GRPCALLOCATIONINFO']._serialized_end=7620 + + _globals['_GRPCUNDERLYINGPATTERNINFO']._serialized_start=7623 + + _globals['_GRPCUNDERLYINGPATTERNINFO']._serialized_end=7762 + + _globals['_GRPCGRAPHEDGE']._serialized_start=7765 + + _globals['_GRPCGRAPHEDGE']._serialized_end=7919 + + _globals['_GRPCGRAPHEDGEADDITIONALDATA']._serialized_start=7922 + + _globals['_GRPCGRAPHEDGEADDITIONALDATA']._serialized_end=8119 + + _globals['_GRPCEDGEEXECUTIONINFO']._serialized_start=8121 + + _globals['_GRPCEDGEEXECUTIONINFO']._serialized_end=8161 + + _globals['_GRPCBYTES']._serialized_start=8163 + + _globals['_GRPCBYTES']._serialized_end=8189 + + _globals['_GRPCLOGTIMELINEDIAGRAM']._serialized_start=8191 + + _globals['_GRPCLOGTIMELINEDIAGRAM']._serialized_end=8264 + + _globals['_GRPCTIMELINETRACEEVENTSGROUP']._serialized_start=8266 + + _globals['_GRPCTIMELINETRACEEVENTSGROUP']._serialized_end=8378 + + _globals['_GRPCTRACETIMELINEDIAGRAM']._serialized_start=8380 + + _globals['_GRPCTRACETIMELINEDIAGRAM']._serialized_end=8502 + + _globals['_GRPCTHREAD']._serialized_start=8504 + + _globals['_GRPCTHREAD']._serialized_end=8556 + + _globals['_GRPCTHREADEVENT']._serialized_start=8558 + + _globals['_GRPCTHREADEVENT']._serialized_end=8604 # @@protoc_insertion_point(module_scope) diff --git a/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.pyi b/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.pyi index 5a0f28d74..327e00ddb 100644 --- a/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.pyi +++ b/Ficus/src/python/ficus/grpc_pipelines/models/pipelines_and_context_pb2.pyi @@ -13,6 +13,7 @@ class GrpcGraphKind(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = [] None: _ClassVar[GrpcGraphKind] DAG: _ClassVar[GrpcGraphKind] + DagLCS: _ClassVar[GrpcGraphKind] class GrpcDurationKind(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = [] @@ -36,6 +37,7 @@ class GrpcUnderlyingPatternKind(int, metaclass=_enum_type_wrapper.EnumTypeWrappe Unknown: _ClassVar[GrpcUnderlyingPatternKind] None: GrpcGraphKind DAG: GrpcGraphKind +DagLCS: GrpcGraphKind Unspecified: GrpcDurationKind Nanos: GrpcDurationKind Micros: GrpcDurationKind @@ -67,7 +69,7 @@ class GrpcContextValueWithKeyName(_message.Message): def __init__(self, key_name: _Optional[str] = ..., value: _Optional[_Union[GrpcContextValue, _Mapping]] = ...) -> None: ... class GrpcContextValue(_message.Message): - __slots__ = ["string", "hashes_log", "names_log", "uint32", "traces_sub_arrays", "trace_index_sub_arrays", "bool", "xes_event_log", "colors_log", "enum", "event_log_info", "strings", "pipeline", "petriNet", "graph", "float", "annotation", "dataset", "labeled_dataset", "bytes", "logTimelineDiagram", "float_array", "int_array", "uint_array", "json", "event_log"] + __slots__ = ["string", "hashes_log", "names_log", "uint32", "traces_sub_arrays", "trace_index_sub_arrays", "bool", "xes_event_log", "colors_log", "enum", "event_log_info", "strings", "pipeline", "petriNet", "graph", "float", "annotation", "dataset", "labeled_dataset", "bytes", "logTimelineDiagram", "float_array", "int_array", "uint_array", "json", "event_log", "ocel_annotation"] STRING_FIELD_NUMBER: _ClassVar[int] HASHES_LOG_FIELD_NUMBER: _ClassVar[int] NAMES_LOG_FIELD_NUMBER: _ClassVar[int] @@ -94,6 +96,7 @@ class GrpcContextValue(_message.Message): UINT_ARRAY_FIELD_NUMBER: _ClassVar[int] JSON_FIELD_NUMBER: _ClassVar[int] EVENT_LOG_FIELD_NUMBER: _ClassVar[int] + OCEL_ANNOTATION_FIELD_NUMBER: _ClassVar[int] string: str hashes_log: GrpcHashesEventLogContextValue names_log: GrpcNamesEventLogContextValue @@ -120,7 +123,50 @@ class GrpcContextValue(_message.Message): uint_array: GrpcUintArray json: str event_log: _pm_models_pb2.GrpcSimpleEventLog - def __init__(self, string: _Optional[str] = ..., hashes_log: _Optional[_Union[GrpcHashesEventLogContextValue, _Mapping]] = ..., names_log: _Optional[_Union[GrpcNamesEventLogContextValue, _Mapping]] = ..., uint32: _Optional[int] = ..., traces_sub_arrays: _Optional[_Union[GrpcEventLogTraceSubArraysContextValue, _Mapping]] = ..., trace_index_sub_arrays: _Optional[_Union[GrpcSubArraysWithTraceIndexContextValue, _Mapping]] = ..., bool: bool = ..., xes_event_log: _Optional[_Union[GrpcNamesEventLogContextValue, _Mapping]] = ..., colors_log: _Optional[_Union[GrpcColorsEventLog, _Mapping]] = ..., enum: _Optional[_Union[GrpcEnum, _Mapping]] = ..., event_log_info: _Optional[_Union[GrpcEventLogInfo, _Mapping]] = ..., strings: _Optional[_Union[GrpcStrings, _Mapping]] = ..., pipeline: _Optional[_Union[GrpcPipeline, _Mapping]] = ..., petriNet: _Optional[_Union[_pm_models_pb2.GrpcPetriNet, _Mapping]] = ..., graph: _Optional[_Union[GrpcGraph, _Mapping]] = ..., float: _Optional[float] = ..., annotation: _Optional[_Union[_pm_models_pb2.GrpcAnnotation, _Mapping]] = ..., dataset: _Optional[_Union[_pm_models_pb2.GrpcDataset, _Mapping]] = ..., labeled_dataset: _Optional[_Union[_pm_models_pb2.GrpcLabeledDataset, _Mapping]] = ..., bytes: _Optional[_Union[GrpcBytes, _Mapping]] = ..., logTimelineDiagram: _Optional[_Union[GrpcLogTimelineDiagram, _Mapping]] = ..., float_array: _Optional[_Union[GrpcFloatArray, _Mapping]] = ..., int_array: _Optional[_Union[GrpcIntArray, _Mapping]] = ..., uint_array: _Optional[_Union[GrpcUintArray, _Mapping]] = ..., json: _Optional[str] = ..., event_log: _Optional[_Union[_pm_models_pb2.GrpcSimpleEventLog, _Mapping]] = ...) -> None: ... + ocel_annotation: GrpcOcelModelAnnotation + def __init__(self, string: _Optional[str] = ..., hashes_log: _Optional[_Union[GrpcHashesEventLogContextValue, _Mapping]] = ..., names_log: _Optional[_Union[GrpcNamesEventLogContextValue, _Mapping]] = ..., uint32: _Optional[int] = ..., traces_sub_arrays: _Optional[_Union[GrpcEventLogTraceSubArraysContextValue, _Mapping]] = ..., trace_index_sub_arrays: _Optional[_Union[GrpcSubArraysWithTraceIndexContextValue, _Mapping]] = ..., bool: bool = ..., xes_event_log: _Optional[_Union[GrpcNamesEventLogContextValue, _Mapping]] = ..., colors_log: _Optional[_Union[GrpcColorsEventLog, _Mapping]] = ..., enum: _Optional[_Union[GrpcEnum, _Mapping]] = ..., event_log_info: _Optional[_Union[GrpcEventLogInfo, _Mapping]] = ..., strings: _Optional[_Union[GrpcStrings, _Mapping]] = ..., pipeline: _Optional[_Union[GrpcPipeline, _Mapping]] = ..., petriNet: _Optional[_Union[_pm_models_pb2.GrpcPetriNet, _Mapping]] = ..., graph: _Optional[_Union[GrpcGraph, _Mapping]] = ..., float: _Optional[float] = ..., annotation: _Optional[_Union[_pm_models_pb2.GrpcAnnotation, _Mapping]] = ..., dataset: _Optional[_Union[_pm_models_pb2.GrpcDataset, _Mapping]] = ..., labeled_dataset: _Optional[_Union[_pm_models_pb2.GrpcLabeledDataset, _Mapping]] = ..., bytes: _Optional[_Union[GrpcBytes, _Mapping]] = ..., logTimelineDiagram: _Optional[_Union[GrpcLogTimelineDiagram, _Mapping]] = ..., float_array: _Optional[_Union[GrpcFloatArray, _Mapping]] = ..., int_array: _Optional[_Union[GrpcIntArray, _Mapping]] = ..., uint_array: _Optional[_Union[GrpcUintArray, _Mapping]] = ..., json: _Optional[str] = ..., event_log: _Optional[_Union[_pm_models_pb2.GrpcSimpleEventLog, _Mapping]] = ..., ocel_annotation: _Optional[_Union[GrpcOcelModelAnnotation, _Mapping]] = ...) -> None: ... + +class GrpcOcelModelAnnotation(_message.Message): + __slots__ = ["annotations"] + ANNOTATIONS_FIELD_NUMBER: _ClassVar[int] + annotations: _containers.RepeatedCompositeFieldContainer[GrpcModelElementOcelAnnotation] + def __init__(self, annotations: _Optional[_Iterable[_Union[GrpcModelElementOcelAnnotation, _Mapping]]] = ...) -> None: ... + +class GrpcModelElementOcelAnnotation(_message.Message): + __slots__ = ["element_id", "initial_state", "final_state", "relations"] + ELEMENT_ID_FIELD_NUMBER: _ClassVar[int] + INITIAL_STATE_FIELD_NUMBER: _ClassVar[int] + FINAL_STATE_FIELD_NUMBER: _ClassVar[int] + RELATIONS_FIELD_NUMBER: _ClassVar[int] + element_id: int + initial_state: GrpcOcelState + final_state: GrpcOcelState + relations: _containers.RepeatedCompositeFieldContainer[GrpcOcelStateObjectRelation] + def __init__(self, element_id: _Optional[int] = ..., initial_state: _Optional[_Union[GrpcOcelState, _Mapping]] = ..., final_state: _Optional[_Union[GrpcOcelState, _Mapping]] = ..., relations: _Optional[_Iterable[_Union[GrpcOcelStateObjectRelation, _Mapping]]] = ...) -> None: ... + +class GrpcOcelStateObjectRelation(_message.Message): + __slots__ = ["object_id", "element_id", "related_objects_ids"] + OBJECT_ID_FIELD_NUMBER: _ClassVar[int] + ELEMENT_ID_FIELD_NUMBER: _ClassVar[int] + RELATED_OBJECTS_IDS_FIELD_NUMBER: _ClassVar[int] + object_id: str + element_id: int + related_objects_ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, object_id: _Optional[str] = ..., element_id: _Optional[int] = ..., related_objects_ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class GrpcOcelState(_message.Message): + __slots__ = ["type_states"] + TYPE_STATES_FIELD_NUMBER: _ClassVar[int] + type_states: _containers.RepeatedCompositeFieldContainer[GrpcOcelObjectTypeState] + def __init__(self, type_states: _Optional[_Iterable[_Union[GrpcOcelObjectTypeState, _Mapping]]] = ...) -> None: ... + +class GrpcOcelObjectTypeState(_message.Message): + __slots__ = ["type", "object_ids"] + TYPE_FIELD_NUMBER: _ClassVar[int] + OBJECT_IDS_FIELD_NUMBER: _ClassVar[int] + type: str + object_ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, type: _Optional[str] = ..., object_ids: _Optional[_Iterable[str]] = ...) -> None: ... class GrpcFloatArray(_message.Message): __slots__ = ["items"] @@ -421,18 +467,62 @@ class GrpcNodeCorrespondingTraceData(_message.Message): def __init__(self, belongs_to_root_sequence: bool = ...) -> None: ... class GrpcSoftwareData(_message.Message): - __slots__ = ["histogram", "timeline_diagram_fragment", "histogram_data", "simple_counter_data", "activities_durations_data"] + __slots__ = ["histogram", "timeline_diagram_fragment", "histogram_data", "simple_counter_data", "activities_durations_data", "ocel_data"] HISTOGRAM_FIELD_NUMBER: _ClassVar[int] TIMELINE_DIAGRAM_FRAGMENT_FIELD_NUMBER: _ClassVar[int] HISTOGRAM_DATA_FIELD_NUMBER: _ClassVar[int] SIMPLE_COUNTER_DATA_FIELD_NUMBER: _ClassVar[int] ACTIVITIES_DURATIONS_DATA_FIELD_NUMBER: _ClassVar[int] + OCEL_DATA_FIELD_NUMBER: _ClassVar[int] histogram: _containers.RepeatedCompositeFieldContainer[GrpcHistogramEntry] timeline_diagram_fragment: GrpcTimelineDiagramFragment histogram_data: _containers.RepeatedCompositeFieldContainer[GrpcGeneralHistogramData] simple_counter_data: _containers.RepeatedCompositeFieldContainer[GrpcSimpleCounterData] activities_durations_data: _containers.RepeatedCompositeFieldContainer[GrpcActivityDurationData] - def __init__(self, histogram: _Optional[_Iterable[_Union[GrpcHistogramEntry, _Mapping]]] = ..., timeline_diagram_fragment: _Optional[_Union[GrpcTimelineDiagramFragment, _Mapping]] = ..., histogram_data: _Optional[_Iterable[_Union[GrpcGeneralHistogramData, _Mapping]]] = ..., simple_counter_data: _Optional[_Iterable[_Union[GrpcSimpleCounterData, _Mapping]]] = ..., activities_durations_data: _Optional[_Iterable[_Union[GrpcActivityDurationData, _Mapping]]] = ...) -> None: ... + ocel_data: _containers.RepeatedCompositeFieldContainer[GrpcOcelData] + def __init__(self, histogram: _Optional[_Iterable[_Union[GrpcHistogramEntry, _Mapping]]] = ..., timeline_diagram_fragment: _Optional[_Union[GrpcTimelineDiagramFragment, _Mapping]] = ..., histogram_data: _Optional[_Iterable[_Union[GrpcGeneralHistogramData, _Mapping]]] = ..., simple_counter_data: _Optional[_Iterable[_Union[GrpcSimpleCounterData, _Mapping]]] = ..., activities_durations_data: _Optional[_Iterable[_Union[GrpcActivityDurationData, _Mapping]]] = ..., ocel_data: _Optional[_Iterable[_Union[GrpcOcelData, _Mapping]]] = ...) -> None: ... + +class GrpcOcelObjectTypeData(_message.Message): + __slots__ = ["type"] + TYPE_FIELD_NUMBER: _ClassVar[int] + type: str + def __init__(self, type: _Optional[str] = ...) -> None: ... + +class GrpcOcelAllocateMerge(_message.Message): + __slots__ = ["type", "merged_objects_ids"] + TYPE_FIELD_NUMBER: _ClassVar[int] + MERGED_OBJECTS_IDS_FIELD_NUMBER: _ClassVar[int] + type: str + merged_objects_ids: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, type: _Optional[str] = ..., merged_objects_ids: _Optional[_Iterable[str]] = ...) -> None: ... + +class GrpcOcelProducedObject(_message.Message): + __slots__ = ["id", "type"] + ID_FIELD_NUMBER: _ClassVar[int] + TYPE_FIELD_NUMBER: _ClassVar[int] + id: str + type: str + def __init__(self, id: _Optional[str] = ..., type: _Optional[str] = ...) -> None: ... + +class GrpcOcelConsumeProduce(_message.Message): + __slots__ = ["produced_objects"] + PRODUCED_OBJECTS_FIELD_NUMBER: _ClassVar[int] + produced_objects: _containers.RepeatedCompositeFieldContainer[GrpcOcelProducedObject] + def __init__(self, produced_objects: _Optional[_Iterable[_Union[GrpcOcelProducedObject, _Mapping]]] = ...) -> None: ... + +class GrpcOcelData(_message.Message): + __slots__ = ["object_id", "allocate", "consume", "merged_object_allocation", "produce_object_consumption"] + OBJECT_ID_FIELD_NUMBER: _ClassVar[int] + ALLOCATE_FIELD_NUMBER: _ClassVar[int] + CONSUME_FIELD_NUMBER: _ClassVar[int] + MERGED_OBJECT_ALLOCATION_FIELD_NUMBER: _ClassVar[int] + PRODUCE_OBJECT_CONSUMPTION_FIELD_NUMBER: _ClassVar[int] + object_id: str + allocate: GrpcOcelObjectTypeData + consume: GrpcOcelObjectTypeData + merged_object_allocation: GrpcOcelAllocateMerge + produce_object_consumption: GrpcOcelConsumeProduce + def __init__(self, object_id: _Optional[str] = ..., allocate: _Optional[_Union[GrpcOcelObjectTypeData, _Mapping]] = ..., consume: _Optional[_Union[GrpcOcelObjectTypeData, _Mapping]] = ..., merged_object_allocation: _Optional[_Union[GrpcOcelAllocateMerge, _Mapping]] = ..., produce_object_consumption: _Optional[_Union[GrpcOcelConsumeProduce, _Mapping]] = ...) -> None: ... class GrpcActivityDurationData(_message.Message): __slots__ = ["base", "duration", "kind"] diff --git a/Ficus/src/python/tests/grpc_pipelines/annotations/__init__.py b/Ficus/src/python/tests/grpc_pipelines/annotations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/Ficus/src/python/tests/grpc_pipelines/annotations/test_ocel_annotation.py b/Ficus/src/python/tests/grpc_pipelines/annotations/test_ocel_annotation.py new file mode 100644 index 000000000..b3c03dfff --- /dev/null +++ b/Ficus/src/python/tests/grpc_pipelines/annotations/test_ocel_annotation.py @@ -0,0 +1,112 @@ +import json + +from ...core.gold_based_test import execute_test_with_gold +from ....ficus import * + +from ...grpc_pipelines.test_grpc_pipelines import _execute_pipeline, assert_success_pipeline_final_result +from ...test_data_provider import * + + +class AssertCorrectOcelAnnotation(PipelinePartWithCallback): + def __init__(self, test_name: str): + super().__init__() + self.test_name = test_name + + def to_grpc_part(self) -> GrpcPipelinePartBase: + part = create_simple_get_context_value_part( + self.uuid, + self.__class__.__name__, + const_ocel_annotation, + ) + + return GrpcPipelinePartBase(simpleContextRequestPart=part) + + def execute_callback(self, values: dict[str, GrpcContextValue]): + assert const_ocel_annotation in values + + test_results = [] + grpc_annotations = values[const_ocel_annotation].ocel_annotation.annotations + + for annotation in AssertCorrectOcelAnnotation.build_annotations(grpc_annotations): + test_results.append({ + 'states': AssertCorrectOcelAnnotation.build_entity_state(annotation), + 'relations': self.build_relations_list(annotation.relations) + }) + + gold_path = get_ocel_gold_path(self.test_name) + execute_test_with_gold(gold_path, json.dumps(test_results, indent=2)) + + @staticmethod + def build_annotations(grpc_annotations) -> list[GrpcModelElementOcelAnnotation]: + annotations = list(grpc_annotations) + return sorted(annotations, key=lambda a: a.element_id) + + @staticmethod + def build_entity_state(annotation): + state = annotation.final_state + entity_states = [] + type_states = sorted(state.type_states, key=lambda t: t.type) + + for type_state in type_states: + entity_states.append(AssertCorrectOcelAnnotation.build_type_states(type_state)) + + return entity_states + + @staticmethod + def build_type_states(type_state): + ids = [id for id in type_state.object_ids] + ids.sort() + + return { + 'type': type_state.type, + 'object_ids': ids, + } + + @staticmethod + def build_relations_list(grpc_relations): + relations = list(map(lambda r: {'id': r.object_id, 'relations': list(r.related_objects_ids)}, grpc_relations)) + relations = sorted(relations, key=lambda r: r['id']) + + for r in relations: + r['relations'].sort() + + return relations + + +def test_ocel_annotation_1(): + _execute_ocel_annotation_test( + 'test_ocel_annotation_1', + 'ocel.xes', + [ + RemainEventsByRegex('(^Procfiler|^Ocel)'), + FilterEventsByRegex('NextId'), + RemainOnlyMethodStartEvents(), + PrepareSoftwareLog(time_attribute='time:timestamp'), + ] + ) + + +def _execute_ocel_annotation_test(test_name: str, log_name: str, filter_parts: list[PipelinePart]): + with open(get_ocel_logs_software_data_extraction_config(), "r") as f: + software_data_config = f.read() + + pipeline = Pipeline() + + pipeline.parts.append(ReadLogFromXes(use_bytes=True)) + + pipeline.parts.extend(filter_parts) + + pipeline.parts.extend([ + AddStartArtificialEvents(), + DiscoverRootSequenceGraph(root_sequence_kind=RootSequenceKind.FindBest, + merge_sequences_of_events=False), + CreateDagOcelAnnotation(), + AssertCorrectOcelAnnotation(test_name) + ]) + + result = _execute_pipeline(pipeline, { + 'bytes': BytesContextValue(read_file_bytes(get_ocel_log_path(log_name))), + 'software_data_extraction_config': JsonContextValue(software_data_config) + }) + + assert_success_pipeline_final_result(result) diff --git a/Ficus/src/python/tests/grpc_pipelines/test_grpc_pipelines.py b/Ficus/src/python/tests/grpc_pipelines/test_grpc_pipelines.py index 975ee1181..6201a8ed3 100644 --- a/Ficus/src/python/tests/grpc_pipelines/test_grpc_pipelines.py +++ b/Ficus/src/python/tests/grpc_pipelines/test_grpc_pipelines.py @@ -53,15 +53,17 @@ def _execute_test_with_exercise_log(log_name: str, pipeline: Pipeline): 'bytes': BytesContextValue(read_file_bytes(get_example_log_path(f'{log_name}.xes'))) }) + assert_success_pipeline_final_result(result) + + +def assert_success_pipeline_final_result(result): assert result.finalResult.HasField('success') assert not result.finalResult.HasField('error') def _execute_test_with_context(pipeline: Pipeline, context: dict[str, ContextValue]): result = _execute_pipeline(pipeline, context) - - assert result.finalResult.HasField('success') - assert not result.finalResult.HasField('error') + assert_success_pipeline_final_result(result) def test_pipeline_with_getting_context_value2(): @@ -154,8 +156,8 @@ def _execute_test_with_names_log(names_log: list[list[str]], success_field = 'success' error_field = 'error' - (present_field, not_present_error_field) = ( - success_field, error_field) if assertance_kind == ResultAssertanceKind.Success else (error_field, success_field) + success = assertance_kind == ResultAssertanceKind.Success + (present_field, not_present_error_field) = (success_field, error_field) if success else (error_field, success_field) assert result.finalResult.HasField(present_field) assert not result.finalResult.HasField(not_present_error_field) diff --git a/Ficus/src/python/tests/test_data_provider.py b/Ficus/src/python/tests/test_data_provider.py index 80474be68..aa22c0185 100644 --- a/Ficus/src/python/tests/test_data_provider.py +++ b/Ficus/src/python/tests/test_data_provider.py @@ -50,3 +50,21 @@ def console_app_method2_bxes_log_path() -> str: def array_pooling_bxes_log_path() -> str: return os.path.join(data_dir(), 'source', 'solutions_logs', 'arraypooling.bxes') + +def ocel_folder(): + return os.path.join(sources_dir(), 'ocel') + +def ocel_logs_folder(): + return os.path.join(ocel_folder(), 'logs') + +def get_ocel_logs_software_data_extraction_config(): + return os.path.join(ocel_folder(), 'config.json') + +def get_ocel_log_path(log_name: str) -> str: + return os.path.join(ocel_logs_folder(), log_name) + +def ocel_gold_folder() -> str: + return os.path.join(gold_dir(), 'ocel') + +def get_ocel_gold_path(test_name: str) -> str: + return os.path.join(ocel_gold_folder(), f'{test_name}.gold') diff --git a/Ficus/src/rust/Cargo.lock b/Ficus/src/rust/Cargo.lock index f61b50e98..e55039357 100644 --- a/Ficus/src/rust/Cargo.lock +++ b/Ficus/src/rust/Cargo.lock @@ -360,9 +360,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.51" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" dependencies = [ "cc", ] @@ -400,6 +400,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -496,6 +505,15 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "enum-display" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40f4d8927f0f19dc99da4506dca2b26f6c2a089887cf2cc424df114f3a2585ab" +dependencies = [ + "enum-display-macro", +] + [[package]] name = "enum-display-derive" version = "0.1.1" @@ -507,6 +525,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-display-macro" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e2e13c29d91e61ec78280847036d13cdc585e75ea2458274362d5d8467f1641" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", +] + [[package]] name = "env_filter" version = "0.1.3" @@ -571,6 +602,7 @@ dependencies = [ "bxes_kafka", "chrono", "derive-new", + "enum-display", "enum-display-derive", "fancy-regex", "futures", @@ -886,7 +918,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio", "tower-service", "tracing", @@ -957,6 +989,17 @@ dependencies = [ "generic-array", ] +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "libc", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -1025,9 +1068,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.164" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "libm" @@ -1037,9 +1080,9 @@ checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libz-sys" -version = "1.1.20" +version = "1.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" dependencies = [ "cc", "libc", @@ -1115,9 +1158,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" -version = "0.4.25" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "matchit" @@ -1386,23 +1429,24 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" dependencies = [ "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.5.11" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.87", ] [[package]] @@ -1499,9 +1543,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" @@ -1577,9 +1621,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -1779,9 +1823,9 @@ dependencies = [ [[package]] name = "rdkafka-sys" -version = "4.7.0+2.3.0" +version = "4.9.0+2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e0d2f9ba6253f6ec72385e453294f8618e9e15c2c6aba2a5c01ccf9622d615" +checksum = "5230dca48bc354d718269f3e4353280e188b610f7af7e2fcf54b7a79d5802872" dependencies = [ "cmake", "libc", @@ -1950,6 +1994,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "space" version = "0.12.1" @@ -2071,18 +2125,20 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tokio" -version = "1.41.1" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio", "pin-project-lite", - "socket2", + "slab", + "socket2 0.6.0", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2097,9 +2153,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -2269,6 +2325,12 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "utf8parse" version = "0.2.2" diff --git a/Ficus/src/rust/ficus/Cargo.toml b/Ficus/src/rust/ficus/Cargo.toml index 8218c05a5..9cce65efc 100644 --- a/Ficus/src/rust/ficus/Cargo.toml +++ b/Ficus/src/rust/ficus/Cargo.toml @@ -38,6 +38,7 @@ serde = { version = "1.0.200", features = ["derive"] } serde_json = "1.0.140" derive-new = "0.7.0" enum-display-derive = "0.1.1" +enum-display = "0.2.1" [dependencies.uuid] version = "1.4.1" diff --git a/Ficus/src/rust/ficus/src/features/discovery/mod.rs b/Ficus/src/rust/ficus/src/features/discovery/mod.rs index a7194f444..2355b642b 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/mod.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/mod.rs @@ -2,6 +2,7 @@ pub mod alpha; pub mod fuzzy; pub mod heuristic; pub mod multithreaded_dfg; +pub mod ocel; pub mod petri_net; pub mod relations; pub mod root_sequence; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs new file mode 100644 index 000000000..b9f4690e5 --- /dev/null +++ b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs @@ -0,0 +1,237 @@ +use crate::features::discovery::root_sequence::context_keys::EDGE_SOFTWARE_DATA_KEY; +use crate::features::discovery::timeline::software_data::models::OcelObjectAction; +use crate::utils::graph::graph::DefaultGraph; +use crate::utils::references::HeapedOrOwned; +use crate::utils::user_data::user_data::UserData; +use derive_new::new; +use enum_display::EnumDisplay; +use getset::Getters; +use lazy_static::lazy_static; +use std::collections::{HashMap, HashSet, VecDeque}; +use std::rc::Rc; + +#[derive(new, Getters)] +pub struct OcelAnnotation { + #[get = "pub"] + nodes_to_states: HashMap, +} + +#[derive(EnumDisplay)] +pub enum OcelAnnotationCreationError { + UnsupportedGraphKind, + FailedToFindStartNode, + ObjectAlreadyExistsInNodeState, + ConsumeNotExistingObject, + OneOfMergedObjetsDoesNotExist, +} + +#[derive(Getters)] +pub struct NodeObjectsState { + #[getset(get = "pub")] + map: HashMap, HashSet>>, +} + +impl NodeObjectsState { + pub fn new() -> Self { + Self { map: HashMap::new() } + } + + pub fn add_allocated_object( + &mut self, + object_type: HeapedOrOwned, + object_id: HeapedOrOwned, + ) -> Result<(), OcelAnnotationCreationError> { + if self.contains_object(&object_type, &object_id) { + return Err(OcelAnnotationCreationError::ObjectAlreadyExistsInNodeState); + } + + self.type_set_mut(&object_type).insert(object_id); + Ok(()) + } + + pub fn remove_object(&mut self, object_type: &HeapedOrOwned, id: &HeapedOrOwned) { + let Some(set) = self.map.get_mut(object_type) else { return }; + + set.remove(id); + } + + pub fn remove_unknown_object(&mut self, id: &HeapedOrOwned) { + for (_, set) in self.map.iter_mut() { + if set.remove(id) { + return; + } + } + } + + pub fn contains_object(&self, object_type: &HeapedOrOwned, object_id: &HeapedOrOwned) -> bool { + if let Some(type_objects) = self.map.get(object_type) { + type_objects.contains(object_id) + } else { + false + } + } + + pub fn contains_unknown_object(&self, object_id: &HeapedOrOwned) -> bool { + self.map.values().any(|set| set.contains(object_id)) + } + + fn type_set_mut(&mut self, object_type: &HeapedOrOwned) -> &mut HashSet> { + if !self.map.contains_key(object_type) { + self.map.insert(object_type.clone(), HashSet::new()); + } + + self.map.get_mut(object_type).unwrap() + } + + pub fn add_state_from(&mut self, other: &NodeObjectsState) { + for (obj_type, ids) in other.map.iter() { + let set = self.map.entry(obj_type.to_owned()).or_insert(HashSet::new()); + + for id in ids { + set.insert(id.clone()); + } + } + } +} + +#[derive(new, Getters)] +pub struct ProcessNodesStates { + #[get = "pub"] + initial_objects: Option, + #[get = "pub"] + final_objects: NodeObjectsState, + #[get = "pub"] + incoming_objects_relations: Vec, +} + +#[derive(new, Getters)] +pub struct OcelObjectRelations { + #[get = "pub"] + object_id: HeapedOrOwned, + #[get = "pub"] + from_element_id: u64, + #[get = "pub"] + related_objects_ids: Vec> +} + +lazy_static! { + pub static ref UNKNOWN_TYPE: Box = Box::new("UNKNOWN".to_string()); +} + +pub fn create_ocel_annotation_for_dag(graph: &DefaultGraph) -> Result { + let Some(kind) = graph.kind.as_ref() else { + return Err(OcelAnnotationCreationError::UnsupportedGraphKind); + }; + if !kind.is_dag() { + return Err(OcelAnnotationCreationError::UnsupportedGraphKind); + } + + let mut q = VecDeque::new(); + let start_node_id = graph + .all_nodes() + .iter() + .find(|n| graph.incoming_edges(n.id()).len() == 0) + .map(|n| n.id().to_owned()); + + if start_node_id.is_none() { + return Err(OcelAnnotationCreationError::FailedToFindStartNode); + } + + q.push_back(start_node_id.unwrap()); + + let mut process_nodes_states = HashMap::new(); + + 'main_loop: loop { + if q.is_empty() { + break; + } + + let node = q.pop_front().unwrap(); + + let incoming_nodes = graph.incoming_edges(&node); + for incoming_node in incoming_nodes.iter() { + if !process_nodes_states.contains_key(*incoming_node) { + q.push_back(node); + continue 'main_loop; + } + } + + let mut new_node_state = NodeObjectsState::new(); + let mut new_node_objects_relations = vec![]; + + let fallback_type = HeapedOrOwned::Heaped(Rc::new(UNKNOWN_TYPE.clone())); + + for incoming_node in incoming_nodes.iter() { + let prev_state: &ProcessNodesStates = *process_nodes_states.get(*incoming_node).as_ref().unwrap(); + let edge = graph.edge(*incoming_node, &node); + let edge = edge.as_ref().unwrap(); + + new_node_state.add_state_from(prev_state.final_objects()); + + if let Some(edge_software_data) = edge.user_data().concrete(EDGE_SOFTWARE_DATA_KEY.key()) { + for data in edge_software_data { + for ocel_data in data.ocel_data() { + let obj_id = ocel_data.object_id(); + + match ocel_data.action() { + OcelObjectAction::Allocate(data) => { + let obj_type = data.r#type().as_ref().unwrap_or(&fallback_type); + new_node_state.add_allocated_object(obj_type.to_owned(), obj_id.to_owned())?; + } + OcelObjectAction::Consume(data) => { + let obj_type = data.r#type().as_ref().unwrap_or(&fallback_type); + if prev_state.final_objects.contains_object(obj_type, obj_id) { + return Err(OcelAnnotationCreationError::ConsumeNotExistingObject); + } + + new_node_state.remove_object(obj_type, obj_id); + } + OcelObjectAction::AllocateMerged(data) => { + let mut related_objects = vec![]; + + for id in data.data() { + if !prev_state.final_objects.contains_unknown_object(id) { + return Err(OcelAnnotationCreationError::OneOfMergedObjetsDoesNotExist); + } + + new_node_state.remove_unknown_object(id); + related_objects.push(id.clone()); + } + + let relations = OcelObjectRelations::new(obj_id.to_owned(), **incoming_node, related_objects); + new_node_objects_relations.push(relations); + + let obj_type = data.r#type().as_ref().unwrap_or(&fallback_type); + new_node_state.add_allocated_object(obj_type.clone(), obj_id.clone())?; + } + OcelObjectAction::ConsumeWithProduce(data) => { + if !prev_state.final_objects.contains_unknown_object(obj_id) { + return Err(OcelAnnotationCreationError::ConsumeNotExistingObject); + } + + for produced_obj in data.iter() { + let obj_type = produced_obj.r#type().as_ref().unwrap_or(&fallback_type); + let id = produced_obj.id(); + new_node_state.add_allocated_object(obj_type.clone(), id.clone())?; + + let relations = OcelObjectRelations::new(id.clone(), **incoming_node, vec![obj_id.clone()]); + new_node_objects_relations.push(relations); + } + + new_node_state.remove_unknown_object(obj_id); + } + } + } + } + } + } + + process_nodes_states.insert(node, ProcessNodesStates::new(None, new_node_state, new_node_objects_relations)); + + for outgoing_node in graph.outgoing_nodes(&node) { + q.push_back(outgoing_node.clone()); + } + } + + Ok(OcelAnnotation::new(process_nodes_states)) +} diff --git a/Ficus/src/rust/ficus/src/features/discovery/ocel/mod.rs b/Ficus/src/rust/ficus/src/features/discovery/ocel/mod.rs new file mode 100644 index 000000000..a5c123bba --- /dev/null +++ b/Ficus/src/rust/ficus/src/features/discovery/ocel/mod.rs @@ -0,0 +1 @@ +pub mod graph_annotation; diff --git a/Ficus/src/rust/ficus/src/features/discovery/root_sequence/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/root_sequence/discovery.rs index bd78afcf0..27e64bc75 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/root_sequence/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/root_sequence/discovery.rs @@ -3,7 +3,7 @@ use crate::features::discovery::root_sequence::adjustments::{ adjust_connections, adjust_edges_data, adjust_weights, find_next_node, merge_sequences_of_nodes, }; use crate::features::discovery::root_sequence::context::DiscoveryContext; -use crate::features::discovery::root_sequence::models::{DiscoverRootSequenceGraphError, EventWithUniqueId}; +use crate::features::discovery::root_sequence::models::{DiscoverRootSequenceGraphError, EventWithUniqueId, RootSequenceKind}; use crate::features::discovery::root_sequence::root_sequence::discover_root_sequence; use crate::utils::context_key::DefaultContextKey; use crate::utils::graph::graph::{DefaultGraph, GraphKind, NodesConnectionData}; @@ -65,7 +65,12 @@ pub fn discover_root_sequence_graph( ) -> Result { let mut result = discover_root_sequence_graph_internal(log, context, true)?; - result.graph_mut().set_kind(Some(GraphKind::Dag)); + let graph_kind = match context.root_sequence_kind() { + RootSequenceKind::FindBest | RootSequenceKind::PairwiseLCS | RootSequenceKind::Trace => GraphKind::Dag, + RootSequenceKind::LCS => GraphKind::DagLCS, + }; + + result.graph_mut().set_kind(Some(graph_kind)); add_start_end_nodes_ids_to_user_data(&mut result); adjust_connections(context, log, &mut result.graph); diff --git a/Ficus/src/rust/ficus/src/features/discovery/root_sequence/models.rs b/Ficus/src/rust/ficus/src/features/discovery/root_sequence/models.rs index 4bd87d4e9..46a4dc15e 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/root_sequence/models.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/root_sequence/models.rs @@ -100,8 +100,10 @@ impl NodeAdditionalDataContainer { #[derive(Clone, Debug, Getters, new)] pub struct ActivityStartEndTimeData { - #[getset(get = "pub")] start_time: i64, - #[getset(get = "pub")] end_time: i64, + #[getset(get = "pub")] + start_time: i64, + #[getset(get = "pub")] + end_time: i64, } #[derive(Clone, Debug)] diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs index 507243a81..5b880c026 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs @@ -21,6 +21,7 @@ use crate::features::discovery::timeline::software_data::extractors::core::{ EventGroupSoftwareDataExtractor, EventGroupTraceSoftwareDataExtractor, SoftwareDataExtractionError, }; use crate::features::discovery::timeline::software_data::extractors::event_classes::EventClassesDataExtractor; +use crate::features::discovery::timeline::software_data::extractors::ocel::OcelDataExtractor; use crate::features::discovery::timeline::software_data::extractors::pie_charts::PieChartExtractor; use crate::features::discovery::timeline::software_data::extractors::simple_counter::SimpleCounterExtractor; use crate::features::discovery::timeline::software_data::models::SoftwareData; @@ -152,6 +153,7 @@ fn put_node_user_data( let activity_start_end_time = ActivityStartEndTimeData::new(first_stamp, last_stamp); let activity_start_end_time = NodeAdditionalDataContainer::new(activity_start_end_time, event_coordinates); + event .user_data_mut() .put_concrete(NODE_START_END_ACTIVITIES_TIMES_KEY.key(), vec![activity_start_end_time]); @@ -185,6 +187,7 @@ fn put_edge_user_data( event .user_data_mut() .put_concrete(EDGE_START_END_ACTIVITIES_TIMES_KEY.key(), vec![edge_start_end_time]); + event.user_data_mut().put_concrete( EDGE_TRACE_EXECUTION_INFO_KEY.key(), vec![EdgeTraceExecutionInfo::new(event_coordinates.trace_id())], @@ -242,6 +245,7 @@ fn create_edge_software_data_extractors<'a>( vec![ Rc::new(Box::new(PieChartExtractor::<'a>::new(config))), Rc::new(Box::new(SimpleCounterExtractor::<'a>::new(config))), + Rc::new(Box::new(OcelDataExtractor::<'a>::new(config))), ] } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs index 66c2ba6a4..3927a4fea 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs @@ -1,4 +1,5 @@ use crate::features::mutations::mutations::{ARTIFICIAL_END_EVENT_NAME, ARTIFICIAL_START_EVENT_NAME}; +use crate::utils::references::HeapedOrOwned; use derive_new::new; use fancy_regex::Regex; use getset::{Getters, Setters}; @@ -13,6 +14,8 @@ pub struct SoftwareDataExtractionConfig { method_end: Option>, #[getset(get = "pub", set = "pub")] allocation: Option>, + #[getset(get = "pub", set = "pub")] + ocel: Option, #[getset(get = "pub", set = "pub")] raw_control_flow_regexes: Vec, @@ -31,6 +34,7 @@ impl SoftwareDataExtractionConfig { method_start: None, method_end: None, allocation: None, + ocel: None, raw_control_flow_regexes: vec![], pie_chart_extraction_configs: vec![], simple_counter_configs: vec![], @@ -60,6 +64,46 @@ impl SoftwareDataExtractionConfig { } } +#[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] +pub struct OcelUnitedExtractionConfig { + #[getset(get = "pub")] + delimiter: Option, + #[getset(get = "pub")] + allocated: Option>, + #[getset(get = "pub")] + consumed: Option>, + #[getset(get = "pub")] + allocated_merged: Option>, + #[getset(get = "pub")] + consume_produce: Option>, +} + +#[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] +pub struct OcelObjectExtractionConfigBase { + #[getset(get = "pub")] + object_type_attr: NameCreationStrategy, + #[getset(get = "pub")] + object_id_attr: String, +} + +#[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] +pub struct OcelAllocateMergeExtractionConfig { + #[getset(get = "pub")] + allocated_obj: OcelObjectExtractionConfigBase, + #[getset(get = "pub")] + related_object_ids_attr: String, +} + +#[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] +pub struct OcelConsumeProduceExtractionConfig { + #[getset(get = "pub")] + object_id_attr: String, + #[getset(get = "pub")] + related_object_ids_attr: String, + #[getset(get = "pub")] + related_object_type_attr: String, +} + #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct AllocationExtractionConfig { #[getset(get = "pub")] @@ -111,11 +155,11 @@ pub struct PieChartExtractionConfig { #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct GenericExtractionConfigBase { #[getset(get = "pub")] - name: String, + name: HeapedOrOwned, #[getset(get = "pub")] - units: String, + units: HeapedOrOwned, #[getset(get = "pub")] - group: Option, + group: Option>, } #[derive(Clone, Debug, Serialize, Deserialize, new)] @@ -126,10 +170,10 @@ pub enum NameCreationStrategy { } impl NameCreationStrategy { - pub fn fallback_value(&self) -> String { + pub fn fallback_value(&self) -> HeapedOrOwned { match self { - NameCreationStrategy::SingleAttribute(s) => s.fallback_value().to_string(), - NameCreationStrategy::ManyAttributes(m) => m.fallback_value().to_string(), + NameCreationStrategy::SingleAttribute(s) => s.fallback_value().clone(), + NameCreationStrategy::ManyAttributes(m) => m.fallback_value().clone(), } } } @@ -139,7 +183,7 @@ pub struct SingleAttribute { #[getset(get = "pub")] name: String, #[getset(get = "pub")] - fallback_value: String, + fallback_value: HeapedOrOwned, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] @@ -149,7 +193,7 @@ pub struct ManyAttributes { #[getset(get = "pub")] separator: String, #[getset(get = "pub")] - fallback_value: String, + fallback_value: HeapedOrOwned, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] @@ -179,7 +223,7 @@ pub struct TimeAttributeConfig { #[getset(get = "pub")] time_attribute: String, #[getset(get = "pub")] - kind: TimeKind + kind: TimeKind, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -194,5 +238,5 @@ pub enum TimeKind { Hours, Days, - UtcStamp + UtcStamp, } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs index 2511b21fb..1ab9fb078 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs @@ -2,14 +2,17 @@ use crate::event_log::core::event::event::Event; use crate::event_log::xes::xes_event::XesEventImpl; use crate::features::discovery::timeline::events_groups::EventGroup; use crate::features::discovery::timeline::software_data::extraction_config::{ - ActivityDurationExtractionConfig, GenericExtractionConfigBase, SoftwareDataExtractionConfig, TimeAttributeConfig, + ActivityDurationExtractionConfig, SoftwareDataExtractionConfig, TimeAttributeConfig, }; use crate::features::discovery::timeline::software_data::extractors::core::{ EventGroupTraceSoftwareDataExtractor, SoftwareDataExtractionError, }; use crate::features::discovery::timeline::software_data::extractors::utils::RegexParingResult; -use crate::features::discovery::timeline::software_data::models::{ActivityDurationData, DurationKind, GenericEnhancementBase, SoftwareData}; +use crate::features::discovery::timeline::software_data::models::{ + ActivityDurationData, DurationKind, GenericEnhancementBase, SoftwareData, +}; use crate::features::discovery::timeline::utils::get_stamp; +use crate::utils::references::HeapedOrOwned; use crate::utils::vec_utils::VectorOptionExtensions; use derive_new::new; use fancy_regex::Regex; @@ -188,12 +191,12 @@ fn add_software_activities_durations(software_data: &mut SoftwareData, data: &Du let base = info.base(); ActivityDurationData::new( - GenericEnhancementBase::new(base.name().to_string(), base.units().to_string(), base.group().clone()), + GenericEnhancementBase::new(base.name().clone(), base.units().clone(), base.group().clone()), *value, match info.time_attribute() { Some(attr) => DurationKind::from(attr.kind()), - None => DurationKind::Unknown - } + None => DurationKind::Unknown, + }, ) })); } @@ -235,7 +238,7 @@ impl DurationsMapExtensions for DurationsMap { #[derive(Getters, new)] struct StackActivityStartEntry { #[getset(get = "pub")] - id: Option, + id: Option>, #[getset(get = "pub")] event: Rc>, } @@ -289,11 +292,7 @@ fn process_events( for prev_data in previous_data.iter_mut() { if let Some(prev_data) = prev_data.as_mut() { let duration = (prev_data.end_time - prev_data.start_time) as u64; - (*prev_data - .map - .entry(info.base().name().to_string()) - .or_insert((0u64, info.clone())) - ).0 += duration; + (*prev_data.map.entry(info.base().name().to_string()).or_insert((0u64, info.clone()))).0 += duration; } } } @@ -332,7 +331,10 @@ fn get_duration( Ok((get_stamp_or_err(second, attribute)? - get_stamp_or_err(first, attribute)?) as u64) } -fn get_stamp_or_err(event: &Rc>, attribute: Option<&TimeAttributeConfig>) -> Result { +fn get_stamp_or_err( + event: &Rc>, + attribute: Option<&TimeAttributeConfig>, +) -> Result { let attribute = attribute.map(|a| a.time_attribute()); get_stamp(&event.borrow(), attribute).map_err(|_| SoftwareDataExtractionError::FailedToGetStamp) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs index c971f4cfc..a10d0e59f 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs @@ -56,4 +56,4 @@ pub(super) fn parse_or_err(value: &str) -> Result EventGroupSoftwareDataExtractor for EventClassesDataExtractor<'a> { let mut threads = HashMap::new(); for event in events { - *software_data.event_classes_mut().entry(event.borrow().name().clone()).or_insert(0) += 1; + let name = HeapedOrOwned::Heaped(event.borrow().name_pointer().clone()); + *software_data.event_classes_mut().entry(name).or_insert(0) += 1; if let Some(thread_attribute) = self.thread_attribute { let thread_id = extract_thread_id(event.borrow().deref(), thread_attribute); diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/mod.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/mod.rs index c6cff24cc..459357e90 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/mod.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/mod.rs @@ -1,6 +1,7 @@ pub mod activities_durations; pub mod core; pub mod event_classes; +pub mod ocel; pub mod pie_charts; pub mod simple_counter; mod utils; diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs new file mode 100644 index 000000000..17fdc1219 --- /dev/null +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs @@ -0,0 +1,238 @@ +use crate::event_log::core::event::event::{Event, EventPayloadValue}; +use crate::event_log::xes::xes_event::XesEventImpl; +use crate::features::discovery::timeline::software_data::extraction_config::{ + ExtractionConfig, OcelAllocateMergeExtractionConfig, OcelConsumeProduceExtractionConfig, OcelObjectExtractionConfigBase, + SoftwareDataExtractionConfig, +}; +use crate::features::discovery::timeline::software_data::extractors::core::{EventGroupSoftwareDataExtractor, SoftwareDataExtractionError}; +use crate::features::discovery::timeline::software_data::models::{ + ObjectTypeWithData, OcelData, OcelObjectAction, OcelProducedObjectAfterConsume, SoftwareData, +}; +use crate::utils::references::HeapedOrOwned; +use derive_new::new; +use fancy_regex::Regex; +use log::{debug, warn}; +use std::cell::RefCell; +use std::collections::HashMap; +use std::fmt::Debug; +use std::rc::Rc; + +#[derive(Debug, Clone, new)] +pub struct OcelDataExtractor<'a> { + config: &'a SoftwareDataExtractionConfig, +} + +impl<'a> EventGroupSoftwareDataExtractor for OcelDataExtractor<'a> { + fn extract_from_events( + &self, + software_data: &mut SoftwareData, + events: &[Rc>], + ) -> Result<(), SoftwareDataExtractionError> { + let Some(ocel_config) = self.config.ocel().as_ref() else { + return Ok(()); + }; + + let alloc_config = Self::map_config_to_regex(ocel_config.allocated())?; + let consume_config = Self::map_config_to_regex(ocel_config.consumed())?; + let alloc_merged_config = Self::map_config_to_regex(ocel_config.allocated_merged())?; + let consume_produce_config = Self::map_config_to_regex(ocel_config.consume_produce())?; + + let delimiter = ocel_config.delimiter().as_ref().map(|s| s.as_str()).unwrap_or(" "); + + for event in events { + let event = &event.borrow(); + + let _ = Self::process_allocate_merge(event, alloc_merged_config.as_ref(), delimiter, software_data) + || Self::process_consume_produce(event, consume_produce_config.as_ref(), delimiter, software_data) + || Self::process_allocate(event, alloc_config.as_ref(), software_data) + || Self::process_consume(event, consume_config.as_ref(), software_data); + } + + Ok(()) + } +} + +impl<'a> OcelDataExtractor<'a> { + fn map_config_to_regex( + config: &Option>, + ) -> Result, SoftwareDataExtractionError> { + let Some(config) = config else { return Ok(None) }; + + let regex = config.event_class_regex(); + let regex = Regex::new(regex).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(regex.to_owned()))?; + + Ok(Some((regex, config.info()))) + } + + fn process_allocate( + event: &XesEventImpl, + config: Option<&(Regex, &OcelObjectExtractionConfigBase)>, + software_data: &mut SoftwareData, + ) -> bool { + let Some(config) = Self::try_get_config(event, config) else { + return false; + }; + let Some((id, obj_type)) = Self::extract_object_id_and_type(event, config) else { + return false; + }; + let action = OcelObjectAction::Allocate(ObjectTypeWithData::new(Some(obj_type), ())); + + software_data.ocel_data_mut().push(OcelData::new(id, action)); + + true + } + + fn try_get_config<'b, T>(event: &'b XesEventImpl, config: Option<&'b (Regex, T)>) -> Option<&'b T> { + let Some((regex, config)) = config else { return None }; + if !regex.is_match(event.name().as_str()).unwrap_or(false) { + return None; + } + + Some(config) + } + + fn process_consume( + event: &XesEventImpl, + config: Option<&(Regex, &OcelObjectExtractionConfigBase)>, + software_data: &mut SoftwareData, + ) -> bool { + let Some(config) = Self::try_get_config(event, config) else { + return false; + }; + + let Some((id, obj_type)) = Self::extract_object_id_and_type(event, config) else { + return false; + }; + let action = OcelObjectAction::Consume(ObjectTypeWithData::new(Some(obj_type), ())); + + software_data.ocel_data_mut().push(OcelData::new(id, action)); + + true + } + + fn extract_object_id_and_type( + event: &XesEventImpl, + config: &OcelObjectExtractionConfigBase, + ) -> Option<(HeapedOrOwned, HeapedOrOwned)> { + let object_type = config.object_type_attr().create(event); + + let object_id = match Self::parse_object_id(&event, config.object_id_attr().as_str()) { + None => { + debug!("Object does not have an object id, skipping it"); + return None; + } + Some(id) => id, + }; + + Some((object_id, object_type)) + } + + fn process_allocate_merge( + event: &XesEventImpl, + config: Option<&(Regex, &OcelAllocateMergeExtractionConfig)>, + delimiter: &str, + software_data: &mut SoftwareData, + ) -> bool { + let Some(config) = Self::try_get_config(event, config) else { + return false; + }; + + let Some(payload) = event.payload_map() else { return false }; + let Some((id, obj_type)) = Self::extract_object_id_and_type(event, config.allocated_obj()) else { + return false; + }; + + let related_objects_ids = Self::parse_related_objects_ids(payload, Some(config.related_object_ids_attr()), delimiter); + let Some(related_objects_ids) = related_objects_ids else { + return false; + }; + + let data = ObjectTypeWithData::new(Some(obj_type), related_objects_ids); + let ocel_data = OcelData::new(id, OcelObjectAction::AllocateMerged(data)); + software_data.ocel_data_mut().push(ocel_data); + + true + } + + fn process_consume_produce( + event: &XesEventImpl, + config: Option<&(Regex, &OcelConsumeProduceExtractionConfig)>, + delimiter: &str, + software_data: &mut SoftwareData, + ) -> bool { + let Some(config) = Self::try_get_config(event, config) else { + return false; + }; + + let Some(payload) = event.payload_map() else { return false }; + let Some(object_id) = Self::parse_object_id(&event, config.object_id_attr().as_str()) else { + return false; + }; + let related_objects_ids = Self::parse_related_objects_ids(payload, Some(config.related_object_ids_attr()), delimiter); + let Some(related_objects_ids) = related_objects_ids else { + return false; + }; + + let related_objects_types = Self::parse_related_objects_ids(payload, Some(config.related_object_type_attr()), delimiter); + let Some(related_objects_types) = related_objects_types else { + return false; + }; + + if related_objects_ids.len() != related_objects_types.len() { + warn!("related_objects_ids.len() != related_objects_types.len(), will not add consume produce"); + return false; + } + + let data = related_objects_ids + .into_iter() + .zip(related_objects_types.into_iter()) + .map(|(id, r#type)| OcelProducedObjectAfterConsume::new(id, Some(r#type))) + .collect(); + + let ocel_data = OcelData::new(object_id, OcelObjectAction::ConsumeWithProduce(data)); + software_data.ocel_data_mut().push(ocel_data); + + true + } + + fn parse_object_id(event: &XesEventImpl, object_id_attr: &str) -> Option> { + if let Some(map) = event.payload_map().as_ref() { + if let Some(object_id) = map.get(object_id_attr).as_ref() { + return Some(object_id.to_string_repr()); + } + } + + None + } + + fn parse_related_objects_ids( + payload: &HashMap, + related_objects_ids_attr: Option<&String>, + delimiter: &str, + ) -> Option>> { + if let Some(related_objects_ids_attr) = related_objects_ids_attr { + if let Some(objects_ids) = payload.get(related_objects_ids_attr) { + let parsed_ids: Vec> = objects_ids + .to_string_repr() + .trim() + .split(delimiter) + .filter_map(|s| { + if s.len() > 0 { + Some(HeapedOrOwned::Owned(s.to_string())) + } else { + None + } + }) + .collect(); + + if parsed_ids.len() == 0 { + return None; + } + + return Some(parsed_ids); + } + } + + None + } +} diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs index 52e308b9c..ead8da874 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs @@ -6,6 +6,7 @@ use crate::features::discovery::timeline::software_data::extractors::core::{ }; use crate::features::discovery::timeline::software_data::extractors::utils::RegexParingResult; use crate::features::discovery::timeline::software_data::models::{GenericEnhancementBase, HistogramData, HistogramEntry, SoftwareData}; +use crate::utils::references::HeapedOrOwned; use derive_new::new; use fancy_regex::Regex; use std::cell::RefCell; @@ -59,7 +60,7 @@ impl<'a> EventGroupSoftwareDataExtractor for PieChartExtractor<'a> { let grouping_value = if let Some(strategy) = config.grouping_attr() { strategy.create(&event.borrow()) } else { - event.borrow().name().to_string() + HeapedOrOwned::Heaped(event.borrow().name_pointer().clone()) }; *result @@ -78,7 +79,7 @@ impl<'a> EventGroupSoftwareDataExtractor for PieChartExtractor<'a> { for (_, (base, counts)) in result { software_data.histograms_mut().push(HistogramData::new( - GenericEnhancementBase::new(base.name().to_string(), base.units().to_string(), base.group().clone()), + GenericEnhancementBase::new(base.name().clone(), base.units().clone(), base.group().clone()), counts.into_iter().map(|(k, v)| HistogramEntry::new(k, v)).collect(), )) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs index cb46bf698..88266390b 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs @@ -69,7 +69,7 @@ impl<'a> EventGroupSoftwareDataExtractor for SimpleCounterExtractor<'a> { for (_, (base, count)) in result { software_data.simple_counters_mut().push(SimpleCounterData::new( - GenericEnhancementBase::new(base.name().to_string(), base.units().to_string(), base.group().clone()), + GenericEnhancementBase::new(base.name().clone(), base.units().clone(), base.group().clone()), count, )); } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs index 225cd2194..b51f10fdf 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs @@ -2,13 +2,14 @@ use crate::event_log::core::event::event::{Event, EventPayloadValue}; use crate::event_log::xes::xes_event::XesEventImpl; use crate::features::discovery::timeline::software_data::extraction_config::NameCreationStrategy; use crate::features::discovery::timeline::software_data::extractors::core::SoftwareDataExtractionError; +use crate::utils::references::HeapedOrOwned; use fancy_regex::Regex; use std::collections::HashMap; pub type RegexParingResult = Result; impl NameCreationStrategy { - pub(super) fn create(&self, event: &XesEventImpl) -> String { + pub(super) fn create(&self, event: &XesEventImpl) -> HeapedOrOwned { if let Some(map) = event.payload_map() { match self { NameCreationStrategy::SingleAttribute(single_attribute) => self.value_or_fallback(single_attribute.name(), map), @@ -23,7 +24,7 @@ impl NameCreationStrategy { result.remove(result.len() - 1); } - result + HeapedOrOwned::Owned(result) } } } else { @@ -31,9 +32,9 @@ impl NameCreationStrategy { } } - fn value_or_fallback(&self, attr: &String, payload: &HashMap) -> String { + fn value_or_fallback(&self, attr: &String, payload: &HashMap) -> HeapedOrOwned { if let Some(attr_value) = payload.get(attr) { - attr_value.to_string_repr().to_string() + attr_value.to_string_repr() } else { self.fallback_value() } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs index 7ca1bc8b7..e985fddf6 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs @@ -1,15 +1,17 @@ use crate::features::discovery::timeline::discovery::TraceThread; +use crate::features::discovery::timeline::software_data::extraction_config::TimeKind; +use crate::utils::references::HeapedOrOwned; use derive_new::new; +use enum_display::EnumDisplay; use getset::{Getters, MutGetters}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use crate::features::discovery::timeline::software_data::extraction_config::TimeKind; #[derive(Clone, Debug, Getters, MutGetters, Serialize, Deserialize)] pub struct SoftwareData { #[getset(get = "pub", get_mut = "pub")] #[serde(skip_serializing_if = "HashMap::is_empty")] - event_classes: HashMap, + event_classes: HashMap, usize>, #[getset(get = "pub", get_mut = "pub")] #[serde(skip)] @@ -26,6 +28,10 @@ pub struct SoftwareData { #[getset(get = "pub", get_mut = "pub")] #[serde(skip_serializing_if = "Vec::is_empty")] activities_durations: Vec, + + #[getset(get = "pub", get_mut = "pub")] + #[serde(skip_serializing_if = "Vec::is_empty")] + ocel_data: Vec, } impl SoftwareData { @@ -36,10 +42,43 @@ impl SoftwareData { histograms: vec![], simple_counters: vec![], activities_durations: vec![], + ocel_data: vec![], } } } +#[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] +pub struct OcelProducedObjectAfterConsume { + #[getset(get = "pub")] + id: HeapedOrOwned, + #[getset(get = "pub")] + r#type: Option>, +} + +#[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] +pub struct ObjectTypeWithData { + #[getset(get = "pub")] + r#type: Option>, + #[getset(get = "pub")] + data: T, +} + +#[derive(Clone, Debug, Serialize, Deserialize, EnumDisplay)] +pub enum OcelObjectAction { + Allocate(ObjectTypeWithData<()>), + Consume(ObjectTypeWithData<()>), + AllocateMerged(ObjectTypeWithData>>), + ConsumeWithProduce(Vec), +} + +#[derive(Clone, Debug, Getters, new, Serialize, Deserialize)] +pub struct OcelData { + #[getset(get = "pub")] + object_id: HeapedOrOwned, + #[getset(get = "pub")] + action: OcelObjectAction, +} + #[derive(Clone, Debug, Getters, MutGetters, new, Serialize, Deserialize)] pub struct HistogramData { #[getset(get = "pub")] @@ -51,17 +90,17 @@ pub struct HistogramData { #[derive(Clone, Debug, Getters, MutGetters, new, Serialize, Deserialize)] pub struct GenericEnhancementBase { #[getset(get = "pub")] - name: String, + name: HeapedOrOwned, #[getset(get = "pub")] - units: String, + units: HeapedOrOwned, #[getset(get = "pub")] - group: Option, + group: Option>, } #[derive(Clone, Debug, Getters, new, Serialize, Deserialize)] pub struct HistogramEntry { #[getset(get = "pub")] - name: String, + name: HeapedOrOwned, #[getset(get = "pub")] value: f64, } @@ -81,7 +120,7 @@ pub struct ActivityDurationData { #[getset(get = "pub")] duration: u64, #[getset(get = "pub")] - kind: DurationKind + kind: DurationKind, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -108,7 +147,7 @@ impl From<&TimeKind> for DurationKind { TimeKind::Minutes => Self::Minutes, TimeKind::Hours => Self::Hours, TimeKind::Days => Self::Days, - TimeKind::UtcStamp => Self::Nanos + TimeKind::UtcStamp => Self::Nanos, } } -} \ No newline at end of file +} diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs index 28dfa63cf..549b2da82 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs @@ -1,7 +1,7 @@ -use chrono::{DateTime, Utc}; use crate::event_log::core::event::event::{Event, EventPayloadValue}; use crate::event_log::xes::xes_event::XesEventImpl; use crate::features::discovery::timeline::discovery::LogThreadsDiagramError; +use chrono::{DateTime, Utc}; pub fn extract_thread_id(event: &TEvent, thread_attribute: &str) -> Option { if let Some(map) = event.payload_map() { @@ -39,4 +39,4 @@ fn get_utc_date_stamp(date: &DateTime) -> Result> + Send + Sync + 'static>>; + type ExecutePipelineStream = Pin> + Send + Sync + 'static>>; async fn execute_pipeline( &self, @@ -82,10 +82,15 @@ impl GrpcBackendService for FicusService { if let Some(grpc_cv) = convert_to_grpc_context_value(&context_key, value) { let id = Uuid::new_v4(); - cv_service.put_context_value(id.to_string(), GrpcContextKeyValue { - key: Some(GrpcContextKey { name: key.name().to_owned() }), - value: Some(grpc_cv), - }); + cv_service.put_context_value( + id.to_string(), + GrpcContextKeyValue { + key: Some(GrpcContextKey { + name: key.name().to_owned(), + }), + value: Some(grpc_cv), + }, + ); ids.insert(key.name().to_owned(), id); } @@ -120,7 +125,7 @@ impl GrpcBackendService for FicusService { Some(keys_to_cv_ids) => match keys_to_cv_ids.get(key.key().name()) { None => Err(Status::not_found("Failed to get context for guid".to_string())), Some(id) => Ok(Response::new(GrpcGuid { guid: id.to_string() })), - } + }, } } } @@ -131,10 +136,12 @@ impl GrpcBackendService for FicusService { match self.contexts.lock().as_ref().unwrap().get(&id.guid) { None => Err(Status::not_found("The context values for supplied execution id are not found")), Some(keys_to_cv_ids) => Ok(Response::new(GrpcGetAllContextValuesResult { - context_values: keys_to_cv_ids.values().into_iter().map(|id| GrpcGuid { - guid: id.to_string() - }).collect() - })) + context_values: keys_to_cv_ids + .values() + .into_iter() + .map(|id| GrpcGuid { guid: id.to_string() }) + .collect(), + })), } } @@ -152,12 +159,11 @@ impl GrpcBackendService for FicusService { async fn get_backend_info(&self, _: Request<()>) -> Result, Status> { Ok(Response::new(GrpcFicusBackendInfo { name: "RUST_FICUS_BACKEND".to_string(), - pipeline_parts: self.pipeline_parts + pipeline_parts: self + .pipeline_parts .pipeline_parts_descriptors() .into_iter() - .map(|d| GrpcPipelinePartDescriptor { - name: d.name() - }) + .map(|d| GrpcPipelinePartDescriptor { name: d.name() }) .collect(), })) } diff --git a/Ficus/src/rust/ficus/src/grpc/context_values_service.rs b/Ficus/src/rust/ficus/src/grpc/context_values_service.rs index b1f1ab40a..930f408d7 100644 --- a/Ficus/src/rust/ficus/src/grpc/context_values_service.rs +++ b/Ficus/src/rust/ficus/src/grpc/context_values_service.rs @@ -1,14 +1,16 @@ use crate::ficus_proto::grpc_context_values_service_server::GrpcContextValuesService; -use crate::ficus_proto::{GrpcContextKey, GrpcContextKeyValue, GrpcContextValue, GrpcContextValuePart, GrpcDropContextValuesRequest, GrpcGuid}; +use crate::ficus_proto::{ + GrpcContextKey, GrpcContextKeyValue, GrpcContextValue, GrpcContextValuePart, GrpcDropContextValuesRequest, GrpcGuid, +}; use crate::grpc::converters::context_value_from_bytes; +use prost::Message; use std::collections::HashMap; use std::pin::Pin; use std::sync::{Arc, Mutex}; -use prost::Message; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; -use tonic::{Code, Request, Response, Status, Streaming}; use tonic::codegen::futures_core::Stream; +use tonic::{Code, Request, Response, Status, Streaming}; use uuid::Uuid; pub struct ContextValueService { @@ -61,12 +63,10 @@ impl ContextValueService { match context_values.get(key) { None => None, - Some(value) => Some( - ( - value.key.as_ref().unwrap().name.clone(), - value.value.as_ref().unwrap().encode_to_vec() - ) - ) + Some(value) => Some(( + value.key.as_ref().unwrap().name.clone(), + value.value.as_ref().unwrap().encode_to_vec(), + )), } } } @@ -112,7 +112,7 @@ impl GrpcContextValuesService for GrpcContextValueService { })) } - type GetContextValueStream = Pin> + Send + 'static>>; + type GetContextValueStream = Pin> + Send + 'static>>; async fn get_context_value(&self, request: Request) -> Result, Status> { let (sender, receiver) = mpsc::channel(4); diff --git a/Ficus/src/rust/ficus/src/grpc/converters.rs b/Ficus/src/rust/ficus/src/grpc/converters.rs index 88bf70b5d..22f7da2b9 100644 --- a/Ficus/src/rust/ficus/src/grpc/converters.rs +++ b/Ficus/src/rust/ficus/src/grpc/converters.rs @@ -3,11 +3,13 @@ use crate::event_log::core::event_log::EventLog; use crate::event_log::core::trace::trace::Trace; use crate::event_log::xes::xes_event::XesEventImpl; use crate::event_log::xes::xes_event_log::XesEventLogImpl; +use crate::event_log::xes::xes_trace::XesTraceImpl; use crate::features::analysis::log_info::event_log_info::{EventLogInfo, OfflineEventLogInfo}; use crate::features::analysis::patterns::activity_instances::{ActivityInTraceFilterKind, ActivityNarrowingKind}; use crate::features::analysis::patterns::pattern_info::{UnderlyingPatternGraphInfo, UnderlyingPatternKind}; use crate::features::clustering::activities::activities_params::ActivityRepresentationSource; use crate::features::clustering::traces::traces_params::TracesRepresentationSource; +use crate::features::discovery::ocel::graph_annotation::{NodeObjectsState, OcelAnnotation, OcelObjectRelations, ProcessNodesStates}; use crate::features::discovery::petri_net::annotations::TimeAnnotationKind; use crate::features::discovery::petri_net::arc::Arc; use crate::features::discovery::petri_net::marking::{Marking, SingleMarking}; @@ -23,14 +25,35 @@ use crate::features::discovery::root_sequence::models::{ ActivityStartEndTimeData, CorrespondingTraceData, EdgeTraceExecutionInfo, EventCoordinates, NodeAdditionalDataContainer, RootSequenceKind, }; use crate::features::discovery::timeline::discovery::{LogPoint, LogTimelineDiagram, TraceThread}; -use crate::features::discovery::timeline::software_data::models::{ActivityDurationData, DurationKind, GenericEnhancementBase, HistogramData, SimpleCounterData, SoftwareData}; +use crate::features::discovery::timeline::software_data::models::{ + ActivityDurationData, DurationKind, GenericEnhancementBase, HistogramData, OcelData, OcelObjectAction, SimpleCounterData, SoftwareData, +}; use crate::ficus_proto::grpc_annotation::Annotation::{CountAnnotation, FrequencyAnnotation, TimeAnnotation}; use crate::ficus_proto::grpc_context_value::ContextValue::Annotation; use crate::ficus_proto::grpc_node_additional_data::Data; -use crate::ficus_proto::{grpc_event_attribute, grpc_graph_edge_additional_data, GrpcActivityDurationData, GrpcActivityStartEndData, GrpcAllocationInfo, GrpcAnnotation, GrpcBytes, GrpcColorsEventLogMapping, GrpcCountAnnotation, GrpcDataset, GrpcDurationKind, GrpcEdgeExecutionInfo, GrpcEntityCountAnnotation, GrpcEntityFrequencyAnnotation, GrpcEntityTimeAnnotation, GrpcEvent, GrpcEventAttribute, GrpcEventCoordinates, GrpcFrequenciesAnnotation, GrpcGeneralHistogramData, GrpcGenericEnhancementBase, GrpcGraph, GrpcGraphEdge, GrpcGraphEdgeAdditionalData, GrpcGraphKind, GrpcGraphNode, GrpcGuid, GrpcHistogramEntry, GrpcLabeledDataset, GrpcLogPoint, GrpcLogTimelineDiagram, GrpcMatrix, GrpcMatrixRow, GrpcMethodInliningInfo, GrpcMethodNameParts, GrpcMultithreadedFragment, GrpcNodeAdditionalData, GrpcNodeCorrespondingTraceData, GrpcPetriNet, GrpcPetriNetArc, GrpcPetriNetMarking, GrpcPetriNetPlace, GrpcPetriNetSinglePlaceMarking, GrpcPetriNetTransition, GrpcSimpleCounterData, GrpcSimpleEventLog, GrpcSimpleTrace, GrpcSoftwareData, GrpcThread, GrpcThreadEvent, GrpcTimePerformanceAnnotation, GrpcTimeSpan, GrpcTimelineDiagramFragment, GrpcTimelineTraceEventsGroup, GrpcTraceTimelineDiagram, GrpcUnderlyingPatternInfo, GrpcUnderlyingPatternKind}; +use crate::ficus_proto::{ + grpc_event_attribute, grpc_graph_edge_additional_data, grpc_ocel_data, GrpcActivityDurationData, GrpcActivityStartEndData, + GrpcAllocationInfo, GrpcAnnotation, GrpcBytes, GrpcColorsEventLogMapping, GrpcCountAnnotation, GrpcDataset, GrpcDurationKind, + GrpcEdgeExecutionInfo, GrpcEntityCountAnnotation, GrpcEntityFrequencyAnnotation, GrpcEntityTimeAnnotation, GrpcEvent, GrpcEventAttribute, + GrpcEventCoordinates, GrpcFrequenciesAnnotation, GrpcGeneralHistogramData, GrpcGenericEnhancementBase, GrpcGraph, GrpcGraphEdge, + GrpcGraphEdgeAdditionalData, GrpcGraphKind, GrpcGraphNode, GrpcGuid, GrpcHistogramEntry, GrpcLabeledDataset, GrpcLogPoint, + GrpcLogTimelineDiagram, GrpcMatrix, GrpcMatrixRow, GrpcMethodInliningInfo, GrpcMethodNameParts, GrpcModelElementOcelAnnotation, + GrpcMultithreadedFragment, GrpcNodeAdditionalData, GrpcNodeCorrespondingTraceData, GrpcOcelAllocateMerge, GrpcOcelConsumeProduce, + GrpcOcelData, GrpcOcelModelAnnotation, GrpcOcelObjectTypeData, GrpcOcelObjectTypeState, GrpcOcelProducedObject, GrpcOcelState, + GrpcOcelStateObjectRelation, GrpcPetriNet, GrpcPetriNetArc, GrpcPetriNetMarking, GrpcPetriNetPlace, GrpcPetriNetSinglePlaceMarking, + GrpcPetriNetTransition, GrpcSimpleCounterData, GrpcSimpleEventLog, GrpcSimpleTrace, GrpcSoftwareData, GrpcThread, GrpcThreadEvent, + GrpcTimePerformanceAnnotation, GrpcTimeSpan, GrpcTimelineDiagramFragment, GrpcTimelineTraceEventsGroup, GrpcTraceTimelineDiagram, + GrpcUnderlyingPatternInfo, GrpcUnderlyingPatternKind, +}; use crate::grpc::pipeline_executor::ServicePipelineExecutionContext; use crate::pipelines::activities_parts::{ActivitiesLogsSourceDto, UndefActivityHandlingStrategyDto}; -use crate::pipelines::keys::context_keys::{BYTES_KEY, COLORS_EVENT_LOG_KEY, EVENT_LOG_INFO_KEY, EVENT_LOG_KEY, GRAPH_KEY, GRAPH_TIME_ANNOTATION_KEY, HASHES_EVENT_LOG_KEY, LABELED_LOG_TRACES_DATASET_KEY, LABELED_TRACES_ACTIVITIES_DATASET_KEY, LOG_THREADS_DIAGRAM_KEY, LOG_TRACES_DATASET_KEY, NAMES_EVENT_LOG_KEY, PATH_KEY, PATTERNS_KEY, PETRI_NET_COUNT_ANNOTATION_KEY, PETRI_NET_FREQUENCY_ANNOTATION_KEY, PETRI_NET_KEY, PETRI_NET_TRACE_FREQUENCY_ANNOTATION_KEY, REPEAT_SETS_KEY, SOFTWARE_DATA_EXTRACTION_CONFIG_KEY, TRACES_ACTIVITIES_DATASET_KEY}; +use crate::pipelines::keys::context_keys::{ + BYTES_KEY, COLORS_EVENT_LOG_KEY, EVENT_LOG_INFO_KEY, EVENT_LOG_KEY, GRAPH_KEY, GRAPH_TIME_ANNOTATION_KEY, HASHES_EVENT_LOG_KEY, + LABELED_LOG_TRACES_DATASET_KEY, LABELED_TRACES_ACTIVITIES_DATASET_KEY, LOG_THREADS_DIAGRAM_KEY, LOG_TRACES_DATASET_KEY, + NAMES_EVENT_LOG_KEY, OCEL_ANNOTATION_KEY, PATH_KEY, PATTERNS_KEY, PETRI_NET_COUNT_ANNOTATION_KEY, PETRI_NET_FREQUENCY_ANNOTATION_KEY, + PETRI_NET_KEY, PETRI_NET_TRACE_FREQUENCY_ANNOTATION_KEY, REPEAT_SETS_KEY, SOFTWARE_DATA_EXTRACTION_CONFIG_KEY, + TRACES_ACTIVITIES_DATASET_KEY, +}; use crate::pipelines::multithreading::FeatureCountKindDto; use crate::pipelines::patterns_parts::PatternsKindDto; use crate::utils::colors::ColorsEventLog; @@ -41,6 +64,7 @@ use crate::utils::graph::graph::{DefaultGraph, Graph, GraphKind}; use crate::utils::graph::graph_edge::GraphEdge; use crate::utils::graph::graph_node::GraphNode; use crate::utils::log_serialization_format::LogSerializationFormat; +use crate::utils::references::HeapedOrOwned; use crate::utils::user_data::user_data::UserDataImpl; use crate::{ features::analysis::patterns::{ @@ -60,6 +84,7 @@ use crate::{ }, vecs, }; +use chrono::{DateTime, Utc}; use log::error; use nameof::name_of_type; use prost::{DecodeError, Message}; @@ -69,9 +94,7 @@ use std::collections::HashMap; use std::fmt::Display; use std::rc::Rc; use std::{any::Any, str::FromStr}; -use chrono::{DateTime, Utc}; use uuid::Uuid; -use crate::event_log::xes::xes_trace::XesTraceImpl; pub(super) fn context_value_from_bytes(bytes: &[u8]) -> Result { GrpcContextValue::decode(bytes) @@ -155,7 +178,7 @@ pub(super) fn put_into_user_data( }, ) } - }, + } ContextValue::EventLog(log) => { let mut xes_log = XesEventLogImpl::empty(); @@ -187,6 +210,7 @@ pub(super) fn put_into_user_data( user_data.put_concrete(EVENT_LOG_KEY.key(), xes_log); } + ContextValue::OcelAnnotation(_) => todo!(), } } @@ -269,11 +293,68 @@ pub fn convert_to_grpc_context_value(key: &dyn ContextKey, value: &dyn Any) -> O try_convert_to_grpc_log_threads_diagram(value) } else if EVENT_LOG_KEY.eq_other(key) { try_convert_to_grpc_simple_log(value) + } else if OCEL_ANNOTATION_KEY.eq_other(key) { + try_convert_to_grpc_ocel_annotation(value) } else { None } } +fn try_convert_to_grpc_ocel_annotation(value: &dyn Any) -> Option { + if !value.is::() { + None + } else { + let value = value.downcast_ref::().unwrap(); + Some(GrpcContextValue { + context_value: Some(ContextValue::OcelAnnotation(convert_to_grpc_ocel_annotation(value))), + }) + } +} + +fn convert_to_grpc_ocel_annotation(annotation: &OcelAnnotation) -> GrpcOcelModelAnnotation { + GrpcOcelModelAnnotation { + annotations: annotation + .nodes_to_states() + .iter() + .map(|s| GrpcModelElementOcelAnnotation { + element_id: s.0.clone(), + final_state: Some(convert_to_grpc_ocel_node_state(s.1.final_objects())), + initial_state: match s.1.initial_objects() { + None => None, + Some(objects) => Some(convert_to_grpc_ocel_node_state(objects)), + }, + relations: s + .1 + .incoming_objects_relations() + .iter() + .map(|r| convert_to_grpc_ocel_object_relation(r)) + .collect(), + }) + .collect(), + } +} + +fn convert_to_grpc_ocel_object_relation(relations: &OcelObjectRelations) -> GrpcOcelStateObjectRelation { + GrpcOcelStateObjectRelation { + element_id: relations.from_element_id().to_owned(), + related_objects_ids: relations.related_objects_ids().iter().map(|id| id.to_string()).collect(), + object_id: relations.object_id().to_string(), + } +} + +fn convert_to_grpc_ocel_node_state(state: &NodeObjectsState) -> GrpcOcelState { + GrpcOcelState { + type_states: state + .map() + .iter() + .map(|t| GrpcOcelObjectTypeState { + r#type: t.0.to_string(), + object_ids: t.1.iter().map(|s| s.to_string()).collect(), + }) + .collect(), + } +} + fn try_convert_to_grpc_bytes(value: &dyn Any) -> Option { if !value.is::>() { None @@ -647,6 +728,7 @@ fn convert_to_grpc_graph_kind(kind: Option<&GraphKind>) -> GrpcGraphKind { None => GrpcGraphKind::None, Some(kind) => match kind { GraphKind::Dag => GrpcGraphKind::Dag, + GraphKind::DagLCS => GrpcGraphKind::DagLcs, }, } } @@ -778,15 +860,16 @@ fn convert_to_grpc_simple_trace(trace: &Vec>>) -> GrpcS name: e.borrow().name().to_owned(), stamp: Some(convert_to_grpc_timestamp(e.borrow().timestamp())), attributes: if let Some(payload) = e.borrow().payload_map() { - payload.iter().map(|(k, v)| { - GrpcEventAttribute { + payload + .iter() + .map(|(k, v)| GrpcEventAttribute { key: k.to_owned(), value: convert_to_grpc_attribute_value(v), - } - }).collect() + }) + .collect() } else { vec![] - } + }, }) .collect(), } @@ -864,22 +947,54 @@ fn convert_to_grpc_software_data(software_data: &SoftwareData) -> GrpcSoftwareDa .iter() .map(|h| convert_to_grpc_histogram_data(h)) .collect(), + simple_counter_data: software_data .simple_counters() .iter() .map(|c| convert_to_grpc_simple_counter_data(c)) .collect(), + activities_durations_data: software_data .activities_durations() .iter() .map(|c| convert_to_grpc_activity_duration(c)) .collect(), + + ocel_data: software_data.ocel_data().iter().map(|c| convert_to_grpc_ocel_data(c)).collect(), + timeline_diagram_fragment: Some(GrpcTimelineDiagramFragment { threads: convert_to_grpc_threads(software_data.thread_diagram_fragment()), }), } } +fn convert_to_grpc_ocel_data(data: &OcelData) -> GrpcOcelData { + GrpcOcelData { + object_id: data.object_id().to_string(), + action: Some(match data.action() { + OcelObjectAction::Allocate(data) => grpc_ocel_data::Action::Allocate(GrpcOcelObjectTypeData { + r#type: data.r#type().as_ref().map(|t| t.to_string()), + }), + OcelObjectAction::Consume(data) => grpc_ocel_data::Action::Consume(GrpcOcelObjectTypeData { + r#type: data.r#type().as_ref().map(|t| t.to_string()), + }), + OcelObjectAction::AllocateMerged(data) => grpc_ocel_data::Action::MergedObjectAllocation(GrpcOcelAllocateMerge { + r#type: data.r#type().as_ref().map(|t| t.to_string()), + merged_objects_ids: data.data().iter().map(|id| id.to_string()).collect(), + }), + OcelObjectAction::ConsumeWithProduce(data) => grpc_ocel_data::Action::ProduceObjectConsumption(GrpcOcelConsumeProduce { + produced_objects: data + .iter() + .map(|x| GrpcOcelProducedObject { + id: x.id().to_string(), + r#type: x.r#type().as_ref().map(|t| t.to_string()), + }) + .collect(), + }), + }), + } +} + fn convert_to_grpc_activity_duration(data: &ActivityDurationData) -> GrpcActivityDurationData { GrpcActivityDurationData { base: Some(convert_to_grpc_generic_enhancement_base(data.base())), @@ -892,8 +1007,8 @@ fn convert_to_grpc_activity_duration(data: &ActivityDurationData) -> GrpcActivit DurationKind::Seconds => GrpcDurationKind::Seconds, DurationKind::Minutes => GrpcDurationKind::Minutes, DurationKind::Hours => GrpcDurationKind::Hours, - DurationKind::Days => GrpcDurationKind::Days - }) as i32 + DurationKind::Days => GrpcDurationKind::Days, + }) as i32, } } @@ -901,7 +1016,7 @@ fn convert_to_grpc_generic_enhancement_base(base: &GenericEnhancementBase) -> Gr GrpcGenericEnhancementBase { name: base.name().to_string(), units: base.units().to_string(), - group: base.group().clone(), + group: base.group().as_ref().map(|g| g.to_string()), } } @@ -926,11 +1041,11 @@ fn convert_to_grpc_simple_counter_data(data: &SimpleCounterData) -> GrpcSimpleCo } } -fn convert_to_grpc_histogram_entries(histogram: &HashMap) -> Vec { +fn convert_to_grpc_histogram_entries(histogram: &HashMap, usize>) -> Vec { histogram .iter() .map(|(key, value)| GrpcHistogramEntry { - name: key.to_owned(), + name: key.to_string(), count: *value as f64, }) .collect() diff --git a/Ficus/src/rust/ficus/src/grpc/kafka/grpc_kafka_service.rs b/Ficus/src/rust/ficus/src/grpc/kafka/grpc_kafka_service.rs index 3f94b2aae..79bc39cba 100644 --- a/Ficus/src/rust/ficus/src/grpc/kafka/grpc_kafka_service.rs +++ b/Ficus/src/rust/ficus/src/grpc/kafka/grpc_kafka_service.rs @@ -178,7 +178,10 @@ impl GrpcKafkaService for GrpcKafkaServiceImpl { let handler = handler as Box; let dto = PipelineExecutionDto::new(self.pipeline_parts.clone(), Arc::new(handler)); - let context_values = match self.cv_service.reclaim_context_values(&request.get_ref().pipeline_request.as_ref().unwrap().context_values_ids) { + let context_values = match self + .cv_service + .reclaim_context_values(&request.get_ref().pipeline_request.as_ref().unwrap().context_values_ids) + { Ok(context_values) => context_values, Err(not_found_id) => { let message = format!("Failed to find context value for id {}", not_found_id); diff --git a/Ficus/src/rust/ficus/src/pipelines/annotations_parts.rs b/Ficus/src/rust/ficus/src/pipelines/annotations_parts.rs index eb7160d1d..9ec7220bc 100644 --- a/Ficus/src/rust/ficus/src/pipelines/annotations_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/annotations_parts.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use crate::event_log::xes::xes_event_log::XesEventLogImpl; +use crate::features::discovery::ocel::graph_annotation::{create_ocel_annotation_for_dag, OcelAnnotation, OcelAnnotationCreationError}; use crate::features::discovery::petri_net::annotations::{ annotate_with_counts, annotate_with_frequencies, annotate_with_time_performance, annotate_with_trace_frequency, }; @@ -8,8 +9,9 @@ use crate::features::discovery::petri_net::petri_net::DefaultPetriNet; use crate::pipelines::context::PipelineContext; use crate::pipelines::errors::pipeline_errors::{PipelinePartExecutionError, RawPartExecutionError}; use crate::pipelines::keys::context_keys::{ - EVENT_LOG_KEY, GRAPH_KEY, GRAPH_TIME_ANNOTATION_KEY, PETRI_NET_COUNT_ANNOTATION_KEY, PETRI_NET_FREQUENCY_ANNOTATION_KEY, PETRI_NET_KEY, - PETRI_NET_TRACE_FREQUENCY_ANNOTATION_KEY, TERMINATE_ON_UNREPLAYABLE_TRACES_KEY, TIME_ANNOTATION_KIND_KEY, + EVENT_LOG_KEY, GRAPH_KEY, GRAPH_TIME_ANNOTATION_KEY, OCEL_ANNOTATION_KEY, PETRI_NET_COUNT_ANNOTATION_KEY, + PETRI_NET_FREQUENCY_ANNOTATION_KEY, PETRI_NET_KEY, PETRI_NET_TRACE_FREQUENCY_ANNOTATION_KEY, TERMINATE_ON_UNREPLAYABLE_TRACES_KEY, + TIME_ANNOTATION_KIND_KEY, }; use crate::pipelines::pipeline_parts::PipelineParts; use crate::pipelines::pipelines::PipelinePartFactory; @@ -89,4 +91,21 @@ impl PipelineParts { } }) } + + pub(super) fn create_ocel_annotation_for_dag() -> (String, PipelinePartFactory) { + Self::create_pipeline_part(Self::CREATE_OCEL_ANNOTATION_FOR_DAG, &|context, _, config| { + let graph = Self::get_user_data(context, &GRAPH_KEY)?; + + match create_ocel_annotation_for_dag(graph) { + Ok(annotation) => { + context.put_concrete(OCEL_ANNOTATION_KEY.key(), annotation); + Ok(()) + } + Err(err) => { + let message = format!("Failed to create ocel annotation, error: {}", err.to_string()); + Err(PipelinePartExecutionError::new_raw(message)) + } + } + }) + } } diff --git a/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs b/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs index 393a6af45..896a436e1 100644 --- a/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs +++ b/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs @@ -5,6 +5,7 @@ use crate::features::analysis::log_info::event_log_info::OfflineEventLogInfo; use crate::features::analysis::patterns::activity_instances::{ActivityInTraceFilterKind, ActivityNarrowingKind}; use crate::features::clustering::activities::activities_params::ActivityRepresentationSource; use crate::features::clustering::traces::traces_params::TracesRepresentationSource; +use crate::features::discovery::ocel::graph_annotation::OcelAnnotation; use crate::features::discovery::petri_net::annotations::TimeAnnotationKind; use crate::features::discovery::petri_net::petri_net::DefaultPetriNet; use crate::features::discovery::root_sequence::models::RootSequenceKind; @@ -133,6 +134,7 @@ pub const DISCOVER_EVENTS_GROUPS_IN_EACH_TRACE: &'static str = "discover_events_ pub const SOFTWARE_DATA_EXTRACTION_CONFIG: &'static str = "software_data_extraction_config"; pub const DISCOVER_ACTIVITY_INSTANCES_STRICT: &'static str = "discover_activity_instances_strict"; pub const PUT_NOISE_EVENTS_IN_ONE_CLUSTER: &'static str = "put_noise_events_in_one_cluster"; +pub const OCEL_ANNOTATION: &'static str = "ocel_annotation"; #[rustfmt::skip] lazy_static!( @@ -237,6 +239,7 @@ lazy_static!( pub static ref SOFTWARE_DATA_EXTRACTION_CONFIG_KEY: DefaultContextKey = DefaultContextKey::new(SOFTWARE_DATA_EXTRACTION_CONFIG); pub static ref DISCOVER_ACTIVITY_INSTANCES_STRICT_KEY: DefaultContextKey = DefaultContextKey::new(DISCOVER_ACTIVITY_INSTANCES_STRICT); pub static ref PUT_NOISE_EVENTS_IN_ONE_CLUSTER_KEY: DefaultContextKey = DefaultContextKey::new(PUT_NOISE_EVENTS_IN_ONE_CLUSTER); + pub static ref OCEL_ANNOTATION_KEY: DefaultContextKey = DefaultContextKey::new(OCEL_ANNOTATION); ); pub fn find_context_key(name: &str) -> Option<&dyn ContextKey> { @@ -331,6 +334,7 @@ pub fn find_context_key(name: &str) -> Option<&dyn ContextKey> { SOFTWARE_DATA_EXTRACTION_CONFIG => Some(SOFTWARE_DATA_EXTRACTION_CONFIG_KEY.deref() as &dyn ContextKey), DISCOVER_ACTIVITY_INSTANCES_STRICT => Some(DISCOVER_ACTIVITY_INSTANCES_STRICT_KEY.deref() as &dyn ContextKey), PUT_NOISE_EVENTS_IN_ONE_CLUSTER => Some(PUT_NOISE_EVENTS_IN_ONE_CLUSTER_KEY.deref() as &dyn ContextKey), + OCEL_ANNOTATION => Some(OCEL_ANNOTATION_KEY.deref() as &dyn ContextKey), _ => None, } } diff --git a/Ficus/src/rust/ficus/src/pipelines/parts_names.rs b/Ficus/src/rust/ficus/src/pipelines/parts_names.rs index 419ec81a8..3f2704427 100644 --- a/Ficus/src/rust/ficus/src/pipelines/parts_names.rs +++ b/Ficus/src/rust/ficus/src/pipelines/parts_names.rs @@ -76,6 +76,7 @@ impl PipelineParts { pub const ANNOTATE_PETRI_NET_COUNT: &'static str = "AnnotatePetriNetWithCount"; pub const ANNOTATE_PETRI_NET_FREQUENCY: &'static str = "AnnotatePetriNetWithFrequency"; pub const ANNOTATE_PETRI_NET_TRACE_FREQUENCY: &'static str = "AnnotatePetriNetWithTraceFrequency"; + pub const CREATE_OCEL_ANNOTATION_FOR_DAG: &'static str = "CreateOcelAnnotationForDag"; pub const ANNOTATE_GRAPH_WITH_TIME: &'static str = "AnnotateGraphWithTime"; diff --git a/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs b/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs index 07cbaaefe..efb979122 100644 --- a/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs @@ -5,9 +5,9 @@ use crate::utils::context_key::DefaultContextKey; use crate::utils::performance::performance_cookie::performance_cookie; use crate::utils::user_data::keys::Key; use crate::utils::user_data::user_data::{UserData, UserDataImpl}; +use derive_new::new; use fancy_regex::Regex; use std::collections::HashMap; -use derive_new::new; pub struct PipelineParts { names_to_parts: HashMap, @@ -125,6 +125,7 @@ impl PipelineParts { Self::add_graph_to_graphs(), Self::clear_graphs(), Self::terminate_if_empty_log(), + Self::create_ocel_annotation_for_dag(), ]; let mut names_to_parts = HashMap::new(); diff --git a/Ficus/src/rust/ficus/src/utils/context_key.rs b/Ficus/src/rust/ficus/src/utils/context_key.rs index a39895f3e..a149bd208 100644 --- a/Ficus/src/rust/ficus/src/utils/context_key.rs +++ b/Ficus/src/rust/ficus/src/utils/context_key.rs @@ -36,7 +36,7 @@ where pub fn existing(id: u64, name: String) -> Self { Self { - key: DefaultKey::existing(id, name) + key: DefaultKey::existing(id, name), } } diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph.rs b/Ficus/src/rust/ficus/src/utils/graph/graph.rs index faec87671..e76e12465 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph.rs @@ -48,6 +48,16 @@ impl NodesConnectionData { #[derive(Debug, Clone)] pub enum GraphKind { Dag, + DagLCS, +} + +impl GraphKind { + pub fn is_dag(&self) -> bool { + match self { + Self::Dag | Self::DagLCS => true, + _ => false, + } + } } #[derive(Debug, Getters, Setters)] diff --git a/Ficus/src/rust/ficus/src/utils/references.rs b/Ficus/src/rust/ficus/src/utils/references.rs index efbfa5237..6867c8377 100644 --- a/Ficus/src/rust/ficus/src/utils/references.rs +++ b/Ficus/src/rust/ficus/src/utils/references.rs @@ -1,3 +1,4 @@ +use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt::{Debug, Display, Formatter}; use std::hash::{Hash, Hasher}; use std::ops::Deref; @@ -24,6 +25,35 @@ pub enum HeapedOrOwned { Owned(T), } +impl Serialize for HeapedOrOwned { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + HeapedOrOwned::Heaped(heaped) => heaped.serialize(serializer), + HeapedOrOwned::Owned(owned) => owned.serialize(serializer), + } + } +} + +impl<'a, T: Deserialize<'a>> Deserialize<'a> for HeapedOrOwned { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'a>, + { + Ok(HeapedOrOwned::Heaped(Rc::new(Box::new(T::deserialize(deserializer)?)))) + } +} + +pub fn owned(t: T) -> HeapedOrOwned { + HeapedOrOwned::Owned(t) +} + +pub fn heaped(t: T) -> HeapedOrOwned { + HeapedOrOwned::Heaped(Rc::new(Box::new(t))) +} + impl Deref for HeapedOrOwned { type Target = T; diff --git a/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs b/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs index 288926d7c..3a5d18e62 100644 --- a/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs +++ b/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs @@ -15,8 +15,10 @@ pub trait ExecuteWithUserData { #[derive(new, Getters, Debug, Clone)] struct UserDataValue { - #[getset(get = "pub")] value: Rc>, - #[getset(get = "pub")] key_name: String, + #[getset(get = "pub")] + value: Rc>, + #[getset(get = "pub")] + key_name: String, } #[derive(Debug)] @@ -105,11 +107,9 @@ impl UserData for UserDataImpl { .map(|(k, v)| { let key = Box::new(DefaultKey::<()>::existing(*k, v.key_name.to_owned())); - unsafe { - (key as Box, v.value().as_ref().try_borrow_unguarded().ok().unwrap()) - } + unsafe { (key as Box, v.value().as_ref().try_borrow_unguarded().ok().unwrap()) } }) - .collect() + .collect(), ) } else { None diff --git a/Ficus/src/rust/ficus/tests/pipelines/pipeline_keys_tests.rs b/Ficus/src/rust/ficus/tests/pipelines/pipeline_keys_tests.rs index b17eb8b5b..714454c30 100644 --- a/Ficus/src/rust/ficus/tests/pipelines/pipeline_keys_tests.rs +++ b/Ficus/src/rust/ficus/tests/pipelines/pipeline_keys_tests.rs @@ -7,6 +7,7 @@ use ficus::features::analysis::log_info::event_log_info::OfflineEventLogInfo; use ficus::features::analysis::patterns::activity_instances::{ActivityInTraceFilterKind, ActivityNarrowingKind}; use ficus::features::clustering::activities::activities_params::ActivityRepresentationSource; use ficus::features::clustering::traces::traces_params::{FeatureCountKind, TracesRepresentationSource}; +use ficus::features::discovery::ocel::graph_annotation::OcelAnnotationCreationError; use ficus::features::discovery::petri_net::annotations::TimeAnnotationKind; use ficus::features::discovery::petri_net::petri_net::DefaultPetriNet; use ficus::features::discovery::root_sequence::models::RootSequenceKind; @@ -125,6 +126,7 @@ fn test_event_log_all_concrete_keys() { assert_existence::(&SOFTWARE_DATA_EXTRACTION_CONFIG, &mut used); assert_existence::(&DISCOVER_ACTIVITY_INSTANCES_STRICT, &mut used); assert_existence::(&MERGE_SEQUENCES_OF_EVENTS, &mut used); + assert_existence::(&OCEL_ANNOTATION, &mut used); assert_eq!(used.len(), get_all_keys_names().len()) } @@ -229,7 +231,8 @@ fn get_all_keys_names() -> Vec { "discover_events_groups_in_each_trace", "software_data_extraction_config", "discover_activity_instances_strict", - "merge_sequences_of_events" + "merge_sequences_of_events", + "ocel_annotation" ] } @@ -335,6 +338,7 @@ fn test_equivalence_of_keys() { assert_keys_equivalence::(&SOFTWARE_DATA_EXTRACTION_CONFIG, &mut used); assert_keys_equivalence::(&DISCOVER_ACTIVITY_INSTANCES_STRICT, &mut used); assert_keys_equivalence::(&MERGE_SEQUENCES_OF_EVENTS, &mut used); + assert_keys_equivalence::(&OCEL_ANNOTATION, &mut used); assert_eq!(used.len(), get_all_keys_names().len()) } diff --git a/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs b/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs index 51eb01a7e..753d529f3 100644 --- a/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs +++ b/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs @@ -91,7 +91,8 @@ fn get_test_parts_names() -> Vec { "MergeGraphs", "AddGraphToGraphs", "ClearGraphs", - "TerminateIfEmptyLog" + "TerminateIfEmptyLog", + "CreateOcelAnnotationForDag" ] } diff --git a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs index 600ab30f3..d3a8cd54b 100644 --- a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs +++ b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs @@ -3,16 +3,19 @@ use ficus::event_log::core::event::event::EventPayloadValue; use ficus::event_log::xes::xes_event::XesEventImpl; use ficus::features::discovery::timeline::events_groups::EventGroup; use ficus::features::discovery::timeline::software_data::extraction_config::{ - ActivityDurationExtractionConfig, ExtractionConfig, GenericExtractionConfigBase, NameCreationStrategy, PieChartExtractionConfig, + ActivityDurationExtractionConfig, ExtractionConfig, GenericExtractionConfigBase, NameCreationStrategy, OcelAllocateMergeExtractionConfig, + OcelConsumeProduceExtractionConfig, OcelObjectExtractionConfigBase, OcelUnitedExtractionConfig, PieChartExtractionConfig, SimpleCountExtractionConfig, SingleAttribute, SoftwareDataExtractionConfig, TimeAttributeConfig, TimeKind, }; use ficus::features::discovery::timeline::software_data::extractors::activities_durations::ActivityDurationExtractor; use ficus::features::discovery::timeline::software_data::extractors::core::{ EventGroupSoftwareDataExtractor, EventGroupTraceSoftwareDataExtractor, }; +use ficus::features::discovery::timeline::software_data::extractors::ocel::OcelDataExtractor; use ficus::features::discovery::timeline::software_data::extractors::pie_charts::PieChartExtractor; use ficus::features::discovery::timeline::software_data::extractors::simple_counter::SimpleCounterExtractor; -use ficus::features::discovery::timeline::software_data::models::SoftwareData; +use ficus::features::discovery::timeline::software_data::models::{OcelProducedObjectAfterConsume, SoftwareData}; +use ficus::utils::references::heaped; use std::cell::RefCell; use std::rc::Rc; @@ -89,10 +92,10 @@ fn test_general_histogram() { ExtractionConfig::new( "histogram_event".to_string(), PieChartExtractionConfig::new( - GenericExtractionConfigBase::new("g1".to_string(), "units".to_string(), None), + GenericExtractionConfigBase::new(heaped("g1".to_string()), heaped("units".to_string()), None), Some(NameCreationStrategy::SingleAttribute(SingleAttribute::new( "type".to_string(), - "xd".to_string(), + heaped("xd".to_string()), ))), Some("count".to_string()), ), @@ -100,10 +103,10 @@ fn test_general_histogram() { ExtractionConfig::new( "hst_event".to_string(), PieChartExtractionConfig::new( - GenericExtractionConfigBase::new("g2".to_string(), "units".to_string(), None), + GenericExtractionConfigBase::new(heaped("g2".to_string()), heaped("units".to_string()), None), Some(NameCreationStrategy::SingleAttribute(SingleAttribute::new( "type".to_string(), - "xd".to_string(), + heaped("xd".to_string()), ))), Some("count".to_string()), ), @@ -198,14 +201,14 @@ fn test_simple_counter() { ExtractionConfig::new( "histogram_event".to_string(), SimpleCountExtractionConfig::new( - GenericExtractionConfigBase::new("counter1".to_string(), "units".to_string(), None), + GenericExtractionConfigBase::new(heaped("counter1".to_string()), heaped("units".to_string()), None), None, ), ), ExtractionConfig::new( "hst_event".to_string(), SimpleCountExtractionConfig::new( - GenericExtractionConfigBase::new("counter2".to_string(), "units".to_string(), None), + GenericExtractionConfigBase::new(heaped("counter2".to_string()), heaped("units".to_string()), None), Some("count".to_string()), ), ), @@ -271,13 +274,13 @@ fn test_activities_duration() { fn execute_test_with_activities_durations(gold: &str, raw_event_groups: Vec>>>>) { let mut config = SoftwareDataExtractionConfig::empty(); config.set_activities_duration_configs(vec![ActivityDurationExtractionConfig::new( - GenericExtractionConfigBase::new("activity".to_string(), "units".to_string(), None), + GenericExtractionConfigBase::new(heaped("activity".to_string()), heaped("units".to_string()), None), "event_start".to_string(), "event_end".to_string(), Some(TimeAttributeConfig::new("stamp".to_string(), TimeKind::Unknown)), Some(NameCreationStrategy::SingleAttribute(SingleAttribute::new( "activity_id".to_string(), - "xd".to_string(), + heaped("xd".to_string()), ))), )]); @@ -347,6 +350,143 @@ fn test_activities_duration_2() { ); } +#[test] +pub fn test_ocel_data_extraction() { + execute_test_with_software_data( + r#"{"ocel_data":[{"object_id":"id_1","action":{"Allocate":{"type":"type1","data":null}}},{"object_id":"id_2","action":{"Consume":{"type":"type1","data":null}}},{"object_id":"id_3","action":{"Allocate":{"type":"type1","data":null}}},{"object_id":"id_2","action":{"ConsumeWithProduce":[{"id":"1","type":"T1"},{"id":"2","type":"T2"},{"id":"3","type":"T3"},{"id":"4","type":"T4"},{"id":"5","type":"T5"}]}},{"object_id":"id_2","action":{"AllocateMerged":{"type":"type1","data":["1","2","3","4","5"]}}}]}"#, + || { + let events = [ + create_event_with_attributes( + "ocel_allocate".to_string(), + vec![ + ( + "object_type".to_string(), + EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + ), + ( + "object_id".to_string(), + EventPayloadValue::String(Rc::new(Box::new("id_1".to_string()))), + ), + ], + ), + create_event_with_attributes( + "ocel_consume".to_string(), + vec![ + ( + "object_type".to_string(), + EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + ), + ( + "object_id".to_string(), + EventPayloadValue::String(Rc::new(Box::new("id_2".to_string()))), + ), + ], + ), + create_event_with_attributes( + "ocel_allocate".to_string(), + vec![ + ( + "object_type".to_string(), + EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + ), + ( + "object_id".to_string(), + EventPayloadValue::String(Rc::new(Box::new("id_3".to_string()))), + ), + ], + ), + create_event_with_attributes( + "unknown".to_string(), + vec![ + ( + "object_type".to_string(), + EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + ), + ( + "object_id".to_string(), + EventPayloadValue::String(Rc::new(Box::new("id_2123123".to_string()))), + ), + ], + ), + create_event_with_attributes( + "ocel_consume_produce".to_string(), + vec![ + ( + "object_type".to_string(), + EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + ), + ( + "object_id".to_string(), + EventPayloadValue::String(Rc::new(Box::new("id_2".to_string()))), + ), + ( + "ocel_related_objects_ids".to_string(), + EventPayloadValue::String(Rc::new(Box::new("1 2 3 4 5".to_string()))), + ), + ( + "ocel_related_objects_types".to_string(), + EventPayloadValue::String(Rc::new(Box::new("T1 T2 T3 T4 T5".to_string()))), + ), + ], + ), + create_event_with_attributes( + "ocel_allocate_merge".to_string(), + vec![ + ( + "object_type".to_string(), + EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + ), + ( + "object_id".to_string(), + EventPayloadValue::String(Rc::new(Box::new("id_2".to_string()))), + ), + ( + "ocel_action".to_string(), + EventPayloadValue::String(Rc::new(Box::new("AllocateMerged".to_string()))), + ), + ( + "ocel_related_objects_ids".to_string(), + EventPayloadValue::String(Rc::new(Box::new("1 2 3 4 5".to_string()))), + ), + ], + ), + ]; + + let mut config = SoftwareDataExtractionConfig::empty(); + let object_id_attr = "object_id"; + let object_type_attr = SingleAttribute::new("object_type".to_string(), heaped("???".to_string())); + let object_type_attr = NameCreationStrategy::SingleAttribute(object_type_attr); + let base_conf = OcelObjectExtractionConfigBase::new(object_type_attr.to_owned(), object_id_attr.to_string()); + let related_ids_attr = "ocel_related_objects_ids"; + let related_types_attr = "ocel_related_objects_types"; + + config.set_ocel(Some(OcelUnitedExtractionConfig::new( + Some(" ".to_string()), + Some(ExtractionConfig::new("ocel_allocate".to_string(), base_conf.to_owned())), + Some(ExtractionConfig::new("ocel_consume".to_string(), base_conf.to_owned())), + Some(ExtractionConfig::new( + "ocel_allocate_merge".to_string(), + OcelAllocateMergeExtractionConfig::new(base_conf.to_owned(), related_ids_attr.to_string()), + )), + Some(ExtractionConfig::new( + "ocel_consume_produce".to_string(), + OcelConsumeProduceExtractionConfig::new( + object_id_attr.to_string(), + related_ids_attr.to_string(), + related_types_attr.to_string(), + ), + )), + ))); + + let extractor = OcelDataExtractor::new(&config); + let mut software_data = SoftwareData::empty(); + extractor.extract_from_events(&mut software_data, &events).ok().unwrap(); + + software_data + }, + ) +} + fn create_event_with_attributes(name: String, attributes: Vec<(String, EventPayloadValue)>) -> Rc> { Rc::new(RefCell::new(XesEventImpl::new_all_fields( Rc::new(Box::new(name)), diff --git a/Ficus/test/IntegrationTests/IntegrationTests/IntegrationTests.csproj b/Ficus/test/IntegrationTests/IntegrationTests/IntegrationTests.csproj index f3b8a1a9d..1c7089c3f 100644 --- a/Ficus/test/IntegrationTests/IntegrationTests/IntegrationTests.csproj +++ b/Ficus/test/IntegrationTests/IntegrationTests/IntegrationTests.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable diff --git a/Ficus/test_data/gold/python/ocel/test_ocel_annotation_1.gold b/Ficus/test_data/gold/python/ocel/test_ocel_annotation_1.gold new file mode 100644 index 000000000..af3b3d1fd --- /dev/null +++ b/Ficus/test_data/gold/python/ocel/test_ocel_annotation_1.gold @@ -0,0 +1,234 @@ +[ + { + "states": [], + "relations": [] + }, + { + "states": [], + "relations": [] + }, + { + "states": [], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [ + "1", + "2", + "3" + ] + }, + { + "type": "Type2", + "object_ids": [ + "4", + "5", + "6" + ] + } + ], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [ + "1", + "2", + "3" + ] + }, + { + "type": "Type2", + "object_ids": [ + "4", + "5", + "6" + ] + } + ], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [ + "7", + "8" + ] + }, + { + "type": "Type2", + "object_ids": [] + } + ], + "relations": [ + { + "id": "7", + "relations": [ + "1", + "3", + "5" + ] + }, + { + "id": "8", + "relations": [ + "2", + "4", + "6" + ] + } + ] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [ + "7", + "8" + ] + }, + { + "type": "Type2", + "object_ids": [] + } + ], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [] + }, + { + "type": "Type2", + "object_ids": [ + "10" + ] + }, + { + "type": "Type3", + "object_ids": [ + "11", + "9" + ] + } + ], + "relations": [ + { + "id": "10", + "relations": [ + "7" + ] + }, + { + "id": "11", + "relations": [ + "8" + ] + }, + { + "id": "9", + "relations": [ + "7" + ] + } + ] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [] + }, + { + "type": "Type2", + "object_ids": [ + "10" + ] + }, + { + "type": "Type3", + "object_ids": [ + "11", + "9" + ] + } + ], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [] + }, + { + "type": "Type2", + "object_ids": [ + "10" + ] + }, + { + "type": "Type3", + "object_ids": [ + "11", + "9" + ] + } + ], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [] + }, + { + "type": "Type2", + "object_ids": [ + "10" + ] + }, + { + "type": "Type3", + "object_ids": [ + "11", + "9" + ] + } + ], + "relations": [] + }, + { + "states": [ + { + "type": "Type1", + "object_ids": [] + }, + { + "type": "Type2", + "object_ids": [ + "10" + ] + }, + { + "type": "Type3", + "object_ids": [ + "11", + "9" + ] + } + ], + "relations": [] + } +] \ No newline at end of file diff --git a/Ficus/test_data/source/ocel/config.json b/Ficus/test_data/source/ocel/config.json new file mode 100644 index 000000000..a35673297 --- /dev/null +++ b/Ficus/test_data/source/ocel/config.json @@ -0,0 +1,398 @@ +{ + "method_start": { + "event_class_regex": "ProcfilerMethod/Begin", + "info": { + "method_attrs": { + "name_attr": "MethodName", + "namespace_attr": "MethodNamespace", + "signature_attr": "MethodSignature" + }, + "prefix": "[Start]" + } + }, + "method_end": { + "event_class_regex": "ProcfilerMethod/End", + "info": { + "method_attrs": { + "name_attr": "MethodName", + "namespace_attr": "MethodNamespace", + "signature_attr": "MethodSignature" + }, + "prefix": "[End]" + } + }, + "pie_chart_extraction_configs": [ + { + "event_class_regex": "Request/Start", + "info": { + "base": { + "name": "Request Start", + "units": "reqs", + "group": "HTTP" + }, + "grouping_attr": { + "many_attributes": { + "attributes": [ + "host", + "port", + "scheme", + "pathAndQuery" + ], + "separator": ".", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Connect/Start", + "info": { + "base": { + "name": "Connect Start", + "units": "reqs", + "group": "Sockets" + }, + "grouping_attr": { + "single_attribute": { + "name": "address", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Connect/Stop", + "info": { + "base": { + "name": "Connect Stop", + "units": "reqs", + "group": "Sockets" + }, + "grouping_attr": { + "single_attribute": { + "name": "address", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Accept/Start", + "info": { + "base": { + "name": "Accept Stop", + "units": "reqs", + "group": "Sockets" + }, + "grouping_attr": { + "single_attribute": { + "name": "address", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "ConnectFailed", + "info": { + "base": { + "name": "Connect Failed", + "units": "fails", + "group": "Sockets" + }, + "grouping_attr": { + "single_attribute": { + "name": "error", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "AcceptFailed", + "info": { + "base": { + "name": "Accept Failed", + "units": "fails", + "group": "Sockets" + }, + "grouping_attr": { + "single_attribute": { + "name": "error", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Loader/AssemblyLoad", + "info": { + "base": { + "name": "Load", + "units": "asms", + "group": "Assemblies" + }, + "grouping_attr": { + "single_attribute": { + "name": "FullyQualifiedAssemblyName", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Loader/AssemblyUnload", + "info": { + "base": { + "name": "Unload", + "units": "asms", + "group": "Assemblies" + }, + "grouping_attr": { + "single_attribute": { + "name": "FullyQualifiedAssemblyName", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Exception/Start", + "info": { + "base": { + "name": "Errors", + "units": "exceptions" + }, + "grouping_attr": { + "single_attribute": { + "name": "ExceptionType", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "GC\/SampledObject", + "info": { + "base": { + "name": "Object Allocations", + "units": "bytes" + }, + "count_attr": "TotalSizeForTypeSample", + "grouping_attr": { + "single_attribute": { + "name": "TypeName", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Method/LoadVerbose", + "info": { + "base": { + "name": "Loads", + "units": "methods", + "group": "Methods" + } + } + }, + { + "event_class_regex": "Method/UnloadVerbose", + "info": { + "base": { + "name": "Unloads", + "units": "methods", + "group": "Methods" + } + } + }, + { + "event_class_regex": "Method/InliningFailed", + "info": { + "base": { + "name": "Failed", + "units": "methods", + "group": "Inlinings" + }, + "grouping_attr": { + "many_attributes": { + "attributes": [ + "InlineeNamespace", + "InlineeName", + "InlineeNameSignature" + ], + "separator": ".", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Method/InliningFailed", + "info": { + "base": { + "name": "Fail Reasons", + "units": "reasons", + "group": "Inlinings" + }, + "grouping_attr": { + "single_attribute": { + "name": "FailReason", + "fallback_value": "UNRESOLVED" + } + } + } + }, + { + "event_class_regex": "Method/InliningSucceeded", + "info": { + "base": { + "name": "Succeeded", + "units": "methods", + "group": "Inlinings" + }, + "grouping_attr": { + "many_attributes": { + "attributes": [ + "InlineeNamespace", + "InlineeName", + "InlineeNameSignature" + ], + "separator": ".", + "fallback_value": "UNRESOLVED" + } + } + } + } + ], + "simple_counter_configs": [ + { + "event_class_regex": "Thread/Creating", + "info": { + "base": { + "name": "Threads", + "units": "threads", + "group": "Created" + } + } + }, + { + "event_class_regex": "Buffer/Rented", + "info": { + "base": { + "name": "Rented", + "units": "bytes", + "group": "Array Pools" + }, + "count_attr": "bufferSize" + } + }, + { + "event_class_regex": "Buffer/Returned", + "info": { + "base": { + "name": "Returned", + "units": "bytes", + "group": "Array Pools" + }, + "count_attr": "bufferSize" + } + }, + { + "event_class_regex": "Buffer/Trimmed", + "info": { + "base": { + "name": "Trimmed", + "units": "bytes", + "group": "Array Pools" + }, + "count_attr": "bufferSize" + } + }, + { + "event_class_regex": "Buffer/Allocated", + "info": { + "base": { + "name": "Allocated", + "units": "bytes", + "group": "Array Pools" + }, + "count_attr": "bufferSize" + } + } + ], + "activities_duration_configs": [ + { + "base": { + "name": "Runtime Suspensions", + "units": "" + }, + "start_event_regex": "GC/SuspendEEStop", + "end_event_regex": "GC/RestartEEStop", + "time_attribute": { + "time_attribute": "time:timestamp", + "kind": "UtcStamp" + }, + "activity_id_attr": { + "single_attribute": { + "name": "XesActivityId", + "fallback_value": "" + } + } + } + ], + "ocel": { + "delimiter": " ", + "allocated": { + "event_class_regex": "OcelObjectAllocated", + "info": { + "object_type_attr": { + "single_attribute": { + "name": "type", + "fallback_value": "UNRESOLVED" + } + }, + "object_id_attr": "objectId" + } + }, + "consumed": { + "event_class_regex": "OcelObjectConsumed", + "info": { + "object_type_attr": { + "single_attribute": { + "name": "type", + "fallback_value": "UNRESOLVED" + } + }, + "object_id_attr": "objectId" + } + }, + "allocated_merged": { + "event_class_regex": "OcelMergeAllocate", + "info": { + "allocated_obj": { + "object_type_attr": { + "single_attribute": { + "name": "type", + "fallback_value": "UNRESOLVED" + } + }, + "object_id_attr": "objectId" + }, + "related_object_ids_attr": "relatedObjectsIds" + } + }, + "consume_produce": { + "event_class_regex": "OcelConsumeProduce", + "info": { + "object_id_attr": "objectId", + "related_object_ids_attr": "relatedObjectsIds", + "related_object_type_attr": "relatedObjectsTypes" + } + } + }, + "raw_control_flow_regexes": [ + "^Procfiler" + ] +} \ No newline at end of file diff --git a/Ficus/test_data/source/ocel/logs/ocel.xes b/Ficus/test_data/source/ocel/logs/ocel.xes new file mode 100644 index 000000000..b7ae0eee8 --- /dev/null +++ b/Ficus/test_data/source/ocel/logs/ocel.xes @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Procfiler/docker/tests.dockerfile b/Procfiler/docker/tests.dockerfile index 51466e0c6..60242c95e 100644 --- a/Procfiler/docker/tests.dockerfile +++ b/Procfiler/docker/tests.dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env RUN apt update -y && apt upgrade -y RUN apt-get update -y @@ -14,8 +14,8 @@ COPY ./Ficus ./Ficus COPY ProcfilerBxes.sln ./ProcfilerBxes.sln COPY Directory.Packages.props ./Directory.Packages.props -RUN dotnet build ./Procfiler/src/dotnet/ProcfilerBuildTasks/ProcfilerBuildTasks.csproj -c Release -RUN dotnet build . -c Release +RUN dotnet build ./Procfiler/src/dotnet/ProcfilerBuildTasks/ProcfilerBuildTasks.csproj -c Release -v d +RUN dotnet build . -c Release -v d FROM build-env as test ENTRYPOINT [ "dotnet", "test", "/app/Procfiler/src/dotnet/OnlineProcfilerTests/OnlineProcfilerTests.csproj", "-c", "Release", "/p:SolutionDir=/app" ] \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/inc/CMakeLists.txt index f6724ee38..4edac3b4f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/CMakeLists.txt @@ -5,7 +5,6 @@ set( CORGUIDS_IDL_SOURCES clrinternal.idl xclrdata.idl corprof.idl - corpub.idl corsym.idl sospriv.idl ) @@ -51,10 +50,6 @@ else(CLR_CMAKE_HOST_WIN32) endif(CLR_CMAKE_HOST_WIN32) -if(FEATURE_JIT_PITCHING) - add_definitions(-DFEATURE_JIT_PITCHING) -endif(FEATURE_JIT_PITCHING) - # Compile *_i.cpp to lib add_library_clr(corguids OBJECT ${CORGUIDS_SOURCES}) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypeTool.cs b/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypeTool.cs deleted file mode 100644 index b161d13f7..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypeTool.cs +++ /dev/null @@ -1,992 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// This tool exists to transform a high level description of Crst dependencies (i.e. which Crst type may be -// acquired before or after other Crst types) into a header file that defines a enum to describe each Crst -// type and tables that map type to numerical ranking and a string based name. -// -// To use the tool, run "csc.exe CrstTypeTool.cs" and run the resulting executable. -// -// The Crst type definition file is written in a very simple language. Comments begin with '//' and continue -// to the end of the line. All remaining tokens after comment removal are simply sequences of non-whitespace -// characters separated by whitespace. Keywords are case-insensitive and identifiers (which are always Crst -// type names) are case sensitive. The language grammar is given below in EBNF-like form: -// -// TopLevel ::= CrstDefinition* -// -// CrstDefinition ::= 'Crst' CrstDependency* 'End' -// -// CrstDependency ::= 'AcquiredBefore' * -// | 'AcquiredAfter' * -// | 'SameLevelAs' * -// | 'Unordered' -// -// Crst type names match the CrstType enums used in the source code minus the 'Crst' prefix. For example -// CrstAppDomainCache is written as 'AppDomainCache' in the .def file. -// -// The dependency "A 'AcquiredBefore' B" indicates that CrstA may be legally held while CrstB is acquired. -// Similarly "A 'AcquiredAfter' B" indicates that CrstA may be legally acquired while CrstB is held. "A -// 'AcquiredBefore' B" is logically equivalent to "B 'AcquiredAfter' A" and authors may enter the dependency -// is whichever seems to make the most sense to them (or add both rules if they so desire). -// -// 'Unordered' indicates that the Crst type does not participate in ranking (there should be very few Crsts -// like this and those that are know how to avoid or deal with deadlocks manually). -// -// 'SameLevelAs' indicates the given Crst type may be acquired alongside any number of instances of the Crst -// types indicated. "A 'SameLevel' B" automatically implies "B 'SameLevel' A" so it's not necessary to specify -// the dependency both ways though authors can do so if they wish. -// -// Simple validation of the .def file (over and above syntax checking) is performed by this tool prior to -// emitting the header file. This will catch logic errors such as referencing a Crst type that is not -// defined or using the 'Unordered' attribute along with any other attribute within a single definition. It -// will also catch cycles in the dependency graph (i.e. definitions that logically describe a system where the -// Crst types can't be ranked). -// - -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Text.RegularExpressions; - -// The main application class containing the program entry point. -class CrstTypeTool -{ - // A hash containing every Crst type defined by the input .def file along with its attributes. Keyed by - // Crst type name (which is case sensitive and doesn't include the 'Crst' enum prefix). - Dictionary m_crsts = new Dictionary(); - - // The program entry point. - public static int Main() - { - try - { - // Calculate the filenames of the input and output files. - string inputFile = "CrstTypes.def"; - string outputFile = "crsttypes_generated.h"; - - // A common error is to forget to check out the crsttypes_generated.h file first. Handle this case specially - // so we can give a good error message. - if (File.Exists(outputFile) && (File.GetAttributes(outputFile) & FileAttributes.ReadOnly) != 0) - { - Console.WriteLine(outputFile + " is read-only, you must check it out of TFS/SD first"); - return 2; - } - - // Create an instance of our application class to store state in (specifically the collection of - // Crst type definitions). - CrstTypeTool app = new CrstTypeTool(); - - // Create a parser for the CrstTypes.def file and run it over the input file (errors are signalled - // via exception, in common with all the following steps except validation). - new TypeFileParser().ParseFile(inputFile, app.m_crsts); - - // Validate the collection of Crst type definitions we built up during parsing for common logic - // errors and the presence of dependency cycles. False is returned from ValidateCrsts if an error - // was detected (an error message will have already been output to the console at this point). - if (!app.ValidateCrsts()) - return 3; - - // Perform a topological sort to map each Crst type to a numeric ranking. - app.LevelCrsts(); - - // Emit the new header file containing Crst type definitions and ranking information. - app.WriteHeaderFile(outputFile); - - // If we get here the transformation was successful; inform the user and we're done. - Console.WriteLine(outputFile + " successfully updated"); - return 0; - } - catch (TypeFileParser.ParseError pe) - { - // Syntax errors specific to parsing the input file. - Console.WriteLine("ParseError: " + pe.Message); - return 4; - } - catch (Exception e) - { - // Any other general errors (file I/O problems, out of memory etc.). - Console.WriteLine("Unexpected exception:"); - Console.WriteLine(e); - return 5; - } - } - - // Emit the crsttypes_generated.h output file. - void WriteHeaderFile(string fileName) - { - FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None); - StreamWriter writer = new StreamWriter(stream); - - // Create a collection based on all the Crst types we've stored in the hash. We do this so we can sort - // the Crst types we emit (lexically, based on type name). - Dictionary.ValueCollection crstCollection = m_crsts.Values; - CrstType[] crsts = new CrstType[crstCollection.Count]; - crstCollection.CopyTo(crsts, 0); - Array.Sort(crsts); - - // Emit the header. Contains copyright information, the usual goop to avoid multiple inclusion and a - // header comment to discourage direct editing and point the user at the CrstTypes.def file instead - // (where all will be explained in greater detail). - writer.WriteLine("//"); - writer.WriteLine("// Licensed to the .NET Foundation under one or more agreements."); - writer.WriteLine("// The .NET Foundation licenses this file to you under the MIT license."); - writer.WriteLine("//"); - writer.WriteLine(); - writer.WriteLine("#ifndef __CRST_TYPES_INCLUDED"); - writer.WriteLine("#define __CRST_TYPES_INCLUDED"); - writer.WriteLine(); - writer.WriteLine("// **** THIS IS AN AUTOMATICALLY GENERATED HEADER FILE -- DO NOT EDIT!!! ****"); - writer.WriteLine(); - writer.WriteLine("// This file describes the range of Crst types available and their mapping to a numeric level (used by the"); - writer.WriteLine("// runtime in debug mode to validate we're deadlock free). To modify these settings edit the"); - writer.WriteLine("// file:CrstTypes.def file and run the clr\\artifacts\\CrstTypeTool utility to generate a new version of this file."); - writer.WriteLine(); - - // Emit the CrstType enum to define a value for each crst type (along with the kNumberOfCrstTypes - // constant). - writer.WriteLine("// Each Crst type is declared as a value in the following CrstType enum."); - writer.WriteLine("enum CrstType"); - writer.WriteLine("{"); - for (int i = 0; i < crsts.Length; i++) - writer.WriteLine(" Crst" + crsts[i].Name + " = " + i.ToString() + ","); - writer.WriteLine(" kNumberOfCrstTypes = " + crsts.Length.ToString()); - writer.WriteLine("};"); - writer.WriteLine(); - - // This is the end of the regular part of the header included by most files. - writer.WriteLine("#endif // __CRST_TYPES_INCLUDED"); - writer.WriteLine(); - - // There is a second section of the header intended for inclusion only by vm\Crst.cpp. This contains - // some data tables used to map crst type to rank or name. We could instead define two separate - // headers, but on the whole it seems simpler to do it this way. - writer.WriteLine("// Define some debug data in one module only -- vm\\crst.cpp."); - writer.WriteLine("#if defined(__IN_CRST_CPP) && defined(_DEBUG)"); - writer.WriteLine(); - - // Emit the crst type to rank mapping table. - writer.WriteLine("// An array mapping CrstType to level."); - writer.WriteLine("int g_rgCrstLevelMap[] ="); - writer.WriteLine("{"); - foreach (CrstType crst in crsts) - { - string crstLine = " " + crst.Level + ","; - crstLine = crstLine + new string(' ', 16 - crstLine.Length); - writer.WriteLine(crstLine + "// Crst" + crst.Name); - } - writer.WriteLine("};"); - writer.WriteLine(); - - // Emit the crst type to name mapping table. - writer.WriteLine("// An array mapping CrstType to a stringized name."); - writer.WriteLine("LPCSTR g_rgCrstNameMap[] ="); - writer.WriteLine("{"); - foreach (CrstType crst in crsts) - writer.WriteLine(" \"Crst" + crst.Name + "\","); - writer.WriteLine("};"); - writer.WriteLine(); - - // Emit the constant Crst.cpp uses to record an unordered rank. - writer.WriteLine("// Define a special level constant for unordered locks."); - writer.WriteLine("#define CRSTUNORDERED (-1)"); - writer.WriteLine(); - - // Emit a couple of inline helpers to map type to rank or name (and validate the type while they're at - // it). - writer.WriteLine("// Define inline helpers to map Crst types to names and levels."); - writer.WriteLine("inline static int GetCrstLevel(CrstType crstType)"); - writer.WriteLine("{"); - writer.WriteLine(" LIMITED_METHOD_CONTRACT;"); - writer.WriteLine(" _ASSERTE(crstType >= 0 && crstType < kNumberOfCrstTypes);"); - writer.WriteLine(" return g_rgCrstLevelMap[crstType];"); - writer.WriteLine("}"); - writer.WriteLine("inline static LPCSTR GetCrstName(CrstType crstType)"); - writer.WriteLine("{"); - writer.WriteLine(" LIMITED_METHOD_CONTRACT;"); - writer.WriteLine(" _ASSERTE(crstType >= 0 && crstType < kNumberOfCrstTypes);"); - writer.WriteLine(" return g_rgCrstNameMap[crstType];"); - writer.WriteLine("}"); - writer.WriteLine(); - - // And that's the end of the second section of the header file. - writer.WriteLine("#endif // defined(__IN_CRST_CPP) && defined(_DEBUG)"); - - writer.Close(); - stream.Close(); - } - - // Perform checking of the Crst type definitions we've read just read. Various forms of logic error are - // scanned for including cycles in the dependency graph. Returns true if no errors are found. If false is - // returned a descriptive error message will have already been written to the console. - bool ValidateCrsts() - { - // Look at each Crst type definition in turn. - foreach (CrstType crst in m_crsts.Values) - { - // Catch Crst types that are referenced but never defined. - if (!crst.Defined) - { - Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is referenced without being defined", - crst.Name)); - return false; - } - - // Catch the use of the 'Unordered' attribute alongside the 'AcquiredBefore' attribute (which - // indicates an ordering). - if (crst.Level == CrstType.CrstUnordered && (crst.AcquiredBeforeList.Count > 0 || - crst.Group != null)) - { - Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is declared as both unordered and acquired before 'Crst{1}'", - crst.Name, crst.AcquiredBeforeList[0].Name)); - return false; - } - - // Catch the use of the 'Unordered' attribute alongside the 'SameLevelAs' attribute (which - // indicates an ordering). - if (crst.Level == CrstType.CrstUnordered && crst.Group != null) - { - Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is declared as both unordered and in the same level as another CrstType", - crst.Name)); - return false; - } - - // Catch the simple cycle where the Crst type depends on itself. - if (crst.AcquiredBeforeList.Contains(crst)) - { - Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is declared as being acquired before itself", - crst.Name)); - return false; - } - - // Look for deeper cycles using a recursive algorithm in 'FindCycle()'. - List cycleList = new List(); - if (FindCycle(crst, crst, cycleList)) - { - Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is involved in a dependency cycle with the following CrstTypes:", - crst.Name)); - foreach (CrstType cycleCrst in cycleList) - Console.WriteLine(String.Format(" Crst{0}", cycleCrst.Name)); - return false; - } - } - - // Perform normalization of each set of Crst types that are included in the same group (i.e. have a - // 'SameLevelAs' relationship). Normalization means that each Crst type in a group will have exactly - // the same set of dependency rules as all the others. - CrstTypeGroup.NormalizeAllRules(); - - // The normalization process could have introduced cycles in the dependency graph so run the cycle - // detection pass again. We do separate passes like this since normalizing can lead to less intuitive - // error messages if a cycle is found: so if the cycle exists before normalization takes place we want - // to generate an error message then. - foreach (CrstType crst in m_crsts.Values) - { - List cycleList = new List(); - if (FindCycle(crst, crst, cycleList)) - { - Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is involved in a dependency cycle with the following CrstTypes:", - crst.Name)); - foreach (CrstType cycleCrst in cycleList) - Console.WriteLine(String.Format(" Crst{0}", cycleCrst)); - Console.WriteLine("Note that the cycle was detected only after 'SameLevelAs' processing was performed so some CrstType dependencies are implied by peer CrstTypes"); - return false; - } - } - - return true; - } - - // Recursively determine if a cycle exists in the Crst type dependency graph rooted at the 'rootCrst' - // type. The 'currCrst' indicates the next dependency to be examined (it will be the same as the - // 'rootCrst' when we're first called). The 'cycleList' argument contains a list of Crst types we've - // already examined in this branch of the algorithm and serves both to avoid checking the same node twice - // and to provide a list of the involved Crst types should a cycle be detected. - // Note that this algorithm is not designed to detect general cycles in the graph, only those that involve - // the 'rootCrst' directly. This is somewhat inefficient but gives us a simple way to generate clear error - // messages. - bool FindCycle(CrstType rootCrst, CrstType currCrst, List cycleList) - { - // Add the current Crst type to the list of those we've seen. - cycleList.Add(currCrst); - - // Look through all the dependencies of the current Crst type. - foreach (CrstType childCrst in currCrst.AcquiredBeforeList) - { - // If we find a reference back to the root Crst type then we've found a cycle. Start backing out - // from the recursion (keeping the list of nodes we visited intact) by returning true. - if (childCrst == rootCrst) - return true; - - // Otherwise iterate over the dependencies of the current node and for each one that we haven't - // already seen and recursively extend the search. - if (!cycleList.Contains(childCrst)) - if (FindCycle(rootCrst, childCrst, cycleList)) - return true; - } - - // Didn't find any cycles involving the root and this node; remove this node from the potential cycle - // list and return up to our caller indicating such. - cycleList.RemoveAt(cycleList.Count - 1); - - return false; - } - - // Topologically sort all the Crsts so we can assign a total ordering to them (in the form of a numeric - // ranking). Ranks start from 0 (Crst types that may be acquired at any time) and increment from there - // (Crst types that may only be acquired if a lower type is not already held). - // **** NOTE: The leveling process is destructive in that we will lose all dependency information from the - // Crst type definitions during the course of the algorithm. - void LevelCrsts() - { - // Note that Crst type dependency rules have been normalized (by the input parser) so that all - // AcquiredBefore/AcquiredAfter relationships have been reduced to AcquiredBefore relationships (i.e. - // any rule of the form "A AcquiredAfter B" has been converted to "B AcquiredBefore A". Any - // normalization makes the algorithm easier to program, but a normaliztion to AcquiredBefore - // relationships was chosen since it makes it particularly easy to implement an algorithm that assigns - // ranks beginning with zero and moving up to an arbitrary level. Any type that doesn't have any - // AcquiredBefore dependencies can always be ranked at a lower level than any remaining unranked types - // by definition and from this we can derive a simple iterative process to rank all the crst types. - - // Calculate how many Crst types we have left to rank (some are not included in this step because - // they've been marked as 'Unordered' in the input file). - int unsorted = 0; - foreach (CrstType crst in m_crsts.Values) - if (crst.Level == CrstType.CrstUnassigned) - unsorted++; - - // The ranking level we're going to assign to Crst types on the next pass of the algorithm. - int currLevel = 0; - - // Iterate while we still have Crst types left to rank. On each pass we'll assign a rank to those - // types that no longer have any dependencies forcing them to have a higher rank and then remove - // dependency rules involving those newly ranked types from the remaining types. - while (unsorted > 0) - { - // Record a flag indicating whether we manage to assign a rank to at least one Crst type on this - // pass. If we ever fail to do this we've hit a cycle (this is just paranoia, the Crst declaration - // validation performed in ValidateCrsts() should have detected such a cycle first). - bool madeProgress = false; - - // If we spot any types that are in a group (SameLevelAs relationship) then we defer assigning a - // rank till we've dealt with any non-group types (we wish to always place type groups in their - // very own rank else the Crst rank violation detection code won't detect violations between - // members of the group and singleton types that happened to be assigned rank on the same pass). - List deferredGroups = new List(); - - // Scan through all the Crst types. - foreach (CrstType crst in m_crsts.Values) - { - // Skip those types that already have a rank assigned. - if (crst.Level != CrstType.CrstUnassigned) - continue; - - // We're looking for Crst types that no longer have any types that can be acquired while they - // are already held. This indicates that it's safe to assign the current rank to them (since - // there are no remaining dependencies that need to be ranked first (i.e. with a lower rank - // value than this type). - if (crst.AcquiredBeforeList.Count == 0) - { - if (crst.Group == null) - { - // If this type is not part of the group we can go and assign the rank right away. - crst.Level = currLevel; - madeProgress = true; - unsorted--; - } - else if (!deferredGroups.Contains(crst.Group)) - // Otherwise we'll defer ranking this group member until all the singletons are - // processed. - deferredGroups.Add(crst.Group); - } - } - - // We've gone through the entire collection of Crst types and assigned the current rank level to - // any singleton Crst types that qualify. Now deal with any group members we detected (it's - // possible that more than one group qualifies for ranking at this level but we need to be careful - // to assign distinct rank values to each group to avoid hiding lock rank violations (since group - // members are always allowed to be acquired alongside any other type with the same rank value). - // Iterate over each distinct group that we found in this pass. - foreach (CrstTypeGroup group in deferredGroups) - { - // Look at our progress flag here. If it is false then we didn't have any singleton Crst types - // ranked at this level and we haven't processed any other groups at this level either. Thus - // we can rank this group at the current level. Otherwise at least one type was already ranked - // with this level so we need to increment to a new, distinct level to avoid ranking - // ambiguity. - if (madeProgress) - currLevel++; - - // Iterate through each Crst type that is a member of this group assigning them the (same) - // current rank. - foreach (CrstType crst in group.Members) - { - // Double check that each member has the same dependencies (i.e. they should all be empty - // by now). There should be no way that this error should ever occur, it's just paranoia - // on my part. - if (crst.AcquiredBeforeList.Count != 0) - throw new Exception("Internal error: SameLevel CrstTypes with differing rulesets"); - - crst.Level = currLevel; - unsorted--; - } - - // Once we've processed at least one group we've made progress this iteration. - madeProgress = true; - } - - // If we didn't manage to assign rank to at least one Crst type then we're not going to do any - // better next iteration either (because no state was updated in this iteration). This should only - // occur in the presence of a dependency cycle and we shouldn't get that here after a successful - // call to ValidateCrsts(), so this check is pure paranoia. - if (!madeProgress) - { - Console.WriteLine(String.Format("{0} unsorted remain", unsorted)); - throw new Exception("Cycle detected trying to assign level " + currLevel.ToString()); - } - - // Loop through all the unranked Crsts types and remove any AcquiredBefore relationships that - // involve types we've already leveled (since those types, by definition, have already been - // assigned a lower rank). - foreach (CrstType crst in m_crsts.Values) - { - if (crst.Level != CrstType.CrstUnassigned) - continue; - List prunedCrsts = crst.AcquiredBeforeList.FindAll(Unleveled); - crst.AcquiredBeforeList = prunedCrsts; - } - - // Done with this rank level, move to the next. - currLevel++; - } - } - - // Predicate method used with List.FindAll() to locate Crst types that haven't had their rank assigned - // yet. - static bool Unleveled(CrstType crst) - { - return crst.Level == CrstType.CrstUnassigned; - } -} - -// Class used to parse a CrstTypes.def file into a dictionary of Crst type definitions. It uses a simple lexer -// that removes comments then forms tokens out of any consecutive non-whitespace characters. An equally simple -// recursive descent parser forms Crst instances by parsing the token stream. -class TypeFileParser -{ - // Remember the input file name and the dictionary we're meant to populate. - string m_typeFileName; - Dictionary m_crsts; - - // Compile regular expressions for detecting comments and tokens in the parser input. - Regex m_commentRegex = new Regex(@"//.*"); - Regex m_tokenRegex = new Regex(@"^(\s*(\S+)\s*)*"); - - // Input is lexed into an array of tokens. We record the index of the token being currently parsed. - Token[] m_tokens; - int m_currToken; - - // Parse the given file into Crst type definitions and place these definitions in the dictionary provided. - // Syntax errors are signalled via ParseError derived exceptions. - public void ParseFile(string typeFileName, Dictionary crsts) - { - m_typeFileName = typeFileName; - m_crsts = crsts; - - // Lex the file into tokens. - InitTokenStream(); - - // Parse the tokens according to the grammar set out at the top of this file. - // Loop until we have no further tokens to process. - while (!IsEof()) - { - // Grab the next token. - Token token = NextToken(); - - // We're at the top level, so the token had better be 'Crst'. - if (token.Id != KeywordId.Crst) - throw new UnexpectedTokenError(token, KeywordId.Crst); - - // OK, parse the rest of this single Crst type definition. - ParseCrst(); - } - } - - // Parse a single Crst type definition. - void ParseCrst() - { - // The next token had better be an identifier (the Crst type name). - Token token = NextToken(); - if (token.Id != KeywordId.Id) - throw new UnexpectedTokenError(token, KeywordId.Id); - - // The Crst instance might already exist in the dictionary (forward references to a Crst type cause - // these entries to auto-vivify). But in that case the entry better not be marked as 'Defined' which - // would indicate a double declaration. - CrstType crst; - if (m_crsts.ContainsKey(token.Text)) - { - crst = m_crsts[token.Text]; - if (crst.Defined) - throw new ParseError(String.Format("Duplicate definition for CrstType '{0}'", token.Text), token); - } - else - { - // Otherwise this Crst type hasn't been seen thus far so we allocate a new instance and add it to - // the dictionary. - crst = new CrstType(token.Text); - m_crsts.Add(crst.Name, crst); - } - - // We're defining, not just referencing this type. - crst.Defined = true; - - // Parse any attributes inside this definition (until we see an 'End' token). - bool parsingCrst = true; - while (parsingCrst) - { - // Get the next token. Either some attribute keyword or 'End'. - token = NextToken(); - List list; - - switch (token.Id) - { - - case KeywordId.AcquiredBefore: - // Simply parse the following list of Crst types into the current type's AcquiredBefore list. - ParseList(crst.AcquiredBeforeList); - break; - - case KeywordId.AcquiredAfter: - // AcquiredAfter is trickier. To make the ranking algorithm's life easier we actually - // normalize all rules to the AcquiredBefore form (see LevelCrsts() for the reasoning). So we - // capture the list of Crst types that follow the AcquiredAfter keyword and then append the - // current type to the AcquiredBefore list of each type found. - list = new List(); - ParseList(list); - foreach (CrstType priorCrst in list) - priorCrst.AcquiredBeforeList.Add(crst); - break; - - case KeywordId.SameLevelAs: - // Parse the following list of Crst types them let the CrstTypeGroup class handle the - // resulting updates to the type groups we're currently maintaining. See the comments for the - // CrstTypeGroup class for more details. - list = new List(); - ParseList(list); - foreach (CrstType sameLevelCrst in list) - CrstTypeGroup.Join(crst, sameLevelCrst); - break; - - case KeywordId.Unordered: - crst.Level = CrstType.CrstUnordered; - break; - - case KeywordId.End: - parsingCrst = false; - break; - - default: - throw new UnexpectedTokenError(token, - KeywordId.AcquiredBefore, - KeywordId.AcquiredAfter, - KeywordId.SameLevelAs, - KeywordId.Unordered); - } - } - } - - // Parse a list of Crst type names. Any other token terminates the list (without error and without - // consuming that token from the stream). The list of tokens is returned as a list of corresponding - // CrstTypes (which are auto-vivified in the output dictionary if they haven't been declared yet). - void ParseList(List list) - { - // Parse tokens until we find a non-identifier. - while (true) - { - Token token = NextToken(); - if (token.Id != KeywordId.Id) - { - // We found the list terminator. Push the non-identifier token back into the stream for our - // caller to parse correctly. - UnwindToken(); - return; - } - - // Look up or add a new CrstType corresponding to this type name. - CrstType crst; - if (m_crsts.ContainsKey(token.Text)) - crst = m_crsts[token.Text]; - else - { - crst = new CrstType(token.Text); - m_crsts[crst.Name] = crst; - } - - // Add the type to the output list we're building. - list.Add(crst); - } - } - - // Lex the input file into an array of tokens. - void InitTokenStream() - { - StreamReader file = new StreamReader(m_typeFileName); - int lineNumber = 1; - List tokenList = new List(); - - // Read the file a line at a time. - string line; - while ((line = file.ReadLine()) != null) - { - // Remove comments from the current line. - line = m_commentRegex.Replace(line, ""); - - // Match all contiguous non-whitespace characters as individual tokens. - Match match = m_tokenRegex.Match(line); - if (match.Success) - { - // For each token captured build a token instance and record the token text and the file, line - // and column at which it was encountered (these latter in order to produce useful syntax - // error messages). - CaptureCollection cap = match.Groups[2].Captures; - for (int i = 0; i < cap.Count; i++) - tokenList.Add(new Token(m_typeFileName, cap[i].Value, lineNumber, cap[i].Index)); - } - - lineNumber++; - } - - // Record the list of tokens we captured as an array and reset the index of the next token to be - // handled by the parser. - m_tokens = tokenList.ToArray(); - m_currToken = 0; - } - - // Have we run out of tokens to parse? - bool IsEof() - { - return m_currToken >= m_tokens.Length; - } - - // Get the next token and throw an exception if we ran out. - Token NextToken() - { - if (m_currToken >= m_tokens.Length) - throw new UnexpectedEofError(); - return m_tokens[m_currToken++]; - } - - // Push the last token parsed back into the stream. - void UnwindToken() - { - if (m_currToken <= 0) - throw new InvalidOperationException(); - m_currToken--; - } - - // The various keywords we can encounter (plus Id for identifiers, which are currently always Crst type - // names). - internal enum KeywordId - { - Id, - Crst, - End, - AcquiredBefore, - AcquiredAfter, - Unordered, - SameLevelAs, - } - - // Class encapsulating a single token captured from the input file. - internal class Token - { - // Hash of keyword text to enum values. - static Dictionary s_keywords; - - // The characters comprising the text of the token from the input file. - string m_text; - - // Where the token was found (for error messages). - string m_file; - int m_line; - int m_column; - - // The ID of the keyword this token represents (or KeywordId.Id). - KeywordId m_id; - - // Static class initialization. - static Token() - { - // Populate the keyword hash. No sense building complex finite state machines to improve the - // efficiency of keyword lexing here since the input file (and keyword set) is never going to be - // big enough to justify the extra work. - s_keywords = new Dictionary(); - s_keywords.Add("crst", KeywordId.Crst); - s_keywords.Add("end", KeywordId.End); - s_keywords.Add("acquiredbefore", KeywordId.AcquiredBefore); - s_keywords.Add("acquiredafter", KeywordId.AcquiredAfter); - s_keywords.Add("unordered", KeywordId.Unordered); - s_keywords.Add("samelevelas", KeywordId.SameLevelAs); - } - - public Token(string file, string text, int line, int column) - { - m_file = file; - m_text = text; - m_line = line; - m_column = column; - - // Map token text to keyword ID. True keywords (not identifiers) are case insensitive so normalize - // the text to lower case before performing the keyword hash lookup. - string canonName = m_text.ToLower(); - if (s_keywords.ContainsKey(canonName)) - m_id = s_keywords[canonName]; - else - m_id = KeywordId.Id; - } - - public string Text {get { return m_text; }} - public string Location {get { return String.Format("{0} line {1}, column {2}", m_file, m_line, m_column); }} - public KeywordId Id {get { return m_id; }} - } - - // Base class for all syntax errors reported by the parser. - internal class ParseError : Exception - { - // A raw error message. - public ParseError(string message) - : base(message) - {} - - // An error message tagged with a file, line and column (coming from an error token). - public ParseError(string message, Token errorToken) - : base(String.Format("{0}: {1}", errorToken.Location, message)) - {} - - // Produce a textual name for the given keyword type. - protected static string IdToName(KeywordId id) - { - if (id == KeywordId.Id) - return "a CrstType name"; - return String.Format("'{0}'", id.ToString()); - } - } - - // Syntax error used when an unexpected token is encountered which further lists the valid tokens that - // would otherwise have been accepted. - internal class UnexpectedTokenError : ParseError - { - // Produce an unexpected token message with a file, line and column coming from an error token and - // optionally the names of zero or more tokens that would have been accepted. - public UnexpectedTokenError(Token errorToken, params KeywordId[] expected) - : base(FormatErrorMessage(errorToken, expected)) - {} - - static string FormatErrorMessage(Token errorToken, KeywordId[] expected) - { - StringBuilder message = new StringBuilder(String.Format("Unexpected token '{0}' at {1}", - errorToken.Text, errorToken.Location)); - if (expected.Length == 0) - { - } - else if (expected.Length == 1) - { - message.Append(String.Format("; expected {0}", IdToName(expected[0]))); - } - else - { - message.Append("; expected one of "); - for (int i = 0; i < expected.Length - 1; i++) - message.Append(String.Format("{0}, ", IdToName(expected[i]))); - message.Append(IdToName(expected[expected.Length - 1])); - - } - - return message.ToString(); - } - } - - // Syntax error used when we unexpectedly ran out of tokens. - internal class UnexpectedEofError : ParseError - { - public UnexpectedEofError() - : base("Unexpected end of file") - {} - } -} - -// This class represents an instance of a Crst type. These are unqiuely identified by case-sensitive name (the -// same as the enum name used in vm code, minus the 'Crst' prefix). -class CrstType : IComparable -{ - // Special level constants used to indicate unordered Crst types or those types we haven't gotten around - // to ranking yet. - public static readonly int CrstUnordered = -1; - public static readonly int CrstUnassigned = -2; - - // Name of the type, e.g. "AppDomainCache" for the CrstAppDomainCache type. - string m_name; - - // The numeric ranking assigned to this type. Starts as CrstUnassigned and then becomes either - // CrstUnordered (while parsing the input file) or a number >= 0 (during LevelCrsts()). - int m_level; - - // List of Crst types that can be legally acquired while this one is held. (AcquiredAfter relationships - // are by switching the terms and adding to the second type's AcquiredBefore list). - List m_acquiredBeforeCrsts; - - // Either null if this Crst type is not in (or has not yet been determined to be in) a SameLevelAs - // relationship or points to a CrstTypeGroup that records all the sibling types at the same level (that - // have been discovered thus far during parsing). - CrstTypeGroup m_group; - - // Set once a definition for this type has been discovered. Used to detect double definitions and types - // referenced without definitions. - bool m_defined; - - public CrstType(string name) - { - m_name = name; - m_level = CrstUnassigned; - m_acquiredBeforeCrsts = new List(); - m_group = null; - m_defined = false; - } - - public string Name {get { return m_name; }} - public int Level {get { return m_level; } set { m_level = value; }} - public List AcquiredBeforeList {get { return m_acquiredBeforeCrsts; } set { m_acquiredBeforeCrsts = value; }} - public CrstTypeGroup Group {get { return m_group; } set { m_group = value; }} - public bool Defined {get {return m_defined; } set { m_defined = value; }} - - // Helper used to sort CrstTypes. The sort order is lexical based on the type name. - public int CompareTo(object other) - { - return m_name.CompareTo(((CrstType)other).m_name); - } -} - -// Every time a SameLevelAs relationship is used we need to be careful to keep track of the transitive closure -// of all types bound in the relationship. That's because such a relationship impacts the other dependency -// rules (each member of a SameLevelAs group must behave as though it has exactly the same dependency rules as -// all the others). Identifying all the members is tricky because "A SameLevelAs B" and "B SameLevelAs C" -// implies "A SameLevelAs C". So we use a separate tracking structure, instances of the CrstTypeGroup type, to -// do the bookkeeping for us. Each Crst type belongs to either zero or one CrstTypeGroups. As we find new -// SameLevelAs relationships we create new groups, add types to existing groups or merge groups (as previous -// distinct groups are merged by the discovery of a SameLevelAs relationship that links them). By the time -// parsing has finished we are guaranteed to have discovered all the distinct, disjoint groups and to have -// fully populated them with the transitive closure of all related types. We can them normalize all groups -// members so they share the same AcquiredBefore relationships. -class CrstTypeGroup -{ - // We record every group that has been formed so far. This makes normalizing all groups easier. - static List s_groups = new List(); - - // Crst types that are members of the current group. There are no duplicates in this list. - List m_members = new List(); - - // Declare a SameLevelAs relationship between the two Crst types given. Groups will be assigned, created - // or merged as required to maintain our guarantees (each CrstType is a member of at most one group and - // all CrstTypes involved in the same transitive closure of a SameLevelAs relationship are members of one - // group). - public static void Join(CrstType crst1, CrstType crst2) - { - CrstTypeGroup group; - - if (crst1 == crst2) - { - // In this case the type refers to itself. Create a singleton group for this type if it doesn't - // already exist. - if (crst1.Group == null) - { - group = new CrstTypeGroup(); - group.m_members.Add(crst1); - - s_groups.Add(group); - - crst1.Group = group; - } - } - else if (crst1.Group == null && crst2.Group == null) - { - // Neither types belong to a group already. So we can create a new one and add both types to it. - group = new CrstTypeGroup(); - group.m_members.Add(crst1); - group.m_members.Add(crst2); - - s_groups.Add(group); - - crst1.Group = group; - crst2.Group = group; - } - else if (crst1.Group == null) - { - // The first type doesn't belong to a group yet but the second does. So we can simply add the - // first type to the second group. - group = crst2.Group; - group.m_members.Add(crst1); - - crst1.Group = group; - } - else if (crst2.Group == null) - { - // As for the case above but the group/no-group positions are reversed. - group = crst1.Group; - group.m_members.Add(crst2); - - crst2.Group = group; - } - else if (crst1.Group != crst2.Group) - { - // Both types belong to different groups so we'll have to merge them. Add the members of group 2 - // to group 1 and throw away group 2. - group = crst1.Group; - CrstTypeGroup absorbGroup = crst2.Group; - foreach (CrstType crst in absorbGroup.m_members) - { - group.m_members.Add(crst); - crst.Group = group; - } - - s_groups.Remove(absorbGroup); - } - - // The only case left is when both types are already in the same group and there's no work needed in - // this case. - } - - // Normalize all the groups we created during parsing. See below for the definition of normalization. - public static void NormalizeAllRules() - { - foreach (CrstTypeGroup group in s_groups) - group.NormalizeRules(); - } - - // Normalize this group. This involves adjusting the AcquiredBefore list of each member to be the union of - // all such rules within the group. This step allows us to detect cycles in the dependency graph that - // would otherwise remain hidden if we only examined the unnormalized AcquiredBefore rules. - void NormalizeRules() - { - // This local will contain the union of all AcquiredBefore rules. - List acquiredBeforeList = new List(); - - // Iterate through each member of the group. - foreach (CrstType crst in m_members) - { - // Add each AcquiredBefore rule we haven't already seen to the union. - foreach (CrstType afterCrst in crst.AcquiredBeforeList) - if (!acquiredBeforeList.Contains(afterCrst)) - acquiredBeforeList.Add(afterCrst); - } - - // Reset each member's AcquiredBefore list to a copy of the union we calculated. Note it's important - // to make a (shallow) copy because the ranking process modifies this list and so a shared copy would - // cause unexpected results. - foreach (CrstType crst in m_members) - crst.AcquiredBeforeList = acquiredBeforeList.GetRange(0, acquiredBeforeList.Count); - } - - public List Members {get { return m_members; }} -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypes.def b/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypes.def index eeccd6f6c..8cd820022 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypes.def +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/CrstTypes.def @@ -78,13 +78,10 @@ Crst AppDomainCache End Crst PinnedHeapHandleTable - AcquiredBefore AvailableParamTypes HandleTable IbcProfile SyncBlockCache SystemDomainDelayedUnloadList + AcquiredBefore AvailableParamTypes HandleTable SyncBlockCache SystemDomainDelayedUnloadList SystemDomain End -Crst ArgBasedStubCache -End - Crst AssemblyLoader AcquiredBefore DeadlockDetection UniqueStack DebuggerMutex End @@ -94,11 +91,7 @@ Crst AvailableClass End Crst AvailableParamTypes - AcquiredBefore ModuleLookupTable IbcProfile LoaderHeap -End - -Crst BaseDomain - AcquiredBefore LoaderHeap UniqueStack + AcquiredBefore ModuleLookupTable LoaderHeap End Crst CCompRC @@ -110,7 +103,7 @@ Crst ClassFactInfoHash End Crst ClassInit - AcquiredBefore DeadlockDetection IbcProfile + AcquiredBefore DeadlockDetection SameLevelAs Jit End @@ -182,18 +175,15 @@ End Crst DbgTransport End -Crst DelegateToFPtrHash -End - Crst GenericDictionaryExpansion - AcquiredBefore PinnedHeapHandleTable IbcProfile LoaderHeap SystemDomainDelayedUnloadList UniqueStack + AcquiredBefore PinnedHeapHandleTable LoaderHeap SystemDomainDelayedUnloadList UniqueStack End Crst DynamicIL End Crst DynamicMT - AcquiredBefore IbcProfile CodeVersioning + AcquiredBefore CodeVersioning End Crst EventStore @@ -203,11 +193,7 @@ Crst Exception End Crst ExecutableAllocatorLock - AcquiredAfter LoaderHeap ArgBasedStubCache UMEntryThunkFreeListLock COMCallWrapper -End - -Crst ExecuteManRangeLock - AcquiredAfter NativeImageEagerFixups + AcquiredAfter LoaderHeap UMEntryThunkFreeListLock COMCallWrapper End Crst FCall @@ -222,12 +208,8 @@ Crst MethodTableExposedObject Unordered End -Crst RetThunkCache - AcquiredBefore LoaderHeap -End - Crst FuncPtrStubs - AcquiredBefore IbcProfile LoaderHeap UniqueStack CodeFragmentHeap JumpStubCache + AcquiredBefore LoaderHeap UniqueStack CodeFragmentHeap JumpStubCache End Crst FusionAppCtx @@ -239,16 +221,13 @@ Crst GCCover End Crst GlobalStrLiteralMap - AcquiredBefore PinnedHeapHandleTable HandleTable IbcProfile SyncBlockCache SystemDomainDelayedUnloadList ThreadStore UniqueStack + AcquiredBefore PinnedHeapHandleTable HandleTable SyncBlockCache SystemDomainDelayedUnloadList ThreadStore UniqueStack End Crst HandleTable SameLevelAs HandleTable End -Crst IbcProfile -End - Crst IJWFixupData AcquiredBefore FuncPtrStubs IJWHash LoaderHeap End @@ -266,8 +245,8 @@ End Crst Interop AcquiredBefore PinnedHeapHandleTable AvailableParamTypes ClassInit DeadlockDetection GenericDictionaryExpansion - HandleTable InstMethodHashTable InteropData JitGenericHandleCache LoaderHeap SigConvert - StubDispatchCache StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock + HandleTable InstMethodHashTable InteropData LoaderHeap SigConvert + StubDispatchCache SyncBlockCache TypeIDMap UnresolvedClassLock PendingTypeLoadEntry End @@ -287,22 +266,15 @@ Crst Jit SameLevelAs ClassInit End -Crst JitGenericHandleCache -End - Crst JitPatchpoint AcquiredBefore LoaderHeap End -Crst JitPerf - Unordered -End - Crst JumpStubCache - AcquiredBefore ExecuteManRangeLock LoaderHeap SingleUseLock + AcquiredBefore LoaderHeap SingleUseLock AcquiredAfter AppDomainCache ILStubGen - TypeIDMap BaseDomain AssemblyLoader + TypeIDMap AssemblyLoader End Crst ListLock @@ -342,33 +314,22 @@ Crst Module AcquiredBefore LoaderHeap UniqueStack End -Crst ModuleFixup - AcquiredBefore PinnedHeapHandleTable GlobalStrLiteralMap IbcProfile SyncBlockCache -End - Crst ModuleLookupTable AcquiredBefore LoaderHeap End -Crst Nls -End - -Crst ObjectList - SameLevelAs ObjectList -End - Crst PEImage AcquiredBefore UniqueStack End Crst PendingTypeLoadEntry AcquiredBefore AppDomainCache PinnedHeapHandleTable AssemblyLoader AvailableClass AvailableParamTypes - BaseDomain ClassInit DeadlockDetection DebuggerController DebuggerJitInfo DebuggerMutex - GenericDictionaryExpansion Exception ExecuteManRangeLock FuncPtrStubs - FusionAppCtx GlobalStrLiteralMap HandleTable IbcProfile + ClassInit DeadlockDetection DebuggerController DebuggerJitInfo DebuggerMutex + GenericDictionaryExpansion Exception FuncPtrStubs + FusionAppCtx GlobalStrLiteralMap HandleTable IJWFixupData IJWHash ISymUnmanagedReader Jit JumpStubCache LoaderHeap Module ModuleLookupTable PEImage - SigConvert SingleUseLock StubDispatchCache StubUnwindInfoHeapSegments + SigConvert SingleUseLock StubDispatchCache SyncBlockCache SystemDomain ThreadIdDispenser ThreadStore TypeIDMap UnresolvedClassLock SameLevelAs PendingTypeLoadEntry End @@ -388,7 +349,7 @@ Crst ProfilingAPIStatus End Crst RCWCache - AcquiredBefore IbcProfile LoaderHeap RCWCleanupList + AcquiredBefore LoaderHeap RCWCleanupList End Crst RCWCleanupList @@ -419,29 +380,19 @@ Crst EtwTypeLogHash AcquiredAfter SingleUseLock End -Crst SavedExceptionInfo - AcquiredBefore DebuggerController -End - -Crst SaveModuleProfileData -End - Crst SigConvert AcquiredBefore LoaderHeap End Crst SingleUseLock - AcquiredBefore ExecuteManRangeLock LoaderHeap UniqueStack DebuggerJitInfo + AcquiredBefore LoaderHeap UniqueStack DebuggerJitInfo End Crst UnwindInfoTableLock - AcquiredAfter StubUnwindInfoHeapSegments SingleUseLock + AcquiredAfter SingleUseLock AcquiredBefore StressLog End -Crst SpecialStatics -End - Crst StressLog Unordered End @@ -453,10 +404,6 @@ End Crst StubDispatchCache End -Crst StubUnwindInfoHeapSegments - AcquiredAfter StubCache -End - Crst SyncBlockCache AcquiredBefore ThreadIdDispenser End @@ -464,12 +411,8 @@ End Crst SyncHashLock End -Crst SystemBaseDomain - AcquiredBefore LoaderHeap UniqueStack -End - Crst SystemDomain - AcquiredBefore DebuggerMutex HandleTable IbcProfile SaveModuleProfileData + AcquiredBefore DebuggerMutex HandleTable ThreadIdDispenser ThreadStore End @@ -485,8 +428,8 @@ End Crst ThreadStore AcquiredBefore AvailableParamTypes DeadlockDetection DebuggerController - DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile - JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilerGCRefDataFreeList + DebuggerHeapLock DebuggerJitInfo DynamicIL HandleTable + JumpStubCache LoaderHeap ModuleLookupTable ProfilerGCRefDataFreeList SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList ThreadIdDispenser DebuggerMutex JitInlineTrackingMap End @@ -507,11 +450,11 @@ Crst UniqueStack End Crst UnresolvedClassLock - AcquiredBefore AvailableParamTypes IbcProfile JumpStubCache + AcquiredBefore AvailableParamTypes JumpStubCache End Crst WrapperTemplate - AcquiredBefore IbcProfile + AcquiredBefore ExecutableAllocatorLock End Crst UMEntryThunkCache @@ -532,11 +475,7 @@ Crst MulticoreJitManager AcquiredBefore MulticoreJitHash ThreadStore End -Crst StackSampler -End - Crst InlineTrackingMap - AcquiredBefore IbcProfile End Crst JitInlineTrackingMap @@ -552,7 +491,7 @@ Crst NotifyGdb End Crst ReadyToRunEntryPointToMethodDescMap - AcquiredBefore ExecuteManRangeLock UniqueStack + AcquiredBefore UniqueStack End Crst TieredCompilation @@ -569,6 +508,7 @@ Crst MethodDescBackpatchInfoTracker End Crst NativeImageEagerFixups + AcquiredBefore UnresolvedClassLock End Crst NativeImageLoad @@ -581,3 +521,10 @@ End Crst PerfMap AcquiredAfter CodeVersioning AssemblyList End + +Crst InterfaceDispatchGlobalLists +End + +Crst CallStubCache + AcquiredBefore LoaderHeap +End \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/OpCodeGen.pl b/Procfiler/src/cpp/3rdparty/coreclr/inc/OpCodeGen.pl deleted file mode 100644 index 952dd477e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/OpCodeGen.pl +++ /dev/null @@ -1,481 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# -# OpCodeGen.pl -# -# PERL script used to generate the numbering of the reference opcodes -# -#use strict 'vars'; -#use strict 'subs'; -#use strict 'refs'; - - -my $ret = 0; -my %opcodeEnum; -my %oneByte; -my %twoByte; -my %controlFlow; -my @singleByteArg; -my %stackbehav; -my %opcodetype; -my %operandtype; -my %opcodes; -my $popstate; -my $pushstate; - -$ctrlflowcount = 0; - -$count = 0; - -my @lowercaseAlphabet = ('a'..'z','0'..'9'); -my %upcaseAlphabet = (); - -foreach $letter (@lowercaseAlphabet) { - $j = $letter; - $j=~tr/a-z/A-Z/; - $upcaseAlphabet{$letter}=$j; -} - -$license = "// Licensed to the .NET Foundation under one or more agreements.\n"; -$license .= "// The .NET Foundation licenses this file to you under the MIT license.\n"; - -$startHeaderComment = "/*============================================================\n**\n"; -$endHeaderComment = "**\n** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!\n"; -$endHeaderComment .= "** See \$(RepoRoot)\\src\\inc\\OpCodeGen.pl for more information.**\n"; -$endHeaderComment .= "==============================================================*/\n\n"; - -$usingAndRefEmitNmsp = "namespace System.Reflection.Emit\n{\n\n"; -$obsoleteAttr = " [Obsolete(\"This API has been deprecated. https://go.microsoft.com/fwlink/?linkid=14202\")]\n"; - -# Open source file and target files - -open (OPCODE, "opcode.def") or die "Couldn't open opcode.def: $!\n"; -open (OUTPUT, ">OpCodes.cs") or die "Couldn't open OpCodes.cs: $!\n"; -open (FCOUTPUT, ">FlowControl.cs") or die "Couldn't open FlowControl.cs: $!\n"; -open (SOUTPUT, ">StackBehaviour.cs") or die "Couldn't open StackBehaviour.cs: $!\n"; -open (OCOUTPUT, ">OpCodeType.cs") or die "Couldn't open OpCodeType.cs: $!\n"; -open (OPOUTPUT, ">OperandType.cs") or die "Couldn't open OperandType.cs: $!\n"; - -print OUTPUT $license; -print OUTPUT $startHeaderComment; -print OUTPUT "** Class: OpCodes\n"; -print OUTPUT "**\n"; -print OUTPUT "** Purpose: Exposes all of the IL instructions supported by the runtime.\n"; -print OUTPUT $endHeaderComment; - -print OUTPUT $usingAndRefEmitNmsp; - -print FCOUTPUT $license; -print FCOUTPUT $startHeaderComment; -print FCOUTPUT "** Enumeration: FlowControl\n"; -print FCOUTPUT "**\n"; -print FCOUTPUT "** Purpose: Exposes FlowControl Attribute of IL.\n"; -print FCOUTPUT $endHeaderComment; - -print FCOUTPUT $usingAndRefEmitNmsp; -print FCOUTPUT " public enum FlowControl\n {\n"; - -print SOUTPUT $license; -print SOUTPUT $startHeaderComment; -print SOUTPUT "** Enumeration: StackBehaviour\n"; -print SOUTPUT "**\n"; -print SOUTPUT "** Purpose: Exposes StackBehaviour Attribute of IL.\n"; -print SOUTPUT $endHeaderComment; - -print SOUTPUT $usingAndRefEmitNmsp; -print SOUTPUT " public enum StackBehaviour\n {\n"; - -print OCOUTPUT $license; -print OCOUTPUT $startHeaderComment; -print OCOUTPUT "** Enumeration: OpCodeType\n"; -print OCOUTPUT "**\n"; -print OCOUTPUT "** Purpose: Exposes OpCodeType Attribute of IL.\n"; -print OCOUTPUT $endHeaderComment; - -print OCOUTPUT $usingAndRefEmitNmsp; -print OCOUTPUT " public enum OpCodeType\n {\n"; - -print OPOUTPUT $license; -print OPOUTPUT $startHeaderComment; -print OPOUTPUT "** Enumeration: OperandType\n"; -print OPOUTPUT "**\n"; -print OPOUTPUT "** Purpose: Exposes OperandType Attribute of IL.\n"; -print OPOUTPUT $endHeaderComment; - -print OPOUTPUT $usingAndRefEmitNmsp; -print OPOUTPUT " public enum OperandType\n {\n"; - -while () -{ - # Process only OPDEF(....) lines - if (/OPDEF\(\s*/) - { - chop; # Strip off trailing CR - s/^OPDEF\(\s*//; # Strip off "OP(" - s/,\s*/,/g; # Remove whitespace - s/\).*$//; # Strip off ")" and everything behind it at end - - # Split the line up into its basic parts - ($enumname, $stringname, $pop, $push, $operand, $type, $size, $s1, $s2, $ctrl) = split(/,/); - $s1 =~ s/0x//; - $s1 = hex($s1); - $s2 =~ s/0x//; - $s2 = hex($s2); - - if ($size == 0) - { - next; - } - - next if ($enumname =~ /UNUSED/); - - #Remove the prefix - $enumname=~s/CEE_//g; - - #Convert name to our casing convention - $enumname=~tr/A-Z/a-z/; - $enumname=~s/^(.)/\u$1/g; - $enumname=~s/_(.)/_\u$1/g; - - #Convert pop to our casing convention - $pop=~tr/A-Z/a-z/; - $pop=~s/^(.)/\u$1/g; - $pop=~s/_(.)/_\u$1/g; - - #Convert push to our casing convention - $push=~tr/A-Z/a-z/; - $push=~s/^(.)/\u$1/g; - $push=~s/_(.)/_\u$1/g; - - #Convert operand to our casing convention - #$operand=~tr/A-Z/a-z/; - #$operand=~s/^(.)/\u$1/g; - #$operand=~s/_(.)/_\u$1/g; - - #Remove the I prefix on type - $type=~s/I//g; - - #Convert Type to our casing convention - $type=~tr/A-Z/a-z/; - $type=~s/^(.)/\u$1/g; - $type=~s/_(.)/_\u$1/g; - - #Convert ctrl to our casing convention - $ctrl=~tr/A-Z/a-z/; - $ctrl=~s/^(.)/\u$1/g; - $ctrl=~s/_(.)/_\u$1/g; - - # Make a list of the flow Control type - - # Make a list of the opcodes and their values - if ($opcodes{$enumname}) - { - } - elsif ($size == 1) - { - $opcodes{$enumname} = $s2; - } - elsif ($size == 2) - { - $opcodes{$enumname} = ($s2 + 256 * $s1); - } - - #Make a list of the instructions which only take one-byte arguments - if ($enumname =~ /^.*_S$/) { - #but exclude the deprecated expressions (sometimes spelled "depricated") - if (!($enumname=~/^Depr.cated.*/)) { - my $caseStatement = sprintf(" case %-20s: \n", $enumname); - push(@singleByteArg, $caseStatement); - } - } - - #make a list of the control Flow Types - if ($controlFlow{$ctrl}) - { - #printf("DUPE Control Flow\n"); - } - else - { - $controlFlow{$ctrl} = $ctrlflowcount; - $ctrlflowcount++; - } - - $ctrlflowcount = 0; - #make a list of the StackBehaviour Types - $pop=~s/\+/_/g; - if ($stackbehav{$pop}) - { - #printf("DUPE stack behaviour pop\n"); - } - else - { - $stackbehav{$pop} = $ctrlflowcount; - $ctrlflowcount++; - } - - #make a list of the StackBehaviour Types - $push=~s/\+/_/g; - if ($stackbehav{$push}) - { - #printf("DUPE stack behaviour push\n"); - } - else - { - $stackbehav{$push} = $ctrlflowcount; - $ctrlflowcount++; - } - #make a list of operand types - if ($operandtype{$operand}) - { - #printf("DUPE operand type\n"); - } - else - { - $operandtype{$operand} = $ctrlflowcount; - $ctrlflowcount++; - } - - - #make a list of opcode types - if ($opcodetype{$type}) - { - #printf("DUPE opcode type\n"); - } - else - { - $opcodetype{$type} = $ctrlflowcount; - $ctrlflowcount++; - } - - my $opcodeName = $enumname; - - # Tailcall OpCode enum name does not comply with convention - # that all enum names are exactly the same as names in opcode.def - # file less leading CEE_ and changed casing convention - $enumname = substr $enumname, 0, 4 unless $enumname !~ m/Tailcall$/; - - # If string name ends with dot OpCode enum name ends with underscore - $enumname .= "_" unless $stringname !~ m/\."$/; - - printf(" OpCode name:%20s,\t\tEnum label:%20s,\t\tString name:%20s\n", $opcodeName, $enumname, $stringname); - if ($stringname eq "arglist") - { - print "This is arglist----------\n"; - } - - my $lineEnum; - if ($size == 1) - { - $lineEnum = sprintf(" %s = 0x%.2x,\n", $enumname, $s2); - $opcodeEnum{$s2} = $lineEnum; - } - elsif ($size == 2) - { - $lineEnum = sprintf(" %s = 0x%.4x,\n", $enumname, $s2 + 256 * $s1); - $opcodeEnum{$s2 + 256 * $s1} = $lineEnum; - } - - my $line; - $line = sprintf(" public static readonly OpCode %s = new OpCode(OpCodeValues.%s,\n", $opcodeName, $enumname); - $line .= sprintf(" ((int)OperandType.%s) |\n", $operand); - $line .= sprintf(" ((int)FlowControl.%s << OpCode.FlowControlShift) |\n", $ctrl); - $line .= sprintf(" ((int)OpCodeType.%s << OpCode.OpCodeTypeShift) |\n", $type); - $line .= sprintf(" ((int)StackBehaviour.%s << OpCode.StackBehaviourPopShift) |\n", $pop); - $line .= sprintf(" ((int)StackBehaviour.%s << OpCode.StackBehaviourPushShift) |\n", $push); - - $popstate = 0; - if($pop eq "Pop0" || $pop eq "Varpop") - { - $popstate = 0; - } - elsif ($pop eq "Pop1" || $pop eq "Popi" || $pop eq "Popref") - { - $popstate = $popstate -1; - } - elsif ($pop eq "Pop1_pop1" || $pop eq "Popi_pop1" || $pop eq "Popi_popi" || $pop eq "Popi_popi8" || $pop eq "Popi_popr4" || $pop eq "Popi_popr8" || $pop eq "Popref_pop1" || $pop eq "Popref_popi") - { - $popstate = $popstate -2; - } - elsif ($pop eq "Popi_popi_popi" || $pop eq "Popref_popi_popi" || $pop eq "Popref_popi_popi8" || $pop eq "Popref_popi_popr4" || $pop eq "Popref_popi_popr8" || $pop eq "Popref_popi_popref" || $pop eq "Popref_popi_pop1") - { - $popstate = $popstate -3; - } - - if ($push eq "Push1" || $push eq "Pushi" ||$push eq "Pushi8" ||$push eq "Pushr4" ||$push eq "Pushr8" ||$push eq "Pushref") - { - $popstate = $popstate + 1; - } - elsif($push eq "Push1_push1") - { - $popstate = $popstate + 2; - } - - $line .= sprintf(" (%s << OpCode.SizeShift) |\n", $size); - if ($ctrl =~ m/Return/ || $ctrl =~ m/^Branch/ || $ctrl =~ m/^Throw/ || $enumname =~ m/Jmp/){ - $line .= sprintf(" OpCode.EndsUncondJmpBlkFlag |\n", $size); - } - $line .= sprintf(" (%d << OpCode.StackChangeShift)\n", $popstate); - $line .= sprintf(" );\n\n"); - - if ($size == 1) - { - if ($oneByte{$s2}) - { - printf("Error opcode 0x%x already defined!\n", $s2); - print " Old = $oneByte{$s2}"; - print " New = $line"; - $ret = -1; - } - $oneByte{$s2} = $line; - } - elsif ($size == 2) - { - if ($twoByte{$s2}) - { - printf("Error opcode 0x%x%x already defined!\n", $s1, $s2); - print " Old = $oneByte{$s2}"; - print " New = $line"; - $ret = -1; - } - - $twoByte{$s2 + 256 * $s1} = $line; - } - else - { - $line .= "\n"; - push(@deprecated, $line); - printf("deprecated code!\n"); - } - $count++; - } -} - -# Generate the Flow Control enum -$ctrlflowcount = 0; -foreach $key (sort {$a cmp $b} keys (%controlFlow)) -{ - print FCOUTPUT " $key"; - print FCOUTPUT " = $ctrlflowcount,\n"; - $ctrlflowcount++; - if ($key =~ m/Next/){ - print FCOUTPUT $obsoleteAttr; - print FCOUTPUT " Phi"; - print FCOUTPUT " = $ctrlflowcount,\n"; - $ctrlflowcount++; - } -} -#end the flowcontrol enum -print FCOUTPUT " }\n}\n"; - -# Generate the StackBehaviour enum -$ctrlflowcount = 0; -foreach $key (sort {$a cmp $b} keys (%stackbehav)) -{ - if ($key !~ m/Popref_popi_pop1/){ - print SOUTPUT " $key"; - print SOUTPUT " = $ctrlflowcount,\n"; - $ctrlflowcount++; - } -} -print SOUTPUT " Popref_popi_pop1 = $ctrlflowcount,\n"; -#end the StackBehaviour enum -print SOUTPUT " }\n}\n"; - -# Generate OpCodeType enum -$ctrlflowcount = 0; -foreach $key (sort {$a cmp $b} keys (%opcodetype)) -{ - if ($ctrlflowcount == 0){ - print OCOUTPUT $obsoleteAttr; - print OCOUTPUT " Annotation = 0,\n"; - $ctrlflowcount++; - } - print OCOUTPUT " $key"; - print OCOUTPUT " = $ctrlflowcount,\n"; - $ctrlflowcount++; -} -# end the OpCodeType enum -print OCOUTPUT " }\n}\n"; - -# Generate OperandType enum -$ctrlflowcount = 0; -foreach $key (sort {$a cmp $b} keys (%operandtype)) -{ - print OPOUTPUT " $key"; - print OPOUTPUT " = $ctrlflowcount,\n"; - $ctrlflowcount++; - if ($key =~ m/InlineNone/){ - print OPOUTPUT $obsoleteAttr; - print OPOUTPUT " InlinePhi = 6,\n"; - $ctrlflowcount++; - } - if ($key =~ m/^InlineR$/){ - $ctrlflowcount++; - } -} -#end the OperandType enum -print OPOUTPUT " }\n}\n"; - -# Generate OpCodeValues internal enum -print OUTPUT " ///\n"; -print OUTPUT " /// Internal enum OpCodeValues for opcode values.\n"; -print OUTPUT " ///\n"; -print OUTPUT " ///\n"; -print OUTPUT " /// Note that the value names are used to construct publicly visible\n"; -print OUTPUT " /// ilasm-compatible opcode names, so their exact form is important!\n"; -print OUTPUT " ///\n"; -print OUTPUT " internal enum OpCodeValues\n"; -print OUTPUT " {\n"; - -foreach $opcodeValue (sort {$a <=> $b} keys(%opcodeEnum)) { - print OUTPUT $opcodeEnum{$opcodeValue}; -} - -# End generating OpCodeValues internal enum -print OUTPUT " }\n\n"; - - -# Generate public OpCodes class -print OUTPUT " /// \n"; -print OUTPUT " /// \n"; -print OUTPUT " /// The IL instruction opcodes supported by the runtime.\n"; -print OUTPUT " /// The Specification of IL Instruction describes each Opcode.\n"; -print OUTPUT " /// \n"; -print OUTPUT " /// \n"; -print OUTPUT " /// \n"; -print OUTPUT " public class OpCodes\n"; -print OUTPUT " {\n\n";; -print OUTPUT " private OpCodes()\n {\n }\n\n"; - -my $opcode; -my $lastOp = -1; -foreach $opcode (sort {$a <=> $b} keys(%oneByte)) { - printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0); - print OUTPUT $oneByte{$opcode}; - $lastOp = $opcode; -} - -$lastOp = -1; -foreach $opcode (sort {$a <=> $b} keys(%twoByte)) { - printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0); - print OUTPUT $twoByte{$opcode}; - $lastOp = $opcode; -} - -print OUTPUT "\n";; -print OUTPUT " public static bool TakesSingleByteArgument(OpCode inst)\n"; -print OUTPUT " {\n"; -print OUTPUT " switch (inst.OperandType)\n"; -print OUTPUT " {\n"; -print OUTPUT " case OperandType.ShortInlineBrTarget:\n"; -print OUTPUT " case OperandType.ShortInlineI:\n"; -print OUTPUT " case OperandType.ShortInlineVar:\n"; -print OUTPUT " return true;\n"; -print OUTPUT " }\n"; -print OUTPUT " return false;\n"; -print OUTPUT " }\n"; - -# End Generate public OpCodes class and close namespace -print OUTPUT " }\n}\n"; - -exit($ret); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/arrayholder.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/arrayholder.h index 1795ec56a..3a172a112 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/arrayholder.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/arrayholder.h @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma once + template class ArrayHolder { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/arraylist.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/arraylist.h index f2ffe29d2..9e2a360e2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/arraylist.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/arraylist.h @@ -9,6 +9,9 @@ #include #include // offsetof +// Forward Declarations +template struct cdac_data; + // // ArrayList is a simple class which is used to contain a growable // list of pointers, stored in chunks. Modification is by appending @@ -263,8 +266,21 @@ class ArrayListBase return BlockIterator((ArrayListBlock *) &m_firstBlock, m_count); } + friend struct cdac_data; +}; + +template<> +struct cdac_data +{ + static constexpr size_t Count = offsetof(ArrayListBase, m_count); + static constexpr size_t FirstBlock = offsetof(ArrayListBase, m_firstBlock); + + static constexpr size_t Next = offsetof(ArrayListBase::ArrayListBlock, m_next); + static constexpr size_t Size = offsetof(ArrayListBase::ArrayListBlock, m_blockSize); + static constexpr size_t ArrayStart = offsetof(ArrayListBase::ArrayListBlock, m_array); }; + class ArrayList : public ArrayListBase { public: diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/bitvector.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/bitvector.h deleted file mode 100644 index b957bdadc..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/bitvector.h +++ /dev/null @@ -1,463 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -/***************************************************************************/ -/* BitVector.h */ -/***************************************************************************/ -// Routines to support a growable bitvector -/***************************************************************************/ - -#ifndef BITVECTOR_H -#define BITVECTOR_H 1 - - -#ifndef LIMITED_METHOD_CONTRACT -#define LIMITED_METHOD_CONTRACT -#define UNDEF_LIMITED_METHOD_CONTRACT -#endif - -#ifndef WRAPPER_NO_CONTRACT -#define WRAPPER_NO_CONTRACT -#define UNDEF_WRAPPER_NO_CONTRACT -#endif - -#ifndef SUPPORTS_DAC -#define SUPPORTS_DAC -#define UNDEF_SUPPORTS_DAC -#endif - -#ifndef _ASSERTE -#define _ASSERTE(x) -#define UNDEF_ASSERTE -#endif - -#ifndef FEATURE_NATIVEAOT -#define USE_BITVECTOR 1 -#endif -#if USE_BITVECTOR - -/* The bitvector class is meant to be a drop in replacement for an integer - (that is you use it like an integer), however it grows as needed. - - Features: - plug compatible with normal integers; - grows as needed - Optimized for the small case when the vector fits in machine word - Uses one machine word if vector fits in machine word (minus a bit) - - Some caveates: - You should use mutator operators &=, |= ... instead of the - non-mutators whenever possible to avoid creating a temps - - Specifically did NOT supply automatic coercions to - and from short types so that the programmer is aware of - when code was being injected on their behalf. The upshot of this - is that you have to use the BitVector() toUnsigned() to convert -*/ - -/***************************************************************************/ - -class BitVector { - // Set this to be unsigned char to do testing, should be UINT_PTR for real life - - typedef UINT_PTR ChunkType; // The size of integer type that the machine can operate on directly -// typedef BYTE ChunkType; // Use for testing - - // Maximum number of bits in our bitvector -#define MAX_PTRARG_OFS 1024 - - enum { - IS_BIG = 1, // The low bit is used to discrimate m_val and m_vals - CHUNK_BITS = sizeof(ChunkType)*8, // The number of bits that we can manipuate as a chunk - SMALL_BITS = CHUNK_BITS - 1, // The number of bits we can fit in the small representation -// SMALL_BITS = 5, // TESTING ONLY: The number of bits we can fit in the small representation - VALS_COUNT = MAX_PTRARG_OFS / CHUNK_BITS, // The number of ChunkType elements in the Vals array - }; - -public: - BitVector() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - m_val = 0; - } - - BOOL isBig() const - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - return ((m_val & IS_BIG) != 0); - } - - void toBig() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - if (!isBig()) - { - doBigInit(smallBits()); - } - } - - explicit BitVector(ChunkType arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (arg > MaxVal) - { - doBigInit(arg); - } - else - { - m_val = ChunkType(arg << 1); - } - } - - BitVector(ChunkType arg, UINT shift) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if ((arg > MaxVal) || (shift >= SMALL_BITS) || (arg > (MaxVal >> shift))) - { - doBigInit(arg); - doBigLeftShiftAssign(shift); - } - else - { - m_val = ChunkType(arg << (shift+1)); - } - } - -#define CONSTRUCT_ptrArgTP(arg,shift) BitVector((arg), (shift)) - - BitVector(const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (arg.isBig()) - { - doBigInit(arg); - } - else - { - m_val = arg.m_val; - } - } - - void operator <<=(unsigned shift) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if ((m_val == 0) || (shift == 0)) // Zero is a special case, don't need to do anything - return; - - if (isBig() || (shift >= SMALL_BITS) || (m_val > (MaxVal >> (shift-1)))) - { - doBigLeftShiftAssign(shift); - } - else - { - m_val <<= shift; - } - } - - void operator >>=(unsigned shift) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (isBig()) - { - doBigRightShiftAssign(shift); - } - else - { - m_val >>= shift; - m_val &= ~IS_BIG; // clear the isBig bit if it got set - } - } - - void operator |=(const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (((m_val | arg.m_val) & IS_BIG) != 0) - { - doBigOrAssign(arg); - } - else - { - m_val |= arg.m_val; - } - } - - // Note that this is set difference, not subtration - void operator -=(const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (((m_val | arg.m_val) & IS_BIG) != 0) - { - doBigDiffAssign(arg); - } - else - { - m_val &= ~arg.m_val; - } - } - - void operator &=(const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (((m_val | arg.m_val) & IS_BIG) != 0) - { - doBigAndAssign(arg); - } - else - { - m_val &= arg.m_val; - } - } - - friend void setDiff(BitVector& target, const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - target -= arg; - } - - friend BOOL intersect(const BitVector& arg1, const BitVector& arg2) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (((arg1.m_val | arg2.m_val) & IS_BIG) != 0) - { - return arg1.doBigIntersect(arg2); - } - else - { - return ((arg1.m_val & arg2.m_val) != 0); - } - } - - BOOL operator ==(const BitVector& arg) const - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if ((m_val | arg.m_val) & IS_BIG) - { - return doBigEquals(arg); - } - else - { - return m_val == arg.m_val; - } - } - - BOOL operator !=(const BitVector& arg) const - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - return !(*this == arg); - } - - friend ChunkType toUnsigned(const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (arg.isBig()) - { - return arg.m_vals.m_chunks[0]; // Note truncation - } - else - { - return arg.smallBits(); - } - } - - // Note that we require the invariant that zero is always stored in the - // small form so that this works bitvector is zero iff (m_val == 0) - friend BOOL isZero(const BitVector& arg) - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - return arg.m_val == 0; - } - - /* currently only used in asserts */ - BitVector operator &(const BitVector& arg) const - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - BitVector ret = *this; - ret &= arg; - return ret; - } - - int NumBits() const; - -private: - - static const ChunkType MaxVal = ((ChunkType)1 << SMALL_BITS) - 1; // Maximum value that can be stored in m_val - - // This is the structure that we use when the bit vector overflows. - // It is a simple vector. - struct Vals { - unsigned m_encodedLength; // An encoding of the current length of the 'm_chunks' array - ChunkType m_chunks[VALS_COUNT]; - - BOOL isBig() const - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - return ((m_encodedLength & IS_BIG) != 0); - } - - unsigned GetLength() const - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - if (isBig()) - { - unsigned length = (m_encodedLength >> 1); - _ASSERTE(length > 0); - return length; - } - else - { - return 0; - } - } - - void SetLength(unsigned length) - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - _ASSERTE(length > 0); - _ASSERTE(length <= VALS_COUNT); - - m_encodedLength = (ChunkType) (length << 1); - m_encodedLength |= (ChunkType) IS_BIG; - } - }; - - // - // This is the instance data for the bitvector - // - // We discrimininate on this - union { - ChunkType m_val; // if m_val bit 0 is false, then bits 1-N are the bit vector - Vals m_vals; // if m_val bit 1 is true, then use Vals - }; - - - ChunkType smallBits() const - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - _ASSERTE(!isBig()); - return (m_val >> 1); - } - -#ifdef STRIKE - void doBigInit(ChunkType arg) {} -#else - void doBigInit(ChunkType arg); -#endif - void doBigInit(const BitVector& arg); - void doBigLeftShiftAssign(unsigned arg); - void doBigRightShiftAssign(unsigned arg); - void doBigDiffAssign(const BitVector&); - void doBigAndAssign(const BitVector&); - void doBigOrAssign(const BitVector& arg); - BOOL doBigEquals(const BitVector&) const; - BOOL doBigIntersect(const BitVector&) const; -}; - -typedef BitVector ptrArgTP; - -#else // !USE_BITVECTOR - -typedef uint64_t ptrArgTP; - - // Maximum number of bits in our bitvector -#define MAX_PTRARG_OFS (sizeof(ptrArgTP) * 8) - -#define CONSTRUCT_ptrArgTP(arg,shift) (((ptrArgTP) (arg)) << (shift)) - -inline BOOL isZero(const ptrArgTP& arg) -{ - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - return (arg == 0); -} - -inline ptrArgTP toUnsigned(const ptrArgTP& arg) -{ - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - return arg; -} - -inline void setDiff(ptrArgTP& target, const ptrArgTP& arg) -{ - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - target &= ~arg; -} - -inline BOOL intersect(const ptrArgTP arg1, const ptrArgTP arg2) -{ - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - return ((arg1 & arg2) != 0); -} - -#endif // !USE_BITVECTOR - -#ifdef UNDEF_LIMITED_METHOD_CONTRACT -#undef LIMITED_METHOD_CONTRACT -#undef UNDEF_LIMITED_METHOD_CONTRACT -#endif - -#ifdef UNDEF_WRAPPER_NO_CONTRACT -#undef WRAPPER_NO_CONTRACT -#undef UNDEF_WRAPPER_NO_CONTRACT -#endif - -#ifdef UNDEF_SUPPORTS_DAC -#undef SUPPORTS_DAC -#undef UNDEF_SUPPORTS_DAC -#endif - -#ifdef UNDEF_ASSERTE -#undef _ASSERTE -#undef UNDEF_ASSERTE -#endif - -#endif // BITVECTOR_H diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/bundle.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/bundle.h index 3d55a54b3..3aa76e365 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/bundle.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/bundle.h @@ -19,15 +19,15 @@ struct BundleFileLocation { INT64 Size; INT64 Offset; - INT64 UncompresedSize; + INT64 UncompressedSize; BundleFileLocation() - { + { LIMITED_METHOD_CONTRACT; Size = 0; - Offset = 0; - UncompresedSize = 0; + Offset = 0; + UncompressedSize = 0; } static BundleFileLocation Invalid() { LIMITED_METHOD_CONTRACT; return BundleFileLocation(); } @@ -43,17 +43,22 @@ class Bundle Bundle(LPCSTR bundlePath, BundleProbeFn *probe); BundleFileLocation Probe(const SString& path, bool pathIsBundleRelative = false) const; - const SString &Path() const { LIMITED_METHOD_CONTRACT; return m_path; } - const SString &BasePath() const { LIMITED_METHOD_CONTRACT; return m_basePath; } + // Paths do not change and should remain valid for the lifetime of the Bundle + const SString& Path() const { LIMITED_METHOD_CONTRACT; return m_path; } + const UTF8* BasePath() const { LIMITED_METHOD_CONTRACT; return m_basePath.GetUTF8(); } + + // Extraction path does not change and should remain valid for the lifetime of the Bundle + bool HasExtractedFiles() const { LIMITED_METHOD_CONTRACT; return !m_extractionPath.IsEmpty(); } + const WCHAR* ExtractionPath() const { LIMITED_METHOD_CONTRACT; return m_extractionPath.GetUnicode(); } static Bundle* AppBundle; // The BundleInfo for the current app, initialized by coreclr_initialize. static bool AppIsBundle() { LIMITED_METHOD_CONTRACT; return AppBundle != nullptr; } static BundleFileLocation ProbeAppBundle(const SString& path, bool pathIsBundleRelative = false); private: - SString m_path; // The path to single-file executable BundleProbeFn *m_probe; + SString m_extractionPath; // The path to the extraction location, if bundle extracted any files SString m_basePath; // The prefix to denote a path within the bundle COUNT_T m_basePathLength; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/ceefilegenwriter.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/ceefilegenwriter.h index 0364767cd..2acbcb4f0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/ceefilegenwriter.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/ceefilegenwriter.h @@ -108,6 +108,7 @@ class CeeFileGenWriter : public CCeeGen HRESULT getCorHeader(IMAGE_COR20_HEADER **ppHeader); HRESULT getFileTimeStamp(DWORD *pTimeStamp); + void setFileHeaderTimeStamp(DWORD timeStamp); HRESULT setLibraryGuid(_In_ LPWSTR libraryGuid); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/ceegen.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/ceegen.h index 67cb10d64..7264c28ec 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/ceegen.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/ceegen.h @@ -104,10 +104,6 @@ class CeeSectionImpl { CeeSection & relativeTo, CeeSectionRelocType reloc = srRelocAbsolute, CeeSectionRelocExtra * extra = NULL) = 0; - virtual HRESULT addBaseReloc( - unsigned offset, - CeeSectionRelocType reloc = srRelocHighLow, - CeeSectionRelocExtra * extra = NULL) = 0; virtual HRESULT directoryEntry(unsigned num) = 0; virtual unsigned char * name() = 0; virtual char * computePointer(unsigned offset) const = 0; @@ -150,8 +146,6 @@ class CeeSection { // have the base of section 'relativeTo added to it HRESULT addSectReloc(unsigned offset, CeeSection& relativeTo, CeeSectionRelocType = srRelocAbsolute, CeeSectionRelocExtra *extra = 0); - // Add a base reloc for the given offset in the current section - virtual HRESULT addBaseReloc(unsigned offset, CeeSectionRelocType reloc = srRelocHighLow, CeeSectionRelocExtra *extra = 0); // this section will be directory entry 'num' @@ -179,7 +173,7 @@ class CCeeGen : public ICeeGenInternal { protected: short m_textIdx; // m_sections[] index for the .text section short m_metaIdx; // m_sections[] index for metadata (.text, or .cormeta for obj files) - short m_corHdrIdx; // m_sections[] index for the COM+ header (.text0) + short m_corHdrIdx; // m_sections[] index for the CLR header (.text0) short m_stringIdx; // m_sections[] index for strings (.text, or .rdata for EnC) short m_ilIdx; // m_sections[] index for IL (.text) @@ -224,10 +218,6 @@ class CCeeGen : public ICeeGenInternal { _In_ LPWSTR lpString, // [IN] String to emit ULONG *RVA); - STDMETHODIMP GetString ( - ULONG RVA, - __inout LPWSTR *lpString); - STDMETHODIMP AllocateMethodBuffer ( ULONG cchBuffer, // [IN] Length of string to emit UCHAR **lpBuffer, // [OUT] Returned buffer @@ -275,7 +265,7 @@ class CCeeGen : public ICeeGenInternal { // Write the metadata in "emitter" to the default metadata section is "section" is 0 // If 'section != 0, it will put the data in 'buffer'. This // buffer is assumed to be in 'section' at 'offset' and of size 'buffLen' - // (should use GetSaveSize to insure that buffer is big enough + // (should use GetSaveSize to ensure that buffer is big enough virtual HRESULT emitMetaData(IMetaDataEmit *emitter, CeeSection* section=0, DWORD offset=0, BYTE* buffer=0, unsigned buffLen=0); virtual HRESULT getMethodRVA(ULONG codeOffset, ULONG *codeRVA); @@ -323,12 +313,6 @@ inline HRESULT CeeSection::addSectReloc( return(m_impl.addSectReloc(offset, relativeTo, reloc, extra)); } -inline HRESULT CeeSection::addBaseReloc(unsigned offset, CeeSectionRelocType reloc, CeeSectionRelocExtra *extra) { - WRAPPER_NO_CONTRACT; - return(m_impl.addBaseReloc(offset, reloc, extra)); -} - - inline HRESULT CeeSection::directoryEntry(unsigned num) { WRAPPER_NO_CONTRACT; TESTANDRETURN(num < IMAGE_NUMBEROF_DIRECTORY_ENTRIES, E_INVALIDARG); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/check.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/check.h index 21d717c13..deeba791e 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/check.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/check.h @@ -510,7 +510,7 @@ CHECK CheckValue(TYPENAME &val) // in a free build they are passed through to the compiler to use in optimization. //-------------------------------------------------------------------------------- -#if defined(_PREFAST_) || defined(_PREFIX_) || defined(__clang_analyzer__) +#if defined(__clang_analyzer__) #define COMPILER_ASSUME_MSG(_condition, _message) if (!(_condition)) __UNREACHABLE(); #define COMPILER_ASSUME_MSGF(_condition, args) if (!(_condition)) __UNREACHABLE(); #else @@ -532,37 +532,11 @@ CHECK CheckValue(TYPENAME &val) #endif // DACCESS_COMPILE -#endif // _PREFAST_ || _PREFIX_ +#endif #define COMPILER_ASSUME(_condition) \ COMPILER_ASSUME_MSG(_condition, "") -//-------------------------------------------------------------------------------- -// PREFIX_ASSUME_MSG and PREFAST_ASSUME_MSG are just another name -// for COMPILER_ASSUME_MSG -// In a checked build these turn into asserts; in a free build -// they are passed through to the compiler to use in optimization; -// via an __assume(_condition) optimization hint. -//-------------------------------------------------------------------------------- - -#define PREFIX_ASSUME_MSG(_condition, _message) \ - COMPILER_ASSUME_MSG(_condition, _message) - -#define PREFIX_ASSUME_MSGF(_condition, args) \ - COMPILER_ASSUME_MSGF(_condition, args) - -#define PREFIX_ASSUME(_condition) \ - COMPILER_ASSUME_MSG(_condition, "") - -#define PREFAST_ASSUME_MSG(_condition, _message) \ - COMPILER_ASSUME_MSG(_condition, _message) - -#define PREFAST_ASSUME_MSGF(_condition, args) \ - COMPILER_ASSUME_MSGF(_condition, args) - -#define PREFAST_ASSUME(_condition) \ - COMPILER_ASSUME_MSG(_condition, "") - //-------------------------------------------------------------------------------- // UNREACHABLE points are locations in the code which should not be able to be // reached under any circumstances (e.g. a default in a switch which is supposed to @@ -650,14 +624,15 @@ CHECK CheckValue(TYPENAME &val) #define CCHECK_END \ } EX_CATCH { \ - if (___result.IsInAssert()) \ + if (___result.IsInAssert()) \ { \ ___exception = TRUE; \ ___transient = GET_EXCEPTION()->IsTransient(); \ } \ else \ EX_RETHROW; \ - } EX_END_CATCH(RethrowTerminalExceptions); \ + RethrowTerminalExceptions(); \ + } EX_END_CATCH \ \ if (___exception) \ { \ @@ -723,7 +698,9 @@ CHECK CheckOverflow(UINT64 value1, UINT64 value2); #ifdef __APPLE__ CHECK CheckOverflow(SIZE_T value1, SIZE_T value2); #endif +#ifndef __wasm__ CHECK CheckOverflow(PTR_CVOID address, UINT offset); +#endif #if defined(_MSC_VER) CHECK CheckOverflow(const void *address, ULONG offset); #endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/check.inl b/Procfiler/src/cpp/3rdparty/coreclr/inc/check.inl index 34a2956d1..b0f65c5d2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/check.inl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/check.inl @@ -156,7 +156,7 @@ inline CHECK CheckAligned(UINT64 value, UINT alignment) CHECK_OK; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__wasm__) inline CHECK CheckAligned(SIZE_T value, UINT alignment) { STATIC_CONTRACT_WRAPPER; @@ -237,7 +237,7 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset) CHECK_OK; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__wasm__) inline CHECK CheckOverflow(const void *address, SIZE_T offset) { CHECK((UINT64) address + offset >= (UINT64) address); @@ -316,10 +316,11 @@ inline CHECK CheckUnderflow(const void *address, UINT64 offset) CHECK_OK; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__wasm__) inline CHECK CheckUnderflow(const void *address, SIZE_T offset) { -#if POINTER_BITS == 32 + // SIZE_T is 32bit on wasm32 +#if !defined(__wasm__) && POINTER_BITS == 32 CHECK(offset >> 32 == 0); CHECK((UINT) (SIZE_T) address - (UINT) offset <= (UINT) (SIZE_T) address); #else diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs.h deleted file mode 100644 index d7efac04c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs.h +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// This header will include all headers relating to file system functionality. - -#ifndef _clr_fs_h_ -#define _clr_fs_h_ - -#include "fs/path.h" - -#endif // _clr_fs_h_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs/path.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs/path.h index efc21a5cd..1f5454c9a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs/path.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/fs/path.h @@ -10,10 +10,6 @@ #include "clrtypes.h" -#include "strsafe.h" - -#include "clr/str.h" - namespace clr { namespace fs diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/stack.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/stack.h deleted file mode 100644 index 97719c21c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/stack.h +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// This header provides a basic stack implementation - -#ifndef _clr_Stack_h_ -#define _clr_Stack_h_ - -namespace clr -{ - //------------------------------------------------------------------------------------------------- - // A basic stack class. - // - template < typename T > - class Stack - { - private: - //--------------------------------------------------------------------------------------------- - struct Link - { - template < typename A1 > - Link(A1 && a1, Link * next = nullptr) - : _value(std::forward(a1)) - , _next(next) - {} - - T _value; - Link * _next; - }; - - public: - //--------------------------------------------------------------------------------------------- - // Empty stack constructor. - Stack() - : _top(nullptr) - , _size(0) - {} - - //--------------------------------------------------------------------------------------------- - // Move constructor. - Stack(Stack && stack) - : _top(nullptr) - , _size(0) - { *this = std::move(stack); } - - //--------------------------------------------------------------------------------------------- - ~Stack() - { - while (!empty()) - { - pop(); - } - } - - //--------------------------------------------------------------------------------------------- - // Move assignment. - Stack& operator=(Stack && stack) - { std::swap(_top, stack._top); std::swap(_size, stack._size); } - - //--------------------------------------------------------------------------------------------- - bool empty() const - { return _top == nullptr; } - - //--------------------------------------------------------------------------------------------- - size_t size() const - { return _size; } - - //--------------------------------------------------------------------------------------------- - T & top() - { return _top->_value; } - - //--------------------------------------------------------------------------------------------- - T const & top() const - { return _top->_value; } - - //--------------------------------------------------------------------------------------------- - template < typename A1 > inline - void push(A1 && value) - { - STATIC_CONTRACT_THROWS; - _top = new Link(std::forward(value), _top); - ++_size; - } - - //--------------------------------------------------------------------------------------------- - void pop() - { Link * del = _top; _top = _top->_next; --_size; delete del; } - - private: - //--------------------------------------------------------------------------------------------- - Link * _top; - size_t _size; - }; -} // namespace clr - -#endif // _clr_Stack_h_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/str.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/str.h deleted file mode 100644 index d09a965fe..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/str.h +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// This header provides general standard string services. -// - -#ifndef _clr_str_h_ -#define _clr_str_h_ - -namespace clr -{ - namespace str - { - //----------------------------------------------------------------------------------------- - // Returns true if the provided string is a null pointer or the empty string. - static inline bool - IsNullOrEmpty(LPCWSTR wzStr) - { - return wzStr == nullptr || *wzStr == W('\0'); - } - } -} - -#endif // _clr_str_h_ - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/win32.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/win32.h deleted file mode 100644 index 0198a732d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr/win32.h +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// -// clr/win32.h -// -// Provides Win32-specific utility functionality. -// - -// - -#ifndef clr_win32_h -#define clr_win32_h - -#include "winwrap.h" - -namespace clr -{ - namespace win32 - { - // Prevents an HMODULE from being unloaded until process termination. - inline - HRESULT PreventModuleUnload(HMODULE hMod) - { - if (!WszGetModuleHandleEx( - GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, - reinterpret_cast(hMod), - &hMod)) - { - return HRESULT_FROM_GetLastError(); - } - - return S_OK; - } - } // namespace win -} // namespace clr - -#endif // clr_win32_h diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/algorithm b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/algorithm deleted file mode 100644 index ebd21b09c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/algorithm +++ /dev/null @@ -1,118 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// clr_std/algorithm -// -// Copy of some key Standard Template Library functionality - -#ifdef _MSC_VER -#pragma once -#endif - -#ifdef USE_STL -#include -#else -#ifndef __clr_std_algorithm_h__ -#define __clr_std_algorithm_h__ - -namespace std -{ - template - iter find_if ( iter first, iter last, CompareFunc comp ) - { - for ( ; first!=last ; first++ ) - if ( comp(*first) ) - break; - return first; - } - - template - iter find(iter first, iter last, const T& val) - { - for (;first != last; first++) - { - if (*first == val) - break; - } - return first; - } - - template - iter qsort_partition( iter first, iter last, iter pivot, comp compare ) - { - iter lastMinusOne = last - 1; - swap(pivot, lastMinusOne); - - // Pivot is at end - pivot = last - 1; - - iter partitionLoc = first; - - for (iter partitionWalk = first; partitionWalk != pivot; ++partitionWalk) - { - if (compare(*partitionWalk, *pivot)) - { - swap(*partitionWalk, *partitionLoc); - partitionLoc++; - } - } - swap(*pivot, *partitionLoc); - - return partitionLoc; - } - - template - void sort_worker ( iter first, iter last, comp compare ) - { - typename iter::difference_type RangeSize = last - first; - - // When down to a list of size 1, be done - if (RangeSize < 2) - return; - - // Pick pivot - - // Use simple pick middle algorithm - iter pivotLoc = first + (RangeSize / 2); - - // Partition - pivotLoc = qsort_partition(first, last, pivotLoc, compare); - - // Sort first array - sort_worker(first, pivotLoc, compare); - - // Sort second array - sort_worker(pivotLoc + 1, last, compare); - } - - template - void sort ( iter first, iter last, comp compare ) - { - sort_worker(first, last, compare); - if (first != last) - { - for (iter i = first; i < (last - 1); i++) - { - // Assert that the sort function works. - assert(!compare(*(i+1), *i)); - } - } - } - - template - OutIter transform( InIter first, InIter last, OutIter dest, Fn1 func ) - { - for ( ; first!=last ; ++first, ++dest ) - *dest = func(*first); - return dest; - } - -} // namespace std - -#endif /* __clr_std_algorithm_h__ */ - -#endif // !USE_STL - -// Help the VIM editor figure out what kind of file this no-extension file is. -// vim: filetype=cpp diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/string b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/string deleted file mode 100644 index 59ac67b98..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/string +++ /dev/null @@ -1,425 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// clr_std/string -// -// Copy of some key Standard Template Library functionality -// -// This was created for use with SuperPMI. It has the minimal functionality needed by SuperPMI. It hasn't -// been tested elsewhere. - -#ifdef _MSC_VER -#pragma once -#endif - -#ifdef USE_STL -#include -#else -#ifndef __clr_std_string_h__ -#define __clr_std_string_h__ - -#include "clr_std/vector" - -namespace std -{ - -template -class basic_string -{ -public: - typedef T value_type; - typedef size_t size_type; - typedef typename vector::iterator iterator; - typedef typename vector::const_iterator const_iterator; - - basic_string() - : m_string(1) // start with a string of length 1 for null terminator - { - m_string[0] = T(); - } - - basic_string(const basic_string& _Right) - { - assign(_Right); - } - - // Initialize a string with _Count characters from the string pointed at by _Ptr. - // If you want to include the trailing null character, _Count needs to include that. - basic_string(const value_type* _Ptr, size_type _Count) - : m_string(_Count + 1) // add 1 for a null terminator - { - copy(_Ptr, _Count); - } - - basic_string(const value_type* _Ptr) : basic_string(_Ptr, c_len(_Ptr)) - { - } - - void reserve(size_t newcapacity) - { - m_string.reserve(newcapacity + 1); // add 1 for the null terminator - } - - // - // Assignment - // - - basic_string& operator=(const basic_string& _Right) - { - if (this != &_Right) - { - assign(_Right); - } - return (*this); - } - - basic_string& assign(const basic_string& _Right) - { - m_string.resize(_Right.size() + 1); // +1 for null terminator - copy(_Right); - return (*this); - } - - // - // Basic data copying - // - - void copy(const basic_string& _Right) - { - assert(size() >= _Right.size()); - size_type i; - for (i = 0; i < _Right.size(); i++) - { - m_string[i] = _Right.m_string[i]; - } - m_string[i] = T(); - } - - void copy(const value_type* _Ptr, size_type _Count) - { - assert(size() >= _Count); - size_type i; - for (i = 0; i < _Count; i++) - { - m_string[i] = _Ptr[i]; - } - m_string[i] = T(); - } - - // - // Appending - // - - // Append a C-style string to the string. - basic_string& operator+=(const value_type* _Ptr) - { - size_type oldsize = size(); // doesn't include null terminator - size_type addsize = c_len(_Ptr); // doesn't include null terminator - size_type newsize = oldsize + addsize + 1; - m_string.resize(newsize); - size_type i; - for (i = oldsize; i < newsize - 1; i++) - { - m_string[i] = *_Ptr++; - } - m_string[i] = T(); - return (*this); - } - - basic_string& operator+=(const basic_string& _Right) - { - size_type oldsize = size(); // doesn't include null terminator - size_type addsize = _Right.size(); // doesn't include null terminator - size_type newsize = oldsize + addsize + 1; - m_string.resize(newsize); - size_type new_index = oldsize, right_index = 0; - while (right_index < addsize) - { - m_string[new_index] = _Right.m_string[right_index]; - ++new_index; - ++right_index; - } - m_string[new_index] = T(); - return (*this); - } - - basic_string& operator+=(value_type _Ch) - { - size_type oldsize = size(); // doesn't include null terminator - m_string[oldsize] = _Ch; // Replace the null terminator with the new symbol. - m_string.push_back(T()); // Return the replaced terminator again. - return (*this); - } - - ~basic_string() - { - // vector destructor does all the work - } - - size_t size() const - { - assert(m_string.size() > 0); - return m_string.size() - 1; // Don't report the null terminator. - } - - size_t length() const - { - return size(); - } - - T& operator[](size_t iIndex) - { - assert(iIndex < size() + 1); // allow looking at the null terminator - return m_string[iIndex]; - } - - const T* c_str() const - { - return m_string.data(); - } - - iterator begin() - { - return m_string.begin(); - } - - iterator end() - { - return m_string.end(); - } - - const_iterator cbegin() const - { - return m_string.cbegin(); - } - - const_iterator cend() const - { - return m_string.cend(); - } - - basic_string substr(size_type _Off = 0, size_type _Count = npos) const - { - size_type cursize = size(); - if (_Off >= cursize) - { - // result will be empty - return basic_string(); - } - else - { - if ((_Count == npos) || // No count specified; take the whole string suffix - (_Off + _Count > cursize)) // Count specified is too many characters; just take the whole suffix - { - _Count = cursize - _Off; - } - return basic_string(m_string.data() + _Off, _Count); - } - } - - size_type find_last_of(value_type _Ch) const - { - for (size_type _Off = size(); _Off != 0; _Off--) - { - if (m_string[_Off - 1] == _Ch) - { - return _Off - 1; - } - } - return npos; - } - - bool empty() const - { - return size() == 0; - } - - int compare(const basic_string& _Str) const - { - size_type i; - size_type compareSize = size(); - if (_Str.size() < compareSize) - { - // This string is longer; compare character-by-character only as many characters as we have. - compareSize = _Str.size(); - } - for (i = 0; i < compareSize; i++) - { - if (m_string[i] != _Str.m_string[i]) - { - if (m_string[i] < _Str.m_string[i]) - { - return -1; - } - else - { - return 1; - } - } - } - - // All the characters we compared were identical, but one string might be longer than the other. - if (size() == _Str.size()) - { - // We compared everything. - return 0; - } - else if (size() < _Str.size()) - { - // _Str has more characters than this. - return -1; - } - else - { - // this has more characters than _Str - return 1; - } - } - - static const size_type npos = size_type(-1); - -private: - - // Compute the length in characters of a null-terminated C-style string, not including the trailing null character. - // _Ptr must not be nullptr. - size_type c_len(const value_type* _Ptr) - { - size_type count; - for (count = 0; *_Ptr != T(); _Ptr++) - { - count++; - } - return count; - } - - vector m_string; // use a vector<> to represent the string, to avoid reimplementing similar functionality - -}; // class basic_string - -// -// String class instantiations -// - -typedef basic_string string; - -// -// Numeric conversions -// - -// convert integer T to string -template inline -string _IntToString(const char *_Fmt, T _Val) -{ - const size_t MaxIntBufSize = 21; /* can hold -2^63 and 2^64 - 1, plus NUL */ - char buf[MaxIntBufSize]; - int len = sprintf_s(buf, MaxIntBufSize, _Fmt, _Val); - return (string(buf, len)); -} - -inline string to_string(int _Val) -{ - return (_IntToString("%d", _Val)); -} - -inline string to_string(unsigned int _Val) -{ - return (_IntToString("%u", _Val)); -} - -inline string to_string(long _Val) -{ - return (_IntToString("%ld", _Val)); -} - -inline string to_string(unsigned long _Val) -{ - return (_IntToString("%lu", _Val)); -} - -inline string to_string(long long _Val) -{ - return (_IntToString("%lld", _Val)); -} - -inline string to_string(unsigned long long _Val) -{ - return (_IntToString("%llu", _Val)); -} - -// -// Comparisons -// - -template inline -bool operator==( - const basic_string& _Left, - const basic_string& _Right) -{ - return (_Left.compare(_Right) == 0); -} - -template inline -bool operator!=( - const basic_string& _Left, - const basic_string& _Right) -{ - return (!(_Left == _Right)); -} - -template inline -bool operator<( - const basic_string& _Left, - const basic_string& _Right) -{ - return (_Left.compare(_Right) < 0); -} - -template inline -bool operator>( - const basic_string& _Left, - const basic_string& _Right) -{ - return (_Right < _Left); -} - -template inline -bool operator<=( - const basic_string& _Left, - const basic_string& _Right) -{ - return (!(_Right < _Left)); -} - -template inline -bool operator>=( - const basic_string& _Left, - const basic_string& _Right) -{ - return (!(_Left < _Right)); -} - -// -// String concatenation and other string operations -// - -template inline -basic_string operator+( - const basic_string& _Left, - const basic_string& _Right) -{ - basic_string ret; - ret.reserve(_Left.size() + _Right.size()); - ret += _Left; - ret += _Right; - return ret; -} - -}; // namespace std - -#endif /* __clr_std_string_h__ */ - -#endif // !USE_STL - -// Help the VIM editor figure out what kind of file this no-extension file is. -// vim: filetype=cpp diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/type_traits b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/type_traits deleted file mode 100644 index 12af99d5c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/type_traits +++ /dev/null @@ -1,627 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// clr_std/utility -// -// Copy of some key Standard Template Library functionality. -// See http://msdn.microsoft.com/en-us/library/bb982077.aspx for documentation. -// - -#ifdef _MSC_VER -#pragma once -#endif - -#ifndef __clr_std_type_traits_h__ -#define __clr_std_type_traits_h__ - -#ifdef USE_STL - -#include - -#else - -namespace std -{ - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS remove_const - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type; - }; - - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type; - }; - - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type[]; - }; - - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type[_Nx]; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS remove_volatile - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type; - }; - - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type; - }; - - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type[]; - }; - - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type[_Nx]; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS remove_cv - template - struct remove_cv - { // remove top level const and volatile qualifiers - typedef typename remove_const::type>::type type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE remove_reference - template - struct remove_reference - { // remove reference - typedef T type; - }; - - template - struct remove_reference - { // remove reference - typedef T type; - }; - - template - struct remove_reference - { // remove rvalue reference - typedef T type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE remove_pointer - template - struct remove_pointer - { // remove pointer - typedef T type; - }; - - template - struct remove_pointer - { // remove pointer - typedef T type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE FUNCTION identity - template - struct identity - { // map T to type unchanged - typedef T type; - - inline - const T& operator()(const T& left) const - { // apply identity operator to operand - return (left); - } - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS integral_constant - template - struct integral_constant - { // convenient template for integral constant types - static const _Ty value = _Val; - - typedef _Ty value_type; - typedef integral_constant<_Ty, _Val> type; - }; - - typedef integral_constant true_type; - typedef integral_constant false_type; - - // TEMPLATE CLASS _Cat_base - template - struct _Cat_base - : false_type - { // base class for type predicates - }; - - template<> - struct _Cat_base - : true_type - { // base class for type predicates - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS enable_if - template - struct enable_if - { // type is undefined for assumed !_Test - }; - - template - struct enable_if - { // type is _Type for _Test - typedef _Type type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS conditional - template - struct conditional - { // type is _Ty2 for assumed !_Test - typedef _Ty2 type; - }; - - template - struct conditional - { // type is _Ty1 for _Test - typedef _Ty1 type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS make_unsigned - template - struct make_unsigned - { - }; - - template<> - struct make_unsigned - { - typedef unsigned int type; - }; - -#ifndef HOST_UNIX - - template<> - struct make_unsigned - { - typedef unsigned long type; - }; - -#endif // !HOST_UNIX - - template<> - struct make_unsigned<__int64> - { - typedef unsigned __int64 type; - }; - - template<> - struct make_unsigned - { - typedef size_t type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS make_signed - template - struct make_signed - { - }; - - template<> - struct make_signed - { - typedef signed int type; - }; - -#ifndef HOST_UNIX - - template<> - struct make_signed - { - typedef signed long type; - }; - -#endif // !HOST_UNIX - - template<> - struct make_signed - { - typedef signed __int64 type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_lvalue_reference - template - struct is_lvalue_reference - : false_type - { // determine whether _Ty is an lvalue reference - }; - - template - struct is_lvalue_reference<_Ty&> - : true_type - { // determine whether _Ty is an lvalue reference - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_rvalue_reference - template - struct is_rvalue_reference - : false_type - { // determine whether _Ty is an rvalue reference - }; - - template - struct is_rvalue_reference<_Ty&&> - : true_type - { // determine whether _Ty is an rvalue reference - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_reference - template - struct is_reference - : conditional< - is_lvalue_reference<_Ty>::value || is_rvalue_reference<_Ty>::value, - true_type, - false_type>::type - { // determine whether _Ty is a reference - }; - - // TEMPLATE CLASS is_pointer - template - struct is_pointer - : false_type - { // determine whether _Ty is a pointer - }; - - template - struct is_pointer<_Ty *> - : true_type - { // determine whether _Ty is a pointer - }; - - // TEMPLATE CLASS _Is_integral - template - struct _Is_integral - : false_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - -// On Unix 'long' is a 64-bit type (same as __int64) and the following two definitions -// conflict with _Is_integral and _Is_integral. -#ifndef HOST_UNIX - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; -#endif /* HOST_UNIX */ - - #if _HAS_CHAR16_T_LANGUAGE_SUPPORT - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - #endif /* _HAS_CHAR16_T_LANGUAGE_SUPPORT */ - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - // TEMPLATE CLASS is_integral - template - struct is_integral - : _Is_integral::type> - { // determine whether _Ty is integral - }; - - // TEMPLATE CLASS _Is_floating_point - template - struct _Is_floating_point - : false_type - { // determine whether _Ty is floating point - }; - - template<> - struct _Is_floating_point - : true_type - { // determine whether _Ty is floating point - }; - - template<> - struct _Is_floating_point - : true_type - { // determine whether _Ty is floating point - }; - -// In PAL, we define long as int and so this becomes int double, -// which is a nonsense -#ifndef HOST_UNIX - template<> - struct _Is_floating_point - : true_type - { // determine whether _Ty is floating point - }; -#endif - - // TEMPLATE CLASS is_floating_point - template - struct is_floating_point - : _Is_floating_point::type> - { // determine whether _Ty is floating point - }; - - // TEMPLATE CLASS is_arithmetic - template - struct is_arithmetic - : _Cat_base::value - || is_floating_point<_Ty>::value> - { // determine whether _Ty is an arithmetic type - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_signed - template - struct is_signed : conditional< - static_cast::type>(-1) < 0, true_type, false_type>::type {}; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_same - template - struct is_same : false_type { }; - - //----------------------------------------------------------------------------------------- - template - struct is_same : true_type { }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_base_of -#ifdef _MSC_VER - - template - struct is_base_of : - conditional<__is_base_of( TBase, TDerived), true_type, false_type>::type {}; - -#else - namespace detail - { - //------------------------------------------------------------------------------------- - // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) - // - - template - struct conversion_helper - { - typedef char Small; - struct Big { char dummy[2]; }; - static Big Test(...); - static Small Test(U); - static T MakeT(); - }; - - //------------------------------------------------------------------------------------- - // class template conversion - // Figures out the conversion relationships between two types - // Invocations (T and U are types): - // a) conversion::exists - // returns (at compile time) true if there is an implicit conversion from T - // to U (example: Derived to Base) - // b) conversion::exists2Way - // returns (at compile time) true if there are both conversions from T - // to U and from U to T (example: int to char and back) - // c) conversion::sameType - // returns (at compile time) true if T and U represent the same type - // - // NOTE: might not work if T and U are in a private inheritance hierarchy. - // - - template - struct conversion - { - typedef detail::conversion_helper H; - static const bool exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))); - static const bool exists2Way = exists && conversion::exists; - static const bool sameType = false; - }; - - template - struct conversion - { - static const bool exists = true; - static const bool exists2Way = true; - static const bool sameType = true; - }; - - template - struct conversion - { - static const bool exists = false; - static const bool exists2Way = false; - static const bool sameType = false; - }; - - template - struct conversion - { - static const bool exists = false; - static const bool exists2Way = false; - static const bool sameType = false; - }; - - template <> - struct conversion - { - static const bool exists = true; - static const bool exists2Way = true; - static const bool sameType = true; - }; - } // detail - - // Note that we need to compare pointer types here, since conversion of types by-value - // just tells us whether or not an implicit conversion constructor exists. We handle - // type parameters that are already pointers specially; see below. - template - struct is_base_of : - conditional::exists, true_type, false_type>::type {}; - - // Specialization to handle type parameters that are already pointers. - template - struct is_base_of : - conditional::exists, true_type, false_type>::type {}; - - // Specialization to handle invalid mixing of pointer types. - template - struct is_base_of : - false_type {}; - - // Specialization to handle invalid mixing of pointer types. - template - struct is_base_of : - false_type {}; - -#endif - - namespace detail - { - template - using void_t = void; - } - // Always false dependent-value for static_asserts. - template - struct _Always_false - { - const bool value = false; - }; - - template - struct _Add_reference { // add reference (non-referenceable type) - using _Lvalue = _Ty; - using _Rvalue = _Ty; - }; - - template - struct _Add_reference<_Ty, detail::void_t<_Ty&>> { // (referenceable type) - using _Lvalue = _Ty&; - using _Rvalue = _Ty&&; - }; - - template - struct add_lvalue_reference { - using type = typename _Add_reference<_Ty>::_Lvalue; - }; - - template - struct add_rvalue_reference { - using type = typename _Add_reference<_Ty>::_Rvalue; - }; - - template - typename add_rvalue_reference<_Ty>::type declval() noexcept - { - static_assert(_Always_false<_Ty>::value, "Calling declval is ill-formed, see N4892 [declval]/2."); - } -} // namespace std - -#endif // !USE_STL - -#define REM_CONST(T) typename std::remove_const< T >::type -#define REM_CV(T) typename std::remove_cv< T >::type -#define REM_REF(T) typename std::remove_reference< T >::type - -#define REF_T(T) REM_REF(T) & -#define REF_CT(T) REM_REF(REM_CONST(T)) const & - -#endif // __clr_std_type_traits_h__ - -// Help the VIM editor figure out what kind of file this no-extension file is. -// vim: filetype=cpp diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/utility b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/utility deleted file mode 100644 index 1b6b5a7b7..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/utility +++ /dev/null @@ -1,253 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// clr_std/utility -// -// Copy of some key Standard Template Library functionality -// See http://msdn.microsoft.com/en-us/library/bb982077.aspx for documentation. -// - -#ifdef _MSC_VER -#pragma once -#endif - -#ifdef USE_STL -#include -#else -#ifndef __clr_std_utility_h__ -#define __clr_std_utility_h__ - -#include "clr_std/type_traits" - -namespace std -{ - //----------------------------------------------------------------------------------------- - // TEMPLATE FUNCTION move - template inline - typename remove_reference::type&& - move(T&& arg) - { // forward _Arg as movable - return ((typename remove_reference::type&&)arg); - } - - //----------------------------------------------------------------------------------------- - // TEMPLATE FUNCTION swap (from ) - template inline - void swap(T& left, T& right) - { // exchange values stored at left and right - T tmp = std::move(left); - left = std::move(right); - right = std::move(tmp); - } - - //----------------------------------------------------------------------------------------- - // TEMPLATE FUNCTION forward - template inline - T&& - forward(typename identity::type& _Arg) - { // forward _Arg, given explicitly specified type parameter - return ((T&&)_Arg); - } -} - -namespace std -{ - //----------------------------------------------------------------------------------------- - // TEMPLATE STRUCT pair - template - struct pair - { // store a pair of values - typedef pair<_Ty1, _Ty2> _Myt; - typedef _Ty1 first_type; - typedef _Ty2 second_type; - - pair() - : first(_Ty1()), second(_Ty2()) - { // construct from defaults - } - - pair(const _Ty1& _Val1, const _Ty2& _Val2) - : first(_Val1.first), second(_Val2.second) - { // construct from specified values - } - - template - pair(pair<_Other1, _Other2>& _Right) - : first(_Right.first), second(_Right.second) - { // construct from compatible pair - } - - template - pair(const pair<_Other1, _Other2>& _Right) - : first(_Right.first), second(_Right.second) - { // construct from compatible pair - } - - void swap(_Myt& _Right) - { // exchange contents with _Right - if (this != &_Right) - { // different, worth swapping - swap(this->first, _Right.first); - swap(this->second, _Right.second); - } - } - - _Myt& operator=(const _Myt& _Right) - { // assign from copied pair - this->first = _Right.first; - this->second = _Right.second; - return (*this); - } - - typedef typename remove_reference<_Ty1>::type _Ty1x; - typedef typename remove_reference<_Ty2>::type _Ty2x; - - pair(_Ty1x&& _Val1, _Ty2x&& _Val2) - : first(std::move(_Val1)), - second(std::move(_Val2)) - { // construct from specified values - } - - pair(const _Ty1x& _Val1, _Ty2x&& _Val2) - : first(_Val1), - second(std::move(_Val2)) - { // construct from specified values - } - - pair(_Ty1x&& _Val1, const _Ty2x& _Val2) - : first(std::move(_Val1)), - second(_Val2) - { // construct from specified values - } - - template - pair(_Other1&& _Val1, _Other2&& _Val2) - : first(std::move(_Val1)), - second(std::move(_Val2)) - { // construct from moved values - } - - template - pair(pair<_Other1, _Other2>&& _Right) - : first(std::move(_Right.first)), - second(std::move(_Right.second)) - { // construct from moved compatible pair - } - - pair& operator=(pair<_Ty1, _Ty2>&& _Right) - { // assign from moved pair - this->first = std::move(_Right.first); - this->second = std::move(_Right.second); - return (*this); - } - - void swap(_Myt&& _Right) - { // exchange contents with _Right - if (this != &_Right) - { // different, worth swapping - this->first = std::move(_Right.first); - this->second = std::move(_Right.second); - } - } - - _Ty1 first; // the first stored value - _Ty2 second; // the second stored value - }; // struct pair - - //----------------------------------------------------------------------------------------- - // pair TEMPLATE FUNCTIONS - - template inline - void swap(pair<_Ty1, _Ty2>& _Left, pair<_Ty1, _Ty2>& _Right) - { // swap _Left and _Right pairs - _Left.swap(_Right); - } - - template inline - void swap(pair<_Ty1, _Ty2>& _Left, pair<_Ty1, _Ty2>&& _Right) - { // swap _Left and _Right pairs - typedef pair<_Ty1, _Ty2> _Myt; - _Left.swap(std::forward<_Myt>(_Right)); - } - - template inline - void swap( - pair<_Ty1, _Ty2>&& _Left, - pair<_Ty1, _Ty2>& _Right) - { // swap _Left and _Right pairs - typedef pair<_Ty1, _Ty2> _Myt; - _Right.swap(std::forward<_Myt>(_Left)); - } - - template inline - bool operator==( - const pair<_Ty1, _Ty2>& _Left, - const pair<_Ty1, _Ty2>& _Right) - { // test for pair equality - return (_Left.first == _Right.first && _Left.second == _Right.second); - } - - template inline - bool operator!=( - const pair<_Ty1, _Ty2>& _Left, - const pair<_Ty1, _Ty2>& _Right) - { // test for pair inequality - return (!(_Left == _Right)); - } - - template inline - bool operator<( - const pair<_Ty1, _Ty2>& _Left, - const pair<_Ty1, _Ty2>& _Right) - { // test if _Left < _Right for pairs - return (_Left.first < _Right.first || - (!(_Right.first < _Left.first) && _Left.second < _Right.second)); - } - - template inline - bool operator>( - const pair<_Ty1, _Ty2>& _Left, - const pair<_Ty1, _Ty2>& _Right) - { // test if _Left > _Right for pairs - return (_Right < _Left); - } - - template inline - bool operator<=( - const pair<_Ty1, _Ty2>& _Left, - const pair<_Ty1, _Ty2>& _Right) - { // test if _Left <= _Right for pairs - return (!(_Right < _Left)); - } - - template inline - bool operator>=( - const pair<_Ty1, _Ty2>& _Left, - const pair<_Ty1, _Ty2>& _Right) - { // test if _Left >= _Right for pairs - return (!(_Left < _Right)); - } - - template inline - _InIt begin( - const pair<_InIt, _InIt>& _Pair) - { // return first element of pair - return (_Pair.first); - } - - template inline - _InIt end( - const pair<_InIt, _InIt>& _Pair) - { // return second element of pair - return (_Pair.second); - } - -} // namespace std - -#endif /* __clr_std_utility_h__ */ - -#endif // !USE_STL - -// Help the VIM editor figure out what kind of file this no-extension file is. -// vim: filetype=cpp diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/vector b/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/vector deleted file mode 100644 index c2d1caba8..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clr_std/vector +++ /dev/null @@ -1,462 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// clr_std/vector -// -// Copy of some key Standard Template Library functionality -// - -#ifdef _MSC_VER -#pragma once -#endif - -#ifdef USE_STL -#include -#else -#ifndef __clr_std_vector_h__ -#define __clr_std_vector_h__ - -// This is defined in the debugmacrosext.h header, but don't take a dependency on that. -#ifndef INDEBUG -#ifdef _DEBUG -#define INDEBUG(x) x -#else -#define INDEBUG(x) -#endif -#endif // !def INDEBUG - -namespace std -{ - template - class vector - { - public: - class const_iterator; - - class iterator - { - friend class std::vector::const_iterator; - public: - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; - - typedef class vector::iterator _MyIter; - - _MyIter &operator++() - { - m_ptr++; - return *this; - } - - _MyIter operator++(int) - { - // post-increment ++ - _MyIter myiter(m_ptr); - m_ptr++; - return myiter; - } - - _MyIter &operator--() - { - m_ptr--; - return *this; - } - - _MyIter operator--(int) - { - // post-decrement -- - _MyIter myiter(m_ptr); - m_ptr--; - return myiter; - } - - _MyIter operator- (ptrdiff_t n) - { - _MyIter myiter(m_ptr); - myiter.m_ptr -= n; - return myiter; - } - - ptrdiff_t operator- (_MyIter right) - { - _MyIter myiter(m_ptr); - return myiter.m_ptr - right.m_ptr; - } - - _MyIter operator+ (ptrdiff_t n) - { - _MyIter myiter(m_ptr); - myiter.m_ptr += n; - return myiter; - } - - T* operator->() const - { - return m_ptr; - } - - T & operator*() const - { - return *m_ptr; - } - - bool operator==(const _MyIter& _Right) const - { - bool equals = this->m_ptr == _Right.m_ptr; - return equals; - } - - bool operator!=(const _MyIter& _Right) const - { - bool equals = this->m_ptr == _Right.m_ptr; - return !equals; - } - - bool operator<(const _MyIter& _Right) const - { - return this->m_ptr < _Right.m_ptr; - } - - bool operator>(const _MyIter& _Right) const - { - return this->m_ptr > _Right.m_ptr; - } - public: - explicit iterator(T* ptr) - { - m_ptr = ptr; - } - - private: - T* m_ptr; - }; // class iterator - - class const_iterator - { - public: - typedef class vector::const_iterator _MyIter; - typedef class vector::iterator _MyNonConstIter; - - _MyIter &operator++() - { - m_ptr++; - return *this; - } - - _MyIter operator++(int) - { - // post-increment ++ - _MyIter myiter(m_ptr); - m_ptr++; - return myiter; - } - - const T* operator->() const - { - return m_ptr; - } - - const T & operator*() const - { - return *m_ptr; - } - - bool operator==(const _MyIter& _Right) const - { - bool equals = this->m_ptr == _Right.m_ptr; - return equals; - } - - bool operator!=(const _MyIter& _Right) const - { - bool equals = this->m_ptr == _Right.m_ptr; - return !equals; - } - - public: - explicit const_iterator(T* ptr) - { - m_ptr = ptr; - } - const_iterator(const _MyNonConstIter &nonConstIterator) - { - m_ptr = nonConstIterator.m_ptr; - } - - private: - T* m_ptr; - }; // class const iterator - - - public: - explicit vector(size_t n = 0) - { - m_size = 0; - m_capacity = 0; - m_pelements = NULL; - m_isBufferOwner = true; - resize(n); - } - - ~vector() - { - if (m_isBufferOwner) - { - erase(m_pelements, 0, m_size); - delete [] (BYTE*)m_pelements; // cast to BYTE* as we don't want this delete to invoke T's dtor - } - else - { - m_size = 0; - m_capacity = 0; - } - } - - vector(const vector&) = delete; - vector& operator=(const vector&) = delete; - - vector(vector&& v) noexcept - : m_size(v.m_size) - , m_capacity(v.m_capacity) - , m_pelements(v.m_pelements) - , m_isBufferOwner(v.m_isBufferOwner) - { - v.m_isBufferOwner = false; - } - - vector& operator=(vector&& v) noexcept - { - if (m_isBufferOwner) - { - erase(m_pelements, 0, m_size); - delete [] (BYTE*)m_pelements; - } - - m_size = v.m_size; - m_capacity = v.m_capacity; - m_pelements = v.m_pelements; - m_isBufferOwner = v.m_isBufferOwner; - v.m_isBufferOwner = false; - return *this; - } - - size_t size() const - { - return m_size; - } - - T & operator[](size_t iIndex) - { - assert(iIndex < m_size); - return m_pelements[iIndex]; - } - - T & operator[](size_t iIndex) const - { - assert(iIndex < m_size); - return m_pelements[iIndex]; - } - - void resize(size_t newsize) - { - assert(m_isBufferOwner); - size_t oldsize = this->size(); - resize_noinit(newsize); - if (newsize > oldsize) - { - fill_uninitialized_with_default_value(m_pelements, oldsize, newsize); - } - } - - void clear() - { - assert(m_isBufferOwner); - resize(0); - } - - void resize(size_t newsize, T c) - { - assert(m_isBufferOwner); - size_t oldsize = this->size(); - resize_noinit(newsize); - if (newsize > oldsize) - { - for (size_t i = oldsize; i < newsize; i++) - { - m_pelements[i] = c; - } - } - } - - void wrap(size_t numElements, T* pElements) - { - m_size = numElements; - m_pelements = pElements; - m_isBufferOwner = false; - } - - void resize_noinit(size_t newsize) - { - assert(m_isBufferOwner); - size_t oldsize = this->size(); - if (newsize < oldsize) - { - // Shrink - erase(m_pelements, newsize, oldsize); - } - else if (newsize > oldsize) - { - // Grow - reserve(newsize); - } - m_size = newsize; - } - - void push_back(const T & val) - { - assert(m_isBufferOwner); - if (m_size + 1 < m_size) - { - assert("push_back: overflow"); - // @todo: how to throw. - } - resize(m_size + 1, val); - } - - void reserve(size_t newcapacity) - { - assert(m_isBufferOwner); - if (newcapacity > m_capacity) - { - // To avoid resizing for every element that gets added to a vector, we - // allocate at least twice the old capacity, or 16 elements, whichever is greater. - newcapacity = max(newcapacity, max(m_capacity * 2, 16)); - - size_t bytesNeeded = newcapacity * sizeof(T); - if (bytesNeeded / sizeof(T) != newcapacity) - { - assert("resize: overflow"); - // @todo: how to throw something here? - } - - - T *pelements = (T*)(new BYTE[bytesNeeded]); // Allocate as BYTE array to avoid automatic construction - INDEBUG(memset(pelements, 0xcc, bytesNeeded)); - for (size_t i = 0; i < m_size; i++) - { - pelements[i] = m_pelements[i]; - } - - erase(m_pelements, 0, m_size); - delete [] (BYTE*)m_pelements; // cast to BYTE* as we don't want this delete to invoke T's dtor - - m_pelements = pelements; - m_capacity = newcapacity; - } - } - - iterator begin() - { - return iterator(m_pelements); - } - - iterator end() - { - return iterator(m_pelements + m_size); - } - - const_iterator cbegin() const - { - return const_iterator(m_pelements); - } - - const_iterator cend() const - { - return const_iterator(m_pelements + m_size); - } - - iterator erase(iterator position) - { - assert(m_isBufferOwner); - assert((position > begin() || position == begin()) && position < end()); - ptrdiff_t index = position - begin(); - erase(m_pelements, index, index + 1); - memcpy(&m_pelements[index], &m_pelements[index + 1], sizeof(T) * (m_size - index - 1)); - --m_size; - return iterator(m_pelements + (position - begin())); - } - - iterator erase(iterator position, iterator positionEnd) - { - assert(m_isBufferOwner); - assert((position > begin() || position == begin()) && position < end()); - ptrdiff_t index = position - begin(); - ptrdiff_t elements = positionEnd - position; - erase(m_pelements, index, index + elements); - memcpy(&m_pelements[index], &m_pelements[index + elements], sizeof(T) * (m_size - index - elements)); - m_size -= elements; - return iterator(m_pelements + (position - begin())); - } - - T* data() - { - return m_pelements; - } - - const T* data() const - { - return m_pelements; - } - - private: - // Transition a subset of the array from uninitialized to initialized with default value for T. - static void fill_uninitialized_with_default_value(T* pelements, size_t startIdx, size_t endIdx) - { - assert(startIdx <= endIdx); - assert(pelements != NULL || startIdx == endIdx); - for (size_t i = startIdx; i < endIdx; i++) - { - INDEBUG(assert(0xcc == *((BYTE*)&pelements[i]))); - pelements[i] = T(); - } - } - - // Transition a subset of the array from a valid value of T to uninitialized. - static void erase(T* pelements, size_t startIdx, size_t endIdx) - { - assert(startIdx <= endIdx); - assert(pelements != NULL || startIdx == endIdx); - for (size_t i = startIdx; i < endIdx; i++) - { - pelements[i].~T(); - } - - INDEBUG(memset(&pelements[startIdx], 0xcc, (endIdx - startIdx) * sizeof(T))); - } - - private: - size_t m_size; //# of elements - size_t m_capacity; //# of elements allocated - T *m_pelements; //actual array - // invariants: - // dimensions == m_capacity - // elements 0 thru m_size-1 always contain constructed T values. - // elements from m_size thru m_capacity - 1 contain memory garbage (0xcc in DEBUG). - bool m_isBufferOwner; // indicate if this vector creates its own buffer, or wraps an existing buffer. - - - - - }; // class vector - -}; // namespace std - -#endif /* __clr_std_vector_h__ */ - -#endif // !USE_STL - -// Help the VIM editor figure out what kind of file this no-extension file is. -// vim: filetype=cpp diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrconfigvalues.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrconfigvalues.h index 52a681413..882a88839 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrconfigvalues.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrconfigvalues.h @@ -10,9 +10,9 @@ // // Given any config knob below that looks like this example: // RETAIL_CONFIG_DWORD_INFO(INTERNAL_LogEnable, W("LogEnable"), 0, "Turns on the traditional CLR log.") -// --------- -// | -// -------------------- +// --------- +// | +// ------- // | // V // You can set an environment variable DOTNET_LogEnable=1 to enable it. @@ -109,22 +109,6 @@ // * W("UNSUPPORTED_Security_DisableTransparency") // * W("Security_LegacyHMACMode") <---------------------- (No EXTERNAL prefix) -/// -/// AppDomain -/// -CONFIG_DWORD_INFO(INTERNAL_EnableFullDebug, W("EnableFullDebug"), 0, "Heavy-weight checking for AD boundary violations (AD leaks)") - -/// -/// Jit Pitching -/// -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchEnabled, W("JitPitchEnabled"), (DWORD)0, "Set it to 1 to enable Jit Pitching") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchMemThreshold, W("JitPitchMemThreshold"), (DWORD)0, "Do Jit Pitching when code heap usage is larger than this (in bytes)") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchMethodSizeThreshold, W("JitPitchMethodSizeThreshold"), (DWORD)0, "Do Jit Pitching for methods whose native code size larger than this (in bytes)") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchTimeInterval, W("JitPitchTimeInterval"), (DWORD)0, "Time interval between Jit Pitchings in ms") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchPrintStat, W("JitPitchPrintStat"), (DWORD)0, "Print statistics about Jit Pitching") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchMinVal, W("JitPitchMinVal"), (DWORD)0, "Do Jit Pitching if the value of the inner counter greater than this value (for debugging purpose only)") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitPitchMaxVal, W("JitPitchMaxVal"), (DWORD)0xffffffff, "Do Jit Pitching the value of the inner counter less then this value (for debuggin purpose only)") - /// /// Assembly Loader /// @@ -148,7 +132,6 @@ CONFIG_DWORD_INFO(INTERNAL_BreakOnDumpToken, W("BreakOnDumpToken"), 0xffffffff, RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_BreakOnEELoad, W("BreakOnEELoad"), 0, "") CONFIG_DWORD_INFO(INTERNAL_BreakOnEEShutdown, W("BreakOnEEShutdown"), 0, "") CONFIG_DWORD_INFO(INTERNAL_BreakOnExceptionInGetThrowable, W("BreakOnExceptionInGetThrowable"), 0, "") -CONFIG_DWORD_INFO(INTERNAL_BreakOnFindMethod, W("BreakOnFindMethod"), 0, "Breaks in findMethodInternal when it searches for the specified token.") CONFIG_DWORD_INFO(INTERNAL_BreakOnFirstPass, W("BreakOnFirstPass"), 0, "") CONFIG_DWORD_INFO(INTERNAL_BreakOnHR, W("BreakOnHR"), 0, "Debug.cpp, IfFailxxx use this macro to stop if hr matches ") CONFIG_STRING_INFO(INTERNAL_BreakOnInstantiation, W("BreakOnInstantiation"), "Very useful for debugging generic class instantiation.") @@ -177,11 +160,8 @@ CONFIG_DWORD_INFO(INTERNAL_DbgBreakOnRawInt3, W("DbgBreakOnRawInt3"), 0, "Allows CONFIG_DWORD_INFO(INTERNAL_DbgBreakOnSendBreakpoint, W("DbgBreakOnSendBreakpoint"), 0, "Allows an assert when sending a breakpoint to the right side") CONFIG_DWORD_INFO(INTERNAL_DbgBreakOnSetIP, W("DbgBreakOnSetIP"), 0, "Allows an assert when setting the IP") CONFIG_DWORD_INFO(INTERNAL_DbgCheckInt3, W("DbgCheckInt3"), 0, "Asserts if the debugger explicitly writes int3 instead of calling SetUnmanagedBreakpoint") -CONFIG_DWORD_INFO(INTERNAL_DbgDACAssertOnMismatch, W("DbgDACAssertOnMismatch"), 0, "Allows an assert when the mscordacwks and mscorwks dll versions don't match") CONFIG_DWORD_INFO(INTERNAL_DbgDACEnableAssert, W("DbgDACEnableAssert"), 0, "Enables extra validity checking in DAC - assumes target isn't corrupt") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_DbgDACSkipVerifyDlls, W("DbgDACSkipVerifyDlls"), 0, "Allows disabling the check to ensure mscordacwks and mscorwks dll versions match") CONFIG_DWORD_INFO(INTERNAL_DbgDelayHelper, W("DbgDelayHelper"), 0, "Varies the wait in the helper thread startup for testing race between threads") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_DbgDisableDynamicSymsCompat, W("DbgDisableDynamicSymsCompat"), 0, "") CONFIG_DWORD_INFO(INTERNAL_DbgDisableTargetConsistencyAsserts, W("DbgDisableTargetConsistencyAsserts"), 0, "Allows explicitly testing with corrupt targets") CONFIG_DWORD_INFO(INTERNAL_DbgExtraThreads, W("DbgExtraThreads"), 0, "Allows extra unmanaged threads to run and throw debug events for stress testing") CONFIG_DWORD_INFO(INTERNAL_DbgExtraThreadsCantStop, W("DbgExtraThreadsCantStop"), 0, "Allows extra unmanaged threads in can't stop region to run and throw debug events for stress testing") @@ -199,19 +179,14 @@ CONFIG_DWORD_INFO(INTERNAL_DbgPingInterop, W("DbgPingInterop"), 0, "Allows check CONFIG_DWORD_INFO(INTERNAL_DbgRace, W("DbgRace"), 0, "Allows pausing for native debug events to get hijicked") CONFIG_DWORD_INFO(INTERNAL_DbgShortcutCanary, W("DbgShortcutCanary"), 0, "Allows a way to force canary to fail to be able to test failure paths") CONFIG_DWORD_INFO(INTERNAL_DbgSkipMEOnStep, W("DbgSkipMEOnStep"), 0, "Turns off MethodEnter checks") -CONFIG_DWORD_INFO(INTERNAL_DbgSkipVerCheck, W("DbgSkipVerCheck"), 0, "Allows different RS and LS versions (for servicing work)") -CONFIG_DWORD_INFO(INTERNAL_DbgTC, W("DbgTC"), 0, "Allows checking boundary compression for offset mappings") CONFIG_DWORD_INFO(INTERNAL_DbgTransportFaultInject, W("DbgTransportFaultInject"), 0, "Allows injecting a fault for testing the debug transport") CONFIG_DWORD_INFO(INTERNAL_DbgTransportLog, W("DbgTransportLog"), 0 /* LE_None */, "Turns on logging for the debug transport") CONFIG_DWORD_INFO(INTERNAL_DbgTransportLogClass, W("DbgTransportLogClass"), (DWORD)-1 /* LC_All */, "Mask to control what is logged in DbgTransportLog") -RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_DbgTransportProxyAddress, W("DbgTransportProxyAddress"), "Allows specifying the transport proxy address") CONFIG_DWORD_INFO(INTERNAL_DbgTrapOnSkip, W("DbgTrapOnSkip"), 0, "Allows breaking when we skip a breakpoint") CONFIG_DWORD_INFO(INTERNAL_DbgWaitTimeout, W("DbgWaitTimeout"), 1, "Specifies the timeout value for waits") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DbgWFDETimeout, W("DbgWFDETimeout"), 25, "Specifies the timeout value for wait when waiting for a debug event") CONFIG_DWORD_INFO(INTERNAL_RaiseExceptionOnAssert, W("RaiseExceptionOnAssert"), 0, "Raise a first chance (if set to 1) or second chance (if set to 2) exception on asserts.") -CONFIG_DWORD_INFO(INTERNAL_DebugBreakOnVerificationFailure, W("DebugBreakOnVerificationFailure"), 0, "Halts the jit on verification failure") CONFIG_STRING_INFO(INTERNAL_DebuggerBreakPoint, W("DebuggerBreakPoint"), "Allows counting various debug events") -CONFIG_STRING_INFO(INTERNAL_DebugVerify, W("DebugVerify"), "Control for tracing in peverify") CONFIG_DWORD_INFO(INTERNAL_EncApplyChanges, W("EncApplyChanges"), 0, "Allows breaking when ApplyEditAndContinue is called") CONFIG_DWORD_INFO(INTERNAL_EnCBreakOnRemapComplete, W("EnCBreakOnRemapComplete"), 0, "Allows breaking after N RemapCompletes") CONFIG_DWORD_INFO(INTERNAL_EnCBreakOnRemapOpportunity, W("EnCBreakOnRemapOpportunity"), 0, "Allows breaking after N RemapOpportunities") @@ -259,7 +234,8 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_legacyCorruptedStateExceptionsPolicy, W("le CONFIG_DWORD_INFO(INTERNAL_SuppressLostExceptionTypeAssert, W("SuppressLostExceptionTypeAssert"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_UseEntryPointFilter, W("UseEntryPointFilter"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_Corhost_Swallow_Uncaught_Exceptions, W("Corhost_Swallow_Uncaught_Exceptions"), 0, "") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_LegacyExceptionHandling, W("LegacyExceptionHandling"), 0, "Enable legacy exception handling."); +RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_NativeToILOffsetCacheSize, W("NativeToILOffsetCacheSize"), 1024, "") +CONFIG_DWORD_INFO(INTERNAL_LogStackOverflowExit, W("LogStackOverflowExit"), 0, "Temporary flag to log stack overflow exit process") /// /// Garbage collector @@ -268,6 +244,7 @@ CONFIG_DWORD_INFO(INTERNAL_FastGCCheckStack, W("FastGCCheckStack"), 0, "") CONFIG_DWORD_INFO(INTERNAL_FastGCStress, W("FastGCStress"), 0, "Reduce the number of GCs done by enabling GCStress") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCBreakOnOOM, W("GCBreakOnOOM"), 0, "Does a DebugBreak at the soonest time we detect an OOM") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConcurrent, W("gcConcurrent"), (DWORD)-1, "Enables/Disables concurrent GC") +RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_UseGCWriteBarrierCopy, W("UseGCWriteBarrierCopy"), 1, "Use a copy of the write barrier for the GC. This is somewhat faster and for optimizations where the barrier is mutated as the program runs. Setting this to 0 removes scenarios where the write barrier is ever mutable.") #ifdef FEATURE_CONSERVATIVE_GC RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConservative, W("gcConservative"), 0, "Enables/Disables conservative GC") @@ -278,6 +255,7 @@ CONFIG_STRING_INFO(INTERNAL_SkipGCCoverage, W("SkipGcCoverage"), "Specify a list RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StatsUpdatePeriod, W("StatsUpdatePeriod"), 60, "Specifies the interval, in seconds, at which to update the statistics") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCRetainVM, W("GCRetainVM"), 0, "When set we put the segments that should be deleted on a standby list (instead of releasing them back to the OS) which will be considered to satisfy new segment requests (note that the same thing can be specified via API which is the supported way)") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_gcAllowVeryLargeObjects, W("gcAllowVeryLargeObjects"), 1, "Allow allocation of 2GB+ objects on GC heap") +RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_CheckDoubleReporting, W("CheckDoubleReporting"), 0, "Enable checks to proactively watch for possible GC holes") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_GCStress, W("GCStress"), 0, "Trigger GCs at regular intervals") CONFIG_DWORD_INFO(INTERNAL_GcStressOnDirectCalls, W("GcStressOnDirectCalls"), 0, "Whether to trigger a GC on direct calls") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_HeapVerify, W("HeapVerify"), 0, "When set verifies the integrity of the managed heap on entry and exit of each GC") @@ -308,7 +286,6 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_JitFramed, W("JitFramed"), 0, "Forces EBP f CONFIG_DWORD_INFO(INTERNAL_JitThrowOnAssertionFailure, W("JitThrowOnAssertionFailure"), 0, "Throw managed exception on assertion failures during JIT instead of failfast") CONFIG_DWORD_INFO(INTERNAL_JitGCStress, W("JitGCStress"), 0, "GC stress mode for jit") CONFIG_DWORD_INFO(INTERNAL_JitHeartbeat, W("JitHeartbeat"), 0, "") -CONFIG_DWORD_INFO(INTERNAL_JitHelperLogging, W("JitHelperLogging"), 0, "") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_JITMinOpts, W("JITMinOpts"), 0, "Forces MinOpts") // *Some* relocs are just opportunistic optimizations and can be non-deterministic - it might produce @@ -324,13 +301,17 @@ RETAIL_CONFIG_STRING_INFO(EXTERNAL_AltJitOs, W("AltJitOS"), "Sets target OS for RETAIL_CONFIG_STRING_INFO(EXTERNAL_AltJitExcludeAssemblies, W("AltJitExcludeAssemblies"), "Do not use AltJit on this semicolon-delimited list of assemblies.") #endif // defined(ALLOW_SXS_JIT) +#ifdef FEATURE_INTERPRETER +RETAIL_CONFIG_STRING_INFO(EXTERNAL_InterpreterName, W("InterpreterName"), "Primary interpreter to use") +CONFIG_STRING_INFO(INTERNAL_InterpreterPath, W("InterpreterPath"), "Full path to the interpreter to use") +RETAIL_CONFIG_STRING_INFO(EXTERNAL_Interpreter, W("Interpreter"), "Enables Interpreter and selectively limits it to the specified methods.") +#endif // FEATURE_INTERPRETER + RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitHostMaxSlabCache, W("JitHostMaxSlabCache"), 0x1000000, "Sets jit host max slab cache size, 16MB default") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitOptimizeType, W("JitOptimizeType"), 0 /* OPT_DEFAULT */, "") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitPrintInlinedMethods, W("JitPrintInlinedMethods"), 0, "") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitTelemetry, W("JitTelemetry"), 1, "If non-zero, gather JIT telemetry data") -RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogFile, W("JitTimeLogFile"), "If set, gather JIT throughput data and write to this file.") -RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogCsv, W("JitTimeLogCsv"), "If set, gather JIT throughput data and write to a CSV file. This mode must be used in internal retail builds.") RETAIL_CONFIG_STRING_INFO(INTERNAL_JitFuncInfoLogFile, W("JitFuncInfoLogFile"), "If set, gather JIT function info and write to this file.") CONFIG_DWORD_INFO(INTERNAL_JitVerificationDisable, W("JitVerificationDisable"), 0, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitLockWrite, W("JitLockWrite"), 0, "Force all volatile writes to be 'locked'") @@ -363,34 +344,6 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_MultiCoreJitNoProfileGather, W("MultiCoreJitNo #endif -#ifdef FEATURE_INTERPRETER -/// -/// Interpreter -/// -RETAIL_CONFIG_STRING_INFO(INTERNAL_Interpret, W("Interpret"), "Selectively uses the interpreter to execute the specified methods") -RETAIL_CONFIG_STRING_INFO(INTERNAL_InterpretExclude, W("InterpretExclude"), "Excludes the specified methods from the set selected by 'Interpret'") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterMethHashMin, W("InterpreterMethHashMin"), 0, "Only interpret methods selected by 'Interpret' whose hash is at least this value. or after nth") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterMethHashMax, W("InterpreterMethHashMax"), UINT32_MAX, "If non-zero, only interpret methods selected by 'Interpret' whose hash is at most this value") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterStubMin, W("InterpreterStubMin"), 0, "Only interpret methods selected by 'Interpret' whose stub num is at least this value.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterStubMax, W("InterpreterStubMax"), UINT32_MAX, "If non-zero, only interpret methods selected by 'Interpret' whose stub number is at most this value.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterJITThreshold, W("InterpreterJITThreshold"), 10, "The number of times a method should be interpreted before being JITted") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterDoLoopMethods, W("InterpreterDoLoopMethods"), 0, "If set, don't check for loops, start by interpreting *all* methods") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterUseCaching, W("InterpreterUseCaching"), 1, "If non-zero, use the caching mechanism.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterLooseRules, W("InterpreterLooseRules"), 1, "If non-zero, allow ECMA spec violations required by managed C++.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterPrintPostMortem, W("InterpreterPrintPostMortem"), 0, "Prints summary information about the execution to the console") -RETAIL_CONFIG_STRING_INFO(INTERNAL_InterpreterLogFile, W("InterpreterLogFile"), "If non-null, append interpreter logging to this file, else use stdout") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_DumpInterpreterStubs, W("DumpInterpreterStubs"), 0, "Prints all interpreter stubs that are created to the console") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterEntries, W("TraceInterpreterEntries"), 0, "Logs entries to interpreted methods to the console") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterIL, W("TraceInterpreterIL"), 0, "Logs individual instructions of interpreted methods to the console") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterOstack, W("TraceInterpreterOstack"), 0, "Logs operand stack after each IL instruction of interpreted methods to the console") -CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterVerbose, W("TraceInterpreterVerbose"), 0, "Logs interpreter progress with detailed messages to the console") -CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterJITTransition, W("TraceInterpreterJITTransition"), 0, "Logs when the interpreter determines a method should be JITted") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ForceInterpreter, W("ForceInterpreter"), 0, "If non-zero, force the interpreter to be used") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterHWIntrinsicsIsSupportedFalse, W("InterpreterHWIntrinsicsIsSupportedFalse"), 0, "If non-zero, force get_IsSupported to return false for hardware intrinsics") // for internal testing purposes -#endif -// The JIT queries this ConfigDWORD but it doesn't know if FEATURE_INTERPRETER is enabled -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterFallback, W("InterpreterFallback"), 0, "Fallback to the interpreter when the JIT compiler fails") - /// /// Loader heap /// @@ -421,8 +374,6 @@ CONFIG_DWORD_INFO(INTERNAL_MD_ApplyDeltaBreak, W("MD_ApplyDeltaBreak"), 0, "ASSE RETAIL_CONFIG_DWORD_INFO(INTERNAL_AssertOnBadImageFormat, W("AssertOnBadImageFormat"), 0, "ASSERT when invalid MD read") RETAIL_CONFIG_DWORD_INFO(INTERNAL_MD_DeltaCheck, W("MD_DeltaCheck"), 1, "Some checks of GUID when applying EnC (?)") CONFIG_DWORD_INFO(INTERNAL_MD_EncDelta, W("MD_EncDelta"), 0, "Forces EnC Delta format in MD (?)") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_MD_ForceNoColDesSharing, W("MD_ForceNoColDesSharing"), 0, "Don't know - the only usage I could find is #if 0 (?)") -CONFIG_DWORD_INFO(INTERNAL_MD_KeepKnownCA, W("MD_KeepKnownCA"), 0, "Something with known CAs (?)") CONFIG_DWORD_INFO(INTERNAL_MD_MiniMDBreak, W("MD_MiniMDBreak"), 0, "ASSERT when creating CMiniMdRw class") CONFIG_DWORD_INFO(INTERNAL_MD_PreSaveBreak, W("MD_PreSaveBreak"), 0, "ASSERT when calling CMiniMdRw::PreSave") CONFIG_DWORD_INFO(INTERNAL_MD_RegMetaBreak, W("MD_RegMetaBreak"), 0, "ASSERT when creating RegMeta class") @@ -444,12 +395,6 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_SpinLimitConstant, W("SpinLimitConstant"), 0x0 RETAIL_CONFIG_DWORD_INFO(EXTERNAL_SpinRetryCount, W("SpinRetryCount"), 0xA, "Hex value specifying the number of times the entire spin process is repeated (when applicable)") RETAIL_CONFIG_DWORD_INFO(INTERNAL_Monitor_SpinCount, W("Monitor_SpinCount"), 0x1e, "Hex value specifying the maximum number of spin iterations Monitor may perform upon contention on acquiring the lock before waiting.") -/// -/// Native Binder -/// - -CONFIG_DWORD_INFO(INTERNAL_SymDiffDump, W("SymDiffDump"), 0, "Used to create the map file while binding the assembly. Used by SemanticDiffer") - /// /// Profiling API / ETW /// @@ -470,8 +415,6 @@ RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_ProfAPI_ProfilerCompatibilitySetting, W("P RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_DetachMinSleepMs, W("ProfAPI_DetachMinSleepMs"), 0, "The minimum time, in milliseconds, the CLR will wait before checking whether a profiler that is in the process of detaching is ready to be unloaded.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_DetachMaxSleepMs, W("ProfAPI_DetachMaxSleepMs"), 0, "The maximum time, in milliseconds, the CLR will wait before checking whether a profiler that is in the process of detaching is ready to be unloaded.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_RejitOnAttach, W("ProfApi_RejitOnAttach"), 1, "Enables the ability for profilers to rejit methods on attach.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_InliningTracking, W("ProfApi_InliningTracking"), 1, "Enables the runtime's tracking of inlining for profiler ReJIT.") -CONFIG_DWORD_INFO(INTERNAL_ProfAPI_EnableRejitDiagnostics, W("ProfAPI_EnableRejitDiagnostics"), 0, "Enable extra dumping to stdout of rejit structures") CONFIG_DWORD_INFO(INTERNAL_ProfAPIFault, W("ProfAPIFault"), 0, "Test-only bitmask to inject various types of faults in the profapi code") CONFIG_DWORD_INFO(INTERNAL_TestOnlyAllowedEventMask, W("TestOnlyAllowedEventMask"), 0, "Test-only bitmask to allow profiler tests to override CLR enforcement of COR_PRF_ALLOWABLE_AFTER_ATTACH and COR_PRF_MONITOR_IMMUTABLE") CONFIG_DWORD_INFO(INTERNAL_TestOnlyEnableICorProfilerInfo, W("ProfAPI_TestOnlyEnableICorProfilerInfo"), 0, "Test-only flag to allow attaching profiler tests to call ICorProfilerInfo interface, which would otherwise be disallowed for attaching profilers") @@ -479,13 +422,12 @@ CONFIG_DWORD_INFO(INTERNAL_TestOnlyEnableObjectAllocatedHook, W("TestOnlyEnableO CONFIG_DWORD_INFO(INTERNAL_TestOnlyEnableSlowELTHooks, W("TestOnlyEnableSlowELTHooks"), 0, "Test-only flag that forces CLR to initialize on startup as if slow-ELT were requested, to enable post-attach ELT functionality.") RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_ETW_ObjectAllocationEventsPerTypePerSec, W("ETW_ObjectAllocationEventsPerTypePerSec"), "Desired number of GCSampledObjectAllocation ETW events to be logged per type per second. If 0, then the default built in to the implementation for the enabled event (e.g., High, Low), will be used.") -RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_ProfAPI_ValidateNGENInstrumentation, W("ProfAPI_ValidateNGENInstrumentation"), 0, "This flag enables additional validations when using the IMetaDataEmit APIs for NGEN'ed images to ensure only supported edits are made.") #ifdef FEATURE_PERFMAP RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapEnabled, W("PerfMapEnabled"), 0, "This flag is used on Linux and macOS to enable writing /tmp/perf-$pid.map. It is disabled by default") -RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to /tmp", CLRConfig::LookupOptions::TrimWhiteSpaceFromStringValue) RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapIgnoreSignal, W("PerfMapIgnoreSignal"), 0, "When perf map is enabled, this option will configure the specified signal to be accepted and ignored as a marker in the perf logs. It is disabled by default") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapShowOptimizationTiers, W("PerfMapShowOptimizationTiers"), 1, "Shows optimization tiers in the perf map for methods, as part of the symbol name. Useful for seeing separate stack frames for different optimization tiers of each method.") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapStubGranularity, W("PerfMapStubGranularity"), 0, "Report stubs with varying amounts of granularity (low bit being zero indicates attempt to group all stubs of a type together) (second lowest bit being non-zero records stubs at individual allocation sites, which is more expensive, but also more accurate).") #endif RETAIL_CONFIG_STRING_INFO(EXTERNAL_StartupDelayMS, W("StartupDelayMS"), "") @@ -507,48 +449,17 @@ CONFIG_DWORD_INFO(INTERNAL_DiagnosticSuspend, W("DiagnosticSuspend"), 0, "") CONFIG_DWORD_INFO(INTERNAL_SuspendDeadlockTimeout, W("SuspendDeadlockTimeout"), 40000, "") CONFIG_DWORD_INFO(INTERNAL_SuspendThreadDeadlockTimeoutMs, W("SuspendThreadDeadlockTimeoutMs"), 2000, "") RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadSuspendInjection, W("INTERNAL_ThreadSuspendInjection"), 1, "Specifies whether to inject activations for thread suspension on Unix") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterruptibleCallSites, W("InterruptibleCallSites"), 1, "Specifies whether to allow asynchronous thread interruptions at call sites (requires GCInfo v3)") /// /// Thread (miscellaneous) /// -RETAIL_CONFIG_DWORD_INFO(INTERNAL_DefaultStackSize, W("DefaultStackSize"), 0, "Stack size to use for new VM threads when thread is created with default stack size (dwStackSize == 0).") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Thread_DefaultStackSize, W("Thread_DefaultStackSize"), 0, "Stack size to use for new VM threads when thread is created with default stack size (dwStackSize == 0).") RETAIL_CONFIG_DWORD_INFO(INTERNAL_Thread_DeadThreadCountThresholdForGCTrigger, W("Thread_DeadThreadCountThresholdForGCTrigger"), 75, "In the heuristics to clean up dead threads, this threshold must be reached before triggering a GC will be considered. Set to 0 to disable triggering a GC based on dead threads.") RETAIL_CONFIG_DWORD_INFO(INTERNAL_Thread_DeadThreadGCTriggerPeriodMilliseconds, W("Thread_DeadThreadGCTriggerPeriodMilliseconds"), 1000 * 60 * 30, "In the heuristics to clean up dead threads, this much time must have elapsed since the previous max-generation GC before triggering another GC will be considered") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Thread_UseAllCpuGroups, W("Thread_UseAllCpuGroups"), 0, "Specifies whether to query and use CPU group information for determining the processor count.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Thread_AssignCpuGroups, W("Thread_AssignCpuGroups"), 1, "Specifies whether to automatically distribute threads created by the CLR across CPU Groups. Effective only when Thread_UseAllCpuGroups and GCCpuGroup are enabled.") RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ProcessorCount, W("PROCESSOR_COUNT"), 0, "Specifies the number of processors available for the process, which is returned by Environment.ProcessorCount", CLRConfig::LookupOptions::ParseIntegerAsBase10) -/// -/// Threadpool -/// -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_ForceMinWorkerThreads, W("ThreadPool_ForceMinWorkerThreads"), 0, "Overrides the MinThreads setting for the ThreadPool worker pool") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_ForceMaxWorkerThreads, W("ThreadPool_ForceMaxWorkerThreads"), 0, "Overrides the MaxThreads setting for the ThreadPool worker pool") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DisableStarvationDetection, W("ThreadPool_DisableStarvationDetection"), 0, "Disables the ThreadPool feature that forces new threads to be added when workitems run for too long") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DebugBreakOnWorkerStarvation, W("ThreadPool_DebugBreakOnWorkerStarvation"), 0, "Breaks into the debugger if the ThreadPool detects work queue starvation") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_EnableWorkerTracking, W("ThreadPool_EnableWorkerTracking"), 0, "Enables extra expensive tracking of how many workers threads are working simultaneously") -#ifdef TARGET_ARM64 -// Spinning scheme is currently different on ARM64 -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("ThreadPool_UnfairSemaphoreSpinLimit"), 0x32, "Maximum number of spins per processor a thread pool worker thread performs before waiting for work") -#else // !TARGET_ARM64 -RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("ThreadPool_UnfairSemaphoreSpinLimit"), 0x46, "Maximum number of spins a thread pool worker thread performs before waiting for work") -#endif // TARGET_ARM64 - -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_Disable, W("HillClimbing_Disable"), 0, "Disables hill climbing for thread adjustments in the thread pool"); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WavePeriod, W("HillClimbing_WavePeriod"), 4, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_TargetSignalToNoiseRatio, W("HillClimbing_TargetSignalToNoiseRatio"), 300, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_ErrorSmoothingFactor, W("HillClimbing_ErrorSmoothingFactor"), 1, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WaveMagnitudeMultiplier, W("HillClimbing_WaveMagnitudeMultiplier"), 100, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxWaveMagnitude, W("HillClimbing_MaxWaveMagnitude"), 20, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WaveHistorySize, W("HillClimbing_WaveHistorySize"), 8, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_Bias, W("HillClimbing_Bias"), 15, "The 'cost' of a thread. 0 means drive for increased throughput regardless of thread count; higher values bias more against higher thread counts."); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxChangePerSecond, W("HillClimbing_MaxChangePerSecond"), 4, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxChangePerSample, W("HillClimbing_MaxChangePerSample"), 20, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxSampleErrorPercent, W("HillClimbing_MaxSampleErrorPercent"), 15, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_SampleIntervalLow, W("HillClimbing_SampleIntervalLow"), 10, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_SampleIntervalHigh, W("HillClimbing_SampleIntervalHigh"), 200, ""); -RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_GainExponent, W("HillClimbing_GainExponent"), 200, "The exponent to apply to the gain, times 100. 100 means to use linear gain, higher values will enhance large moves and damp small ones."); - /// /// Tiered Compilation /// @@ -567,11 +478,11 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_GainExponent, #endif // _DEBUG RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TieredCompilation, W("TieredCompilation"), 1, "Enables tiered compilation") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TC_QuickJit, W("TC_QuickJit"), 1, "For methods that would be jitted, enable using quick JIT when appropriate.") -#if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) +#ifdef FEATURE_ON_STACK_REPLACEMENT RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TC_QuickJitForLoops, W("TC_QuickJitForLoops"), 1, "When quick JIT is enabled, quick JIT may also be used for methods that contain loops.") -#else // !(defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)) || defined(TARGET_RISCV64) +#else // FEATURE_ON_STACK_REPLACEMENT RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TC_QuickJitForLoops, W("TC_QuickJitForLoops"), 0, "When quick JIT is enabled, quick JIT may also be used for methods that contain loops.") -#endif // defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) +#endif // FEATURE_ON_STACK_REPLACEMENT RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TC_AggressiveTiering, W("TC_AggressiveTiering"), 0, "Transition through tiers aggressively.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TC_CallCountThreshold, W("TC_CallCountThreshold"), TC_CallCountThreshold, "Number of times a method must be called in tier 0 after which it is promoted to the next tier.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TC_CallCountingDelayMs, W("TC_CallCountingDelayMs"), TC_CallCountingDelayMs, "A perpetual delay in milliseconds that is applied to call counting in tier 0 and jitting at higher tiers, while there is startup-like activity.") @@ -642,6 +553,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_VirtualCallStubLogging, W("VirtualCallStubLogg CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubMissCount, W("VirtualCallStubMissCount"), 100, "Used only when STUB_LOGGING is defined, which by default is not.") CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubResetCacheCounter, W("VirtualCallStubResetCacheCounter"), 0, "Used only when STUB_LOGGING is defined, which by default is not.") CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubResetCacheIncr, W("VirtualCallStubResetCacheIncr"), 0, "Used only when STUB_LOGGING is defined, which by default is not.") +CONFIG_DWORD_INFO(INTERNAL_UseCachedInterfaceDispatch, W("UseCachedInterfaceDispatch"), 0, "If cached interface dispatch is compiled in, use that instead of virtual stub dispatch") /// /// Watson @@ -655,7 +567,6 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_DbgEnableMiniDump, W("DbgEnableMiniDump"), 0, RETAIL_CONFIG_STRING_INFO(INTERNAL_DbgMiniDumpName, W("DbgMiniDumpName"), "Crash dump name") RETAIL_CONFIG_DWORD_INFO(INTERNAL_DbgMiniDumpType, W("DbgMiniDumpType"), 0, "Crash dump type: 1 normal, 2 withheap, 3 triage, 4 full") RETAIL_CONFIG_DWORD_INFO(INTERNAL_CreateDumpDiagnostics, W("CreateDumpDiagnostics"), 0, "Enable crash dump generation diagnostic logging") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_EnableDumpOnSigTerm, W("EnableDumpOnSigTerm"), 0, "Enable crash dump generation on SIGTERM") /// /// R2R @@ -667,8 +578,6 @@ RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "N #if defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT) RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableEventLog, W("EnableEventLog"), 0, "Enable/disable use of EnableEventLogging mechanism ") // Off by default -RETAIL_CONFIG_STRING_INFO(INTERNAL_EventSourceFilter, W("EventSourceFilter"), "") -RETAIL_CONFIG_STRING_INFO(INTERNAL_EventNameFilter, W("EventNameFilter"), "") #endif //defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT) /// @@ -683,7 +592,6 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_EnableRCWCleanupOnSTAShutdown, W("EnableRCWCle // EventPipe // RETAIL_CONFIG_DWORD_INFO(INTERNAL_EnableEventPipe, W("EnableEventPipe"), 0, "Enable/disable event pipe. Non-zero values enable tracing.") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeNetTraceFormat, W("EventPipeNetTraceFormat"), 1, "Enable/disable using the newer nettrace file format.") RETAIL_CONFIG_STRING_INFO(INTERNAL_EventPipeOutputPath, W("EventPipeOutputPath"), "The full path excluding file name for the trace file that will be written when DOTNET_EnableEventPipe=1") RETAIL_CONFIG_STRING_INFO(INTERNAL_EventPipeConfig, W("EventPipeConfig"), "Configuration for EventPipe.") RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeRundown, W("EventPipeRundown"), 1, "Enable/disable eventpipe rundown.") @@ -724,7 +632,6 @@ RETAIL_CONFIG_STRING_INFO(EXTERNAL_DOTNET_DiagnosticPorts, W("DiagnosticPorts"), // LTTng // RETAIL_CONFIG_STRING_INFO(INTERNAL_LTTngConfig, W("LTTngConfig"), "Configuration for LTTng.") -RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_LTTng, W("LTTng"), 1, "If DOTNET_LTTng is set to 0, this will prevent the LTTng library from being loaded at runtime") // // Executable code @@ -747,51 +654,43 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_GDBJitEmitDebugFrame, W("GDBJitEmitDebugFrame" #endif RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_MaxVectorTBitWidth, W("MaxVectorTBitWidth"), 0, "The maximum decimal width, in bits, that Vector is allowed to be. A value less than 128 is treated as the system default.", CLRConfig::LookupOptions::ParseIntegerAsBase10) +#if defined(TARGET_AMD64) || defined(TARGET_X86) +RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_PreferredVectorBitWidth, W("PreferredVectorBitWidth"), 0, "The maximum decimal width, in bits, of fixed-width vectors that may be considered hardware accelerated. A value less than 128 is treated as the system default.", CLRConfig::LookupOptions::ParseIntegerAsBase10) +#endif // defined(TARGET_AMD64) || defined(TARGET_X86) // // Hardware Intrinsic ISAs; keep in sync with jitconfigvalues.h // -#if defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) +#if defined(TARGET_LOONGARCH64) //TODO: should implement LoongArch64's features. -//TODO-RISCV64-CQ: should implement RISCV64's features. RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableHWIntrinsic, W("EnableHWIntrinsic"), 0, "Allows Base+ hardware intrinsics to be disabled") #else RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableHWIntrinsic, W("EnableHWIntrinsic"), 1, "Allows Base+ hardware intrinsics to be disabled") -#endif // defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) +#endif // defined(TARGET_LOONGARCH64) #if defined(TARGET_AMD64) || defined(TARGET_X86) -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAES, W("EnableAES"), 1, "Allows AES+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX, W("EnableAVX"), 1, "Allows AVX+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX2, W("EnableAVX2"), 1, "Allows AVX2+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512BW, W("EnableAVX512BW"), 1, "Allows AVX512BW+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512BW_VL, W("EnableAVX512BW_VL"), 1, "Allows AVX512BW_VL+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512CD, W("EnableAVX512CD"), 1, "Allows AVX512CD+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512CD_VL, W("EnableAVX512CD_VL"), 1, "Allows AVX512CD_VL+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512DQ, W("EnableAVX512DQ"), 1, "Allows AVX512DQ+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512DQ_VL, W("EnableAVX512DQ_VL"), 1, "Allows AVX512DQ_VL+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512F, W("EnableAVX512F"), 1, "Allows AVX512F+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512F_VL, W("EnableAVX512F_VL"), 1, "Allows AVX512F_VL+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VBMI, W("EnableAVX512VBMI"), 1, "Allows AVX512VBMI+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VBMI_VL, W("EnableAVX512VBMI_VL"), 1, "Allows AVX512VBMI_VL+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v1, W("EnableAVX10v1"), 1, "Allows AVX10v1+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVXVNNI, W("EnableAVXVNNI"), 1, "Allows AVXVNNI+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableBMI1, W("EnableBMI1"), 1, "Allows BMI1+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableBMI2, W("EnableBMI2"), 1, "Allows BMI2+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableFMA, W("EnableFMA"), 1, "Allows FMA+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableLZCNT, W("EnableLZCNT"), 1, "Allows LZCNT+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnablePCLMULQDQ, W("EnablePCLMULQDQ"), 1, "Allows PCLMULQDQ+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableMOVBE, W("EnableMOVBE"), 1, "Allows MOVBE+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnablePOPCNT, W("EnablePOPCNT"), 1, "Allows POPCNT+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE, W("EnableSSE"), 1, "Allows SSE+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE2, W("EnableSSE2"), 1, "Allows SSE2+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE3, W("EnableSSE3"), 1, "Allows SSE3+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE3_4, W("EnableSSE3_4"), 1, "Allows SSE3+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE41, W("EnableSSE41"), 1, "Allows SSE4.1+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE42, W("EnableSSE42"), 1, "Allows SSE4.2+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSSE3, W("EnableSSSE3"), 1, "Allows SSSE3+ hardware intrinsics to be disabled") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableX86Serialize, W("EnableX86Serialize"), 1, "Allows X86Serialize+ hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE42, W("EnableSSE42"), 1, "Allows SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX, W("EnableAVX"), 1, "Allows AVX and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX2, W("EnableAVX2"), 1, "Allows AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512, W("EnableAVX512"), 1, "Allows AVX512 F+BW+CD+DQ+VL and depdendent hardware intrinsics to be disabled") + +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512v2, W("EnableAVX512v2"), 1, "Allows AVX512 IFMA+VBMI and depdendent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512v3, W("EnableAVX512v3"), 1, "Allows AVX512 BITALG+VBMI2+VNNI+VPOPCNTDQ and depdendent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v1, W("EnableAVX10v1"), 1, "Allows AVX10v1 and depdendent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v2, W("EnableAVX10v2"), 0, "Allows AVX10v2 and depdendent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAPX, W("EnableAPX"), 0, "Allows APX and dependent features to be disabled") + +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAES, W("EnableAES"), 1, "Allows AES, PCLMULQDQ, and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VP2INTERSECT, W("EnableAVX512VP2INTERSECT"), 1, "Allows AVX512VP2INTERSECT and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVXIFMA, W("EnableAVXIFMA"), 1, "Allows AVXIFMA and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVXVNNI, W("EnableAVXVNNI"), 1, "Allows AVXVNNI and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVXVNNIINT, W("EnableAVXVNNIINT"), 1, "Allows VEX versions (AVXVNNI8 & AVXVNNIINT16) hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableGFNI, W("EnableGFNI"), 1, "Allows GFNI and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSHA, W("EnableSHA"), 1, "Allows SHA and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableVAES, W("EnableVAES"), 1, "Allows VAES, VPCLMULQDQ, and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableWAITPKG, W("EnableWAITPKG"), 1, "Allows WAITPKG and dependent hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableX86Serialize, W("EnableX86Serialize"), 1, "Allows X86Serialize and dependent hardware intrinsics to be disabled") #elif defined(TARGET_ARM64) -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64AdvSimd, W("EnableArm64AdvSimd"), 1, "Allows Arm64 AdvSimd+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Aes, W("EnableArm64Aes"), 1, "Allows Arm64 Aes+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Atomics, W("EnableArm64Atomics"), 1, "Allows Arm64 Atomics+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Crc32, W("EnableArm64Crc32"), 1, "Allows Arm64 Crc32+ hardware intrinsics to be disabled") @@ -803,8 +702,15 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Sha256, W("EnableArm64Sh RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Rcpc, W("EnableArm64Rcpc"), 1, "Allows Arm64 Rcpc+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Rcpc2, W("EnableArm64Rcpc2"), 1, "Allows Arm64 Rcpc2+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Sve, W("EnableArm64Sve"), 1, "Allows Arm64 SVE hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableArm64Sve2, W("EnableArm64Sve2"), 1, "Allows Arm64 SVE2 hardware intrinsics to be disabled") +#elif defined(TARGET_RISCV64) +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableRiscV64Zba, W("EnableRiscV64Zba"), 1, "Allows RiscV64 Zba hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableRiscV64Zbb, W("EnableRiscV64Zbb"), 1, "Allows RiscV64 Zbb hardware intrinsics to be disabled") #endif +// Runtime-async +RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 0, "Enables runtime async method support") + /// /// Uncategorized /// @@ -821,28 +727,16 @@ CONFIG_DWORD_INFO(INTERNAL_ActivatePatchSkip, W("ActivatePatchSkip"), 0, "Allows CONFIG_DWORD_INFO(INTERNAL_AlwaysUseMetadataInterfaceMapLayout, W("AlwaysUseMetadataInterfaceMapLayout"), 0, "Used for debugging generic interface map layout.") CONFIG_DWORD_INFO(INTERNAL_AssertOnUnneededThis, W("AssertOnUnneededThis"), 0, "While the ConfigDWORD is unnecessary, the contained ASSERT should be kept. This may result in some work tracking down violating MethodDescCallSites.") CONFIG_DWORD_INFO(INTERNAL_AssertStacktrace, W("AssertStacktrace"), 1, "") -CONFIG_DWORD_INFO(INTERNAL_CPUFamily, W("CPUFamily"), 0xFFFFFFFF, "") -CONFIG_DWORD_INFO(INTERNAL_CPUFeatures, W("CPUFeatures"), 0xFFFFFFFF, "") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DisableConfigCache, W("DisableConfigCache"), 0, "Used to disable the \"probabilistic\" config cache, which walks through the appropriate config registry keys on init and probabilistically keeps track of which exist.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DisableStackwalkCache, W("DisableStackwalkCache"), 0, "") -RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DoubleArrayToLargeObjectHeap, W("DoubleArrayToLargeObjectHeap"), 0, "Controls double[] placement") CONFIG_STRING_INFO(INTERNAL_DumpOnClassLoad, W("DumpOnClassLoad"), "Dumps information about loaded class to log.") CONFIG_DWORD_INFO(INTERNAL_ExpandAllOnLoad, W("ExpandAllOnLoad"), 0, "") CONFIG_DWORD_INFO(INTERNAL_ForceRelocs, W("ForceRelocs"), 0, "") CONFIG_DWORD_INFO(INTERNAL_GenerateLongJumpDispatchStubRatio, W("GenerateLongJumpDispatchStubRatio"), 0, "Useful for testing VSD on AMD64") -CONFIG_DWORD_INFO(INTERNAL_HostManagerConfig, W("HostManagerConfig"), (DWORD)-1, "") CONFIG_DWORD_INFO(INTERNAL_HostTestThreadAbort, W("HostTestThreadAbort"), 0, "") CONFIG_STRING_INFO(INTERNAL_InvokeHalt, W("InvokeHalt"), "Throws an assert when the given method is invoked through reflection.") -CONFIG_DWORD_INFO(INTERNAL_MaxStubUnwindInfoSegmentSize, W("MaxStubUnwindInfoSegmentSize"), 0, "") -CONFIG_DWORD_INFO(INTERNAL_MessageDebugOut, W("MessageDebugOut"), 0, "") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NativeImageRequire, W("NativeImageRequire"), 0, "") -CONFIG_DWORD_INFO(INTERNAL_NestedEhOom, W("NestedEhOom"), 0, "") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NoProcedureSplitting, W("NoProcedureSplitting"), 0, "") -CONFIG_DWORD_INFO(INTERNAL_PauseOnLoad, W("PauseOnLoad"), 0, "Stops in SystemDomain::init. I think it can be removed.") CONFIG_DWORD_INFO(INTERNAL_PerfAllocsSizeThreshold, W("PerfAllocsSizeThreshold"), 0x3FFFFFFF, "Log facility LF_GCALLOC logs object allocations. This flag controls which ones also log stacktraces. Predates ClrProfiler.") CONFIG_DWORD_INFO(INTERNAL_PerfNumAllocsThreshold, W("PerfNumAllocsThreshold"), 0x3FFFFFFF, "Log facility LF_GCALLOC logs object allocations. This flag controls which ones also log stacktraces. Predates ClrProfiler.") CONFIG_STRING_INFO(INTERNAL_PerfTypesToLog, W("PerfTypesToLog"), "Log facility LF_GCALLOC logs object allocations. This flag controls which ones also log stacktraces. Predates ClrProfiler.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Prepopulate1, W("Prepopulate1"), 1, "") CONFIG_STRING_INFO(INTERNAL_PrestubGC, W("PrestubGC"), "") CONFIG_STRING_INFO(INTERNAL_PrestubHalt, W("PrestubHalt"), "") RETAIL_CONFIG_STRING_INFO(EXTERNAL_RestrictedGCStressExe, W("RestrictedGCStressExe"), "") @@ -852,7 +746,6 @@ CONFIG_DWORD_INFO(INTERNAL_SBDumpOnNewIndex, W("SBDumpOnNewIndex"), 0, "Used for CONFIG_DWORD_INFO(INTERNAL_SBDumpOnResize, W("SBDumpOnResize"), 0, "Used for Syncblock debugging. It's been a while since any of those have been used.") CONFIG_DWORD_INFO(INTERNAL_SBDumpStyle, W("SBDumpStyle"), 0, "Used for Syncblock debugging. It's been a while since any of those have been used.") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_SleepOnExit, W("SleepOnExit"), 0, "Used for lrak detection. I'd say deprecated by umdh.") -CONFIG_DWORD_INFO(INTERNAL_StubLinkerUnwindInfoVerificationOn, W("StubLinkerUnwindInfoVerificationOn"), 0, "") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_SuccessExit, W("SuccessExit"), 0, "") RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TestDataConsistency, W("TestDataConsistency"), FALSE, "Allows ensuring the left side is not holding locks (and may thus be in an inconsistent state) when inspection occurs") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ThreadGuardPages, W("ThreadGuardPages"), 0, "") @@ -861,7 +754,6 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ThreadGuardPages, W("ThreadGuardPages"), 0, "" RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TraceWrap, W("TraceWrap"), 0, "") #endif -CONFIG_DWORD_INFO(INTERNAL_VerifierOff, W("VerifierOff"), 0, "") // ** // PLEASE MOVE ANY CONFIG SWITCH YOU OWN OUT OF THIS SECTION INTO A CATEGORY ABOVE // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrhost.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrhost.h index a1d22b6ee..5971ca2b4 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrhost.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrhost.h @@ -22,24 +22,26 @@ using std::nothrow; #include "staticcontract.h" #include "predeftlsslot.h" #include "safemath.h" -#include "debugreturn.h" #include "yieldprocessornormalized.h" #if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE) #define _DEBUG_IMPL 1 #endif -#define BEGIN_PRESERVE_LAST_ERROR \ - { \ - DWORD __dwLastError = ::GetLastError(); \ - DEBUG_ASSURE_NO_RETURN_BEGIN(PRESERVE_LAST_ERROR); \ - { +struct PreserveLastErrorHolder +{ + PreserveLastErrorHolder() + { + m_dwLastError = ::GetLastError(); + } -#define END_PRESERVE_LAST_ERROR \ - } \ - DEBUG_ASSURE_NO_RETURN_END(PRESERVE_LAST_ERROR); \ - ::SetLastError(__dwLastError); \ + ~PreserveLastErrorHolder() + { + ::SetLastError(m_dwLastError); } +private: + DWORD m_dwLastError; +}; // // TRASH_LASTERROR macro sets bogus last error in debug builds to help find places that fail to save it diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrinternal.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrinternal.idl index e2efa1f68..f940748a1 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrinternal.idl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrinternal.idl @@ -61,7 +61,7 @@ typedef enum { CRST_UNSAFE_COOPGC = 0x4, // AVOID THIS! Lock must be taken in cooperative mode. CRST_UNSAFE_ANYMODE = 0x8, // AVOID THIS! Lock can be taken in either GC mode. CRST_DEBUGGER_THREAD = 0x10, // This lock can be taken on the debugger's helper thread. - CRST_HOST_BREAKABLE = 0x20, // This lock is held while running managed code. It can be terminated by a host. + // CRST_UNUSED = 0x20, // CRST_UNUSED = 0x40, CRST_TAKEN_DURING_SHUTDOWN = 0x80, // This lock is taken during the shutdown sequence in EEShutdown(helper) CRST_GC_NOTRIGGER_WHEN_TAKEN = 0x100, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrnt.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrnt.h index 2d935a953..f9b63c824 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrnt.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrnt.h @@ -211,7 +211,7 @@ RtlpGetFunctionEndAddress ( _In_ TADDR ImageBase ) { - PUNWIND_INFO pUnwindInfo = (PUNWIND_INFO)(ImageBase + FunctionEntry->UnwindData); + DPTR(UNWIND_INFO) pUnwindInfo = dac_cast(ImageBase + FunctionEntry->UnwindData); return FunctionEntry->BeginAddress + pUnwindInfo->FunctionLength; } @@ -501,4 +501,52 @@ RtlVirtualUnwind( #endif // TARGET_RISCV64 +#ifdef TARGET_WASM +// +// Define unwind information flags. +// + +#define UNW_FLAG_NHANDLER 0x0 /* any handler */ +#define UNW_FLAG_EHANDLER 0x1 /* filter handler */ +#define UNW_FLAG_UHANDLER 0x2 /* unwind handler */ + +inline PEXCEPTION_ROUTINE +RtlVirtualUnwind ( + _In_ DWORD HandlerType, + _In_ DWORD ImageBase, + _In_ DWORD ControlPc, + _In_ PRUNTIME_FUNCTION FunctionEntry, + __inout PT_CONTEXT ContextRecord, + _Out_ PVOID *HandlerData, + _Out_ PDWORD EstablisherFrame, + __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers + ) +{ + PORTABILITY_ASSERT("The function RtlVirtualUnwind is not implemented on wasm"); + return nullptr; +} + +FORCEINLINE +ULONG +RtlpGetFunctionEndAddress ( + _In_ PT_RUNTIME_FUNCTION FunctionEntry, + _In_ TADDR ImageBase + ) +{ + PORTABILITY_ASSERT("The function RtlpGetFunctionEndAddress is not implemented on wasm"); + return 0; +} + +#define RUNTIME_FUNCTION__BeginAddress(FunctionEntry) ((FunctionEntry)->BeginAddress) +#define RUNTIME_FUNCTION__SetBeginAddress(FunctionEntry,address) ((FunctionEntry)->BeginAddress = (address)) + +#define RUNTIME_FUNCTION__EndAddress(FunctionEntry, ImageBase) (RtlpGetFunctionEndAddress(FunctionEntry, (ULONG64)(ImageBase))) + +#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf,address) do { (prf)->UnwindData = (address); } while (0) + +typedef struct _UNWIND_INFO { + // dummy +} UNWIND_INFO, *PUNWIND_INFO; +#endif + #endif // CLRNT_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrtypes.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrtypes.h index 9094e4932..408cdf540 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/clrtypes.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/clrtypes.h @@ -338,7 +338,7 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment) return (value+alignment-1)&~(UINT64)(alignment-1); } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__wasm__) inline SIZE_T AlignUp(SIZE_T value, UINT alignment) { STATIC_CONTRACT_LEAF; @@ -370,6 +370,15 @@ inline UINT64 AlignDown(UINT64 value, UINT alignment) return (value&~(UINT64)(alignment-1)); } +#ifdef __wasm__ +inline uintptr_t AlignDown(uintptr_t value, UINT alignment) +{ + STATIC_CONTRACT_LEAF; + STATIC_CONTRACT_SUPPORTS_DAC; + return (value&~(uintptr_t)(alignment-1)); +} +#endif + #ifdef __APPLE__ inline SIZE_T AlignDown(SIZE_T value, UINT alignment) { @@ -399,13 +408,13 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment) return (UINT) (AlignUp(value, alignment) - value); } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__wasm__) inline UINT AlignmentPad(SIZE_T value, UINT alignment) { STATIC_CONTRACT_WRAPPER; return (UINT) (AlignUp(value, alignment) - value); } -#endif // __APPLE__ +#endif // __APPLE__ || __wasm__ inline UINT AlignmentTrim(UINT value, UINT alignment) { @@ -432,7 +441,7 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment) return ((UINT)value)&(alignment-1); } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__wasm__) inline UINT AlignmentTrim(SIZE_T value, UINT alignment) { STATIC_CONTRACT_LEAF; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/complex.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/complex.h deleted file mode 100644 index eb2082426..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/complex.h +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// -// complex.h -// - -// -// Defines a basic complex number data type. We cannot use the standard C++ library's -// complex implementation, because the CLR links to the wrong CRT. -// - -#ifndef _COMPLEX_H_ -#define _COMPLEX_H_ - -#include - -// -// Default compilation mode is /fp:precise, which disables fp intrinsics. This causes us to pull in FP stuff (sqrt,etc.) from -// The CRT, and increases our download size. We don't need the extra precision this gets us, so let's switch to -// the intrinsic versions. -// -#ifdef _MSC_VER -#pragma float_control(precise, off, push) -#endif - - -class Complex -{ -public: - double r; - double i; - - Complex() : r(0), i(0) {} - Complex(double real) : r(real), i(0) {} - Complex(double real, double imag) : r(real), i(imag) {} - Complex(const Complex& other) : r(other.r), i(other.i) {} -}; - -inline Complex operator+(Complex left, Complex right) -{ - LIMITED_METHOD_CONTRACT; - return Complex(left.r + right.r, left.i + right.i); -} - -inline Complex operator-(Complex left, Complex right) -{ - LIMITED_METHOD_CONTRACT; - return Complex(left.r - right.r, left.i - right.i); -} - -inline Complex operator*(Complex left, Complex right) -{ - LIMITED_METHOD_CONTRACT; - return Complex( - left.r * right.r - left.i * right.i, - left.r * right.i + left.i * right.r); -} - -inline Complex operator/(Complex left, Complex right) -{ - LIMITED_METHOD_CONTRACT; - double denom = right.r * right.r + right.i * right.i; - return Complex( - (left.r * right.r + left.i * right.i) / denom, - (-left.r * right.i + left.i * right.r) / denom); -} - -inline double abs(Complex c) -{ - LIMITED_METHOD_CONTRACT; - return sqrt(c.r * c.r + c.i * c.i); -} - -#ifdef _MSC_VER -#pragma float_control(pop) -#endif - - -#endif //_COMPLEX_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.h index a8f3f6f47..383c8323b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.h @@ -233,7 +233,6 @@ #include "specstrings.h" #include "clrtypes.h" #include "check.h" -#include "debugreturn.h" #include "staticcontract.h" #ifdef ENABLE_CONTRACTS_DATA @@ -297,15 +296,9 @@ struct TakenLockInfo enum DbgStateLockType { - // EE locks (used to sync EE structures). These do not include - // CRST_HOST_BREAKABLE Crsts, and are thus not held while managed - // code runs + // EE locks (used to sync EE structures). kDbgStateLockType_EE, - // CRST_HOST_BREAKABLE Crsts. These can be held while arbitrary - // managed code runs. - kDbgStateLockType_HostBreakableCrst, - // User locks (e.g., Monitor.Enter, ReaderWriterLock class) kDbgStateLockType_User, @@ -710,7 +703,6 @@ class DebugOnlyCodeHolder // we don't recreated one on exit if its been deleted. DEBUG_NOINLINE void Enter() { - SCAN_SCOPE_BEGIN; STATIC_CONTRACT_DEBUG_ONLY; m_pClrDebugState = GetClrDebugState(); @@ -723,7 +715,6 @@ class DebugOnlyCodeHolder DEBUG_NOINLINE void Leave() { - SCAN_SCOPE_END; STATIC_CONTRACT_DEBUG_ONLY; m_pClrDebugState = CheckClrDebugState(); @@ -751,7 +742,6 @@ class AutoCleanupDebugOnlyCodeHolder : public DebugOnlyCodeHolder public: DEBUG_NOINLINE AutoCleanupDebugOnlyCodeHolder() { - SCAN_SCOPE_BEGIN; STATIC_CONTRACT_DEBUG_ONLY; Enter(); @@ -759,8 +749,6 @@ class AutoCleanupDebugOnlyCodeHolder : public DebugOnlyCodeHolder DEBUG_NOINLINE ~AutoCleanupDebugOnlyCodeHolder() { - SCAN_SCOPE_END; - Leave(); }; }; @@ -1160,7 +1148,6 @@ typedef __SafeToUsePostCondition __PostConditionOK; Contract::RanPostconditions ___ran(__FUNCTION__); \ Contract::Operation ___op = Contract::Setup; \ BOOL ___contract_enabled = FALSE; \ - DEBUG_ASSURE_NO_RETURN_BEGIN(CONTRACT) \ ___contract_enabled = Contract::EnforceContract(); \ enum {___disabled = 0}; \ if (!___contract_enabled) \ @@ -1181,10 +1168,8 @@ typedef __SafeToUsePostCondition __PostConditionOK; } \ else \ { \ - DEBUG_OK_TO_RETURN_BEGIN(CONTRACT) \ ___run_return: \ return _returnexp; \ - DEBUG_OK_TO_RETURN_END(CONTRACT) \ } \ } \ if (0) \ @@ -1226,7 +1211,6 @@ typedef __SafeToUsePostCondition __PostConditionOK; Contract::Returner<_returntype> ___returner(RETVAL); \ Contract::RanPostconditions ___ran(__FUNCTION__); \ Contract::Operation ___op = Contract::Setup; \ - DEBUG_ASSURE_NO_RETURN_BEGIN(CONTRACT) \ BOOL ___contract_enabled = Contract::EnforceContract(); \ enum {___disabled = 0}; \ { \ @@ -1244,10 +1228,8 @@ typedef __SafeToUsePostCondition __PostConditionOK; } \ else \ { \ - DEBUG_OK_TO_RETURN_BEGIN(CONTRACT) \ ___run_return: \ return _returnexp; \ - DEBUG_OK_TO_RETURN_END(CONTRACT) \ } \ } \ if (0) \ @@ -1409,7 +1391,6 @@ typedef __SafeToUsePostCondition __PostConditionOK; #define UNCHECKED(thecheck) \ do { \ - ANNOTATION_UNCHECKED(thecheck); \ enum {___disabled = 1 }; \ thecheck; \ } while(0) @@ -1460,8 +1441,7 @@ typedef __SafeToUsePostCondition __PostConditionOK; #endif // __FORCE_NORUNTIME_CONTRACTS__ -#define CONTRACT_END CONTRACTL_END \ - DEBUG_ASSURE_NO_RETURN_END(CONTRACT) \ +#define CONTRACT_END CONTRACTL_END // The final expression in the RETURN macro deserves special explanation (or something.) @@ -1496,7 +1476,7 @@ typedef __SafeToUsePostCondition __PostConditionOK; // to return and we need to ensure that we don't allow a return where one should not happen // #define RETURN \ - while (DEBUG_ASSURE_SAFE_TO_RETURN, TRUE) \ + while (TRUE) \ RETURN_BODY \ #define RETURN_VOID \ @@ -1608,7 +1588,7 @@ typedef __SafeToUsePostCondition __PostConditionOK; #define WRAPPER_NO_CONTRACT CUSTOM_WRAPPER_NO_CONTRACT(Contract) // GC_NOTRIGGER allowed but not currently enforced at runtime -#define GC_NOTRIGGER STATIC_CONTRACT_GC_NOTRIGGER +#define GC_NOTRIGGER do { STATIC_CONTRACT_GC_NOTRIGGER; } while(0) #define GC_TRIGGERS static_assert(false, "TriggersGC not supported in utilcode contracts") #ifdef ENABLE_CONTRACTS_IMPL @@ -1626,7 +1606,6 @@ class ContractViolationHolder DEBUG_NOINLINE void Leave() { - SCAN_SCOPE_END; LeaveInternal(); }; @@ -1667,7 +1646,6 @@ class AutoCleanupContractViolationHolder : ContractViolationHolderLeaveInternal(); }; }; @@ -1679,7 +1657,6 @@ class AutoCleanupContractViolationHolder : ContractViolationHolder __violationHolder_onlyOneAllowedPerScope; \ __violationHolder_onlyOneAllowedPerScope.Enter(); \ - DEBUG_ASSURE_NO_RETURN_BEGIN(CONTRACT) \ // Use this to jump out prematurely from a violation. Used for EH // when the function might not return @@ -1687,7 +1664,6 @@ class AutoCleanupContractViolationHolder : ContractViolationHolderSetOkToThrow( m_oldOkayToThrowValue ); } @@ -1986,10 +1956,6 @@ inline ClrDebugState *GetClrDebugState(BOOL fAlloc) LOCK_TAKEN_MULTIPLE(kDbgStateLockType_EE, 1, pvLock) #define EE_LOCK_RELEASED(pvLock) \ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_EE, 1, pvLock) -#define HOST_BREAKABLE_CRST_TAKEN(pvLock) \ - LOCK_TAKEN_MULTIPLE(kDbgStateLockType_HostBreakableCrst, 1, pvLock) -#define HOST_BREAKABLE_CRST_RELEASED(pvLock) \ - LOCK_RELEASED_MULTIPLE(kDbgStateLockType_HostBreakableCrst, 1, pvLock) #define USER_LOCK_TAKEN(pvLock) \ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_User, 1, pvLock) #define USER_LOCK_RELEASED(pvLock) \ @@ -2001,8 +1967,6 @@ inline ClrDebugState *GetClrDebugState(BOOL fAlloc) #define LOCK_RELEASED_MULTIPLE(dbgStateLockType, cExits, pvLock) #define EE_LOCK_TAKEN(pvLock) #define EE_LOCK_RELEASED(pvLock) -#define HOST_BREAKABLE_CRST_TAKEN(pvLock) -#define HOST_BREAKABLE_CRST_RELEASED(pvLock) #define USER_LOCK_TAKEN(pvLock) #define USER_LOCK_RELEASED(pvLock) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.inl b/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.inl index 211b6b5a1..5f53bd27f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.inl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/contract.inl @@ -417,9 +417,9 @@ inline UINT DbgStateLockData::GetCombinedLockCount() { // If this fires, the set of lock types must have changed. You'll need to // fix the sum below to include all lock types - _ASSERTE(kDbgStateLockType_Count == 3); + _ASSERTE(kDbgStateLockType_Count == 2); - return m_rgcLocksTaken[0] + m_rgcLocksTaken[1] + m_rgcLocksTaken[2]; + return m_rgcLocksTaken[0] + m_rgcLocksTaken[1]; } inline void DbgStateLockState::SetStartingValues() @@ -585,7 +585,7 @@ void CONTRACT_ASSERT(const char *szElaboration, } else { - strcat_s(Buf,ARRAY_SIZE(Buf), "We can't find the violated contract. Look for an old-style non-holder-based contract.\n"); + strcat_s(Buf,ARRAY_SIZE(Buf), "Missing tracking information. Look for data structures that manipulate contract state (i.e., CrstHolder).\n"); } } @@ -619,15 +619,12 @@ inline UINT GetDbgStateLockCount(DbgStateLockType dbgStateLockType) #define ASSERT_NO_USER_LOCKS_HELD() \ _ASSERTE(GetDbgStateLockCount(kDbgStateLockType_User) == 0) -#define ASSERT_NO_HOST_BREAKABLE_CRSTS_HELD() \ - _ASSERTE(GetDbgStateLockCount(kDbgStateLockType_HostBreakableCrst) == 0) #define ASSERT_NO_EE_LOCKS_HELD() \ _ASSERTE(GetDbgStateLockCount(kDbgStateLockType_EE) == 0) #else // ENABLE_CONTRACTS_IMPL #define ASSERT_NO_USER_LOCKS_HELD() -#define ASSERT_NO_HOST_BREAKABLE_CRSTS_HELD() #define ASSERT_NO_EE_LOCKS_HELD() #endif // ENABLE_CONTRACTS_IMPL diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/cor.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/cor.h index d6f31caef..610520cfe 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/cor.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/cor.h @@ -15,7 +15,7 @@ // Required includes #include // Definitions of OLE types. #include -#include "corerror.h" +#include //***************************************************************************** @@ -121,24 +121,16 @@ typedef UNALIGNED void const *UVCP_CONSTANT; //***************************************************************************** -// -#ifndef _WINDOWS_UPDATES_ #include -#endif // updates //***************************************************************************** //***************************************************************************** -// CLSID_Cor: {bee00000-ee77-11d0-a015-00c04fbbb884} -EXTERN_GUID(CLSID_Cor, 0xbee00010, 0xee77, 0x11d0, 0xa0, 0x15, 0x00, 0xc0, 0x4f, 0xbb, 0xb8, 0x84); - // CLSID_CorMetaDataDispenser: {E5CB7A31-7512-11d2-89CE-0080C792E5D8} // This is the "Master Dispenser", always guaranteed to be the most recent // dispenser on the machine. EXTERN_GUID(CLSID_CorMetaDataDispenser, 0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x0, 0x80, 0xc7, 0x92, 0xe5, 0xd8); -interface IMetaDataDispenser; - //------------------------------------- //--- IMetaDataError //------------------------------------- @@ -246,7 +238,7 @@ DECLARE_INTERFACE_(IMetaDataEmit, IUnknown) mdTypeDef td, // Parent TypeDef LPCWSTR szName, // Name of member DWORD dwMethodFlags, // Member attributes - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob ULONG ulCodeRVA, DWORD dwImplFlags, @@ -274,7 +266,7 @@ DECLARE_INTERFACE_(IMetaDataEmit, IUnknown) STDMETHOD(DefineMemberRef)( // S_OK or error mdToken tkImport, // [IN] ClassRef or ClassDef importing a member. LPCWSTR szName, // [IN] member's name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdMemberRef *pmr) PURE; // [OUT] memberref token @@ -418,7 +410,7 @@ DECLARE_INTERFACE_(IMetaDataEmit, IUnknown) mdTypeDef td, // Parent TypeDef LPCWSTR szName, // Name of member DWORD dwFieldFlags, // Member attributes - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_* void const *pValue, // [IN] constant value @@ -529,7 +521,7 @@ DECLARE_INTERFACE_(IMetaDataEmit2, IMetaDataEmit) { STDMETHOD(DefineMethodSpec)( mdToken tkParent, // [IN] MethodDef or MemberRef - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdMethodSpec *pmi) PURE; // [OUT] method instantiation token @@ -709,28 +701,28 @@ DECLARE_INTERFACE_(IMetaDataImport, IUnknown) STDMETHOD(FindMember)( mdTypeDef td, // [IN] given typedef LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdToken *pmb) PURE; // [OUT] matching memberdef STDMETHOD(FindMethod)( mdTypeDef td, // [IN] given typedef LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdMethodDef *pmb) PURE; // [OUT] matching memberdef STDMETHOD(FindField)( mdTypeDef td, // [IN] given typedef LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdFieldDef *pmb) PURE; // [OUT] matching memberdef STDMETHOD(FindMemberRef)( mdTypeRef td, // [IN] given typeRef LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdMemberRef *pmr) PURE; // [OUT] matching memberref diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corcompile.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corcompile.h index 845b72465..16b688eaa 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corcompile.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corcompile.h @@ -56,6 +56,11 @@ inline ReadyToRunCrossModuleInlineFlags operator &( const ReadyToRunCrossModuleI return static_cast(static_cast(left) & static_cast(right)); } +#ifdef TARGET_WASM +// why was it defined only for x86 before? +typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; +#endif + #ifdef TARGET_X86 typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; @@ -94,82 +99,6 @@ enum CORCOMPILE_GCREFMAP_TOKENS GCREFMAP_VASIG_COOKIE = 5, }; -// Tags for fixup blobs -enum CORCOMPILE_FIXUP_BLOB_KIND -{ - ENCODE_NONE = 0, - - ENCODE_MODULE_OVERRIDE = 0x80, /* When the high bit is set, override of the module immediately follows */ - - ENCODE_DICTIONARY_LOOKUP_THISOBJ = 0x07, - ENCODE_DICTIONARY_LOOKUP_TYPE = 0x08, - ENCODE_DICTIONARY_LOOKUP_METHOD = 0x09, - - ENCODE_TYPE_HANDLE = 0x10, /* Type handle */ - ENCODE_METHOD_HANDLE, /* Method handle */ - ENCODE_FIELD_HANDLE, /* Field handle */ - - ENCODE_METHOD_ENTRY, /* For calling a method entry point */ - ENCODE_METHOD_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is def token */ - ENCODE_METHOD_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is ref token */ - - ENCODE_VIRTUAL_ENTRY, /* For invoking a virtual method */ - ENCODE_VIRTUAL_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is def token */ - ENCODE_VIRTUAL_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is ref token */ - ENCODE_VIRTUAL_ENTRY_SLOT, /* Smaller version of ENCODE_VIRTUAL_ENTRY - type & slot */ - - ENCODE_READYTORUN_HELPER, /* ReadyToRun helper */ - ENCODE_STRING_HANDLE, /* String token */ - - ENCODE_NEW_HELPER, /* Dynamically created new helpers */ - ENCODE_NEW_ARRAY_HELPER, - - ENCODE_ISINSTANCEOF_HELPER, /* Dynamically created casting helper */ - ENCODE_CHKCAST_HELPER, - - ENCODE_FIELD_ADDRESS, /* For accessing a cross-module static fields */ - ENCODE_CCTOR_TRIGGER, /* Static constructor trigger */ - - ENCODE_STATIC_BASE_NONGC_HELPER, /* Dynamically created static base helpers */ - ENCODE_STATIC_BASE_GC_HELPER, - ENCODE_THREAD_STATIC_BASE_NONGC_HELPER, - ENCODE_THREAD_STATIC_BASE_GC_HELPER, - - ENCODE_FIELD_BASE_OFFSET, /* Field base */ - ENCODE_FIELD_OFFSET, - - ENCODE_TYPE_DICTIONARY, - ENCODE_METHOD_DICTIONARY, - - ENCODE_CHECK_TYPE_LAYOUT, - ENCODE_CHECK_FIELD_OFFSET, - - ENCODE_DELEGATE_CTOR, - - ENCODE_DECLARINGTYPE_HANDLE, - - ENCODE_INDIRECT_PINVOKE_TARGET, /* For calling a pinvoke method ptr indirectly */ - ENCODE_PINVOKE_TARGET, /* For calling a pinvoke method ptr */ - - ENCODE_CHECK_INSTRUCTION_SET_SUPPORT, /* Define the set of instruction sets that must be supported/unsupported to use the fixup */ - - ENCODE_VERIFY_FIELD_OFFSET, /* Used for the R2R compiler can generate a check against the real field offset used at runtime */ - ENCODE_VERIFY_TYPE_LAYOUT, /* Used for the R2R compiler can generate a check against the real type layout used at runtime */ - - ENCODE_CHECK_VIRTUAL_FUNCTION_OVERRIDE, /* Generate a runtime check to ensure that virtual function resolution has equivalent behavior at runtime as at compile time. If not equivalent, code will not be used */ - ENCODE_VERIFY_VIRTUAL_FUNCTION_OVERRIDE, /* Generate a runtime check to ensure that virtual function resolution has equivalent behavior at runtime as at compile time. If not equivalent, generate runtime failure. */ - - ENCODE_CHECK_IL_BODY, /* Check to see if an IL method is defined the same at runtime as at compile time. A failed match will cause code not to be used. */ - ENCODE_VERIFY_IL_BODY, /* Verify an IL body is defined the same at compile time and runtime. A failed match will cause a hard runtime failure. */ - - ENCODE_MODULE_HANDLE = 0x50, /* Module token */ - ENCODE_SYNC_LOCK, /* For synchronizing access to a type */ - ENCODE_PROFILING_HANDLE, /* For the method's profiling counter */ - ENCODE_VARARGS_METHODDEF, /* For calling a varargs method */ - ENCODE_VARARGS_METHODREF, - ENCODE_VARARGS_SIG, -}; - enum EncodeMethodSigFlags { ENCODE_METHOD_SIG_UnboxingStub = 0x01, @@ -180,6 +109,7 @@ enum EncodeMethodSigFlags ENCODE_METHOD_SIG_Constrained = 0x20, ENCODE_METHOD_SIG_OwnerType = 0x40, ENCODE_METHOD_SIG_UpdateContext = 0x80, + ENCODE_METHOD_SIG_AsyncVariant = 0x100, }; enum EncodeFieldSigFlags @@ -188,11 +118,6 @@ enum EncodeFieldSigFlags ENCODE_FIELD_SIG_OwnerType = 0x40, }; -class SBuffer; -class SigBuilder; -class PEDecoder; -class GCRefMapBuilder; - //REVIEW: include for ee exception info #include "eexcp.h" @@ -227,17 +152,4 @@ struct CORCOMPILE_EXCEPTION_CLAUSE }; }; -/*********************************************************************************/ -// When NGEN install /Profile is run, the ZapProfilingHandleImport fixup table contains -// these 5 values per MethodDesc -enum -{ - kZapProfilingHandleImportValueIndexFixup = 0, - kZapProfilingHandleImportValueIndexEnterAddr = 1, - kZapProfilingHandleImportValueIndexLeaveAddr = 2, - kZapProfilingHandleImportValueIndexTailcallAddr = 3, - kZapProfilingHandleImportValueIndexClientData = 4, - - kZapProfilingHandleImportValueIndexCount -}; #endif /* COR_COMPILE_H_ */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebug.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebug.idl index 077d811cd..6dd3c57a6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebug.idl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebug.idl @@ -5180,7 +5180,7 @@ interface ICorDebugNativeFrame : ICorDebugFrame * coherent state. (Note that even if the frame is in a valid * state as far as the runtime is concerned, there still may be * problems - e.g. uninitialized local variables, etc. The caller - * (or perhaps the user) is responsible for insuring coherency of + * (or perhaps the user) is responsible for ensuring coherency of * the running program.) * * Calling SetIP immediately invalidates all frames and chains for the diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebuginfo.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebuginfo.h index b3125060f..b0e813dff 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebuginfo.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/cordebuginfo.h @@ -27,7 +27,7 @@ class ICorDebugInfo NO_BOUNDARIES = 0x00, // No implicit boundaries STACK_EMPTY_BOUNDARIES = 0x01, // Boundary whenever the IL evaluation stack is empty NOP_BOUNDARIES = 0x02, // Before every CEE_NOP instruction - CALL_SITE_BOUNDARIES = 0x04, // Before every CEE_CALL, CEE_CALLVIRT, etc instruction + CALL_SITE_BOUNDARIES = 0x04, // After every CEE_CALL, CEE_CALLVIRT, etc instruction // Set of boundaries that debugger should always reasonably ask the JIT for. DEFAULT_BOUNDARIES = STACK_EMPTY_BOUNDARIES | NOP_BOUNDARIES | CALL_SITE_BOUNDARIES @@ -213,6 +213,8 @@ class ICorDebugInfo REGNUM_T5, REGNUM_T6, REGNUM_PC, +#elif TARGET_WASM + REGNUM_PC, // wasm doesn't have registers #else PORTABILITY_WARNING("Register numbers not defined on this platform") #endif @@ -224,6 +226,7 @@ class ICorDebugInfo REGNUM_FP = REGNUM_EBP, REGNUM_SP = REGNUM_ESP, #elif TARGET_AMD64 + REGNUM_FP = REGNUM_RBP, REGNUM_SP = REGNUM_RSP, #elif TARGET_ARM REGNUM_FP = REGNUM_R11, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/coredistools.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/coredistools.h index f26693f98..b14703e0f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/coredistools.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/coredistools.h @@ -1,12 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -//===--------- coredistools.h - Disassembly tools for CoreClr ------------===// -// -// Core Disassembly Tools API Version 1.4.0 +//===--------- coredistools.h - Disassembly tools for CoreClr ------------=== +// Core Disassembly Tools API // Disassembly tools required by CoreCLR for utilities like // GCStress, SuperPMI, and R2RDump. -//===----------------------------------------------------------------------===// +//===---------------------------------------------------------------------=== #if !defined(_COREDISTOOLS_H_) #define _COREDISTOOLS_H_ @@ -42,7 +41,8 @@ enum TargetArch { Target_X64, Target_Thumb, Target_Arm64, - Target_LoongArch64 + Target_LoongArch64, + Target_RiscV64, }; struct CorDisasm; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corerror.xml b/Procfiler/src/cpp/3rdparty/coreclr/inc/corerror.xml index 68c9a1aa5..a9dd81fb2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corerror.xml +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corerror.xml @@ -1176,6 +1176,11 @@ This object belongs to a non-gc heap + + CORPROF_E_MODULE_IS_ENC + The module is EnC + + CORSEC_E_POLICY_EXCEPTION "PolicyException thrown." diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corexcep.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corexcep.h index e1c00b50b..5ff335e30 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corexcep.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corexcep.h @@ -11,9 +11,9 @@ #ifndef __COREXCEP_H__ #define __COREXCEP_H__ -// All COM+ exceptions are expressed as a RaiseException with this exception +// All CLR exceptions are expressed as a RaiseException with this exception // code. If you change this value, you must also change -// Exception.cs's _COMPlusExceptionCode value. +// Exception.cs's EXCEPTION_COMPLUS value. #define EXCEPTION_MSVC 0xe06d7363 // 0xe0000000 | 'msc' @@ -28,8 +28,4 @@ // stress to facilitate failure triaging. #endif -// This is the exception code to report SetupThread failure to caller of reverse pinvoke -// It is misleading to use our COM+ exception code, since this is not a managed exception. -// In the end, we picked e0455858 (EXX). -#define EXCEPTION_EXX 0xe0455858 // 0xe0000000 | 'EXX' #endif // __COREXCEP_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corhdr.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corhdr.h index c12c1cfdd..01a2d602b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corhdr.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corhdr.h @@ -246,14 +246,6 @@ typedef struct IMAGE_COR20_HEADER } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER; -#else // !__IMAGE_COR20_HEADER_DEFINED__ - -// @TODO: This is required because we pull in the COM+ 2.0 PE header -// definition from WinNT.h, and these constants have not yet propagated to there. -// -#define COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN 0x08 -#define COMIMAGE_FLAGS_32BITPREFERRED 0x00020000 - #endif // __IMAGE_COR20_HEADER_DEFINED__ @@ -648,13 +640,15 @@ typedef enum CorMethodImpl miNoOptimization = 0x0040, // Method may not be optimized. miAggressiveOptimization = 0x0200, // Method may contain hot code and should be aggressively optimized. + miAsync = 0x2000, // Method requires async state machine rewrite. + // These are the flags that are allowed in MethodImplAttribute's Value // property. This should include everything above except the code impl // flags (which are used for MethodImplAttribute's MethodCodeType field). miUserMask = miManagedMask | miForwardRef | miPreserveSig | miInternalCall | miSynchronized | miNoInlining | miAggressiveInlining | - miNoOptimization | miAggressiveOptimization, + miNoOptimization | miAggressiveOptimization | miAsync, miMaxMethodImplVal = 0xffff, // Range check value } CorMethodImpl; @@ -678,6 +672,7 @@ typedef enum CorMethodImpl #define IsMiAggressiveInlining(x) ((x) & miAggressiveInlining) #define IsMiNoOptimization(x) ((x) & miNoOptimization) #define IsMiAggressiveOptimization(x) (((x) & (miAggressiveOptimization | miNoOptimization)) == miAggressiveOptimization) +#define IsMiAsync(x) ((x) & miAsync) // PinvokeMap attr bits, used by DefinePinvokeMap. typedef enum CorPinvokeMap @@ -911,9 +906,10 @@ typedef enum CorElementType // This is for signatures generated internally (which will not be persisted in any way). ELEMENT_TYPE_INTERNAL = 0x21, // INTERNAL + ELEMENT_TYPE_CMOD_INTERNAL = 0x22, // CMOD_INTERNAL // Note that this is the max of base type excluding modifiers - ELEMENT_TYPE_MAX = 0x22, // first invalid element type + ELEMENT_TYPE_MAX = 0x23, // first invalid element type ELEMENT_TYPE_MODIFIER = 0x40, @@ -979,7 +975,8 @@ typedef enum CorCallingConvention IMAGE_CEE_CS_CALLCONV_UNMANAGED = 0x9, // Unmanaged calling convention encoded as modopts IMAGE_CEE_CS_CALLCONV_GENERICINST = 0xa, // generic method instantiation IMAGE_CEE_CS_CALLCONV_NATIVEVARARG = 0xb, // used ONLY for 64bit vararg PInvoke calls - IMAGE_CEE_CS_CALLCONV_MAX = 0xc, // first invalid calling convention + IMAGE_CEE_CS_CALLCONV_ASYNC = 0xc, // used for calli in IL stubs + IMAGE_CEE_CS_CALLCONV_MAX = 0xd, // first invalid calling convention // The high bits of the calling convention convey additional info @@ -1143,12 +1140,11 @@ typedef struct IMAGE_COR_ILMETHOD_SECT_FAT typedef enum CorExceptionFlag // definitions for the Flags field below (for both big and small) { COR_ILEXCEPTION_CLAUSE_NONE, // This is a typed handler - COR_ILEXCEPTION_CLAUSE_OFFSETLEN = 0x0000, // Deprecated - COR_ILEXCEPTION_CLAUSE_DEPRECATED = 0x0000, // Deprecated COR_ILEXCEPTION_CLAUSE_FILTER = 0x0001, // If this bit is on, then this EH entry is for a filter COR_ILEXCEPTION_CLAUSE_FINALLY = 0x0002, // This clause is a finally clause COR_ILEXCEPTION_CLAUSE_FAULT = 0x0004, // Fault clause (finally that is called on exception only) - COR_ILEXCEPTION_CLAUSE_DUPLICATED = 0x0008, // duplicated clause. This clause was duplicated to a funclet which was pulled out of line + COR_ILEXCEPTION_CLAUSE_DUPLICATED = 0x0008, // Deprecated: Duplicated clause. This clause was duplicated to a funclet which was pulled out of line + COR_ILEXCEPTION_CLAUSE_SAMETRY = 0x0010, // This clause covers same try block as the previous one } CorExceptionFlag; /***********************************/ @@ -1687,6 +1683,8 @@ typedef enum CorAttributeTargets // Keep in sync with RuntimeCompatibilityAttribute.cs #define RUNTIMECOMPATIBILITY_TYPE_W W("System.Runtime.CompilerServices.RuntimeCompatibilityAttribute") #define RUNTIMECOMPATIBILITY_TYPE "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" +#define RUNTIMECOMPATIBILITY_TYPE_NAMESPACE "System.Runtime.CompilerServices" +#define RUNTIMECOMPATIBILITY_TYPE_NAME "RuntimeCompatibilityAttribute" // Keep in sync with AssemblySettingAttributes.cs diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.cpp b/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.cpp index 97c25d3cf..030a154d9 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.cpp @@ -226,7 +226,7 @@ HRESULT _CountBytesOfOneArg( // copy fixed part of VarArg signature to a buffer //***************************************************************************** HRESULT _GetFixedSigOfVarArg( // S_OK or error. - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob of COM+ method signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob of method signature ULONG cbSigBlob, // [IN] size of signature CQuickBytes *pqbSig, // [OUT] output buffer for fixed part of VarArg Signature ULONG *pcbSigBlob) // [OUT] number of bytes written to the above output buffer diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.h index 9cbdaa4a3..e960eb416 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corhlprpriv.h @@ -573,6 +573,16 @@ class CQuickArrayList : protected CQuickArray return m_curSize; } + T* Ptr() + { + return (T*) CQuickBytesBase::Ptr(); + } + + const T* Ptr() const + { + return (T*) CQuickBytesBase::Ptr(); + } + void Shrink() { CQuickArray::Shrink(m_curSize); @@ -648,7 +658,7 @@ HRESULT _CountBytesOfOneArg( ULONG *pcbTotal); HRESULT _GetFixedSigOfVarArg( // S_OK or error. - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob of signature ULONG cbSigBlob, // [IN] size of signature CQuickBytes *pqbSig, // [OUT] output buffer for fixed part of VarArg Signature ULONG *pcbSigBlob); // [OUT] number of bytes written to the above output buffer diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfo.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfo.h index cab2f6c71..b0d0108a3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfo.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfo.h @@ -336,13 +336,13 @@ enum CorInfoHelpFunc CORINFO_HELP_LMOD, CORINFO_HELP_ULDIV, CORINFO_HELP_ULMOD, + CORINFO_HELP_LNG2FLT, // Convert a signed int64 to a float CORINFO_HELP_LNG2DBL, // Convert a signed int64 to a double + CORINFO_HELP_ULNG2FLT, // Convert a unsigned int64 to a float CORINFO_HELP_ULNG2DBL, // Convert a unsigned int64 to a double - CORINFO_HELP_DBL2INT, CORINFO_HELP_DBL2INT_OVF, CORINFO_HELP_DBL2LNG, CORINFO_HELP_DBL2LNG_OVF, - CORINFO_HELP_DBL2UINT, CORINFO_HELP_DBL2UINT_OVF, CORINFO_HELP_DBL2ULNG, CORINFO_HELP_DBL2ULNG_OVF, @@ -363,7 +363,7 @@ enum CorInfoHelpFunc CORINFO_HELP_NEW_MDARR_RARE,// rare multi-dim array helper (Rank == 1) CORINFO_HELP_NEWARR_1_DIRECT, // helper for any one dimensional array creation CORINFO_HELP_NEWARR_1_MAYBEFROZEN, // allocator for arrays that *might* allocate them on a frozen segment - CORINFO_HELP_NEWARR_1_OBJ, // optimized 1-D object arrays + CORINFO_HELP_NEWARR_1_PTR, // optimized 1-D arrays with pointer sized elements CORINFO_HELP_NEWARR_1_VC, // optimized 1-D value class arrays CORINFO_HELP_NEWARR_1_ALIGN8, // like VC, but aligns the array start @@ -405,6 +405,7 @@ enum CorInfoHelpFunc CORINFO_HELP_THROW, // Throw an exception object CORINFO_HELP_RETHROW, // Rethrow the currently active exception + CORINFO_HELP_THROWEXACT, // Throw an exception object, preserving stack trace CORINFO_HELP_USER_BREAKPOINT, // For a user program to break to the debugger CORINFO_HELP_RNGCHKFAIL, // array bounds check failed CORINFO_HELP_OVERFLOW, // throw an overflow exception @@ -424,19 +425,15 @@ enum CorInfoHelpFunc CORINFO_HELP_MON_ENTER, CORINFO_HELP_MON_EXIT, - CORINFO_HELP_MON_ENTER_STATIC, - CORINFO_HELP_MON_EXIT_STATIC, CORINFO_HELP_GETCLASSFROMMETHODPARAM, // Given a generics method handle, returns a class handle - CORINFO_HELP_GETSYNCFROMCLASSHANDLE, // Given a generics class handle, returns the sync monitor - // in its ManagedClassObject + CORINFO_HELP_GETSYNCFROMCLASSHANDLE, // Given a generics class handle return the ManagedClassObject that is used to lock a static method /* GC support */ CORINFO_HELP_STOP_FOR_GC, // Call GC (force a GC) CORINFO_HELP_POLL_GC, // Ask GC if it wants to collect - CORINFO_HELP_STRESS_GC, // Force a GC, but then update the JITTED code to be a noop call CORINFO_HELP_CHECK_OBJ, // confirm that ECX is a valid object pointer (debugging only) /* GC Write barrier support */ @@ -483,6 +480,7 @@ enum CorInfoHelpFunc CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED, CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED, CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED2, + CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED2_NOJITOPT, /* Debugger */ @@ -495,8 +493,6 @@ enum CorInfoHelpFunc /* Miscellaneous */ - CORINFO_HELP_BBT_FCN_ENTER, // record the entry to a method for collecting Tuning data - CORINFO_HELP_PINVOKE_CALLI, // Indirect pinvoke call CORINFO_HELP_TAILCALL, // Perform a tail call @@ -511,9 +507,7 @@ enum CorInfoHelpFunc // not safe for unbounded size, does not trigger GC) CORINFO_HELP_RUNTIMEHANDLE_METHOD, // determine a type/field/method handle at run-time - CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG, // determine a type/field/method handle at run-time, with IBC logging CORINFO_HELP_RUNTIMEHANDLE_CLASS, // determine a type/field/method handle at run-time - CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, // determine a type/field/method handle at run-time, with IBC logging CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, // Convert from a TypeHandle (native structure pointer) to RuntimeType at run-time CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, // Convert from a TypeHandle (native structure pointer) to RuntimeType at run-time, the type may be null @@ -585,7 +579,7 @@ enum CorInfoHelpFunc CORINFO_HELP_STACK_PROBE, // Probes each page of the allocated stack frame CORINFO_HELP_PATCHPOINT, // Notify runtime that code has reached a patchpoint - CORINFO_HELP_PARTIAL_COMPILATION_PATCHPOINT, // Notify runtime that code has reached a part of the method that wasn't originally jitted. + CORINFO_HELP_PATCHPOINT_FORCED, // Notify runtime that code has reached a part of the method that needs to transition CORINFO_HELP_CLASSPROFILE32, // Update 32-bit class profile for a call site CORINFO_HELP_CLASSPROFILE64, // Update 64-bit class profile for a call site @@ -601,6 +595,10 @@ enum CorInfoHelpFunc CORINFO_HELP_VALIDATE_INDIRECT_CALL, // CFG: Validate function pointer CORINFO_HELP_DISPATCH_INDIRECT_CALL, // CFG: Validate and dispatch to pointer + CORINFO_HELP_ALLOC_CONTINUATION, + CORINFO_HELP_ALLOC_CONTINUATION_METHOD, + CORINFO_HELP_ALLOC_CONTINUATION_CLASS, + CORINFO_HELP_COUNT, }; @@ -644,6 +642,7 @@ enum CorInfoTypeWithMod { CORINFO_TYPE_MASK = 0x3F, // lower 6 bits are type mask CORINFO_TYPE_MOD_PINNED = 0x40, // can be applied to CLASS, or BYREF to indicate pinned + CORINFO_TYPE_MOD_COPY_WITH_HELPER = 0x80 // can be applied to VALUECLASS to indicate 'needs helper to copy' }; inline CorInfoType strip(CorInfoTypeWithMod val) { @@ -674,6 +673,7 @@ enum CorInfoCallConv CORINFO_CALLCONV_HASTHIS = 0x20, CORINFO_CALLCONV_EXPLICITTHIS=0x40, CORINFO_CALLCONV_PARAMTYPE = 0x80, // Passed last. Same as CORINFO_GENERICS_CTXT_FROM_PARAMTYPEARG + CORINFO_CALLCONV_ASYNCCALL = 0x100, // Is this a call to an async function? }; // Represents the calling conventions supported with the extensible calling convention syntax @@ -721,7 +721,6 @@ enum CorInfoOptions CORINFO_GENERICS_CTXT_FROM_METHODDESC | CORINFO_GENERICS_CTXT_FROM_METHODTABLE), CORINFO_GENERICS_CTXT_KEEP_ALIVE = 0x00000100, // Keep the generics context alive throughout the method even if there is no explicit use, and report its location to the CLR - }; // @@ -792,7 +791,7 @@ enum CorInfoFlag enum CorInfoMethodRuntimeFlags { CORINFO_FLG_BAD_INLINEE = 0x00000001, // The method is not suitable for inlining - // unused = 0x00000002, + // unused = 0x00000002, // The method was compiled by the interpreter // unused = 0x00000004, CORINFO_FLG_SWITCHED_TO_MIN_OPT = 0x00000008, // The JIT decided to switch to MinOpt for this method, when it was not requested CORINFO_FLG_SWITCHED_TO_OPTIMIZED = 0x00000010, // The JIT decided to switch to tier 1 for this method, when a different tier was requested @@ -819,32 +818,17 @@ enum CORINFO_ACCESS_FLAGS }; // These are the flags set on an CORINFO_EH_CLAUSE +// Keep values in sync with COR_ILEXCEPTION_CLAUSE flags enum CORINFO_EH_CLAUSE_FLAGS { CORINFO_EH_CLAUSE_NONE = 0, CORINFO_EH_CLAUSE_FILTER = 0x0001, // If this bit is on, then this EH entry is for a filter CORINFO_EH_CLAUSE_FINALLY = 0x0002, // This clause is a finally clause CORINFO_EH_CLAUSE_FAULT = 0x0004, // This clause is a fault clause - CORINFO_EH_CLAUSE_DUPLICATE = 0x0008, // Duplicated clause. This clause was duplicated to a funclet which was pulled out of line + // UNUSED = 0x0008, CORINFO_EH_CLAUSE_SAMETRY = 0x0010, // This clause covers same try block as the previous one }; -// This enumeration is passed to InternalThrow -enum CorInfoException -{ - CORINFO_NullReferenceException, - CORINFO_DivideByZeroException, - CORINFO_InvalidCastException, - CORINFO_IndexOutOfRangeException, - CORINFO_OverflowException, - CORINFO_SynchronizationLockException, - CORINFO_ArrayTypeMismatchException, - CORINFO_RankException, - CORINFO_ArgumentNullException, - CORINFO_ArgumentException, - CORINFO_Exception_Count, -}; - // These are used to detect array methods as NamedIntrinsic in JIT importer, // which otherwise don't have a name. enum class CorInfoArrayIntrinsic @@ -1013,6 +997,7 @@ struct CORINFO_SIG_INFO unsigned totalILArgs() { return (numArgs + (hasImplicitThis() ? 1 : 0)); } bool isVarArg() { return ((getCallConv() == CORINFO_CALLCONV_VARARG) || (getCallConv() == CORINFO_CALLCONV_NATIVEVARARG)); } bool hasTypeArg() { return ((callConv & CORINFO_CALLCONV_PARAMTYPE) != 0); } + bool isAsyncCall() { return ((callConv & CORINFO_CALLCONV_ASYNCCALL) != 0); } }; struct CORINFO_METHOD_INFO @@ -1372,7 +1357,7 @@ enum CORINFO_CALLINFO_FLAGS CORINFO_CALLINFO_ALLOWINSTPARAM = 0x0001, // Can the compiler generate code to pass an instantiation parameters? Simple compilers should not use this flag CORINFO_CALLINFO_CALLVIRT = 0x0002, // Is it a virtual call? // UNUSED = 0x0004, - // UNUSED = 0x0008, + CORINFO_CALLINFO_DISALLOW_STUB = 0x0008, // Do not use a stub for this call, even if it is a virtual call. CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks. CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN // UNUSED = 0x0040, @@ -1418,6 +1403,9 @@ enum CorInfoTokenKind // token comes from devirtualizing a method CORINFO_TOKENKIND_DevirtualizedMethod = 0x800 | CORINFO_TOKENKIND_Method, + + // token comes from runtime async awaiting pattern + CORINFO_TOKENKIND_Await = 0x2000 | CORINFO_TOKENKIND_Method, }; struct CORINFO_RESOLVED_TOKEN @@ -1529,18 +1517,21 @@ struct CORINFO_DEVIRTUALIZATION_INFO // [Out] results of resolveVirtualMethod. // - devirtualizedMethod is set to MethodDesc of devirt'ed method iff we were able to devirtualize. // invariant is `resolveVirtualMethod(...) == (devirtualizedMethod != nullptr)`. - // - requiresInstMethodTableArg is set to TRUE if the devirtualized method requires a type handle arg. // - exactContext is set to wrapped CORINFO_CLASS_HANDLE of devirt'ed method table. // - details on the computation done by the jit host // - If pResolvedTokenDevirtualizedMethod is not set to NULL and targeting an R2R image // use it as the parameter to getCallInfo + // - isInstantiatingStub is set to TRUE if the devirtualized method is a generic method instantiating stub + // - wasArrayInterfaceDevirt is set TRUE for array interface method devirtualization + // (in which case the method handle and context will be a generic method) // CORINFO_METHOD_HANDLE devirtualizedMethod; - bool requiresInstMethodTableArg; CORINFO_CONTEXT_HANDLE exactContext; CORINFO_DEVIRTUALIZATION_DETAIL detail; CORINFO_RESOLVED_TOKEN resolvedTokenDevirtualizedMethod; CORINFO_RESOLVED_TOKEN resolvedTokenDevirtualizedUnboxedMethod; + bool isInstantiatingStub; + bool wasArrayInterfaceDevirt; }; //---------------------------------------------------------------------------- @@ -1669,8 +1660,6 @@ struct CORINFO_EE_INFO // Size of the Frame structure when it also contains the secret stub arg unsigned sizeWithSecretStubArg; - unsigned offsetOfGSCookie; - unsigned offsetOfFrameVptr; unsigned offsetOfFrameLink; unsigned offsetOfCallSiteSP; unsigned offsetOfCalleeSavedFP; @@ -1709,6 +1698,59 @@ struct CORINFO_EE_INFO CORINFO_OS osType; }; +enum CorInfoContinuationFlags +{ + // Whether or not the continuation expects the result to be boxed and + // placed in the GCData array at index 0. Not set if the callee is void. + CORINFO_CONTINUATION_RESULT_IN_GCDATA = 1, + // If this bit is set the continuation resumes inside a try block and thus + // if an exception is being propagated, needs to be resumed. The exception + // should be placed at index 0 or 1 depending on whether the continuation + // also expects a result. + CORINFO_CONTINUATION_NEEDS_EXCEPTION = 2, + // If this bit is set the continuation has the IL offset that inspired the + // OSR method saved in the beginning of 'Data', or -1 if the continuation + // belongs to a tier 0 method. + CORINFO_CONTINUATION_OSR_IL_OFFSET_IN_DATA = 4, + // If this bit is set the continuation should continue on the thread + // pool. + CORINFO_CONTINUATION_CONTINUE_ON_THREAD_POOL = 8, + // If this bit is set the continuation has a SynchronizationContext + // that we should continue on. + CORINFO_CONTINUATION_CONTINUE_ON_CAPTURED_SYNCHRONIZATION_CONTEXT = 16, + // If this bit is set the continuation has a TaskScheduler + // that we should continue on. + CORINFO_CONTINUATION_CONTINUE_ON_CAPTURED_TASK_SCHEDULER = 32, +}; + +struct CORINFO_ASYNC_INFO +{ + // Class handle for System.Runtime.CompilerServices.Continuation + CORINFO_CLASS_HANDLE continuationClsHnd; + // 'Next' field + CORINFO_FIELD_HANDLE continuationNextFldHnd; + // 'Resume' field + CORINFO_FIELD_HANDLE continuationResumeFldHnd; + // 'State' field + CORINFO_FIELD_HANDLE continuationStateFldHnd; + // 'Flags' field + CORINFO_FIELD_HANDLE continuationFlagsFldHnd; + // 'Data' field + CORINFO_FIELD_HANDLE continuationDataFldHnd; + // 'GCData' field + CORINFO_FIELD_HANDLE continuationGCDataFldHnd; + // Whether or not the continuation needs to be allocated through the + // helper that also takes a method handle + bool continuationsNeedMethodHandle; + // Method handle for AsyncHelpers.CaptureExecutionContext + CORINFO_METHOD_HANDLE captureExecutionContextMethHnd; + // Method handle for AsyncHelpers.RestoreExecutionContext + CORINFO_METHOD_HANDLE restoreExecutionContextMethHnd; + CORINFO_METHOD_HANDLE captureContinuationContextMethHnd; + CORINFO_METHOD_HANDLE captureContextsMethHnd; + CORINFO_METHOD_HANDLE restoreContextsMethHnd; +}; + // Flags passed from JIT to runtime. enum CORINFO_GET_TAILCALL_HELPERS_FLAGS { @@ -2130,6 +2172,14 @@ class ICorStaticInfo bool* requiresInstMethodTableArg ) = 0; + // Get the wrapped entry point for an instantiating stub, if possible. + // Sets methodArg for method instantiations, classArg for class instantiations. + virtual CORINFO_METHOD_HANDLE getInstantiatedEntry( + CORINFO_METHOD_HANDLE ftn, + CORINFO_METHOD_HANDLE* methodArg, + CORINFO_CLASS_HANDLE* classArg + ) = 0; + // Given T, return the type of the default Comparer. // Returns null if the type can't be determined exactly. virtual CORINFO_CLASS_HANDLE getDefaultComparerClass( @@ -2142,6 +2192,12 @@ class ICorStaticInfo CORINFO_CLASS_HANDLE elemType ) = 0; + // Given T, return the type of the SZArrayHelper enumerator + // Returns null if the type can't be determined exactly. + virtual CORINFO_CLASS_HANDLE getSZArrayHelperEnumeratorClass( + CORINFO_CLASS_HANDLE elemType + ) = 0; + // Given resolved token that corresponds to an intrinsic classified to // get a raw handle (NI_System_Activator_AllocatorOf etc.), fetch the // handle associated with the token. If this is not possible at @@ -2305,6 +2361,13 @@ class ICorStaticInfo unsigned index ) = 0; + // Return the type argument of the instantiated generic method, + // which is specified by the index + virtual CORINFO_CLASS_HANDLE getMethodInstantiationArgument( + CORINFO_METHOD_HANDLE ftn, + unsigned index + ) = 0; + // Prints the name for a specified class including namespaces and enclosing // classes. // See printObjectDescription for documentation for the parameters. @@ -2323,7 +2386,7 @@ class ICorStaticInfo CORINFO_CLASS_HANDLE cls ) = 0; - // Returns the assembly name of the class "cls", or nullptr if there is none. + // Returns the assembly name of the class "cls", or nullptr if there is none. virtual const char* getClassAssemblyName ( CORINFO_CLASS_HANDLE cls ) = 0; @@ -2481,14 +2544,6 @@ class ICorStaticInfo CORINFO_CLASS_HANDLE cls ) = 0; - // Get a representation for a stack-allocated boxed value type. - // - // This differs from getTypeForBox in that it includes an explicit field - // for the method table pointer. - virtual CORINFO_CLASS_HANDLE getTypeForBoxOnStack( - CORINFO_CLASS_HANDLE cls - ) = 0; - // returns the correct box helper for a particular class. Note // that if this returns CORINFO_HELP_BOX, the JIT can assume // 'standard' boxing (allocate object and copy), and optimize @@ -2743,12 +2798,12 @@ class ICorStaticInfo // the field's value class (if 'structType' == 0, then don't bother // the structure info). // - // 'memberParent' is typically only set when verifying. It should be the - // result of calling getMemberParent. + // 'fieldOwnerHint' is, potentially, a more exact owner of the field. + // it's fine for it to be non-precise, it's just a hint. virtual CorInfoType getFieldType( CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE * structType = NULL, - CORINFO_CLASS_HANDLE memberParent = NULL /* IN */ + CORINFO_CLASS_HANDLE fieldOwnerHint = NULL /* IN */ ) = 0; // return the data member's instance offset @@ -2959,8 +3014,9 @@ class ICorStaticInfo CORINFO_EE_INFO *pEEInfoOut ) = 0; - // Returns name of the JIT timer log - virtual const char16_t *getJitTimeLogFilename() = 0; + virtual void getAsyncInfo( + CORINFO_ASYNC_INFO* pAsyncInfoOut + ) = 0; /*********************************************************************************/ // @@ -3060,10 +3116,11 @@ class ICorDynamicInfo : public ICorStaticInfo void **ppIndirection = NULL ) = 0; - // return the native entry point to an EE helper (see CorInfoHelpFunc) - virtual void* getHelperFtn ( + // return the native entry point and/or managed method of an EE helper (see CorInfoHelpFunc) + virtual void getHelperFtn ( CorInfoHelpFunc ftnNum, - void **ppIndirection = NULL + CORINFO_CONST_LOOKUP * pNativeEntrypoint, + CORINFO_METHOD_HANDLE * pMethodHandle = NULL /* OUT */ ) = 0; // return a callable address of the function (native code). This function @@ -3084,12 +3141,6 @@ class ICorDynamicInfo : public ICorStaticInfo CORINFO_CONST_LOOKUP * pResult ) = 0; - // get the synchronization handle that is passed to monXstatic function - virtual void* getMethodSync( - CORINFO_METHOD_HANDLE ftn, - void** ppIndirection = NULL - ) = 0; - // get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*). // Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used. virtual CorInfoHelpFunc getLazyStringLiteralHelper( @@ -3149,18 +3200,15 @@ class ICorDynamicInfo : public ICorStaticInfo CORINFO_CONST_LOOKUP * pLookup ) = 0; - // Generate a cookie based on the signature that would needs to be passed - // to CORINFO_HELP_PINVOKE_CALLI + // Generate a cookie based on the signature to pass to CORINFO_HELP_PINVOKE_CALLI virtual void* GetCookieForPInvokeCalliSig( CORINFO_SIG_INFO* szMetaSig, void** ppIndirection = NULL ) = 0; - // returns true if a VM cookie can be generated for it (might be false due to cross-module - // inlining, in which case the inlining should be aborted) - virtual bool canGetCookieForPInvokeCalliSig( - CORINFO_SIG_INFO* szMetaSig - ) = 0; + // Generate a cookie based on the signature to pass to INTOP_CALLI in the interpreter. + virtual void* GetCookieForInterpreterCalliSig( + CORINFO_SIG_INFO* szMetaSig) = 0; // Gets a handle that is checked to see if the current method is // included in "JustMyCode" @@ -3243,15 +3291,10 @@ class ICorDynamicInfo : public ICorStaticInfo // registers a vararg sig & returns a VM cookie for it (which can contain other stuff) virtual CORINFO_VARARGS_HANDLE getVarArgsHandle( CORINFO_SIG_INFO *pSig, + CORINFO_METHOD_HANDLE methHnd, void **ppIndirection = NULL ) = 0; - // returns true if a VM cookie can be generated for it (might be false due to cross-module - // inlining, in which case the inlining should be aborted) - virtual bool canGetVarArgsHandle( - CORINFO_SIG_INFO *pSig - ) = 0; - // Allocate a string literal on the heap and return a handle to it virtual InfoAccessType constructStringLiteral( CORINFO_MODULE_HANDLE module, @@ -3297,6 +3340,8 @@ class ICorDynamicInfo : public ICorStaticInfo CORINFO_TAILCALL_HELPERS* pResult ) = 0; + virtual CORINFO_METHOD_HANDLE getAsyncResumptionStub() = 0; + // Optionally, convert calli to regular method call. This is for PInvoke argument marshalling. virtual bool convertPInvokeCalliToCall( CORINFO_RESOLVED_TOKEN * pResolvedToken, @@ -3315,6 +3360,8 @@ class ICorDynamicInfo : public ICorStaticInfo // but for tailcalls, the contract is that JIT leaves the indirection cell in // a register during tailcall. virtual void updateEntryPointForTailCall(CORINFO_CONST_LOOKUP* entryPoint) = 0; + + virtual CORINFO_METHOD_HANDLE getSpecialCopyHelper(CORINFO_CLASS_HANDLE type) = 0; }; /**********************************************************************************/ @@ -3350,6 +3397,17 @@ class ICorDynamicInfo : public ICorStaticInfo // #define IMAGE_REL_BASED_REL_THUMB_MOV32_PCREL 0x14 +// +// LOONGARCH64 relocation types +// +#define IMAGE_REL_LOONGARCH64_PC 0x0003 +#define IMAGE_REL_LOONGARCH64_JIR 0x0004 + +// +// RISCV64 relocation types +// +#define IMAGE_REL_RISCV64_PC 0x0003 + /**********************************************************************************/ #ifdef TARGET_64BIT #define USE_PER_FRAME_PINVOKE_INIT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfoinstructionset.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfoinstructionset.h index 43f2be795..9d2f2aa9c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfoinstructionset.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corinfoinstructionset.h @@ -32,159 +32,120 @@ enum CORINFO_InstructionSet InstructionSet_VectorT128=14, InstructionSet_Rcpc2=15, InstructionSet_Sve=16, - InstructionSet_ArmBase_Arm64=17, - InstructionSet_AdvSimd_Arm64=18, - InstructionSet_Aes_Arm64=19, - InstructionSet_Crc32_Arm64=20, - InstructionSet_Dp_Arm64=21, - InstructionSet_Rdm_Arm64=22, - InstructionSet_Sha1_Arm64=23, - InstructionSet_Sha256_Arm64=24, - InstructionSet_Sve_Arm64=25, + InstructionSet_Sve2=17, + InstructionSet_ArmBase_Arm64=18, + InstructionSet_AdvSimd_Arm64=19, + InstructionSet_Aes_Arm64=20, + InstructionSet_Crc32_Arm64=21, + InstructionSet_Dp_Arm64=22, + InstructionSet_Rdm_Arm64=23, + InstructionSet_Sha1_Arm64=24, + InstructionSet_Sha256_Arm64=25, + InstructionSet_Sve_Arm64=26, + InstructionSet_Sve2_Arm64=27, #endif // TARGET_ARM64 +#ifdef TARGET_RISCV64 + InstructionSet_RiscV64Base=1, + InstructionSet_Zba=2, + InstructionSet_Zbb=3, +#endif // TARGET_RISCV64 #ifdef TARGET_AMD64 InstructionSet_X86Base=1, - InstructionSet_SSE=2, - InstructionSet_SSE2=3, - InstructionSet_SSE3=4, - InstructionSet_SSSE3=5, - InstructionSet_SSE41=6, - InstructionSet_SSE42=7, - InstructionSet_AVX=8, - InstructionSet_AVX2=9, - InstructionSet_AES=10, - InstructionSet_BMI1=11, - InstructionSet_BMI2=12, - InstructionSet_FMA=13, - InstructionSet_LZCNT=14, - InstructionSet_PCLMULQDQ=15, - InstructionSet_POPCNT=16, - InstructionSet_Vector128=17, - InstructionSet_Vector256=18, - InstructionSet_Vector512=19, - InstructionSet_AVXVNNI=20, - InstructionSet_MOVBE=21, + InstructionSet_SSE42=2, + InstructionSet_AVX=3, + InstructionSet_AVX2=4, + InstructionSet_AVX512=5, + InstructionSet_AVX512v2=6, + InstructionSet_AVX512v3=7, + InstructionSet_AVX10v1=8, + InstructionSet_AVX10v2=9, + InstructionSet_APX=10, + InstructionSet_AES=11, + InstructionSet_AES_V256=12, + InstructionSet_AES_V512=13, + InstructionSet_AVX512VP2INTERSECT=14, + InstructionSet_AVXIFMA=15, + InstructionSet_AVXVNNI=16, + InstructionSet_GFNI=17, + InstructionSet_GFNI_V256=18, + InstructionSet_GFNI_V512=19, + InstructionSet_SHA=20, + InstructionSet_WAITPKG=21, InstructionSet_X86Serialize=22, - InstructionSet_EVEX=23, - InstructionSet_AVX512F=24, - InstructionSet_AVX512F_VL=25, - InstructionSet_AVX512BW=26, - InstructionSet_AVX512BW_VL=27, - InstructionSet_AVX512CD=28, - InstructionSet_AVX512CD_VL=29, - InstructionSet_AVX512DQ=30, - InstructionSet_AVX512DQ_VL=31, - InstructionSet_AVX512VBMI=32, - InstructionSet_AVX512VBMI_VL=33, - InstructionSet_AVX10v1=34, - InstructionSet_AVX10v1_V512=35, - InstructionSet_VectorT128=36, - InstructionSet_VectorT256=37, - InstructionSet_VectorT512=38, - InstructionSet_X86Base_X64=39, - InstructionSet_SSE_X64=40, - InstructionSet_SSE2_X64=41, - InstructionSet_SSE3_X64=42, - InstructionSet_SSSE3_X64=43, - InstructionSet_SSE41_X64=44, - InstructionSet_SSE42_X64=45, - InstructionSet_AVX_X64=46, - InstructionSet_AVX2_X64=47, - InstructionSet_AES_X64=48, - InstructionSet_BMI1_X64=49, - InstructionSet_BMI2_X64=50, - InstructionSet_FMA_X64=51, - InstructionSet_LZCNT_X64=52, - InstructionSet_PCLMULQDQ_X64=53, - InstructionSet_POPCNT_X64=54, - InstructionSet_AVXVNNI_X64=55, - InstructionSet_MOVBE_X64=56, - InstructionSet_X86Serialize_X64=57, - InstructionSet_EVEX_X64=58, - InstructionSet_AVX512F_X64=59, - InstructionSet_AVX512F_VL_X64=60, - InstructionSet_AVX512BW_X64=61, - InstructionSet_AVX512BW_VL_X64=62, - InstructionSet_AVX512CD_X64=63, - InstructionSet_AVX512CD_VL_X64=64, - InstructionSet_AVX512DQ_X64=65, - InstructionSet_AVX512DQ_VL_X64=66, - InstructionSet_AVX512VBMI_X64=67, - InstructionSet_AVX512VBMI_VL_X64=68, - InstructionSet_AVX10v1_X64=69, - InstructionSet_AVX10v1_V512_X64=70, + InstructionSet_Vector128=23, + InstructionSet_Vector256=24, + InstructionSet_Vector512=25, + InstructionSet_VectorT128=26, + InstructionSet_VectorT256=27, + InstructionSet_VectorT512=28, + InstructionSet_AVXVNNIINT=29, + InstructionSet_AVXVNNIINT_V512=30, + InstructionSet_X86Base_X64=31, + InstructionSet_SSE42_X64=32, + InstructionSet_AVX_X64=33, + InstructionSet_AVX2_X64=34, + InstructionSet_AVX512_X64=35, + InstructionSet_AVX512v2_X64=36, + InstructionSet_AVX512v3_X64=37, + InstructionSet_AVX10v1_X64=38, + InstructionSet_AVX10v2_X64=39, + InstructionSet_AES_X64=40, + InstructionSet_AVX512VP2INTERSECT_X64=41, + InstructionSet_AVXIFMA_X64=42, + InstructionSet_AVXVNNI_X64=43, + InstructionSet_GFNI_X64=44, + InstructionSet_SHA_X64=45, + InstructionSet_WAITPKG_X64=46, + InstructionSet_X86Serialize_X64=47, #endif // TARGET_AMD64 #ifdef TARGET_X86 InstructionSet_X86Base=1, - InstructionSet_SSE=2, - InstructionSet_SSE2=3, - InstructionSet_SSE3=4, - InstructionSet_SSSE3=5, - InstructionSet_SSE41=6, - InstructionSet_SSE42=7, - InstructionSet_AVX=8, - InstructionSet_AVX2=9, - InstructionSet_AES=10, - InstructionSet_BMI1=11, - InstructionSet_BMI2=12, - InstructionSet_FMA=13, - InstructionSet_LZCNT=14, - InstructionSet_PCLMULQDQ=15, - InstructionSet_POPCNT=16, - InstructionSet_Vector128=17, - InstructionSet_Vector256=18, - InstructionSet_Vector512=19, - InstructionSet_AVXVNNI=20, - InstructionSet_MOVBE=21, + InstructionSet_SSE42=2, + InstructionSet_AVX=3, + InstructionSet_AVX2=4, + InstructionSet_AVX512=5, + InstructionSet_AVX512v2=6, + InstructionSet_AVX512v3=7, + InstructionSet_AVX10v1=8, + InstructionSet_AVX10v2=9, + InstructionSet_APX=10, + InstructionSet_AES=11, + InstructionSet_AES_V256=12, + InstructionSet_AES_V512=13, + InstructionSet_AVX512VP2INTERSECT=14, + InstructionSet_AVXIFMA=15, + InstructionSet_AVXVNNI=16, + InstructionSet_GFNI=17, + InstructionSet_GFNI_V256=18, + InstructionSet_GFNI_V512=19, + InstructionSet_SHA=20, + InstructionSet_WAITPKG=21, InstructionSet_X86Serialize=22, - InstructionSet_EVEX=23, - InstructionSet_AVX512F=24, - InstructionSet_AVX512F_VL=25, - InstructionSet_AVX512BW=26, - InstructionSet_AVX512BW_VL=27, - InstructionSet_AVX512CD=28, - InstructionSet_AVX512CD_VL=29, - InstructionSet_AVX512DQ=30, - InstructionSet_AVX512DQ_VL=31, - InstructionSet_AVX512VBMI=32, - InstructionSet_AVX512VBMI_VL=33, - InstructionSet_AVX10v1=34, - InstructionSet_AVX10v1_V512=35, - InstructionSet_VectorT128=36, - InstructionSet_VectorT256=37, - InstructionSet_VectorT512=38, - InstructionSet_X86Base_X64=39, - InstructionSet_SSE_X64=40, - InstructionSet_SSE2_X64=41, - InstructionSet_SSE3_X64=42, - InstructionSet_SSSE3_X64=43, - InstructionSet_SSE41_X64=44, - InstructionSet_SSE42_X64=45, - InstructionSet_AVX_X64=46, - InstructionSet_AVX2_X64=47, - InstructionSet_AES_X64=48, - InstructionSet_BMI1_X64=49, - InstructionSet_BMI2_X64=50, - InstructionSet_FMA_X64=51, - InstructionSet_LZCNT_X64=52, - InstructionSet_PCLMULQDQ_X64=53, - InstructionSet_POPCNT_X64=54, - InstructionSet_AVXVNNI_X64=55, - InstructionSet_MOVBE_X64=56, - InstructionSet_X86Serialize_X64=57, - InstructionSet_EVEX_X64=58, - InstructionSet_AVX512F_X64=59, - InstructionSet_AVX512F_VL_X64=60, - InstructionSet_AVX512BW_X64=61, - InstructionSet_AVX512BW_VL_X64=62, - InstructionSet_AVX512CD_X64=63, - InstructionSet_AVX512CD_VL_X64=64, - InstructionSet_AVX512DQ_X64=65, - InstructionSet_AVX512DQ_VL_X64=66, - InstructionSet_AVX512VBMI_X64=67, - InstructionSet_AVX512VBMI_VL_X64=68, - InstructionSet_AVX10v1_X64=69, - InstructionSet_AVX10v1_V512_X64=70, + InstructionSet_Vector128=23, + InstructionSet_Vector256=24, + InstructionSet_Vector512=25, + InstructionSet_VectorT128=26, + InstructionSet_VectorT256=27, + InstructionSet_VectorT512=28, + InstructionSet_AVXVNNIINT=29, + InstructionSet_AVXVNNIINT_V512=30, + InstructionSet_X86Base_X64=31, + InstructionSet_SSE42_X64=32, + InstructionSet_AVX_X64=33, + InstructionSet_AVX2_X64=34, + InstructionSet_AVX512_X64=35, + InstructionSet_AVX512v2_X64=36, + InstructionSet_AVX512v3_X64=37, + InstructionSet_AVX10v1_X64=38, + InstructionSet_AVX10v2_X64=39, + InstructionSet_AES_X64=40, + InstructionSet_AVX512VP2INTERSECT_X64=41, + InstructionSet_AVXIFMA_X64=42, + InstructionSet_AVXVNNI_X64=43, + InstructionSet_GFNI_X64=44, + InstructionSet_SHA_X64=45, + InstructionSet_WAITPKG_X64=46, + InstructionSet_X86Serialize_X64=47, #endif // TARGET_X86 }; @@ -298,72 +259,46 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_Sha256_Arm64); if (HasInstructionSet(InstructionSet_Sve)) AddInstructionSet(InstructionSet_Sve_Arm64); + if (HasInstructionSet(InstructionSet_Sve2)) + AddInstructionSet(InstructionSet_Sve2_Arm64); #endif // TARGET_ARM64 +#ifdef TARGET_RISCV64 +#endif // TARGET_RISCV64 #ifdef TARGET_AMD64 if (HasInstructionSet(InstructionSet_X86Base)) AddInstructionSet(InstructionSet_X86Base_X64); - if (HasInstructionSet(InstructionSet_SSE)) - AddInstructionSet(InstructionSet_SSE_X64); - if (HasInstructionSet(InstructionSet_SSE2)) - AddInstructionSet(InstructionSet_SSE2_X64); - if (HasInstructionSet(InstructionSet_SSE3)) - AddInstructionSet(InstructionSet_SSE3_X64); - if (HasInstructionSet(InstructionSet_SSSE3)) - AddInstructionSet(InstructionSet_SSSE3_X64); - if (HasInstructionSet(InstructionSet_SSE41)) - AddInstructionSet(InstructionSet_SSE41_X64); if (HasInstructionSet(InstructionSet_SSE42)) AddInstructionSet(InstructionSet_SSE42_X64); if (HasInstructionSet(InstructionSet_AVX)) AddInstructionSet(InstructionSet_AVX_X64); if (HasInstructionSet(InstructionSet_AVX2)) AddInstructionSet(InstructionSet_AVX2_X64); + if (HasInstructionSet(InstructionSet_AVX512)) + AddInstructionSet(InstructionSet_AVX512_X64); + if (HasInstructionSet(InstructionSet_AVX512v2)) + AddInstructionSet(InstructionSet_AVX512v2_X64); + if (HasInstructionSet(InstructionSet_AVX512v3)) + AddInstructionSet(InstructionSet_AVX512v3_X64); + if (HasInstructionSet(InstructionSet_AVX10v1)) + AddInstructionSet(InstructionSet_AVX10v1_X64); + if (HasInstructionSet(InstructionSet_AVX10v2)) + AddInstructionSet(InstructionSet_AVX10v2_X64); if (HasInstructionSet(InstructionSet_AES)) AddInstructionSet(InstructionSet_AES_X64); - if (HasInstructionSet(InstructionSet_BMI1)) - AddInstructionSet(InstructionSet_BMI1_X64); - if (HasInstructionSet(InstructionSet_BMI2)) - AddInstructionSet(InstructionSet_BMI2_X64); - if (HasInstructionSet(InstructionSet_FMA)) - AddInstructionSet(InstructionSet_FMA_X64); - if (HasInstructionSet(InstructionSet_LZCNT)) - AddInstructionSet(InstructionSet_LZCNT_X64); - if (HasInstructionSet(InstructionSet_PCLMULQDQ)) - AddInstructionSet(InstructionSet_PCLMULQDQ_X64); - if (HasInstructionSet(InstructionSet_POPCNT)) - AddInstructionSet(InstructionSet_POPCNT_X64); + if (HasInstructionSet(InstructionSet_AVX512VP2INTERSECT)) + AddInstructionSet(InstructionSet_AVX512VP2INTERSECT_X64); + if (HasInstructionSet(InstructionSet_AVXIFMA)) + AddInstructionSet(InstructionSet_AVXIFMA_X64); if (HasInstructionSet(InstructionSet_AVXVNNI)) AddInstructionSet(InstructionSet_AVXVNNI_X64); - if (HasInstructionSet(InstructionSet_MOVBE)) - AddInstructionSet(InstructionSet_MOVBE_X64); + if (HasInstructionSet(InstructionSet_GFNI)) + AddInstructionSet(InstructionSet_GFNI_X64); + if (HasInstructionSet(InstructionSet_SHA)) + AddInstructionSet(InstructionSet_SHA_X64); + if (HasInstructionSet(InstructionSet_WAITPKG)) + AddInstructionSet(InstructionSet_WAITPKG_X64); if (HasInstructionSet(InstructionSet_X86Serialize)) AddInstructionSet(InstructionSet_X86Serialize_X64); - if (HasInstructionSet(InstructionSet_EVEX)) - AddInstructionSet(InstructionSet_EVEX_X64); - if (HasInstructionSet(InstructionSet_AVX512F)) - AddInstructionSet(InstructionSet_AVX512F_X64); - if (HasInstructionSet(InstructionSet_AVX512F_VL)) - AddInstructionSet(InstructionSet_AVX512F_VL_X64); - if (HasInstructionSet(InstructionSet_AVX512BW)) - AddInstructionSet(InstructionSet_AVX512BW_X64); - if (HasInstructionSet(InstructionSet_AVX512BW_VL)) - AddInstructionSet(InstructionSet_AVX512BW_VL_X64); - if (HasInstructionSet(InstructionSet_AVX512CD)) - AddInstructionSet(InstructionSet_AVX512CD_X64); - if (HasInstructionSet(InstructionSet_AVX512CD_VL)) - AddInstructionSet(InstructionSet_AVX512CD_VL_X64); - if (HasInstructionSet(InstructionSet_AVX512DQ)) - AddInstructionSet(InstructionSet_AVX512DQ_X64); - if (HasInstructionSet(InstructionSet_AVX512DQ_VL)) - AddInstructionSet(InstructionSet_AVX512DQ_VL_X64); - if (HasInstructionSet(InstructionSet_AVX512VBMI)) - AddInstructionSet(InstructionSet_AVX512VBMI_X64); - if (HasInstructionSet(InstructionSet_AVX512VBMI_VL)) - AddInstructionSet(InstructionSet_AVX512VBMI_VL_X64); - if (HasInstructionSet(InstructionSet_AVX10v1)) - AddInstructionSet(InstructionSet_AVX10v1_X64); - if (HasInstructionSet(InstructionSet_AVX10v1_V512)) - AddInstructionSet(InstructionSet_AVX10v1_V512_X64); #endif // TARGET_AMD64 #ifdef TARGET_X86 #endif // TARGET_X86 @@ -420,6 +355,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_Sve); if (resultflags.HasInstructionSet(InstructionSet_Sve_Arm64) && !resultflags.HasInstructionSet(InstructionSet_Sve)) resultflags.RemoveInstructionSet(InstructionSet_Sve_Arm64); + if (resultflags.HasInstructionSet(InstructionSet_Sve2) && !resultflags.HasInstructionSet(InstructionSet_Sve2_Arm64)) + resultflags.RemoveInstructionSet(InstructionSet_Sve2); + if (resultflags.HasInstructionSet(InstructionSet_Sve2_Arm64) && !resultflags.HasInstructionSet(InstructionSet_Sve2)) + resultflags.RemoveInstructionSet(InstructionSet_Sve2_Arm64); if (resultflags.HasInstructionSet(InstructionSet_AdvSimd) && !resultflags.HasInstructionSet(InstructionSet_ArmBase)) resultflags.RemoveInstructionSet(InstructionSet_AdvSimd); if (resultflags.HasInstructionSet(InstructionSet_Aes) && !resultflags.HasInstructionSet(InstructionSet_ArmBase)) @@ -442,32 +381,20 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_VectorT128); if (resultflags.HasInstructionSet(InstructionSet_Sve) && !resultflags.HasInstructionSet(InstructionSet_AdvSimd)) resultflags.RemoveInstructionSet(InstructionSet_Sve); + if (resultflags.HasInstructionSet(InstructionSet_Sve2) && !resultflags.HasInstructionSet(InstructionSet_Sve)) + resultflags.RemoveInstructionSet(InstructionSet_Sve2); #endif // TARGET_ARM64 +#ifdef TARGET_RISCV64 + if (resultflags.HasInstructionSet(InstructionSet_Zbb) && !resultflags.HasInstructionSet(InstructionSet_RiscV64Base)) + resultflags.RemoveInstructionSet(InstructionSet_Zbb); + if (resultflags.HasInstructionSet(InstructionSet_Zba) && !resultflags.HasInstructionSet(InstructionSet_RiscV64Base)) + resultflags.RemoveInstructionSet(InstructionSet_Zba); +#endif // TARGET_RISCV64 #ifdef TARGET_AMD64 if (resultflags.HasInstructionSet(InstructionSet_X86Base) && !resultflags.HasInstructionSet(InstructionSet_X86Base_X64)) resultflags.RemoveInstructionSet(InstructionSet_X86Base); if (resultflags.HasInstructionSet(InstructionSet_X86Base_X64) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_X86Base_X64); - if (resultflags.HasInstructionSet(InstructionSet_SSE) && !resultflags.HasInstructionSet(InstructionSet_SSE_X64)) - resultflags.RemoveInstructionSet(InstructionSet_SSE); - if (resultflags.HasInstructionSet(InstructionSet_SSE_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE)) - resultflags.RemoveInstructionSet(InstructionSet_SSE_X64); - if (resultflags.HasInstructionSet(InstructionSet_SSE2) && !resultflags.HasInstructionSet(InstructionSet_SSE2_X64)) - resultflags.RemoveInstructionSet(InstructionSet_SSE2); - if (resultflags.HasInstructionSet(InstructionSet_SSE2_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) - resultflags.RemoveInstructionSet(InstructionSet_SSE2_X64); - if (resultflags.HasInstructionSet(InstructionSet_SSE3) && !resultflags.HasInstructionSet(InstructionSet_SSE3_X64)) - resultflags.RemoveInstructionSet(InstructionSet_SSE3); - if (resultflags.HasInstructionSet(InstructionSet_SSE3_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE3)) - resultflags.RemoveInstructionSet(InstructionSet_SSE3_X64); - if (resultflags.HasInstructionSet(InstructionSet_SSSE3) && !resultflags.HasInstructionSet(InstructionSet_SSSE3_X64)) - resultflags.RemoveInstructionSet(InstructionSet_SSSE3); - if (resultflags.HasInstructionSet(InstructionSet_SSSE3_X64) && !resultflags.HasInstructionSet(InstructionSet_SSSE3)) - resultflags.RemoveInstructionSet(InstructionSet_SSSE3_X64); - if (resultflags.HasInstructionSet(InstructionSet_SSE41) && !resultflags.HasInstructionSet(InstructionSet_SSE41_X64)) - resultflags.RemoveInstructionSet(InstructionSet_SSE41); - if (resultflags.HasInstructionSet(InstructionSet_SSE41_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE41)) - resultflags.RemoveInstructionSet(InstructionSet_SSE41_X64); if (resultflags.HasInstructionSet(InstructionSet_SSE42) && !resultflags.HasInstructionSet(InstructionSet_SSE42_X64)) resultflags.RemoveInstructionSet(InstructionSet_SSE42); if (resultflags.HasInstructionSet(InstructionSet_SSE42_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) @@ -480,307 +407,187 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AVX2); if (resultflags.HasInstructionSet(InstructionSet_AVX2_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_AVX2_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX512) && !resultflags.HasInstructionSet(InstructionSet_AVX512_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512); + if (resultflags.HasInstructionSet(InstructionSet_AVX512_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v2) && !resultflags.HasInstructionSet(InstructionSet_AVX512v2_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v2); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v2_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512v2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v2_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v3) && !resultflags.HasInstructionSet(InstructionSet_AVX512v3_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v3); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v3_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512v3)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v3_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v2) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v2); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v2_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v2_X64); if (resultflags.HasInstructionSet(InstructionSet_AES) && !resultflags.HasInstructionSet(InstructionSet_AES_X64)) resultflags.RemoveInstructionSet(InstructionSet_AES); if (resultflags.HasInstructionSet(InstructionSet_AES_X64) && !resultflags.HasInstructionSet(InstructionSet_AES)) resultflags.RemoveInstructionSet(InstructionSet_AES_X64); - if (resultflags.HasInstructionSet(InstructionSet_BMI1) && !resultflags.HasInstructionSet(InstructionSet_BMI1_X64)) - resultflags.RemoveInstructionSet(InstructionSet_BMI1); - if (resultflags.HasInstructionSet(InstructionSet_BMI1_X64) && !resultflags.HasInstructionSet(InstructionSet_BMI1)) - resultflags.RemoveInstructionSet(InstructionSet_BMI1_X64); - if (resultflags.HasInstructionSet(InstructionSet_BMI2) && !resultflags.HasInstructionSet(InstructionSet_BMI2_X64)) - resultflags.RemoveInstructionSet(InstructionSet_BMI2); - if (resultflags.HasInstructionSet(InstructionSet_BMI2_X64) && !resultflags.HasInstructionSet(InstructionSet_BMI2)) - resultflags.RemoveInstructionSet(InstructionSet_BMI2_X64); - if (resultflags.HasInstructionSet(InstructionSet_FMA) && !resultflags.HasInstructionSet(InstructionSet_FMA_X64)) - resultflags.RemoveInstructionSet(InstructionSet_FMA); - if (resultflags.HasInstructionSet(InstructionSet_FMA_X64) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_FMA_X64); - if (resultflags.HasInstructionSet(InstructionSet_LZCNT) && !resultflags.HasInstructionSet(InstructionSet_LZCNT_X64)) - resultflags.RemoveInstructionSet(InstructionSet_LZCNT); - if (resultflags.HasInstructionSet(InstructionSet_LZCNT_X64) && !resultflags.HasInstructionSet(InstructionSet_LZCNT)) - resultflags.RemoveInstructionSet(InstructionSet_LZCNT_X64); - if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_X64)) - resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ); - if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_X64) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ)) - resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_X64); - if (resultflags.HasInstructionSet(InstructionSet_POPCNT) && !resultflags.HasInstructionSet(InstructionSet_POPCNT_X64)) - resultflags.RemoveInstructionSet(InstructionSet_POPCNT); - if (resultflags.HasInstructionSet(InstructionSet_POPCNT_X64) && !resultflags.HasInstructionSet(InstructionSet_POPCNT)) - resultflags.RemoveInstructionSet(InstructionSet_POPCNT_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX512VP2INTERSECT) && !resultflags.HasInstructionSet(InstructionSet_AVX512VP2INTERSECT_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512VP2INTERSECT); + if (resultflags.HasInstructionSet(InstructionSet_AVX512VP2INTERSECT_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512VP2INTERSECT)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512VP2INTERSECT_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVXIFMA) && !resultflags.HasInstructionSet(InstructionSet_AVXIFMA_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVXIFMA); + if (resultflags.HasInstructionSet(InstructionSet_AVXIFMA_X64) && !resultflags.HasInstructionSet(InstructionSet_AVXIFMA)) + resultflags.RemoveInstructionSet(InstructionSet_AVXIFMA_X64); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI) && !resultflags.HasInstructionSet(InstructionSet_AVXVNNI_X64)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI_X64) && !resultflags.HasInstructionSet(InstructionSet_AVXVNNI)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI_X64); - if (resultflags.HasInstructionSet(InstructionSet_MOVBE) && !resultflags.HasInstructionSet(InstructionSet_MOVBE_X64)) - resultflags.RemoveInstructionSet(InstructionSet_MOVBE); - if (resultflags.HasInstructionSet(InstructionSet_MOVBE_X64) && !resultflags.HasInstructionSet(InstructionSet_MOVBE)) - resultflags.RemoveInstructionSet(InstructionSet_MOVBE_X64); + if (resultflags.HasInstructionSet(InstructionSet_GFNI) && !resultflags.HasInstructionSet(InstructionSet_GFNI_X64)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_X64) && !resultflags.HasInstructionSet(InstructionSet_GFNI)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_X64); + if (resultflags.HasInstructionSet(InstructionSet_SHA) && !resultflags.HasInstructionSet(InstructionSet_SHA_X64)) + resultflags.RemoveInstructionSet(InstructionSet_SHA); + if (resultflags.HasInstructionSet(InstructionSet_SHA_X64) && !resultflags.HasInstructionSet(InstructionSet_SHA)) + resultflags.RemoveInstructionSet(InstructionSet_SHA_X64); + if (resultflags.HasInstructionSet(InstructionSet_WAITPKG) && !resultflags.HasInstructionSet(InstructionSet_WAITPKG_X64)) + resultflags.RemoveInstructionSet(InstructionSet_WAITPKG); + if (resultflags.HasInstructionSet(InstructionSet_WAITPKG_X64) && !resultflags.HasInstructionSet(InstructionSet_WAITPKG)) + resultflags.RemoveInstructionSet(InstructionSet_WAITPKG_X64); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Serialize_X64)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize_X64) && !resultflags.HasInstructionSet(InstructionSet_X86Serialize)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize_X64); - if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_EVEX_X64)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX); - if (resultflags.HasInstructionSet(InstructionSet_EVEX_X64) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F_VL_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F_VL_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_VL_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_VL_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_VL_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_X64); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512_X64)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512_X64); - if (resultflags.HasInstructionSet(InstructionSet_SSE) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) - resultflags.RemoveInstructionSet(InstructionSet_SSE); - if (resultflags.HasInstructionSet(InstructionSet_SSE2) && !resultflags.HasInstructionSet(InstructionSet_SSE)) - resultflags.RemoveInstructionSet(InstructionSet_SSE2); - if (resultflags.HasInstructionSet(InstructionSet_SSE3) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) - resultflags.RemoveInstructionSet(InstructionSet_SSE3); - if (resultflags.HasInstructionSet(InstructionSet_SSSE3) && !resultflags.HasInstructionSet(InstructionSet_SSE3)) - resultflags.RemoveInstructionSet(InstructionSet_SSSE3); - if (resultflags.HasInstructionSet(InstructionSet_SSE41) && !resultflags.HasInstructionSet(InstructionSet_SSSE3)) - resultflags.RemoveInstructionSet(InstructionSet_SSE41); - if (resultflags.HasInstructionSet(InstructionSet_SSE42) && !resultflags.HasInstructionSet(InstructionSet_SSE41)) + if (resultflags.HasInstructionSet(InstructionSet_SSE42) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_SSE42); - if (resultflags.HasInstructionSet(InstructionSet_POPCNT) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) - resultflags.RemoveInstructionSet(InstructionSet_POPCNT); if (resultflags.HasInstructionSet(InstructionSet_AVX) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) resultflags.RemoveInstructionSet(InstructionSet_AVX); if (resultflags.HasInstructionSet(InstructionSet_AVX2) && !resultflags.HasInstructionSet(InstructionSet_AVX)) resultflags.RemoveInstructionSet(InstructionSet_AVX2); - if (resultflags.HasInstructionSet(InstructionSet_BMI1) && !resultflags.HasInstructionSet(InstructionSet_AVX)) - resultflags.RemoveInstructionSet(InstructionSet_BMI1); - if (resultflags.HasInstructionSet(InstructionSet_BMI2) && !resultflags.HasInstructionSet(InstructionSet_AVX)) - resultflags.RemoveInstructionSet(InstructionSet_BMI2); - if (resultflags.HasInstructionSet(InstructionSet_FMA) && !resultflags.HasInstructionSet(InstructionSet_AVX)) - resultflags.RemoveInstructionSet(InstructionSet_FMA); - if (resultflags.HasInstructionSet(InstructionSet_LZCNT) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) - resultflags.RemoveInstructionSet(InstructionSet_LZCNT); - if (resultflags.HasInstructionSet(InstructionSet_MOVBE) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) - resultflags.RemoveInstructionSet(InstructionSet_MOVBE); - if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX); - if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AES) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) + if (resultflags.HasInstructionSet(InstructionSet_AVX512) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v2) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v2); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v3) && !resultflags.HasInstructionSet(InstructionSet_AVX512v2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v3); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_AVX512v3)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v2) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v2); + if (resultflags.HasInstructionSet(InstructionSet_AES) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_AES); - if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) - resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet_AES_V256) && !resultflags.HasInstructionSet(InstructionSet_AES)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V256); + if (resultflags.HasInstructionSet(InstructionSet_AES_V256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V256); + if (resultflags.HasInstructionSet(InstructionSet_AES_V512) && !resultflags.HasInstructionSet(InstructionSet_AES_V256)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V512); + if (resultflags.HasInstructionSet(InstructionSet_AES_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V512); + if (resultflags.HasInstructionSet(InstructionSet_AVX512VP2INTERSECT) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512VP2INTERSECT); + if (resultflags.HasInstructionSet(InstructionSet_AVXIFMA) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVXIFMA); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI); + if (resultflags.HasInstructionSet(InstructionSet_GFNI) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V256) && !resultflags.HasInstructionSet(InstructionSet_GFNI)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V256); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V256); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V512) && !resultflags.HasInstructionSet(InstructionSet_GFNI_V256)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V512); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V512); + if (resultflags.HasInstructionSet(InstructionSet_SHA) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) + resultflags.RemoveInstructionSet(InstructionSet_SHA); + if (resultflags.HasInstructionSet(InstructionSet_WAITPKG) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) + resultflags.RemoveInstructionSet(InstructionSet_WAITPKG); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_Vector128) && !resultflags.HasInstructionSet(InstructionSet_SSE)) + if (resultflags.HasInstructionSet(InstructionSet_AVXVNNIINT) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVXVNNIINT); + if (resultflags.HasInstructionSet(InstructionSet_AVXVNNIINT_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2)) + resultflags.RemoveInstructionSet(InstructionSet_AVXVNNIINT_V512); + if (resultflags.HasInstructionSet(InstructionSet_Vector128) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_Vector128); if (resultflags.HasInstructionSet(InstructionSet_Vector256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) resultflags.RemoveInstructionSet(InstructionSet_Vector256); - if (resultflags.HasInstructionSet(InstructionSet_Vector512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet_Vector512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) resultflags.RemoveInstructionSet(InstructionSet_Vector512); - if (resultflags.HasInstructionSet(InstructionSet_VectorT128) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) + if (resultflags.HasInstructionSet(InstructionSet_VectorT128) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_VectorT128); if (resultflags.HasInstructionSet(InstructionSet_VectorT256) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_VectorT256); - if (resultflags.HasInstructionSet(InstructionSet_VectorT512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet_VectorT512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) resultflags.RemoveInstructionSet(InstructionSet_VectorT512); #endif // TARGET_AMD64 #ifdef TARGET_X86 - if (resultflags.HasInstructionSet(InstructionSet_SSE) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) - resultflags.RemoveInstructionSet(InstructionSet_SSE); - if (resultflags.HasInstructionSet(InstructionSet_SSE2) && !resultflags.HasInstructionSet(InstructionSet_SSE)) - resultflags.RemoveInstructionSet(InstructionSet_SSE2); - if (resultflags.HasInstructionSet(InstructionSet_SSE3) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) - resultflags.RemoveInstructionSet(InstructionSet_SSE3); - if (resultflags.HasInstructionSet(InstructionSet_SSSE3) && !resultflags.HasInstructionSet(InstructionSet_SSE3)) - resultflags.RemoveInstructionSet(InstructionSet_SSSE3); - if (resultflags.HasInstructionSet(InstructionSet_SSE41) && !resultflags.HasInstructionSet(InstructionSet_SSSE3)) - resultflags.RemoveInstructionSet(InstructionSet_SSE41); - if (resultflags.HasInstructionSet(InstructionSet_SSE42) && !resultflags.HasInstructionSet(InstructionSet_SSE41)) + if (resultflags.HasInstructionSet(InstructionSet_SSE42) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_SSE42); - if (resultflags.HasInstructionSet(InstructionSet_POPCNT) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) - resultflags.RemoveInstructionSet(InstructionSet_POPCNT); if (resultflags.HasInstructionSet(InstructionSet_AVX) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) resultflags.RemoveInstructionSet(InstructionSet_AVX); if (resultflags.HasInstructionSet(InstructionSet_AVX2) && !resultflags.HasInstructionSet(InstructionSet_AVX)) resultflags.RemoveInstructionSet(InstructionSet_AVX2); - if (resultflags.HasInstructionSet(InstructionSet_BMI1) && !resultflags.HasInstructionSet(InstructionSet_AVX)) - resultflags.RemoveInstructionSet(InstructionSet_BMI1); - if (resultflags.HasInstructionSet(InstructionSet_BMI2) && !resultflags.HasInstructionSet(InstructionSet_AVX)) - resultflags.RemoveInstructionSet(InstructionSet_BMI2); - if (resultflags.HasInstructionSet(InstructionSet_FMA) && !resultflags.HasInstructionSet(InstructionSet_AVX)) - resultflags.RemoveInstructionSet(InstructionSet_FMA); - if (resultflags.HasInstructionSet(InstructionSet_LZCNT) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) - resultflags.RemoveInstructionSet(InstructionSet_LZCNT); - if (resultflags.HasInstructionSet(InstructionSet_MOVBE) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) - resultflags.RemoveInstructionSet(InstructionSet_MOVBE); - if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX); - if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512CD_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512DQ_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AES) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) + if (resultflags.HasInstructionSet(InstructionSet_AVX512) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v2) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v2); + if (resultflags.HasInstructionSet(InstructionSet_AVX512v3) && !resultflags.HasInstructionSet(InstructionSet_AVX512v2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512v3); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_AVX512v3)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); + if (resultflags.HasInstructionSet(InstructionSet_AVX10v2) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) + resultflags.RemoveInstructionSet(InstructionSet_AVX10v2); + if (resultflags.HasInstructionSet(InstructionSet_AES) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_AES); - if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) - resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet_AES_V256) && !resultflags.HasInstructionSet(InstructionSet_AES)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V256); + if (resultflags.HasInstructionSet(InstructionSet_AES_V256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V256); + if (resultflags.HasInstructionSet(InstructionSet_AES_V512) && !resultflags.HasInstructionSet(InstructionSet_AES_V256)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V512); + if (resultflags.HasInstructionSet(InstructionSet_AES_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AES_V512); + if (resultflags.HasInstructionSet(InstructionSet_AVX512VP2INTERSECT) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_AVX512VP2INTERSECT); + if (resultflags.HasInstructionSet(InstructionSet_AVXIFMA) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVXIFMA); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI); + if (resultflags.HasInstructionSet(InstructionSet_GFNI) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V256) && !resultflags.HasInstructionSet(InstructionSet_GFNI)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V256); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V256); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V512) && !resultflags.HasInstructionSet(InstructionSet_GFNI_V256)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V512); + if (resultflags.HasInstructionSet(InstructionSet_GFNI_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) + resultflags.RemoveInstructionSet(InstructionSet_GFNI_V512); + if (resultflags.HasInstructionSet(InstructionSet_SHA) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) + resultflags.RemoveInstructionSet(InstructionSet_SHA); + if (resultflags.HasInstructionSet(InstructionSet_WAITPKG) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) + resultflags.RemoveInstructionSet(InstructionSet_WAITPKG); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512CD_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512DQ_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet_Vector128) && !resultflags.HasInstructionSet(InstructionSet_SSE)) + if (resultflags.HasInstructionSet(InstructionSet_AVXVNNIINT) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVXVNNIINT); + if (resultflags.HasInstructionSet(InstructionSet_AVXVNNIINT_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2)) + resultflags.RemoveInstructionSet(InstructionSet_AVXVNNIINT_V512); + if (resultflags.HasInstructionSet(InstructionSet_Vector128) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_Vector128); if (resultflags.HasInstructionSet(InstructionSet_Vector256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) resultflags.RemoveInstructionSet(InstructionSet_Vector256); - if (resultflags.HasInstructionSet(InstructionSet_Vector512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet_Vector512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) resultflags.RemoveInstructionSet(InstructionSet_Vector512); - if (resultflags.HasInstructionSet(InstructionSet_VectorT128) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) + if (resultflags.HasInstructionSet(InstructionSet_VectorT128) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_VectorT128); if (resultflags.HasInstructionSet(InstructionSet_VectorT256) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_VectorT256); - if (resultflags.HasInstructionSet(InstructionSet_VectorT512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet_VectorT512) && !resultflags.HasInstructionSet(InstructionSet_AVX512)) resultflags.RemoveInstructionSet(InstructionSet_VectorT512); #endif // TARGET_X86 @@ -848,32 +655,24 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "Sve"; case InstructionSet_Sve_Arm64 : return "Sve_Arm64"; + case InstructionSet_Sve2 : + return "Sve2"; + case InstructionSet_Sve2_Arm64 : + return "Sve2_Arm64"; #endif // TARGET_ARM64 +#ifdef TARGET_RISCV64 + case InstructionSet_RiscV64Base : + return "RiscV64Base"; + case InstructionSet_Zba : + return "Zba"; + case InstructionSet_Zbb : + return "Zbb"; +#endif // TARGET_RISCV64 #ifdef TARGET_AMD64 case InstructionSet_X86Base : return "X86Base"; case InstructionSet_X86Base_X64 : return "X86Base_X64"; - case InstructionSet_SSE : - return "SSE"; - case InstructionSet_SSE_X64 : - return "SSE_X64"; - case InstructionSet_SSE2 : - return "SSE2"; - case InstructionSet_SSE2_X64 : - return "SSE2_X64"; - case InstructionSet_SSE3 : - return "SSE3"; - case InstructionSet_SSE3_X64 : - return "SSE3_X64"; - case InstructionSet_SSSE3 : - return "SSSE3"; - case InstructionSet_SSSE3_X64 : - return "SSSE3_X64"; - case InstructionSet_SSE41 : - return "SSE41"; - case InstructionSet_SSE41_X64 : - return "SSE41_X64"; case InstructionSet_SSE42 : return "SSE42"; case InstructionSet_SSE42_X64 : @@ -886,188 +685,146 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "AVX2"; case InstructionSet_AVX2_X64 : return "AVX2_X64"; + case InstructionSet_AVX512 : + return "AVX512"; + case InstructionSet_AVX512_X64 : + return "AVX512_X64"; + case InstructionSet_AVX512v2 : + return "AVX512v2"; + case InstructionSet_AVX512v2_X64 : + return "AVX512v2_X64"; + case InstructionSet_AVX512v3 : + return "AVX512v3"; + case InstructionSet_AVX512v3_X64 : + return "AVX512v3_X64"; + case InstructionSet_AVX10v1 : + return "AVX10v1"; + case InstructionSet_AVX10v1_X64 : + return "AVX10v1_X64"; + case InstructionSet_AVX10v2 : + return "AVX10v2"; + case InstructionSet_AVX10v2_X64 : + return "AVX10v2_X64"; + case InstructionSet_APX : + return "APX"; case InstructionSet_AES : return "AES"; case InstructionSet_AES_X64 : return "AES_X64"; - case InstructionSet_BMI1 : - return "BMI1"; - case InstructionSet_BMI1_X64 : - return "BMI1_X64"; - case InstructionSet_BMI2 : - return "BMI2"; - case InstructionSet_BMI2_X64 : - return "BMI2_X64"; - case InstructionSet_FMA : - return "FMA"; - case InstructionSet_FMA_X64 : - return "FMA_X64"; - case InstructionSet_LZCNT : - return "LZCNT"; - case InstructionSet_LZCNT_X64 : - return "LZCNT_X64"; - case InstructionSet_PCLMULQDQ : - return "PCLMULQDQ"; - case InstructionSet_PCLMULQDQ_X64 : - return "PCLMULQDQ_X64"; - case InstructionSet_POPCNT : - return "POPCNT"; - case InstructionSet_POPCNT_X64 : - return "POPCNT_X64"; - case InstructionSet_Vector128 : - return "Vector128"; - case InstructionSet_Vector256 : - return "Vector256"; - case InstructionSet_Vector512 : - return "Vector512"; + case InstructionSet_AES_V256 : + return "AES_V256"; + case InstructionSet_AES_V512 : + return "AES_V512"; + case InstructionSet_AVX512VP2INTERSECT : + return "AVX512VP2INTERSECT"; + case InstructionSet_AVX512VP2INTERSECT_X64 : + return "AVX512VP2INTERSECT_X64"; + case InstructionSet_AVXIFMA : + return "AVXIFMA"; + case InstructionSet_AVXIFMA_X64 : + return "AVXIFMA_X64"; case InstructionSet_AVXVNNI : return "AVXVNNI"; case InstructionSet_AVXVNNI_X64 : return "AVXVNNI_X64"; - case InstructionSet_MOVBE : - return "MOVBE"; - case InstructionSet_MOVBE_X64 : - return "MOVBE_X64"; + case InstructionSet_GFNI : + return "GFNI"; + case InstructionSet_GFNI_X64 : + return "GFNI_X64"; + case InstructionSet_GFNI_V256 : + return "GFNI_V256"; + case InstructionSet_GFNI_V512 : + return "GFNI_V512"; + case InstructionSet_SHA : + return "SHA"; + case InstructionSet_SHA_X64 : + return "SHA_X64"; + case InstructionSet_WAITPKG : + return "WAITPKG"; + case InstructionSet_WAITPKG_X64 : + return "WAITPKG_X64"; case InstructionSet_X86Serialize : return "X86Serialize"; case InstructionSet_X86Serialize_X64 : return "X86Serialize_X64"; - case InstructionSet_EVEX : - return "EVEX"; - case InstructionSet_EVEX_X64 : - return "EVEX_X64"; - case InstructionSet_AVX512F : - return "AVX512F"; - case InstructionSet_AVX512F_X64 : - return "AVX512F_X64"; - case InstructionSet_AVX512F_VL : - return "AVX512F_VL"; - case InstructionSet_AVX512F_VL_X64 : - return "AVX512F_VL_X64"; - case InstructionSet_AVX512BW : - return "AVX512BW"; - case InstructionSet_AVX512BW_X64 : - return "AVX512BW_X64"; - case InstructionSet_AVX512BW_VL : - return "AVX512BW_VL"; - case InstructionSet_AVX512BW_VL_X64 : - return "AVX512BW_VL_X64"; - case InstructionSet_AVX512CD : - return "AVX512CD"; - case InstructionSet_AVX512CD_X64 : - return "AVX512CD_X64"; - case InstructionSet_AVX512CD_VL : - return "AVX512CD_VL"; - case InstructionSet_AVX512CD_VL_X64 : - return "AVX512CD_VL_X64"; - case InstructionSet_AVX512DQ : - return "AVX512DQ"; - case InstructionSet_AVX512DQ_X64 : - return "AVX512DQ_X64"; - case InstructionSet_AVX512DQ_VL : - return "AVX512DQ_VL"; - case InstructionSet_AVX512DQ_VL_X64 : - return "AVX512DQ_VL_X64"; - case InstructionSet_AVX512VBMI : - return "AVX512VBMI"; - case InstructionSet_AVX512VBMI_X64 : - return "AVX512VBMI_X64"; - case InstructionSet_AVX512VBMI_VL : - return "AVX512VBMI_VL"; - case InstructionSet_AVX512VBMI_VL_X64 : - return "AVX512VBMI_VL_X64"; - case InstructionSet_AVX10v1 : - return "AVX10v1"; - case InstructionSet_AVX10v1_X64 : - return "AVX10v1_X64"; - case InstructionSet_AVX10v1_V512 : - return "AVX10v1_V512"; - case InstructionSet_AVX10v1_V512_X64 : - return "AVX10v1_V512_X64"; + case InstructionSet_Vector128 : + return "Vector128"; + case InstructionSet_Vector256 : + return "Vector256"; + case InstructionSet_Vector512 : + return "Vector512"; case InstructionSet_VectorT128 : return "VectorT128"; case InstructionSet_VectorT256 : return "VectorT256"; case InstructionSet_VectorT512 : return "VectorT512"; + case InstructionSet_AVXVNNIINT : + return "AVXVNNIINT"; + case InstructionSet_AVXVNNIINT_V512 : + return "AVXVNNIINT_V512"; #endif // TARGET_AMD64 #ifdef TARGET_X86 case InstructionSet_X86Base : return "X86Base"; - case InstructionSet_SSE : - return "SSE"; - case InstructionSet_SSE2 : - return "SSE2"; - case InstructionSet_SSE3 : - return "SSE3"; - case InstructionSet_SSSE3 : - return "SSSE3"; - case InstructionSet_SSE41 : - return "SSE41"; case InstructionSet_SSE42 : return "SSE42"; case InstructionSet_AVX : return "AVX"; case InstructionSet_AVX2 : return "AVX2"; + case InstructionSet_AVX512 : + return "AVX512"; + case InstructionSet_AVX512v2 : + return "AVX512v2"; + case InstructionSet_AVX512v3 : + return "AVX512v3"; + case InstructionSet_AVX10v1 : + return "AVX10v1"; + case InstructionSet_AVX10v2 : + return "AVX10v2"; + case InstructionSet_APX : + return "APX"; case InstructionSet_AES : return "AES"; - case InstructionSet_BMI1 : - return "BMI1"; - case InstructionSet_BMI2 : - return "BMI2"; - case InstructionSet_FMA : - return "FMA"; - case InstructionSet_LZCNT : - return "LZCNT"; - case InstructionSet_PCLMULQDQ : - return "PCLMULQDQ"; - case InstructionSet_POPCNT : - return "POPCNT"; + case InstructionSet_AES_V256 : + return "AES_V256"; + case InstructionSet_AES_V512 : + return "AES_V512"; + case InstructionSet_AVX512VP2INTERSECT : + return "AVX512VP2INTERSECT"; + case InstructionSet_AVXIFMA : + return "AVXIFMA"; + case InstructionSet_AVXVNNI : + return "AVXVNNI"; + case InstructionSet_GFNI : + return "GFNI"; + case InstructionSet_GFNI_V256 : + return "GFNI_V256"; + case InstructionSet_GFNI_V512 : + return "GFNI_V512"; + case InstructionSet_SHA : + return "SHA"; + case InstructionSet_WAITPKG : + return "WAITPKG"; + case InstructionSet_X86Serialize : + return "X86Serialize"; case InstructionSet_Vector128 : return "Vector128"; case InstructionSet_Vector256 : return "Vector256"; case InstructionSet_Vector512 : return "Vector512"; - case InstructionSet_AVXVNNI : - return "AVXVNNI"; - case InstructionSet_MOVBE : - return "MOVBE"; - case InstructionSet_X86Serialize : - return "X86Serialize"; - case InstructionSet_EVEX : - return "EVEX"; - case InstructionSet_AVX512F : - return "AVX512F"; - case InstructionSet_AVX512F_VL : - return "AVX512F_VL"; - case InstructionSet_AVX512BW : - return "AVX512BW"; - case InstructionSet_AVX512BW_VL : - return "AVX512BW_VL"; - case InstructionSet_AVX512CD : - return "AVX512CD"; - case InstructionSet_AVX512CD_VL : - return "AVX512CD_VL"; - case InstructionSet_AVX512DQ : - return "AVX512DQ"; - case InstructionSet_AVX512DQ_VL : - return "AVX512DQ_VL"; - case InstructionSet_AVX512VBMI : - return "AVX512VBMI"; - case InstructionSet_AVX512VBMI_VL : - return "AVX512VBMI_VL"; - case InstructionSet_AVX10v1 : - return "AVX10v1"; - case InstructionSet_AVX10v1_V512 : - return "AVX10v1_V512"; case InstructionSet_VectorT128 : return "VectorT128"; case InstructionSet_VectorT256 : return "VectorT256"; case InstructionSet_VectorT512 : return "VectorT512"; + case InstructionSet_AVXVNNIINT : + return "AVXVNNIINT"; + case InstructionSet_AVXVNNIINT_V512 : + return "AVXVNNIINT_V512"; #endif // TARGET_X86 default: @@ -1101,80 +858,150 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_VectorT128: return InstructionSet_VectorT128; case READYTORUN_INSTRUCTION_Rcpc2: return InstructionSet_Rcpc2; case READYTORUN_INSTRUCTION_Sve: return InstructionSet_Sve; + case READYTORUN_INSTRUCTION_Sve2: return InstructionSet_Sve2; #endif // TARGET_ARM64 +#ifdef TARGET_RISCV64 + case READYTORUN_INSTRUCTION_RiscV64Base: return InstructionSet_RiscV64Base; + case READYTORUN_INSTRUCTION_Zba: return InstructionSet_Zba; + case READYTORUN_INSTRUCTION_Zbb: return InstructionSet_Zbb; +#endif // TARGET_RISCV64 #ifdef TARGET_AMD64 case READYTORUN_INSTRUCTION_X86Base: return InstructionSet_X86Base; - case READYTORUN_INSTRUCTION_Sse: return InstructionSet_SSE; - case READYTORUN_INSTRUCTION_Sse2: return InstructionSet_SSE2; - case READYTORUN_INSTRUCTION_Sse3: return InstructionSet_SSE3; - case READYTORUN_INSTRUCTION_Ssse3: return InstructionSet_SSSE3; - case READYTORUN_INSTRUCTION_Sse41: return InstructionSet_SSE41; + case READYTORUN_INSTRUCTION_Sse: return InstructionSet_X86Base; + case READYTORUN_INSTRUCTION_Sse2: return InstructionSet_X86Base; case READYTORUN_INSTRUCTION_Sse42: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Sse3: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Ssse3: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Sse41: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Popcnt: return InstructionSet_SSE42; case READYTORUN_INSTRUCTION_Avx: return InstructionSet_AVX; case READYTORUN_INSTRUCTION_Avx2: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Bmi1: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Bmi2: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_F16C: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Fma: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Lzcnt: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Evex: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512F: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512F_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512BW: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512BW_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512CD: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512CD_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512DQ: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512DQ_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512Ifma: return InstructionSet_AVX512v2; + case READYTORUN_INSTRUCTION_Avx512Vbmi: return InstructionSet_AVX512v2; + case READYTORUN_INSTRUCTION_Avx512Vbmi_VL: return InstructionSet_AVX512v2; + case READYTORUN_INSTRUCTION_Avx512Bitalg: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Bitalg_VL: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vbmi2: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vbmi2_VL: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vnni: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vpopcntdq: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vpopcntdq_VL: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Bf16: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx512Bf16_VL: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx512Fp16: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx512Fp16_VL: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx10v1: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx10v1_V512: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx10v2: return InstructionSet_AVX10v2; + case READYTORUN_INSTRUCTION_Avx10v2_V512: return InstructionSet_AVX10v2; + case READYTORUN_INSTRUCTION_Apx: return InstructionSet_APX; case READYTORUN_INSTRUCTION_Aes: return InstructionSet_AES; - case READYTORUN_INSTRUCTION_Bmi1: return InstructionSet_BMI1; - case READYTORUN_INSTRUCTION_Bmi2: return InstructionSet_BMI2; - case READYTORUN_INSTRUCTION_Fma: return InstructionSet_FMA; - case READYTORUN_INSTRUCTION_Lzcnt: return InstructionSet_LZCNT; - case READYTORUN_INSTRUCTION_Pclmulqdq: return InstructionSet_PCLMULQDQ; - case READYTORUN_INSTRUCTION_Popcnt: return InstructionSet_POPCNT; + case READYTORUN_INSTRUCTION_Aes_V256: return InstructionSet_AES_V256; + case READYTORUN_INSTRUCTION_Aes_V512: return InstructionSet_AES_V512; + case READYTORUN_INSTRUCTION_Pclmulqdq: return InstructionSet_AES; + case READYTORUN_INSTRUCTION_Pclmulqdq_V256: return InstructionSet_AES_V256; + case READYTORUN_INSTRUCTION_Pclmulqdq_V512: return InstructionSet_AES_V512; + case READYTORUN_INSTRUCTION_Avx512Vp2intersect: return InstructionSet_AVX512VP2INTERSECT; + case READYTORUN_INSTRUCTION_Avx512Vp2intersect_VL: return InstructionSet_AVX512VP2INTERSECT; + case READYTORUN_INSTRUCTION_AvxIfma: return InstructionSet_AVXIFMA; case READYTORUN_INSTRUCTION_AvxVnni: return InstructionSet_AVXVNNI; - case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_MOVBE; + case READYTORUN_INSTRUCTION_Gfni: return InstructionSet_GFNI; + case READYTORUN_INSTRUCTION_Gfni_V256: return InstructionSet_GFNI_V256; + case READYTORUN_INSTRUCTION_Gfni_V512: return InstructionSet_GFNI_V512; + case READYTORUN_INSTRUCTION_Sha: return InstructionSet_SHA; + case READYTORUN_INSTRUCTION_WaitPkg: return InstructionSet_WAITPKG; case READYTORUN_INSTRUCTION_X86Serialize: return InstructionSet_X86Serialize; - case READYTORUN_INSTRUCTION_EVEX: return InstructionSet_EVEX; - case READYTORUN_INSTRUCTION_Avx512F: return InstructionSet_AVX512F; - case READYTORUN_INSTRUCTION_Avx512F_VL: return InstructionSet_AVX512F_VL; - case READYTORUN_INSTRUCTION_Avx512BW: return InstructionSet_AVX512BW; - case READYTORUN_INSTRUCTION_Avx512BW_VL: return InstructionSet_AVX512BW_VL; - case READYTORUN_INSTRUCTION_Avx512CD: return InstructionSet_AVX512CD; - case READYTORUN_INSTRUCTION_Avx512CD_VL: return InstructionSet_AVX512CD_VL; - case READYTORUN_INSTRUCTION_Avx512DQ: return InstructionSet_AVX512DQ; - case READYTORUN_INSTRUCTION_Avx512DQ_VL: return InstructionSet_AVX512DQ_VL; - case READYTORUN_INSTRUCTION_Avx512Vbmi: return InstructionSet_AVX512VBMI; - case READYTORUN_INSTRUCTION_Avx512Vbmi_VL: return InstructionSet_AVX512VBMI_VL; - case READYTORUN_INSTRUCTION_Avx10v1: return InstructionSet_AVX10v1; - case READYTORUN_INSTRUCTION_Avx10v1_V512: return InstructionSet_AVX10v1_V512; case READYTORUN_INSTRUCTION_VectorT128: return InstructionSet_VectorT128; case READYTORUN_INSTRUCTION_VectorT256: return InstructionSet_VectorT256; case READYTORUN_INSTRUCTION_VectorT512: return InstructionSet_VectorT512; + case READYTORUN_INSTRUCTION_AvxVnniInt8: return InstructionSet_AVXVNNIINT; + case READYTORUN_INSTRUCTION_AvxVnniInt8_V512: return InstructionSet_AVXVNNIINT_V512; + case READYTORUN_INSTRUCTION_AvxVnniInt16: return InstructionSet_AVXVNNIINT; + case READYTORUN_INSTRUCTION_AvxVnniInt16_V512: return InstructionSet_AVXVNNIINT_V512; #endif // TARGET_AMD64 #ifdef TARGET_X86 case READYTORUN_INSTRUCTION_X86Base: return InstructionSet_X86Base; - case READYTORUN_INSTRUCTION_Sse: return InstructionSet_SSE; - case READYTORUN_INSTRUCTION_Sse2: return InstructionSet_SSE2; - case READYTORUN_INSTRUCTION_Sse3: return InstructionSet_SSE3; - case READYTORUN_INSTRUCTION_Ssse3: return InstructionSet_SSSE3; - case READYTORUN_INSTRUCTION_Sse41: return InstructionSet_SSE41; + case READYTORUN_INSTRUCTION_Sse: return InstructionSet_X86Base; + case READYTORUN_INSTRUCTION_Sse2: return InstructionSet_X86Base; case READYTORUN_INSTRUCTION_Sse42: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Sse3: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Ssse3: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Sse41: return InstructionSet_SSE42; + case READYTORUN_INSTRUCTION_Popcnt: return InstructionSet_SSE42; case READYTORUN_INSTRUCTION_Avx: return InstructionSet_AVX; case READYTORUN_INSTRUCTION_Avx2: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Bmi1: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Bmi2: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_F16C: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Fma: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Lzcnt: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_AVX2; + case READYTORUN_INSTRUCTION_Evex: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512F: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512F_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512BW: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512BW_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512CD: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512CD_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512DQ: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512DQ_VL: return InstructionSet_AVX512; + case READYTORUN_INSTRUCTION_Avx512Ifma: return InstructionSet_AVX512v2; + case READYTORUN_INSTRUCTION_Avx512Vbmi: return InstructionSet_AVX512v2; + case READYTORUN_INSTRUCTION_Avx512Vbmi_VL: return InstructionSet_AVX512v2; + case READYTORUN_INSTRUCTION_Avx512Bitalg: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Bitalg_VL: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vbmi2: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vbmi2_VL: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vnni: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vpopcntdq: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Vpopcntdq_VL: return InstructionSet_AVX512v3; + case READYTORUN_INSTRUCTION_Avx512Bf16: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx512Bf16_VL: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx512Fp16: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx512Fp16_VL: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx10v1: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx10v1_V512: return InstructionSet_AVX10v1; + case READYTORUN_INSTRUCTION_Avx10v2: return InstructionSet_AVX10v2; + case READYTORUN_INSTRUCTION_Avx10v2_V512: return InstructionSet_AVX10v2; + case READYTORUN_INSTRUCTION_Apx: return InstructionSet_APX; case READYTORUN_INSTRUCTION_Aes: return InstructionSet_AES; - case READYTORUN_INSTRUCTION_Bmi1: return InstructionSet_BMI1; - case READYTORUN_INSTRUCTION_Bmi2: return InstructionSet_BMI2; - case READYTORUN_INSTRUCTION_Fma: return InstructionSet_FMA; - case READYTORUN_INSTRUCTION_Lzcnt: return InstructionSet_LZCNT; - case READYTORUN_INSTRUCTION_Pclmulqdq: return InstructionSet_PCLMULQDQ; - case READYTORUN_INSTRUCTION_Popcnt: return InstructionSet_POPCNT; + case READYTORUN_INSTRUCTION_Aes_V256: return InstructionSet_AES_V256; + case READYTORUN_INSTRUCTION_Aes_V512: return InstructionSet_AES_V512; + case READYTORUN_INSTRUCTION_Pclmulqdq: return InstructionSet_AES; + case READYTORUN_INSTRUCTION_Pclmulqdq_V256: return InstructionSet_AES_V256; + case READYTORUN_INSTRUCTION_Pclmulqdq_V512: return InstructionSet_AES_V512; + case READYTORUN_INSTRUCTION_Avx512Vp2intersect: return InstructionSet_AVX512VP2INTERSECT; + case READYTORUN_INSTRUCTION_Avx512Vp2intersect_VL: return InstructionSet_AVX512VP2INTERSECT; + case READYTORUN_INSTRUCTION_AvxIfma: return InstructionSet_AVXIFMA; case READYTORUN_INSTRUCTION_AvxVnni: return InstructionSet_AVXVNNI; - case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_MOVBE; + case READYTORUN_INSTRUCTION_Gfni: return InstructionSet_GFNI; + case READYTORUN_INSTRUCTION_Gfni_V256: return InstructionSet_GFNI_V256; + case READYTORUN_INSTRUCTION_Gfni_V512: return InstructionSet_GFNI_V512; + case READYTORUN_INSTRUCTION_Sha: return InstructionSet_SHA; + case READYTORUN_INSTRUCTION_WaitPkg: return InstructionSet_WAITPKG; case READYTORUN_INSTRUCTION_X86Serialize: return InstructionSet_X86Serialize; - case READYTORUN_INSTRUCTION_EVEX: return InstructionSet_EVEX; - case READYTORUN_INSTRUCTION_Avx512F: return InstructionSet_AVX512F; - case READYTORUN_INSTRUCTION_Avx512F_VL: return InstructionSet_AVX512F_VL; - case READYTORUN_INSTRUCTION_Avx512BW: return InstructionSet_AVX512BW; - case READYTORUN_INSTRUCTION_Avx512BW_VL: return InstructionSet_AVX512BW_VL; - case READYTORUN_INSTRUCTION_Avx512CD: return InstructionSet_AVX512CD; - case READYTORUN_INSTRUCTION_Avx512CD_VL: return InstructionSet_AVX512CD_VL; - case READYTORUN_INSTRUCTION_Avx512DQ: return InstructionSet_AVX512DQ; - case READYTORUN_INSTRUCTION_Avx512DQ_VL: return InstructionSet_AVX512DQ_VL; - case READYTORUN_INSTRUCTION_Avx512Vbmi: return InstructionSet_AVX512VBMI; - case READYTORUN_INSTRUCTION_Avx512Vbmi_VL: return InstructionSet_AVX512VBMI_VL; - case READYTORUN_INSTRUCTION_Avx10v1: return InstructionSet_AVX10v1; - case READYTORUN_INSTRUCTION_Avx10v1_V512: return InstructionSet_AVX10v1_V512; case READYTORUN_INSTRUCTION_VectorT128: return InstructionSet_VectorT128; case READYTORUN_INSTRUCTION_VectorT256: return InstructionSet_VectorT256; case READYTORUN_INSTRUCTION_VectorT512: return InstructionSet_VectorT512; + case READYTORUN_INSTRUCTION_AvxVnniInt8: return InstructionSet_AVXVNNIINT; + case READYTORUN_INSTRUCTION_AvxVnniInt8_V512: return InstructionSet_AVXVNNIINT_V512; + case READYTORUN_INSTRUCTION_AvxVnniInt16: return InstructionSet_AVXVNNIINT; + case READYTORUN_INSTRUCTION_AvxVnniInt16_V512: return InstructionSet_AVXVNNIINT_V512; #endif // TARGET_X86 default: diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corjitflags.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corjitflags.h index dce9a9f00..d7a8349a8 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corjitflags.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corjitflags.h @@ -39,11 +39,11 @@ class CORJIT_FLAGS CORJIT_FLAG_OSR = 7, // Generate alternate version for On Stack Replacement CORJIT_FLAG_ALT_JIT = 8, // JIT should consider itself an ALT_JIT CORJIT_FLAG_FROZEN_ALLOC_ALLOWED = 9, // JIT is allowed to use *_MAYBEFROZEN allocators - CORJIT_FLAG_MAKEFINALCODE = 10, // Use the final code generator, i.e., not the interpreter. - CORJIT_FLAG_READYTORUN = 11, // Use version-resilient code generation + // CORJIT_FLAG_UNUSED = 10, + CORJIT_FLAG_AOT = 11, // Do ahead-of-time code generation (ReadyToRun or NativeAOT) CORJIT_FLAG_PROF_ENTERLEAVE = 12, // Instrument prologues/epilogues CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 13, // Disables PInvoke inlining - CORJIT_FLAG_PREJIT = 14, // prejit is the execution engine. + // CORJIT_FLAG_UNUSED = 14, CORJIT_FLAG_RELOC = 15, // Generate relocatable code CORJIT_FLAG_IL_STUB = 16, // method is an IL stub CORJIT_FLAG_PROCSPLIT = 17, // JIT should separate code into hot and cold sections @@ -63,11 +63,7 @@ class CORJIT_FLAGS CORJIT_FLAG_RELATIVE_CODE_RELOCS = 29, // JIT should generate PC-relative address computations instead of EE relocation records CORJIT_FLAG_SOFTFP_ABI = 30, // Enable armel calling convention #endif - -#if defined(TARGET_X86) || defined(TARGET_AMD64) - CORJIT_FLAG_VECTOR512_THROTTLING = 31, // On x86/x64, 512-bit vector usage may incur CPU frequency throttling -#endif - + CORJIT_FLAG_ASYNC = 31, // Generate code for use as an async function }; CORJIT_FLAGS() diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corjithost.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corjithost.h index e70558f9e..1adb047b6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corjithost.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corjithost.h @@ -22,13 +22,13 @@ class ICorJitHost // Return an integer config value for the given key, if any exists. virtual int getIntConfigValue( - const WCHAR* name, + const char* name, int defaultValue ) = 0; // Return a string config value for the given key, if any exists. - virtual const WCHAR* getStringConfigValue( - const WCHAR* name + virtual const char* getStringConfigValue( + const char* name ) = 0; // Free a string ConfigValue returned by the runtime. @@ -36,7 +36,7 @@ class ICorJitHost // to return the string values to the runtime for deletion. // This avoids leaking the memory in the JIT. virtual void freeStringConfigValue( - const WCHAR* value + const char* value ) = 0; // Allocate memory slab of the given size in bytes. The host is expected to pool diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corpriv.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/corpriv.h index 45e0c49b1..8086a3f9c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corpriv.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corpriv.h @@ -7,34 +7,22 @@ #ifndef _CORPRIV_H_ #define _CORPRIV_H_ -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// %%Includes: --------------------------------------------------------------- -// avoid taking DLL import hit on intra-DLL calls -#define NODLLIMPORT #include #include "cor.h" #include "corimage.h" #include "metadata.h" -#include -// -interface IAssemblyName; class UTSemReadWrite; -// Helper function to get a pointer to the Dispenser interface. -STDAPI MetaDataGetDispenser( // Return HRESULT - REFCLSID rclsid, // The class to desired. - REFIID riid, // Interface wanted on class factory. - LPVOID FAR *ppv); // Return interface pointer here. - -BOOL RuntimeFileNotFound(HRESULT hr); +// Creation function to get IMetaDataDispenser(Ex) interface. +STDAPI CreateMetaDataDispenser( + REFIID riid, + void ** pMetaDataDispenserOut); // Helper function to get an Internal interface with an in-memory metadata section -STDAPI GetMetaDataInternalInterface( +STDAPI GetMDInternalInterface( LPVOID pData, // [IN] in memory metadata section ULONG cbData, // [IN] size of the metadata section DWORD flags, // [IN] CorOpenFlags @@ -42,13 +30,13 @@ STDAPI GetMetaDataInternalInterface( void **ppv); // [OUT] returned interface // Helper function to get an internal scopeless interface given a scope. -STDAPI GetMetaDataInternalInterfaceFromPublic( +STDAPI GetMDInternalInterfaceFromPublic( IUnknown *pv, // [IN] Given interface REFIID riid, // [IN] desired interface void **ppv); // [OUT] returned interface // Helper function to get an internal scopeless interface given a scope. -STDAPI GetMetaDataPublicInterfaceFromInternal( +STDAPI GetMDPublicInterfaceFromInternal( void *pv, // [IN] Given interface REFIID riid, // [IN] desired interface void **ppv); // [OUT] returned interface @@ -60,16 +48,12 @@ STDAPI ConvertMDInternalImport( // S_OK or error. IMDInternalImport *pIMD, // [IN] The metadata to be updated. IMDInternalImport **ppIMD); // [OUT] Put RW interface here. -STDAPI GetAssemblyMDInternalImport( // Return code. - LPCWSTR szFileName, // [IN] The scope to open. - REFIID riid, // [IN] The interface desired. - IUnknown **ppIUnk); // [OUT] Return interface on success. - -STDAPI GetAssemblyMDInternalImportByStream( // Return code. - IStream *pIStream, // [IN] The IStream for the file - UINT64 AssemblyId, // [IN] Unique Id for the assembly - REFIID riid, // [IN] The interface desired. - IUnknown **ppIUnk); // [OUT] Return interface on success. +// Update an existing metadata importer with a buffer +STDAPI MDReOpenMetaDataWithMemory( + void *pImport, // [IN] Given scope. public interfaces + LPCVOID pData, // [in] Location of scope data. + ULONG cbData, // [in] Size of the data pointed to by pData. + DWORD dwReOpenFlags); // [in] ReOpen flags enum MDInternalImportFlags @@ -82,36 +66,6 @@ enum MDInternalImportFlags }; // enum MDInternalImportFlags - -STDAPI GetAssemblyMDInternalImportEx( // Return code. - LPCWSTR szFileName, // [IN] The scope to open. - REFIID riid, // [IN] The interface desired. - MDInternalImportFlags flags, // [in] Flags to control opening the assembly - IUnknown **ppIUnk, // [OUT] Return interface on success. - HANDLE hFile = INVALID_HANDLE_VALUE); - -STDAPI GetAssemblyMDInternalImportByStreamEx( // Return code. - IStream *pIStream, // [IN] The IStream for the file - UINT64 AssemblyId, // [IN] Unique Id for the assembly - REFIID riid, // [IN] The interface desired. - MDInternalImportFlags flags, // [in] Flags to control opening the assembly - IUnknown **ppIUnk); // [OUT] Return interface on success. - - -// Returns part of the "Zap string" which describes the properties of a native image - -__success(SUCCEEDED(return)) -STDAPI GetNativeImageDescription( - _In_z_ LPCWSTR wzCustomString, // [IN] Custom string of the native image - DWORD dwConfigMask, // [IN] Config mask of the native image - _Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR pwzZapInfo,// [OUT] The description string. Can be NULL to find the size of buffer to allocate - LPDWORD pdwLength); // [IN/OUT] Length of the pwzZapInfo buffer on IN. - // Number of WCHARs (including termintating NULL) on OUT - - -class CQuickBytes; - - // predefined constant for parent token for global functions #define COR_GLOBAL_PARENT_TOKEN TokenFromRid(1, mdtTypeDef) @@ -314,51 +268,20 @@ typedef enum { // generate a .reloc for a pointer sized location, // This is transformed into BASED_HIGHLOW or BASED_DIR64 based on the platform - srRelocHighLow = 3, - - // generate a .reloc for the top 16-bits of a 32 bit number, where the - // bottom 16 bits are included in the next word in the .reloc table - srRelocHighAdj, // Never Used + srRelocHighLow, // generate a token map relocation, nothing into .reloc section srRelocMapToken, - // relative address fixup - srRelocRelative, - // Generate only a section-relative reloc, nothing into .reloc // section. This reloc is relative to the file position of the // section, not the section's virtual address. srRelocFilePos, - // code relative address fixup - srRelocCodeRelative, - - // generate a .reloc for a 64 bit address - srRelocDir64, - - // generate a 30-bit section-relative reloc, used for tagged pointer values - srRelocAbsoluteTagged, - - // A sentinel value to help ensure any additions to this enum are reflected // in PEWriter.cpp's RelocName array. srRelocSentinel, - // Flags that can be used with the above reloc types - - // do not emit base reloc - srNoBaseReloc = 0x4000, - - // pre-fixup contents of memory are ptr rather than a section offset - srRelocPtr = 0x8000, - - // legal enums which include the Ptr flag - srRelocAbsolutePtr = srRelocPtr + srRelocAbsolute, - srRelocHighLowPtr = srRelocPtr + srRelocHighLow, - srRelocRelativePtr = srRelocPtr + srRelocRelative, - srRelocDir64Ptr = srRelocPtr + srRelocDir64, - } CeeSectionRelocType; typedef union { @@ -379,11 +302,6 @@ DECLARE_INTERFACE_(ICeeGenInternal, IUnknown) LPWSTR lpString, // [IN] String to emit ULONG * RVA) PURE; // [OUT] RVA for string emitted string - STDMETHOD(GetString) ( - ULONG RVA, // [IN] RVA for string to return - _Out_opt_ - LPWSTR * lpString) PURE; // [OUT] Returned string - STDMETHOD(AllocateMethodBuffer) ( ULONG cchBuffer, // [IN] Length of buffer to create UCHAR * *lpBuffer, // [OUT] Returned buffer @@ -438,7 +356,7 @@ DECLARE_INTERFACE_(ICeeGenInternal, IUnknown) // Private interface exposed by // AssemblyMDInternalImport - gives us access to the internally stored IMDInternalImport*. // -// RegMeta - supports the internal GetMetaDataInternalInterfaceFromPublic() "api". +// RegMeta - supports the internal GetMDInternalInterfaceFromPublic() "api". // // {92B2FEF9-F7F5-420d-AD42-AECEEE10A1EF} EXTERN_GUID(IID_IGetIMDInternalImport, 0x92b2fef9, 0xf7f5, 0x420d, 0xad, 0x42, 0xae, 0xce, 0xee, 0x10, 0xa1, 0xef); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corprof.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/corprof.idl index 4e43edfdf..dadacf934 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corprof.idl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/corprof.idl @@ -592,6 +592,8 @@ typedef enum COR_PRF_MONITOR_CLASS_LOADS | COR_PRF_MONITOR_EXCEPTIONS | COR_PRF_MONITOR_JIT_COMPILATION | + COR_PRF_DISABLE_INLINING | + COR_PRF_DISABLE_OPTIMIZATIONS | COR_PRF_ENABLE_REJIT, COR_PRF_ALLOWABLE_NOTIFICATION_PROFILER @@ -625,8 +627,6 @@ typedef enum COR_PRF_MONITOR_REMOTING_ASYNC | COR_PRF_ENABLE_INPROC_DEBUGGING | COR_PRF_ENABLE_JIT_MAPS | - COR_PRF_DISABLE_OPTIMIZATIONS | - COR_PRF_DISABLE_INLINING | COR_PRF_ENABLE_OBJECT_ALLOCATED | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | @@ -2717,8 +2717,7 @@ interface ICorProfilerInfo : IUnknown * TO WORK, GetEventMask2 PROVIDES MORE FUNCTIONALITY. * * The code profiler calls GetEventMask to obtain the current event - * categories for which it is to receive event notifications from the COM+ - * Runtime. + * categories for which it is to receive event notifications from the CLR */ HRESULT GetEventMask( [out] DWORD *pdwEvents); @@ -3168,7 +3167,7 @@ interface ICorProfilerInfo2 : ICorProfilerInfo * When a COR_PRF_FRAME_INFO from any other source is passed, or * when 0 is passed as the frameInfo argument, exact ClassID and type * arguments cannot always be determined. The value returned in pClassId - * may be NULL and some type args will come back as System.Object. + * may not be exact and some type args will come back as System.Object. * */ HRESULT GetFunctionInfo2( @@ -4293,10 +4292,10 @@ interface ICorProfilerInfo14 : ICorProfilerInfo13 [out, size_is(cObjectRanges), length_is(*pcObjectRanges)] COR_PRF_NONGC_HEAP_RANGE ranges[]); - // EventPipeCreateProvider2 allows you to pass in a callback which will be called whenever a + // EventPipeCreateProvider2 allows you to pass in a callback which will be called whenever a // session enables your provider. The behavior of the callback matches the ETW behavior which - // can be counter intuitive. You will get a callback any time a session changes with the updated - // global keywords enabled for your session. The is_enabled parameter will be true if any + // can be counter intuitive. You will get a callback any time a session changes with the updated + // global keywords enabled for your session. The is_enabled parameter will be true if any // session has your provider enabled. The source_id parameter will be a valid id if the callback // was triggered due to a session enabling and it will be NULL if it was triggered due to a session // disabling. diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/corpub.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/corpub.idl deleted file mode 100644 index 16d3e6359..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/corpub.idl +++ /dev/null @@ -1,264 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/* -------------------------------------------------------------------------- * - * Common Language Runtime Process Publishing Interfaces - * -------------------------------------------------------------------------- */ - -cpp_quote("#if 0") -#ifndef DO_NO_IMPORTS -import "unknwn.idl"; -#endif -cpp_quote("#endif") - -typedef enum -{ - COR_PUB_MANAGEDONLY = 0x00000001 // Must always be set, - // only enumerates - // managed processes -} COR_PUB_ENUMPROCESS; - - -/* -------------------------------------------------------------------------- * - * Forward declarations - * -------------------------------------------------------------------------- */ -#pragma warning(push) -#pragma warning(disable:28718) //Unable to annotate as this is not a local interface - -interface ICorPublish; -interface ICorPublishProcess; -interface ICorPublishAppDomain; -interface ICorPublishProcessEnum; -interface ICorPublishAppDomainEnum; - -#pragma warning(pop) - -/* ------------------------------------------------------------------------- * - * Library definition - * ------------------------------------------------------------------------- */ - -[ - uuid(e97ca460-657d-11d3-8d5b-00104b35e7ef), - version(1.0), - helpstring("Common Language Runtime Process Publishing Library") -] -library CorpubProcessLib -{ - importlib("STDOLE2.TLB"); - - // CorPublish is a shared component across all version of the runtime. - [ - uuid(047a9a40-657e-11d3-8d5b-00104b35e7ef) - ] - coclass CorpubPublish - { - [default] interface ICorPublish; - interface ICorPublishProcess; - interface ICorPublishAppDomain; - interface ICorPublishProcessEnum; - interface ICorPublishAppDomainEnum; - }; -}; - - -/* -------------------------------------------------------------------------- * - * Interface definitions - * -------------------------------------------------------------------------- */ - -/* - * This interface is the top level interface for publishing of processes. - */ -[ - object, - uuid(9613A0E7-5A68-11d3-8F84-00A0C9B4D50C), - pointer_default(unique), - local -] -interface ICorPublish : IUnknown -{ - /* - * Retrieves a list of managed processes on this machine which - * the current user has permission to debug. In this version, - * Type must always be equal to COR_PUB_MANAGEDONLY. - * The list is based on a snapshot of the processes running when - * the enum method is called. The enumerator will not reflect any - * processes that start before or terminate after EnumProcesses is called. - * If EnumProcesses is called more than once on this ICorPublish - * instance, a new up-to-date enumeration will be returned without - * affecting any previous ones. - */ - HRESULT EnumProcesses([in] COR_PUB_ENUMPROCESS Type, - [out] ICorPublishProcessEnum **ppIEnum); - - /* - * Gets a new ICorPublishProcess object for the managed process - * with the given process ID. Returns failure if the process doesn't - * exist, or isn't a managed process that can be debugged by the current - * user. - */ - HRESULT GetProcess([in] unsigned pid, - [out] ICorPublishProcess **ppProcess); -} - -/* - * An abstract enumerator. - */ -[ - object, - uuid(C0B22967-5A69-11d3-8F84-00A0C9B4D50C), - pointer_default(unique), - local -] -interface ICorPublishEnum : IUnknown -{ - /* - * Moves the current position forward the given number of - * elements. - */ - HRESULT Skip([in] ULONG celt); - - /* - * Sets the position of the enumerator to the beginning of the - * enumeration. - */ - HRESULT Reset(); - - /* - * Creates another enumerator with the same current position - * as this one. - */ - HRESULT Clone([out] ICorPublishEnum **ppEnum); - - /* - * Gets the number of elements in the enumeration - */ - HRESULT GetCount([out] ULONG *pcelt); -}; - -#pragma warning(push) -#pragma warning(disable:28718) -/* - * Describes a process on a machine. - */ -[ - object, - uuid(18D87AF1-5A6A-11d3-8F84-00A0C9B4D50C), - pointer_default(unique), - local -] -interface ICorPublishProcess : IUnknown -{ - /* - * Returns true if the process is known to have managed code - * running in it. Since this version of ICorPublish only provides access - * to managed processes, this method always returns true. - */ - HRESULT IsManaged([out] BOOL *pbManaged); - - /* - * Enumerates the list of known application domains in this process. - * This list is based on a snapshot of the existing AppDomains when - * this method is called. This method may be called more than - * once to create a new up-to-date list. Existing enumerations will not - * be affected by calls to this method. If the process has been - * terminated, this will fail with CORDBG_E_PROCESS_TERMINATED. - */ - HRESULT EnumAppDomains([out] ICorPublishAppDomainEnum **ppEnum); - - /* - * Returns the OS ID for this process. - */ - HRESULT GetProcessID([out] unsigned *pid); - - /* - * Get the full path of the executable for this process. - * If szName is non-null, this copies up to cchName characters (including - * the null terminator) into szName, and ensures it is null-terminated. - * If pcchName is non-null, the actual number of characters in the name - * (including the null terminator) is stored there. This method returns - * S_OK regardless of how many characters were copied. - */ - HRESULT GetDisplayName([in] ULONG32 cchName, - [out] ULONG32 *pcchName, - [out, size_is(cchName), - length_is(*pcchName)] WCHAR *szName); -} -#pragma warning(pop) - -#pragma warning(push) -#pragma warning(disable:28718) -/* - * Provide information on an Application Domain object. - */ -[ - object, - uuid(D6315C8F-5A6A-11d3-8F84-00A0C9B4D50C), - pointer_default(unique), - local -] -interface ICorPublishAppDomain : IUnknown -{ - /* - * Gets the identification number of this application domain. - * Note that this number is unique to this AppDomain, but only - * within the containing process. - */ - HRESULT GetID([out] ULONG32 *puId); - - /* - * Get the name for an application domain. - * If szName is non-null, this copies up to cchName characters (including - * the null terminator) into szName, and ensures it is null-terminated. - * If pcchName is non-null, the actual number of characters in the name - * (including the null terminator) is stored there. This method returns - * S_OK regardless of how many characters were copied. - */ - HRESULT GetName([in] ULONG32 cchName, - [out] ULONG32 *pcchName, - [out, size_is(cchName), - length_is(*pcchName)] WCHAR *szName); -} -#pragma warning(pop) - - -/* - * Enumerate a list of processes based on the filter criteria given - * when the enumerator object was created. - */ -[ - object, - uuid(A37FBD41-5A69-11d3-8F84-00A0C9B4D50C), - pointer_default(unique), - local -] -interface ICorPublishProcessEnum : ICorPublishEnum -{ - /* - * Gets the next "celt" processes in the enumeration. - */ - HRESULT Next([in] ULONG celt, - [out, size_is(celt), - length_is(*pceltFetched)] ICorPublishProcess **objects, - [out] ULONG *pceltFetched); -} - -/* - * Enumerate a list of app domains based in a process. - */ -[ - object, - uuid(9F0C98F5-5A6A-11d3-8F84-00A0C9B4D50C), - pointer_default(unique), - local -] -interface ICorPublishAppDomainEnum : ICorPublishEnum -{ - /* - * Gets the next "celt" application domains in the enumeration. - */ - HRESULT Next([in] ULONG celt, - [out, size_is(celt), - length_is(*pceltFetched)] ICorPublishAppDomain **objects, - [out] ULONG *pceltFetched); -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/cortypeinfo.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/cortypeinfo.h index 87d960301..d96a51ad8 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/cortypeinfo.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/cortypeinfo.h @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// This describes information about the COM+ primitive types +// This describes information about the CLR primitive types // // Note: This file gets parsed by the IL Linker (https://github.com/dotnet/runtime/tree/main/src/tools/illink) which may throw an exception during parsing. @@ -54,3 +54,4 @@ TYPEINFO(ELEMENT_TYPE_MVAR, NULL, NULL, TARGET_POINTER_SI TYPEINFO(ELEMENT_TYPE_CMOD_REQD, NULL, NULL, 0, TYPE_GC_NONE, false, false, false, false, false) // 0x1f TYPEINFO(ELEMENT_TYPE_CMOD_OPT, NULL, NULL, 0, TYPE_GC_NONE, false, false, false, false, false) // 0x20 TYPEINFO(ELEMENT_TYPE_INTERNAL, NULL, NULL, 0, TYPE_GC_OTHER, false, false, false, false, false) // 0x21 +TYPEINFO(ELEMENT_TYPE_CMOD_INTERNAL,NULL, NULL, 0, TYPE_GC_NONE, false, false, false, false, false) // 0x22 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/crosscomp.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/crosscomp.h index 10a196302..4c30eb01b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/crosscomp.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/crosscomp.h @@ -4,20 +4,34 @@ // crosscomp.h - cross-compilation enablement structures. // - #pragma once +#include + #if (!defined(HOST_64BIT) && defined(TARGET_64BIT)) || (defined(HOST_64BIT) && !defined(TARGET_64BIT)) #define CROSSBITNESS_COMPILE + +#ifndef CROSS_COMPILE +#define CROSS_COMPILE +#endif // !CROSS_COMPILE + #endif +#if defined(TARGET_WINDOWS) && !defined(HOST_WINDOWS) && !defined(CROSS_COMPILE) +#define CROSS_COMPILE +#endif // TARGET_WINDOWS && !HOST_WINDOWS && !CROSS_COMPILE + +#if defined(TARGET_UNIX) && !defined(HOST_UNIX) && !defined(CROSS_COMPILE) +#define CROSS_COMPILE +#endif // TARGET_UNIX && !HOST_UNIX && !CROSS_COMPILE + // Target platform-specific library naming // #ifdef TARGET_WINDOWS #define MAKE_TARGET_DLLNAME_W(name) name W(".dll") #define MAKE_TARGET_DLLNAME_A(name) name ".dll" #else // TARGET_WINDOWS -#ifdef TARGET_OSX +#ifdef TARGET_APPLE #define MAKE_TARGET_DLLNAME_W(name) W("lib") name W(".dylib") #define MAKE_TARGET_DLLNAME_A(name) "lib" name ".dylib" #else @@ -506,7 +520,6 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS { PDWORD64 S7; PDWORD64 S8; PDWORD64 Fp; - PDWORD64 Tp; PDWORD64 Ra; PDWORD64 F24; @@ -668,6 +681,36 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS { #define T_DISPATCHER_CONTEXT DISPATCHER_CONTEXT #define PT_DISPATCHER_CONTEXT PDISPATCHER_CONTEXT +#if defined(HOST_WINDOWS) && defined(TARGET_X86) +typedef struct _KNONVOLATILE_CONTEXT { + + DWORD Edi; + DWORD Esi; + DWORD Ebx; + DWORD Ebp; + +} KNONVOLATILE_CONTEXT, *PKNONVOLATILE_CONTEXT; + +typedef struct _KNONVOLATILE_CONTEXT_POINTERS_EX +{ + // The ordering of these fields should be aligned with that + // of corresponding fields in CONTEXT + // + // (See FillRegDisplay in inc/regdisp.h for details) + PDWORD Edi; + PDWORD Esi; + PDWORD Ebx; + PDWORD Edx; + PDWORD Ecx; + PDWORD Eax; + + PDWORD Ebp; + +} KNONVOLATILE_CONTEXT_POINTERS_EX, *PKNONVOLATILE_CONTEXT_POINTERS_EX; + +#define KNONVOLATILE_CONTEXT_POINTERS KNONVOLATILE_CONTEXT_POINTERS_EX +#define PKNONVOLATILE_CONTEXT_POINTERS PKNONVOLATILE_CONTEXT_POINTERS_EX +#endif #define T_KNONVOLATILE_CONTEXT_POINTERS KNONVOLATILE_CONTEXT_POINTERS #define PT_KNONVOLATILE_CONTEXT_POINTERS PKNONVOLATILE_CONTEXT_POINTERS @@ -676,74 +719,42 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS { #endif -#if defined(DACCESS_COMPILE) && defined(TARGET_UNIX) -// This is a TARGET oriented copy of CRITICAL_SECTION and PAL_CS_NATIVE_DATA_SIZE -// It is configured based on TARGET configuration rather than HOST configuration -// There is validation code in src/coreclr/vm/crst.cpp to keep these from -// getting out of sync - -#define T_CRITICAL_SECTION_VALIDATION_MESSAGE "T_CRITICAL_SECTION validation failed. It is not in sync with CRITICAL_SECTION" - -#if defined(TARGET_OSX) && defined(TARGET_X86) -#define DAC_CS_NATIVE_DATA_SIZE 76 -#elif defined(TARGET_OSX) && defined(TARGET_AMD64) -#define DAC_CS_NATIVE_DATA_SIZE 120 -#elif defined(TARGET_OSX) && defined(TARGET_ARM64) -#define DAC_CS_NATIVE_DATA_SIZE 120 -#elif defined(TARGET_FREEBSD) && defined(TARGET_X86) -#define DAC_CS_NATIVE_DATA_SIZE 12 -#elif defined(TARGET_FREEBSD) && defined(TARGET_AMD64) -#define DAC_CS_NATIVE_DATA_SIZE 24 -#elif defined(TARGET_FREEBSD) && defined(TARGET_ARM64) -#define DAC_CS_NATIVE_DATA_SIZE 24 -#elif defined(TARGET_LINUX) && defined(TARGET_ARM) -#define DAC_CS_NATIVE_DATA_SIZE 80 -#elif defined(TARGET_LINUX) && defined(TARGET_ARM64) -#define DAC_CS_NATIVE_DATA_SIZE 104 -#elif defined(TARGET_LINUX) && defined(TARGET_LOONGARCH64) -#define DAC_CS_NATIVE_DATA_SIZE 96 -#elif defined(TARGET_LINUX) && defined(TARGET_X86) -#define DAC_CS_NATIVE_DATA_SIZE 76 -#elif defined(TARGET_LINUX) && defined(TARGET_AMD64) -#define DAC_CS_NATIVE_DATA_SIZE 96 -#elif defined(TARGET_LINUX) && defined(TARGET_S390X) -#define DAC_CS_NATIVE_DATA_SIZE 96 -#elif defined(TARGET_LINUX) && defined(TARGET_RISCV64) -#define DAC_CS_NATIVE_DATA_SIZE 96 -#elif defined(TARGET_LINUX) && defined(TARGET_POWERPC64) -#define DAC_CS_NATIVE_DATA_SIZE 96 -#elif defined(TARGET_NETBSD) && defined(TARGET_AMD64) -#define DAC_CS_NATIVE_DATA_SIZE 96 -#elif defined(TARGET_NETBSD) && defined(TARGET_ARM) -#define DAC_CS_NATIVE_DATA_SIZE 56 -#elif defined(TARGET_NETBSD) && defined(TARGET_X86) -#define DAC_CS_NATIVE_DATA_SIZE 56 -#elif defined(__sun) && defined(TARGET_AMD64) -#define DAC_CS_NATIVE_DATA_SIZE 48 +#if defined(TARGET_APPLE) +#define DAC_MUTEX_MAX_SIZE 96 +#elif defined(TARGET_FREEBSD) +#define DAC_MUTEX_MAX_SIZE 16 +#elif defined(TARGET_LINUX) || defined(TARGET_ANDROID) +#define DAC_MUTEX_MAX_SIZE 64 +#elif defined(TARGET_WINDOWS) +#ifdef TARGET_64BIT +#define DAC_MUTEX_MAX_SIZE 40 +#else +#define DAC_MUTEX_MAX_SIZE 24 +#endif // TARGET_64BIT #else -#warning -#error DAC_CS_NATIVE_DATA_SIZE is not defined for this architecture. This should be same value as PAL_CS_NATIVE_DATA_SIZE (aka sizeof(PAL_CS_NATIVE_DATA)). +// Fallback to a conservative default value +#define DAC_MUTEX_MAX_SIZE 128 #endif -struct T_CRITICAL_SECTION { - PVOID DebugInfo; - LONG LockCount; - LONG RecursionCount; - HANDLE OwningThread; - ULONG_PTR SpinCount; - -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - BOOL bInternal; -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA - volatile DWORD dwInitState; +#ifndef CROSS_COMPILE +static_assert(DAC_MUTEX_MAX_SIZE >= sizeof(minipal_mutex), "DAC_MUTEX_MAX_SIZE must be greater than or equal to the size of minipal_mutex"); +#endif // !CROSS_COMPILE - union CSNativeDataStorage +// This type is used to ensure a consistent size of mutexes +// contained with our Crst types. +// We have this requirement for cross OS compiling the DAC. +struct tgt_minipal_mutex final +{ + union { - BYTE rgNativeDataStorage[DAC_CS_NATIVE_DATA_SIZE]; - PVOID pvAlign; // make sure the storage is machine-pointer-size aligned - } csnds; + // DAC builds want to have the data layout of the target system. + // Make sure that the host minipal_mutex does not influence + // the target data layout +#ifndef DACCESS_COMPILE + minipal_mutex _mtx; +#endif // !DACCESS_COMPILE + + // This is unused padding to ensure struct size. + alignas(void*) BYTE _dacPadding[DAC_MUTEX_MAX_SIZE]; + }; }; -#else -#define T_CRITICAL_SECTION CRITICAL_SECTION -#endif - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/crsttypes_generated.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/crsttypes_generated.h index ccbb4070e..713f6bd5b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/crsttypes_generated.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/crsttypes_generated.h @@ -10,130 +10,115 @@ // This file describes the range of Crst types available and their mapping to a numeric level (used by the // runtime in debug mode to validate we're deadlock free). To modify these settings edit the -// file:CrstTypes.def file and run the clr\artifacts\CrstTypeTool utility to generate a new version of this file. +// file:CrstTypes.def file and run the .\CrstTypeTool utility to generate a new version of this file. // Each Crst type is declared as a value in the following CrstType enum. enum CrstType { CrstAppDomainCache = 0, - CrstArgBasedStubCache = 1, - CrstAssemblyList = 2, - CrstAssemblyLoader = 3, - CrstAvailableClass = 4, - CrstAvailableParamTypes = 5, - CrstBaseDomain = 6, - CrstCCompRC = 7, - CrstClassFactInfoHash = 8, - CrstClassInit = 9, - CrstClrNotification = 10, - CrstCodeFragmentHeap = 11, - CrstCodeVersioning = 12, - CrstCOMCallWrapper = 13, - CrstCOMWrapperCache = 14, - CrstDataTest1 = 15, - CrstDataTest2 = 16, - CrstDbgTransport = 17, - CrstDeadlockDetection = 18, - CrstDebuggerController = 19, - CrstDebuggerFavorLock = 20, - CrstDebuggerHeapExecMemLock = 21, - CrstDebuggerHeapLock = 22, - CrstDebuggerJitInfo = 23, - CrstDebuggerMutex = 24, - CrstDelegateToFPtrHash = 25, - CrstDynamicIL = 26, - CrstDynamicMT = 27, - CrstEtwTypeLogHash = 28, - CrstEventPipe = 29, - CrstEventStore = 30, - CrstException = 31, - CrstExecutableAllocatorLock = 32, - CrstExecuteManRangeLock = 33, - CrstFCall = 34, - CrstFrozenObjectHeap = 35, - CrstFuncPtrStubs = 36, - CrstFusionAppCtx = 37, - CrstGCCover = 38, - CrstGenericDictionaryExpansion = 39, - CrstGlobalStrLiteralMap = 40, - CrstHandleTable = 41, - CrstIbcProfile = 42, - CrstIJWFixupData = 43, - CrstIJWHash = 44, - CrstILStubGen = 45, - CrstInlineTrackingMap = 46, - CrstInstMethodHashTable = 47, - CrstInterop = 48, - CrstInteropData = 49, - CrstIsJMCMethod = 50, - CrstISymUnmanagedReader = 51, - CrstJit = 52, - CrstJitGenericHandleCache = 53, - CrstJitInlineTrackingMap = 54, - CrstJitPatchpoint = 55, - CrstJitPerf = 56, - CrstJumpStubCache = 57, - CrstLeafLock = 58, - CrstListLock = 59, - CrstLoaderAllocator = 60, - CrstLoaderAllocatorReferences = 61, - CrstLoaderHeap = 62, - CrstManagedObjectWrapperMap = 63, - CrstMethodDescBackpatchInfoTracker = 64, - CrstMethodTableExposedObject = 65, - CrstModule = 66, - CrstModuleFixup = 67, - CrstModuleLookupTable = 68, - CrstMulticoreJitHash = 69, - CrstMulticoreJitManager = 70, - CrstNativeImageEagerFixups = 71, - CrstNativeImageLoad = 72, - CrstNls = 73, - CrstNotifyGdb = 74, - CrstObjectList = 75, - CrstPEImage = 76, - CrstPendingTypeLoadEntry = 77, - CrstPerfMap = 78, - CrstPgoData = 79, - CrstPinnedByrefValidation = 80, - CrstPinnedHeapHandleTable = 81, - CrstProfilerGCRefDataFreeList = 82, - CrstProfilingAPIStatus = 83, - CrstRCWCache = 84, - CrstRCWCleanupList = 85, - CrstReadyToRunEntryPointToMethodDescMap = 86, - CrstReflection = 87, - CrstReJITGlobalRequest = 88, - CrstRetThunkCache = 89, - CrstSavedExceptionInfo = 90, - CrstSaveModuleProfileData = 91, - CrstSigConvert = 92, - CrstSingleUseLock = 93, - CrstSpecialStatics = 94, - CrstStackSampler = 95, - CrstStressLog = 96, - CrstStubCache = 97, - CrstStubDispatchCache = 98, - CrstStubUnwindInfoHeapSegments = 99, - CrstSyncBlockCache = 100, - CrstSyncHashLock = 101, - CrstSystemBaseDomain = 102, - CrstSystemDomain = 103, - CrstSystemDomainDelayedUnloadList = 104, - CrstThreadIdDispenser = 105, - CrstThreadLocalStorageLock = 106, - CrstThreadStore = 107, - CrstTieredCompilation = 108, - CrstTypeEquivalenceMap = 109, - CrstTypeIDMap = 110, - CrstUMEntryThunkCache = 111, - CrstUMEntryThunkFreeListLock = 112, - CrstUniqueStack = 113, - CrstUnresolvedClassLock = 114, - CrstUnwindInfoTableLock = 115, - CrstVSDIndirectionCellLock = 116, - CrstWrapperTemplate = 117, - kNumberOfCrstTypes = 118 + CrstAssemblyList = 1, + CrstAssemblyLoader = 2, + CrstAvailableClass = 3, + CrstAvailableParamTypes = 4, + CrstCallStubCache = 5, + CrstCCompRC = 6, + CrstClassFactInfoHash = 7, + CrstClassInit = 8, + CrstClrNotification = 9, + CrstCodeFragmentHeap = 10, + CrstCodeVersioning = 11, + CrstCOMCallWrapper = 12, + CrstCOMWrapperCache = 13, + CrstDataTest1 = 14, + CrstDataTest2 = 15, + CrstDbgTransport = 16, + CrstDeadlockDetection = 17, + CrstDebuggerController = 18, + CrstDebuggerFavorLock = 19, + CrstDebuggerHeapExecMemLock = 20, + CrstDebuggerHeapLock = 21, + CrstDebuggerJitInfo = 22, + CrstDebuggerMutex = 23, + CrstDynamicIL = 24, + CrstDynamicMT = 25, + CrstEtwTypeLogHash = 26, + CrstEventPipe = 27, + CrstEventStore = 28, + CrstException = 29, + CrstExecutableAllocatorLock = 30, + CrstFCall = 31, + CrstFrozenObjectHeap = 32, + CrstFuncPtrStubs = 33, + CrstFusionAppCtx = 34, + CrstGCCover = 35, + CrstGenericDictionaryExpansion = 36, + CrstGlobalStrLiteralMap = 37, + CrstHandleTable = 38, + CrstIJWFixupData = 39, + CrstIJWHash = 40, + CrstILStubGen = 41, + CrstInlineTrackingMap = 42, + CrstInstMethodHashTable = 43, + CrstInterfaceDispatchGlobalLists = 44, + CrstInterop = 45, + CrstInteropData = 46, + CrstIsJMCMethod = 47, + CrstISymUnmanagedReader = 48, + CrstJit = 49, + CrstJitInlineTrackingMap = 50, + CrstJitPatchpoint = 51, + CrstJumpStubCache = 52, + CrstLeafLock = 53, + CrstListLock = 54, + CrstLoaderAllocator = 55, + CrstLoaderAllocatorReferences = 56, + CrstLoaderHeap = 57, + CrstManagedObjectWrapperMap = 58, + CrstMethodDescBackpatchInfoTracker = 59, + CrstMethodTableExposedObject = 60, + CrstModule = 61, + CrstModuleLookupTable = 62, + CrstMulticoreJitHash = 63, + CrstMulticoreJitManager = 64, + CrstNativeImageEagerFixups = 65, + CrstNativeImageLoad = 66, + CrstNotifyGdb = 67, + CrstPEImage = 68, + CrstPendingTypeLoadEntry = 69, + CrstPerfMap = 70, + CrstPgoData = 71, + CrstPinnedByrefValidation = 72, + CrstPinnedHeapHandleTable = 73, + CrstProfilerGCRefDataFreeList = 74, + CrstProfilingAPIStatus = 75, + CrstRCWCache = 76, + CrstRCWCleanupList = 77, + CrstReadyToRunEntryPointToMethodDescMap = 78, + CrstReflection = 79, + CrstReJITGlobalRequest = 80, + CrstSigConvert = 81, + CrstSingleUseLock = 82, + CrstStressLog = 83, + CrstStubCache = 84, + CrstStubDispatchCache = 85, + CrstSyncBlockCache = 86, + CrstSyncHashLock = 87, + CrstSystemDomain = 88, + CrstSystemDomainDelayedUnloadList = 89, + CrstThreadIdDispenser = 90, + CrstThreadLocalStorageLock = 91, + CrstThreadStore = 92, + CrstTieredCompilation = 93, + CrstTypeEquivalenceMap = 94, + CrstTypeIDMap = 95, + CrstUMEntryThunkCache = 96, + CrstUMEntryThunkFreeListLock = 97, + CrstUniqueStack = 98, + CrstUnresolvedClassLock = 99, + CrstUnwindInfoTableLock = 100, + CrstVSDIndirectionCellLock = 101, + CrstWrapperTemplate = 102, + kNumberOfCrstTypes = 103 }; #endif // __CRST_TYPES_INCLUDED @@ -144,136 +129,120 @@ enum CrstType // An array mapping CrstType to level. int g_rgCrstLevelMap[] = { - 10, // CrstAppDomainCache - 3, // CrstArgBasedStubCache - 3, // CrstAssemblyList - 14, // CrstAssemblyLoader - 4, // CrstAvailableClass - 5, // CrstAvailableParamTypes - 7, // CrstBaseDomain + 9, // CrstAppDomainCache + 2, // CrstAssemblyList + 13, // CrstAssemblyLoader + 3, // CrstAvailableClass + 4, // CrstAvailableParamTypes + 3, // CrstCallStubCache -1, // CrstCCompRC - 15, // CrstClassFactInfoHash - 11, // CrstClassInit + 14, // CrstClassFactInfoHash + 10, // CrstClassInit -1, // CrstClrNotification - 6, // CrstCodeFragmentHeap - 9, // CrstCodeVersioning - 3, // CrstCOMCallWrapper - 10, // CrstCOMWrapperCache - 3, // CrstDataTest1 + 5, // CrstCodeFragmentHeap + 8, // CrstCodeVersioning + 2, // CrstCOMCallWrapper + 9, // CrstCOMWrapperCache + 2, // CrstDataTest1 0, // CrstDataTest2 0, // CrstDbgTransport 0, // CrstDeadlockDetection -1, // CrstDebuggerController - 3, // CrstDebuggerFavorLock + 2, // CrstDebuggerFavorLock 0, // CrstDebuggerHeapExecMemLock 0, // CrstDebuggerHeapLock - 4, // CrstDebuggerJitInfo - 13, // CrstDebuggerMutex - 0, // CrstDelegateToFPtrHash + 3, // CrstDebuggerJitInfo + 12, // CrstDebuggerMutex 0, // CrstDynamicIL - 10, // CrstDynamicMT + 9, // CrstDynamicMT 0, // CrstEtwTypeLogHash - 20, // CrstEventPipe + 19, // CrstEventPipe 0, // CrstEventStore 0, // CrstException 0, // CrstExecutableAllocatorLock - 0, // CrstExecuteManRangeLock - 4, // CrstFCall + 3, // CrstFCall -1, // CrstFrozenObjectHeap - 7, // CrstFuncPtrStubs - 10, // CrstFusionAppCtx - 10, // CrstGCCover - 18, // CrstGenericDictionaryExpansion - 17, // CrstGlobalStrLiteralMap + 6, // CrstFuncPtrStubs + 9, // CrstFusionAppCtx + 9, // CrstGCCover + 17, // CrstGenericDictionaryExpansion + 16, // CrstGlobalStrLiteralMap 1, // CrstHandleTable - 0, // CrstIbcProfile - 8, // CrstIJWFixupData + 7, // CrstIJWFixupData 0, // CrstIJWHash - 7, // CrstILStubGen - 3, // CrstInlineTrackingMap - 19, // CrstInstMethodHashTable - 22, // CrstInterop - 10, // CrstInteropData + 6, // CrstILStubGen + 0, // CrstInlineTrackingMap + 18, // CrstInstMethodHashTable + 0, // CrstInterfaceDispatchGlobalLists + 21, // CrstInterop + 9, // CrstInteropData 0, // CrstIsJMCMethod - 7, // CrstISymUnmanagedReader - 11, // CrstJit - 0, // CrstJitGenericHandleCache - 12, // CrstJitInlineTrackingMap - 4, // CrstJitPatchpoint - -1, // CrstJitPerf - 6, // CrstJumpStubCache + 6, // CrstISymUnmanagedReader + 10, // CrstJit + 11, // CrstJitInlineTrackingMap + 3, // CrstJitPatchpoint + 5, // CrstJumpStubCache 0, // CrstLeafLock -1, // CrstListLock - 17, // CrstLoaderAllocator - 18, // CrstLoaderAllocatorReferences - 3, // CrstLoaderHeap - 3, // CrstManagedObjectWrapperMap - 10, // CrstMethodDescBackpatchInfoTracker + 16, // CrstLoaderAllocator + 17, // CrstLoaderAllocatorReferences + 2, // CrstLoaderHeap + 2, // CrstManagedObjectWrapperMap + 9, // CrstMethodDescBackpatchInfoTracker -1, // CrstMethodTableExposedObject - 5, // CrstModule - 18, // CrstModuleFixup - 4, // CrstModuleLookupTable + 4, // CrstModule + 3, // CrstModuleLookupTable 0, // CrstMulticoreJitHash - 15, // CrstMulticoreJitManager - 3, // CrstNativeImageEagerFixups + 14, // CrstMulticoreJitManager + 7, // CrstNativeImageEagerFixups 0, // CrstNativeImageLoad - 0, // CrstNls 0, // CrstNotifyGdb - 2, // CrstObjectList - 5, // CrstPEImage - 21, // CrstPendingTypeLoadEntry + 4, // CrstPEImage + 20, // CrstPendingTypeLoadEntry 0, // CrstPerfMap - 4, // CrstPgoData + 3, // CrstPgoData 0, // CrstPinnedByrefValidation - 16, // CrstPinnedHeapHandleTable + 15, // CrstPinnedHeapHandleTable 0, // CrstProfilerGCRefDataFreeList - 15, // CrstProfilingAPIStatus - 4, // CrstRCWCache + 14, // CrstProfilingAPIStatus + 3, // CrstRCWCache 0, // CrstRCWCleanupList - 10, // CrstReadyToRunEntryPointToMethodDescMap - 8, // CrstReflection - 16, // CrstReJITGlobalRequest - 4, // CrstRetThunkCache - 3, // CrstSavedExceptionInfo - 0, // CrstSaveModuleProfileData - 4, // CrstSigConvert - 5, // CrstSingleUseLock - 0, // CrstSpecialStatics - 0, // CrstStackSampler + 9, // CrstReadyToRunEntryPointToMethodDescMap + 7, // CrstReflection + 15, // CrstReJITGlobalRequest + 3, // CrstSigConvert + 4, // CrstSingleUseLock -1, // CrstStressLog - 5, // CrstStubCache + 3, // CrstStubCache 0, // CrstStubDispatchCache - 4, // CrstStubUnwindInfoHeapSegments - 3, // CrstSyncBlockCache + 2, // CrstSyncBlockCache 0, // CrstSyncHashLock - 5, // CrstSystemBaseDomain - 15, // CrstSystemDomain + 14, // CrstSystemDomain 0, // CrstSystemDomainDelayedUnloadList 0, // CrstThreadIdDispenser - 5, // CrstThreadLocalStorageLock - 14, // CrstThreadStore - 8, // CrstTieredCompilation - 4, // CrstTypeEquivalenceMap - 10, // CrstTypeIDMap - 4, // CrstUMEntryThunkCache - 3, // CrstUMEntryThunkFreeListLock - 4, // CrstUniqueStack - 7, // CrstUnresolvedClassLock - 3, // CrstUnwindInfoTableLock - 4, // CrstVSDIndirectionCellLock - 3, // CrstWrapperTemplate + 4, // CrstThreadLocalStorageLock + 13, // CrstThreadStore + 7, // CrstTieredCompilation + 3, // CrstTypeEquivalenceMap + 9, // CrstTypeIDMap + 3, // CrstUMEntryThunkCache + 2, // CrstUMEntryThunkFreeListLock + 3, // CrstUniqueStack + 6, // CrstUnresolvedClassLock + 2, // CrstUnwindInfoTableLock + 3, // CrstVSDIndirectionCellLock + 2, // CrstWrapperTemplate }; // An array mapping CrstType to a stringized name. LPCSTR g_rgCrstNameMap[] = { "CrstAppDomainCache", - "CrstArgBasedStubCache", "CrstAssemblyList", "CrstAssemblyLoader", "CrstAvailableClass", "CrstAvailableParamTypes", - "CrstBaseDomain", + "CrstCallStubCache", "CrstCCompRC", "CrstClassFactInfoHash", "CrstClassInit", @@ -292,7 +261,6 @@ LPCSTR g_rgCrstNameMap[] = "CrstDebuggerHeapLock", "CrstDebuggerJitInfo", "CrstDebuggerMutex", - "CrstDelegateToFPtrHash", "CrstDynamicIL", "CrstDynamicMT", "CrstEtwTypeLogHash", @@ -300,7 +268,6 @@ LPCSTR g_rgCrstNameMap[] = "CrstEventStore", "CrstException", "CrstExecutableAllocatorLock", - "CrstExecuteManRangeLock", "CrstFCall", "CrstFrozenObjectHeap", "CrstFuncPtrStubs", @@ -309,21 +276,19 @@ LPCSTR g_rgCrstNameMap[] = "CrstGenericDictionaryExpansion", "CrstGlobalStrLiteralMap", "CrstHandleTable", - "CrstIbcProfile", "CrstIJWFixupData", "CrstIJWHash", "CrstILStubGen", "CrstInlineTrackingMap", "CrstInstMethodHashTable", + "CrstInterfaceDispatchGlobalLists", "CrstInterop", "CrstInteropData", "CrstIsJMCMethod", "CrstISymUnmanagedReader", "CrstJit", - "CrstJitGenericHandleCache", "CrstJitInlineTrackingMap", "CrstJitPatchpoint", - "CrstJitPerf", "CrstJumpStubCache", "CrstLeafLock", "CrstListLock", @@ -334,15 +299,12 @@ LPCSTR g_rgCrstNameMap[] = "CrstMethodDescBackpatchInfoTracker", "CrstMethodTableExposedObject", "CrstModule", - "CrstModuleFixup", "CrstModuleLookupTable", "CrstMulticoreJitHash", "CrstMulticoreJitManager", "CrstNativeImageEagerFixups", "CrstNativeImageLoad", - "CrstNls", "CrstNotifyGdb", - "CrstObjectList", "CrstPEImage", "CrstPendingTypeLoadEntry", "CrstPerfMap", @@ -356,20 +318,13 @@ LPCSTR g_rgCrstNameMap[] = "CrstReadyToRunEntryPointToMethodDescMap", "CrstReflection", "CrstReJITGlobalRequest", - "CrstRetThunkCache", - "CrstSavedExceptionInfo", - "CrstSaveModuleProfileData", "CrstSigConvert", "CrstSingleUseLock", - "CrstSpecialStatics", - "CrstStackSampler", "CrstStressLog", "CrstStubCache", "CrstStubDispatchCache", - "CrstStubUnwindInfoHeapSegments", "CrstSyncBlockCache", "CrstSyncHashLock", - "CrstSystemBaseDomain", "CrstSystemDomain", "CrstSystemDomainDelayedUnloadList", "CrstThreadIdDispenser", diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/cvconst.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/cvconst.h deleted file mode 100644 index 3fbbfdd01..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/cvconst.h +++ /dev/null @@ -1,3729 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// cvconst.h - codeview constant definitions -//----------------------------------------------------------------- -// -// Copyright Microsoft Corporation. All Rights Reserved. -// -//--------------------------------------------------------------- -#ifndef _CVCONST_H_ -#define _CVCONST_H_ - - - -// Enumeration for function call type - - -typedef enum CV_call_e { - CV_CALL_NEAR_C = 0x00, // near right to left push, caller pops stack - CV_CALL_FAR_C = 0x01, // far right to left push, caller pops stack - CV_CALL_NEAR_PASCAL = 0x02, // near left to right push, callee pops stack - CV_CALL_FAR_PASCAL = 0x03, // far left to right push, callee pops stack - CV_CALL_NEAR_FAST = 0x04, // near left to right push with regs, callee pops stack - CV_CALL_FAR_FAST = 0x05, // far left to right push with regs, callee pops stack - CV_CALL_SKIPPED = 0x06, // skipped (unused) call index - CV_CALL_NEAR_STD = 0x07, // near standard call - CV_CALL_FAR_STD = 0x08, // far standard call - CV_CALL_NEAR_SYS = 0x09, // near sys call - CV_CALL_FAR_SYS = 0x0a, // far sys call - CV_CALL_THISCALL = 0x0b, // this call (this passed in register) - CV_CALL_MIPSCALL = 0x0c, // Mips call - CV_CALL_GENERIC = 0x0d, // Generic call sequence - CV_CALL_ALPHACALL = 0x0e, // Alpha call - CV_CALL_PPCCALL = 0x0f, // PPC call - CV_CALL_SHCALL = 0x10, // Hitachi SuperH call - CV_CALL_ARMCALL = 0x11, // ARM call - CV_CALL_AM33CALL = 0x12, // AM33 call - CV_CALL_TRICALL = 0x13, // TriCore Call - CV_CALL_SH5CALL = 0x14, // Hitachi SuperH-5 call - CV_CALL_M32RCALL = 0x15, // M32R Call - CV_CALL_CLRCALL = 0x16, // clr call - CV_CALL_INLINE = 0x17, // Marker for routines always inlined and thus lacking a convention - CV_CALL_NEAR_VECTOR = 0x18, // near left to right push with regs, callee pops stack - CV_CALL_RESERVED = 0x19 // first unused call enumeration - - // Do NOT add any more machine specific conventions. This is to be used for - // calling conventions in the source only (e.g. __cdecl, __stdcall). -} CV_call_e; - - -// Values for the access protection of class attributes - - -typedef enum CV_access_e { - CV_private = 1, - CV_protected = 2, - CV_public = 3 -} CV_access_e; - -typedef enum THUNK_ORDINAL { - THUNK_ORDINAL_NOTYPE, // standard thunk - THUNK_ORDINAL_ADJUSTOR, // "this" adjustor thunk - THUNK_ORDINAL_VCALL, // virtual call thunk - THUNK_ORDINAL_PCODE, // pcode thunk - THUNK_ORDINAL_LOAD, // thunk which loads the address to jump to - // via unknown means... - - // trampoline thunk ordinals - only for use in Trampoline thunk symbols - THUNK_ORDINAL_TRAMP_INCREMENTAL, - THUNK_ORDINAL_TRAMP_BRANCHISLAND, - -} THUNK_ORDINAL; - - -enum CV_SourceChksum_t { - CHKSUM_TYPE_NONE = 0, // indicates no checksum is available - CHKSUM_TYPE_MD5, - CHKSUM_TYPE_SHA1, - CHKSUM_TYPE_SHA_256, -}; - -// -// DIA enums -// - -enum SymTagEnum -{ - SymTagNull, - SymTagExe, - SymTagCompiland, - SymTagCompilandDetails, - SymTagCompilandEnv, - SymTagFunction, - SymTagBlock, - SymTagData, - SymTagAnnotation, - SymTagLabel, - SymTagPublicSymbol, - SymTagUDT, - SymTagEnum, - SymTagFunctionType, - SymTagPointerType, - SymTagArrayType, - SymTagBaseType, - SymTagTypedef, - SymTagBaseClass, - SymTagFriend, - SymTagFunctionArgType, - SymTagFuncDebugStart, - SymTagFuncDebugEnd, - SymTagUsingNamespace, - SymTagVTableShape, - SymTagVTable, - SymTagCustom, - SymTagThunk, - SymTagCustomType, - SymTagManagedType, - SymTagDimension, - SymTagCallSite, - SymTagInlineSite, - SymTagBaseInterface, - SymTagVectorType, - SymTagMatrixType, - SymTagHLSLType, - SymTagCaller, - SymTagCallee, - SymTagExport, - SymTagHeapAllocationSite, - SymTagCoffGroup, - SymTagMax -}; - -enum LocationType -{ - LocIsNull, - LocIsStatic, - LocIsTLS, - LocIsRegRel, - LocIsThisRel, - LocIsEnregistered, - LocIsBitField, - LocIsSlot, - LocIsIlRel, - LocInMetaData, - LocIsConstant, - LocTypeMax -}; - -enum DataKind -{ - DataIsUnknown, - DataIsLocal, - DataIsStaticLocal, - DataIsParam, - DataIsObjectPtr, - DataIsFileStatic, - DataIsGlobal, - DataIsMember, - DataIsStaticMember, - DataIsConstant -}; - -enum UdtKind -{ - UdtStruct, - UdtClass, - UdtUnion, - UdtInterface -}; - -enum BasicType -{ - btNoType = 0, - btVoid = 1, - btChar = 2, - btWChar = 3, - btInt = 6, - btUInt = 7, - btFloat = 8, - btBCD = 9, - btBool = 10, - btLong = 13, - btULong = 14, - btCurrency = 25, - btDate = 26, - btVariant = 27, - btComplex = 28, - btBit = 29, - btBSTR = 30, - btHresult = 31, - btChar16 = 32, // char16_t - btChar32 = 33, // char32_t -}; - - -// enumeration for type modifier values - -typedef enum CV_modifier_e { - // 0x0000 - 0x01ff - Reserved. - - CV_MOD_INVALID = 0x0000, - - // Standard modifiers. - - CV_MOD_CONST = 0x0001, - CV_MOD_VOLATILE = 0x0002, - CV_MOD_UNALIGNED = 0x0003, - - // 0x0200 - 0x03ff - HLSL modifiers. - - CV_MOD_HLSL_UNIFORM = 0x0200, - CV_MOD_HLSL_LINE = 0x0201, - CV_MOD_HLSL_TRIANGLE = 0x0202, - CV_MOD_HLSL_LINEADJ = 0x0203, - CV_MOD_HLSL_TRIANGLEADJ = 0x0204, - CV_MOD_HLSL_LINEAR = 0x0205, - CV_MOD_HLSL_CENTROID = 0x0206, - CV_MOD_HLSL_CONSTINTERP = 0x0207, - CV_MOD_HLSL_NOPERSPECTIVE = 0x0208, - CV_MOD_HLSL_SAMPLE = 0x0209, - CV_MOD_HLSL_CENTER = 0x020a, - CV_MOD_HLSL_SNORM = 0x020b, - CV_MOD_HLSL_UNORM = 0x020c, - CV_MOD_HLSL_PRECISE = 0x020d, - CV_MOD_HLSL_UAV_GLOBALLY_COHERENT = 0x020e, - - // 0x0400 - 0xffff - Unused. - -} CV_modifier_e; - - -// built-in type kinds - - -typedef enum CV_builtin_e { - - // 0x0000 - 0x01ff - Reserved. - CV_BI_INVALID = 0x0000, - - // 0x0200 - 0x03ff - HLSL types. - - CV_BI_HLSL_INTERFACE_POINTER = 0x0200, - CV_BI_HLSL_TEXTURE1D = 0x0201, - CV_BI_HLSL_TEXTURE1D_ARRAY = 0x0202, - CV_BI_HLSL_TEXTURE2D = 0x0203, - CV_BI_HLSL_TEXTURE2D_ARRAY = 0x0204, - CV_BI_HLSL_TEXTURE3D = 0x0205, - CV_BI_HLSL_TEXTURECUBE = 0x0206, - CV_BI_HLSL_TEXTURECUBE_ARRAY = 0x0207, - CV_BI_HLSL_TEXTURE2DMS = 0x0208, - CV_BI_HLSL_TEXTURE2DMS_ARRAY = 0x0209, - CV_BI_HLSL_SAMPLER = 0x020a, - CV_BI_HLSL_SAMPLERCOMPARISON = 0x020b, - CV_BI_HLSL_BUFFER = 0x020c, - CV_BI_HLSL_POINTSTREAM = 0x020d, - CV_BI_HLSL_LINESTREAM = 0x020e, - CV_BI_HLSL_TRIANGLESTREAM = 0x020f, - CV_BI_HLSL_INPUTPATCH = 0x0210, - CV_BI_HLSL_OUTPUTPATCH = 0x0211, - CV_BI_HLSL_RWTEXTURE1D = 0x0212, - CV_BI_HLSL_RWTEXTURE1D_ARRAY = 0x0213, - CV_BI_HLSL_RWTEXTURE2D = 0x0214, - CV_BI_HLSL_RWTEXTURE2D_ARRAY = 0x0215, - CV_BI_HLSL_RWTEXTURE3D = 0x0216, - CV_BI_HLSL_RWBUFFER = 0x0217, - CV_BI_HLSL_BYTEADDRESS_BUFFER = 0x0218, - CV_BI_HLSL_RWBYTEADDRESS_BUFFER = 0x0219, - CV_BI_HLSL_STRUCTURED_BUFFER = 0x021a, - CV_BI_HLSL_RWSTRUCTURED_BUFFER = 0x021b, - CV_BI_HLSL_APPEND_STRUCTURED_BUFFER = 0x021c, - CV_BI_HLSL_CONSUME_STRUCTURED_BUFFER= 0x021d, - CV_BI_HLSL_MIN8FLOAT = 0x021e, - CV_BI_HLSL_MIN10FLOAT = 0x021f, - CV_BI_HLSL_MIN16FLOAT = 0x0220, - CV_BI_HLSL_MIN12INT = 0x0221, - CV_BI_HLSL_MIN16INT = 0x0222, - CV_BI_HLSL_MIN16UINT = 0x0223, - - // 0x0400 - 0xffff - Unused. - -} CV_builtin_e; - - -// enum describing the compile flag source language - - -typedef enum CV_CFL_LANG { - CV_CFL_C = 0x00, - CV_CFL_CXX = 0x01, - CV_CFL_FORTRAN = 0x02, - CV_CFL_MASM = 0x03, - CV_CFL_PASCAL = 0x04, - CV_CFL_BASIC = 0x05, - CV_CFL_COBOL = 0x06, - CV_CFL_LINK = 0x07, - CV_CFL_CVTRES = 0x08, - CV_CFL_CVTPGD = 0x09, - CV_CFL_CSHARP = 0x0A, // C# - CV_CFL_VB = 0x0B, // Visual Basic - CV_CFL_ILASM = 0x0C, // IL (as in CLR) ASM - CV_CFL_JAVA = 0x0D, - CV_CFL_JSCRIPT = 0x0E, - CV_CFL_MSIL = 0x0F, // Unknown MSIL (LTCG of .NETMODULE) - CV_CFL_HLSL = 0x10, // High Level Shader Language -} CV_CFL_LANG; - - -// enum describing target processor - - -typedef enum CV_CPU_TYPE_e { - CV_CFL_8080 = 0x00, - CV_CFL_8086 = 0x01, - CV_CFL_80286 = 0x02, - CV_CFL_80386 = 0x03, - CV_CFL_80486 = 0x04, - CV_CFL_PENTIUM = 0x05, - CV_CFL_PENTIUMII = 0x06, - CV_CFL_PENTIUMPRO = CV_CFL_PENTIUMII, - CV_CFL_PENTIUMIII = 0x07, - CV_CFL_MIPS = 0x10, - CV_CFL_MIPSR4000 = CV_CFL_MIPS, // don't break current code - CV_CFL_MIPS16 = 0x11, - CV_CFL_MIPS32 = 0x12, - CV_CFL_MIPS64 = 0x13, - CV_CFL_MIPSI = 0x14, - CV_CFL_MIPSII = 0x15, - CV_CFL_MIPSIII = 0x16, - CV_CFL_MIPSIV = 0x17, - CV_CFL_MIPSV = 0x18, - CV_CFL_M68000 = 0x20, - CV_CFL_M68010 = 0x21, - CV_CFL_M68020 = 0x22, - CV_CFL_M68030 = 0x23, - CV_CFL_M68040 = 0x24, - CV_CFL_ALPHA = 0x30, - CV_CFL_ALPHA_21064 = 0x30, - CV_CFL_ALPHA_21164 = 0x31, - CV_CFL_ALPHA_21164A = 0x32, - CV_CFL_ALPHA_21264 = 0x33, - CV_CFL_ALPHA_21364 = 0x34, - CV_CFL_PPC601 = 0x40, - CV_CFL_PPC603 = 0x41, - CV_CFL_PPC604 = 0x42, - CV_CFL_PPC620 = 0x43, - CV_CFL_PPCFP = 0x44, - CV_CFL_PPCBE = 0x45, - CV_CFL_SH3 = 0x50, - CV_CFL_SH3E = 0x51, - CV_CFL_SH3DSP = 0x52, - CV_CFL_SH4 = 0x53, - CV_CFL_SHMEDIA = 0x54, - CV_CFL_ARM3 = 0x60, - CV_CFL_ARM4 = 0x61, - CV_CFL_ARM4T = 0x62, - CV_CFL_ARM5 = 0x63, - CV_CFL_ARM5T = 0x64, - CV_CFL_ARM6 = 0x65, - CV_CFL_ARM_XMAC = 0x66, - CV_CFL_ARM_WMMX = 0x67, - CV_CFL_ARM7 = 0x68, - CV_CFL_OMNI = 0x70, - CV_CFL_IA64 = 0x80, - CV_CFL_IA64_1 = 0x80, - CV_CFL_IA64_2 = 0x81, - CV_CFL_CEE = 0x90, - CV_CFL_AM33 = 0xA0, - CV_CFL_M32R = 0xB0, - CV_CFL_TRICORE = 0xC0, - CV_CFL_X64 = 0xD0, - CV_CFL_AMD64 = CV_CFL_X64, - CV_CFL_EBC = 0xE0, - CV_CFL_THUMB = 0xF0, - CV_CFL_ARMNT = 0xF4, - CV_CFL_ARM64 = 0xF6, - CV_CFL_D3D11_SHADER = 0x100, -} CV_CPU_TYPE_e; - -typedef enum CV_HREG_e { - // Register subset shared by all processor types, - // must not overlap with any of the ranges below, hence the high values - - CV_ALLREG_ERR = 30000, - CV_ALLREG_TEB = 30001, - CV_ALLREG_TIMER = 30002, - CV_ALLREG_EFAD1 = 30003, - CV_ALLREG_EFAD2 = 30004, - CV_ALLREG_EFAD3 = 30005, - CV_ALLREG_VFRAME= 30006, - CV_ALLREG_HANDLE= 30007, - CV_ALLREG_PARAMS= 30008, - CV_ALLREG_LOCALS= 30009, - CV_ALLREG_TID = 30010, - CV_ALLREG_ENV = 30011, - CV_ALLREG_CMDLN = 30012, - - - // Register set for the Intel 80x86 and ix86 processor series - // (plus PCODE registers) - - CV_REG_NONE = 0, - CV_REG_AL = 1, - CV_REG_CL = 2, - CV_REG_DL = 3, - CV_REG_BL = 4, - CV_REG_AH = 5, - CV_REG_CH = 6, - CV_REG_DH = 7, - CV_REG_BH = 8, - CV_REG_AX = 9, - CV_REG_CX = 10, - CV_REG_DX = 11, - CV_REG_BX = 12, - CV_REG_SP = 13, - CV_REG_BP = 14, - CV_REG_SI = 15, - CV_REG_DI = 16, - CV_REG_EAX = 17, - CV_REG_ECX = 18, - CV_REG_EDX = 19, - CV_REG_EBX = 20, - CV_REG_ESP = 21, - CV_REG_EBP = 22, - CV_REG_ESI = 23, - CV_REG_EDI = 24, - CV_REG_ES = 25, - CV_REG_CS = 26, - CV_REG_SS = 27, - CV_REG_DS = 28, - CV_REG_FS = 29, - CV_REG_GS = 30, - CV_REG_IP = 31, - CV_REG_FLAGS = 32, - CV_REG_EIP = 33, - CV_REG_EFLAGS = 34, - CV_REG_TEMP = 40, // PCODE Temp - CV_REG_TEMPH = 41, // PCODE TempH - CV_REG_QUOTE = 42, // PCODE Quote - CV_REG_PCDR3 = 43, // PCODE reserved - CV_REG_PCDR4 = 44, // PCODE reserved - CV_REG_PCDR5 = 45, // PCODE reserved - CV_REG_PCDR6 = 46, // PCODE reserved - CV_REG_PCDR7 = 47, // PCODE reserved - CV_REG_CR0 = 80, // CR0 -- control registers - CV_REG_CR1 = 81, - CV_REG_CR2 = 82, - CV_REG_CR3 = 83, - CV_REG_CR4 = 84, // Pentium - CV_REG_DR0 = 90, // Debug register - CV_REG_DR1 = 91, - CV_REG_DR2 = 92, - CV_REG_DR3 = 93, - CV_REG_DR4 = 94, - CV_REG_DR5 = 95, - CV_REG_DR6 = 96, - CV_REG_DR7 = 97, - CV_REG_GDTR = 110, - CV_REG_GDTL = 111, - CV_REG_IDTR = 112, - CV_REG_IDTL = 113, - CV_REG_LDTR = 114, - CV_REG_TR = 115, - - CV_REG_PSEUDO1 = 116, - CV_REG_PSEUDO2 = 117, - CV_REG_PSEUDO3 = 118, - CV_REG_PSEUDO4 = 119, - CV_REG_PSEUDO5 = 120, - CV_REG_PSEUDO6 = 121, - CV_REG_PSEUDO7 = 122, - CV_REG_PSEUDO8 = 123, - CV_REG_PSEUDO9 = 124, - - CV_REG_ST0 = 128, - CV_REG_ST1 = 129, - CV_REG_ST2 = 130, - CV_REG_ST3 = 131, - CV_REG_ST4 = 132, - CV_REG_ST5 = 133, - CV_REG_ST6 = 134, - CV_REG_ST7 = 135, - CV_REG_CTRL = 136, - CV_REG_STAT = 137, - CV_REG_TAG = 138, - CV_REG_FPIP = 139, - CV_REG_FPCS = 140, - CV_REG_FPDO = 141, - CV_REG_FPDS = 142, - CV_REG_ISEM = 143, - CV_REG_FPEIP = 144, - CV_REG_FPEDO = 145, - - CV_REG_MM0 = 146, - CV_REG_MM1 = 147, - CV_REG_MM2 = 148, - CV_REG_MM3 = 149, - CV_REG_MM4 = 150, - CV_REG_MM5 = 151, - CV_REG_MM6 = 152, - CV_REG_MM7 = 153, - - CV_REG_XMM0 = 154, // KATMAI registers - CV_REG_XMM1 = 155, - CV_REG_XMM2 = 156, - CV_REG_XMM3 = 157, - CV_REG_XMM4 = 158, - CV_REG_XMM5 = 159, - CV_REG_XMM6 = 160, - CV_REG_XMM7 = 161, - - CV_REG_XMM00 = 162, // KATMAI sub-registers - CV_REG_XMM01 = 163, - CV_REG_XMM02 = 164, - CV_REG_XMM03 = 165, - CV_REG_XMM10 = 166, - CV_REG_XMM11 = 167, - CV_REG_XMM12 = 168, - CV_REG_XMM13 = 169, - CV_REG_XMM20 = 170, - CV_REG_XMM21 = 171, - CV_REG_XMM22 = 172, - CV_REG_XMM23 = 173, - CV_REG_XMM30 = 174, - CV_REG_XMM31 = 175, - CV_REG_XMM32 = 176, - CV_REG_XMM33 = 177, - CV_REG_XMM40 = 178, - CV_REG_XMM41 = 179, - CV_REG_XMM42 = 180, - CV_REG_XMM43 = 181, - CV_REG_XMM50 = 182, - CV_REG_XMM51 = 183, - CV_REG_XMM52 = 184, - CV_REG_XMM53 = 185, - CV_REG_XMM60 = 186, - CV_REG_XMM61 = 187, - CV_REG_XMM62 = 188, - CV_REG_XMM63 = 189, - CV_REG_XMM70 = 190, - CV_REG_XMM71 = 191, - CV_REG_XMM72 = 192, - CV_REG_XMM73 = 193, - - CV_REG_XMM0L = 194, - CV_REG_XMM1L = 195, - CV_REG_XMM2L = 196, - CV_REG_XMM3L = 197, - CV_REG_XMM4L = 198, - CV_REG_XMM5L = 199, - CV_REG_XMM6L = 200, - CV_REG_XMM7L = 201, - - CV_REG_XMM0H = 202, - CV_REG_XMM1H = 203, - CV_REG_XMM2H = 204, - CV_REG_XMM3H = 205, - CV_REG_XMM4H = 206, - CV_REG_XMM5H = 207, - CV_REG_XMM6H = 208, - CV_REG_XMM7H = 209, - - CV_REG_MXCSR = 211, // XMM status register - - CV_REG_EDXEAX = 212, // EDX:EAX pair - - CV_REG_EMM0L = 220, // XMM sub-registers (WNI integer) - CV_REG_EMM1L = 221, - CV_REG_EMM2L = 222, - CV_REG_EMM3L = 223, - CV_REG_EMM4L = 224, - CV_REG_EMM5L = 225, - CV_REG_EMM6L = 226, - CV_REG_EMM7L = 227, - - CV_REG_EMM0H = 228, - CV_REG_EMM1H = 229, - CV_REG_EMM2H = 230, - CV_REG_EMM3H = 231, - CV_REG_EMM4H = 232, - CV_REG_EMM5H = 233, - CV_REG_EMM6H = 234, - CV_REG_EMM7H = 235, - - // do not change the order of these regs, first one must be even too - CV_REG_MM00 = 236, - CV_REG_MM01 = 237, - CV_REG_MM10 = 238, - CV_REG_MM11 = 239, - CV_REG_MM20 = 240, - CV_REG_MM21 = 241, - CV_REG_MM30 = 242, - CV_REG_MM31 = 243, - CV_REG_MM40 = 244, - CV_REG_MM41 = 245, - CV_REG_MM50 = 246, - CV_REG_MM51 = 247, - CV_REG_MM60 = 248, - CV_REG_MM61 = 249, - CV_REG_MM70 = 250, - CV_REG_MM71 = 251, - - CV_REG_YMM0 = 252, // AVX registers - CV_REG_YMM1 = 253, - CV_REG_YMM2 = 254, - CV_REG_YMM3 = 255, - CV_REG_YMM4 = 256, - CV_REG_YMM5 = 257, - CV_REG_YMM6 = 258, - CV_REG_YMM7 = 259, - - CV_REG_YMM0H = 260, - CV_REG_YMM1H = 261, - CV_REG_YMM2H = 262, - CV_REG_YMM3H = 263, - CV_REG_YMM4H = 264, - CV_REG_YMM5H = 265, - CV_REG_YMM6H = 266, - CV_REG_YMM7H = 267, - - CV_REG_YMM0I0 = 268, // AVX integer registers - CV_REG_YMM0I1 = 269, - CV_REG_YMM0I2 = 270, - CV_REG_YMM0I3 = 271, - CV_REG_YMM1I0 = 272, - CV_REG_YMM1I1 = 273, - CV_REG_YMM1I2 = 274, - CV_REG_YMM1I3 = 275, - CV_REG_YMM2I0 = 276, - CV_REG_YMM2I1 = 277, - CV_REG_YMM2I2 = 278, - CV_REG_YMM2I3 = 279, - CV_REG_YMM3I0 = 280, - CV_REG_YMM3I1 = 281, - CV_REG_YMM3I2 = 282, - CV_REG_YMM3I3 = 283, - CV_REG_YMM4I0 = 284, - CV_REG_YMM4I1 = 285, - CV_REG_YMM4I2 = 286, - CV_REG_YMM4I3 = 287, - CV_REG_YMM5I0 = 288, - CV_REG_YMM5I1 = 289, - CV_REG_YMM5I2 = 290, - CV_REG_YMM5I3 = 291, - CV_REG_YMM6I0 = 292, - CV_REG_YMM6I1 = 293, - CV_REG_YMM6I2 = 294, - CV_REG_YMM6I3 = 295, - CV_REG_YMM7I0 = 296, - CV_REG_YMM7I1 = 297, - CV_REG_YMM7I2 = 298, - CV_REG_YMM7I3 = 299, - - CV_REG_YMM0F0 = 300, // AVX floating-point single precise registers - CV_REG_YMM0F1 = 301, - CV_REG_YMM0F2 = 302, - CV_REG_YMM0F3 = 303, - CV_REG_YMM0F4 = 304, - CV_REG_YMM0F5 = 305, - CV_REG_YMM0F6 = 306, - CV_REG_YMM0F7 = 307, - CV_REG_YMM1F0 = 308, - CV_REG_YMM1F1 = 309, - CV_REG_YMM1F2 = 310, - CV_REG_YMM1F3 = 311, - CV_REG_YMM1F4 = 312, - CV_REG_YMM1F5 = 313, - CV_REG_YMM1F6 = 314, - CV_REG_YMM1F7 = 315, - CV_REG_YMM2F0 = 316, - CV_REG_YMM2F1 = 317, - CV_REG_YMM2F2 = 318, - CV_REG_YMM2F3 = 319, - CV_REG_YMM2F4 = 320, - CV_REG_YMM2F5 = 321, - CV_REG_YMM2F6 = 322, - CV_REG_YMM2F7 = 323, - CV_REG_YMM3F0 = 324, - CV_REG_YMM3F1 = 325, - CV_REG_YMM3F2 = 326, - CV_REG_YMM3F3 = 327, - CV_REG_YMM3F4 = 328, - CV_REG_YMM3F5 = 329, - CV_REG_YMM3F6 = 330, - CV_REG_YMM3F7 = 331, - CV_REG_YMM4F0 = 332, - CV_REG_YMM4F1 = 333, - CV_REG_YMM4F2 = 334, - CV_REG_YMM4F3 = 335, - CV_REG_YMM4F4 = 336, - CV_REG_YMM4F5 = 337, - CV_REG_YMM4F6 = 338, - CV_REG_YMM4F7 = 339, - CV_REG_YMM5F0 = 340, - CV_REG_YMM5F1 = 341, - CV_REG_YMM5F2 = 342, - CV_REG_YMM5F3 = 343, - CV_REG_YMM5F4 = 344, - CV_REG_YMM5F5 = 345, - CV_REG_YMM5F6 = 346, - CV_REG_YMM5F7 = 347, - CV_REG_YMM6F0 = 348, - CV_REG_YMM6F1 = 349, - CV_REG_YMM6F2 = 350, - CV_REG_YMM6F3 = 351, - CV_REG_YMM6F4 = 352, - CV_REG_YMM6F5 = 353, - CV_REG_YMM6F6 = 354, - CV_REG_YMM6F7 = 355, - CV_REG_YMM7F0 = 356, - CV_REG_YMM7F1 = 357, - CV_REG_YMM7F2 = 358, - CV_REG_YMM7F3 = 359, - CV_REG_YMM7F4 = 360, - CV_REG_YMM7F5 = 361, - CV_REG_YMM7F6 = 362, - CV_REG_YMM7F7 = 363, - - CV_REG_YMM0D0 = 364, // AVX floating-point double precise registers - CV_REG_YMM0D1 = 365, - CV_REG_YMM0D2 = 366, - CV_REG_YMM0D3 = 367, - CV_REG_YMM1D0 = 368, - CV_REG_YMM1D1 = 369, - CV_REG_YMM1D2 = 370, - CV_REG_YMM1D3 = 371, - CV_REG_YMM2D0 = 372, - CV_REG_YMM2D1 = 373, - CV_REG_YMM2D2 = 374, - CV_REG_YMM2D3 = 375, - CV_REG_YMM3D0 = 376, - CV_REG_YMM3D1 = 377, - CV_REG_YMM3D2 = 378, - CV_REG_YMM3D3 = 379, - CV_REG_YMM4D0 = 380, - CV_REG_YMM4D1 = 381, - CV_REG_YMM4D2 = 382, - CV_REG_YMM4D3 = 383, - CV_REG_YMM5D0 = 384, - CV_REG_YMM5D1 = 385, - CV_REG_YMM5D2 = 386, - CV_REG_YMM5D3 = 387, - CV_REG_YMM6D0 = 388, - CV_REG_YMM6D1 = 389, - CV_REG_YMM6D2 = 390, - CV_REG_YMM6D3 = 391, - CV_REG_YMM7D0 = 392, - CV_REG_YMM7D1 = 393, - CV_REG_YMM7D2 = 394, - CV_REG_YMM7D3 = 395, - - CV_REG_BND0 = 396, - CV_REG_BND1 = 397, - CV_REG_BND2 = 398, - CV_REG_BND3 = 399, - - // registers for the 68K processors - - CV_R68_D0 = 0, - CV_R68_D1 = 1, - CV_R68_D2 = 2, - CV_R68_D3 = 3, - CV_R68_D4 = 4, - CV_R68_D5 = 5, - CV_R68_D6 = 6, - CV_R68_D7 = 7, - CV_R68_A0 = 8, - CV_R68_A1 = 9, - CV_R68_A2 = 10, - CV_R68_A3 = 11, - CV_R68_A4 = 12, - CV_R68_A5 = 13, - CV_R68_A6 = 14, - CV_R68_A7 = 15, - CV_R68_CCR = 16, - CV_R68_SR = 17, - CV_R68_USP = 18, - CV_R68_MSP = 19, - CV_R68_SFC = 20, - CV_R68_DFC = 21, - CV_R68_CACR = 22, - CV_R68_VBR = 23, - CV_R68_CAAR = 24, - CV_R68_ISP = 25, - CV_R68_PC = 26, - //reserved 27 - CV_R68_FPCR = 28, - CV_R68_FPSR = 29, - CV_R68_FPIAR = 30, - //reserved 31 - CV_R68_FP0 = 32, - CV_R68_FP1 = 33, - CV_R68_FP2 = 34, - CV_R68_FP3 = 35, - CV_R68_FP4 = 36, - CV_R68_FP5 = 37, - CV_R68_FP6 = 38, - CV_R68_FP7 = 39, - //reserved 40 - CV_R68_MMUSR030 = 41, - CV_R68_MMUSR = 42, - CV_R68_URP = 43, - CV_R68_DTT0 = 44, - CV_R68_DTT1 = 45, - CV_R68_ITT0 = 46, - CV_R68_ITT1 = 47, - //reserved 50 - CV_R68_PSR = 51, - CV_R68_PCSR = 52, - CV_R68_VAL = 53, - CV_R68_CRP = 54, - CV_R68_SRP = 55, - CV_R68_DRP = 56, - CV_R68_TC = 57, - CV_R68_AC = 58, - CV_R68_SCC = 59, - CV_R68_CAL = 60, - CV_R68_TT0 = 61, - CV_R68_TT1 = 62, - //reserved 63 - CV_R68_BAD0 = 64, - CV_R68_BAD1 = 65, - CV_R68_BAD2 = 66, - CV_R68_BAD3 = 67, - CV_R68_BAD4 = 68, - CV_R68_BAD5 = 69, - CV_R68_BAD6 = 70, - CV_R68_BAD7 = 71, - CV_R68_BAC0 = 72, - CV_R68_BAC1 = 73, - CV_R68_BAC2 = 74, - CV_R68_BAC3 = 75, - CV_R68_BAC4 = 76, - CV_R68_BAC5 = 77, - CV_R68_BAC6 = 78, - CV_R68_BAC7 = 79, - - // Register set for the MIPS 4000 - - CV_M4_NOREG = CV_REG_NONE, - - CV_M4_IntZERO = 10, /* CPU REGISTER */ - CV_M4_IntAT = 11, - CV_M4_IntV0 = 12, - CV_M4_IntV1 = 13, - CV_M4_IntA0 = 14, - CV_M4_IntA1 = 15, - CV_M4_IntA2 = 16, - CV_M4_IntA3 = 17, - CV_M4_IntT0 = 18, - CV_M4_IntT1 = 19, - CV_M4_IntT2 = 20, - CV_M4_IntT3 = 21, - CV_M4_IntT4 = 22, - CV_M4_IntT5 = 23, - CV_M4_IntT6 = 24, - CV_M4_IntT7 = 25, - CV_M4_IntS0 = 26, - CV_M4_IntS1 = 27, - CV_M4_IntS2 = 28, - CV_M4_IntS3 = 29, - CV_M4_IntS4 = 30, - CV_M4_IntS5 = 31, - CV_M4_IntS6 = 32, - CV_M4_IntS7 = 33, - CV_M4_IntT8 = 34, - CV_M4_IntT9 = 35, - CV_M4_IntKT0 = 36, - CV_M4_IntKT1 = 37, - CV_M4_IntGP = 38, - CV_M4_IntSP = 39, - CV_M4_IntS8 = 40, - CV_M4_IntRA = 41, - CV_M4_IntLO = 42, - CV_M4_IntHI = 43, - - CV_M4_Fir = 50, - CV_M4_Psr = 51, - - CV_M4_FltF0 = 60, /* Floating point registers */ - CV_M4_FltF1 = 61, - CV_M4_FltF2 = 62, - CV_M4_FltF3 = 63, - CV_M4_FltF4 = 64, - CV_M4_FltF5 = 65, - CV_M4_FltF6 = 66, - CV_M4_FltF7 = 67, - CV_M4_FltF8 = 68, - CV_M4_FltF9 = 69, - CV_M4_FltF10 = 70, - CV_M4_FltF11 = 71, - CV_M4_FltF12 = 72, - CV_M4_FltF13 = 73, - CV_M4_FltF14 = 74, - CV_M4_FltF15 = 75, - CV_M4_FltF16 = 76, - CV_M4_FltF17 = 77, - CV_M4_FltF18 = 78, - CV_M4_FltF19 = 79, - CV_M4_FltF20 = 80, - CV_M4_FltF21 = 81, - CV_M4_FltF22 = 82, - CV_M4_FltF23 = 83, - CV_M4_FltF24 = 84, - CV_M4_FltF25 = 85, - CV_M4_FltF26 = 86, - CV_M4_FltF27 = 87, - CV_M4_FltF28 = 88, - CV_M4_FltF29 = 89, - CV_M4_FltF30 = 90, - CV_M4_FltF31 = 91, - CV_M4_FltFsr = 92, - - - // Register set for the ALPHA AXP - - CV_ALPHA_NOREG = CV_REG_NONE, - - CV_ALPHA_FltF0 = 10, // Floating point registers - CV_ALPHA_FltF1 = 11, - CV_ALPHA_FltF2 = 12, - CV_ALPHA_FltF3 = 13, - CV_ALPHA_FltF4 = 14, - CV_ALPHA_FltF5 = 15, - CV_ALPHA_FltF6 = 16, - CV_ALPHA_FltF7 = 17, - CV_ALPHA_FltF8 = 18, - CV_ALPHA_FltF9 = 19, - CV_ALPHA_FltF10 = 20, - CV_ALPHA_FltF11 = 21, - CV_ALPHA_FltF12 = 22, - CV_ALPHA_FltF13 = 23, - CV_ALPHA_FltF14 = 24, - CV_ALPHA_FltF15 = 25, - CV_ALPHA_FltF16 = 26, - CV_ALPHA_FltF17 = 27, - CV_ALPHA_FltF18 = 28, - CV_ALPHA_FltF19 = 29, - CV_ALPHA_FltF20 = 30, - CV_ALPHA_FltF21 = 31, - CV_ALPHA_FltF22 = 32, - CV_ALPHA_FltF23 = 33, - CV_ALPHA_FltF24 = 34, - CV_ALPHA_FltF25 = 35, - CV_ALPHA_FltF26 = 36, - CV_ALPHA_FltF27 = 37, - CV_ALPHA_FltF28 = 38, - CV_ALPHA_FltF29 = 39, - CV_ALPHA_FltF30 = 40, - CV_ALPHA_FltF31 = 41, - - CV_ALPHA_IntV0 = 42, // Integer registers - CV_ALPHA_IntT0 = 43, - CV_ALPHA_IntT1 = 44, - CV_ALPHA_IntT2 = 45, - CV_ALPHA_IntT3 = 46, - CV_ALPHA_IntT4 = 47, - CV_ALPHA_IntT5 = 48, - CV_ALPHA_IntT6 = 49, - CV_ALPHA_IntT7 = 50, - CV_ALPHA_IntS0 = 51, - CV_ALPHA_IntS1 = 52, - CV_ALPHA_IntS2 = 53, - CV_ALPHA_IntS3 = 54, - CV_ALPHA_IntS4 = 55, - CV_ALPHA_IntS5 = 56, - CV_ALPHA_IntFP = 57, - CV_ALPHA_IntA0 = 58, - CV_ALPHA_IntA1 = 59, - CV_ALPHA_IntA2 = 60, - CV_ALPHA_IntA3 = 61, - CV_ALPHA_IntA4 = 62, - CV_ALPHA_IntA5 = 63, - CV_ALPHA_IntT8 = 64, - CV_ALPHA_IntT9 = 65, - CV_ALPHA_IntT10 = 66, - CV_ALPHA_IntT11 = 67, - CV_ALPHA_IntRA = 68, - CV_ALPHA_IntT12 = 69, - CV_ALPHA_IntAT = 70, - CV_ALPHA_IntGP = 71, - CV_ALPHA_IntSP = 72, - CV_ALPHA_IntZERO = 73, - - - CV_ALPHA_Fpcr = 74, // Control registers - CV_ALPHA_Fir = 75, - CV_ALPHA_Psr = 76, - CV_ALPHA_FltFsr = 77, - CV_ALPHA_SoftFpcr = 78, - - // Register Set for Motorola/IBM PowerPC - - /* - ** PowerPC General Registers ( User Level ) - */ - CV_PPC_GPR0 = 1, - CV_PPC_GPR1 = 2, - CV_PPC_GPR2 = 3, - CV_PPC_GPR3 = 4, - CV_PPC_GPR4 = 5, - CV_PPC_GPR5 = 6, - CV_PPC_GPR6 = 7, - CV_PPC_GPR7 = 8, - CV_PPC_GPR8 = 9, - CV_PPC_GPR9 = 10, - CV_PPC_GPR10 = 11, - CV_PPC_GPR11 = 12, - CV_PPC_GPR12 = 13, - CV_PPC_GPR13 = 14, - CV_PPC_GPR14 = 15, - CV_PPC_GPR15 = 16, - CV_PPC_GPR16 = 17, - CV_PPC_GPR17 = 18, - CV_PPC_GPR18 = 19, - CV_PPC_GPR19 = 20, - CV_PPC_GPR20 = 21, - CV_PPC_GPR21 = 22, - CV_PPC_GPR22 = 23, - CV_PPC_GPR23 = 24, - CV_PPC_GPR24 = 25, - CV_PPC_GPR25 = 26, - CV_PPC_GPR26 = 27, - CV_PPC_GPR27 = 28, - CV_PPC_GPR28 = 29, - CV_PPC_GPR29 = 30, - CV_PPC_GPR30 = 31, - CV_PPC_GPR31 = 32, - - /* - ** PowerPC Condition Register ( User Level ) - */ - CV_PPC_CR = 33, - CV_PPC_CR0 = 34, - CV_PPC_CR1 = 35, - CV_PPC_CR2 = 36, - CV_PPC_CR3 = 37, - CV_PPC_CR4 = 38, - CV_PPC_CR5 = 39, - CV_PPC_CR6 = 40, - CV_PPC_CR7 = 41, - - /* - ** PowerPC Floating Point Registers ( User Level ) - */ - CV_PPC_FPR0 = 42, - CV_PPC_FPR1 = 43, - CV_PPC_FPR2 = 44, - CV_PPC_FPR3 = 45, - CV_PPC_FPR4 = 46, - CV_PPC_FPR5 = 47, - CV_PPC_FPR6 = 48, - CV_PPC_FPR7 = 49, - CV_PPC_FPR8 = 50, - CV_PPC_FPR9 = 51, - CV_PPC_FPR10 = 52, - CV_PPC_FPR11 = 53, - CV_PPC_FPR12 = 54, - CV_PPC_FPR13 = 55, - CV_PPC_FPR14 = 56, - CV_PPC_FPR15 = 57, - CV_PPC_FPR16 = 58, - CV_PPC_FPR17 = 59, - CV_PPC_FPR18 = 60, - CV_PPC_FPR19 = 61, - CV_PPC_FPR20 = 62, - CV_PPC_FPR21 = 63, - CV_PPC_FPR22 = 64, - CV_PPC_FPR23 = 65, - CV_PPC_FPR24 = 66, - CV_PPC_FPR25 = 67, - CV_PPC_FPR26 = 68, - CV_PPC_FPR27 = 69, - CV_PPC_FPR28 = 70, - CV_PPC_FPR29 = 71, - CV_PPC_FPR30 = 72, - CV_PPC_FPR31 = 73, - - /* - ** PowerPC Floating Point Status and Control Register ( User Level ) - */ - CV_PPC_FPSCR = 74, - - /* - ** PowerPC Machine State Register ( Supervisor Level ) - */ - CV_PPC_MSR = 75, - - /* - ** PowerPC Segment Registers ( Supervisor Level ) - */ - CV_PPC_SR0 = 76, - CV_PPC_SR1 = 77, - CV_PPC_SR2 = 78, - CV_PPC_SR3 = 79, - CV_PPC_SR4 = 80, - CV_PPC_SR5 = 81, - CV_PPC_SR6 = 82, - CV_PPC_SR7 = 83, - CV_PPC_SR8 = 84, - CV_PPC_SR9 = 85, - CV_PPC_SR10 = 86, - CV_PPC_SR11 = 87, - CV_PPC_SR12 = 88, - CV_PPC_SR13 = 89, - CV_PPC_SR14 = 90, - CV_PPC_SR15 = 91, - - /* - ** For all of the special purpose registers add 100 to the SPR# that the - ** Motorola/IBM documentation gives with the exception of any imaginary - ** registers. - */ - - /* - ** PowerPC Special Purpose Registers ( User Level ) - */ - CV_PPC_PC = 99, // PC (imaginary register) - - CV_PPC_MQ = 100, // MPC601 - CV_PPC_XER = 101, - CV_PPC_RTCU = 104, // MPC601 - CV_PPC_RTCL = 105, // MPC601 - CV_PPC_LR = 108, - CV_PPC_CTR = 109, - - CV_PPC_COMPARE = 110, // part of XER (internal to the debugger only) - CV_PPC_COUNT = 111, // part of XER (internal to the debugger only) - - /* - ** PowerPC Special Purpose Registers ( Supervisor Level ) - */ - CV_PPC_DSISR = 118, - CV_PPC_DAR = 119, - CV_PPC_DEC = 122, - CV_PPC_SDR1 = 125, - CV_PPC_SRR0 = 126, - CV_PPC_SRR1 = 127, - CV_PPC_SPRG0 = 372, - CV_PPC_SPRG1 = 373, - CV_PPC_SPRG2 = 374, - CV_PPC_SPRG3 = 375, - CV_PPC_ASR = 280, // 64-bit implementations only - CV_PPC_EAR = 382, - CV_PPC_PVR = 287, - CV_PPC_BAT0U = 628, - CV_PPC_BAT0L = 629, - CV_PPC_BAT1U = 630, - CV_PPC_BAT1L = 631, - CV_PPC_BAT2U = 632, - CV_PPC_BAT2L = 633, - CV_PPC_BAT3U = 634, - CV_PPC_BAT3L = 635, - CV_PPC_DBAT0U = 636, - CV_PPC_DBAT0L = 637, - CV_PPC_DBAT1U = 638, - CV_PPC_DBAT1L = 639, - CV_PPC_DBAT2U = 640, - CV_PPC_DBAT2L = 641, - CV_PPC_DBAT3U = 642, - CV_PPC_DBAT3L = 643, - - /* - ** PowerPC Special Purpose Registers Implementation Dependent ( Supervisor Level ) - */ - - /* - ** Doesn't appear that IBM/Motorola has finished defining these. - */ - - CV_PPC_PMR0 = 1044, // MPC620, - CV_PPC_PMR1 = 1045, // MPC620, - CV_PPC_PMR2 = 1046, // MPC620, - CV_PPC_PMR3 = 1047, // MPC620, - CV_PPC_PMR4 = 1048, // MPC620, - CV_PPC_PMR5 = 1049, // MPC620, - CV_PPC_PMR6 = 1050, // MPC620, - CV_PPC_PMR7 = 1051, // MPC620, - CV_PPC_PMR8 = 1052, // MPC620, - CV_PPC_PMR9 = 1053, // MPC620, - CV_PPC_PMR10 = 1054, // MPC620, - CV_PPC_PMR11 = 1055, // MPC620, - CV_PPC_PMR12 = 1056, // MPC620, - CV_PPC_PMR13 = 1057, // MPC620, - CV_PPC_PMR14 = 1058, // MPC620, - CV_PPC_PMR15 = 1059, // MPC620, - - CV_PPC_DMISS = 1076, // MPC603 - CV_PPC_DCMP = 1077, // MPC603 - CV_PPC_HASH1 = 1078, // MPC603 - CV_PPC_HASH2 = 1079, // MPC603 - CV_PPC_IMISS = 1080, // MPC603 - CV_PPC_ICMP = 1081, // MPC603 - CV_PPC_RPA = 1082, // MPC603 - - CV_PPC_HID0 = 1108, // MPC601, MPC603, MPC620 - CV_PPC_HID1 = 1109, // MPC601 - CV_PPC_HID2 = 1110, // MPC601, MPC603, MPC620 ( IABR ) - CV_PPC_HID3 = 1111, // Not Defined - CV_PPC_HID4 = 1112, // Not Defined - CV_PPC_HID5 = 1113, // MPC601, MPC604, MPC620 ( DABR ) - CV_PPC_HID6 = 1114, // Not Defined - CV_PPC_HID7 = 1115, // Not Defined - CV_PPC_HID8 = 1116, // MPC620 ( BUSCSR ) - CV_PPC_HID9 = 1117, // MPC620 ( L2CSR ) - CV_PPC_HID10 = 1118, // Not Defined - CV_PPC_HID11 = 1119, // Not Defined - CV_PPC_HID12 = 1120, // Not Defined - CV_PPC_HID13 = 1121, // MPC604 ( HCR ) - CV_PPC_HID14 = 1122, // Not Defined - CV_PPC_HID15 = 1123, // MPC601, MPC604, MPC620 ( PIR ) - - // - // JAVA VM registers - // - - CV_JAVA_PC = 1, - - // - // Register set for the Hitachi SH3 - // - - CV_SH3_NOREG = CV_REG_NONE, - - CV_SH3_IntR0 = 10, // CPU REGISTER - CV_SH3_IntR1 = 11, - CV_SH3_IntR2 = 12, - CV_SH3_IntR3 = 13, - CV_SH3_IntR4 = 14, - CV_SH3_IntR5 = 15, - CV_SH3_IntR6 = 16, - CV_SH3_IntR7 = 17, - CV_SH3_IntR8 = 18, - CV_SH3_IntR9 = 19, - CV_SH3_IntR10 = 20, - CV_SH3_IntR11 = 21, - CV_SH3_IntR12 = 22, - CV_SH3_IntR13 = 23, - CV_SH3_IntFp = 24, - CV_SH3_IntSp = 25, - CV_SH3_Gbr = 38, - CV_SH3_Pr = 39, - CV_SH3_Mach = 40, - CV_SH3_Macl = 41, - - CV_SH3_Pc = 50, - CV_SH3_Sr = 51, - - CV_SH3_BarA = 60, - CV_SH3_BasrA = 61, - CV_SH3_BamrA = 62, - CV_SH3_BbrA = 63, - CV_SH3_BarB = 64, - CV_SH3_BasrB = 65, - CV_SH3_BamrB = 66, - CV_SH3_BbrB = 67, - CV_SH3_BdrB = 68, - CV_SH3_BdmrB = 69, - CV_SH3_Brcr = 70, - - // - // Additional registers for Hitachi SH processors - // - - CV_SH_Fpscr = 75, // floating point status/control register - CV_SH_Fpul = 76, // floating point communication register - - CV_SH_FpR0 = 80, // Floating point registers - CV_SH_FpR1 = 81, - CV_SH_FpR2 = 82, - CV_SH_FpR3 = 83, - CV_SH_FpR4 = 84, - CV_SH_FpR5 = 85, - CV_SH_FpR6 = 86, - CV_SH_FpR7 = 87, - CV_SH_FpR8 = 88, - CV_SH_FpR9 = 89, - CV_SH_FpR10 = 90, - CV_SH_FpR11 = 91, - CV_SH_FpR12 = 92, - CV_SH_FpR13 = 93, - CV_SH_FpR14 = 94, - CV_SH_FpR15 = 95, - - CV_SH_XFpR0 = 96, - CV_SH_XFpR1 = 97, - CV_SH_XFpR2 = 98, - CV_SH_XFpR3 = 99, - CV_SH_XFpR4 = 100, - CV_SH_XFpR5 = 101, - CV_SH_XFpR6 = 102, - CV_SH_XFpR7 = 103, - CV_SH_XFpR8 = 104, - CV_SH_XFpR9 = 105, - CV_SH_XFpR10 = 106, - CV_SH_XFpR11 = 107, - CV_SH_XFpR12 = 108, - CV_SH_XFpR13 = 109, - CV_SH_XFpR14 = 110, - CV_SH_XFpR15 = 111, - - // - // Register set for the ARM processor. - // - - CV_ARM_NOREG = CV_REG_NONE, - - CV_ARM_R0 = 10, - CV_ARM_R1 = 11, - CV_ARM_R2 = 12, - CV_ARM_R3 = 13, - CV_ARM_R4 = 14, - CV_ARM_R5 = 15, - CV_ARM_R6 = 16, - CV_ARM_R7 = 17, - CV_ARM_R8 = 18, - CV_ARM_R9 = 19, - CV_ARM_R10 = 20, - CV_ARM_R11 = 21, // Frame pointer, if allocated - CV_ARM_R12 = 22, - CV_ARM_SP = 23, // Stack pointer - CV_ARM_LR = 24, // Link Register - CV_ARM_PC = 25, // Program counter - CV_ARM_CPSR = 26, // Current program status register - - CV_ARM_ACC0 = 27, // DSP co-processor 0 40 bit accumulator - - // - // Registers for ARM VFP10 support - // - - CV_ARM_FPSCR = 40, - CV_ARM_FPEXC = 41, - - CV_ARM_FS0 = 50, - CV_ARM_FS1 = 51, - CV_ARM_FS2 = 52, - CV_ARM_FS3 = 53, - CV_ARM_FS4 = 54, - CV_ARM_FS5 = 55, - CV_ARM_FS6 = 56, - CV_ARM_FS7 = 57, - CV_ARM_FS8 = 58, - CV_ARM_FS9 = 59, - CV_ARM_FS10 = 60, - CV_ARM_FS11 = 61, - CV_ARM_FS12 = 62, - CV_ARM_FS13 = 63, - CV_ARM_FS14 = 64, - CV_ARM_FS15 = 65, - CV_ARM_FS16 = 66, - CV_ARM_FS17 = 67, - CV_ARM_FS18 = 68, - CV_ARM_FS19 = 69, - CV_ARM_FS20 = 70, - CV_ARM_FS21 = 71, - CV_ARM_FS22 = 72, - CV_ARM_FS23 = 73, - CV_ARM_FS24 = 74, - CV_ARM_FS25 = 75, - CV_ARM_FS26 = 76, - CV_ARM_FS27 = 77, - CV_ARM_FS28 = 78, - CV_ARM_FS29 = 79, - CV_ARM_FS30 = 80, - CV_ARM_FS31 = 81, - - // - // ARM VFP Floating Point Extra control registers - // - - CV_ARM_FPEXTRA0 = 90, - CV_ARM_FPEXTRA1 = 91, - CV_ARM_FPEXTRA2 = 92, - CV_ARM_FPEXTRA3 = 93, - CV_ARM_FPEXTRA4 = 94, - CV_ARM_FPEXTRA5 = 95, - CV_ARM_FPEXTRA6 = 96, - CV_ARM_FPEXTRA7 = 97, - - // XSCALE Concan co-processor registers - CV_ARM_WR0 = 128, - CV_ARM_WR1 = 129, - CV_ARM_WR2 = 130, - CV_ARM_WR3 = 131, - CV_ARM_WR4 = 132, - CV_ARM_WR5 = 133, - CV_ARM_WR6 = 134, - CV_ARM_WR7 = 135, - CV_ARM_WR8 = 136, - CV_ARM_WR9 = 137, - CV_ARM_WR10 = 138, - CV_ARM_WR11 = 139, - CV_ARM_WR12 = 140, - CV_ARM_WR13 = 141, - CV_ARM_WR14 = 142, - CV_ARM_WR15 = 143, - - // XSCALE Concan co-processor control registers - CV_ARM_WCID = 144, - CV_ARM_WCON = 145, - CV_ARM_WCSSF = 146, - CV_ARM_WCASF = 147, - CV_ARM_WC4 = 148, - CV_ARM_WC5 = 149, - CV_ARM_WC6 = 150, - CV_ARM_WC7 = 151, - CV_ARM_WCGR0 = 152, - CV_ARM_WCGR1 = 153, - CV_ARM_WCGR2 = 154, - CV_ARM_WCGR3 = 155, - CV_ARM_WC12 = 156, - CV_ARM_WC13 = 157, - CV_ARM_WC14 = 158, - CV_ARM_WC15 = 159, - - // - // ARM VFPv3/Neon extended floating Point - // - - CV_ARM_FS32 = 200, - CV_ARM_FS33 = 201, - CV_ARM_FS34 = 202, - CV_ARM_FS35 = 203, - CV_ARM_FS36 = 204, - CV_ARM_FS37 = 205, - CV_ARM_FS38 = 206, - CV_ARM_FS39 = 207, - CV_ARM_FS40 = 208, - CV_ARM_FS41 = 209, - CV_ARM_FS42 = 210, - CV_ARM_FS43 = 211, - CV_ARM_FS44 = 212, - CV_ARM_FS45 = 213, - CV_ARM_FS46 = 214, - CV_ARM_FS47 = 215, - CV_ARM_FS48 = 216, - CV_ARM_FS49 = 217, - CV_ARM_FS50 = 218, - CV_ARM_FS51 = 219, - CV_ARM_FS52 = 220, - CV_ARM_FS53 = 221, - CV_ARM_FS54 = 222, - CV_ARM_FS55 = 223, - CV_ARM_FS56 = 224, - CV_ARM_FS57 = 225, - CV_ARM_FS58 = 226, - CV_ARM_FS59 = 227, - CV_ARM_FS60 = 228, - CV_ARM_FS61 = 229, - CV_ARM_FS62 = 230, - CV_ARM_FS63 = 231, - - // ARM double-precision floating point - - CV_ARM_ND0 = 300, - CV_ARM_ND1 = 301, - CV_ARM_ND2 = 302, - CV_ARM_ND3 = 303, - CV_ARM_ND4 = 304, - CV_ARM_ND5 = 305, - CV_ARM_ND6 = 306, - CV_ARM_ND7 = 307, - CV_ARM_ND8 = 308, - CV_ARM_ND9 = 309, - CV_ARM_ND10 = 310, - CV_ARM_ND11 = 311, - CV_ARM_ND12 = 312, - CV_ARM_ND13 = 313, - CV_ARM_ND14 = 314, - CV_ARM_ND15 = 315, - CV_ARM_ND16 = 316, - CV_ARM_ND17 = 317, - CV_ARM_ND18 = 318, - CV_ARM_ND19 = 319, - CV_ARM_ND20 = 320, - CV_ARM_ND21 = 321, - CV_ARM_ND22 = 322, - CV_ARM_ND23 = 323, - CV_ARM_ND24 = 324, - CV_ARM_ND25 = 325, - CV_ARM_ND26 = 326, - CV_ARM_ND27 = 327, - CV_ARM_ND28 = 328, - CV_ARM_ND29 = 329, - CV_ARM_ND30 = 330, - CV_ARM_ND31 = 331, - - // ARM extended precision floating point - - CV_ARM_NQ0 = 400, - CV_ARM_NQ1 = 401, - CV_ARM_NQ2 = 402, - CV_ARM_NQ3 = 403, - CV_ARM_NQ4 = 404, - CV_ARM_NQ5 = 405, - CV_ARM_NQ6 = 406, - CV_ARM_NQ7 = 407, - CV_ARM_NQ8 = 408, - CV_ARM_NQ9 = 409, - CV_ARM_NQ10 = 410, - CV_ARM_NQ11 = 411, - CV_ARM_NQ12 = 412, - CV_ARM_NQ13 = 413, - CV_ARM_NQ14 = 414, - CV_ARM_NQ15 = 415, - - // - // Register set for ARM64 - // - - CV_ARM64_NOREG = CV_REG_NONE, - - // General purpose 32-bit integer registers - - CV_ARM64_W0 = 10, - CV_ARM64_W1 = 11, - CV_ARM64_W2 = 12, - CV_ARM64_W3 = 13, - CV_ARM64_W4 = 14, - CV_ARM64_W5 = 15, - CV_ARM64_W6 = 16, - CV_ARM64_W7 = 17, - CV_ARM64_W8 = 18, - CV_ARM64_W9 = 19, - CV_ARM64_W10 = 20, - CV_ARM64_W11 = 21, - CV_ARM64_W12 = 22, - CV_ARM64_W13 = 23, - CV_ARM64_W14 = 24, - CV_ARM64_W15 = 25, - CV_ARM64_W16 = 26, - CV_ARM64_W17 = 27, - CV_ARM64_W18 = 28, - CV_ARM64_W19 = 29, - CV_ARM64_W20 = 30, - CV_ARM64_W21 = 31, - CV_ARM64_W22 = 32, - CV_ARM64_W23 = 33, - CV_ARM64_W24 = 34, - CV_ARM64_W25 = 35, - CV_ARM64_W26 = 36, - CV_ARM64_W27 = 37, - CV_ARM64_W28 = 38, - CV_ARM64_W29 = 39, - CV_ARM64_W30 = 40, - CV_ARM64_WZR = 41, - - // General purpose 64-bit integer registers - - CV_ARM64_X0 = 50, - CV_ARM64_X1 = 51, - CV_ARM64_X2 = 52, - CV_ARM64_X3 = 53, - CV_ARM64_X4 = 54, - CV_ARM64_X5 = 55, - CV_ARM64_X6 = 56, - CV_ARM64_X7 = 57, - CV_ARM64_X8 = 58, - CV_ARM64_X9 = 59, - CV_ARM64_X10 = 60, - CV_ARM64_X11 = 61, - CV_ARM64_X12 = 62, - CV_ARM64_X13 = 63, - CV_ARM64_X14 = 64, - CV_ARM64_X15 = 65, - CV_ARM64_IP0 = 66, - CV_ARM64_IP1 = 67, - CV_ARM64_X18 = 68, - CV_ARM64_X19 = 69, - CV_ARM64_X20 = 70, - CV_ARM64_X21 = 71, - CV_ARM64_X22 = 72, - CV_ARM64_X23 = 73, - CV_ARM64_X24 = 74, - CV_ARM64_X25 = 75, - CV_ARM64_X26 = 76, - CV_ARM64_X27 = 77, - CV_ARM64_X28 = 78, - CV_ARM64_FP = 79, - CV_ARM64_LR = 80, - CV_ARM64_SP = 81, - CV_ARM64_ZR = 82, - CV_ARM64_PC = 83, - - // status registers - - CV_ARM64_NZCV = 90, - CV_ARM64_CPSR = 91, - - // 32-bit floating point registers - - CV_ARM64_S0 = 100, - CV_ARM64_S1 = 101, - CV_ARM64_S2 = 102, - CV_ARM64_S3 = 103, - CV_ARM64_S4 = 104, - CV_ARM64_S5 = 105, - CV_ARM64_S6 = 106, - CV_ARM64_S7 = 107, - CV_ARM64_S8 = 108, - CV_ARM64_S9 = 109, - CV_ARM64_S10 = 110, - CV_ARM64_S11 = 111, - CV_ARM64_S12 = 112, - CV_ARM64_S13 = 113, - CV_ARM64_S14 = 114, - CV_ARM64_S15 = 115, - CV_ARM64_S16 = 116, - CV_ARM64_S17 = 117, - CV_ARM64_S18 = 118, - CV_ARM64_S19 = 119, - CV_ARM64_S20 = 120, - CV_ARM64_S21 = 121, - CV_ARM64_S22 = 122, - CV_ARM64_S23 = 123, - CV_ARM64_S24 = 124, - CV_ARM64_S25 = 125, - CV_ARM64_S26 = 126, - CV_ARM64_S27 = 127, - CV_ARM64_S28 = 128, - CV_ARM64_S29 = 129, - CV_ARM64_S30 = 130, - CV_ARM64_S31 = 131, - - // 64-bit floating point registers - - CV_ARM64_D0 = 140, - CV_ARM64_D1 = 141, - CV_ARM64_D2 = 142, - CV_ARM64_D3 = 143, - CV_ARM64_D4 = 144, - CV_ARM64_D5 = 145, - CV_ARM64_D6 = 146, - CV_ARM64_D7 = 147, - CV_ARM64_D8 = 148, - CV_ARM64_D9 = 149, - CV_ARM64_D10 = 150, - CV_ARM64_D11 = 151, - CV_ARM64_D12 = 152, - CV_ARM64_D13 = 153, - CV_ARM64_D14 = 154, - CV_ARM64_D15 = 155, - CV_ARM64_D16 = 156, - CV_ARM64_D17 = 157, - CV_ARM64_D18 = 158, - CV_ARM64_D19 = 159, - CV_ARM64_D20 = 160, - CV_ARM64_D21 = 161, - CV_ARM64_D22 = 162, - CV_ARM64_D23 = 163, - CV_ARM64_D24 = 164, - CV_ARM64_D25 = 165, - CV_ARM64_D26 = 166, - CV_ARM64_D27 = 167, - CV_ARM64_D28 = 168, - CV_ARM64_D29 = 169, - CV_ARM64_D30 = 170, - CV_ARM64_D31 = 171, - - // 128-bit SIMD registers - - CV_ARM64_Q0 = 180, - CV_ARM64_Q1 = 181, - CV_ARM64_Q2 = 182, - CV_ARM64_Q3 = 183, - CV_ARM64_Q4 = 184, - CV_ARM64_Q5 = 185, - CV_ARM64_Q6 = 186, - CV_ARM64_Q7 = 187, - CV_ARM64_Q8 = 188, - CV_ARM64_Q9 = 189, - CV_ARM64_Q10 = 190, - CV_ARM64_Q11 = 191, - CV_ARM64_Q12 = 192, - CV_ARM64_Q13 = 193, - CV_ARM64_Q14 = 194, - CV_ARM64_Q15 = 195, - CV_ARM64_Q16 = 196, - CV_ARM64_Q17 = 197, - CV_ARM64_Q18 = 198, - CV_ARM64_Q19 = 199, - CV_ARM64_Q20 = 200, - CV_ARM64_Q21 = 201, - CV_ARM64_Q22 = 202, - CV_ARM64_Q23 = 203, - CV_ARM64_Q24 = 204, - CV_ARM64_Q25 = 205, - CV_ARM64_Q26 = 206, - CV_ARM64_Q27 = 207, - CV_ARM64_Q28 = 208, - CV_ARM64_Q29 = 209, - CV_ARM64_Q30 = 210, - CV_ARM64_Q31 = 211, - - // Floating point status register - - CV_ARM64_FPSR = 220, - - // - // Register set for Intel IA64 - // - - CV_IA64_NOREG = CV_REG_NONE, - - // Branch Registers - - CV_IA64_Br0 = 512, - CV_IA64_Br1 = 513, - CV_IA64_Br2 = 514, - CV_IA64_Br3 = 515, - CV_IA64_Br4 = 516, - CV_IA64_Br5 = 517, - CV_IA64_Br6 = 518, - CV_IA64_Br7 = 519, - - // Predicate Registers - - CV_IA64_P0 = 704, - CV_IA64_P1 = 705, - CV_IA64_P2 = 706, - CV_IA64_P3 = 707, - CV_IA64_P4 = 708, - CV_IA64_P5 = 709, - CV_IA64_P6 = 710, - CV_IA64_P7 = 711, - CV_IA64_P8 = 712, - CV_IA64_P9 = 713, - CV_IA64_P10 = 714, - CV_IA64_P11 = 715, - CV_IA64_P12 = 716, - CV_IA64_P13 = 717, - CV_IA64_P14 = 718, - CV_IA64_P15 = 719, - CV_IA64_P16 = 720, - CV_IA64_P17 = 721, - CV_IA64_P18 = 722, - CV_IA64_P19 = 723, - CV_IA64_P20 = 724, - CV_IA64_P21 = 725, - CV_IA64_P22 = 726, - CV_IA64_P23 = 727, - CV_IA64_P24 = 728, - CV_IA64_P25 = 729, - CV_IA64_P26 = 730, - CV_IA64_P27 = 731, - CV_IA64_P28 = 732, - CV_IA64_P29 = 733, - CV_IA64_P30 = 734, - CV_IA64_P31 = 735, - CV_IA64_P32 = 736, - CV_IA64_P33 = 737, - CV_IA64_P34 = 738, - CV_IA64_P35 = 739, - CV_IA64_P36 = 740, - CV_IA64_P37 = 741, - CV_IA64_P38 = 742, - CV_IA64_P39 = 743, - CV_IA64_P40 = 744, - CV_IA64_P41 = 745, - CV_IA64_P42 = 746, - CV_IA64_P43 = 747, - CV_IA64_P44 = 748, - CV_IA64_P45 = 749, - CV_IA64_P46 = 750, - CV_IA64_P47 = 751, - CV_IA64_P48 = 752, - CV_IA64_P49 = 753, - CV_IA64_P50 = 754, - CV_IA64_P51 = 755, - CV_IA64_P52 = 756, - CV_IA64_P53 = 757, - CV_IA64_P54 = 758, - CV_IA64_P55 = 759, - CV_IA64_P56 = 760, - CV_IA64_P57 = 761, - CV_IA64_P58 = 762, - CV_IA64_P59 = 763, - CV_IA64_P60 = 764, - CV_IA64_P61 = 765, - CV_IA64_P62 = 766, - CV_IA64_P63 = 767, - - CV_IA64_Preds = 768, - - // Banked General Registers - - CV_IA64_IntH0 = 832, - CV_IA64_IntH1 = 833, - CV_IA64_IntH2 = 834, - CV_IA64_IntH3 = 835, - CV_IA64_IntH4 = 836, - CV_IA64_IntH5 = 837, - CV_IA64_IntH6 = 838, - CV_IA64_IntH7 = 839, - CV_IA64_IntH8 = 840, - CV_IA64_IntH9 = 841, - CV_IA64_IntH10 = 842, - CV_IA64_IntH11 = 843, - CV_IA64_IntH12 = 844, - CV_IA64_IntH13 = 845, - CV_IA64_IntH14 = 846, - CV_IA64_IntH15 = 847, - - // Special Registers - - CV_IA64_Ip = 1016, - CV_IA64_Umask = 1017, - CV_IA64_Cfm = 1018, - CV_IA64_Psr = 1019, - - // Banked General Registers - - CV_IA64_Nats = 1020, - CV_IA64_Nats2 = 1021, - CV_IA64_Nats3 = 1022, - - // General-Purpose Registers - - // Integer registers - CV_IA64_IntR0 = 1024, - CV_IA64_IntR1 = 1025, - CV_IA64_IntR2 = 1026, - CV_IA64_IntR3 = 1027, - CV_IA64_IntR4 = 1028, - CV_IA64_IntR5 = 1029, - CV_IA64_IntR6 = 1030, - CV_IA64_IntR7 = 1031, - CV_IA64_IntR8 = 1032, - CV_IA64_IntR9 = 1033, - CV_IA64_IntR10 = 1034, - CV_IA64_IntR11 = 1035, - CV_IA64_IntR12 = 1036, - CV_IA64_IntR13 = 1037, - CV_IA64_IntR14 = 1038, - CV_IA64_IntR15 = 1039, - CV_IA64_IntR16 = 1040, - CV_IA64_IntR17 = 1041, - CV_IA64_IntR18 = 1042, - CV_IA64_IntR19 = 1043, - CV_IA64_IntR20 = 1044, - CV_IA64_IntR21 = 1045, - CV_IA64_IntR22 = 1046, - CV_IA64_IntR23 = 1047, - CV_IA64_IntR24 = 1048, - CV_IA64_IntR25 = 1049, - CV_IA64_IntR26 = 1050, - CV_IA64_IntR27 = 1051, - CV_IA64_IntR28 = 1052, - CV_IA64_IntR29 = 1053, - CV_IA64_IntR30 = 1054, - CV_IA64_IntR31 = 1055, - - // Register Stack - CV_IA64_IntR32 = 1056, - CV_IA64_IntR33 = 1057, - CV_IA64_IntR34 = 1058, - CV_IA64_IntR35 = 1059, - CV_IA64_IntR36 = 1060, - CV_IA64_IntR37 = 1061, - CV_IA64_IntR38 = 1062, - CV_IA64_IntR39 = 1063, - CV_IA64_IntR40 = 1064, - CV_IA64_IntR41 = 1065, - CV_IA64_IntR42 = 1066, - CV_IA64_IntR43 = 1067, - CV_IA64_IntR44 = 1068, - CV_IA64_IntR45 = 1069, - CV_IA64_IntR46 = 1070, - CV_IA64_IntR47 = 1071, - CV_IA64_IntR48 = 1072, - CV_IA64_IntR49 = 1073, - CV_IA64_IntR50 = 1074, - CV_IA64_IntR51 = 1075, - CV_IA64_IntR52 = 1076, - CV_IA64_IntR53 = 1077, - CV_IA64_IntR54 = 1078, - CV_IA64_IntR55 = 1079, - CV_IA64_IntR56 = 1080, - CV_IA64_IntR57 = 1081, - CV_IA64_IntR58 = 1082, - CV_IA64_IntR59 = 1083, - CV_IA64_IntR60 = 1084, - CV_IA64_IntR61 = 1085, - CV_IA64_IntR62 = 1086, - CV_IA64_IntR63 = 1087, - CV_IA64_IntR64 = 1088, - CV_IA64_IntR65 = 1089, - CV_IA64_IntR66 = 1090, - CV_IA64_IntR67 = 1091, - CV_IA64_IntR68 = 1092, - CV_IA64_IntR69 = 1093, - CV_IA64_IntR70 = 1094, - CV_IA64_IntR71 = 1095, - CV_IA64_IntR72 = 1096, - CV_IA64_IntR73 = 1097, - CV_IA64_IntR74 = 1098, - CV_IA64_IntR75 = 1099, - CV_IA64_IntR76 = 1100, - CV_IA64_IntR77 = 1101, - CV_IA64_IntR78 = 1102, - CV_IA64_IntR79 = 1103, - CV_IA64_IntR80 = 1104, - CV_IA64_IntR81 = 1105, - CV_IA64_IntR82 = 1106, - CV_IA64_IntR83 = 1107, - CV_IA64_IntR84 = 1108, - CV_IA64_IntR85 = 1109, - CV_IA64_IntR86 = 1110, - CV_IA64_IntR87 = 1111, - CV_IA64_IntR88 = 1112, - CV_IA64_IntR89 = 1113, - CV_IA64_IntR90 = 1114, - CV_IA64_IntR91 = 1115, - CV_IA64_IntR92 = 1116, - CV_IA64_IntR93 = 1117, - CV_IA64_IntR94 = 1118, - CV_IA64_IntR95 = 1119, - CV_IA64_IntR96 = 1120, - CV_IA64_IntR97 = 1121, - CV_IA64_IntR98 = 1122, - CV_IA64_IntR99 = 1123, - CV_IA64_IntR100 = 1124, - CV_IA64_IntR101 = 1125, - CV_IA64_IntR102 = 1126, - CV_IA64_IntR103 = 1127, - CV_IA64_IntR104 = 1128, - CV_IA64_IntR105 = 1129, - CV_IA64_IntR106 = 1130, - CV_IA64_IntR107 = 1131, - CV_IA64_IntR108 = 1132, - CV_IA64_IntR109 = 1133, - CV_IA64_IntR110 = 1134, - CV_IA64_IntR111 = 1135, - CV_IA64_IntR112 = 1136, - CV_IA64_IntR113 = 1137, - CV_IA64_IntR114 = 1138, - CV_IA64_IntR115 = 1139, - CV_IA64_IntR116 = 1140, - CV_IA64_IntR117 = 1141, - CV_IA64_IntR118 = 1142, - CV_IA64_IntR119 = 1143, - CV_IA64_IntR120 = 1144, - CV_IA64_IntR121 = 1145, - CV_IA64_IntR122 = 1146, - CV_IA64_IntR123 = 1147, - CV_IA64_IntR124 = 1148, - CV_IA64_IntR125 = 1149, - CV_IA64_IntR126 = 1150, - CV_IA64_IntR127 = 1151, - - // Floating-Point Registers - - // Low Floating Point Registers - CV_IA64_FltF0 = 2048, - CV_IA64_FltF1 = 2049, - CV_IA64_FltF2 = 2050, - CV_IA64_FltF3 = 2051, - CV_IA64_FltF4 = 2052, - CV_IA64_FltF5 = 2053, - CV_IA64_FltF6 = 2054, - CV_IA64_FltF7 = 2055, - CV_IA64_FltF8 = 2056, - CV_IA64_FltF9 = 2057, - CV_IA64_FltF10 = 2058, - CV_IA64_FltF11 = 2059, - CV_IA64_FltF12 = 2060, - CV_IA64_FltF13 = 2061, - CV_IA64_FltF14 = 2062, - CV_IA64_FltF15 = 2063, - CV_IA64_FltF16 = 2064, - CV_IA64_FltF17 = 2065, - CV_IA64_FltF18 = 2066, - CV_IA64_FltF19 = 2067, - CV_IA64_FltF20 = 2068, - CV_IA64_FltF21 = 2069, - CV_IA64_FltF22 = 2070, - CV_IA64_FltF23 = 2071, - CV_IA64_FltF24 = 2072, - CV_IA64_FltF25 = 2073, - CV_IA64_FltF26 = 2074, - CV_IA64_FltF27 = 2075, - CV_IA64_FltF28 = 2076, - CV_IA64_FltF29 = 2077, - CV_IA64_FltF30 = 2078, - CV_IA64_FltF31 = 2079, - - // High Floating Point Registers - CV_IA64_FltF32 = 2080, - CV_IA64_FltF33 = 2081, - CV_IA64_FltF34 = 2082, - CV_IA64_FltF35 = 2083, - CV_IA64_FltF36 = 2084, - CV_IA64_FltF37 = 2085, - CV_IA64_FltF38 = 2086, - CV_IA64_FltF39 = 2087, - CV_IA64_FltF40 = 2088, - CV_IA64_FltF41 = 2089, - CV_IA64_FltF42 = 2090, - CV_IA64_FltF43 = 2091, - CV_IA64_FltF44 = 2092, - CV_IA64_FltF45 = 2093, - CV_IA64_FltF46 = 2094, - CV_IA64_FltF47 = 2095, - CV_IA64_FltF48 = 2096, - CV_IA64_FltF49 = 2097, - CV_IA64_FltF50 = 2098, - CV_IA64_FltF51 = 2099, - CV_IA64_FltF52 = 2100, - CV_IA64_FltF53 = 2101, - CV_IA64_FltF54 = 2102, - CV_IA64_FltF55 = 2103, - CV_IA64_FltF56 = 2104, - CV_IA64_FltF57 = 2105, - CV_IA64_FltF58 = 2106, - CV_IA64_FltF59 = 2107, - CV_IA64_FltF60 = 2108, - CV_IA64_FltF61 = 2109, - CV_IA64_FltF62 = 2110, - CV_IA64_FltF63 = 2111, - CV_IA64_FltF64 = 2112, - CV_IA64_FltF65 = 2113, - CV_IA64_FltF66 = 2114, - CV_IA64_FltF67 = 2115, - CV_IA64_FltF68 = 2116, - CV_IA64_FltF69 = 2117, - CV_IA64_FltF70 = 2118, - CV_IA64_FltF71 = 2119, - CV_IA64_FltF72 = 2120, - CV_IA64_FltF73 = 2121, - CV_IA64_FltF74 = 2122, - CV_IA64_FltF75 = 2123, - CV_IA64_FltF76 = 2124, - CV_IA64_FltF77 = 2125, - CV_IA64_FltF78 = 2126, - CV_IA64_FltF79 = 2127, - CV_IA64_FltF80 = 2128, - CV_IA64_FltF81 = 2129, - CV_IA64_FltF82 = 2130, - CV_IA64_FltF83 = 2131, - CV_IA64_FltF84 = 2132, - CV_IA64_FltF85 = 2133, - CV_IA64_FltF86 = 2134, - CV_IA64_FltF87 = 2135, - CV_IA64_FltF88 = 2136, - CV_IA64_FltF89 = 2137, - CV_IA64_FltF90 = 2138, - CV_IA64_FltF91 = 2139, - CV_IA64_FltF92 = 2140, - CV_IA64_FltF93 = 2141, - CV_IA64_FltF94 = 2142, - CV_IA64_FltF95 = 2143, - CV_IA64_FltF96 = 2144, - CV_IA64_FltF97 = 2145, - CV_IA64_FltF98 = 2146, - CV_IA64_FltF99 = 2147, - CV_IA64_FltF100 = 2148, - CV_IA64_FltF101 = 2149, - CV_IA64_FltF102 = 2150, - CV_IA64_FltF103 = 2151, - CV_IA64_FltF104 = 2152, - CV_IA64_FltF105 = 2153, - CV_IA64_FltF106 = 2154, - CV_IA64_FltF107 = 2155, - CV_IA64_FltF108 = 2156, - CV_IA64_FltF109 = 2157, - CV_IA64_FltF110 = 2158, - CV_IA64_FltF111 = 2159, - CV_IA64_FltF112 = 2160, - CV_IA64_FltF113 = 2161, - CV_IA64_FltF114 = 2162, - CV_IA64_FltF115 = 2163, - CV_IA64_FltF116 = 2164, - CV_IA64_FltF117 = 2165, - CV_IA64_FltF118 = 2166, - CV_IA64_FltF119 = 2167, - CV_IA64_FltF120 = 2168, - CV_IA64_FltF121 = 2169, - CV_IA64_FltF122 = 2170, - CV_IA64_FltF123 = 2171, - CV_IA64_FltF124 = 2172, - CV_IA64_FltF125 = 2173, - CV_IA64_FltF126 = 2174, - CV_IA64_FltF127 = 2175, - - // Application Registers - - CV_IA64_ApKR0 = 3072, - CV_IA64_ApKR1 = 3073, - CV_IA64_ApKR2 = 3074, - CV_IA64_ApKR3 = 3075, - CV_IA64_ApKR4 = 3076, - CV_IA64_ApKR5 = 3077, - CV_IA64_ApKR6 = 3078, - CV_IA64_ApKR7 = 3079, - CV_IA64_AR8 = 3080, - CV_IA64_AR9 = 3081, - CV_IA64_AR10 = 3082, - CV_IA64_AR11 = 3083, - CV_IA64_AR12 = 3084, - CV_IA64_AR13 = 3085, - CV_IA64_AR14 = 3086, - CV_IA64_AR15 = 3087, - CV_IA64_RsRSC = 3088, - CV_IA64_RsBSP = 3089, - CV_IA64_RsBSPSTORE = 3090, - CV_IA64_RsRNAT = 3091, - CV_IA64_AR20 = 3092, - CV_IA64_StFCR = 3093, - CV_IA64_AR22 = 3094, - CV_IA64_AR23 = 3095, - CV_IA64_EFLAG = 3096, - CV_IA64_CSD = 3097, - CV_IA64_SSD = 3098, - CV_IA64_CFLG = 3099, - CV_IA64_StFSR = 3100, - CV_IA64_StFIR = 3101, - CV_IA64_StFDR = 3102, - CV_IA64_AR31 = 3103, - CV_IA64_ApCCV = 3104, - CV_IA64_AR33 = 3105, - CV_IA64_AR34 = 3106, - CV_IA64_AR35 = 3107, - CV_IA64_ApUNAT = 3108, - CV_IA64_AR37 = 3109, - CV_IA64_AR38 = 3110, - CV_IA64_AR39 = 3111, - CV_IA64_StFPSR = 3112, - CV_IA64_AR41 = 3113, - CV_IA64_AR42 = 3114, - CV_IA64_AR43 = 3115, - CV_IA64_ApITC = 3116, - CV_IA64_AR45 = 3117, - CV_IA64_AR46 = 3118, - CV_IA64_AR47 = 3119, - CV_IA64_AR48 = 3120, - CV_IA64_AR49 = 3121, - CV_IA64_AR50 = 3122, - CV_IA64_AR51 = 3123, - CV_IA64_AR52 = 3124, - CV_IA64_AR53 = 3125, - CV_IA64_AR54 = 3126, - CV_IA64_AR55 = 3127, - CV_IA64_AR56 = 3128, - CV_IA64_AR57 = 3129, - CV_IA64_AR58 = 3130, - CV_IA64_AR59 = 3131, - CV_IA64_AR60 = 3132, - CV_IA64_AR61 = 3133, - CV_IA64_AR62 = 3134, - CV_IA64_AR63 = 3135, - CV_IA64_RsPFS = 3136, - CV_IA64_ApLC = 3137, - CV_IA64_ApEC = 3138, - CV_IA64_AR67 = 3139, - CV_IA64_AR68 = 3140, - CV_IA64_AR69 = 3141, - CV_IA64_AR70 = 3142, - CV_IA64_AR71 = 3143, - CV_IA64_AR72 = 3144, - CV_IA64_AR73 = 3145, - CV_IA64_AR74 = 3146, - CV_IA64_AR75 = 3147, - CV_IA64_AR76 = 3148, - CV_IA64_AR77 = 3149, - CV_IA64_AR78 = 3150, - CV_IA64_AR79 = 3151, - CV_IA64_AR80 = 3152, - CV_IA64_AR81 = 3153, - CV_IA64_AR82 = 3154, - CV_IA64_AR83 = 3155, - CV_IA64_AR84 = 3156, - CV_IA64_AR85 = 3157, - CV_IA64_AR86 = 3158, - CV_IA64_AR87 = 3159, - CV_IA64_AR88 = 3160, - CV_IA64_AR89 = 3161, - CV_IA64_AR90 = 3162, - CV_IA64_AR91 = 3163, - CV_IA64_AR92 = 3164, - CV_IA64_AR93 = 3165, - CV_IA64_AR94 = 3166, - CV_IA64_AR95 = 3167, - CV_IA64_AR96 = 3168, - CV_IA64_AR97 = 3169, - CV_IA64_AR98 = 3170, - CV_IA64_AR99 = 3171, - CV_IA64_AR100 = 3172, - CV_IA64_AR101 = 3173, - CV_IA64_AR102 = 3174, - CV_IA64_AR103 = 3175, - CV_IA64_AR104 = 3176, - CV_IA64_AR105 = 3177, - CV_IA64_AR106 = 3178, - CV_IA64_AR107 = 3179, - CV_IA64_AR108 = 3180, - CV_IA64_AR109 = 3181, - CV_IA64_AR110 = 3182, - CV_IA64_AR111 = 3183, - CV_IA64_AR112 = 3184, - CV_IA64_AR113 = 3185, - CV_IA64_AR114 = 3186, - CV_IA64_AR115 = 3187, - CV_IA64_AR116 = 3188, - CV_IA64_AR117 = 3189, - CV_IA64_AR118 = 3190, - CV_IA64_AR119 = 3191, - CV_IA64_AR120 = 3192, - CV_IA64_AR121 = 3193, - CV_IA64_AR122 = 3194, - CV_IA64_AR123 = 3195, - CV_IA64_AR124 = 3196, - CV_IA64_AR125 = 3197, - CV_IA64_AR126 = 3198, - CV_IA64_AR127 = 3199, - - // CPUID Registers - - CV_IA64_CPUID0 = 3328, - CV_IA64_CPUID1 = 3329, - CV_IA64_CPUID2 = 3330, - CV_IA64_CPUID3 = 3331, - CV_IA64_CPUID4 = 3332, - - // Control Registers - - CV_IA64_ApDCR = 4096, - CV_IA64_ApITM = 4097, - CV_IA64_ApIVA = 4098, - CV_IA64_CR3 = 4099, - CV_IA64_CR4 = 4100, - CV_IA64_CR5 = 4101, - CV_IA64_CR6 = 4102, - CV_IA64_CR7 = 4103, - CV_IA64_ApPTA = 4104, - CV_IA64_ApGPTA = 4105, - CV_IA64_CR10 = 4106, - CV_IA64_CR11 = 4107, - CV_IA64_CR12 = 4108, - CV_IA64_CR13 = 4109, - CV_IA64_CR14 = 4110, - CV_IA64_CR15 = 4111, - CV_IA64_StIPSR = 4112, - CV_IA64_StISR = 4113, - CV_IA64_CR18 = 4114, - CV_IA64_StIIP = 4115, - CV_IA64_StIFA = 4116, - CV_IA64_StITIR = 4117, - CV_IA64_StIIPA = 4118, - CV_IA64_StIFS = 4119, - CV_IA64_StIIM = 4120, - CV_IA64_StIHA = 4121, - CV_IA64_CR26 = 4122, - CV_IA64_CR27 = 4123, - CV_IA64_CR28 = 4124, - CV_IA64_CR29 = 4125, - CV_IA64_CR30 = 4126, - CV_IA64_CR31 = 4127, - CV_IA64_CR32 = 4128, - CV_IA64_CR33 = 4129, - CV_IA64_CR34 = 4130, - CV_IA64_CR35 = 4131, - CV_IA64_CR36 = 4132, - CV_IA64_CR37 = 4133, - CV_IA64_CR38 = 4134, - CV_IA64_CR39 = 4135, - CV_IA64_CR40 = 4136, - CV_IA64_CR41 = 4137, - CV_IA64_CR42 = 4138, - CV_IA64_CR43 = 4139, - CV_IA64_CR44 = 4140, - CV_IA64_CR45 = 4141, - CV_IA64_CR46 = 4142, - CV_IA64_CR47 = 4143, - CV_IA64_CR48 = 4144, - CV_IA64_CR49 = 4145, - CV_IA64_CR50 = 4146, - CV_IA64_CR51 = 4147, - CV_IA64_CR52 = 4148, - CV_IA64_CR53 = 4149, - CV_IA64_CR54 = 4150, - CV_IA64_CR55 = 4151, - CV_IA64_CR56 = 4152, - CV_IA64_CR57 = 4153, - CV_IA64_CR58 = 4154, - CV_IA64_CR59 = 4155, - CV_IA64_CR60 = 4156, - CV_IA64_CR61 = 4157, - CV_IA64_CR62 = 4158, - CV_IA64_CR63 = 4159, - CV_IA64_SaLID = 4160, - CV_IA64_SaIVR = 4161, - CV_IA64_SaTPR = 4162, - CV_IA64_SaEOI = 4163, - CV_IA64_SaIRR0 = 4164, - CV_IA64_SaIRR1 = 4165, - CV_IA64_SaIRR2 = 4166, - CV_IA64_SaIRR3 = 4167, - CV_IA64_SaITV = 4168, - CV_IA64_SaPMV = 4169, - CV_IA64_SaCMCV = 4170, - CV_IA64_CR75 = 4171, - CV_IA64_CR76 = 4172, - CV_IA64_CR77 = 4173, - CV_IA64_CR78 = 4174, - CV_IA64_CR79 = 4175, - CV_IA64_SaLRR0 = 4176, - CV_IA64_SaLRR1 = 4177, - CV_IA64_CR82 = 4178, - CV_IA64_CR83 = 4179, - CV_IA64_CR84 = 4180, - CV_IA64_CR85 = 4181, - CV_IA64_CR86 = 4182, - CV_IA64_CR87 = 4183, - CV_IA64_CR88 = 4184, - CV_IA64_CR89 = 4185, - CV_IA64_CR90 = 4186, - CV_IA64_CR91 = 4187, - CV_IA64_CR92 = 4188, - CV_IA64_CR93 = 4189, - CV_IA64_CR94 = 4190, - CV_IA64_CR95 = 4191, - CV_IA64_CR96 = 4192, - CV_IA64_CR97 = 4193, - CV_IA64_CR98 = 4194, - CV_IA64_CR99 = 4195, - CV_IA64_CR100 = 4196, - CV_IA64_CR101 = 4197, - CV_IA64_CR102 = 4198, - CV_IA64_CR103 = 4199, - CV_IA64_CR104 = 4200, - CV_IA64_CR105 = 4201, - CV_IA64_CR106 = 4202, - CV_IA64_CR107 = 4203, - CV_IA64_CR108 = 4204, - CV_IA64_CR109 = 4205, - CV_IA64_CR110 = 4206, - CV_IA64_CR111 = 4207, - CV_IA64_CR112 = 4208, - CV_IA64_CR113 = 4209, - CV_IA64_CR114 = 4210, - CV_IA64_CR115 = 4211, - CV_IA64_CR116 = 4212, - CV_IA64_CR117 = 4213, - CV_IA64_CR118 = 4214, - CV_IA64_CR119 = 4215, - CV_IA64_CR120 = 4216, - CV_IA64_CR121 = 4217, - CV_IA64_CR122 = 4218, - CV_IA64_CR123 = 4219, - CV_IA64_CR124 = 4220, - CV_IA64_CR125 = 4221, - CV_IA64_CR126 = 4222, - CV_IA64_CR127 = 4223, - - // Protection Key Registers - - CV_IA64_Pkr0 = 5120, - CV_IA64_Pkr1 = 5121, - CV_IA64_Pkr2 = 5122, - CV_IA64_Pkr3 = 5123, - CV_IA64_Pkr4 = 5124, - CV_IA64_Pkr5 = 5125, - CV_IA64_Pkr6 = 5126, - CV_IA64_Pkr7 = 5127, - CV_IA64_Pkr8 = 5128, - CV_IA64_Pkr9 = 5129, - CV_IA64_Pkr10 = 5130, - CV_IA64_Pkr11 = 5131, - CV_IA64_Pkr12 = 5132, - CV_IA64_Pkr13 = 5133, - CV_IA64_Pkr14 = 5134, - CV_IA64_Pkr15 = 5135, - - // Region Registers - - CV_IA64_Rr0 = 6144, - CV_IA64_Rr1 = 6145, - CV_IA64_Rr2 = 6146, - CV_IA64_Rr3 = 6147, - CV_IA64_Rr4 = 6148, - CV_IA64_Rr5 = 6149, - CV_IA64_Rr6 = 6150, - CV_IA64_Rr7 = 6151, - - // Performance Monitor Data Registers - - CV_IA64_PFD0 = 7168, - CV_IA64_PFD1 = 7169, - CV_IA64_PFD2 = 7170, - CV_IA64_PFD3 = 7171, - CV_IA64_PFD4 = 7172, - CV_IA64_PFD5 = 7173, - CV_IA64_PFD6 = 7174, - CV_IA64_PFD7 = 7175, - CV_IA64_PFD8 = 7176, - CV_IA64_PFD9 = 7177, - CV_IA64_PFD10 = 7178, - CV_IA64_PFD11 = 7179, - CV_IA64_PFD12 = 7180, - CV_IA64_PFD13 = 7181, - CV_IA64_PFD14 = 7182, - CV_IA64_PFD15 = 7183, - CV_IA64_PFD16 = 7184, - CV_IA64_PFD17 = 7185, - - // Performance Monitor Config Registers - - CV_IA64_PFC0 = 7424, - CV_IA64_PFC1 = 7425, - CV_IA64_PFC2 = 7426, - CV_IA64_PFC3 = 7427, - CV_IA64_PFC4 = 7428, - CV_IA64_PFC5 = 7429, - CV_IA64_PFC6 = 7430, - CV_IA64_PFC7 = 7431, - CV_IA64_PFC8 = 7432, - CV_IA64_PFC9 = 7433, - CV_IA64_PFC10 = 7434, - CV_IA64_PFC11 = 7435, - CV_IA64_PFC12 = 7436, - CV_IA64_PFC13 = 7437, - CV_IA64_PFC14 = 7438, - CV_IA64_PFC15 = 7439, - - // Instruction Translation Registers - - CV_IA64_TrI0 = 8192, - CV_IA64_TrI1 = 8193, - CV_IA64_TrI2 = 8194, - CV_IA64_TrI3 = 8195, - CV_IA64_TrI4 = 8196, - CV_IA64_TrI5 = 8197, - CV_IA64_TrI6 = 8198, - CV_IA64_TrI7 = 8199, - - // Data Translation Registers - - CV_IA64_TrD0 = 8320, - CV_IA64_TrD1 = 8321, - CV_IA64_TrD2 = 8322, - CV_IA64_TrD3 = 8323, - CV_IA64_TrD4 = 8324, - CV_IA64_TrD5 = 8325, - CV_IA64_TrD6 = 8326, - CV_IA64_TrD7 = 8327, - - // Instruction Breakpoint Registers - - CV_IA64_DbI0 = 8448, - CV_IA64_DbI1 = 8449, - CV_IA64_DbI2 = 8450, - CV_IA64_DbI3 = 8451, - CV_IA64_DbI4 = 8452, - CV_IA64_DbI5 = 8453, - CV_IA64_DbI6 = 8454, - CV_IA64_DbI7 = 8455, - - // Data Breakpoint Registers - - CV_IA64_DbD0 = 8576, - CV_IA64_DbD1 = 8577, - CV_IA64_DbD2 = 8578, - CV_IA64_DbD3 = 8579, - CV_IA64_DbD4 = 8580, - CV_IA64_DbD5 = 8581, - CV_IA64_DbD6 = 8582, - CV_IA64_DbD7 = 8583, - - // - // Register set for the TriCore processor. - // - - CV_TRI_NOREG = CV_REG_NONE, - - // General Purpose Data Registers - - CV_TRI_D0 = 10, - CV_TRI_D1 = 11, - CV_TRI_D2 = 12, - CV_TRI_D3 = 13, - CV_TRI_D4 = 14, - CV_TRI_D5 = 15, - CV_TRI_D6 = 16, - CV_TRI_D7 = 17, - CV_TRI_D8 = 18, - CV_TRI_D9 = 19, - CV_TRI_D10 = 20, - CV_TRI_D11 = 21, - CV_TRI_D12 = 22, - CV_TRI_D13 = 23, - CV_TRI_D14 = 24, - CV_TRI_D15 = 25, - - // General Purpose Address Registers - - CV_TRI_A0 = 26, - CV_TRI_A1 = 27, - CV_TRI_A2 = 28, - CV_TRI_A3 = 29, - CV_TRI_A4 = 30, - CV_TRI_A5 = 31, - CV_TRI_A6 = 32, - CV_TRI_A7 = 33, - CV_TRI_A8 = 34, - CV_TRI_A9 = 35, - CV_TRI_A10 = 36, - CV_TRI_A11 = 37, - CV_TRI_A12 = 38, - CV_TRI_A13 = 39, - CV_TRI_A14 = 40, - CV_TRI_A15 = 41, - - // Extended (64-bit) data registers - - CV_TRI_E0 = 42, - CV_TRI_E2 = 43, - CV_TRI_E4 = 44, - CV_TRI_E6 = 45, - CV_TRI_E8 = 46, - CV_TRI_E10 = 47, - CV_TRI_E12 = 48, - CV_TRI_E14 = 49, - - // Extended (64-bit) address registers - - CV_TRI_EA0 = 50, - CV_TRI_EA2 = 51, - CV_TRI_EA4 = 52, - CV_TRI_EA6 = 53, - CV_TRI_EA8 = 54, - CV_TRI_EA10 = 55, - CV_TRI_EA12 = 56, - CV_TRI_EA14 = 57, - - CV_TRI_PSW = 58, - CV_TRI_PCXI = 59, - CV_TRI_PC = 60, - CV_TRI_FCX = 61, - CV_TRI_LCX = 62, - CV_TRI_ISP = 63, - CV_TRI_ICR = 64, - CV_TRI_BIV = 65, - CV_TRI_BTV = 66, - CV_TRI_SYSCON = 67, - CV_TRI_DPRx_0 = 68, - CV_TRI_DPRx_1 = 69, - CV_TRI_DPRx_2 = 70, - CV_TRI_DPRx_3 = 71, - CV_TRI_CPRx_0 = 68, - CV_TRI_CPRx_1 = 69, - CV_TRI_CPRx_2 = 70, - CV_TRI_CPRx_3 = 71, - CV_TRI_DPMx_0 = 68, - CV_TRI_DPMx_1 = 69, - CV_TRI_DPMx_2 = 70, - CV_TRI_DPMx_3 = 71, - CV_TRI_CPMx_0 = 68, - CV_TRI_CPMx_1 = 69, - CV_TRI_CPMx_2 = 70, - CV_TRI_CPMx_3 = 71, - CV_TRI_DBGSSR = 72, - CV_TRI_EXEVT = 73, - CV_TRI_SWEVT = 74, - CV_TRI_CREVT = 75, - CV_TRI_TRnEVT = 76, - CV_TRI_MMUCON = 77, - CV_TRI_ASI = 78, - CV_TRI_TVA = 79, - CV_TRI_TPA = 80, - CV_TRI_TPX = 81, - CV_TRI_TFA = 82, - - // - // Register set for the AM33 and related processors. - // - - CV_AM33_NOREG = CV_REG_NONE, - - // "Extended" (general purpose integer) registers - CV_AM33_E0 = 10, - CV_AM33_E1 = 11, - CV_AM33_E2 = 12, - CV_AM33_E3 = 13, - CV_AM33_E4 = 14, - CV_AM33_E5 = 15, - CV_AM33_E6 = 16, - CV_AM33_E7 = 17, - - // Address registers - CV_AM33_A0 = 20, - CV_AM33_A1 = 21, - CV_AM33_A2 = 22, - CV_AM33_A3 = 23, - - // Integer data registers - CV_AM33_D0 = 30, - CV_AM33_D1 = 31, - CV_AM33_D2 = 32, - CV_AM33_D3 = 33, - - // (Single-precision) floating-point registers - CV_AM33_FS0 = 40, - CV_AM33_FS1 = 41, - CV_AM33_FS2 = 42, - CV_AM33_FS3 = 43, - CV_AM33_FS4 = 44, - CV_AM33_FS5 = 45, - CV_AM33_FS6 = 46, - CV_AM33_FS7 = 47, - CV_AM33_FS8 = 48, - CV_AM33_FS9 = 49, - CV_AM33_FS10 = 50, - CV_AM33_FS11 = 51, - CV_AM33_FS12 = 52, - CV_AM33_FS13 = 53, - CV_AM33_FS14 = 54, - CV_AM33_FS15 = 55, - CV_AM33_FS16 = 56, - CV_AM33_FS17 = 57, - CV_AM33_FS18 = 58, - CV_AM33_FS19 = 59, - CV_AM33_FS20 = 60, - CV_AM33_FS21 = 61, - CV_AM33_FS22 = 62, - CV_AM33_FS23 = 63, - CV_AM33_FS24 = 64, - CV_AM33_FS25 = 65, - CV_AM33_FS26 = 66, - CV_AM33_FS27 = 67, - CV_AM33_FS28 = 68, - CV_AM33_FS29 = 69, - CV_AM33_FS30 = 70, - CV_AM33_FS31 = 71, - - // Special purpose registers - - // Stack pointer - CV_AM33_SP = 80, - - // Program counter - CV_AM33_PC = 81, - - // Multiply-divide/accumulate registers - CV_AM33_MDR = 82, - CV_AM33_MDRQ = 83, - CV_AM33_MCRH = 84, - CV_AM33_MCRL = 85, - CV_AM33_MCVF = 86, - - // CPU status words - CV_AM33_EPSW = 87, - CV_AM33_FPCR = 88, - - // Loop buffer registers - CV_AM33_LIR = 89, - CV_AM33_LAR = 90, - - // - // Register set for the Mitsubishi M32R - // - - CV_M32R_NOREG = CV_REG_NONE, - - CV_M32R_R0 = 10, - CV_M32R_R1 = 11, - CV_M32R_R2 = 12, - CV_M32R_R3 = 13, - CV_M32R_R4 = 14, - CV_M32R_R5 = 15, - CV_M32R_R6 = 16, - CV_M32R_R7 = 17, - CV_M32R_R8 = 18, - CV_M32R_R9 = 19, - CV_M32R_R10 = 20, - CV_M32R_R11 = 21, - CV_M32R_R12 = 22, // Gloabal Pointer, if used - CV_M32R_R13 = 23, // Frame Pointer, if allocated - CV_M32R_R14 = 24, // Link Register - CV_M32R_R15 = 25, // Stack Pointer - CV_M32R_PSW = 26, // Preocessor Status Register - CV_M32R_CBR = 27, // Condition Bit Register - CV_M32R_SPI = 28, // Interrupt Stack Pointer - CV_M32R_SPU = 29, // User Stack Pointer - CV_M32R_SPO = 30, // OS Stack Pointer - CV_M32R_BPC = 31, // Backup Program Counter - CV_M32R_ACHI = 32, // Accumulator High - CV_M32R_ACLO = 33, // Accumulator Low - CV_M32R_PC = 34, // Program Counter - - // - // Register set for the SuperH SHMedia processor including compact - // mode - // - - // Integer - 64 bit general registers - CV_SHMEDIA_NOREG = CV_REG_NONE, - CV_SHMEDIA_R0 = 10, - CV_SHMEDIA_R1 = 11, - CV_SHMEDIA_R2 = 12, - CV_SHMEDIA_R3 = 13, - CV_SHMEDIA_R4 = 14, - CV_SHMEDIA_R5 = 15, - CV_SHMEDIA_R6 = 16, - CV_SHMEDIA_R7 = 17, - CV_SHMEDIA_R8 = 18, - CV_SHMEDIA_R9 = 19, - CV_SHMEDIA_R10 = 20, - CV_SHMEDIA_R11 = 21, - CV_SHMEDIA_R12 = 22, - CV_SHMEDIA_R13 = 23, - CV_SHMEDIA_R14 = 24, - CV_SHMEDIA_R15 = 25, - CV_SHMEDIA_R16 = 26, - CV_SHMEDIA_R17 = 27, - CV_SHMEDIA_R18 = 28, - CV_SHMEDIA_R19 = 29, - CV_SHMEDIA_R20 = 30, - CV_SHMEDIA_R21 = 31, - CV_SHMEDIA_R22 = 32, - CV_SHMEDIA_R23 = 33, - CV_SHMEDIA_R24 = 34, - CV_SHMEDIA_R25 = 35, - CV_SHMEDIA_R26 = 36, - CV_SHMEDIA_R27 = 37, - CV_SHMEDIA_R28 = 38, - CV_SHMEDIA_R29 = 39, - CV_SHMEDIA_R30 = 40, - CV_SHMEDIA_R31 = 41, - CV_SHMEDIA_R32 = 42, - CV_SHMEDIA_R33 = 43, - CV_SHMEDIA_R34 = 44, - CV_SHMEDIA_R35 = 45, - CV_SHMEDIA_R36 = 46, - CV_SHMEDIA_R37 = 47, - CV_SHMEDIA_R38 = 48, - CV_SHMEDIA_R39 = 49, - CV_SHMEDIA_R40 = 50, - CV_SHMEDIA_R41 = 51, - CV_SHMEDIA_R42 = 52, - CV_SHMEDIA_R43 = 53, - CV_SHMEDIA_R44 = 54, - CV_SHMEDIA_R45 = 55, - CV_SHMEDIA_R46 = 56, - CV_SHMEDIA_R47 = 57, - CV_SHMEDIA_R48 = 58, - CV_SHMEDIA_R49 = 59, - CV_SHMEDIA_R50 = 60, - CV_SHMEDIA_R51 = 61, - CV_SHMEDIA_R52 = 62, - CV_SHMEDIA_R53 = 63, - CV_SHMEDIA_R54 = 64, - CV_SHMEDIA_R55 = 65, - CV_SHMEDIA_R56 = 66, - CV_SHMEDIA_R57 = 67, - CV_SHMEDIA_R58 = 68, - CV_SHMEDIA_R59 = 69, - CV_SHMEDIA_R60 = 70, - CV_SHMEDIA_R61 = 71, - CV_SHMEDIA_R62 = 72, - CV_SHMEDIA_R63 = 73, - - // Target Registers - 32 bit - CV_SHMEDIA_TR0 = 74, - CV_SHMEDIA_TR1 = 75, - CV_SHMEDIA_TR2 = 76, - CV_SHMEDIA_TR3 = 77, - CV_SHMEDIA_TR4 = 78, - CV_SHMEDIA_TR5 = 79, - CV_SHMEDIA_TR6 = 80, - CV_SHMEDIA_TR7 = 81, - CV_SHMEDIA_TR8 = 82, // future-proof - CV_SHMEDIA_TR9 = 83, // future-proof - CV_SHMEDIA_TR10 = 84, // future-proof - CV_SHMEDIA_TR11 = 85, // future-proof - CV_SHMEDIA_TR12 = 86, // future-proof - CV_SHMEDIA_TR13 = 87, // future-proof - CV_SHMEDIA_TR14 = 88, // future-proof - CV_SHMEDIA_TR15 = 89, // future-proof - - // Single - 32 bit fp registers - CV_SHMEDIA_FR0 = 128, - CV_SHMEDIA_FR1 = 129, - CV_SHMEDIA_FR2 = 130, - CV_SHMEDIA_FR3 = 131, - CV_SHMEDIA_FR4 = 132, - CV_SHMEDIA_FR5 = 133, - CV_SHMEDIA_FR6 = 134, - CV_SHMEDIA_FR7 = 135, - CV_SHMEDIA_FR8 = 136, - CV_SHMEDIA_FR9 = 137, - CV_SHMEDIA_FR10 = 138, - CV_SHMEDIA_FR11 = 139, - CV_SHMEDIA_FR12 = 140, - CV_SHMEDIA_FR13 = 141, - CV_SHMEDIA_FR14 = 142, - CV_SHMEDIA_FR15 = 143, - CV_SHMEDIA_FR16 = 144, - CV_SHMEDIA_FR17 = 145, - CV_SHMEDIA_FR18 = 146, - CV_SHMEDIA_FR19 = 147, - CV_SHMEDIA_FR20 = 148, - CV_SHMEDIA_FR21 = 149, - CV_SHMEDIA_FR22 = 150, - CV_SHMEDIA_FR23 = 151, - CV_SHMEDIA_FR24 = 152, - CV_SHMEDIA_FR25 = 153, - CV_SHMEDIA_FR26 = 154, - CV_SHMEDIA_FR27 = 155, - CV_SHMEDIA_FR28 = 156, - CV_SHMEDIA_FR29 = 157, - CV_SHMEDIA_FR30 = 158, - CV_SHMEDIA_FR31 = 159, - CV_SHMEDIA_FR32 = 160, - CV_SHMEDIA_FR33 = 161, - CV_SHMEDIA_FR34 = 162, - CV_SHMEDIA_FR35 = 163, - CV_SHMEDIA_FR36 = 164, - CV_SHMEDIA_FR37 = 165, - CV_SHMEDIA_FR38 = 166, - CV_SHMEDIA_FR39 = 167, - CV_SHMEDIA_FR40 = 168, - CV_SHMEDIA_FR41 = 169, - CV_SHMEDIA_FR42 = 170, - CV_SHMEDIA_FR43 = 171, - CV_SHMEDIA_FR44 = 172, - CV_SHMEDIA_FR45 = 173, - CV_SHMEDIA_FR46 = 174, - CV_SHMEDIA_FR47 = 175, - CV_SHMEDIA_FR48 = 176, - CV_SHMEDIA_FR49 = 177, - CV_SHMEDIA_FR50 = 178, - CV_SHMEDIA_FR51 = 179, - CV_SHMEDIA_FR52 = 180, - CV_SHMEDIA_FR53 = 181, - CV_SHMEDIA_FR54 = 182, - CV_SHMEDIA_FR55 = 183, - CV_SHMEDIA_FR56 = 184, - CV_SHMEDIA_FR57 = 185, - CV_SHMEDIA_FR58 = 186, - CV_SHMEDIA_FR59 = 187, - CV_SHMEDIA_FR60 = 188, - CV_SHMEDIA_FR61 = 189, - CV_SHMEDIA_FR62 = 190, - CV_SHMEDIA_FR63 = 191, - - // Double - 64 bit synonyms for 32bit fp register pairs - // subtract 128 to find first base single register - CV_SHMEDIA_DR0 = 256, - CV_SHMEDIA_DR2 = 258, - CV_SHMEDIA_DR4 = 260, - CV_SHMEDIA_DR6 = 262, - CV_SHMEDIA_DR8 = 264, - CV_SHMEDIA_DR10 = 266, - CV_SHMEDIA_DR12 = 268, - CV_SHMEDIA_DR14 = 270, - CV_SHMEDIA_DR16 = 272, - CV_SHMEDIA_DR18 = 274, - CV_SHMEDIA_DR20 = 276, - CV_SHMEDIA_DR22 = 278, - CV_SHMEDIA_DR24 = 280, - CV_SHMEDIA_DR26 = 282, - CV_SHMEDIA_DR28 = 284, - CV_SHMEDIA_DR30 = 286, - CV_SHMEDIA_DR32 = 288, - CV_SHMEDIA_DR34 = 290, - CV_SHMEDIA_DR36 = 292, - CV_SHMEDIA_DR38 = 294, - CV_SHMEDIA_DR40 = 296, - CV_SHMEDIA_DR42 = 298, - CV_SHMEDIA_DR44 = 300, - CV_SHMEDIA_DR46 = 302, - CV_SHMEDIA_DR48 = 304, - CV_SHMEDIA_DR50 = 306, - CV_SHMEDIA_DR52 = 308, - CV_SHMEDIA_DR54 = 310, - CV_SHMEDIA_DR56 = 312, - CV_SHMEDIA_DR58 = 314, - CV_SHMEDIA_DR60 = 316, - CV_SHMEDIA_DR62 = 318, - - // Vector - 128 bit synonyms for 32bit fp register quads - // subtract 384 to find first base single register - CV_SHMEDIA_FV0 = 512, - CV_SHMEDIA_FV4 = 516, - CV_SHMEDIA_FV8 = 520, - CV_SHMEDIA_FV12 = 524, - CV_SHMEDIA_FV16 = 528, - CV_SHMEDIA_FV20 = 532, - CV_SHMEDIA_FV24 = 536, - CV_SHMEDIA_FV28 = 540, - CV_SHMEDIA_FV32 = 544, - CV_SHMEDIA_FV36 = 548, - CV_SHMEDIA_FV40 = 552, - CV_SHMEDIA_FV44 = 556, - CV_SHMEDIA_FV48 = 560, - CV_SHMEDIA_FV52 = 564, - CV_SHMEDIA_FV56 = 568, - CV_SHMEDIA_FV60 = 572, - - // Matrix - 512 bit synonyms for 16 adjacent 32bit fp registers - // subtract 896 to find first base single register - CV_SHMEDIA_MTRX0 = 1024, - CV_SHMEDIA_MTRX16 = 1040, - CV_SHMEDIA_MTRX32 = 1056, - CV_SHMEDIA_MTRX48 = 1072, - - // Control - Implementation defined 64bit control registers - CV_SHMEDIA_CR0 = 2000, - CV_SHMEDIA_CR1 = 2001, - CV_SHMEDIA_CR2 = 2002, - CV_SHMEDIA_CR3 = 2003, - CV_SHMEDIA_CR4 = 2004, - CV_SHMEDIA_CR5 = 2005, - CV_SHMEDIA_CR6 = 2006, - CV_SHMEDIA_CR7 = 2007, - CV_SHMEDIA_CR8 = 2008, - CV_SHMEDIA_CR9 = 2009, - CV_SHMEDIA_CR10 = 2010, - CV_SHMEDIA_CR11 = 2011, - CV_SHMEDIA_CR12 = 2012, - CV_SHMEDIA_CR13 = 2013, - CV_SHMEDIA_CR14 = 2014, - CV_SHMEDIA_CR15 = 2015, - CV_SHMEDIA_CR16 = 2016, - CV_SHMEDIA_CR17 = 2017, - CV_SHMEDIA_CR18 = 2018, - CV_SHMEDIA_CR19 = 2019, - CV_SHMEDIA_CR20 = 2020, - CV_SHMEDIA_CR21 = 2021, - CV_SHMEDIA_CR22 = 2022, - CV_SHMEDIA_CR23 = 2023, - CV_SHMEDIA_CR24 = 2024, - CV_SHMEDIA_CR25 = 2025, - CV_SHMEDIA_CR26 = 2026, - CV_SHMEDIA_CR27 = 2027, - CV_SHMEDIA_CR28 = 2028, - CV_SHMEDIA_CR29 = 2029, - CV_SHMEDIA_CR30 = 2030, - CV_SHMEDIA_CR31 = 2031, - CV_SHMEDIA_CR32 = 2032, - CV_SHMEDIA_CR33 = 2033, - CV_SHMEDIA_CR34 = 2034, - CV_SHMEDIA_CR35 = 2035, - CV_SHMEDIA_CR36 = 2036, - CV_SHMEDIA_CR37 = 2037, - CV_SHMEDIA_CR38 = 2038, - CV_SHMEDIA_CR39 = 2039, - CV_SHMEDIA_CR40 = 2040, - CV_SHMEDIA_CR41 = 2041, - CV_SHMEDIA_CR42 = 2042, - CV_SHMEDIA_CR43 = 2043, - CV_SHMEDIA_CR44 = 2044, - CV_SHMEDIA_CR45 = 2045, - CV_SHMEDIA_CR46 = 2046, - CV_SHMEDIA_CR47 = 2047, - CV_SHMEDIA_CR48 = 2048, - CV_SHMEDIA_CR49 = 2049, - CV_SHMEDIA_CR50 = 2050, - CV_SHMEDIA_CR51 = 2051, - CV_SHMEDIA_CR52 = 2052, - CV_SHMEDIA_CR53 = 2053, - CV_SHMEDIA_CR54 = 2054, - CV_SHMEDIA_CR55 = 2055, - CV_SHMEDIA_CR56 = 2056, - CV_SHMEDIA_CR57 = 2057, - CV_SHMEDIA_CR58 = 2058, - CV_SHMEDIA_CR59 = 2059, - CV_SHMEDIA_CR60 = 2060, - CV_SHMEDIA_CR61 = 2061, - CV_SHMEDIA_CR62 = 2062, - CV_SHMEDIA_CR63 = 2063, - - CV_SHMEDIA_FPSCR = 2064, - - // Compact mode synonyms - CV_SHMEDIA_GBR = CV_SHMEDIA_R16, - CV_SHMEDIA_MACL = 90, // synonym for lower 32bits of media R17 - CV_SHMEDIA_MACH = 91, // synonym for upper 32bits of media R17 - CV_SHMEDIA_PR = CV_SHMEDIA_R18, - CV_SHMEDIA_T = 92, // synonym for lowest bit of media R19 - CV_SHMEDIA_FPUL = CV_SHMEDIA_FR32, - CV_SHMEDIA_PC = 93, - CV_SHMEDIA_SR = CV_SHMEDIA_CR0, - - // - // AMD64 registers - // - - CV_AMD64_AL = 1, - CV_AMD64_CL = 2, - CV_AMD64_DL = 3, - CV_AMD64_BL = 4, - CV_AMD64_AH = 5, - CV_AMD64_CH = 6, - CV_AMD64_DH = 7, - CV_AMD64_BH = 8, - CV_AMD64_AX = 9, - CV_AMD64_CX = 10, - CV_AMD64_DX = 11, - CV_AMD64_BX = 12, - CV_AMD64_SP = 13, - CV_AMD64_BP = 14, - CV_AMD64_SI = 15, - CV_AMD64_DI = 16, - CV_AMD64_EAX = 17, - CV_AMD64_ECX = 18, - CV_AMD64_EDX = 19, - CV_AMD64_EBX = 20, - CV_AMD64_ESP = 21, - CV_AMD64_EBP = 22, - CV_AMD64_ESI = 23, - CV_AMD64_EDI = 24, - CV_AMD64_ES = 25, - CV_AMD64_CS = 26, - CV_AMD64_SS = 27, - CV_AMD64_DS = 28, - CV_AMD64_FS = 29, - CV_AMD64_GS = 30, - CV_AMD64_FLAGS = 32, - CV_AMD64_RIP = 33, - CV_AMD64_EFLAGS = 34, - - // Control registers - CV_AMD64_CR0 = 80, - CV_AMD64_CR1 = 81, - CV_AMD64_CR2 = 82, - CV_AMD64_CR3 = 83, - CV_AMD64_CR4 = 84, - CV_AMD64_CR8 = 88, - - // Debug registers - CV_AMD64_DR0 = 90, - CV_AMD64_DR1 = 91, - CV_AMD64_DR2 = 92, - CV_AMD64_DR3 = 93, - CV_AMD64_DR4 = 94, - CV_AMD64_DR5 = 95, - CV_AMD64_DR6 = 96, - CV_AMD64_DR7 = 97, - CV_AMD64_DR8 = 98, - CV_AMD64_DR9 = 99, - CV_AMD64_DR10 = 100, - CV_AMD64_DR11 = 101, - CV_AMD64_DR12 = 102, - CV_AMD64_DR13 = 103, - CV_AMD64_DR14 = 104, - CV_AMD64_DR15 = 105, - - CV_AMD64_GDTR = 110, - CV_AMD64_GDTL = 111, - CV_AMD64_IDTR = 112, - CV_AMD64_IDTL = 113, - CV_AMD64_LDTR = 114, - CV_AMD64_TR = 115, - - CV_AMD64_ST0 = 128, - CV_AMD64_ST1 = 129, - CV_AMD64_ST2 = 130, - CV_AMD64_ST3 = 131, - CV_AMD64_ST4 = 132, - CV_AMD64_ST5 = 133, - CV_AMD64_ST6 = 134, - CV_AMD64_ST7 = 135, - CV_AMD64_CTRL = 136, - CV_AMD64_STAT = 137, - CV_AMD64_TAG = 138, - CV_AMD64_FPIP = 139, - CV_AMD64_FPCS = 140, - CV_AMD64_FPDO = 141, - CV_AMD64_FPDS = 142, - CV_AMD64_ISEM = 143, - CV_AMD64_FPEIP = 144, - CV_AMD64_FPEDO = 145, - - CV_AMD64_MM0 = 146, - CV_AMD64_MM1 = 147, - CV_AMD64_MM2 = 148, - CV_AMD64_MM3 = 149, - CV_AMD64_MM4 = 150, - CV_AMD64_MM5 = 151, - CV_AMD64_MM6 = 152, - CV_AMD64_MM7 = 153, - - CV_AMD64_XMM0 = 154, // KATMAI registers - CV_AMD64_XMM1 = 155, - CV_AMD64_XMM2 = 156, - CV_AMD64_XMM3 = 157, - CV_AMD64_XMM4 = 158, - CV_AMD64_XMM5 = 159, - CV_AMD64_XMM6 = 160, - CV_AMD64_XMM7 = 161, - - CV_AMD64_XMM0_0 = 162, // KATMAI sub-registers - CV_AMD64_XMM0_1 = 163, - CV_AMD64_XMM0_2 = 164, - CV_AMD64_XMM0_3 = 165, - CV_AMD64_XMM1_0 = 166, - CV_AMD64_XMM1_1 = 167, - CV_AMD64_XMM1_2 = 168, - CV_AMD64_XMM1_3 = 169, - CV_AMD64_XMM2_0 = 170, - CV_AMD64_XMM2_1 = 171, - CV_AMD64_XMM2_2 = 172, - CV_AMD64_XMM2_3 = 173, - CV_AMD64_XMM3_0 = 174, - CV_AMD64_XMM3_1 = 175, - CV_AMD64_XMM3_2 = 176, - CV_AMD64_XMM3_3 = 177, - CV_AMD64_XMM4_0 = 178, - CV_AMD64_XMM4_1 = 179, - CV_AMD64_XMM4_2 = 180, - CV_AMD64_XMM4_3 = 181, - CV_AMD64_XMM5_0 = 182, - CV_AMD64_XMM5_1 = 183, - CV_AMD64_XMM5_2 = 184, - CV_AMD64_XMM5_3 = 185, - CV_AMD64_XMM6_0 = 186, - CV_AMD64_XMM6_1 = 187, - CV_AMD64_XMM6_2 = 188, - CV_AMD64_XMM6_3 = 189, - CV_AMD64_XMM7_0 = 190, - CV_AMD64_XMM7_1 = 191, - CV_AMD64_XMM7_2 = 192, - CV_AMD64_XMM7_3 = 193, - - CV_AMD64_XMM0L = 194, - CV_AMD64_XMM1L = 195, - CV_AMD64_XMM2L = 196, - CV_AMD64_XMM3L = 197, - CV_AMD64_XMM4L = 198, - CV_AMD64_XMM5L = 199, - CV_AMD64_XMM6L = 200, - CV_AMD64_XMM7L = 201, - - CV_AMD64_XMM0H = 202, - CV_AMD64_XMM1H = 203, - CV_AMD64_XMM2H = 204, - CV_AMD64_XMM3H = 205, - CV_AMD64_XMM4H = 206, - CV_AMD64_XMM5H = 207, - CV_AMD64_XMM6H = 208, - CV_AMD64_XMM7H = 209, - - CV_AMD64_MXCSR = 211, // XMM status register - - CV_AMD64_EMM0L = 220, // XMM sub-registers (WNI integer) - CV_AMD64_EMM1L = 221, - CV_AMD64_EMM2L = 222, - CV_AMD64_EMM3L = 223, - CV_AMD64_EMM4L = 224, - CV_AMD64_EMM5L = 225, - CV_AMD64_EMM6L = 226, - CV_AMD64_EMM7L = 227, - - CV_AMD64_EMM0H = 228, - CV_AMD64_EMM1H = 229, - CV_AMD64_EMM2H = 230, - CV_AMD64_EMM3H = 231, - CV_AMD64_EMM4H = 232, - CV_AMD64_EMM5H = 233, - CV_AMD64_EMM6H = 234, - CV_AMD64_EMM7H = 235, - - // do not change the order of these regs, first one must be even too - CV_AMD64_MM00 = 236, - CV_AMD64_MM01 = 237, - CV_AMD64_MM10 = 238, - CV_AMD64_MM11 = 239, - CV_AMD64_MM20 = 240, - CV_AMD64_MM21 = 241, - CV_AMD64_MM30 = 242, - CV_AMD64_MM31 = 243, - CV_AMD64_MM40 = 244, - CV_AMD64_MM41 = 245, - CV_AMD64_MM50 = 246, - CV_AMD64_MM51 = 247, - CV_AMD64_MM60 = 248, - CV_AMD64_MM61 = 249, - CV_AMD64_MM70 = 250, - CV_AMD64_MM71 = 251, - - // Extended KATMAI registers - CV_AMD64_XMM8 = 252, // KATMAI registers - CV_AMD64_XMM9 = 253, - CV_AMD64_XMM10 = 254, - CV_AMD64_XMM11 = 255, - CV_AMD64_XMM12 = 256, - CV_AMD64_XMM13 = 257, - CV_AMD64_XMM14 = 258, - CV_AMD64_XMM15 = 259, - - CV_AMD64_XMM8_0 = 260, // KATMAI sub-registers - CV_AMD64_XMM8_1 = 261, - CV_AMD64_XMM8_2 = 262, - CV_AMD64_XMM8_3 = 263, - CV_AMD64_XMM9_0 = 264, - CV_AMD64_XMM9_1 = 265, - CV_AMD64_XMM9_2 = 266, - CV_AMD64_XMM9_3 = 267, - CV_AMD64_XMM10_0 = 268, - CV_AMD64_XMM10_1 = 269, - CV_AMD64_XMM10_2 = 270, - CV_AMD64_XMM10_3 = 271, - CV_AMD64_XMM11_0 = 272, - CV_AMD64_XMM11_1 = 273, - CV_AMD64_XMM11_2 = 274, - CV_AMD64_XMM11_3 = 275, - CV_AMD64_XMM12_0 = 276, - CV_AMD64_XMM12_1 = 277, - CV_AMD64_XMM12_2 = 278, - CV_AMD64_XMM12_3 = 279, - CV_AMD64_XMM13_0 = 280, - CV_AMD64_XMM13_1 = 281, - CV_AMD64_XMM13_2 = 282, - CV_AMD64_XMM13_3 = 283, - CV_AMD64_XMM14_0 = 284, - CV_AMD64_XMM14_1 = 285, - CV_AMD64_XMM14_2 = 286, - CV_AMD64_XMM14_3 = 287, - CV_AMD64_XMM15_0 = 288, - CV_AMD64_XMM15_1 = 289, - CV_AMD64_XMM15_2 = 290, - CV_AMD64_XMM15_3 = 291, - - CV_AMD64_XMM8L = 292, - CV_AMD64_XMM9L = 293, - CV_AMD64_XMM10L = 294, - CV_AMD64_XMM11L = 295, - CV_AMD64_XMM12L = 296, - CV_AMD64_XMM13L = 297, - CV_AMD64_XMM14L = 298, - CV_AMD64_XMM15L = 299, - - CV_AMD64_XMM8H = 300, - CV_AMD64_XMM9H = 301, - CV_AMD64_XMM10H = 302, - CV_AMD64_XMM11H = 303, - CV_AMD64_XMM12H = 304, - CV_AMD64_XMM13H = 305, - CV_AMD64_XMM14H = 306, - CV_AMD64_XMM15H = 307, - - CV_AMD64_EMM8L = 308, // XMM sub-registers (WNI integer) - CV_AMD64_EMM9L = 309, - CV_AMD64_EMM10L = 310, - CV_AMD64_EMM11L = 311, - CV_AMD64_EMM12L = 312, - CV_AMD64_EMM13L = 313, - CV_AMD64_EMM14L = 314, - CV_AMD64_EMM15L = 315, - - CV_AMD64_EMM8H = 316, - CV_AMD64_EMM9H = 317, - CV_AMD64_EMM10H = 318, - CV_AMD64_EMM11H = 319, - CV_AMD64_EMM12H = 320, - CV_AMD64_EMM13H = 321, - CV_AMD64_EMM14H = 322, - CV_AMD64_EMM15H = 323, - - // Low byte forms of some standard registers - CV_AMD64_SIL = 324, - CV_AMD64_DIL = 325, - CV_AMD64_BPL = 326, - CV_AMD64_SPL = 327, - - // 64-bit regular registers - CV_AMD64_RAX = 328, - CV_AMD64_RBX = 329, - CV_AMD64_RCX = 330, - CV_AMD64_RDX = 331, - CV_AMD64_RSI = 332, - CV_AMD64_RDI = 333, - CV_AMD64_RBP = 334, - CV_AMD64_RSP = 335, - - // 64-bit integer registers with 8-, 16-, and 32-bit forms (B, W, and D) - CV_AMD64_R8 = 336, - CV_AMD64_R9 = 337, - CV_AMD64_R10 = 338, - CV_AMD64_R11 = 339, - CV_AMD64_R12 = 340, - CV_AMD64_R13 = 341, - CV_AMD64_R14 = 342, - CV_AMD64_R15 = 343, - - CV_AMD64_R8B = 344, - CV_AMD64_R9B = 345, - CV_AMD64_R10B = 346, - CV_AMD64_R11B = 347, - CV_AMD64_R12B = 348, - CV_AMD64_R13B = 349, - CV_AMD64_R14B = 350, - CV_AMD64_R15B = 351, - - CV_AMD64_R8W = 352, - CV_AMD64_R9W = 353, - CV_AMD64_R10W = 354, - CV_AMD64_R11W = 355, - CV_AMD64_R12W = 356, - CV_AMD64_R13W = 357, - CV_AMD64_R14W = 358, - CV_AMD64_R15W = 359, - - CV_AMD64_R8D = 360, - CV_AMD64_R9D = 361, - CV_AMD64_R10D = 362, - CV_AMD64_R11D = 363, - CV_AMD64_R12D = 364, - CV_AMD64_R13D = 365, - CV_AMD64_R14D = 366, - CV_AMD64_R15D = 367, - - // AVX registers 256 bits - CV_AMD64_YMM0 = 368, - CV_AMD64_YMM1 = 369, - CV_AMD64_YMM2 = 370, - CV_AMD64_YMM3 = 371, - CV_AMD64_YMM4 = 372, - CV_AMD64_YMM5 = 373, - CV_AMD64_YMM6 = 374, - CV_AMD64_YMM7 = 375, - CV_AMD64_YMM8 = 376, - CV_AMD64_YMM9 = 377, - CV_AMD64_YMM10 = 378, - CV_AMD64_YMM11 = 379, - CV_AMD64_YMM12 = 380, - CV_AMD64_YMM13 = 381, - CV_AMD64_YMM14 = 382, - CV_AMD64_YMM15 = 383, - - // AVX registers upper 128 bits - CV_AMD64_YMM0H = 384, - CV_AMD64_YMM1H = 385, - CV_AMD64_YMM2H = 386, - CV_AMD64_YMM3H = 387, - CV_AMD64_YMM4H = 388, - CV_AMD64_YMM5H = 389, - CV_AMD64_YMM6H = 390, - CV_AMD64_YMM7H = 391, - CV_AMD64_YMM8H = 392, - CV_AMD64_YMM9H = 393, - CV_AMD64_YMM10H = 394, - CV_AMD64_YMM11H = 395, - CV_AMD64_YMM12H = 396, - CV_AMD64_YMM13H = 397, - CV_AMD64_YMM14H = 398, - CV_AMD64_YMM15H = 399, - - //Lower/upper 8 bytes of XMM registers. Unlike CV_AMD64_XMM, these - //values reprsesent the bit patterns of the registers as 64-bit integers, not - //the representation of these registers as a double. - CV_AMD64_XMM0IL = 400, - CV_AMD64_XMM1IL = 401, - CV_AMD64_XMM2IL = 402, - CV_AMD64_XMM3IL = 403, - CV_AMD64_XMM4IL = 404, - CV_AMD64_XMM5IL = 405, - CV_AMD64_XMM6IL = 406, - CV_AMD64_XMM7IL = 407, - CV_AMD64_XMM8IL = 408, - CV_AMD64_XMM9IL = 409, - CV_AMD64_XMM10IL = 410, - CV_AMD64_XMM11IL = 411, - CV_AMD64_XMM12IL = 412, - CV_AMD64_XMM13IL = 413, - CV_AMD64_XMM14IL = 414, - CV_AMD64_XMM15IL = 415, - - CV_AMD64_XMM0IH = 416, - CV_AMD64_XMM1IH = 417, - CV_AMD64_XMM2IH = 418, - CV_AMD64_XMM3IH = 419, - CV_AMD64_XMM4IH = 420, - CV_AMD64_XMM5IH = 421, - CV_AMD64_XMM6IH = 422, - CV_AMD64_XMM7IH = 423, - CV_AMD64_XMM8IH = 424, - CV_AMD64_XMM9IH = 425, - CV_AMD64_XMM10IH = 426, - CV_AMD64_XMM11IH = 427, - CV_AMD64_XMM12IH = 428, - CV_AMD64_XMM13IH = 429, - CV_AMD64_XMM14IH = 430, - CV_AMD64_XMM15IH = 431, - - CV_AMD64_YMM0I0 = 432, // AVX integer registers - CV_AMD64_YMM0I1 = 433, - CV_AMD64_YMM0I2 = 434, - CV_AMD64_YMM0I3 = 435, - CV_AMD64_YMM1I0 = 436, - CV_AMD64_YMM1I1 = 437, - CV_AMD64_YMM1I2 = 438, - CV_AMD64_YMM1I3 = 439, - CV_AMD64_YMM2I0 = 440, - CV_AMD64_YMM2I1 = 441, - CV_AMD64_YMM2I2 = 442, - CV_AMD64_YMM2I3 = 443, - CV_AMD64_YMM3I0 = 444, - CV_AMD64_YMM3I1 = 445, - CV_AMD64_YMM3I2 = 446, - CV_AMD64_YMM3I3 = 447, - CV_AMD64_YMM4I0 = 448, - CV_AMD64_YMM4I1 = 449, - CV_AMD64_YMM4I2 = 450, - CV_AMD64_YMM4I3 = 451, - CV_AMD64_YMM5I0 = 452, - CV_AMD64_YMM5I1 = 453, - CV_AMD64_YMM5I2 = 454, - CV_AMD64_YMM5I3 = 455, - CV_AMD64_YMM6I0 = 456, - CV_AMD64_YMM6I1 = 457, - CV_AMD64_YMM6I2 = 458, - CV_AMD64_YMM6I3 = 459, - CV_AMD64_YMM7I0 = 460, - CV_AMD64_YMM7I1 = 461, - CV_AMD64_YMM7I2 = 462, - CV_AMD64_YMM7I3 = 463, - CV_AMD64_YMM8I0 = 464, - CV_AMD64_YMM8I1 = 465, - CV_AMD64_YMM8I2 = 466, - CV_AMD64_YMM8I3 = 467, - CV_AMD64_YMM9I0 = 468, - CV_AMD64_YMM9I1 = 469, - CV_AMD64_YMM9I2 = 470, - CV_AMD64_YMM9I3 = 471, - CV_AMD64_YMM10I0 = 472, - CV_AMD64_YMM10I1 = 473, - CV_AMD64_YMM10I2 = 474, - CV_AMD64_YMM10I3 = 475, - CV_AMD64_YMM11I0 = 476, - CV_AMD64_YMM11I1 = 477, - CV_AMD64_YMM11I2 = 478, - CV_AMD64_YMM11I3 = 479, - CV_AMD64_YMM12I0 = 480, - CV_AMD64_YMM12I1 = 481, - CV_AMD64_YMM12I2 = 482, - CV_AMD64_YMM12I3 = 483, - CV_AMD64_YMM13I0 = 484, - CV_AMD64_YMM13I1 = 485, - CV_AMD64_YMM13I2 = 486, - CV_AMD64_YMM13I3 = 487, - CV_AMD64_YMM14I0 = 488, - CV_AMD64_YMM14I1 = 489, - CV_AMD64_YMM14I2 = 490, - CV_AMD64_YMM14I3 = 491, - CV_AMD64_YMM15I0 = 492, - CV_AMD64_YMM15I1 = 493, - CV_AMD64_YMM15I2 = 494, - CV_AMD64_YMM15I3 = 495, - - CV_AMD64_YMM0F0 = 496, // AVX floating-point single precise registers - CV_AMD64_YMM0F1 = 497, - CV_AMD64_YMM0F2 = 498, - CV_AMD64_YMM0F3 = 499, - CV_AMD64_YMM0F4 = 500, - CV_AMD64_YMM0F5 = 501, - CV_AMD64_YMM0F6 = 502, - CV_AMD64_YMM0F7 = 503, - CV_AMD64_YMM1F0 = 504, - CV_AMD64_YMM1F1 = 505, - CV_AMD64_YMM1F2 = 506, - CV_AMD64_YMM1F3 = 507, - CV_AMD64_YMM1F4 = 508, - CV_AMD64_YMM1F5 = 509, - CV_AMD64_YMM1F6 = 510, - CV_AMD64_YMM1F7 = 511, - CV_AMD64_YMM2F0 = 512, - CV_AMD64_YMM2F1 = 513, - CV_AMD64_YMM2F2 = 514, - CV_AMD64_YMM2F3 = 515, - CV_AMD64_YMM2F4 = 516, - CV_AMD64_YMM2F5 = 517, - CV_AMD64_YMM2F6 = 518, - CV_AMD64_YMM2F7 = 519, - CV_AMD64_YMM3F0 = 520, - CV_AMD64_YMM3F1 = 521, - CV_AMD64_YMM3F2 = 522, - CV_AMD64_YMM3F3 = 523, - CV_AMD64_YMM3F4 = 524, - CV_AMD64_YMM3F5 = 525, - CV_AMD64_YMM3F6 = 526, - CV_AMD64_YMM3F7 = 527, - CV_AMD64_YMM4F0 = 528, - CV_AMD64_YMM4F1 = 529, - CV_AMD64_YMM4F2 = 530, - CV_AMD64_YMM4F3 = 531, - CV_AMD64_YMM4F4 = 532, - CV_AMD64_YMM4F5 = 533, - CV_AMD64_YMM4F6 = 534, - CV_AMD64_YMM4F7 = 535, - CV_AMD64_YMM5F0 = 536, - CV_AMD64_YMM5F1 = 537, - CV_AMD64_YMM5F2 = 538, - CV_AMD64_YMM5F3 = 539, - CV_AMD64_YMM5F4 = 540, - CV_AMD64_YMM5F5 = 541, - CV_AMD64_YMM5F6 = 542, - CV_AMD64_YMM5F7 = 543, - CV_AMD64_YMM6F0 = 544, - CV_AMD64_YMM6F1 = 545, - CV_AMD64_YMM6F2 = 546, - CV_AMD64_YMM6F3 = 547, - CV_AMD64_YMM6F4 = 548, - CV_AMD64_YMM6F5 = 549, - CV_AMD64_YMM6F6 = 550, - CV_AMD64_YMM6F7 = 551, - CV_AMD64_YMM7F0 = 552, - CV_AMD64_YMM7F1 = 553, - CV_AMD64_YMM7F2 = 554, - CV_AMD64_YMM7F3 = 555, - CV_AMD64_YMM7F4 = 556, - CV_AMD64_YMM7F5 = 557, - CV_AMD64_YMM7F6 = 558, - CV_AMD64_YMM7F7 = 559, - CV_AMD64_YMM8F0 = 560, - CV_AMD64_YMM8F1 = 561, - CV_AMD64_YMM8F2 = 562, - CV_AMD64_YMM8F3 = 563, - CV_AMD64_YMM8F4 = 564, - CV_AMD64_YMM8F5 = 565, - CV_AMD64_YMM8F6 = 566, - CV_AMD64_YMM8F7 = 567, - CV_AMD64_YMM9F0 = 568, - CV_AMD64_YMM9F1 = 569, - CV_AMD64_YMM9F2 = 570, - CV_AMD64_YMM9F3 = 571, - CV_AMD64_YMM9F4 = 572, - CV_AMD64_YMM9F5 = 573, - CV_AMD64_YMM9F6 = 574, - CV_AMD64_YMM9F7 = 575, - CV_AMD64_YMM10F0 = 576, - CV_AMD64_YMM10F1 = 577, - CV_AMD64_YMM10F2 = 578, - CV_AMD64_YMM10F3 = 579, - CV_AMD64_YMM10F4 = 580, - CV_AMD64_YMM10F5 = 581, - CV_AMD64_YMM10F6 = 582, - CV_AMD64_YMM10F7 = 583, - CV_AMD64_YMM11F0 = 584, - CV_AMD64_YMM11F1 = 585, - CV_AMD64_YMM11F2 = 586, - CV_AMD64_YMM11F3 = 587, - CV_AMD64_YMM11F4 = 588, - CV_AMD64_YMM11F5 = 589, - CV_AMD64_YMM11F6 = 590, - CV_AMD64_YMM11F7 = 591, - CV_AMD64_YMM12F0 = 592, - CV_AMD64_YMM12F1 = 593, - CV_AMD64_YMM12F2 = 594, - CV_AMD64_YMM12F3 = 595, - CV_AMD64_YMM12F4 = 596, - CV_AMD64_YMM12F5 = 597, - CV_AMD64_YMM12F6 = 598, - CV_AMD64_YMM12F7 = 599, - CV_AMD64_YMM13F0 = 600, - CV_AMD64_YMM13F1 = 601, - CV_AMD64_YMM13F2 = 602, - CV_AMD64_YMM13F3 = 603, - CV_AMD64_YMM13F4 = 604, - CV_AMD64_YMM13F5 = 605, - CV_AMD64_YMM13F6 = 606, - CV_AMD64_YMM13F7 = 607, - CV_AMD64_YMM14F0 = 608, - CV_AMD64_YMM14F1 = 609, - CV_AMD64_YMM14F2 = 610, - CV_AMD64_YMM14F3 = 611, - CV_AMD64_YMM14F4 = 612, - CV_AMD64_YMM14F5 = 613, - CV_AMD64_YMM14F6 = 614, - CV_AMD64_YMM14F7 = 615, - CV_AMD64_YMM15F0 = 616, - CV_AMD64_YMM15F1 = 617, - CV_AMD64_YMM15F2 = 618, - CV_AMD64_YMM15F3 = 619, - CV_AMD64_YMM15F4 = 620, - CV_AMD64_YMM15F5 = 621, - CV_AMD64_YMM15F6 = 622, - CV_AMD64_YMM15F7 = 623, - - CV_AMD64_YMM0D0 = 624, // AVX floating-point double precise registers - CV_AMD64_YMM0D1 = 625, - CV_AMD64_YMM0D2 = 626, - CV_AMD64_YMM0D3 = 627, - CV_AMD64_YMM1D0 = 628, - CV_AMD64_YMM1D1 = 629, - CV_AMD64_YMM1D2 = 630, - CV_AMD64_YMM1D3 = 631, - CV_AMD64_YMM2D0 = 632, - CV_AMD64_YMM2D1 = 633, - CV_AMD64_YMM2D2 = 634, - CV_AMD64_YMM2D3 = 635, - CV_AMD64_YMM3D0 = 636, - CV_AMD64_YMM3D1 = 637, - CV_AMD64_YMM3D2 = 638, - CV_AMD64_YMM3D3 = 639, - CV_AMD64_YMM4D0 = 640, - CV_AMD64_YMM4D1 = 641, - CV_AMD64_YMM4D2 = 642, - CV_AMD64_YMM4D3 = 643, - CV_AMD64_YMM5D0 = 644, - CV_AMD64_YMM5D1 = 645, - CV_AMD64_YMM5D2 = 646, - CV_AMD64_YMM5D3 = 647, - CV_AMD64_YMM6D0 = 648, - CV_AMD64_YMM6D1 = 649, - CV_AMD64_YMM6D2 = 650, - CV_AMD64_YMM6D3 = 651, - CV_AMD64_YMM7D0 = 652, - CV_AMD64_YMM7D1 = 653, - CV_AMD64_YMM7D2 = 654, - CV_AMD64_YMM7D3 = 655, - CV_AMD64_YMM8D0 = 656, - CV_AMD64_YMM8D1 = 657, - CV_AMD64_YMM8D2 = 658, - CV_AMD64_YMM8D3 = 659, - CV_AMD64_YMM9D0 = 660, - CV_AMD64_YMM9D1 = 661, - CV_AMD64_YMM9D2 = 662, - CV_AMD64_YMM9D3 = 663, - CV_AMD64_YMM10D0 = 664, - CV_AMD64_YMM10D1 = 665, - CV_AMD64_YMM10D2 = 666, - CV_AMD64_YMM10D3 = 667, - CV_AMD64_YMM11D0 = 668, - CV_AMD64_YMM11D1 = 669, - CV_AMD64_YMM11D2 = 670, - CV_AMD64_YMM11D3 = 671, - CV_AMD64_YMM12D0 = 672, - CV_AMD64_YMM12D1 = 673, - CV_AMD64_YMM12D2 = 674, - CV_AMD64_YMM12D3 = 675, - CV_AMD64_YMM13D0 = 676, - CV_AMD64_YMM13D1 = 677, - CV_AMD64_YMM13D2 = 678, - CV_AMD64_YMM13D3 = 679, - CV_AMD64_YMM14D0 = 680, - CV_AMD64_YMM14D1 = 681, - CV_AMD64_YMM14D2 = 682, - CV_AMD64_YMM14D3 = 683, - CV_AMD64_YMM15D0 = 684, - CV_AMD64_YMM15D1 = 685, - CV_AMD64_YMM15D2 = 686, - CV_AMD64_YMM15D3 = 687 - - - // Note: Next set of platform registers need to go into a new enum... - // this one is above 44K now. - -} CV_HREG_e; - -typedef enum CV_HLSLREG_e { - CV_HLSLREG_TEMP = 0, - CV_HLSLREG_INPUT = 1, - CV_HLSLREG_OUTPUT = 2, - CV_HLSLREG_INDEXABLE_TEMP = 3, - CV_HLSLREG_IMMEDIATE32 = 4, - CV_HLSLREG_IMMEDIATE64 = 5, - CV_HLSLREG_SAMPLER = 6, - CV_HLSLREG_RESOURCE = 7, - CV_HLSLREG_CONSTANT_BUFFER = 8, - CV_HLSLREG_IMMEDIATE_CONSTANT_BUFFER = 9, - CV_HLSLREG_LABEL = 10, - CV_HLSLREG_INPUT_PRIMITIVEID = 11, - CV_HLSLREG_OUTPUT_DEPTH = 12, - CV_HLSLREG_NULL = 13, - CV_HLSLREG_RASTERIZER = 14, - CV_HLSLREG_OUTPUT_COVERAGE_MASK = 15, - CV_HLSLREG_STREAM = 16, - CV_HLSLREG_FUNCTION_BODY = 17, - CV_HLSLREG_FUNCTION_TABLE = 18, - CV_HLSLREG_INTERFACE = 19, - CV_HLSLREG_FUNCTION_INPUT = 20, - CV_HLSLREG_FUNCTION_OUTPUT = 21, - CV_HLSLREG_OUTPUT_CONTROL_POINT_ID = 22, - CV_HLSLREG_INPUT_FORK_INSTANCE_ID = 23, - CV_HLSLREG_INPUT_JOIN_INSTANCE_ID = 24, - CV_HLSLREG_INPUT_CONTROL_POINT = 25, - CV_HLSLREG_OUTPUT_CONTROL_POINT = 26, - CV_HLSLREG_INPUT_PATCH_CONSTANT = 27, - CV_HLSLREG_INPUT_DOMAIN_POINT = 28, - CV_HLSLREG_THIS_POINTER = 29, - CV_HLSLREG_UNORDERED_ACCESS_VIEW = 30, - CV_HLSLREG_THREAD_GROUP_SHARED_MEMORY = 31, - CV_HLSLREG_INPUT_THREAD_ID = 32, - CV_HLSLREG_INPUT_THREAD_GROUP_ID = 33, - CV_HLSLREG_INPUT_THREAD_ID_IN_GROUP = 34, - CV_HLSLREG_INPUT_COVERAGE_MASK = 35, - CV_HLSLREG_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36, - CV_HLSLREG_INPUT_GS_INSTANCE_ID = 37, - CV_HLSLREG_OUTPUT_DEPTH_GREATER_EQUAL = 38, - CV_HLSLREG_OUTPUT_DEPTH_LESS_EQUAL = 39, - CV_HLSLREG_CYCLE_COUNTER = 40, -} CV_HLSLREG_e; - -enum StackFrameTypeEnum -{ - FrameTypeFPO, // Frame pointer omitted, FPO info available - FrameTypeTrap, // Kernel Trap frame - FrameTypeTSS, // Kernel Trap frame - FrameTypeStandard, // Standard EBP stackframe - FrameTypeFrameData, // Frame pointer omitted, FrameData info available - - FrameTypeUnknown = -1, // Frame which does not have any debug info -}; - -enum MemoryTypeEnum -{ - MemTypeCode, // Read only code memory - MemTypeData, // Read only data/stack memory - MemTypeStack, // Read only stack memory - MemTypeCodeOnHeap, // Read only memory for code generated on heap by runtime - - MemTypeAny = -1, -}; - -typedef enum CV_HLSLMemorySpace_e -{ - // HLSL specific memory spaces - - CV_HLSL_MEMSPACE_DATA = 0x00, - CV_HLSL_MEMSPACE_SAMPLER = 0x01, - CV_HLSL_MEMSPACE_RESOURCE = 0x02, - CV_HLSL_MEMSPACE_RWRESOURCE = 0x03, - - CV_HLSL_MEMSPACE_MAX = 0x0F, -} CV_HLSLMemorySpace_e; - -#endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/cvinfo.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/cvinfo.h deleted file mode 100644 index ca62171fa..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/cvinfo.h +++ /dev/null @@ -1,4988 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** cvinfo.h - Generic CodeView information definitions - * - * Structures, constants, etc. for accessing and interpreting - * CodeView information. - * - */ - - -/*** The master copy of this file resides in the langapi project. - * All Microsoft projects are required to use the master copy without - * modification. Modification of the master version or a copy - * without consultation with all parties concerned is extremely - * risky. - * - */ - -#pragma once - -#include "cvconst.h" - -#ifndef _CV_INFO_INCLUDED -#define _CV_INFO_INCLUDED - -#ifdef __cplusplus -#pragma warning ( disable: 4200 ) -#endif - -#ifndef __INLINE -#ifdef __cplusplus -#define __INLINE inline -#else -#define __INLINE __inline -#endif -#endif - -#pragma pack ( push, 1 ) -typedef unsigned long CV_uoff32_t; -typedef long CV_off32_t; -typedef unsigned short CV_uoff16_t; -typedef short CV_off16_t; -typedef unsigned short CV_typ16_t; -typedef unsigned long CV_typ_t; -typedef unsigned long CV_pubsymflag_t; // must be same as CV_typ_t. -typedef unsigned short _2BYTEPAD; -typedef unsigned long CV_tkn_t; - -#if !defined (CV_ZEROLEN) -#define CV_ZEROLEN -#endif - -#if !defined (FLOAT10) -#if defined(_M_I86) // 16 bit x86 supporting long double -typedef long double FLOAT10; -#else // 32 bit w/o long double support -typedef struct FLOAT10 -{ - char b[10]; -} FLOAT10; -#endif -#endif - - -#define CV_SIGNATURE_C6 0L // Actual signature is >64K -#define CV_SIGNATURE_C7 1L // First explicit signature -#define CV_SIGNATURE_C11 2L // C11 (vc5.x) 32-bit types -#define CV_SIGNATURE_C13 4L // C13 (vc7.x) zero terminated names -#define CV_SIGNATURE_RESERVED 5L // All signatures from 5 to 64K are reserved - -#define CV_MAXOFFSET 0xffffffff - -#ifndef GUID_DEFINED -#define GUID_DEFINED - -typedef struct _GUID { // size is 16 - unsigned long Data1; - unsigned short Data2; - unsigned short Data3; - unsigned char Data4[8]; -} GUID; - -#endif // !GUID_DEFINED - -typedef GUID SIG70; // new to 7.0 are 16-byte guid-like signatures -typedef SIG70 * PSIG70; -typedef const SIG70 * PCSIG70; - - - -/** CodeView Symbol and Type OMF type information is broken up into two - * ranges. Type indices less than 0x1000 describe type information - * that is frequently used. Type indices above 0x1000 are used to - * describe more complex features such as functions, arrays and - * structures. - */ - - - - -/** Primitive types have predefined meaning that is encoded in the - * values of the various bit fields in the value. - * - * A CodeView primitive type is defined as: - * - * 1 1 - * 1 089 7654 3 210 - * r mode type r sub - * - * Where - * mode is the pointer mode - * type is a type indicator - * sub is a subtype enumeration - * r is a reserved field - * - * See Microsoft Symbol and Type OMF (Version 4.0) for more - * information. - */ - - -#define CV_MMASK 0x700 // mode mask -#define CV_TMASK 0x0f0 // type mask - -// can we use the reserved bit ?? -#define CV_SMASK 0x00f // subtype mask - -#define CV_MSHIFT 8 // primitive mode right shift count -#define CV_TSHIFT 4 // primitive type right shift count -#define CV_SSHIFT 0 // primitive subtype right shift count - -// macros to extract primitive mode, type and size - -#define CV_MODE(typ) (((typ) & CV_MMASK) >> CV_MSHIFT) -#define CV_TYPE(typ) (((typ) & CV_TMASK) >> CV_TSHIFT) -#define CV_SUBT(typ) (((typ) & CV_SMASK) >> CV_SSHIFT) - -// macros to insert new primitive mode, type and size - -#define CV_NEWMODE(typ, nm) ((CV_typ_t)(((typ) & ~CV_MMASK) | ((nm) << CV_MSHIFT))) -#define CV_NEWTYPE(typ, nt) (((typ) & ~CV_TMASK) | ((nt) << CV_TSHIFT)) -#define CV_NEWSUBT(typ, ns) (((typ) & ~CV_SMASK) | ((ns) << CV_SSHIFT)) - - - -// pointer mode enumeration values - -typedef enum CV_prmode_e { - CV_TM_DIRECT = 0, // mode is not a pointer - CV_TM_NPTR = 1, // mode is a near pointer - CV_TM_FPTR = 2, // mode is a far pointer - CV_TM_HPTR = 3, // mode is a huge pointer - CV_TM_NPTR32 = 4, // mode is a 32 bit near pointer - CV_TM_FPTR32 = 5, // mode is a 32 bit far pointer - CV_TM_NPTR64 = 6, // mode is a 64 bit near pointer - CV_TM_NPTR128 = 7, // mode is a 128 bit near pointer -} CV_prmode_e; - - - - -// type enumeration values - - -typedef enum CV_type_e { - CV_SPECIAL = 0x00, // special type size values - CV_SIGNED = 0x01, // signed integral size values - CV_UNSIGNED = 0x02, // unsigned integral size values - CV_BOOLEAN = 0x03, // Boolean size values - CV_REAL = 0x04, // real number size values - CV_COMPLEX = 0x05, // complex number size values - CV_SPECIAL2 = 0x06, // second set of special types - CV_INT = 0x07, // integral (int) values - CV_CVRESERVED = 0x0f, -} CV_type_e; - - - - -// subtype enumeration values for CV_SPECIAL - - -typedef enum CV_special_e { - CV_SP_NOTYPE = 0x00, - CV_SP_ABS = 0x01, - CV_SP_SEGMENT = 0x02, - CV_SP_VOID = 0x03, - CV_SP_CURRENCY = 0x04, - CV_SP_NBASICSTR = 0x05, - CV_SP_FBASICSTR = 0x06, - CV_SP_NOTTRANS = 0x07, - CV_SP_HRESULT = 0x08, -} CV_special_e; - - - - -// subtype enumeration values for CV_SPECIAL2 - - -typedef enum CV_special2_e { - CV_S2_BIT = 0x00, - CV_S2_PASCHAR = 0x01, // Pascal CHAR - CV_S2_BOOL32FF = 0x02, // 32-bit BOOL where true is 0xffffffff -} CV_special2_e; - - - - - -// subtype enumeration values for CV_SIGNED, CV_UNSIGNED and CV_BOOLEAN - - -typedef enum CV_integral_e { - CV_IN_1BYTE = 0x00, - CV_IN_2BYTE = 0x01, - CV_IN_4BYTE = 0x02, - CV_IN_8BYTE = 0x03, - CV_IN_16BYTE = 0x04 -} CV_integral_e; - - - - - -// subtype enumeration values for CV_REAL and CV_COMPLEX - - -typedef enum CV_real_e { - CV_RC_REAL32 = 0x00, - CV_RC_REAL64 = 0x01, - CV_RC_REAL80 = 0x02, - CV_RC_REAL128 = 0x03, - CV_RC_REAL48 = 0x04, - CV_RC_REAL32PP = 0x05, // 32-bit partial precision real - CV_RC_REAL16 = 0x06, -} CV_real_e; - - - - -// subtype enumeration values for CV_INT (really int) - - -typedef enum CV_int_e { - CV_RI_CHAR = 0x00, - CV_RI_INT1 = 0x00, - CV_RI_WCHAR = 0x01, - CV_RI_UINT1 = 0x01, - CV_RI_INT2 = 0x02, - CV_RI_UINT2 = 0x03, - CV_RI_INT4 = 0x04, - CV_RI_UINT4 = 0x05, - CV_RI_INT8 = 0x06, - CV_RI_UINT8 = 0x07, - CV_RI_INT16 = 0x08, - CV_RI_UINT16 = 0x09, - CV_RI_CHAR16 = 0x0a, // char16_t - CV_RI_CHAR32 = 0x0b, // char32_t -} CV_int_e; - - - -// macros to check the type of a primitive - -#define CV_TYP_IS_DIRECT(typ) (CV_MODE(typ) == CV_TM_DIRECT) -#define CV_TYP_IS_PTR(typ) (CV_MODE(typ) != CV_TM_DIRECT) -#define CV_TYP_IS_NPTR(typ) (CV_MODE(typ) == CV_TM_NPTR) -#define CV_TYP_IS_FPTR(typ) (CV_MODE(typ) == CV_TM_FPTR) -#define CV_TYP_IS_HPTR(typ) (CV_MODE(typ) == CV_TM_HPTR) -#define CV_TYP_IS_NPTR32(typ) (CV_MODE(typ) == CV_TM_NPTR32) -#define CV_TYP_IS_FPTR32(typ) (CV_MODE(typ) == CV_TM_FPTR32) - -#define CV_TYP_IS_SIGNED(typ) (((CV_TYPE(typ) == CV_SIGNED) && CV_TYP_IS_DIRECT(typ)) || \ - (typ == T_INT1) || \ - (typ == T_INT2) || \ - (typ == T_INT4) || \ - (typ == T_INT8) || \ - (typ == T_INT16) || \ - (typ == T_RCHAR)) - -#define CV_TYP_IS_UNSIGNED(typ) (((CV_TYPE(typ) == CV_UNSIGNED) && CV_TYP_IS_DIRECT(typ)) || \ - (typ == T_UINT1) || \ - (typ == T_UINT2) || \ - (typ == T_UINT4) || \ - (typ == T_UINT8) || \ - (typ == T_UINT16)) - -#define CV_TYP_IS_REAL(typ) ((CV_TYPE(typ) == CV_REAL) && CV_TYP_IS_DIRECT(typ)) - -#define CV_FIRST_NONPRIM 0x1000 -#define CV_IS_PRIMITIVE(typ) ((typ) < CV_FIRST_NONPRIM) -#define CV_TYP_IS_COMPLEX(typ) ((CV_TYPE(typ) == CV_COMPLEX) && CV_TYP_IS_DIRECT(typ)) -#define CV_IS_INTERNAL_PTR(typ) (CV_IS_PRIMITIVE(typ) && \ - CV_TYPE(typ) == CV_CVRESERVED && \ - CV_TYP_IS_PTR(typ)) - - - - - - -// selected values for type_index - for a more complete definition, see -// Microsoft Symbol and Type OMF document - - - - -// Special Types - -typedef enum TYPE_ENUM_e { -// Special Types - - T_NOTYPE = 0x0000, // uncharacterized type (no type) - T_ABS = 0x0001, // absolute symbol - T_SEGMENT = 0x0002, // segment type - T_VOID = 0x0003, // void - T_HRESULT = 0x0008, // OLE/COM HRESULT - T_32PHRESULT = 0x0408, // OLE/COM HRESULT __ptr32 * - T_64PHRESULT = 0x0608, // OLE/COM HRESULT __ptr64 * - - T_PVOID = 0x0103, // near pointer to void - T_PFVOID = 0x0203, // far pointer to void - T_PHVOID = 0x0303, // huge pointer to void - T_32PVOID = 0x0403, // 32 bit pointer to void - T_32PFVOID = 0x0503, // 16:32 pointer to void - T_64PVOID = 0x0603, // 64 bit pointer to void - T_CURRENCY = 0x0004, // BASIC 8 byte currency value - T_NBASICSTR = 0x0005, // Near BASIC string - T_FBASICSTR = 0x0006, // Far BASIC string - T_NOTTRANS = 0x0007, // type not translated by cvpack - T_BIT = 0x0060, // bit - T_PASCHAR = 0x0061, // Pascal CHAR - T_BOOL32FF = 0x0062, // 32-bit BOOL where true is 0xffffffff - - -// Character types - - T_CHAR = 0x0010, // 8 bit signed - T_PCHAR = 0x0110, // 16 bit pointer to 8 bit signed - T_PFCHAR = 0x0210, // 16:16 far pointer to 8 bit signed - T_PHCHAR = 0x0310, // 16:16 huge pointer to 8 bit signed - T_32PCHAR = 0x0410, // 32 bit pointer to 8 bit signed - T_32PFCHAR = 0x0510, // 16:32 pointer to 8 bit signed - T_64PCHAR = 0x0610, // 64 bit pointer to 8 bit signed - - T_UCHAR = 0x0020, // 8 bit unsigned - T_PUCHAR = 0x0120, // 16 bit pointer to 8 bit unsigned - T_PFUCHAR = 0x0220, // 16:16 far pointer to 8 bit unsigned - T_PHUCHAR = 0x0320, // 16:16 huge pointer to 8 bit unsigned - T_32PUCHAR = 0x0420, // 32 bit pointer to 8 bit unsigned - T_32PFUCHAR = 0x0520, // 16:32 pointer to 8 bit unsigned - T_64PUCHAR = 0x0620, // 64 bit pointer to 8 bit unsigned - - -// really a character types - - T_RCHAR = 0x0070, // really a char - T_PRCHAR = 0x0170, // 16 bit pointer to a real char - T_PFRCHAR = 0x0270, // 16:16 far pointer to a real char - T_PHRCHAR = 0x0370, // 16:16 huge pointer to a real char - T_32PRCHAR = 0x0470, // 32 bit pointer to a real char - T_32PFRCHAR = 0x0570, // 16:32 pointer to a real char - T_64PRCHAR = 0x0670, // 64 bit pointer to a real char - - -// really a wide character types - - T_WCHAR = 0x0071, // wide char - T_PWCHAR = 0x0171, // 16 bit pointer to a wide char - T_PFWCHAR = 0x0271, // 16:16 far pointer to a wide char - T_PHWCHAR = 0x0371, // 16:16 huge pointer to a wide char - T_32PWCHAR = 0x0471, // 32 bit pointer to a wide char - T_32PFWCHAR = 0x0571, // 16:32 pointer to a wide char - T_64PWCHAR = 0x0671, // 64 bit pointer to a wide char - -// really a 16-bit unicode char - - T_CHAR16 = 0x007a, // 16-bit unicode char - T_PCHAR16 = 0x017a, // 16 bit pointer to a 16-bit unicode char - T_PFCHAR16 = 0x027a, // 16:16 far pointer to a 16-bit unicode char - T_PHCHAR16 = 0x037a, // 16:16 huge pointer to a 16-bit unicode char - T_32PCHAR16 = 0x047a, // 32 bit pointer to a 16-bit unicode char - T_32PFCHAR16 = 0x057a, // 16:32 pointer to a 16-bit unicode char - T_64PCHAR16 = 0x067a, // 64 bit pointer to a 16-bit unicode char - -// really a 32-bit unicode char - - T_CHAR32 = 0x007b, // 32-bit unicode char - T_PCHAR32 = 0x017b, // 16 bit pointer to a 32-bit unicode char - T_PFCHAR32 = 0x027b, // 16:16 far pointer to a 32-bit unicode char - T_PHCHAR32 = 0x037b, // 16:16 huge pointer to a 32-bit unicode char - T_32PCHAR32 = 0x047b, // 32 bit pointer to a 32-bit unicode char - T_32PFCHAR32 = 0x057b, // 16:32 pointer to a 32-bit unicode char - T_64PCHAR32 = 0x067b, // 64 bit pointer to a 32-bit unicode char - -// 8 bit int types - - T_INT1 = 0x0068, // 8 bit signed int - T_PINT1 = 0x0168, // 16 bit pointer to 8 bit signed int - T_PFINT1 = 0x0268, // 16:16 far pointer to 8 bit signed int - T_PHINT1 = 0x0368, // 16:16 huge pointer to 8 bit signed int - T_32PINT1 = 0x0468, // 32 bit pointer to 8 bit signed int - T_32PFINT1 = 0x0568, // 16:32 pointer to 8 bit signed int - T_64PINT1 = 0x0668, // 64 bit pointer to 8 bit signed int - - T_UINT1 = 0x0069, // 8 bit unsigned int - T_PUINT1 = 0x0169, // 16 bit pointer to 8 bit unsigned int - T_PFUINT1 = 0x0269, // 16:16 far pointer to 8 bit unsigned int - T_PHUINT1 = 0x0369, // 16:16 huge pointer to 8 bit unsigned int - T_32PUINT1 = 0x0469, // 32 bit pointer to 8 bit unsigned int - T_32PFUINT1 = 0x0569, // 16:32 pointer to 8 bit unsigned int - T_64PUINT1 = 0x0669, // 64 bit pointer to 8 bit unsigned int - - -// 16 bit short types - - T_SHORT = 0x0011, // 16 bit signed - T_PSHORT = 0x0111, // 16 bit pointer to 16 bit signed - T_PFSHORT = 0x0211, // 16:16 far pointer to 16 bit signed - T_PHSHORT = 0x0311, // 16:16 huge pointer to 16 bit signed - T_32PSHORT = 0x0411, // 32 bit pointer to 16 bit signed - T_32PFSHORT = 0x0511, // 16:32 pointer to 16 bit signed - T_64PSHORT = 0x0611, // 64 bit pointer to 16 bit signed - - T_USHORT = 0x0021, // 16 bit unsigned - T_PUSHORT = 0x0121, // 16 bit pointer to 16 bit unsigned - T_PFUSHORT = 0x0221, // 16:16 far pointer to 16 bit unsigned - T_PHUSHORT = 0x0321, // 16:16 huge pointer to 16 bit unsigned - T_32PUSHORT = 0x0421, // 32 bit pointer to 16 bit unsigned - T_32PFUSHORT = 0x0521, // 16:32 pointer to 16 bit unsigned - T_64PUSHORT = 0x0621, // 64 bit pointer to 16 bit unsigned - - -// 16 bit int types - - T_INT2 = 0x0072, // 16 bit signed int - T_PINT2 = 0x0172, // 16 bit pointer to 16 bit signed int - T_PFINT2 = 0x0272, // 16:16 far pointer to 16 bit signed int - T_PHINT2 = 0x0372, // 16:16 huge pointer to 16 bit signed int - T_32PINT2 = 0x0472, // 32 bit pointer to 16 bit signed int - T_32PFINT2 = 0x0572, // 16:32 pointer to 16 bit signed int - T_64PINT2 = 0x0672, // 64 bit pointer to 16 bit signed int - - T_UINT2 = 0x0073, // 16 bit unsigned int - T_PUINT2 = 0x0173, // 16 bit pointer to 16 bit unsigned int - T_PFUINT2 = 0x0273, // 16:16 far pointer to 16 bit unsigned int - T_PHUINT2 = 0x0373, // 16:16 huge pointer to 16 bit unsigned int - T_32PUINT2 = 0x0473, // 32 bit pointer to 16 bit unsigned int - T_32PFUINT2 = 0x0573, // 16:32 pointer to 16 bit unsigned int - T_64PUINT2 = 0x0673, // 64 bit pointer to 16 bit unsigned int - - -// 32 bit long types - - T_LONG = 0x0012, // 32 bit signed - T_ULONG = 0x0022, // 32 bit unsigned - T_PLONG = 0x0112, // 16 bit pointer to 32 bit signed - T_PULONG = 0x0122, // 16 bit pointer to 32 bit unsigned - T_PFLONG = 0x0212, // 16:16 far pointer to 32 bit signed - T_PFULONG = 0x0222, // 16:16 far pointer to 32 bit unsigned - T_PHLONG = 0x0312, // 16:16 huge pointer to 32 bit signed - T_PHULONG = 0x0322, // 16:16 huge pointer to 32 bit unsigned - - T_32PLONG = 0x0412, // 32 bit pointer to 32 bit signed - T_32PULONG = 0x0422, // 32 bit pointer to 32 bit unsigned - T_32PFLONG = 0x0512, // 16:32 pointer to 32 bit signed - T_32PFULONG = 0x0522, // 16:32 pointer to 32 bit unsigned - T_64PLONG = 0x0612, // 64 bit pointer to 32 bit signed - T_64PULONG = 0x0622, // 64 bit pointer to 32 bit unsigned - - -// 32 bit int types - - T_INT4 = 0x0074, // 32 bit signed int - T_PINT4 = 0x0174, // 16 bit pointer to 32 bit signed int - T_PFINT4 = 0x0274, // 16:16 far pointer to 32 bit signed int - T_PHINT4 = 0x0374, // 16:16 huge pointer to 32 bit signed int - T_32PINT4 = 0x0474, // 32 bit pointer to 32 bit signed int - T_32PFINT4 = 0x0574, // 16:32 pointer to 32 bit signed int - T_64PINT4 = 0x0674, // 64 bit pointer to 32 bit signed int - - T_UINT4 = 0x0075, // 32 bit unsigned int - T_PUINT4 = 0x0175, // 16 bit pointer to 32 bit unsigned int - T_PFUINT4 = 0x0275, // 16:16 far pointer to 32 bit unsigned int - T_PHUINT4 = 0x0375, // 16:16 huge pointer to 32 bit unsigned int - T_32PUINT4 = 0x0475, // 32 bit pointer to 32 bit unsigned int - T_32PFUINT4 = 0x0575, // 16:32 pointer to 32 bit unsigned int - T_64PUINT4 = 0x0675, // 64 bit pointer to 32 bit unsigned int - - -// 64 bit quad types - - T_QUAD = 0x0013, // 64 bit signed - T_PQUAD = 0x0113, // 16 bit pointer to 64 bit signed - T_PFQUAD = 0x0213, // 16:16 far pointer to 64 bit signed - T_PHQUAD = 0x0313, // 16:16 huge pointer to 64 bit signed - T_32PQUAD = 0x0413, // 32 bit pointer to 64 bit signed - T_32PFQUAD = 0x0513, // 16:32 pointer to 64 bit signed - T_64PQUAD = 0x0613, // 64 bit pointer to 64 bit signed - - T_UQUAD = 0x0023, // 64 bit unsigned - T_PUQUAD = 0x0123, // 16 bit pointer to 64 bit unsigned - T_PFUQUAD = 0x0223, // 16:16 far pointer to 64 bit unsigned - T_PHUQUAD = 0x0323, // 16:16 huge pointer to 64 bit unsigned - T_32PUQUAD = 0x0423, // 32 bit pointer to 64 bit unsigned - T_32PFUQUAD = 0x0523, // 16:32 pointer to 64 bit unsigned - T_64PUQUAD = 0x0623, // 64 bit pointer to 64 bit unsigned - - -// 64 bit int types - - T_INT8 = 0x0076, // 64 bit signed int - T_PINT8 = 0x0176, // 16 bit pointer to 64 bit signed int - T_PFINT8 = 0x0276, // 16:16 far pointer to 64 bit signed int - T_PHINT8 = 0x0376, // 16:16 huge pointer to 64 bit signed int - T_32PINT8 = 0x0476, // 32 bit pointer to 64 bit signed int - T_32PFINT8 = 0x0576, // 16:32 pointer to 64 bit signed int - T_64PINT8 = 0x0676, // 64 bit pointer to 64 bit signed int - - T_UINT8 = 0x0077, // 64 bit unsigned int - T_PUINT8 = 0x0177, // 16 bit pointer to 64 bit unsigned int - T_PFUINT8 = 0x0277, // 16:16 far pointer to 64 bit unsigned int - T_PHUINT8 = 0x0377, // 16:16 huge pointer to 64 bit unsigned int - T_32PUINT8 = 0x0477, // 32 bit pointer to 64 bit unsigned int - T_32PFUINT8 = 0x0577, // 16:32 pointer to 64 bit unsigned int - T_64PUINT8 = 0x0677, // 64 bit pointer to 64 bit unsigned int - - -// 128 bit octet types - - T_OCT = 0x0014, // 128 bit signed - T_POCT = 0x0114, // 16 bit pointer to 128 bit signed - T_PFOCT = 0x0214, // 16:16 far pointer to 128 bit signed - T_PHOCT = 0x0314, // 16:16 huge pointer to 128 bit signed - T_32POCT = 0x0414, // 32 bit pointer to 128 bit signed - T_32PFOCT = 0x0514, // 16:32 pointer to 128 bit signed - T_64POCT = 0x0614, // 64 bit pointer to 128 bit signed - - T_UOCT = 0x0024, // 128 bit unsigned - T_PUOCT = 0x0124, // 16 bit pointer to 128 bit unsigned - T_PFUOCT = 0x0224, // 16:16 far pointer to 128 bit unsigned - T_PHUOCT = 0x0324, // 16:16 huge pointer to 128 bit unsigned - T_32PUOCT = 0x0424, // 32 bit pointer to 128 bit unsigned - T_32PFUOCT = 0x0524, // 16:32 pointer to 128 bit unsigned - T_64PUOCT = 0x0624, // 64 bit pointer to 128 bit unsigned - - -// 128 bit int types - - T_INT16 = 0x0078, // 128 bit signed int - T_PINT16 = 0x0178, // 16 bit pointer to 128 bit signed int - T_PFINT16 = 0x0278, // 16:16 far pointer to 128 bit signed int - T_PHINT16 = 0x0378, // 16:16 huge pointer to 128 bit signed int - T_32PINT16 = 0x0478, // 32 bit pointer to 128 bit signed int - T_32PFINT16 = 0x0578, // 16:32 pointer to 128 bit signed int - T_64PINT16 = 0x0678, // 64 bit pointer to 128 bit signed int - - T_UINT16 = 0x0079, // 128 bit unsigned int - T_PUINT16 = 0x0179, // 16 bit pointer to 128 bit unsigned int - T_PFUINT16 = 0x0279, // 16:16 far pointer to 128 bit unsigned int - T_PHUINT16 = 0x0379, // 16:16 huge pointer to 128 bit unsigned int - T_32PUINT16 = 0x0479, // 32 bit pointer to 128 bit unsigned int - T_32PFUINT16 = 0x0579, // 16:32 pointer to 128 bit unsigned int - T_64PUINT16 = 0x0679, // 64 bit pointer to 128 bit unsigned int - - -// 16 bit real types - - T_REAL16 = 0x0046, // 16 bit real - T_PREAL16 = 0x0146, // 16 bit pointer to 16 bit real - T_PFREAL16 = 0x0246, // 16:16 far pointer to 16 bit real - T_PHREAL16 = 0x0346, // 16:16 huge pointer to 16 bit real - T_32PREAL16 = 0x0446, // 32 bit pointer to 16 bit real - T_32PFREAL16 = 0x0546, // 16:32 pointer to 16 bit real - T_64PREAL16 = 0x0646, // 64 bit pointer to 16 bit real - - -// 32 bit real types - - T_REAL32 = 0x0040, // 32 bit real - T_PREAL32 = 0x0140, // 16 bit pointer to 32 bit real - T_PFREAL32 = 0x0240, // 16:16 far pointer to 32 bit real - T_PHREAL32 = 0x0340, // 16:16 huge pointer to 32 bit real - T_32PREAL32 = 0x0440, // 32 bit pointer to 32 bit real - T_32PFREAL32 = 0x0540, // 16:32 pointer to 32 bit real - T_64PREAL32 = 0x0640, // 64 bit pointer to 32 bit real - - -// 32 bit partial-precision real types - - T_REAL32PP = 0x0045, // 32 bit PP real - T_PREAL32PP = 0x0145, // 16 bit pointer to 32 bit PP real - T_PFREAL32PP = 0x0245, // 16:16 far pointer to 32 bit PP real - T_PHREAL32PP = 0x0345, // 16:16 huge pointer to 32 bit PP real - T_32PREAL32PP = 0x0445, // 32 bit pointer to 32 bit PP real - T_32PFREAL32PP = 0x0545, // 16:32 pointer to 32 bit PP real - T_64PREAL32PP = 0x0645, // 64 bit pointer to 32 bit PP real - - -// 48 bit real types - - T_REAL48 = 0x0044, // 48 bit real - T_PREAL48 = 0x0144, // 16 bit pointer to 48 bit real - T_PFREAL48 = 0x0244, // 16:16 far pointer to 48 bit real - T_PHREAL48 = 0x0344, // 16:16 huge pointer to 48 bit real - T_32PREAL48 = 0x0444, // 32 bit pointer to 48 bit real - T_32PFREAL48 = 0x0544, // 16:32 pointer to 48 bit real - T_64PREAL48 = 0x0644, // 64 bit pointer to 48 bit real - - -// 64 bit real types - - T_REAL64 = 0x0041, // 64 bit real - T_PREAL64 = 0x0141, // 16 bit pointer to 64 bit real - T_PFREAL64 = 0x0241, // 16:16 far pointer to 64 bit real - T_PHREAL64 = 0x0341, // 16:16 huge pointer to 64 bit real - T_32PREAL64 = 0x0441, // 32 bit pointer to 64 bit real - T_32PFREAL64 = 0x0541, // 16:32 pointer to 64 bit real - T_64PREAL64 = 0x0641, // 64 bit pointer to 64 bit real - - -// 80 bit real types - - T_REAL80 = 0x0042, // 80 bit real - T_PREAL80 = 0x0142, // 16 bit pointer to 80 bit real - T_PFREAL80 = 0x0242, // 16:16 far pointer to 80 bit real - T_PHREAL80 = 0x0342, // 16:16 huge pointer to 80 bit real - T_32PREAL80 = 0x0442, // 32 bit pointer to 80 bit real - T_32PFREAL80 = 0x0542, // 16:32 pointer to 80 bit real - T_64PREAL80 = 0x0642, // 64 bit pointer to 80 bit real - - -// 128 bit real types - - T_REAL128 = 0x0043, // 128 bit real - T_PREAL128 = 0x0143, // 16 bit pointer to 128 bit real - T_PFREAL128 = 0x0243, // 16:16 far pointer to 128 bit real - T_PHREAL128 = 0x0343, // 16:16 huge pointer to 128 bit real - T_32PREAL128 = 0x0443, // 32 bit pointer to 128 bit real - T_32PFREAL128 = 0x0543, // 16:32 pointer to 128 bit real - T_64PREAL128 = 0x0643, // 64 bit pointer to 128 bit real - - -// 32 bit complex types - - T_CPLX32 = 0x0050, // 32 bit complex - T_PCPLX32 = 0x0150, // 16 bit pointer to 32 bit complex - T_PFCPLX32 = 0x0250, // 16:16 far pointer to 32 bit complex - T_PHCPLX32 = 0x0350, // 16:16 huge pointer to 32 bit complex - T_32PCPLX32 = 0x0450, // 32 bit pointer to 32 bit complex - T_32PFCPLX32 = 0x0550, // 16:32 pointer to 32 bit complex - T_64PCPLX32 = 0x0650, // 64 bit pointer to 32 bit complex - - -// 64 bit complex types - - T_CPLX64 = 0x0051, // 64 bit complex - T_PCPLX64 = 0x0151, // 16 bit pointer to 64 bit complex - T_PFCPLX64 = 0x0251, // 16:16 far pointer to 64 bit complex - T_PHCPLX64 = 0x0351, // 16:16 huge pointer to 64 bit complex - T_32PCPLX64 = 0x0451, // 32 bit pointer to 64 bit complex - T_32PFCPLX64 = 0x0551, // 16:32 pointer to 64 bit complex - T_64PCPLX64 = 0x0651, // 64 bit pointer to 64 bit complex - - -// 80 bit complex types - - T_CPLX80 = 0x0052, // 80 bit complex - T_PCPLX80 = 0x0152, // 16 bit pointer to 80 bit complex - T_PFCPLX80 = 0x0252, // 16:16 far pointer to 80 bit complex - T_PHCPLX80 = 0x0352, // 16:16 huge pointer to 80 bit complex - T_32PCPLX80 = 0x0452, // 32 bit pointer to 80 bit complex - T_32PFCPLX80 = 0x0552, // 16:32 pointer to 80 bit complex - T_64PCPLX80 = 0x0652, // 64 bit pointer to 80 bit complex - - -// 128 bit complex types - - T_CPLX128 = 0x0053, // 128 bit complex - T_PCPLX128 = 0x0153, // 16 bit pointer to 128 bit complex - T_PFCPLX128 = 0x0253, // 16:16 far pointer to 128 bit complex - T_PHCPLX128 = 0x0353, // 16:16 huge pointer to 128 bit real - T_32PCPLX128 = 0x0453, // 32 bit pointer to 128 bit complex - T_32PFCPLX128 = 0x0553, // 16:32 pointer to 128 bit complex - T_64PCPLX128 = 0x0653, // 64 bit pointer to 128 bit complex - - -// boolean types - - T_BOOL08 = 0x0030, // 8 bit boolean - T_PBOOL08 = 0x0130, // 16 bit pointer to 8 bit boolean - T_PFBOOL08 = 0x0230, // 16:16 far pointer to 8 bit boolean - T_PHBOOL08 = 0x0330, // 16:16 huge pointer to 8 bit boolean - T_32PBOOL08 = 0x0430, // 32 bit pointer to 8 bit boolean - T_32PFBOOL08 = 0x0530, // 16:32 pointer to 8 bit boolean - T_64PBOOL08 = 0x0630, // 64 bit pointer to 8 bit boolean - - T_BOOL16 = 0x0031, // 16 bit boolean - T_PBOOL16 = 0x0131, // 16 bit pointer to 16 bit boolean - T_PFBOOL16 = 0x0231, // 16:16 far pointer to 16 bit boolean - T_PHBOOL16 = 0x0331, // 16:16 huge pointer to 16 bit boolean - T_32PBOOL16 = 0x0431, // 32 bit pointer to 18 bit boolean - T_32PFBOOL16 = 0x0531, // 16:32 pointer to 16 bit boolean - T_64PBOOL16 = 0x0631, // 64 bit pointer to 18 bit boolean - - T_BOOL32 = 0x0032, // 32 bit boolean - T_PBOOL32 = 0x0132, // 16 bit pointer to 32 bit boolean - T_PFBOOL32 = 0x0232, // 16:16 far pointer to 32 bit boolean - T_PHBOOL32 = 0x0332, // 16:16 huge pointer to 32 bit boolean - T_32PBOOL32 = 0x0432, // 32 bit pointer to 32 bit boolean - T_32PFBOOL32 = 0x0532, // 16:32 pointer to 32 bit boolean - T_64PBOOL32 = 0x0632, // 64 bit pointer to 32 bit boolean - - T_BOOL64 = 0x0033, // 64 bit boolean - T_PBOOL64 = 0x0133, // 16 bit pointer to 64 bit boolean - T_PFBOOL64 = 0x0233, // 16:16 far pointer to 64 bit boolean - T_PHBOOL64 = 0x0333, // 16:16 huge pointer to 64 bit boolean - T_32PBOOL64 = 0x0433, // 32 bit pointer to 64 bit boolean - T_32PFBOOL64 = 0x0533, // 16:32 pointer to 64 bit boolean - T_64PBOOL64 = 0x0633, // 64 bit pointer to 64 bit boolean - - -// ??? - - T_NCVPTR = 0x01f0, // CV Internal type for created near pointers - T_FCVPTR = 0x02f0, // CV Internal type for created far pointers - T_HCVPTR = 0x03f0, // CV Internal type for created huge pointers - T_32NCVPTR = 0x04f0, // CV Internal type for created near 32-bit pointers - T_32FCVPTR = 0x05f0, // CV Internal type for created far 32-bit pointers - T_64NCVPTR = 0x06f0, // CV Internal type for created near 64-bit pointers - -} TYPE_ENUM_e; - -/** No leaf index can have a value of 0x0000. The leaf indices are - * separated into ranges depending upon the use of the type record. - * The second range is for the type records that are directly referenced - * in symbols. The first range is for type records that are not - * referenced by symbols but instead are referenced by other type - * records. All type records must have a starting leaf index in these - * first two ranges. The third range of leaf indices are used to build - * up complex lists such as the field list of a class type record. No - * type record can begin with one of the leaf indices. The fourth ranges - * of type indices are used to represent numeric data in a symbol or - * type record. These leaf indices are greater than 0x8000. At the - * point that type or symbol processor is expecting a numeric field, the - * next two bytes in the type record are examined. If the value is less - * than 0x8000, then the two bytes contain the numeric value. If the - * value is greater than 0x8000, then the data follows the leaf index in - * a format specified by the leaf index. The final range of leaf indices - * are used to force alignment of subfields within a complex type record.. - */ - - -typedef enum LEAF_ENUM_e { - // leaf indices starting records but referenced from symbol records - - LF_MODIFIER_16t = 0x0001, - LF_POINTER_16t = 0x0002, - LF_ARRAY_16t = 0x0003, - LF_CLASS_16t = 0x0004, - LF_STRUCTURE_16t = 0x0005, - LF_UNION_16t = 0x0006, - LF_ENUM_16t = 0x0007, - LF_PROCEDURE_16t = 0x0008, - LF_MFUNCTION_16t = 0x0009, - LF_VTSHAPE = 0x000a, - LF_COBOL0_16t = 0x000b, - LF_COBOL1 = 0x000c, - LF_BARRAY_16t = 0x000d, - LF_LABEL = 0x000e, - LF_NULL = 0x000f, - LF_NOTTRAN = 0x0010, - LF_DIMARRAY_16t = 0x0011, - LF_VFTPATH_16t = 0x0012, - LF_PRECOMP_16t = 0x0013, // not referenced from symbol - LF_ENDPRECOMP = 0x0014, // not referenced from symbol - LF_OEM_16t = 0x0015, // oem definable type string - LF_TYPESERVER_ST = 0x0016, // not referenced from symbol - - // leaf indices starting records but referenced only from type records - - LF_SKIP_16t = 0x0200, - LF_ARGLIST_16t = 0x0201, - LF_DEFARG_16t = 0x0202, - LF_LIST = 0x0203, - LF_FIELDLIST_16t = 0x0204, - LF_DERIVED_16t = 0x0205, - LF_BITFIELD_16t = 0x0206, - LF_METHODLIST_16t = 0x0207, - LF_DIMCONU_16t = 0x0208, - LF_DIMCONLU_16t = 0x0209, - LF_DIMVARU_16t = 0x020a, - LF_DIMVARLU_16t = 0x020b, - LF_REFSYM = 0x020c, - - LF_BCLASS_16t = 0x0400, - LF_VBCLASS_16t = 0x0401, - LF_IVBCLASS_16t = 0x0402, - LF_ENUMERATE_ST = 0x0403, - LF_FRIENDFCN_16t = 0x0404, - LF_INDEX_16t = 0x0405, - LF_MEMBER_16t = 0x0406, - LF_STMEMBER_16t = 0x0407, - LF_METHOD_16t = 0x0408, - LF_NESTTYPE_16t = 0x0409, - LF_VFUNCTAB_16t = 0x040a, - LF_FRIENDCLS_16t = 0x040b, - LF_ONEMETHOD_16t = 0x040c, - LF_VFUNCOFF_16t = 0x040d, - -// 32-bit type index versions of leaves, all have the 0x1000 bit set -// - LF_TI16_MAX = 0x1000, - - LF_MODIFIER = 0x1001, - LF_POINTER = 0x1002, - LF_ARRAY_ST = 0x1003, - LF_CLASS_ST = 0x1004, - LF_STRUCTURE_ST = 0x1005, - LF_UNION_ST = 0x1006, - LF_ENUM_ST = 0x1007, - LF_PROCEDURE = 0x1008, - LF_MFUNCTION = 0x1009, - LF_COBOL0 = 0x100a, - LF_BARRAY = 0x100b, - LF_DIMARRAY_ST = 0x100c, - LF_VFTPATH = 0x100d, - LF_PRECOMP_ST = 0x100e, // not referenced from symbol - LF_OEM = 0x100f, // oem definable type string - LF_ALIAS_ST = 0x1010, // alias (typedef) type - LF_OEM2 = 0x1011, // oem definable type string - - // leaf indices starting records but referenced only from type records - - LF_SKIP = 0x1200, - LF_ARGLIST = 0x1201, - LF_DEFARG_ST = 0x1202, - LF_FIELDLIST = 0x1203, - LF_DERIVED = 0x1204, - LF_BITFIELD = 0x1205, - LF_METHODLIST = 0x1206, - LF_DIMCONU = 0x1207, - LF_DIMCONLU = 0x1208, - LF_DIMVARU = 0x1209, - LF_DIMVARLU = 0x120a, - - LF_BCLASS = 0x1400, - LF_VBCLASS = 0x1401, - LF_IVBCLASS = 0x1402, - LF_FRIENDFCN_ST = 0x1403, - LF_INDEX = 0x1404, - LF_MEMBER_ST = 0x1405, - LF_STMEMBER_ST = 0x1406, - LF_METHOD_ST = 0x1407, - LF_NESTTYPE_ST = 0x1408, - LF_VFUNCTAB = 0x1409, - LF_FRIENDCLS = 0x140a, - LF_ONEMETHOD_ST = 0x140b, - LF_VFUNCOFF = 0x140c, - LF_NESTTYPEEX_ST = 0x140d, - LF_MEMBERMODIFY_ST = 0x140e, - LF_MANAGED_ST = 0x140f, - - // Types w/ SZ names - - LF_ST_MAX = 0x1500, - - LF_TYPESERVER = 0x1501, // not referenced from symbol - LF_ENUMERATE = 0x1502, - LF_ARRAY = 0x1503, - LF_CLASS = 0x1504, - LF_STRUCTURE = 0x1505, - LF_UNION = 0x1506, - LF_ENUM = 0x1507, - LF_DIMARRAY = 0x1508, - LF_PRECOMP = 0x1509, // not referenced from symbol - LF_ALIAS = 0x150a, // alias (typedef) type - LF_DEFARG = 0x150b, - LF_FRIENDFCN = 0x150c, - LF_MEMBER = 0x150d, - LF_STMEMBER = 0x150e, - LF_METHOD = 0x150f, - LF_NESTTYPE = 0x1510, - LF_ONEMETHOD = 0x1511, - LF_NESTTYPEEX = 0x1512, - LF_MEMBERMODIFY = 0x1513, - LF_MANAGED = 0x1514, - LF_TYPESERVER2 = 0x1515, - - LF_STRIDED_ARRAY = 0x1516, // same as LF_ARRAY, but with stride between adjacent elements - LF_HLSL = 0x1517, - LF_MODIFIER_EX = 0x1518, - LF_INTERFACE = 0x1519, - LF_BINTERFACE = 0x151a, - LF_VECTOR = 0x151b, - LF_MATRIX = 0x151c, - - LF_VFTABLE = 0x151d, // a virtual function table - LF_ENDOFLEAFRECORD = LF_VFTABLE, - - LF_TYPE_LAST, // one greater than the last type record - LF_TYPE_MAX = LF_TYPE_LAST - 1, - - LF_FUNC_ID = 0x1601, // global func ID - LF_MFUNC_ID = 0x1602, // member func ID - LF_BUILDINFO = 0x1603, // build info: tool, version, command line, src/pdb file - LF_SUBSTR_LIST = 0x1604, // similar to LF_ARGLIST, for list of sub strings - LF_STRING_ID = 0x1605, // string ID - - LF_UDT_SRC_LINE = 0x1606, // source and line on where an UDT is defined - // only generated by compiler - - LF_UDT_MOD_SRC_LINE = 0x1607, // module, source and line on where an UDT is defined - // only generated by linker - - LF_ID_LAST, // one greater than the last ID record - LF_ID_MAX = LF_ID_LAST - 1, - - LF_NUMERIC = 0x8000, - LF_CHAR = 0x8000, - LF_SHORT = 0x8001, - LF_USHORT = 0x8002, - LF_LONG = 0x8003, - LF_ULONG = 0x8004, - LF_REAL32 = 0x8005, - LF_REAL64 = 0x8006, - LF_REAL80 = 0x8007, - LF_REAL128 = 0x8008, - LF_QUADWORD = 0x8009, - LF_UQUADWORD = 0x800a, - LF_REAL48 = 0x800b, - LF_COMPLEX32 = 0x800c, - LF_COMPLEX64 = 0x800d, - LF_COMPLEX80 = 0x800e, - LF_COMPLEX128 = 0x800f, - LF_VARSTRING = 0x8010, - - LF_OCTWORD = 0x8017, - LF_UOCTWORD = 0x8018, - - LF_DECIMAL = 0x8019, - LF_DATE = 0x801a, - LF_UTF8STRING = 0x801b, - - LF_REAL16 = 0x801c, - - LF_PAD0 = 0xf0, - LF_PAD1 = 0xf1, - LF_PAD2 = 0xf2, - LF_PAD3 = 0xf3, - LF_PAD4 = 0xf4, - LF_PAD5 = 0xf5, - LF_PAD6 = 0xf6, - LF_PAD7 = 0xf7, - LF_PAD8 = 0xf8, - LF_PAD9 = 0xf9, - LF_PAD10 = 0xfa, - LF_PAD11 = 0xfb, - LF_PAD12 = 0xfc, - LF_PAD13 = 0xfd, - LF_PAD14 = 0xfe, - LF_PAD15 = 0xff, - -} LEAF_ENUM_e; - -// end of leaf indices - - - - -// Type enum for pointer records -// Pointers can be one of the following types - - -typedef enum CV_ptrtype_e { - CV_PTR_NEAR = 0x00, // 16 bit pointer - CV_PTR_FAR = 0x01, // 16:16 far pointer - CV_PTR_HUGE = 0x02, // 16:16 huge pointer - CV_PTR_BASE_SEG = 0x03, // based on segment - CV_PTR_BASE_VAL = 0x04, // based on value of base - CV_PTR_BASE_SEGVAL = 0x05, // based on segment value of base - CV_PTR_BASE_ADDR = 0x06, // based on address of base - CV_PTR_BASE_SEGADDR = 0x07, // based on segment address of base - CV_PTR_BASE_TYPE = 0x08, // based on type - CV_PTR_BASE_SELF = 0x09, // based on self - CV_PTR_NEAR32 = 0x0a, // 32 bit pointer - CV_PTR_FAR32 = 0x0b, // 16:32 pointer - CV_PTR_64 = 0x0c, // 64 bit pointer - CV_PTR_UNUSEDPTR = 0x0d // first unused pointer type -} CV_ptrtype_e; - - - - - -// Mode enum for pointers -// Pointers can have one of the following modes -// -// To support for l-value and r-value reference, we added CV_PTR_MODE_LVREF -// and CV_PTR_MODE_RVREF. CV_PTR_MODE_REF should be removed at some point. -// We keep it now so that old code that uses it won't be broken. -// - -typedef enum CV_ptrmode_e { - CV_PTR_MODE_PTR = 0x00, // "normal" pointer - CV_PTR_MODE_REF = 0x01, // "old" reference - CV_PTR_MODE_LVREF = 0x01, // l-value reference - CV_PTR_MODE_PMEM = 0x02, // pointer to data member - CV_PTR_MODE_PMFUNC = 0x03, // pointer to member function - CV_PTR_MODE_RVREF = 0x04, // r-value reference - CV_PTR_MODE_RESERVED= 0x05 // first unused pointer mode -} CV_ptrmode_e; - - -// enumeration for pointer-to-member types - -typedef enum CV_pmtype_e { - CV_PMTYPE_Undef = 0x00, // not specified (pre VC8) - CV_PMTYPE_D_Single = 0x01, // member data, single inheritance - CV_PMTYPE_D_Multiple= 0x02, // member data, multiple inheritance - CV_PMTYPE_D_Virtual = 0x03, // member data, virtual inheritance - CV_PMTYPE_D_General = 0x04, // member data, most general - CV_PMTYPE_F_Single = 0x05, // member function, single inheritance - CV_PMTYPE_F_Multiple= 0x06, // member function, multiple inheritance - CV_PMTYPE_F_Virtual = 0x07, // member function, virtual inheritance - CV_PMTYPE_F_General = 0x08, // member function, most general -} CV_pmtype_e; - -// enumeration for method properties - -typedef enum CV_methodprop_e { - CV_MTvanilla = 0x00, - CV_MTvirtual = 0x01, - CV_MTstatic = 0x02, - CV_MTfriend = 0x03, - CV_MTintro = 0x04, - CV_MTpurevirt = 0x05, - CV_MTpureintro = 0x06 -} CV_methodprop_e; - - - - -// enumeration for virtual shape table entries - -typedef enum CV_VTS_desc_e { - CV_VTS_near = 0x00, - CV_VTS_far = 0x01, - CV_VTS_thin = 0x02, - CV_VTS_outer = 0x03, - CV_VTS_meta = 0x04, - CV_VTS_near32 = 0x05, - CV_VTS_far32 = 0x06, - CV_VTS_unused = 0x07 -} CV_VTS_desc_e; - - - - -// enumeration for LF_LABEL address modes - -typedef enum CV_LABEL_TYPE_e { - CV_LABEL_NEAR = 0, // near return - CV_LABEL_FAR = 4 // far return -} CV_LABEL_TYPE_e; - - - -// enumeration for LF_MODIFIER values - - -typedef struct CV_modifier_t { - unsigned short MOD_const :1; - unsigned short MOD_volatile :1; - unsigned short MOD_unaligned :1; - unsigned short MOD_unused :13; -} CV_modifier_t; - - - - -// enumeration for HFA kinds - -typedef enum CV_HFA_e { - CV_HFA_none = 0, - CV_HFA_float = 1, - CV_HFA_double = 2, - CV_HFA_other = 3 -} CV_HFA_e; - -// enumeration for MoCOM UDT kinds - -typedef enum CV_MOCOM_UDT_e { - CV_MOCOM_UDT_none = 0, - CV_MOCOM_UDT_ref = 1, - CV_MOCOM_UDT_value = 2, - CV_MOCOM_UDT_interface = 3 -} CV_MOCOM_UDT_e; - -// bit field structure describing class/struct/union/enum properties - -typedef struct CV_prop_t { - unsigned short packed :1; // true if structure is packed - unsigned short ctor :1; // true if constructors or destructors present - unsigned short ovlops :1; // true if overloaded operators present - unsigned short isnested :1; // true if this is a nested class - unsigned short cnested :1; // true if this class contains nested types - unsigned short opassign :1; // true if overloaded assignment (=) - unsigned short opcast :1; // true if casting methods - unsigned short fwdref :1; // true if forward reference (incomplete defn) - unsigned short scoped :1; // scoped definition - unsigned short hasuniquename :1; // true if there is a decorated name following the regular name - unsigned short sealed :1; // true if class cannot be used as a base class - unsigned short hfa :2; // CV_HFA_e - unsigned short intrinsic :1; // true if class is an intrinsic type (e.g. __m128d) - unsigned short mocom :2; // CV_MOCOM_UDT_e -} CV_prop_t; - - - - -// class field attribute - -typedef struct CV_fldattr_t { - unsigned short access :2; // access protection CV_access_t - unsigned short mprop :3; // method properties CV_methodprop_t - unsigned short pseudo :1; // compiler generated fcn and does not exist - unsigned short noinherit :1; // true if class cannot be inherited - unsigned short noconstruct :1; // true if class cannot be constructed - unsigned short compgenx :1; // compiler generated fcn and does exist - unsigned short sealed :1; // true if method cannot be overridden - unsigned short unused :6; // unused -} CV_fldattr_t; - - -// function flags - -typedef struct CV_funcattr_t { - unsigned char cxxreturnudt :1; // true if C++ style ReturnUDT - unsigned char ctor :1; // true if func is an instance constructor - unsigned char ctorvbase :1; // true if func is an instance constructor of a class with virtual bases - unsigned char unused :5; // unused -} CV_funcattr_t; - - -// matrix flags - -typedef struct CV_matrixattr_t { - unsigned char row_major :1; // true if matrix has row-major layout (column-major is default) - unsigned char unused :7; // unused -} CV_matrixattr_t; - - -// Structures to access to the type records - - -typedef struct TYPTYPE { - unsigned short len; - unsigned short leaf; - unsigned char data[CV_ZEROLEN]; -} TYPTYPE; // general types record - -__INLINE char *NextType ( _In_ char * pType) { - return (pType + ((TYPTYPE *)pType)->len + sizeof(unsigned short)); -} - -typedef enum CV_PMEMBER { - CV_PDM16_NONVIRT = 0x00, // 16:16 data no virtual fcn or base - CV_PDM16_VFCN = 0x01, // 16:16 data with virtual functions - CV_PDM16_VBASE = 0x02, // 16:16 data with virtual bases - CV_PDM32_NVVFCN = 0x03, // 16:32 data w/wo virtual functions - CV_PDM32_VBASE = 0x04, // 16:32 data with virtual bases - - CV_PMF16_NEARNVSA = 0x05, // 16:16 near method nonvirtual single address point - CV_PMF16_NEARNVMA = 0x06, // 16:16 near method nonvirtual multiple address points - CV_PMF16_NEARVBASE = 0x07, // 16:16 near method virtual bases - CV_PMF16_FARNVSA = 0x08, // 16:16 far method nonvirtual single address point - CV_PMF16_FARNVMA = 0x09, // 16:16 far method nonvirtual multiple address points - CV_PMF16_FARVBASE = 0x0a, // 16:16 far method virtual bases - - CV_PMF32_NVSA = 0x0b, // 16:32 method nonvirtual single address point - CV_PMF32_NVMA = 0x0c, // 16:32 method nonvirtual multiple address point - CV_PMF32_VBASE = 0x0d // 16:32 method virtual bases -} CV_PMEMBER; - - - -// memory representation of pointer to member. These representations are -// indexed by the enumeration above in the LF_POINTER record - - - - -// representation of a 16:16 pointer to data for a class with no -// virtual functions or virtual bases - - -struct CV_PDMR16_NONVIRT { - CV_off16_t mdisp; // displacement to data (NULL = -1) -}; - - - - -// representation of a 16:16 pointer to data for a class with virtual -// functions - - -struct CV_PMDR16_VFCN { - CV_off16_t mdisp; // displacement to data ( NULL = 0) -}; - - - - -// representation of a 16:16 pointer to data for a class with -// virtual bases - - -struct CV_PDMR16_VBASE { - CV_off16_t mdisp; // displacement to data - CV_off16_t pdisp; // this pointer displacement to vbptr - CV_off16_t vdisp; // displacement within vbase table - // NULL = (,,0xffff) -}; - - - - -// representation of a 32 bit pointer to data for a class with -// or without virtual functions and no virtual bases - - -struct CV_PDMR32_NVVFCN { - CV_off32_t mdisp; // displacement to data (NULL = 0x80000000) -}; - - - - -// representation of a 32 bit pointer to data for a class -// with virtual bases - - -struct CV_PDMR32_VBASE { - CV_off32_t mdisp; // displacement to data - CV_off32_t pdisp; // this pointer displacement - CV_off32_t vdisp; // vbase table displacement - // NULL = (,,0xffffffff) -}; - - - - -// representation of a 16:16 pointer to near member function for a -// class with no virtual functions or bases and a single address point - - -struct CV_PMFR16_NEARNVSA { - CV_uoff16_t off; // near address of function (NULL = 0) -}; - - - -// representation of a 16 bit pointer to member functions of a -// class with no virtual bases and multiple address points - - -struct CV_PMFR16_NEARNVMA { - CV_uoff16_t off; // offset of function (NULL = 0,x) - signed short disp; -}; - - - - -// representation of a 16 bit pointer to member function of a -// class with virtual bases - - -struct CV_PMFR16_NEARVBASE { - CV_uoff16_t off; // offset of function (NULL = 0,x,x,x) - CV_off16_t mdisp; // displacement to data - CV_off16_t pdisp; // this pointer displacement - CV_off16_t vdisp; // vbase table displacement -}; - - - - -// representation of a 16:16 pointer to far member function for a -// class with no virtual bases and a single address point - - -struct CV_PMFR16_FARNVSA { - CV_uoff16_t off; // offset of function (NULL = 0:0) - unsigned short seg; // segment of function -}; - - - - -// representation of a 16:16 far pointer to member functions of a -// class with no virtual bases and multiple address points - - -struct CV_PMFR16_FARNVMA { - CV_uoff16_t off; // offset of function (NULL = 0:0,x) - unsigned short seg; - signed short disp; -}; - - - - -// representation of a 16:16 far pointer to member function of a -// class with virtual bases - - -struct CV_PMFR16_FARVBASE { - CV_uoff16_t off; // offset of function (NULL = 0:0,x,x,x) - unsigned short seg; - CV_off16_t mdisp; // displacement to data - CV_off16_t pdisp; // this pointer displacement - CV_off16_t vdisp; // vbase table displacement - -}; - - - - -// representation of a 32 bit pointer to member function for a -// class with no virtual bases and a single address point - - -struct CV_PMFR32_NVSA { - CV_uoff32_t off; // near address of function (NULL = 0L) -}; - - - - -// representation of a 32 bit pointer to member function for a -// class with no virtual bases and multiple address points - - -struct CV_PMFR32_NVMA { - CV_uoff32_t off; // near address of function (NULL = 0L,x) - CV_off32_t disp; -}; - - - - -// representation of a 32 bit pointer to member function for a -// class with virtual bases - - -struct CV_PMFR32_VBASE { - CV_uoff32_t off; // near address of function (NULL = 0L,x,x,x) - CV_off32_t mdisp; // displacement to data - CV_off32_t pdisp; // this pointer displacement - CV_off32_t vdisp; // vbase table displacement -}; - - - - - -// Easy leaf - used for generic casting to reference leaf field -// of a subfield of a complex list - -typedef struct lfEasy { - unsigned short leaf; // LF_... -} lfEasy; - - -/** The following type records are basically variant records of the - * above structure. The "unsigned short leaf" of the above structure and - * the "unsigned short leaf" of the following type definitions are the same - * symbol. When the OMF record is locked via the MHOMFLock API - * call, the address of the "unsigned short leaf" is returned - */ - -/** Notes on alignment - * Alignment of the fields in most of the type records is done on the - * basis of the TYPTYPE record base. That is why in most of the lf* - * records that the CV_typ_t (32-bit types) is located on what appears to - * be a offset mod 4 == 2 boundary. The exception to this rule are those - * records that are in a list (lfFieldList, lfMethodList), which are - * aligned to their own bases since they don't have the length field - */ - -/**** Change log for 16-bit to 32-bit type and symbol records - - Record type Change (f == field arrangement, p = padding added) - ---------------------------------------------------------------------- - lfModifier f - lfPointer fp - lfClass f - lfStructure f - lfUnion f - lfEnum f - lfVFTPath p - lfPreComp p - lfOEM p - lfArgList p - lfDerived p - mlMethod p (method list member) - lfBitField f - lfDimCon f - lfDimVar p - lfIndex p (field list member) - lfBClass f (field list member) - lfVBClass f (field list member) - lfFriendCls p (field list member) - lfFriendFcn p (field list member) - lfMember f (field list member) - lfSTMember f (field list member) - lfVFuncTab p (field list member) - lfVFuncOff p (field list member) - lfNestType p (field list member) - - DATASYM32 f - PROCSYM32 f - VPATHSYM32 f - REGREL32 f - THREADSYM32 f - PROCSYMMIPS f - - -*/ - -// Type record for LF_MODIFIER - -typedef struct lfModifier_16t { - unsigned short leaf; // LF_MODIFIER_16t - CV_modifier_t attr; // modifier attribute modifier_t - CV_typ16_t type; // modified type -} lfModifier_16t; - -typedef struct lfModifier { - unsigned short leaf; // LF_MODIFIER - CV_typ_t type; // modified type - CV_modifier_t attr; // modifier attribute modifier_t -} lfModifier; - - - - -// type record for LF_POINTER - -#ifndef __cplusplus -typedef struct lfPointer_16t { -#endif - struct lfPointerBody_16t { - unsigned short leaf; // LF_POINTER_16t - struct lfPointerAttr_16t { - unsigned char ptrtype :5; // ordinal specifying pointer type (CV_ptrtype_e) - unsigned char ptrmode :3; // ordinal specifying pointer mode (CV_ptrmode_e) - unsigned char isflat32 :1; // true if 0:32 pointer - unsigned char isvolatile :1; // TRUE if volatile pointer - unsigned char isconst :1; // TRUE if const pointer - unsigned char isunaligned :1; // TRUE if unaligned pointer - unsigned char unused :4; - } attr; - CV_typ16_t utype; // type index of the underlying type -#if (defined(__cplusplus) || defined(_MSC_VER)) // for C++ and MS compilers that support unnamed unions - }; -#else - } u; -#endif -#ifdef __cplusplus -typedef struct lfPointer_16t : public lfPointerBody_16t { -#endif - union { - struct { - CV_typ16_t pmclass; // index of containing class for pointer to member - unsigned short pmenum; // enumeration specifying pm format (CV_pmtype_e) - } pm; - unsigned short bseg; // base segment if PTR_BASE_SEG - unsigned char Sym[1]; // copy of base symbol record (including length) - struct { - CV_typ16_t index; // type index if CV_PTR_BASE_TYPE - unsigned char name[1]; // name of base type - } btype; - } pbase; -} lfPointer_16t; - -#ifndef __cplusplus -typedef struct lfPointer { -#endif - struct lfPointerBody { - unsigned short leaf; // LF_POINTER - CV_typ_t utype; // type index of the underlying type - struct lfPointerAttr { - unsigned long ptrtype :5; // ordinal specifying pointer type (CV_ptrtype_e) - unsigned long ptrmode :3; // ordinal specifying pointer mode (CV_ptrmode_e) - unsigned long isflat32 :1; // true if 0:32 pointer - unsigned long isvolatile :1; // TRUE if volatile pointer - unsigned long isconst :1; // TRUE if const pointer - unsigned long isunaligned :1; // TRUE if unaligned pointer - unsigned long isrestrict :1; // TRUE if restricted pointer (allow agressive opts) - unsigned long size :6; // size of pointer (in bytes) - unsigned long ismocom :1; // TRUE if it is a MoCOM pointer (^ or %) - unsigned long islref :1; // TRUE if it is this pointer of member function with & ref-qualifier - unsigned long isrref :1; // TRUE if it is this pointer of member function with && ref-qualifier - unsigned long unused :10;// pad out to 32-bits for following cv_typ_t's - } attr; -#if (defined(__cplusplus) || defined(_MSC_VER)) // for C++ and MS compilers that support unnamed unions - }; -#else - } u; -#endif -#ifdef __cplusplus -typedef struct lfPointer : public lfPointerBody { -#endif - union { - struct { - CV_typ_t pmclass; // index of containing class for pointer to member - unsigned short pmenum; // enumeration specifying pm format (CV_pmtype_e) - } pm; - unsigned short bseg; // base segment if PTR_BASE_SEG - unsigned char Sym[1]; // copy of base symbol record (including length) - struct { - CV_typ_t index; // type index if CV_PTR_BASE_TYPE - unsigned char name[1]; // name of base type - } btype; - } pbase; -} lfPointer; - - - - -// type record for LF_ARRAY - - -typedef struct lfArray_16t { - unsigned short leaf; // LF_ARRAY_16t - CV_typ16_t elemtype; // type index of element type - CV_typ16_t idxtype; // type index of indexing type - unsigned char data[CV_ZEROLEN]; // variable length data specifying - // size in bytes and name -} lfArray_16t; - -typedef struct lfArray { - unsigned short leaf; // LF_ARRAY - CV_typ_t elemtype; // type index of element type - CV_typ_t idxtype; // type index of indexing type - unsigned char data[CV_ZEROLEN]; // variable length data specifying - // size in bytes and name -} lfArray; - -typedef struct lfStridedArray { - unsigned short leaf; // LF_STRIDED_ARRAY - CV_typ_t elemtype; // type index of element type - CV_typ_t idxtype; // type index of indexing type - unsigned long stride; - unsigned char data[CV_ZEROLEN]; // variable length data specifying - // size in bytes and name -} lfStridedArray; - - - - -// type record for LF_VECTOR - - -typedef struct lfVector { - unsigned short leaf; // LF_VECTOR - CV_typ_t elemtype; // type index of element type - unsigned long count; // number of elements in the vector - unsigned char data[CV_ZEROLEN]; // variable length data specifying - // size in bytes and name -} lfVector; - - - - -// type record for LF_MATRIX - - -typedef struct lfMatrix { - unsigned short leaf; // LF_MATRIX - CV_typ_t elemtype; // type index of element type - unsigned long rows; // number of rows - unsigned long cols; // number of columns - unsigned long majorStride; - CV_matrixattr_t matattr; // attributes - unsigned char data[CV_ZEROLEN]; // variable length data specifying - // size in bytes and name -} lfMatrix; - - - - -// type record for LF_CLASS, LF_STRUCTURE - - -typedef struct lfClass_16t { - unsigned short leaf; // LF_CLASS_16t, LF_STRUCT_16t - unsigned short count; // count of number of elements in class - CV_typ16_t field; // type index of LF_FIELD descriptor list - CV_prop_t property; // property attribute field (prop_t) - CV_typ16_t derived; // type index of derived from list if not zero - CV_typ16_t vshape; // type index of vshape table for this class - unsigned char data[CV_ZEROLEN]; // data describing length of structure in - // bytes and name -} lfClass_16t; -typedef lfClass_16t lfStructure_16t; - - -typedef struct lfClass { - unsigned short leaf; // LF_CLASS, LF_STRUCT, LF_INTERFACE - unsigned short count; // count of number of elements in class - CV_prop_t property; // property attribute field (prop_t) - CV_typ_t field; // type index of LF_FIELD descriptor list - CV_typ_t derived; // type index of derived from list if not zero - CV_typ_t vshape; // type index of vshape table for this class - unsigned char data[CV_ZEROLEN]; // data describing length of structure in - // bytes and name -} lfClass; -typedef lfClass lfStructure; -typedef lfClass lfInterface; - -// type record for LF_UNION - - -typedef struct lfUnion_16t { - unsigned short leaf; // LF_UNION_16t - unsigned short count; // count of number of elements in class - CV_typ16_t field; // type index of LF_FIELD descriptor list - CV_prop_t property; // property attribute field - unsigned char data[CV_ZEROLEN]; // variable length data describing length of - // structure and name -} lfUnion_16t; - - -typedef struct lfUnion { - unsigned short leaf; // LF_UNION - unsigned short count; // count of number of elements in class - CV_prop_t property; // property attribute field - CV_typ_t field; // type index of LF_FIELD descriptor list - unsigned char data[CV_ZEROLEN]; // variable length data describing length of - // structure and name -} lfUnion; - - -// type record for LF_ALIAS - -typedef struct lfAlias { - unsigned short leaf; // LF_ALIAS - CV_typ_t utype; // underlying type - unsigned char Name[1]; // alias name -} lfAlias; - -// Item Id is a stricter typeindex which may referenced from symbol stream. -// The code item always had a name. - -typedef CV_typ_t CV_ItemId; - -typedef struct lfFuncId { - unsigned short leaf; // LF_FUNC_ID - CV_ItemId scopeId; // parent scope of the ID, 0 if global - CV_typ_t type; // function type - unsigned char name[CV_ZEROLEN]; -} lfFuncId; - -typedef struct lfMFuncId { - unsigned short leaf; // LF_MFUNC_ID - CV_typ_t parentType; // type index of parent - CV_typ_t type; // function type - unsigned char name[CV_ZEROLEN]; -} lfMFuncId; - -typedef struct lfStringId { - unsigned short leaf; // LF_STRING_ID - CV_ItemId id; // ID to list of sub string IDs - unsigned char name[CV_ZEROLEN]; -} lfStringId; - -typedef struct lfUdtSrcLine { - unsigned short leaf; // LF_UDT_SRC_LINE - CV_typ_t type; // UDT's type index - CV_ItemId src; // index to LF_STRING_ID record where source file name is saved - unsigned long line; // line number -} lfUdtSrcLine; - -typedef struct lfUdtModSrcLine { - unsigned short leaf; // LF_UDT_MOD_SRC_LINE - CV_typ_t type; // UDT's type index - CV_ItemId src; // index into string table where source file name is saved - unsigned long line; // line number - unsigned short imod; // module that contributes this UDT definition -} lfUdtModSrcLine; - -typedef enum CV_BuildInfo_e { - CV_BuildInfo_CurrentDirectory = 0, - CV_BuildInfo_BuildTool = 1, // Cl.exe - CV_BuildInfo_SourceFile = 2, // foo.cpp - CV_BuildInfo_ProgramDatabaseFile = 3, // foo.pdb - CV_BuildInfo_CommandArguments = 4, // -I etc - CV_BUILDINFO_KNOWN -} CV_BuildInfo_e; - -// type record for build information - -typedef struct lfBuildInfo { - unsigned short leaf; // LF_BUILDINFO - unsigned short count; // number of arguments - CV_ItemId arg[CV_BUILDINFO_KNOWN]; // arguments as CodeItemId -} lfBuildInfo; - -// type record for LF_MANAGED - -typedef struct lfManaged { - unsigned short leaf; // LF_MANAGED - unsigned char Name[1]; // utf8, zero terminated managed type name -} lfManaged; - - -// type record for LF_ENUM - - -typedef struct lfEnum_16t { - unsigned short leaf; // LF_ENUM_16t - unsigned short count; // count of number of elements in class - CV_typ16_t utype; // underlying type of the enum - CV_typ16_t field; // type index of LF_FIELD descriptor list - CV_prop_t property; // property attribute field - unsigned char Name[1]; // length prefixed name of enum -} lfEnum_16t; - -typedef struct lfEnum { - unsigned short leaf; // LF_ENUM - unsigned short count; // count of number of elements in class - CV_prop_t property; // property attribute field - CV_typ_t utype; // underlying type of the enum - CV_typ_t field; // type index of LF_FIELD descriptor list - unsigned char Name[1]; // length prefixed name of enum -} lfEnum; - - - -// Type record for LF_PROCEDURE - - -typedef struct lfProc_16t { - unsigned short leaf; // LF_PROCEDURE_16t - CV_typ16_t rvtype; // type index of return value - unsigned char calltype; // calling convention (CV_call_t) - CV_funcattr_t funcattr; // attributes - unsigned short parmcount; // number of parameters - CV_typ16_t arglist; // type index of argument list -} lfProc_16t; - -typedef struct lfProc { - unsigned short leaf; // LF_PROCEDURE - CV_typ_t rvtype; // type index of return value - unsigned char calltype; // calling convention (CV_call_t) - CV_funcattr_t funcattr; // attributes - unsigned short parmcount; // number of parameters - CV_typ_t arglist; // type index of argument list -} lfProc; - - - -// Type record for member function - - -typedef struct lfMFunc_16t { - unsigned short leaf; // LF_MFUNCTION_16t - CV_typ16_t rvtype; // type index of return value - CV_typ16_t classtype; // type index of containing class - CV_typ16_t thistype; // type index of this pointer (model specific) - unsigned char calltype; // calling convention (call_t) - CV_funcattr_t funcattr; // attributes - unsigned short parmcount; // number of parameters - CV_typ16_t arglist; // type index of argument list - long thisadjust; // this adjuster (long because pad required anyway) -} lfMFunc_16t; - -typedef struct lfMFunc { - unsigned short leaf; // LF_MFUNCTION - CV_typ_t rvtype; // type index of return value - CV_typ_t classtype; // type index of containing class - CV_typ_t thistype; // type index of this pointer (model specific) - unsigned char calltype; // calling convention (call_t) - CV_funcattr_t funcattr; // attributes - unsigned short parmcount; // number of parameters - CV_typ_t arglist; // type index of argument list - long thisadjust; // this adjuster (long because pad required anyway) -} lfMFunc; - - - - -// type record for virtual function table shape - - -typedef struct lfVTShape { - unsigned short leaf; // LF_VTSHAPE - unsigned short count; // number of entries in vfunctable - unsigned char desc[CV_ZEROLEN]; // 4 bit (CV_VTS_desc) descriptors -} lfVTShape; - -// type record for a virtual function table -typedef struct lfVftable { - unsigned short leaf; // LF_VFTABLE - CV_typ_t type; // class/structure that owns the vftable - CV_typ_t baseVftable; // vftable from which this vftable is derived - unsigned long offsetInObjectLayout; // offset of the vfptr to this table, relative to the start of the object layout. - unsigned long len; // length of the Names array below in bytes. - unsigned char Names[1]; // array of names. - // The first is the name of the vtable. - // The others are the names of the methods. - // TS-TODO: replace a name with a NamedCodeItem once Weiping is done, to - // avoid duplication of method names. -} lfVftable; - -// type record for cobol0 - - -typedef struct lfCobol0_16t { - unsigned short leaf; // LF_COBOL0_16t - CV_typ16_t type; // parent type record index - unsigned char data[CV_ZEROLEN]; -} lfCobol0_16t; - -typedef struct lfCobol0 { - unsigned short leaf; // LF_COBOL0 - CV_typ_t type; // parent type record index - unsigned char data[CV_ZEROLEN]; -} lfCobol0; - - - - -// type record for cobol1 - - -typedef struct lfCobol1 { - unsigned short leaf; // LF_COBOL1 - unsigned char data[CV_ZEROLEN]; -} lfCobol1; - - - - -// type record for basic array - - -typedef struct lfBArray_16t { - unsigned short leaf; // LF_BARRAY_16t - CV_typ16_t utype; // type index of underlying type -} lfBArray_16t; - -typedef struct lfBArray { - unsigned short leaf; // LF_BARRAY - CV_typ_t utype; // type index of underlying type -} lfBArray; - -// type record for assembler labels - - -typedef struct lfLabel { - unsigned short leaf; // LF_LABEL - unsigned short mode; // addressing mode of label -} lfLabel; - - - -// type record for dimensioned arrays - - -typedef struct lfDimArray_16t { - unsigned short leaf; // LF_DIMARRAY_16t - CV_typ16_t utype; // underlying type of the array - CV_typ16_t diminfo; // dimension information - unsigned char name[1]; // length prefixed name -} lfDimArray_16t; - -typedef struct lfDimArray { - unsigned short leaf; // LF_DIMARRAY - CV_typ_t utype; // underlying type of the array - CV_typ_t diminfo; // dimension information - unsigned char name[1]; // length prefixed name -} lfDimArray; - - - -// type record describing path to virtual function table - - -typedef struct lfVFTPath_16t { - unsigned short leaf; // LF_VFTPATH_16t - unsigned short count; // count of number of bases in path - CV_typ16_t base[1]; // bases from root to leaf -} lfVFTPath_16t; - -typedef struct lfVFTPath { - unsigned short leaf; // LF_VFTPATH - unsigned long count; // count of number of bases in path - CV_typ_t base[1]; // bases from root to leaf -} lfVFTPath; - - -// type record describing inclusion of precompiled types - - -typedef struct lfPreComp_16t { - unsigned short leaf; // LF_PRECOMP_16t - unsigned short start; // starting type index included - unsigned short count; // number of types in inclusion - unsigned long signature; // signature - unsigned char name[CV_ZEROLEN]; // length prefixed name of included type file -} lfPreComp_16t; - -typedef struct lfPreComp { - unsigned short leaf; // LF_PRECOMP - unsigned long start; // starting type index included - unsigned long count; // number of types in inclusion - unsigned long signature; // signature - unsigned char name[CV_ZEROLEN]; // length prefixed name of included type file -} lfPreComp; - - - -// type record describing end of precompiled types that can be -// included by another file - - -typedef struct lfEndPreComp { - unsigned short leaf; // LF_ENDPRECOMP - unsigned long signature; // signature -} lfEndPreComp; - - - - - -// type record for OEM definable type strings - - -typedef struct lfOEM_16t { - unsigned short leaf; // LF_OEM_16t - unsigned short cvOEM; // MS assigned OEM identified - unsigned short recOEM; // OEM assigned type identifier - unsigned short count; // count of type indices to follow - CV_typ16_t index[CV_ZEROLEN]; // array of type indices followed - // by OEM defined data -} lfOEM_16t; - -typedef struct lfOEM { - unsigned short leaf; // LF_OEM - unsigned short cvOEM; // MS assigned OEM identified - unsigned short recOEM; // OEM assigned type identifier - unsigned long count; // count of type indices to follow - CV_typ_t index[CV_ZEROLEN]; // array of type indices followed - // by OEM defined data -} lfOEM; - -#define OEM_MS_FORTRAN90 0xF090 -#define OEM_ODI 0x0010 -#define OEM_THOMSON_SOFTWARE 0x5453 -#define OEM_ODI_REC_BASELIST 0x0000 - -typedef struct lfOEM2 { - unsigned short leaf; // LF_OEM2 - unsigned char idOem[16]; // an oem ID (GUID) - unsigned long count; // count of type indices to follow - CV_typ_t index[CV_ZEROLEN]; // array of type indices followed - // by OEM defined data -} lfOEM2; - -// type record describing using of a type server - -typedef struct lfTypeServer { - unsigned short leaf; // LF_TYPESERVER - unsigned long signature; // signature - unsigned long age; // age of database used by this module - unsigned char name[CV_ZEROLEN]; // length prefixed name of PDB -} lfTypeServer; - -// type record describing using of a type server with v7 (GUID) signatures - -typedef struct lfTypeServer2 { - unsigned short leaf; // LF_TYPESERVER2 - SIG70 sig70; // guid signature - unsigned long age; // age of database used by this module - unsigned char name[CV_ZEROLEN]; // length prefixed name of PDB -} lfTypeServer2; - -// description of type records that can be referenced from -// type records referenced by symbols - - - -// type record for skip record - - -typedef struct lfSkip_16t { - unsigned short leaf; // LF_SKIP_16t - CV_typ16_t type; // next valid index - unsigned char data[CV_ZEROLEN]; // pad data -} lfSkip_16t; - -typedef struct lfSkip { - unsigned short leaf; // LF_SKIP - CV_typ_t type; // next valid index - unsigned char data[CV_ZEROLEN]; // pad data -} lfSkip; - - - -// argument list leaf - - -typedef struct lfArgList_16t { - unsigned short leaf; // LF_ARGLIST_16t - unsigned short count; // number of arguments - CV_typ16_t arg[CV_ZEROLEN]; // number of arguments -} lfArgList_16t; - -typedef struct lfArgList { - unsigned short leaf; // LF_ARGLIST, LF_SUBSTR_LIST - unsigned long count; // number of arguments - CV_typ_t arg[CV_ZEROLEN]; // number of arguments -} lfArgList; - - - - -// derived class list leaf - - -typedef struct lfDerived_16t { - unsigned short leaf; // LF_DERIVED_16t - unsigned short count; // number of arguments - CV_typ16_t drvdcls[CV_ZEROLEN]; // type indices of derived classes -} lfDerived_16t; - -typedef struct lfDerived { - unsigned short leaf; // LF_DERIVED - unsigned long count; // number of arguments - CV_typ_t drvdcls[CV_ZEROLEN]; // type indices of derived classes -} lfDerived; - - - - -// leaf for default arguments - - -typedef struct lfDefArg_16t { - unsigned short leaf; // LF_DEFARG_16t - CV_typ16_t type; // type of resulting expression - unsigned char expr[CV_ZEROLEN]; // length prefixed expression string -} lfDefArg_16t; - -typedef struct lfDefArg { - unsigned short leaf; // LF_DEFARG - CV_typ_t type; // type of resulting expression - unsigned char expr[CV_ZEROLEN]; // length prefixed expression string -} lfDefArg; - - - -// list leaf -// This list should no longer be used because the utilities cannot -// verify the contents of the list without knowing what type of list -// it is. New specific leaf indices should be used instead. - - -typedef struct lfList { - unsigned short leaf; // LF_LIST - char data[CV_ZEROLEN]; // data format specified by indexing type -} lfList; - - - - -// field list leaf -// This is the header leaf for a complex list of class and structure -// subfields. - - -typedef struct lfFieldList_16t { - unsigned short leaf; // LF_FIELDLIST_16t - char data[CV_ZEROLEN]; // field list sub lists -} lfFieldList_16t; - - -typedef struct lfFieldList { - unsigned short leaf; // LF_FIELDLIST - char data[CV_ZEROLEN]; // field list sub lists -} lfFieldList; - - - - - - - -// type record for non-static methods and friends in overloaded method list - -typedef struct mlMethod_16t { - CV_fldattr_t attr; // method attribute - CV_typ16_t index; // index to type record for procedure - unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if intro virtual -} mlMethod_16t; - -typedef struct mlMethod { - CV_fldattr_t attr; // method attribute - _2BYTEPAD pad0; // internal padding, must be 0 - CV_typ_t index; // index to type record for procedure - unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if intro virtual -} mlMethod; - - -typedef struct lfMethodList_16t { - unsigned short leaf; - unsigned char mList[CV_ZEROLEN]; // really a mlMethod_16t type -} lfMethodList_16t; - -typedef struct lfMethodList { - unsigned short leaf; - unsigned char mList[CV_ZEROLEN]; // really a mlMethod type -} lfMethodList; - - - - - -// type record for LF_BITFIELD - - -typedef struct lfBitfield_16t { - unsigned short leaf; // LF_BITFIELD_16t - unsigned char length; - unsigned char position; - CV_typ16_t type; // type of bitfield - -} lfBitfield_16t; - -typedef struct lfBitfield { - unsigned short leaf; // LF_BITFIELD - CV_typ_t type; // type of bitfield - unsigned char length; - unsigned char position; - -} lfBitfield; - - - - -// type record for dimensioned array with constant bounds - - -typedef struct lfDimCon_16t { - unsigned short leaf; // LF_DIMCONU_16t or LF_DIMCONLU_16t - unsigned short rank; // number of dimensions - CV_typ16_t typ; // type of index - unsigned char dim[CV_ZEROLEN]; // array of dimension information with - // either upper bounds or lower/upper bound -} lfDimCon_16t; - -typedef struct lfDimCon { - unsigned short leaf; // LF_DIMCONU or LF_DIMCONLU - CV_typ_t typ; // type of index - unsigned short rank; // number of dimensions - unsigned char dim[CV_ZEROLEN]; // array of dimension information with - // either upper bounds or lower/upper bound -} lfDimCon; - - - - -// type record for dimensioned array with variable bounds - - -typedef struct lfDimVar_16t { - unsigned short leaf; // LF_DIMVARU_16t or LF_DIMVARLU_16t - unsigned short rank; // number of dimensions - CV_typ16_t typ; // type of index - CV_typ16_t dim[CV_ZEROLEN]; // array of type indices for either - // variable upper bound or variable - // lower/upper bound. The referenced - // types must be LF_REFSYM or T_VOID -} lfDimVar_16t; - -typedef struct lfDimVar { - unsigned short leaf; // LF_DIMVARU or LF_DIMVARLU - unsigned long rank; // number of dimensions - CV_typ_t typ; // type of index - CV_typ_t dim[CV_ZEROLEN]; // array of type indices for either - // variable upper bound or variable - // lower/upper bound. The count of type - // indices is rank or rank*2 depending on - // whether it is LFDIMVARU or LF_DIMVARLU. - // The referenced types must be - // LF_REFSYM or T_VOID -} lfDimVar; - - - - -// type record for referenced symbol - - -typedef struct lfRefSym { - unsigned short leaf; // LF_REFSYM - unsigned char Sym[1]; // copy of referenced symbol record - // (including length) -} lfRefSym; - - - -// type record for generic HLSL type - - -typedef struct lfHLSL { - unsigned short leaf; // LF_HLSL - CV_typ_t subtype; // sub-type index, if any - unsigned short kind; // kind of built-in type from CV_builtin_e - unsigned short numprops : 4; // number of numeric properties - unsigned short unused : 12; // padding, must be 0 - unsigned char data[CV_ZEROLEN]; // variable-length array of numeric properties - // followed by byte size -} lfHLSL; - - - - -// type record for a generalized built-in type modifier - - -typedef struct lfModifierEx { - unsigned short leaf; // LF_MODIFIER_EX - CV_typ_t type; // type being modified - unsigned short count; // count of modifier values - unsigned short mods[CV_ZEROLEN]; // modifiers from CV_modifier_e -} lfModifierEx; - - - - -/** the following are numeric leaves. They are used to indicate the - * size of the following variable length data. When the numeric - * data is a single byte less than 0x8000, then the data is output - * directly. If the data is more the 0x8000 or is a negative value, - * then the data is preceded by the proper index. - */ - - - -// signed character leaf - -typedef struct lfChar { - unsigned short leaf; // LF_CHAR - signed char val; // signed 8-bit value -} lfChar; - - - - -// signed short leaf - -typedef struct lfShort { - unsigned short leaf; // LF_SHORT - short val; // signed 16-bit value -} lfShort; - - - - -// unsigned short leaf - -typedef struct lfUShort { - unsigned short leaf; // LF_unsigned short - unsigned short val; // unsigned 16-bit value -} lfUShort; - - - - -// signed long leaf - -typedef struct lfLong { - unsigned short leaf; // LF_LONG - long val; // signed 32-bit value -} lfLong; - - - - -// unsigned long leaf - -typedef struct lfULong { - unsigned short leaf; // LF_ULONG - unsigned long val; // unsigned 32-bit value -} lfULong; - - - - -// signed quad leaf - -typedef struct lfQuad { - unsigned short leaf; // LF_QUAD - unsigned char val[8]; // signed 64-bit value -} lfQuad; - - - - -// unsigned quad leaf - -typedef struct lfUQuad { - unsigned short leaf; // LF_UQUAD - unsigned char val[8]; // unsigned 64-bit value -} lfUQuad; - - -// signed int128 leaf - -typedef struct lfOct { - unsigned short leaf; // LF_OCT - unsigned char val[16]; // signed 128-bit value -} lfOct; - -// unsigned int128 leaf - -typedef struct lfUOct { - unsigned short leaf; // LF_UOCT - unsigned char val[16]; // unsigned 128-bit value -} lfUOct; - - - - -// real 16-bit leaf - -typedef struct lfReal16 { - unsigned short leaf; // LF_REAL16 - unsigned short val; // 16-bit real value -} lfReal16; - - - - -// real 32-bit leaf - -typedef struct lfReal32 { - unsigned short leaf; // LF_REAL32 - float val; // 32-bit real value -} lfReal32; - - - - -// real 48-bit leaf - -typedef struct lfReal48 { - unsigned short leaf; // LF_REAL48 - unsigned char val[6]; // 48-bit real value -} lfReal48; - - - - -// real 64-bit leaf - -typedef struct lfReal64 { - unsigned short leaf; // LF_REAL64 - double val; // 64-bit real value -} lfReal64; - - - - -// real 80-bit leaf - -typedef struct lfReal80 { - unsigned short leaf; // LF_REAL80 - FLOAT10 val; // real 80-bit value -} lfReal80; - - - - -// real 128-bit leaf - -typedef struct lfReal128 { - unsigned short leaf; // LF_REAL128 - char val[16]; // real 128-bit value -} lfReal128; - - - - -// complex 32-bit leaf - -typedef struct lfCmplx32 { - unsigned short leaf; // LF_COMPLEX32 - float val_real; // real component - float val_imag; // imaginary component -} lfCmplx32; - - - - -// complex 64-bit leaf - -typedef struct lfCmplx64 { - unsigned short leaf; // LF_COMPLEX64 - double val_real; // real component - double val_imag; // imaginary component -} flCmplx64; - - - - -// complex 80-bit leaf - -typedef struct lfCmplx80 { - unsigned short leaf; // LF_COMPLEX80 - FLOAT10 val_real; // real component - FLOAT10 val_imag; // imaginary component -} lfCmplx80; - - - - -// complex 128-bit leaf - -typedef struct lfCmplx128 { - unsigned short leaf; // LF_COMPLEX128 - char val_real[16]; // real component - char val_imag[16]; // imaginary component -} lfCmplx128; - - - -// variable length numeric field - -typedef struct lfVarString { - unsigned short leaf; // LF_VARSTRING - unsigned short len; // length of value in bytes - unsigned char value[CV_ZEROLEN]; // value -} lfVarString; - -//*********************************************************************** - - -// index leaf - contains type index of another leaf -// a major use of this leaf is to allow the compilers to emit a -// long complex list (LF_FIELD) in smaller pieces. - -typedef struct lfIndex_16t { - unsigned short leaf; // LF_INDEX_16t - CV_typ16_t index; // type index of referenced leaf -} lfIndex_16t; - -typedef struct lfIndex { - unsigned short leaf; // LF_INDEX - _2BYTEPAD pad0; // internal padding, must be 0 - CV_typ_t index; // type index of referenced leaf -} lfIndex; - - -// subfield record for base class field - -typedef struct lfBClass_16t { - unsigned short leaf; // LF_BCLASS_16t - CV_typ16_t index; // type index of base class - CV_fldattr_t attr; // attribute - unsigned char offset[CV_ZEROLEN]; // variable length offset of base within class -} lfBClass_16t; - -typedef struct lfBClass { - unsigned short leaf; // LF_BCLASS, LF_BINTERFACE - CV_fldattr_t attr; // attribute - CV_typ_t index; // type index of base class - unsigned char offset[CV_ZEROLEN]; // variable length offset of base within class -} lfBClass; -typedef lfBClass lfBInterface; - - - - -// subfield record for direct and indirect virtual base class field - -typedef struct lfVBClass_16t { - unsigned short leaf; // LF_VBCLASS_16t | LV_IVBCLASS_16t - CV_typ16_t index; // type index of direct virtual base class - CV_typ16_t vbptr; // type index of virtual base pointer - CV_fldattr_t attr; // attribute - unsigned char vbpoff[CV_ZEROLEN]; // virtual base pointer offset from address point - // followed by virtual base offset from vbtable -} lfVBClass_16t; - -typedef struct lfVBClass { - unsigned short leaf; // LF_VBCLASS | LV_IVBCLASS - CV_fldattr_t attr; // attribute - CV_typ_t index; // type index of direct virtual base class - CV_typ_t vbptr; // type index of virtual base pointer - unsigned char vbpoff[CV_ZEROLEN]; // virtual base pointer offset from address point - // followed by virtual base offset from vbtable -} lfVBClass; - - - - - -// subfield record for friend class - - -typedef struct lfFriendCls_16t { - unsigned short leaf; // LF_FRIENDCLS_16t - CV_typ16_t index; // index to type record of friend class -} lfFriendCls_16t; - -typedef struct lfFriendCls { - unsigned short leaf; // LF_FRIENDCLS - _2BYTEPAD pad0; // internal padding, must be 0 - CV_typ_t index; // index to type record of friend class -} lfFriendCls; - - - - - -// subfield record for friend function - - -typedef struct lfFriendFcn_16t { - unsigned short leaf; // LF_FRIENDFCN_16t - CV_typ16_t index; // index to type record of friend function - unsigned char Name[1]; // name of friend function -} lfFriendFcn_16t; - -typedef struct lfFriendFcn { - unsigned short leaf; // LF_FRIENDFCN - _2BYTEPAD pad0; // internal padding, must be 0 - CV_typ_t index; // index to type record of friend function - unsigned char Name[1]; // name of friend function -} lfFriendFcn; - - - -// subfield record for non-static data members - -typedef struct lfMember_16t { - unsigned short leaf; // LF_MEMBER_16t - CV_typ16_t index; // index of type record for field - CV_fldattr_t attr; // attribute mask - unsigned char offset[CV_ZEROLEN]; // variable length offset of field followed - // by length prefixed name of field -} lfMember_16t; - -typedef struct lfMember { - unsigned short leaf; // LF_MEMBER - CV_fldattr_t attr; // attribute mask - CV_typ_t index; // index of type record for field - unsigned char offset[CV_ZEROLEN]; // variable length offset of field followed - // by length prefixed name of field -} lfMember; - - - -// type record for static data members - -typedef struct lfSTMember_16t { - unsigned short leaf; // LF_STMEMBER_16t - CV_typ16_t index; // index of type record for field - CV_fldattr_t attr; // attribute mask - unsigned char Name[1]; // length prefixed name of field -} lfSTMember_16t; - -typedef struct lfSTMember { - unsigned short leaf; // LF_STMEMBER - CV_fldattr_t attr; // attribute mask - CV_typ_t index; // index of type record for field - unsigned char Name[1]; // length prefixed name of field -} lfSTMember; - - - -// subfield record for virtual function table pointer - -typedef struct lfVFuncTab_16t { - unsigned short leaf; // LF_VFUNCTAB_16t - CV_typ16_t type; // type index of pointer -} lfVFuncTab_16t; - -typedef struct lfVFuncTab { - unsigned short leaf; // LF_VFUNCTAB - _2BYTEPAD pad0; // internal padding, must be 0 - CV_typ_t type; // type index of pointer -} lfVFuncTab; - - - -// subfield record for virtual function table pointer with offset - -typedef struct lfVFuncOff_16t { - unsigned short leaf; // LF_VFUNCOFF_16t - CV_typ16_t type; // type index of pointer - CV_off32_t offset; // offset of virtual function table pointer -} lfVFuncOff_16t; - -typedef struct lfVFuncOff { - unsigned short leaf; // LF_VFUNCOFF - _2BYTEPAD pad0; // internal padding, must be 0. - CV_typ_t type; // type index of pointer - CV_off32_t offset; // offset of virtual function table pointer -} lfVFuncOff; - - - -// subfield record for overloaded method list - - -typedef struct lfMethod_16t { - unsigned short leaf; // LF_METHOD_16t - unsigned short count; // number of occurrences of function - CV_typ16_t mList; // index to LF_METHODLIST record - unsigned char Name[1]; // length prefixed name of method -} lfMethod_16t; - -typedef struct lfMethod { - unsigned short leaf; // LF_METHOD - unsigned short count; // number of occurrences of function - CV_typ_t mList; // index to LF_METHODLIST record - unsigned char Name[1]; // length prefixed name of method -} lfMethod; - - - -// subfield record for nonoverloaded method - - -typedef struct lfOneMethod_16t { - unsigned short leaf; // LF_ONEMETHOD_16t - CV_fldattr_t attr; // method attribute - CV_typ16_t index; // index to type record for procedure - unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if - // intro virtual followed by - // length prefixed name of method -} lfOneMethod_16t; - -typedef struct lfOneMethod { - unsigned short leaf; // LF_ONEMETHOD - CV_fldattr_t attr; // method attribute - CV_typ_t index; // index to type record for procedure - unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if - // intro virtual followed by - // length prefixed name of method -} lfOneMethod; - - -// subfield record for enumerate - -typedef struct lfEnumerate { - unsigned short leaf; // LF_ENUMERATE - CV_fldattr_t attr; // access - unsigned char value[CV_ZEROLEN]; // variable length value field followed - // by length prefixed name -} lfEnumerate; - - -// type record for nested (scoped) type definition - -typedef struct lfNestType_16t { - unsigned short leaf; // LF_NESTTYPE_16t - CV_typ16_t index; // index of nested type definition - unsigned char Name[1]; // length prefixed type name -} lfNestType_16t; - -typedef struct lfNestType { - unsigned short leaf; // LF_NESTTYPE - _2BYTEPAD pad0; // internal padding, must be 0 - CV_typ_t index; // index of nested type definition - unsigned char Name[1]; // length prefixed type name -} lfNestType; - -// type record for nested (scoped) type definition, with attributes -// new records for vC v5.0, no need to have 16-bit ti versions. - -typedef struct lfNestTypeEx { - unsigned short leaf; // LF_NESTTYPEEX - CV_fldattr_t attr; // member access - CV_typ_t index; // index of nested type definition - unsigned char Name[1]; // length prefixed type name -} lfNestTypeEx; - -// type record for modifications to members - -typedef struct lfMemberModify { - unsigned short leaf; // LF_MEMBERMODIFY - CV_fldattr_t attr; // the new attributes - CV_typ_t index; // index of base class type definition - unsigned char Name[1]; // length prefixed member name -} lfMemberModify; - -// type record for pad leaf - -typedef struct lfPad { - unsigned char leaf; -} SYM_PAD; - - - -// Symbol definitions - -typedef enum SYM_ENUM_e { - S_COMPILE = 0x0001, // Compile flags symbol - S_REGISTER_16t = 0x0002, // Register variable - S_CONSTANT_16t = 0x0003, // constant symbol - S_UDT_16t = 0x0004, // User defined type - S_SSEARCH = 0x0005, // Start Search - S_END = 0x0006, // Block, procedure, "with" or thunk end - S_SKIP = 0x0007, // Reserve symbol space in $$Symbols table - S_CVRESERVE = 0x0008, // Reserved symbol for CV internal use - S_OBJNAME_ST = 0x0009, // path to object file name - S_ENDARG = 0x000a, // end of argument/return list - S_COBOLUDT_16t = 0x000b, // special UDT for cobol that does not symbol pack - S_MANYREG_16t = 0x000c, // multiple register variable - S_RETURN = 0x000d, // return description symbol - S_ENTRYTHIS = 0x000e, // description of this pointer on entry - - S_BPREL16 = 0x0100, // BP-relative - S_LDATA16 = 0x0101, // Module-local symbol - S_GDATA16 = 0x0102, // Global data symbol - S_PUB16 = 0x0103, // a public symbol - S_LPROC16 = 0x0104, // Local procedure start - S_GPROC16 = 0x0105, // Global procedure start - S_THUNK16 = 0x0106, // Thunk Start - S_BLOCK16 = 0x0107, // block start - S_WITH16 = 0x0108, // with start - S_LABEL16 = 0x0109, // code label - S_CEXMODEL16 = 0x010a, // change execution model - S_VFTABLE16 = 0x010b, // address of virtual function table - S_REGREL16 = 0x010c, // register relative address - - S_BPREL32_16t = 0x0200, // BP-relative - S_LDATA32_16t = 0x0201, // Module-local symbol - S_GDATA32_16t = 0x0202, // Global data symbol - S_PUB32_16t = 0x0203, // a public symbol (CV internal reserved) - S_LPROC32_16t = 0x0204, // Local procedure start - S_GPROC32_16t = 0x0205, // Global procedure start - S_THUNK32_ST = 0x0206, // Thunk Start - S_BLOCK32_ST = 0x0207, // block start - S_WITH32_ST = 0x0208, // with start - S_LABEL32_ST = 0x0209, // code label - S_CEXMODEL32 = 0x020a, // change execution model - S_VFTABLE32_16t = 0x020b, // address of virtual function table - S_REGREL32_16t = 0x020c, // register relative address - S_LTHREAD32_16t = 0x020d, // local thread storage - S_GTHREAD32_16t = 0x020e, // global thread storage - S_SLINK32 = 0x020f, // static link for MIPS EH implementation - - S_LPROCMIPS_16t = 0x0300, // Local procedure start - S_GPROCMIPS_16t = 0x0301, // Global procedure start - - // if these ref symbols have names following then the names are in ST format - S_PROCREF_ST = 0x0400, // Reference to a procedure - S_DATAREF_ST = 0x0401, // Reference to data - S_ALIGN = 0x0402, // Used for page alignment of symbols - - S_LPROCREF_ST = 0x0403, // Local Reference to a procedure - S_OEM = 0x0404, // OEM defined symbol - - // sym records with 32-bit types embedded instead of 16-bit - // all have 0x1000 bit set for easy identification - // only do the 32-bit target versions since we don't really - // care about 16-bit ones anymore. - S_TI16_MAX = 0x1000, - - S_REGISTER_ST = 0x1001, // Register variable - S_CONSTANT_ST = 0x1002, // constant symbol - S_UDT_ST = 0x1003, // User defined type - S_COBOLUDT_ST = 0x1004, // special UDT for cobol that does not symbol pack - S_MANYREG_ST = 0x1005, // multiple register variable - S_BPREL32_ST = 0x1006, // BP-relative - S_LDATA32_ST = 0x1007, // Module-local symbol - S_GDATA32_ST = 0x1008, // Global data symbol - S_PUB32_ST = 0x1009, // a public symbol (CV internal reserved) - S_LPROC32_ST = 0x100a, // Local procedure start - S_GPROC32_ST = 0x100b, // Global procedure start - S_VFTABLE32 = 0x100c, // address of virtual function table - S_REGREL32_ST = 0x100d, // register relative address - S_LTHREAD32_ST = 0x100e, // local thread storage - S_GTHREAD32_ST = 0x100f, // global thread storage - - S_LPROCMIPS_ST = 0x1010, // Local procedure start - S_GPROCMIPS_ST = 0x1011, // Global procedure start - - S_FRAMEPROC = 0x1012, // extra frame and proc information - S_COMPILE2_ST = 0x1013, // extended compile flags and info - - // new symbols necessary for 16-bit enumerates of IA64 registers - // and IA64 specific symbols - - S_MANYREG2_ST = 0x1014, // multiple register variable - S_LPROCIA64_ST = 0x1015, // Local procedure start (IA64) - S_GPROCIA64_ST = 0x1016, // Global procedure start (IA64) - - // Local symbols for IL - S_LOCALSLOT_ST = 0x1017, // local IL sym with field for local slot index - S_PARAMSLOT_ST = 0x1018, // local IL sym with field for parameter slot index - - S_ANNOTATION = 0x1019, // Annotation string literals - - // symbols to support managed code debugging - S_GMANPROC_ST = 0x101a, // Global proc - S_LMANPROC_ST = 0x101b, // Local proc - S_RESERVED1 = 0x101c, // reserved - S_RESERVED2 = 0x101d, // reserved - S_RESERVED3 = 0x101e, // reserved - S_RESERVED4 = 0x101f, // reserved - S_LMANDATA_ST = 0x1020, - S_GMANDATA_ST = 0x1021, - S_MANFRAMEREL_ST= 0x1022, - S_MANREGISTER_ST= 0x1023, - S_MANSLOT_ST = 0x1024, - S_MANMANYREG_ST = 0x1025, - S_MANREGREL_ST = 0x1026, - S_MANMANYREG2_ST= 0x1027, - S_MANTYPREF = 0x1028, // Index for type referenced by name from metadata - S_UNAMESPACE_ST = 0x1029, // Using namespace - - // Symbols w/ SZ name fields. All name fields contain utf8 encoded strings. - S_ST_MAX = 0x1100, // starting point for SZ name symbols - - S_OBJNAME = 0x1101, // path to object file name - S_THUNK32 = 0x1102, // Thunk Start - S_BLOCK32 = 0x1103, // block start - S_WITH32 = 0x1104, // with start - S_LABEL32 = 0x1105, // code label - S_REGISTER = 0x1106, // Register variable - S_CONSTANT = 0x1107, // constant symbol - S_UDT = 0x1108, // User defined type - S_COBOLUDT = 0x1109, // special UDT for cobol that does not symbol pack - S_MANYREG = 0x110a, // multiple register variable - S_BPREL32 = 0x110b, // BP-relative - S_LDATA32 = 0x110c, // Module-local symbol - S_GDATA32 = 0x110d, // Global data symbol - S_PUB32 = 0x110e, // a public symbol (CV internal reserved) - S_LPROC32 = 0x110f, // Local procedure start - S_GPROC32 = 0x1110, // Global procedure start - S_REGREL32 = 0x1111, // register relative address - S_LTHREAD32 = 0x1112, // local thread storage - S_GTHREAD32 = 0x1113, // global thread storage - - S_LPROCMIPS = 0x1114, // Local procedure start - S_GPROCMIPS = 0x1115, // Global procedure start - S_COMPILE2 = 0x1116, // extended compile flags and info - S_MANYREG2 = 0x1117, // multiple register variable - S_LPROCIA64 = 0x1118, // Local procedure start (IA64) - S_GPROCIA64 = 0x1119, // Global procedure start (IA64) - S_LOCALSLOT = 0x111a, // local IL sym with field for local slot index - S_SLOT = S_LOCALSLOT, // alias for LOCALSLOT - S_PARAMSLOT = 0x111b, // local IL sym with field for parameter slot index - - // symbols to support managed code debugging - S_LMANDATA = 0x111c, - S_GMANDATA = 0x111d, - S_MANFRAMEREL = 0x111e, - S_MANREGISTER = 0x111f, - S_MANSLOT = 0x1120, - S_MANMANYREG = 0x1121, - S_MANREGREL = 0x1122, - S_MANMANYREG2 = 0x1123, - S_UNAMESPACE = 0x1124, // Using namespace - - // ref symbols with name fields - S_PROCREF = 0x1125, // Reference to a procedure - S_DATAREF = 0x1126, // Reference to data - S_LPROCREF = 0x1127, // Local Reference to a procedure - S_ANNOTATIONREF = 0x1128, // Reference to an S_ANNOTATION symbol - S_TOKENREF = 0x1129, // Reference to one of the many MANPROCSYM's - - // continuation of managed symbols - S_GMANPROC = 0x112a, // Global proc - S_LMANPROC = 0x112b, // Local proc - - // short, light-weight thunks - S_TRAMPOLINE = 0x112c, // trampoline thunks - S_MANCONSTANT = 0x112d, // constants with metadata type info - - // native attributed local/parms - S_ATTR_FRAMEREL = 0x112e, // relative to virtual frame ptr - S_ATTR_REGISTER = 0x112f, // stored in a register - S_ATTR_REGREL = 0x1130, // relative to register (alternate frame ptr) - S_ATTR_MANYREG = 0x1131, // stored in >1 register - - // Separated code (from the compiler) support - S_SEPCODE = 0x1132, - - S_LOCAL_2005 = 0x1133, // defines a local symbol in optimized code - S_DEFRANGE_2005 = 0x1134, // defines a single range of addresses in which symbol can be evaluated - S_DEFRANGE2_2005 = 0x1135, // defines ranges of addresses in which symbol can be evaluated - - S_SECTION = 0x1136, // A COFF section in a PE executable - S_COFFGROUP = 0x1137, // A COFF group - S_EXPORT = 0x1138, // A export - - S_CALLSITEINFO = 0x1139, // Indirect call site information - S_FRAMECOOKIE = 0x113a, // Security cookie information - - S_DISCARDED = 0x113b, // Discarded by LINK /OPT:REF (experimental, see richards) - - S_COMPILE3 = 0x113c, // Replacement for S_COMPILE2 - S_ENVBLOCK = 0x113d, // Environment block split off from S_COMPILE2 - - S_LOCAL = 0x113e, // defines a local symbol in optimized code - S_DEFRANGE = 0x113f, // defines a single range of addresses in which symbol can be evaluated - S_DEFRANGE_SUBFIELD = 0x1140, // ranges for a subfield - - S_DEFRANGE_REGISTER = 0x1141, // ranges for en-registered symbol - S_DEFRANGE_FRAMEPOINTER_REL = 0x1142, // range for stack symbol. - S_DEFRANGE_SUBFIELD_REGISTER = 0x1143, // ranges for en-registered field of symbol - S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE = 0x1144, // range for stack symbol span valid full scope of function body, gap might apply. - S_DEFRANGE_REGISTER_REL = 0x1145, // range for symbol address as register + offset. - - // S_PROC symbols that reference ID instead of type - S_LPROC32_ID = 0x1146, - S_GPROC32_ID = 0x1147, - S_LPROCMIPS_ID = 0x1148, - S_GPROCMIPS_ID = 0x1149, - S_LPROCIA64_ID = 0x114a, - S_GPROCIA64_ID = 0x114b, - - S_BUILDINFO = 0x114c, // build information. - S_INLINESITE = 0x114d, // inlined function callsite. - S_INLINESITE_END = 0x114e, - S_PROC_ID_END = 0x114f, - - S_DEFRANGE_HLSL = 0x1150, - S_GDATA_HLSL = 0x1151, - S_LDATA_HLSL = 0x1152, - - S_FILESTATIC = 0x1153, - -#if defined(CC_DP_CXX) && CC_DP_CXX - - S_LOCAL_DPC_GROUPSHARED = 0x1154, // DPC groupshared variable - S_LPROC32_DPC = 0x1155, // DPC local procedure start - S_LPROC32_DPC_ID = 0x1156, - S_DEFRANGE_DPC_PTR_TAG = 0x1157, // DPC pointer tag definition range - S_DPC_SYM_TAG_MAP = 0x1158, // DPC pointer tag value to symbol record map - -#endif // CC_DP_CXX - - S_ARMSWITCHTABLE = 0x1159, - S_CALLEES = 0x115a, - S_CALLERS = 0x115b, - S_POGODATA = 0x115c, - S_INLINESITE2 = 0x115d, // extended inline site information - - S_HEAPALLOCSITE = 0x115e, // heap allocation site - - S_MOD_TYPEREF = 0x115f, // only generated at link time - - S_REF_MINIPDB = 0x1160, // only generated at link time for mini PDB - S_PDBMAP = 0x1161, // only generated at link time for mini PDB - - S_GDATA_HLSL32 = 0x1162, - S_LDATA_HLSL32 = 0x1163, - - S_GDATA_HLSL32_EX = 0x1164, - S_LDATA_HLSL32_EX = 0x1165, - - S_RECTYPE_MAX, // one greater than last - S_RECTYPE_LAST = S_RECTYPE_MAX - 1, - S_RECTYPE_PAD = S_RECTYPE_MAX + 0x100 // Used *only* to verify symbol record types so that current PDB code can potentially read - // future PDBs (assuming no format change, etc). - -} SYM_ENUM_e; - - -// enum describing compile flag ambient data model - - -typedef enum CV_CFL_DATA { - CV_CFL_DNEAR = 0x00, - CV_CFL_DFAR = 0x01, - CV_CFL_DHUGE = 0x02 -} CV_CFL_DATA; - - - - -// enum describing compile flag ambiant code model - - -typedef enum CV_CFL_CODE_e { - CV_CFL_CNEAR = 0x00, - CV_CFL_CFAR = 0x01, - CV_CFL_CHUGE = 0x02 -} CV_CFL_CODE_e; - - - - -// enum describing compile flag target floating point package - -typedef enum CV_CFL_FPKG_e { - CV_CFL_NDP = 0x00, - CV_CFL_EMU = 0x01, - CV_CFL_ALT = 0x02 -} CV_CFL_FPKG_e; - - -// enum describing function return method - - -typedef struct CV_PROCFLAGS { - union { - unsigned char bAll; - unsigned char grfAll; - struct { - unsigned char CV_PFLAG_NOFPO :1; // frame pointer present - unsigned char CV_PFLAG_INT :1; // interrupt return - unsigned char CV_PFLAG_FAR :1; // far return - unsigned char CV_PFLAG_NEVER :1; // function does not return - unsigned char CV_PFLAG_NOTREACHED:1; // label isn't fallen into - unsigned char CV_PFLAG_CUST_CALL :1; // custom calling convention - unsigned char CV_PFLAG_NOINLINE :1; // function marked as noinline - unsigned char CV_PFLAG_OPTDBGINFO:1; // function has debug information for optimized code - }; - }; -} CV_PROCFLAGS; - -// Extended proc flags -// -typedef struct CV_EXPROCFLAGS { - CV_PROCFLAGS cvpf; - union { - unsigned char grfAll; - struct { - unsigned char __reserved_byte :8; // must be zero - }; - }; -} CV_EXPROCFLAGS; - -// local variable flags -typedef struct CV_LVARFLAGS { - unsigned short fIsParam :1; // variable is a parameter - unsigned short fAddrTaken :1; // address is taken - unsigned short fCompGenx :1; // variable is compiler generated - unsigned short fIsAggregate :1; // the symbol is split in temporaries, - // which are treated by compiler as - // independent entities - unsigned short fIsAggregated :1; // Counterpart of fIsAggregate - tells - // that it is a part of a fIsAggregate symbol - unsigned short fIsAliased :1; // variable has multiple simultaneous lifetimes - unsigned short fIsAlias :1; // represents one of the multiple simultaneous lifetimes - unsigned short fIsRetValue :1; // represents a function return value - unsigned short fIsOptimizedOut :1; // variable has no lifetimes - unsigned short fIsEnregGlob :1; // variable is an enregistered global - unsigned short fIsEnregStat :1; // variable is an enregistered static - - unsigned short unused :5; // must be zero - -} CV_LVARFLAGS; - -// extended attributes common to all local variables -typedef struct CV_lvar_attr { - CV_uoff32_t off; // first code address where var is live - unsigned short seg; - CV_LVARFLAGS flags; // local var flags -} CV_lvar_attr; - -// This is max length of a lexical linear IP range. -// The upper number are reserved for seeded and flow based range - -#define CV_LEXICAL_RANGE_MAX 0xF000 - -// represents an address range, used for optimized code debug info - -typedef struct CV_LVAR_ADDR_RANGE { // defines a range of addresses - CV_uoff32_t offStart; - unsigned short isectStart; - unsigned short cbRange; -} CV_LVAR_ADDR_RANGE; - -// Represents the holes in overall address range, all address is pre-bbt. -// it is for compress and reduce the amount of relocations need. - -typedef struct CV_LVAR_ADDR_GAP { - unsigned short gapStartOffset; // relative offset from the beginning of the live range. - unsigned short cbRange; // length of this gap. -} CV_LVAR_ADDR_GAP; - -#if defined(CC_DP_CXX) && CC_DP_CXX - -// Represents a mapping from a DPC pointer tag value to the corresponding symbol record -typedef struct CV_DPC_SYM_TAG_MAP_ENTRY { - unsigned int tagValue; // address taken symbol's pointer tag value. - CV_off32_t symRecordOffset; // offset of the symbol record from the S_LPROC32_DPC record it is nested within -} CV_DPC_SYM_TAG_MAP_ENTRY; - -#endif // CC_DP_CXX - -// enum describing function data return method - -typedef enum CV_GENERIC_STYLE_e { - CV_GENERIC_VOID = 0x00, // void return type - CV_GENERIC_REG = 0x01, // return data is in registers - CV_GENERIC_ICAN = 0x02, // indirect caller allocated near - CV_GENERIC_ICAF = 0x03, // indirect caller allocated far - CV_GENERIC_IRAN = 0x04, // indirect returnee allocated near - CV_GENERIC_IRAF = 0x05, // indirect returnee allocated far - CV_GENERIC_UNUSED = 0x06 // first unused -} CV_GENERIC_STYLE_e; - - -typedef struct CV_GENERIC_FLAG { - unsigned short cstyle :1; // true push varargs right to left - unsigned short rsclean :1; // true if returnee stack cleanup - unsigned short unused :14; // unused -} CV_GENERIC_FLAG; - - -// flag bitfields for separated code attributes - -typedef struct CV_SEPCODEFLAGS { - unsigned long fIsLexicalScope : 1; // S_SEPCODE doubles as lexical scope - unsigned long fReturnsToParent : 1; // code frag returns to parent - unsigned long pad : 30; // must be zero -} CV_SEPCODEFLAGS; - -// Generic layout for symbol records - -typedef struct SYMTYPE { - unsigned short reclen; // Record length - unsigned short rectyp; // Record type - char data[CV_ZEROLEN]; -} SYMTYPE; - -__INLINE SYMTYPE *NextSym (SYMTYPE * pSym) { - return (SYMTYPE *) ((char *)pSym + pSym->reclen + sizeof(unsigned short)); -} - -// non-model specific symbol types - - - -typedef struct REGSYM_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_REGISTER_16t - CV_typ16_t typind; // Type index - unsigned short reg; // register enumerate - unsigned char name[1]; // Length-prefixed name -} REGSYM_16t; - -typedef struct REGSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_REGISTER - CV_typ_t typind; // Type index or Metadata token - unsigned short reg; // register enumerate - unsigned char name[1]; // Length-prefixed name -} REGSYM; - -typedef struct ATTRREGSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANREGISTER | S_ATTR_REGISTER - CV_typ_t typind; // Type index or Metadata token - CV_lvar_attr attr; // local var attributes - unsigned short reg; // register enumerate - unsigned char name[1]; // Length-prefixed name -} ATTRREGSYM; - -typedef struct MANYREGSYM_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANYREG_16t - CV_typ16_t typind; // Type index - unsigned char count; // count of number of registers - unsigned char reg[1]; // count register enumerates followed by - // length-prefixed name. Registers are - // most significant first. -} MANYREGSYM_16t; - -typedef struct MANYREGSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANYREG - CV_typ_t typind; // Type index or metadata token - unsigned char count; // count of number of registers - unsigned char reg[1]; // count register enumerates followed by - // length-prefixed name. Registers are - // most significant first. -} MANYREGSYM; - -typedef struct MANYREGSYM2 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANYREG2 - CV_typ_t typind; // Type index or metadata token - unsigned short count; // count of number of registers - unsigned short reg[1]; // count register enumerates followed by - // length-prefixed name. Registers are - // most significant first. -} MANYREGSYM2; - -typedef struct ATTRMANYREGSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANMANYREG - CV_typ_t typind; // Type index or metadata token - CV_lvar_attr attr; // local var attributes - unsigned char count; // count of number of registers - unsigned char reg[1]; // count register enumerates followed by - // length-prefixed name. Registers are - // most significant first. - unsigned char name[CV_ZEROLEN]; // utf-8 encoded zero terminate name -} ATTRMANYREGSYM; - -typedef struct ATTRMANYREGSYM2 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANMANYREG2 | S_ATTR_MANYREG - CV_typ_t typind; // Type index or metadata token - CV_lvar_attr attr; // local var attributes - unsigned short count; // count of number of registers - unsigned short reg[1]; // count register enumerates followed by - // length-prefixed name. Registers are - // most significant first. - unsigned char name[CV_ZEROLEN]; // utf-8 encoded zero terminate name -} ATTRMANYREGSYM2; - -typedef struct CONSTSYM_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_CONSTANT_16t - CV_typ16_t typind; // Type index (containing enum if enumerate) - unsigned short value; // numeric leaf containing value - unsigned char name[CV_ZEROLEN]; // Length-prefixed name -} CONSTSYM_16t; - -typedef struct CONSTSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_CONSTANT or S_MANCONSTANT - CV_typ_t typind; // Type index (containing enum if enumerate) or metadata token - unsigned short value; // numeric leaf containing value - unsigned char name[CV_ZEROLEN]; // Length-prefixed name -} CONSTSYM; - - -typedef struct UDTSYM_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_UDT_16t | S_COBOLUDT_16t - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} UDTSYM_16t; - - -typedef struct UDTSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_UDT | S_COBOLUDT - CV_typ_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} UDTSYM; - -typedef struct MANTYPREF { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANTYPREF - CV_typ_t typind; // Type index -} MANTYPREF; - -typedef struct SEARCHSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_SSEARCH - unsigned long startsym; // offset of the procedure - unsigned short seg; // segment of symbol -} SEARCHSYM; - - -typedef struct CFLAGSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_COMPILE - unsigned char machine; // target processor - struct { - unsigned char language :8; // language index - unsigned char pcode :1; // true if pcode present - unsigned char floatprec :2; // floating precision - unsigned char floatpkg :2; // float package - unsigned char ambdata :3; // ambient data model - unsigned char ambcode :3; // ambient code model - unsigned char mode32 :1; // true if compiled 32 bit mode - unsigned char pad :4; // reserved - } flags; - unsigned char ver[1]; // Length-prefixed compiler version string -} CFLAGSYM; - - -typedef struct COMPILESYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_COMPILE2 - struct { - unsigned long iLanguage : 8; // language index - unsigned long fEC : 1; // compiled for E/C - unsigned long fNoDbgInfo : 1; // not compiled with debug info - unsigned long fLTCG : 1; // compiled with LTCG - unsigned long fNoDataAlign : 1; // compiled with -Bzalign - unsigned long fManagedPresent : 1; // managed code/data present - unsigned long fSecurityChecks : 1; // compiled with /GS - unsigned long fHotPatch : 1; // compiled with /hotpatch - unsigned long fCVTCIL : 1; // converted with CVTCIL - unsigned long fMSILModule : 1; // MSIL netmodule - unsigned long pad : 15; // reserved, must be 0 - } flags; - unsigned short machine; // target processor - unsigned short verFEMajor; // front end major version # - unsigned short verFEMinor; // front end minor version # - unsigned short verFEBuild; // front end build version # - unsigned short verMajor; // back end major version # - unsigned short verMinor; // back end minor version # - unsigned short verBuild; // back end build version # - unsigned char verSt[1]; // Length-prefixed compiler version string, followed - // by an optional block of zero terminated strings - // terminated with a double zero. -} COMPILESYM; - -typedef struct COMPILESYM3 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_COMPILE3 - struct { - unsigned long iLanguage : 8; // language index - unsigned long fEC : 1; // compiled for E/C - unsigned long fNoDbgInfo : 1; // not compiled with debug info - unsigned long fLTCG : 1; // compiled with LTCG - unsigned long fNoDataAlign : 1; // compiled with -Bzalign - unsigned long fManagedPresent : 1; // managed code/data present - unsigned long fSecurityChecks : 1; // compiled with /GS - unsigned long fHotPatch : 1; // compiled with /hotpatch - unsigned long fCVTCIL : 1; // converted with CVTCIL - unsigned long fMSILModule : 1; // MSIL netmodule - unsigned long fSdl : 1; // compiled with /sdl - unsigned long fPGO : 1; // compiled with /ltcg:pgo or pgu - unsigned long fExp : 1; // .exp module - unsigned long pad : 12; // reserved, must be 0 - } flags; - unsigned short machine; // target processor - unsigned short verFEMajor; // front end major version # - unsigned short verFEMinor; // front end minor version # - unsigned short verFEBuild; // front end build version # - unsigned short verFEQFE; // front end QFE version # - unsigned short verMajor; // back end major version # - unsigned short verMinor; // back end minor version # - unsigned short verBuild; // back end build version # - unsigned short verQFE; // back end QFE version # - char verSz[1]; // Zero terminated compiler version string -} COMPILESYM3; - -typedef struct ENVBLOCKSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_ENVBLOCK - struct { - unsigned char rev : 1; // reserved - unsigned char pad : 7; // reserved, must be 0 - } flags; - unsigned char rgsz[1]; // Sequence of zero-terminated strings -} ENVBLOCKSYM; - -typedef struct OBJNAMESYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_OBJNAME - unsigned long signature; // signature - unsigned char name[1]; // Length-prefixed name -} OBJNAMESYM; - - -typedef struct ENDARGSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_ENDARG -} ENDARGSYM; - - -typedef struct RETURNSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_RETURN - CV_GENERIC_FLAG flags; // flags - unsigned char style; // CV_GENERIC_STYLE_e return style - // followed by return method data -} RETURNSYM; - - -typedef struct ENTRYTHISSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_ENTRYTHIS - unsigned char thissym; // symbol describing this pointer on entry -} ENTRYTHISSYM; - - -// symbol types for 16:16 memory model - - -typedef struct BPRELSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BPREL16 - CV_off16_t off; // BP-relative offset - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} BPRELSYM16; - - -typedef struct DATASYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LDATA or S_GDATA - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} DATASYM16; -typedef DATASYM16 PUBSYM16; - - -typedef struct PROCSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROC16 or S_LPROC16 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned short len; // Proc length - unsigned short DbgStart; // Debug start offset - unsigned short DbgEnd; // Debug end offset - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - CV_typ16_t typind; // Type index - CV_PROCFLAGS flags; // Proc flags - unsigned char name[1]; // Length-prefixed name -} PROCSYM16; - - -typedef struct THUNKSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_THUNK - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - unsigned short len; // length of thunk - unsigned char ord; // THUNK_ORDINAL specifying type of thunk - unsigned char name[1]; // name of thunk - unsigned char variant[CV_ZEROLEN]; // variant portion of thunk -} THUNKSYM16; - -typedef struct LABELSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LABEL16 - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - CV_PROCFLAGS flags; // flags - unsigned char name[1]; // Length-prefixed name -} LABELSYM16; - - -typedef struct BLOCKSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BLOCK16 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned short len; // Block length - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - unsigned char name[1]; // Length-prefixed name -} BLOCKSYM16; - - -typedef struct WITHSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_WITH16 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned short len; // Block length - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - unsigned char expr[1]; // Length-prefixed expression -} WITHSYM16; - - -typedef enum CEXM_MODEL_e { - CEXM_MDL_table = 0x00, // not executable - CEXM_MDL_jumptable = 0x01, // Compiler generated jump table - CEXM_MDL_datapad = 0x02, // Data padding for alignment - CEXM_MDL_native = 0x20, // native (actually not-pcode) - CEXM_MDL_cobol = 0x21, // cobol - CEXM_MDL_codepad = 0x22, // Code padding for alignment - CEXM_MDL_code = 0x23, // code - CEXM_MDL_sql = 0x30, // sql - CEXM_MDL_pcode = 0x40, // pcode - CEXM_MDL_pcode32Mac = 0x41, // macintosh 32 bit pcode - CEXM_MDL_pcode32MacNep = 0x42, // macintosh 32 bit pcode native entry point - CEXM_MDL_javaInt = 0x50, - CEXM_MDL_unknown = 0xff -} CEXM_MODEL_e; - -// use the correct enumerate name -#define CEXM_MDL_SQL CEXM_MDL_sql - -typedef enum CV_COBOL_e { - CV_COBOL_dontstop, - CV_COBOL_pfm, - CV_COBOL_false, - CV_COBOL_extcall -} CV_COBOL_e; - -typedef struct CEXMSYM16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_CEXMODEL16 - CV_uoff16_t off; // offset of symbol - unsigned short seg; // segment of symbol - unsigned short model; // execution model - union { - struct { - CV_uoff16_t pcdtable; // offset to pcode function table - CV_uoff16_t pcdspi; // offset to segment pcode information - } pcode; - struct { - unsigned short subtype; // see CV_COBOL_e above - unsigned short flag; - } cobol; - }; -} CEXMSYM16; - - -typedef struct VPATHSYM16 { - unsigned short reclen; // record length - unsigned short rectyp; // S_VFTPATH16 - CV_uoff16_t off; // offset of virtual function table - unsigned short seg; // segment of virtual function table - CV_typ16_t root; // type index of the root of path - CV_typ16_t path; // type index of the path record -} VPATHSYM16; - - -typedef struct REGREL16 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_REGREL16 - CV_uoff16_t off; // offset of symbol - unsigned short reg; // register index - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} REGREL16; - - -typedef struct BPRELSYM32_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BPREL32_16t - CV_off32_t off; // BP-relative offset - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} BPRELSYM32_16t; - -typedef struct BPRELSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BPREL32 - CV_off32_t off; // BP-relative offset - CV_typ_t typind; // Type index or Metadata token - unsigned char name[1]; // Length-prefixed name -} BPRELSYM32; - -typedef struct FRAMERELSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANFRAMEREL | S_ATTR_FRAMEREL - CV_off32_t off; // Frame relative offset - CV_typ_t typind; // Type index or Metadata token - CV_lvar_attr attr; // local var attributes - unsigned char name[1]; // Length-prefixed name -} FRAMERELSYM; - -typedef FRAMERELSYM ATTRFRAMERELSYM; - - -typedef struct SLOTSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LOCALSLOT or S_PARAMSLOT - unsigned long iSlot; // slot index - CV_typ_t typind; // Type index or Metadata token - unsigned char name[1]; // Length-prefixed name -} SLOTSYM32; - -typedef struct ATTRSLOTSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANSLOT - unsigned long iSlot; // slot index - CV_typ_t typind; // Type index or Metadata token - CV_lvar_attr attr; // local var attributes - unsigned char name[1]; // Length-prefixed name -} ATTRSLOTSYM; - -typedef struct ANNOTATIONSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_ANNOTATION - CV_uoff32_t off; - unsigned short seg; - unsigned short csz; // Count of zero terminated annotation strings - unsigned char rgsz[1]; // Sequence of zero terminated annotation strings -} ANNOTATIONSYM; - -typedef struct DATASYM32_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LDATA32_16t, S_GDATA32_16t or S_PUB32_16t - CV_uoff32_t off; - unsigned short seg; - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} DATASYM32_16t; -typedef DATASYM32_16t PUBSYM32_16t; - -typedef struct DATASYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LDATA32, S_GDATA32, S_LMANDATA, S_GMANDATA - CV_typ_t typind; // Type index, or Metadata token if a managed symbol - CV_uoff32_t off; - unsigned short seg; - unsigned char name[1]; // Length-prefixed name -} DATASYM32; - -typedef struct DATASYMHLSL { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GDATA_HLSL, S_LDATA_HLSL - CV_typ_t typind; // Type index - unsigned short regType; // register type from CV_HLSLREG_e - unsigned short dataslot; // Base data (cbuffer, groupshared, etc.) slot - unsigned short dataoff; // Base data byte offset start - unsigned short texslot; // Texture slot start - unsigned short sampslot; // Sampler slot start - unsigned short uavslot; // UAV slot start - unsigned char name[1]; // name -} DATASYMHLSL; - -typedef struct DATASYMHLSL32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GDATA_HLSL32, S_LDATA_HLSL32 - CV_typ_t typind; // Type index - unsigned long dataslot; // Base data (cbuffer, groupshared, etc.) slot - unsigned long dataoff; // Base data byte offset start - unsigned long texslot; // Texture slot start - unsigned long sampslot; // Sampler slot start - unsigned long uavslot; // UAV slot start - unsigned short regType; // register type from CV_HLSLREG_e - unsigned char name[1]; // name -} DATASYMHLSL32; - -typedef struct DATASYMHLSL32_EX { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GDATA_HLSL32_EX, S_LDATA_HLSL32_EX - CV_typ_t typind; // Type index - unsigned long regID; // Register index - unsigned long dataoff; // Base data byte offset start - unsigned long bindSpace; // Binding space - unsigned long bindSlot; // Lower bound in binding space - unsigned short regType; // register type from CV_HLSLREG_e - unsigned char name[1]; // name -} DATASYMHLSL32_EX; - -typedef enum CV_PUBSYMFLAGS_e - { - cvpsfNone = 0, - cvpsfCode = 0x00000001, - cvpsfFunction = 0x00000002, - cvpsfManaged = 0x00000004, - cvpsfMSIL = 0x00000008, -} CV_PUBSYMFLAGS_e; - -typedef union CV_PUBSYMFLAGS { - CV_pubsymflag_t grfFlags; - struct { - CV_pubsymflag_t fCode : 1; // set if public symbol refers to a code address - CV_pubsymflag_t fFunction : 1; // set if public symbol is a function - CV_pubsymflag_t fManaged : 1; // set if managed code (native or IL) - CV_pubsymflag_t fMSIL : 1; // set if managed IL code - CV_pubsymflag_t __unused : 28; // must be zero - }; -} CV_PUBSYMFLAGS; - -typedef struct PUBSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_PUB32 - CV_PUBSYMFLAGS pubsymflags; - CV_uoff32_t off; - unsigned short seg; - unsigned char name[1]; // Length-prefixed name -} PUBSYM32; - - -typedef struct PROCSYM32_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROC32_16t or S_LPROC32_16t - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - CV_uoff32_t off; - unsigned short seg; - CV_typ16_t typind; // Type index - CV_PROCFLAGS flags; // Proc flags - unsigned char name[1]; // Length-prefixed name -} PROCSYM32_16t; - -typedef struct PROCSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROC32, S_LPROC32, S_GPROC32_ID, S_LPROC32_ID, S_LPROC32_DPC or S_LPROC32_DPC_ID - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - CV_typ_t typind; // Type index or ID - CV_uoff32_t off; - unsigned short seg; - CV_PROCFLAGS flags; // Proc flags - unsigned char name[1]; // Length-prefixed name -} PROCSYM32; - -typedef struct MANPROCSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GMANPROC, S_LMANPROC, S_GMANPROCIA64 or S_LMANPROCIA64 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - CV_tkn_t token; // COM+ metadata token for method - CV_uoff32_t off; - unsigned short seg; - CV_PROCFLAGS flags; // Proc flags - unsigned short retReg; // Register return value is in (may not be used for all archs) - unsigned char name[1]; // optional name field -} MANPROCSYM; - -typedef struct MANPROCSYMMIPS { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GMANPROCMIPS or S_LMANPROCMIPS - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - unsigned long regSave; // int register save mask - unsigned long fpSave; // fp register save mask - CV_uoff32_t intOff; // int register save offset - CV_uoff32_t fpOff; // fp register save offset - CV_tkn_t token; // COM+ token type - CV_uoff32_t off; - unsigned short seg; - unsigned char retReg; // Register return value is in - unsigned char frameReg; // Frame pointer register - unsigned char name[1]; // optional name field -} MANPROCSYMMIPS; - -typedef struct THUNKSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_THUNK32 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - CV_uoff32_t off; - unsigned short seg; - unsigned short len; // length of thunk - unsigned char ord; // THUNK_ORDINAL specifying type of thunk - unsigned char name[1]; // Length-prefixed name - unsigned char variant[CV_ZEROLEN]; // variant portion of thunk -} THUNKSYM32; - -typedef enum TRAMP_e { // Trampoline subtype - trampIncremental, // incremental thunks - trampBranchIsland, // Branch island thunks -} TRAMP_e; - -typedef struct TRAMPOLINESYM { // Trampoline thunk symbol - unsigned short reclen; // Record length - unsigned short rectyp; // S_TRAMPOLINE - unsigned short trampType; // trampoline sym subtype - unsigned short cbThunk; // size of the thunk - CV_uoff32_t offThunk; // offset of the thunk - CV_uoff32_t offTarget; // offset of the target of the thunk - unsigned short sectThunk; // section index of the thunk - unsigned short sectTarget; // section index of the target of the thunk -} TRAMPOLINE; - -typedef struct LABELSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LABEL32 - CV_uoff32_t off; - unsigned short seg; - CV_PROCFLAGS flags; // flags - unsigned char name[1]; // Length-prefixed name -} LABELSYM32; - - -typedef struct BLOCKSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BLOCK32 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long len; // Block length - CV_uoff32_t off; // Offset in code segment - unsigned short seg; // segment of label - unsigned char name[1]; // Length-prefixed name -} BLOCKSYM32; - - -typedef struct WITHSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_WITH32 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long len; // Block length - CV_uoff32_t off; // Offset in code segment - unsigned short seg; // segment of label - unsigned char expr[1]; // Length-prefixed expression string -} WITHSYM32; - - - -typedef struct CEXMSYM32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_CEXMODEL32 - CV_uoff32_t off; // offset of symbol - unsigned short seg; // segment of symbol - unsigned short model; // execution model - union { - struct { - CV_uoff32_t pcdtable; // offset to pcode function table - CV_uoff32_t pcdspi; // offset to segment pcode information - } pcode; - struct { - unsigned short subtype; // see CV_COBOL_e above - unsigned short flag; - } cobol; - struct { - CV_uoff32_t calltableOff; // offset to function table - unsigned short calltableSeg; // segment of function table - } pcode32Mac; - }; -} CEXMSYM32; - - - -typedef struct VPATHSYM32_16t { - unsigned short reclen; // record length - unsigned short rectyp; // S_VFTABLE32_16t - CV_uoff32_t off; // offset of virtual function table - unsigned short seg; // segment of virtual function table - CV_typ16_t root; // type index of the root of path - CV_typ16_t path; // type index of the path record -} VPATHSYM32_16t; - -typedef struct VPATHSYM32 { - unsigned short reclen; // record length - unsigned short rectyp; // S_VFTABLE32 - CV_typ_t root; // type index of the root of path - CV_typ_t path; // type index of the path record - CV_uoff32_t off; // offset of virtual function table - unsigned short seg; // segment of virtual function table -} VPATHSYM32; - - - - - -typedef struct REGREL32_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_REGREL32_16t - CV_uoff32_t off; // offset of symbol - unsigned short reg; // register index for symbol - CV_typ16_t typind; // Type index - unsigned char name[1]; // Length-prefixed name -} REGREL32_16t; - -typedef struct REGREL32 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_REGREL32 - CV_uoff32_t off; // offset of symbol - CV_typ_t typind; // Type index or metadata token - unsigned short reg; // register index for symbol - unsigned char name[1]; // Length-prefixed name -} REGREL32; - -typedef struct ATTRREGREL { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MANREGREL | S_ATTR_REGREL - CV_uoff32_t off; // offset of symbol - CV_typ_t typind; // Type index or metadata token - unsigned short reg; // register index for symbol - CV_lvar_attr attr; // local var attributes - unsigned char name[1]; // Length-prefixed name -} ATTRREGREL; - -typedef ATTRREGREL ATTRREGRELSYM; - -typedef struct THREADSYM32_16t { - unsigned short reclen; // record length - unsigned short rectyp; // S_LTHREAD32_16t | S_GTHREAD32_16t - CV_uoff32_t off; // offset into thread storage - unsigned short seg; // segment of thread storage - CV_typ16_t typind; // type index - unsigned char name[1]; // length prefixed name -} THREADSYM32_16t; - -typedef struct THREADSYM32 { - unsigned short reclen; // record length - unsigned short rectyp; // S_LTHREAD32 | S_GTHREAD32 - CV_typ_t typind; // type index - CV_uoff32_t off; // offset into thread storage - unsigned short seg; // segment of thread storage - unsigned char name[1]; // length prefixed name -} THREADSYM32; - -typedef struct SLINK32 { - unsigned short reclen; // record length - unsigned short rectyp; // S_SLINK32 - unsigned long framesize; // frame size of parent procedure - CV_off32_t off; // signed offset where the static link was saved relative to the value of reg - unsigned short reg; -} SLINK32; - -typedef struct PROCSYMMIPS_16t { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROCMIPS_16t or S_LPROCMIPS_16t - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - unsigned long regSave; // int register save mask - unsigned long fpSave; // fp register save mask - CV_uoff32_t intOff; // int register save offset - CV_uoff32_t fpOff; // fp register save offset - CV_uoff32_t off; // Symbol offset - unsigned short seg; // Symbol segment - CV_typ16_t typind; // Type index - unsigned char retReg; // Register return value is in - unsigned char frameReg; // Frame pointer register - unsigned char name[1]; // Length-prefixed name -} PROCSYMMIPS_16t; - -typedef struct PROCSYMMIPS { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROCMIPS or S_LPROCMIPS - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - unsigned long regSave; // int register save mask - unsigned long fpSave; // fp register save mask - CV_uoff32_t intOff; // int register save offset - CV_uoff32_t fpOff; // fp register save offset - CV_typ_t typind; // Type index - CV_uoff32_t off; // Symbol offset - unsigned short seg; // Symbol segment - unsigned char retReg; // Register return value is in - unsigned char frameReg; // Frame pointer register - unsigned char name[1]; // Length-prefixed name -} PROCSYMMIPS; - -typedef struct PROCSYMIA64 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROCIA64 or S_LPROCIA64 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol - unsigned long len; // Proc length - unsigned long DbgStart; // Debug start offset - unsigned long DbgEnd; // Debug end offset - CV_typ_t typind; // Type index - CV_uoff32_t off; // Symbol offset - unsigned short seg; // Symbol segment - unsigned short retReg; // Register return value is in - CV_PROCFLAGS flags; // Proc flags - unsigned char name[1]; // Length-prefixed name -} PROCSYMIA64; - -typedef struct REFSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_PROCREF_ST, S_DATAREF_ST, or S_LPROCREF_ST - unsigned long sumName; // SUC of the name - unsigned long ibSym; // Offset of actual symbol in $$Symbols - unsigned short imod; // Module containing the actual symbol - unsigned short usFill; // align this record -} REFSYM; - -typedef struct REFSYM2 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_PROCREF, S_DATAREF, or S_LPROCREF - unsigned long sumName; // SUC of the name - unsigned long ibSym; // Offset of actual symbol in $$Symbols - unsigned short imod; // Module containing the actual symbol - unsigned char name[1]; // hidden name made a first class member -} REFSYM2; - -typedef struct ALIGNSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_ALIGN -} ALIGNSYM; - -typedef struct OEMSYMBOL { - unsigned short reclen; // Record length - unsigned short rectyp; // S_OEM - unsigned char idOem[16]; // an oem ID (GUID) - CV_typ_t typind; // Type index - unsigned long rgl[]; // user data, force 4-byte alignment -} OEMSYMBOL; - -// generic block definition symbols -// these are similar to the equivalent 16:16 or 16:32 symbols but -// only define the length, type and linkage fields - -typedef struct PROCSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_GPROC16 or S_LPROC16 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol -} PROCSYM; - - -typedef struct THUNKSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_THUNK - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end - unsigned long pNext; // pointer to next symbol -} THUNKSYM; - -typedef struct BLOCKSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BLOCK16 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end -} BLOCKSYM; - - -typedef struct WITHSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_WITH16 - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this blocks end -} WITHSYM; - -typedef struct FRAMEPROCSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_FRAMEPROC - unsigned long cbFrame; // count of bytes of total frame of procedure - unsigned long cbPad; // count of bytes of padding in the frame - CV_uoff32_t offPad; // offset (relative to frame poniter) to where - // padding starts - unsigned long cbSaveRegs; // count of bytes of callee save registers - CV_uoff32_t offExHdlr; // offset of exception handler - unsigned short sectExHdlr; // section id of exception handler - - struct { - unsigned long fHasAlloca : 1; // function uses _alloca() - unsigned long fHasSetJmp : 1; // function uses setjmp() - unsigned long fHasLongJmp : 1; // function uses longjmp() - unsigned long fHasInlAsm : 1; // function uses inline asm - unsigned long fHasEH : 1; // function has EH states - unsigned long fInlSpec : 1; // function was speced as inline - unsigned long fHasSEH : 1; // function has SEH - unsigned long fNaked : 1; // function is __declspec(naked) - unsigned long fSecurityChecks : 1; // function has buffer security check introduced by /GS. - unsigned long fAsyncEH : 1; // function compiled with /EHa - unsigned long fGSNoStackOrdering : 1; // function has /GS buffer checks, but stack ordering couldn't be done - unsigned long fWasInlined : 1; // function was inlined within another function - unsigned long fGSCheck : 1; // function is __declspec(strict_gs_check) - unsigned long fSafeBuffers : 1; // function is __declspec(safebuffers) - unsigned long encodedLocalBasePointer : 2; // record function's local pointer explicitly. - unsigned long encodedParamBasePointer : 2; // record function's parameter pointer explicitly. - unsigned long fPogoOn : 1; // function was compiled with PGO/PGU - unsigned long fValidCounts : 1; // Do we have valid Pogo counts? - unsigned long fOptSpeed : 1; // Did we optimize for speed? - unsigned long fGuardCF : 1; // function contains CFG checks (and no write checks) - unsigned long fGuardCFW : 1; // function contains CFW checks and/or instrumentation - unsigned long pad : 9; // must be zero - } flags; -} FRAMEPROCSYM; - -#ifdef __cplusplus -namespace CodeViewInfo -{ -__inline unsigned short ExpandEncodedBasePointerReg(unsigned machineType, unsigned encodedFrameReg) -{ - static const unsigned short rgFramePointerRegX86[] = { - CV_REG_NONE, CV_ALLREG_VFRAME, CV_REG_EBP, CV_REG_EBX}; - static const unsigned short rgFramePointerRegX64[] = { - CV_REG_NONE, CV_AMD64_RSP, CV_AMD64_RBP, CV_AMD64_R13}; - static const unsigned short rgFramePointerRegArm[] = { - CV_REG_NONE, CV_ARM_SP, CV_ARM_R7, CV_REG_NONE}; - - if (encodedFrameReg >= 4) { - return CV_REG_NONE; - } - switch (machineType) { - case CV_CFL_8080 : - case CV_CFL_8086 : - case CV_CFL_80286 : - case CV_CFL_80386 : - case CV_CFL_80486 : - case CV_CFL_PENTIUM : - case CV_CFL_PENTIUMII : - case CV_CFL_PENTIUMIII : - return rgFramePointerRegX86[encodedFrameReg]; - case CV_CFL_AMD64 : - return rgFramePointerRegX64[encodedFrameReg]; - case CV_CFL_ARMNT : - return rgFramePointerRegArm[encodedFrameReg]; - default: - return CV_REG_NONE; - } -} -} -#endif - -typedef struct UNAMESPACE { - unsigned short reclen; // Record length - unsigned short rectyp; // S_UNAMESPACE - unsigned char name[1]; // name -} UNAMESPACE; - -typedef struct SEPCODESYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_SEPCODE - unsigned long pParent; // pointer to the parent - unsigned long pEnd; // pointer to this block's end - unsigned long length; // count of bytes of this block - CV_SEPCODEFLAGS scf; // flags - CV_uoff32_t off; // sect:off of the separated code - CV_uoff32_t offParent; // sectParent:offParent of the enclosing scope - unsigned short sect; // (proc, block, or sepcode) - unsigned short sectParent; -} SEPCODESYM; - -typedef struct BUILDINFOSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_BUILDINFO - CV_ItemId id; // CV_ItemId of Build Info. -} BUILDINFOSYM; - -typedef struct INLINESITESYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_INLINESITE - unsigned long pParent; // pointer to the inliner - unsigned long pEnd; // pointer to this block's end - CV_ItemId inlinee; // CV_ItemId of inlinee - unsigned char binaryAnnotations[CV_ZEROLEN]; // an array of compressed binary annotations. -} INLINESITESYM; - -typedef struct INLINESITESYM2 { - unsigned short reclen; // Record length - unsigned short rectyp; // S_INLINESITE2 - unsigned long pParent; // pointer to the inliner - unsigned long pEnd; // pointer to this block's end - CV_ItemId inlinee; // CV_ItemId of inlinee - unsigned long invocations; // entry count - unsigned char binaryAnnotations[CV_ZEROLEN]; // an array of compressed binary annotations. -} INLINESITESYM2; - - -// Defines a locals and it is live range, how to evaluate. -// S_DEFRANGE modifies previous local S_LOCAL, it has to consecutive. - -typedef struct LOCALSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LOCAL - CV_typ_t typind; // type index - CV_LVARFLAGS flags; // local var flags - - unsigned char name[CV_ZEROLEN]; // Name of this symbol, a null terminated array of UTF8 characters. -} LOCALSYM; - -typedef struct FILESTATICSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_FILESTATIC - CV_typ_t typind; // type index - CV_uoff32_t modOffset; // index of mod filename in stringtable - CV_LVARFLAGS flags; // local var flags - - unsigned char name[CV_ZEROLEN]; // Name of this symbol, a null terminated array of UTF8 characters -} FILESTATICSYM; - -typedef struct DEFRANGESYM { // A live range of sub field of variable - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE - - CV_uoff32_t program; // DIA program to evaluate the value of the symbol - - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps. -} DEFRANGESYM; - -typedef struct DEFRANGESYMSUBFIELD { // A live range of sub field of variable. like locala.i - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_SUBFIELD - - CV_uoff32_t program; // DIA program to evaluate the value of the symbol - - CV_uoff32_t offParent; // Offset in parent variable. - - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps. -} DEFRANGESYMSUBFIELD; - -typedef struct CV_RANGEATTR { - unsigned short maybe : 1; // May have no user name on one of control flow path. - unsigned short padding : 15; // Padding for future use. -} CV_RANGEATTR; - -typedef struct DEFRANGESYMREGISTER { // A live range of en-registed variable - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_REGISTER - unsigned short reg; // Register to hold the value of the symbol - CV_RANGEATTR attr; // Attribute of the register range. - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps. -} DEFRANGESYMREGISTER; - -typedef struct DEFRANGESYMFRAMEPOINTERREL { // A live range of frame variable - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_FRAMEPOINTER_REL - - CV_off32_t offFramePointer; // offset to frame pointer - - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps. -} DEFRANGESYMFRAMEPOINTERREL; - -typedef struct DEFRANGESYMFRAMEPOINTERREL_FULL_SCOPE { // A frame variable valid in all function scope - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_FRAMEPOINTER_REL - - CV_off32_t offFramePointer; // offset to frame pointer -} DEFRANGESYMFRAMEPOINTERREL_FULL_SCOPE; - -#define CV_OFFSET_PARENT_LENGTH_LIMIT 12 - -// Note DEFRANGESYMREGISTERREL and DEFRANGESYMSUBFIELDREGISTER had same layout. -typedef struct DEFRANGESYMSUBFIELDREGISTER { // A live range of sub field of variable. like locala.i - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_SUBFIELD_REGISTER - - unsigned short reg; // Register to hold the value of the symbol - CV_RANGEATTR attr; // Attribute of the register range. - CV_uoff32_t offParent : CV_OFFSET_PARENT_LENGTH_LIMIT; // Offset in parent variable. - CV_uoff32_t padding : 20; // Padding for future use. - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps. -} DEFRANGESYMSUBFIELDREGISTER; - -// Note DEFRANGESYMREGISTERREL and DEFRANGESYMSUBFIELDREGISTER had same layout. -// Used when /GS Copy parameter as local variable or other variable don't cover by FRAMERELATIVE. -typedef struct DEFRANGESYMREGISTERREL { // A live range of variable related to a register. - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_REGISTER_REL - - unsigned short baseReg; // Register to hold the base pointer of the symbol - unsigned short spilledUdtMember : 1; // Spilled member for s.i. - unsigned short padding : 3; // Padding for future use. - unsigned short offsetParent : CV_OFFSET_PARENT_LENGTH_LIMIT; // Offset in parent variable. - CV_off32_t offBasePointer; // offset to register - - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps. -} DEFRANGESYMREGISTERREL; - -typedef struct DEFRANGESYMHLSL { // A live range of variable related to a symbol in HLSL code. - unsigned short reclen; // Record length - unsigned short rectyp; // S_DEFRANGE_HLSL or S_DEFRANGE_DPC_PTR_TAG - - unsigned short regType; // register type from CV_HLSLREG_e - - unsigned short regIndices : 2; // 0, 1 or 2, dimensionality of register space - unsigned short spilledUdtMember : 1; // this is a spilled member - unsigned short memorySpace : 4; // memory space - unsigned short padding : 9; // for future use - - unsigned short offsetParent; // Offset in parent variable. - unsigned short sizeInParent; // Size of enregistered portion - - CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid - unsigned char data[CV_ZEROLEN]; // variable length data specifying gaps where the value is not available - // followed by multi-dimensional offset of variable location in register - // space (see CV_DEFRANGESYMHLSL_* macros below) -} DEFRANGESYMHLSL; - -#define CV_DEFRANGESYM_GAPS_COUNT(x) \ - (((x)->reclen + sizeof((x)->reclen) - sizeof(DEFRANGESYM)) / sizeof(CV_LVAR_ADDR_GAP)) - -#define CV_DEFRANGESYMSUBFIELD_GAPS_COUNT(x) \ - (((x)->reclen + sizeof((x)->reclen) - sizeof(DEFRANGESYMSUBFIELD)) / sizeof(CV_LVAR_ADDR_GAP)) - -#define CV_DEFRANGESYMHLSL_GAPS_COUNT(x) \ - (((x)->reclen + sizeof((x)->reclen) - sizeof(DEFRANGESYMHLSL) - (x)->regIndices * sizeof(CV_uoff32_t)) / sizeof(CV_LVAR_ADDR_GAP)) - -#define CV_DEFRANGESYMHLSL_GAPS_PTR_BASE(x, t) reinterpret_cast((x)->data) - -#define CV_DEFRANGESYMHLSL_GAPS_CONST_PTR(x) \ - CV_DEFRANGESYMHLSL_GAPS_PTR_BASE(x, const CV_LVAR_ADDR_GAP*) - -#define CV_DEFRANGESYMHLSL_GAPS_PTR(x) \ - CV_DEFRANGESYMHLSL_GAPS_PTR_BASE(x, CV_LVAR_ADDR_GAP*) - -#define CV_DEFRANGESYMHLSL_OFFSET_PTR_BASE(x, t) \ - reinterpret_cast(((CV_LVAR_ADDR_GAP*)(x)->data) + CV_DEFRANGESYMHLSL_GAPS_COUNT(x)) - -#define CV_DEFRANGESYMHLSL_OFFSET_CONST_PTR(x) \ - CV_DEFRANGESYMHLSL_OFFSET_PTR_BASE(x, const CV_uoff32_t*) - -#define CV_DEFRANGESYMHLSL_OFFSET_PTR(x) \ - CV_DEFRANGESYMHLSL_OFFSET_PTR_BASE(x, CV_uoff32_t*) - -#if defined(CC_DP_CXX) && CC_DP_CXX - -// Defines a local DPC group shared variable and its location. -typedef struct LOCALDPCGROUPSHAREDSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_LOCAL_DPC_GROUPSHARED - CV_typ_t typind; // type index - CV_LVARFLAGS flags; // local var flags - - unsigned short dataslot; // Base data (cbuffer, groupshared, etc.) slot - unsigned short dataoff; // Base data byte offset start - - unsigned char name[CV_ZEROLEN]; // Name of this symbol, a null terminated array of UTF8 characters. -} LOCALDPCGROUPSHAREDSYM; - -typedef struct DPCSYMTAGMAP { // A map for DPC pointer tag values to symbol records. - unsigned short reclen; // Record length - unsigned short rectyp; // S_DPC_SYM_TAG_MAP - - CV_DPC_SYM_TAG_MAP_ENTRY mapEntries[CV_ZEROLEN]; // Array of mappings from DPC pointer tag values to symbol record offsets -} DPCSYMTAGMAP; - -#define CV_DPCSYMTAGMAP_COUNT(x) \ - (((x)->reclen + sizeof((x)->reclen) - sizeof(DPCSYMTAGMAP)) / sizeof(CV_DPC_SYM_TAG_MAP_ENTRY)) - -#endif // CC_DP_CXX - -typedef enum CV_armswitchtype { - CV_SWT_INT1 = 0, - CV_SWT_UINT1 = 1, - CV_SWT_INT2 = 2, - CV_SWT_UINT2 = 3, - CV_SWT_INT4 = 4, - CV_SWT_UINT4 = 5, - CV_SWT_POINTER = 6, - CV_SWT_UINT1SHL1 = 7, - CV_SWT_UINT2SHL1 = 8, - CV_SWT_INT1SHL1 = 9, - CV_SWT_INT2SHL1 = 10, - CV_SWT_TBB = CV_SWT_UINT1SHL1, - CV_SWT_TBH = CV_SWT_UINT2SHL1, -} CV_armswitchtype; - -typedef struct FUNCTIONLIST { - unsigned short reclen; // Record length - unsigned short rectyp; // S_CALLERS or S_CALLEES - - unsigned long count; // Number of functions - CV_typ_t funcs[CV_ZEROLEN]; // List of functions, dim == count - // unsigned long invocations[CV_ZEROLEN]; Followed by a parallel array of - // invocation counts. Counts > reclen are assumed to be zero -} FUNCTIONLIST; - -typedef struct POGOINFO { - unsigned short reclen; // Record length - unsigned short rectyp; // S_POGODATA - - unsigned long invocations; // Number of times function was called - __int64 dynCount; // Dynamic instruction count - unsigned long numInstrs; // Static instruction count - unsigned long staInstLive; // Final static instruction count (post inlining) -} POGOINFO; - -typedef struct ARMSWITCHTABLE { - unsigned short reclen; // Record length - unsigned short rectyp; // S_ARMSWITCHTABLE - - CV_uoff32_t offsetBase; // Section-relative offset to the base for switch offsets - unsigned short sectBase; // Section index of the base for switch offsets - unsigned short switchType; // type of each entry - CV_uoff32_t offsetBranch; // Section-relative offset to the table branch instruction - CV_uoff32_t offsetTable; // Section-relative offset to the start of the table - unsigned short sectBranch; // Section index of the table branch instruction - unsigned short sectTable; // Section index of the table - unsigned long cEntries; // number of switch table entries -} ARMSWITCHTABLE; - -typedef struct MODTYPEREF { - unsigned short reclen; // Record length - unsigned short rectyp; // S_MOD_TYPEREF - - unsigned long fNone : 1; // module doesn't reference any type - unsigned long fRefTMPCT : 1; // reference /Z7 PCH types - unsigned long fOwnTMPCT : 1; // module contains /Z7 PCH types - unsigned long fOwnTMR : 1; // module contains type info (/Z7) - unsigned long fOwnTM : 1; // module contains type info (/Zi or /ZI) - unsigned long fRefTM : 1; // module references type info owned by other module - unsigned long reserved : 9; - - unsigned short word0; // these two words contain SN or module index depending - unsigned short word1; // on above flags -} MODTYPEREF; - -typedef struct SECTIONSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_SECTION - - unsigned short isec; // Section number - unsigned char align; // Alignment of this section (power of 2) - unsigned char bReserved; // Reserved. Must be zero. - unsigned long rva; - unsigned long cb; - unsigned long characteristics; - unsigned char name[1]; // name -} SECTIONSYM; - -typedef struct COFFGROUPSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_COFFGROUP - - unsigned long cb; - unsigned long characteristics; - CV_uoff32_t off; // Symbol offset - unsigned short seg; // Symbol segment - unsigned char name[1]; // name -} COFFGROUPSYM; - -typedef struct EXPORTSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_EXPORT - - unsigned short ordinal; - unsigned short fConstant : 1; // CONSTANT - unsigned short fData : 1; // DATA - unsigned short fPrivate : 1; // PRIVATE - unsigned short fNoName : 1; // NONAME - unsigned short fOrdinal : 1; // Ordinal was explicitly assigned - unsigned short fForwarder : 1; // This is a forwarder - unsigned short reserved : 10; // Reserved. Must be zero. - unsigned char name[1]; // name of -} EXPORTSYM; - -// -// Symbol for describing indirect calls when they are using -// a function pointer cast on some other type or temporary. -// Typical content will be an LF_POINTER to an LF_PROCEDURE -// type record that should mimic an actual variable with the -// function pointer type in question. -// -// Since the compiler can sometimes tail-merge a function call -// through a function pointer, there may be more than one -// S_CALLSITEINFO record at an address. This is similar to what -// you could do in your own code by: -// -// if (expr) -// pfn = &function1; -// else -// pfn = &function2; -// -// (*pfn)(arg list); -// - -typedef struct CALLSITEINFO { - unsigned short reclen; // Record length - unsigned short rectyp; // S_CALLSITEINFO - CV_off32_t off; // offset of call site - unsigned short sect; // section index of call site - unsigned short __reserved_0; // alignment padding field, must be zero - CV_typ_t typind; // type index describing function signature -} CALLSITEINFO; - -typedef struct HEAPALLOCSITE { - unsigned short reclen; // Record length - unsigned short rectyp; // S_HEAPALLOCSITE - CV_off32_t off; // offset of call site - unsigned short sect; // section index of call site - unsigned short cbInstr; // length of heap allocation call instruction - CV_typ_t typind; // type index describing function signature -} HEAPALLOCSITE; - -// Frame cookie information - -typedef enum CV_cookietype_e -{ - CV_COOKIETYPE_COPY = 0, - CV_COOKIETYPE_XOR_SP, - CV_COOKIETYPE_XOR_BP, - CV_COOKIETYPE_XOR_R13, -} CV_cookietype_e; - -// Symbol for describing security cookie's position and type -// (raw, xor'd with esp, xor'd with ebp). - -typedef struct FRAMECOOKIE { - unsigned short reclen; // Record length - unsigned short rectyp; // S_FRAMECOOKIE - CV_off32_t off; // Frame relative offset - unsigned short reg; // Register index - CV_cookietype_e cookietype; // Type of the cookie - unsigned char flags; // Flags describing this cookie -} FRAMECOOKIE; - -typedef enum CV_DISCARDED_e -{ - CV_DISCARDED_UNKNOWN, - CV_DISCARDED_NOT_SELECTED, - CV_DISCARDED_NOT_REFERENCED, -} CV_DISCARDED_e; - -typedef struct DISCARDEDSYM { - unsigned short reclen; // Record length - unsigned short rectyp; // S_DISCARDED - unsigned long discarded : 8; // CV_DISCARDED_e - unsigned long reserved : 24; // Unused - unsigned long fileid; // First FILEID if line number info present - unsigned long linenum; // First line number - char data[CV_ZEROLEN]; // Original record(s) with invalid type indices -} DISCARDEDSYM; - -typedef struct REFMINIPDB { - unsigned short reclen; // Record length - unsigned short rectyp; // S_REF_MINIPDB - union { - unsigned long isectCoff; // coff section - CV_typ_t typind; // type index - }; - unsigned short imod; // mod index - unsigned short fLocal : 1; // reference to local (vs. global) func or data - unsigned short fData : 1; // reference to data (vs. func) - unsigned short fUDT : 1; // reference to UDT - unsigned short fLabel : 1; // reference to label - unsigned short fConst : 1; // reference to const - unsigned short reserved : 11; // reserved, must be zero - unsigned char name[1]; // zero terminated name string -} REFMINIPDB; - -typedef struct PDBMAP { - unsigned short reclen; // Record length - unsigned short rectyp; // S_PDBMAP - unsigned char name[CV_ZEROLEN]; // zero terminated source PDB filename followed by zero - // terminated destination PDB filename, both in wchar_t -} PDBMAP; - -// -// V7 line number data types -// - -enum DEBUG_S_SUBSECTION_TYPE { - DEBUG_S_IGNORE = 0x80000000, // if this bit is set in a subsection type then ignore the subsection contents - - DEBUG_S_SYMBOLS = 0xf1, - DEBUG_S_LINES, - DEBUG_S_STRINGTABLE, - DEBUG_S_FILECHKSMS, - DEBUG_S_FRAMEDATA, - DEBUG_S_INLINEELINES, - DEBUG_S_CROSSSCOPEIMPORTS, - DEBUG_S_CROSSSCOPEEXPORTS, - - DEBUG_S_IL_LINES, - DEBUG_S_FUNC_MDTOKEN_MAP, - DEBUG_S_TYPE_MDTOKEN_MAP, - DEBUG_S_MERGED_ASSEMBLYINPUT, - - DEBUG_S_COFF_SYMBOL_RVA, -}; - -struct CV_DebugSSubsectionHeader_t { - enum DEBUG_S_SUBSECTION_TYPE type; - CV_off32_t cbLen; -}; - -struct CV_DebugSLinesHeader_t { - CV_off32_t offCon; - unsigned short segCon; - unsigned short flags; - CV_off32_t cbCon; -}; - -struct CV_DebugSLinesFileBlockHeader_t { - CV_off32_t offFile; - CV_off32_t nLines; - CV_off32_t cbBlock; - // CV_Line_t lines[nLines]; - // CV_Column_t columns[nColumns]; -}; - -// -// Line flags (data present) -// -#define CV_LINES_HAVE_COLUMNS 0x0001 - -struct CV_Line_t { - unsigned long offset; // Offset to start of code bytes for line number - unsigned long linenumStart:24; // line where statement/expression starts - unsigned long deltaLineEnd:7; // delta to line where statement ends (optional) - unsigned long fStatement:1; // true if a statement linenumber, else an expression line num -}; - -typedef unsigned short CV_columnpos_t; // byte offset in a source line - -struct CV_Column_t { - CV_columnpos_t offColumnStart; - CV_columnpos_t offColumnEnd; -}; - -struct tagFRAMEDATA { - unsigned long ulRvaStart; - unsigned long cbBlock; - unsigned long cbLocals; - unsigned long cbParams; - unsigned long cbStkMax; - unsigned long frameFunc; - unsigned short cbProlog; - unsigned short cbSavedRegs; - unsigned long fHasSEH:1; - unsigned long fHasEH:1; - unsigned long fIsFunctionStart:1; - unsigned long reserved:29; -}; - -typedef struct tagFRAMEDATA FRAMEDATA, * PFRAMEDATA; - -typedef struct tagXFIXUP_DATA { - unsigned short wType; - unsigned short wExtra; - unsigned long rva; - unsigned long rvaTarget; -} XFIXUP_DATA; - -// Those cross scope IDs are private convention, -// it used to delay the ID merging for frontend and backend even linker. -// It is transparent for DIA client. -// Use those ID will let DIA run a litter slower and but -// avoid the copy type tree in some scenarios. - -#ifdef __cplusplus -namespace CodeViewInfo -{ - -typedef struct ComboID -{ - static const unsigned int IndexBitWidth = 20; - static const unsigned int ImodBitWidth = 12; - - ComboID(unsigned short imod, unsigned int index) - { - m_comboID = (((unsigned int) imod) << IndexBitWidth) | index; - } - - ComboID(unsigned int comboID) - { - m_comboID = comboID; - } - - operator unsigned int() - { - return m_comboID; - } - - unsigned short GetModIndex() - { - return (unsigned short) (m_comboID >> IndexBitWidth); - } - - unsigned int GetIndex() - { - return (m_comboID & ((1 << IndexBitWidth) - 1)); - } - -private: - - unsigned int m_comboID; -} ComboID; - - -typedef struct CrossScopeId -{ - static const unsigned int LocalIdBitWidth = 20; - static const unsigned int IdScopeBitWidth = 11; - static const unsigned int StartCrossScopeId = - (unsigned int) (1 << (LocalIdBitWidth + IdScopeBitWidth)); - static const unsigned int LocalIdMask = (1 << LocalIdBitWidth) - 1; - static const unsigned int ScopeIdMask = StartCrossScopeId - (1 << LocalIdBitWidth); - - // Compilation unit at most reference 1M constructed type. - static const unsigned int MaxLocalId = (1 << LocalIdBitWidth) - 1; - - // Compilation unit at most reference to another 2K compilation units. - static const unsigned int MaxScopeId = (1 << IdScopeBitWidth) - 1; - - CrossScopeId(unsigned short aIdScopeId, unsigned int aLocalId) - { - crossScopeId = StartCrossScopeId - | (aIdScopeId << LocalIdBitWidth) - | aLocalId; - } - - operator unsigned int() { - return crossScopeId; - } - - unsigned int GetLocalId() { - return crossScopeId & LocalIdMask; - } - - unsigned int GetIdScopeId() { - return (crossScopeId & ScopeIdMask) >> LocalIdBitWidth; - } - - static bool IsCrossScopeId(unsigned int i) - { - return (StartCrossScopeId & i) != 0; - } - - static CrossScopeId Decode(unsigned int i) - { - CrossScopeId retval; - retval.crossScopeId = i; - return retval; - } - -private: - - CrossScopeId() {} - - unsigned int crossScopeId; - -} CrossScopeId; - -// Combined encoding of TI or FuncId, In compiler implementation -// Id prefixed by 1 if it is function ID. - -typedef struct DecoratedItemId -{ - DecoratedItemId(bool isFuncId, CV_ItemId inputId) { - if (isFuncId) { - decoratedItemId = 0x80000000 | inputId; - } else { - decoratedItemId = inputId; - } - } - - DecoratedItemId(CV_ItemId encodedId) { - decoratedItemId = encodedId; - } - - operator unsigned int() { - return decoratedItemId; - } - - bool IsFuncId() - { - return (decoratedItemId & 0x80000000) == 0x80000000; - } - - CV_ItemId GetItemId() - { - return decoratedItemId & 0x7fffffff; - } - -private: - - unsigned int decoratedItemId; - -} DecoratedItemId; - -// Compilation Unit object file path include library name -// Or compile time PDB full path - -typedef struct tagPdbIdScope { - CV_off32_t offObjectFilePath; -} PdbIdScope; - -// An array of all imports by import module. -// List all cross reference for a specific ID scope. -// Format of DEBUG_S_CROSSSCOPEIMPORTS subsection is -typedef struct tagCrossScopeReferences { - PdbIdScope externalScope; // Module of definition Scope. - unsigned int countOfCrossReferences; // Count of following array. - CV_ItemId referenceIds[CV_ZEROLEN]; // CV_ItemId in another compilation unit. -} CrossScopeReferences; - -// An array of all exports in this module. -// Format of DEBUG_S_CROSSSCOPEEXPORTS subsection is -typedef struct tagLocalIdAndGlobalIdPair { - CV_ItemId localId; // local id inside the compile time PDB scope. 0 based - CV_ItemId globalId; // global id inside the link time PDB scope, if scope are different. -} LocalIdAndGlobalIdPair; - -// Format of DEBUG_S_INLINEELINEINFO subsection -// List start source file information for an inlined function. - -#define CV_INLINEE_SOURCE_LINE_SIGNATURE 0x0 -#define CV_INLINEE_SOURCE_LINE_SIGNATURE_EX 0x1 - -typedef struct tagInlineeSourceLine { - CV_ItemId inlinee; // function id. - CV_off32_t fileId; // offset into file table DEBUG_S_FILECHKSMS - CV_off32_t sourceLineNum; // definition start line number. -} InlineeSourceLine; - -typedef struct tagInlineeSourceLineEx { - CV_ItemId inlinee; // function id - CV_off32_t fileId; // offset into file table DEBUG_S_FILECHKSMS - CV_off32_t sourceLineNum; // definition start line number - unsigned int countOfExtraFiles; - CV_off32_t extraFileId[CV_ZEROLEN]; -} InlineeSourceLineEx; - -// BinaryAnnotations ::= BinaryAnnotationInstruction+ -// BinaryAnnotationInstruction ::= BinaryAnnotationOpcode Operand+ -// -// The binary annotation mechanism supports recording a list of annotations -// in an instruction stream. The X64 unwind code and the DWARF standard have -// similar design. -// -// One annotation contains opcode and a number of 32bits operands. -// -// The initial set of annotation instructions are for line number table -// encoding only. These annotations append to S_INLINESITE record, and -// operands are unsigned except for BA_OP_ChangeLineOffset. - -enum BinaryAnnotationOpcode -{ - BA_OP_Invalid, // link time pdb contains PADDINGs - BA_OP_CodeOffset, // param : start offset - BA_OP_ChangeCodeOffsetBase, // param : nth separated code chunk (main code chunk == 0) - BA_OP_ChangeCodeOffset, // param : delta of offset - BA_OP_ChangeCodeLength, // param : length of code, default next start - BA_OP_ChangeFile, // param : fileId - BA_OP_ChangeLineOffset, // param : line offset (signed) - BA_OP_ChangeLineEndDelta, // param : how many lines, default 1 - BA_OP_ChangeRangeKind, // param : either 1 (default, for statement) - // or 0 (for expression) - - BA_OP_ChangeColumnStart, // param : start column number, 0 means no column info - BA_OP_ChangeColumnEndDelta, // param : end column number delta (signed) - - // Combo opcodes for smaller encoding size. - - BA_OP_ChangeCodeOffsetAndLineOffset, // param : ((sourceDelta << 4) | CodeDelta) - BA_OP_ChangeCodeLengthAndCodeOffset, // param : codeLength, codeOffset - - BA_OP_ChangeColumnEnd, // param : end column number -}; - -inline int BinaryAnnotationInstructionOperandCount(BinaryAnnotationOpcode op) -{ - return (op == BA_OP_ChangeCodeLengthAndCodeOffset) ? 2 : 1; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// This routine a simplified variant from cor.h. -// -// Compress an unsigned integer (iLen) and store the result into pDataOut. -// -// Return value is the number of bytes that the compressed data occupies. It -// is caller's responsibilityt to ensure *pDataOut has at least 4 bytes to be -// written to. -// -// Note that this function returns -1 if iLen is too big to be compressed. -// We currently can only encode numbers no larger than 0x1FFFFFFF. -// -/////////////////////////////////////////////////////////////////////////////// - -typedef unsigned __int8 UInt8; -typedef unsigned __int32 UInt32; - -typedef UInt8 CompressedAnnotation; -typedef CompressedAnnotation* PCompressedAnnotation; - -inline UInt32 CVCompressData( - UInt32 iLen, // [IN] given uncompressed data - void * pDataOut) // [OUT] buffer for the compressed data -{ - UInt8 *pBytes = reinterpret_cast(pDataOut); - - if (iLen <= 0x7F) { - *pBytes = UInt8(iLen); - return 1; - } - - if (iLen <= 0x3FFF) { - *pBytes = UInt8((iLen >> 8) | 0x80); - *(pBytes+1) = UInt8(iLen & 0xff); - return 2; - } - - if (iLen <= 0x1FFFFFFF) { - *pBytes = UInt8((iLen >> 24) | 0xC0); - *(pBytes+1) = UInt8((iLen >> 16) & 0xff); - *(pBytes+2) = UInt8((iLen >> 8) & 0xff); - *(pBytes+3) = UInt8(iLen & 0xff); - return 4; - } - - return (UInt32) -1; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Uncompress the data in pData and store the result into pDataOut. -// -// Return value is the uncompressed unsigned integer. pData is incremented to -// point to the next piece of uncompressed data. -// -// Returns -1 if what is passed in is incorrectly compressed data, such as -// (*pBytes & 0xE0) == 0xE0. -// -/////////////////////////////////////////////////////////////////////////////// - -inline UInt32 CVUncompressData( - PCompressedAnnotation & pData) // [IN,OUT] compressed data -{ - UInt32 res = (UInt32)(-1); - - if ((*pData & 0x80) == 0x00) { - // 0??? ???? - - res = (UInt32)(*pData++); - } - else if ((*pData & 0xC0) == 0x80) { - // 10?? ???? - - res = (UInt32)((*pData++ & 0x3f) << 8); - res |= *pData++; - } - else if ((*pData & 0xE0) == 0xC0) { - // 110? ???? - - res = (*pData++ & 0x1f) << 24; - res |= *pData++ << 16; - res |= *pData++ << 8; - res |= *pData++; - } - - return res; -} - -// Encode smaller absolute numbers with smaller buffer. -// -// General compression only work for input < 0x1FFFFFFF -// algorithm will not work on 0x80000000 - -inline unsigned __int32 EncodeSignedInt32(__int32 input) -{ - unsigned __int32 rotatedInput; - - if (input >= 0) { - rotatedInput = input << 1; - } else { - rotatedInput = ((-input) << 1) | 1; - } - - return rotatedInput; -} - -inline __int32 DecodeSignedInt32(unsigned __int32 input) -{ - __int32 rotatedInput; - - if (input & 1) { - rotatedInput = - (int)(input >> 1); - } else { - rotatedInput = input >> 1; - } - - return rotatedInput; -} - -} -#endif -#pragma pack ( pop ) - -#endif /* CV_INFO_INCLUDED */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/daccess.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/daccess.h index 74aeed1c9..a26146c05 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/daccess.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/daccess.h @@ -282,17 +282,17 @@ // // extern ThreadStore* g_pThreadStore; // ThreadStore* g_pThreadStore = &StaticStore; -// class SystemDomain : public BaseDomain { +// class CodeVersionManager { // ... -// ArrayListStatic m_appDomainIndexList; +// static BOOL s_HasNonDefaultILVersions; // ... // } // // SystemDomain::m_appDomainIndexList; // -// extern DWORD gThreadTLSIndex; +// extern DWORD g_TlsIndex; // -// DWORD gThreadTLSIndex = TLS_OUT_OF_INDEXES; +// DWORD g_TlsIndex = TLS_OUT_OF_INDEXES; // // Modified Code: // @@ -304,17 +304,17 @@ // GPTR_DECL(ThreadStore, g_pThreadStore); // GPTR_IMPL_INIT(ThreadStore, g_pThreadStore, &StaticStore); // -// class SystemDomain : public BaseDomain { +// class CodeVersionManager { // ... -// SVAL_DECL(ArrayListStatic; m_appDomainIndexList); +// SVAL_DECL(BOOL, s_HasNonDefaultILVersions); // ... // } // // SVAL_IMPL(ArrayListStatic, SystemDomain, m_appDomainIndexList); // -// GVAL_DECL(DWORD, gThreadTLSIndex); +// GVAL_DECL(DWORD, g_TlsIndex); // -// GVAL_IMPL_INIT(DWORD, gThreadTLSIndex, TLS_OUT_OF_INDEXES); +// GVAL_IMPL_INIT(DWORD, g_TlsIndex, TLS_OUT_OF_INDEXES); // // When declaring the variable, the first argument declares the // variable's type and the second argument declares the variable's @@ -699,7 +699,6 @@ PWSTR DacInstantiateStringW(TADDR addr, ULONG32 maxChars, bool throwEx); TADDR DacGetTargetAddrForHostAddr(LPCVOID ptr, bool throwEx); TADDR DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx); TADDR DacGetTargetVtForHostVt(LPCVOID vtHost, bool throwEx); -PWSTR DacGetVtNameW(TADDR targetVtable); // Report a region of memory to the debugger bool DacEnumMemoryRegion(TADDR addr, TSIZE_T size, bool fExpectSuccess = true); @@ -709,15 +708,15 @@ bool DacUpdateMemoryRegion(TADDR addr, TSIZE_T bufferSize, BYTE* buffer); HRESULT DacWriteHostInstance(PVOID host, bool throwEx); -// This is meant to mimic the RethrowTerminalExceptions/ -// SwallowAllExceptions/RethrowTransientExceptions macros to allow minidump +// This is meant to mimic the RethrowTerminalExceptions()/ +// RethrowTransientExceptions() macros to allow minidump // gathering cancelation for details see // code:ClrDataAccess.EnumMemoryRegionsWrapper extern void DacLogMessage(LPCSTR format, ...); -// This is usable in EX_TRY exactly how RethrowTerminalExceptions et cetera -#define RethrowCancelExceptions \ +// This is usable in EX_TRY exactly how RethrowTerminalExceptions() et cetera +#define RethrowCancelExceptions() \ if (GET_EXCEPTION()->GetHR() == COR_E_OPERATIONCANCELED) \ { \ EX_RETHROW; \ @@ -830,11 +829,6 @@ struct _UNWIND_INFO * DacGetUnwindInfo(TADDR taUnwindInfo); BOOL DacUnwindStackFrame(T_CONTEXT * pContext, T_KNONVOLATILE_CONTEXT_POINTERS* pContextPointers); #endif // FEATURE_EH_FUNCLETS -#if defined(TARGET_UNIX) -// call back through data target to unwind out-of-process -HRESULT DacVirtualUnwind(ULONG32 threadId, PT_CONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers); -#endif // TARGET_UNIX - #ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS class SString; void DacMdCacheAddEEName(TADDR taEE, const SString& ssEEName); @@ -994,7 +988,7 @@ class __DPtrBase : public __TPtrBase __DPtrBase() = default; explicit __DPtrBase(__TPtrBase ptr) : __TPtrBase(ptr.GetAddr()) {} - + // construct const from non-const __DPtrBase(__DPtrBase::type, DPtrTemplate> const & rhs) : __DPtrBase(rhs.GetAddr()) {} @@ -2205,11 +2199,6 @@ public: name(int dummy) : base(dummy) {} // helper macro to make the vtables unique for DAC #define VPTR_UNIQUE(unique) virtual int MakeVTableUniqueForDAC() { return unique; } -#define VPTR_UNIQUE_BaseDomain (100000) -#define VPTR_UNIQUE_SystemDomain (VPTR_UNIQUE_BaseDomain + 1) -#define VPTR_UNIQUE_ComMethodFrame (VPTR_UNIQUE_SystemDomain + 1) -#define VPTR_UNIQUE_RedirectedThreadFrame (VPTR_UNIQUE_ComMethodFrame + 1) -#define VPTR_UNIQUE_HijackFrame (VPTR_UNIQUE_RedirectedThreadFrame + 1) #define PTR_TO_TADDR(ptr) ((TADDR)(ptr)) #define GFN_TADDR(name) ((TADDR)(name)) @@ -2319,10 +2308,10 @@ public: name(int dummy) : base(dummy) {} // pMD = dac_cast(pInstMD) // // - (D|V)PTR of one encapsulated pointer type to a (D|V)PTR of -// another type, i.e., PTR_AppDomain <-> PTR_BaseDomain -// Syntax: with PTR_AppDomain pAD, PTR_BaseDomain pBD -// dac_cast(pBD) -// dac_cast(pAD) +// another type, i.e., PTR_Module <-> PTR_ModuleBase +// Syntax: with PTR_Module pModule, PTR_Module pModuleBase +// dac_cast(pModuleBase) +// dac_cast(pModule) // // Example comparisons of some old and new syntax, where // h is a host pointer, such as "Foo *h;" @@ -2469,6 +2458,12 @@ typedef DPTR(T_RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; #endif #endif +#ifdef DACCESS_COMPILE +#define DAC_IGNORE(x) +#else +#define DAC_IGNORE(x) x +#endif // DACCESS_COMPILE + //---------------------------------------------------------------------------- // // A PCODE is a valid PC/IP value -- a pointer to an instruction, possibly including some processor mode bits. diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/dacprivate.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/dacprivate.h index 305029634..9e23b4df7 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/dacprivate.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/dacprivate.h @@ -425,11 +425,11 @@ enum DacpAppDomainDataStage { STAGE_CLOSED }; -// Information about a BaseDomain (AppDomain, SharedDomain or SystemDomain). +// Information about an AppDomain or SystemDomain. // For types other than AppDomain, some fields (like dwID, DomainLocalBlock, etc.) will be 0/null. struct MSLAYOUT DacpAppDomainData { - // The pointer to the BaseDomain (not necessarily an AppDomain). + // The pointer to the AppDomain or SystemDomain. // It's useful to keep this around in the structure CLRDATA_ADDRESS AppDomainPtr = 0; CLRDATA_ADDRESS AppSecDesc = 0; @@ -455,7 +455,7 @@ struct MSLAYOUT DacpAssemblyData CLRDATA_ADDRESS AssemblyPtr = 0; //useful to have CLRDATA_ADDRESS ClassLoader = 0; CLRDATA_ADDRESS ParentDomain = 0; - CLRDATA_ADDRESS BaseDomainPtr = 0; + CLRDATA_ADDRESS DomainPtr = 0; CLRDATA_ADDRESS AssemblySecDesc = 0; BOOL isDynamic = FALSE; UINT ModuleCount = FALSE; @@ -463,9 +463,9 @@ struct MSLAYOUT DacpAssemblyData BOOL isDomainNeutral = FALSE; // Always false, preserved for backward compatibility DWORD dwLocationFlags = 0; - HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr, CLRDATA_ADDRESS baseDomainPtr) + HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr, CLRDATA_ADDRESS domainPtr) { - return sos->GetAssemblyData(baseDomainPtr, addr, this); + return sos->GetAssemblyData(domainPtr, addr, this); } HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr) @@ -967,7 +967,7 @@ struct MSLAYOUT DACEHInfo CLRDATA_ADDRESS tryEndOffset = 0; CLRDATA_ADDRESS handlerStartOffset = 0; CLRDATA_ADDRESS handlerEndOffset = 0; - BOOL isDuplicateClause = FALSE; + BOOL isDuplicateClause = FALSE; // unused CLRDATA_ADDRESS filterOffset = 0; // valid when clauseType is EHFilter BOOL isCatchAllHandler = FALSE; // valid when clauseType is EHTyped CLRDATA_ADDRESS moduleAddr = 0; // when == 0 mtCatch contains a MethodTable, when != 0 tokCatch contains a type token diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/dacvars.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/dacvars.h index 039951763..31a618b33 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/dacvars.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/dacvars.h @@ -84,6 +84,10 @@ DEFINE_DACVAR(PTR_EEJitManager, ExecutionManager__m_pEEJitManager, ExecutionMana #ifdef FEATURE_READYTORUN DEFINE_DACVAR(PTR_ReadyToRunJitManager, ExecutionManager__m_pReadyToRunJitManager, ExecutionManager::m_pReadyToRunJitManager) #endif +#ifdef FEATURE_INTERPRETER +DEFINE_DACVAR(PTR_InterpreterJitManager, ExecutionManager__m_pInterpreterJitManager, ExecutionManager::m_pInterpreterJitManager) +DEFINE_DACVAR(PTR_InterpreterCodeManager, ExecutionManager__m_pInterpreterCodeMan, ExecutionManager::m_pInterpreterCodeMan) +#endif DEFINE_DACVAR_NO_DUMP(VMHELPDEF *, dac__hlpFuncTable, ::hlpFuncTable) DEFINE_DACVAR(VMHELPDEF *, dac__hlpDynamicFuncTable, ::hlpDynamicFuncTable) @@ -91,7 +95,6 @@ DEFINE_DACVAR(VMHELPDEF *, dac__hlpDynamicFuncTable, ::hlpDynamicFuncTable) DEFINE_DACVAR(PTR_StubManager, StubManager__g_pFirstManager, StubManager::g_pFirstManager) DEFINE_DACVAR(PTR_PrecodeStubManager, PrecodeStubManager__g_pManager, PrecodeStubManager::g_pManager) DEFINE_DACVAR(PTR_StubLinkStubManager, StubLinkStubManager__g_pManager, StubLinkStubManager::g_pManager) -DEFINE_DACVAR(PTR_ThunkHeapStubManager, ThunkHeapStubManager__g_pManager, ThunkHeapStubManager::g_pManager) DEFINE_DACVAR(PTR_JumpStubStubManager, JumpStubStubManager__g_pManager, JumpStubStubManager::g_pManager) DEFINE_DACVAR(PTR_RangeSectionStubManager, RangeSectionStubManager__g_pManager, RangeSectionStubManager::g_pManager) DEFINE_DACVAR(PTR_VirtualCallStubManagerManager, VirtualCallStubManagerManager__g_pManager, VirtualCallStubManagerManager::g_pManager) @@ -112,12 +115,12 @@ DEFINE_DACVAR(PTR_SystemDomain, SystemDomain__m_pSystemDomain, SystemDomain::m_p DEFINE_DACVAR(DWORD, dac__g_debuggerWordTLSIndex, g_debuggerWordTLSIndex) #endif DEFINE_DACVAR(DWORD, dac__g_TlsIndex, g_TlsIndex) +DEFINE_DACVAR(DWORD, dac__g_offsetOfCurrentThreadInfo, g_offsetOfCurrentThreadInfo) #ifdef FEATURE_EH_FUNCLETS DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pEHClass, ::g_pEHClass) DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pExceptionServicesInternalCallsClass, ::g_pExceptionServicesInternalCallsClass) DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pStackFrameIteratorClass, ::g_pStackFrameIteratorClass) -DEFINE_DACVAR(BOOL, dac__g_isNewExceptionHandlingEnabled, ::g_isNewExceptionHandlingEnabled) #endif DEFINE_DACVAR(PTR_SString, SString__s_Empty, SString::s_Empty) @@ -140,7 +143,7 @@ DEFINE_DACVAR(ProfControlBlock, dac__g_profControlBlock, ::g_profControlBlock) DEFINE_DACVAR(PTR_DWORD, dac__g_card_table, ::g_card_table) DEFINE_DACVAR(PTR_BYTE, dac__g_lowest_address, ::g_lowest_address) DEFINE_DACVAR(PTR_BYTE, dac__g_highest_address, ::g_highest_address) -DEFINE_DACVAR(gc_alloc_context, dac__g_global_alloc_context, ::g_global_alloc_context) +DEFINE_DACVAR(ee_alloc_context, dac__g_global_alloc_context, ::g_global_alloc_context) DEFINE_DACVAR(IGCHeap, dac__g_pGCHeap, ::g_pGCHeap) @@ -175,14 +178,10 @@ DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pBaseCOMObject, ::g_pBaseCOMObject) DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pIDynamicInterfaceCastableInterface, ::g_pIDynamicInterfaceCastableInterface) -#ifdef FEATURE_ICASTABLE -DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pICastableInterface, ::g_pICastableInterface) -#endif // FEATURE_ICASTABLE - DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pObjectFinalizerMD, ::g_pObjectFinalizerMD) DEFINE_DACVAR(bool, dac__g_fProcessDetach, ::g_fProcessDetach) -DEFINE_DACVAR(DWORD, dac__g_fEEShutDown, ::g_fEEShutDown) +DEFINE_DACVAR_VOLATILE(DWORD, dac__g_fEEShutDown, ::g_fEEShutDown) DEFINE_DACVAR(ULONG, dac__g_CORDebuggerControlFlags, ::g_CORDebuggerControlFlags) DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pDebugger, ::g_pDebugger) @@ -196,10 +195,6 @@ DEFINE_DACVAR(BOOL, Debugger__s_fCanChangeNgenFlags, Debugger::s_fCanChangeNgenF DEFINE_DACVAR(PTR_DebuggerPatchTable, DebuggerController__g_patches, DebuggerController::g_patches) DEFINE_DACVAR(BOOL, DebuggerController__g_patchTableValid, DebuggerController::g_patchTableValid) -DEFINE_DACVAR(SIZE_T, dac__gLowestFCall, ::gLowestFCall) -DEFINE_DACVAR(SIZE_T, dac__gHighestFCall, ::gHighestFCall) -DEFINE_DACVAR(SIZE_T, dac__gFCallMethods, ::gFCallMethods) - DEFINE_DACVAR(PTR_SyncTableEntry, dac__g_pSyncTable, ::g_pSyncTable) #ifdef FEATURE_COMINTEROP DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pRCWCleanupList, ::g_pRCWCleanupList) @@ -238,5 +233,7 @@ DEFINE_DACVAR(bool, dac__g_metadataUpdatesApplied, ::g_metadataUpdatesApplied) DEFINE_DACVAR(PTR_WSTR, dac__g_EntryAssemblyPath, ::g_EntryAssemblyPath) +DEFINE_DACVAR(CDacPlatformMetadata, dac__g_cdacPlatformMetadata, ::g_cdacPlatformMetadata) + #undef DEFINE_DACVAR #undef DEFINE_DACVAR_NO_DUMP diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/debugmacros.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/debugmacros.h index 35592ea36..3d2918f68 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/debugmacros.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/debugmacros.h @@ -13,8 +13,8 @@ #include "stacktrace.h" #include "debugmacrosext.h" #include "palclr.h" +#include -#undef _ASSERTE #undef VERIFY #ifdef __cplusplus @@ -55,8 +55,12 @@ extern VOID ANALYZER_NORETURN DbgAssertDialog(const char *szFile, int iLine, con #else // !_DEBUG -#define _ASSERTE(expr) ((void)0) -#define _ASSERTE_MSG(expr, msg) ((void)0) +#if !defined(_ASSERTE) + #define _ASSERTE(expr) ((void)0) +#endif +#if !defined(_ASSERTE_MSG) + #define _ASSERTE_MSG(expr, msg) ((void)0) +#endif #define VERIFY(stmt) (void)(stmt) // At this point, EEPOLICY_HANDLE_FATAL_ERROR may or may not be defined. It will be defined diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/debugreturn.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/debugreturn.h deleted file mode 100644 index d052364ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/debugreturn.h +++ /dev/null @@ -1,124 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -#ifndef _DEBUGRETURN_H_ -#define _DEBUGRETURN_H_ - -// Note that with OACR Prefast is run over checked (_DEBUG is defined) sources -// so we have to first check the _PREFAST_ define followed by the _DEBUG define -// -#ifdef _PREFAST_ - -// Use prefast to detect gotos out of no-return blocks. The gotos out of no-return blocks -// should be reported as memory leaks by prefast. The (nothrow) is because PREfix sees the -// throw from the new statement, and doesn't like these macros used in a destructor (and -// the NULL returned by failure works just fine in delete[]) - -#define DEBUG_ASSURE_NO_RETURN_BEGIN(arg) { char* __noReturnInThisBlock_##arg = ::new (nothrow) char[1]; -#define DEBUG_ASSURE_NO_RETURN_END(arg) ::delete[] __noReturnInThisBlock_##arg; } - -#define DEBUG_OK_TO_RETURN_BEGIN(arg) { ::delete[] __noReturnInThisBlock_##arg; -#define DEBUG_OK_TO_RETURN_END(arg) __noReturnInThisBlock_##arg = ::new (nothrow) char[1]; } - -#define DEBUG_ASSURE_SAFE_TO_RETURN TRUE -#define return return - -#else // !_PREFAST_ - -// This is disabled in build 190024315 (a pre-release build after VS 2015 Update 3) and -// earlier because those builds only support C++11 constexpr, which doesn't allow the -// use of 'if' statements within the body of a constexpr function. Later builds support -// C++14 constexpr. -#if defined(_DEBUG) && !defined(JIT_BUILD) && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER > 190024315) - -// Code to generate a compile-time error if return statements appear where they -// shouldn't. -// -// Here's the way it works... -// -// We create two classes with a safe_to_return() method. The method is static, -// returns void, and does nothing. One class has the method as public, the other -// as private. We introduce a global scope typedef for __ReturnOK that refers to -// the class with the public method. So, by default, the expression -// -// __ReturnOK::safe_to_return() -// -// quietly compiles and does nothing. When we enter a block in which we want to -// inhibit returns, we introduce a new typedef that defines __ReturnOK as the -// class with the private method. Inside this scope, -// -// __ReturnOK::safe_to_return() -// -// generates a compile-time error. -// -// To cause the method to be called, we have to #define the return keyword. -// The simplest working version would be -// -// #define return if (0) __ReturnOK::safe_to_return(); else return -// -// but we've used -// -// #define return for (;1;__ReturnOK::safe_to_return()) return -// -// because it happens to generate somewhat faster code in a checked build. (They -// both introduce no overhead in a fastchecked build.) -// -class __SafeToReturn { -public: - static int safe_to_return() {return 0;}; - static int used() {return 0;}; -}; - -class __YouCannotUseAReturnStatementHere { -private: - // If you got here, and you're wondering what you did wrong -- you're using - // a return statement where it's not allowed. Likely, it's inside one of: - // GCPROTECT_BEGIN ... GCPROTECT_END - // HELPER_METHOD_FRAME_BEGIN ... HELPER_METHOD_FRAME_END - // - static int safe_to_return() {return 0;}; -public: - // Some compilers warn if all member functions in a class are private - // or if a typedef is unused. Rather than disable the warning, we'll work - // around it here. - static int used() {return 0;}; -}; - -typedef __SafeToReturn __ReturnOK; - -// Use this to ensure that it is safe to return from a given scope -#define DEBUG_ASSURE_SAFE_TO_RETURN __ReturnOK::safe_to_return() - -// Unfortunately, the only way to make this work is to #define all return statements -- -// even the ones at global scope. This actually generates better code that appears. -// The call is dead, and does not appear in the generated code, even in a checked -// build. (And, in fastchecked, there is no penalty at all.) -// -#ifdef _MSC_VER -#define return if (0 && __ReturnOK::safe_to_return()) { } else return -#else // _MSC_VER -#define return for (;1;__ReturnOK::safe_to_return()) return -#endif // _MSC_VER - -#define DEBUG_ASSURE_NO_RETURN_BEGIN(arg) { typedef __YouCannotUseAReturnStatementHere __ReturnOK; if (0 && __ReturnOK::used()) { } else { -#define DEBUG_ASSURE_NO_RETURN_END(arg) } } - -#define DEBUG_OK_TO_RETURN_BEGIN(arg) { typedef __SafeToReturn __ReturnOK; if (0 && __ReturnOK::used()) { } else { -#define DEBUG_OK_TO_RETURN_END(arg) } } - -#else // defined(_DEBUG) && !defined(JIT_BUILD) && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER > 190024315) - -#define DEBUG_ASSURE_SAFE_TO_RETURN TRUE - -#define DEBUG_ASSURE_NO_RETURN_BEGIN(arg) { -#define DEBUG_ASSURE_NO_RETURN_END(arg) } - -#define DEBUG_OK_TO_RETURN_BEGIN(arg) { -#define DEBUG_OK_TO_RETURN_END(arg) } - -#endif // defined(_DEBUG) && !defined(JIT_BUILD) && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER > 190024315) - -#endif // !_PREFAST_ - -#endif // _DEBUGRETURN_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/ecmakey.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/ecmakey.h deleted file mode 100644 index a4ec51be1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/ecmakey.h +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -#pragma once - -// The byte values of the ECMA pseudo public key and its token. -const BYTE g_rbNeutralPublicKey[] = { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 }; -const BYTE g_rbNeutralPublicKeyToken[] = { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }; - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/eetwain.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/eetwain.h index 4ee7b9a7b..1062ebf56 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/eetwain.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/eetwain.h @@ -28,7 +28,6 @@ #include "regdisp.h" #include "corjit.h" // For NativeVarInfo #include "stackwalktypes.h" -#include "bitvector.h" #include "gcinfotypes.h" #if !defined(TARGET_X86) @@ -66,18 +65,6 @@ typedef void (*GCEnumCallback)( DAC_ARG(DacSlotLocation loc) // where the reference came from ); -/****************************************************************************** - The stackwalker maintains some state on behalf of ICodeManager. -*/ - -const int CODEMAN_STATE_SIZE = 512; - -struct CodeManState -{ - DWORD dwIsSet; // Is set to 0 by the stackwalk as appropriate - BYTE stateBuf[CODEMAN_STATE_SIZE]; -}; - /****************************************************************************** These flags are used by some functions, although not all combinations might make sense for all functions. @@ -170,7 +157,6 @@ virtual void FixContext(ContextType ctxType, DWORD dwRelOffset, DWORD nestingLevel, OBJECTREF thrownObject, - CodeManState *pState, size_t ** ppShadowSP, // OUT size_t ** ppEndRegion) = 0; // OUT #endif // !FEATURE_EH_FUNCLETS @@ -184,8 +170,7 @@ virtual void FixContext(ContextType ctxType, virtual TADDR GetAmbientSP(PREGDISPLAY pContext, EECodeInfo *pCodeInfo, DWORD dwRelOffset, - DWORD nestingLevel, - CodeManState *pState) = 0; + DWORD nestingLevel) = 0; #endif // TARGET_X86 /* @@ -202,10 +187,15 @@ virtual ULONG32 GetStackParameterSize(EECodeInfo* pCodeInfo) = 0; (if UpdateAllRegs), callee-UNsaved registers are trashed) Returns success of operation. */ -virtual bool UnwindStackFrame(PREGDISPLAY pContext, +virtual bool UnwindStackFrame(PREGDISPLAY pRD, EECodeInfo *pCodeInfo, - unsigned flags, - CodeManState *pState) = 0; + unsigned flags) = 0; + +virtual void UnwindStackFrame(T_CONTEXT *pContext) = 0; + +#ifdef FEATURE_EH_FUNCLETS +virtual void EnsureCallerContextIsValid(PREGDISPLAY pRD, EECodeInfo * pCodeInfo = NULL, unsigned flags = 0) = 0; +#endif // FEATURE_EH_FUNCLETS /* Is the function currently at a "GC safe point" ? @@ -218,17 +208,6 @@ virtual bool IsGcSafe(EECodeInfo *pCodeInfo, virtual bool HasTailCalls(EECodeInfo *pCodeInfo) = 0; #endif // TARGET_ARM || TARGET_ARM64 || TARGET_LOONGARCH64 || TARGET_RISCV64 -#if defined(TARGET_AMD64) && defined(_DEBUG) -/* - Locates the end of the last interruptible region in the given code range. - Returns 0 if the entire range is uninterruptible. Returns the end point - if the entire range is interruptible. -*/ -virtual unsigned FindEndOfLastInterruptibleRegion(unsigned curOffset, - unsigned endOffset, - GCInfoToken gcInfoToken) = 0; -#endif // TARGET_AMD64 && _DEBUG - /* Enumerate all live object references in that function using the virtual register set. Same reference location cannot be enumerated @@ -273,8 +252,7 @@ virtual GenericParamContextType GetParamContextType(PREGDISPLAY pContext, */ virtual void * GetGSCookieAddr(PREGDISPLAY pContext, EECodeInfo * pCodeInfo, - unsigned flags, - CodeManState * pState) = 0; + unsigned flags) = 0; #ifndef USE_GC_INFO_DECODER /* @@ -283,7 +261,7 @@ virtual void * GetGSCookieAddr(PREGDISPLAY pContext, virtual bool IsInPrologOrEpilog(DWORD relPCOffset, GCInfoToken gcInfoToken, size_t* prologSize) = 0; - +#ifndef FEATURE_EH_FUNCLETS /* Returns true if the given IP is in the synchronized region of the method (valid for synchronized methods only) */ @@ -291,6 +269,7 @@ virtual bool IsInSynchronizedRegion( DWORD relOffset, GCInfoToken gcInfoToken, unsigned flags) = 0; +#endif // FEATURE_EH_FUNCLETS #endif // !USE_GC_INFO_DECODER /* @@ -306,7 +285,7 @@ virtual size_t GetFunctionSize(GCInfoToken gcInfoToken) = 0; * returns true. * If hijacking is not possible for some reason, it return false. */ -virtual bool GetReturnAddressHijackInfo(GCInfoToken gcInfoToken, ReturnKind * returnKind) = 0; +virtual bool GetReturnAddressHijackInfo(GCInfoToken gcInfoToken X86_ARG(ReturnKind * returnKind)) = 0; #ifndef USE_GC_INFO_DECODER /* @@ -322,11 +301,6 @@ virtual unsigned int GetFrameSize(GCInfoToken gcInfoToken) = 0; #ifndef FEATURE_EH_FUNCLETS virtual const BYTE* GetFinallyReturnAddr(PREGDISPLAY pReg)=0; -virtual BOOL IsInFilter(GCInfoToken gcInfoToken, - unsigned offset, - PCONTEXT pCtx, - DWORD curNestLevel) = 0; - virtual BOOL LeaveFinally(GCInfoToken gcInfoToken, unsigned offset, PCONTEXT pCtx) = 0; @@ -334,6 +308,12 @@ virtual BOOL LeaveFinally(GCInfoToken gcInfoToken, virtual void LeaveCatch(GCInfoToken gcInfoToken, unsigned offset, PCONTEXT pCtx)=0; +#else // FEATURE_EH_FUNCLETS +virtual DWORD_PTR CallFunclet(OBJECTREF throwable, void* pHandler, REGDISPLAY *pRD, ExInfo *pExInfo, bool isFilter) = 0; +virtual void ResumeAfterCatch(CONTEXT *pContext, size_t targetSSP, bool fIntercepted) = 0; +#if defined(HOST_AMD64) && defined(HOST_WINDOWS) +virtual void UpdateSSP(PREGDISPLAY pRD) = 0; +#endif // HOST_AMD64 && HOST_WINDOWS #endif // FEATURE_EH_FUNCLETS #ifdef FEATURE_REMAP_FUNCTION @@ -355,7 +335,6 @@ virtual HRESULT FixContextForEnC(PCONTEXT pCtx, #endif // #ifndef DACCESS_COMPILE - #ifdef DACCESS_COMPILE virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags) = 0; #endif @@ -390,7 +369,6 @@ void FixContext(ContextType ctxType, DWORD dwRelOffset, DWORD nestingLevel, OBJECTREF thrownObject, - CodeManState *pState, size_t ** ppShadowSP, // OUT size_t ** ppEndRegion); // OUT #endif // !FEATURE_EH_FUNCLETS @@ -405,8 +383,7 @@ virtual TADDR GetAmbientSP(PREGDISPLAY pContext, EECodeInfo *pCodeInfo, DWORD dwRelOffset, - DWORD nestingLevel, - CodeManState *pState); + DWORD nestingLevel); #endif // TARGET_X86 /* @@ -426,10 +403,12 @@ ULONG32 GetStackParameterSize(EECodeInfo* pCodeInfo); */ virtual bool UnwindStackFrame( - PREGDISPLAY pContext, + PREGDISPLAY pRD, EECodeInfo *pCodeInfo, - unsigned flags, - CodeManState *pState); + unsigned flags); + +virtual +void UnwindStackFrame(T_CONTEXT *pContext); #ifdef HAS_LIGHTUNWIND enum LightUnwindFlag @@ -458,26 +437,11 @@ virtual bool IsGcSafe( EECodeInfo *pCodeInfo, DWORD dwRelOffset); -static -bool InterruptibleSafePointsEnabled(); - #if defined(TARGET_ARM) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) virtual bool HasTailCalls(EECodeInfo *pCodeInfo); #endif // TARGET_ARM || TARGET_ARM64 || TARGET_LOONGARCH64 || defined(TARGET_RISCV64) -#if defined(TARGET_AMD64) && defined(_DEBUG) -/* - Locates the end of the last interruptible region in the given code range. - Returns 0 if the entire range is uninterruptible. Returns the end point - if the entire range is interruptible. -*/ -virtual -unsigned FindEndOfLastInterruptibleRegion(unsigned curOffset, - unsigned endOffset, - GCInfoToken gcInfoToken); -#endif // TARGET_AMD64 && _DEBUG - /* Enumerate all live object references in that function using the virtual register set. Same reference location cannot be enumerated @@ -529,10 +493,10 @@ PTR_VOID GetExactGenericsToken(PREGDISPLAY pContext, EECodeInfo * pCodeInfo); static -PTR_VOID GetExactGenericsToken(SIZE_T baseStackSlot, +PTR_VOID GetExactGenericsToken(TADDR sp, + TADDR fp, EECodeInfo * pCodeInfo); - #endif // FEATURE_EH_FUNCLETS && USE_GC_INFO_DECODER /* @@ -542,8 +506,7 @@ PTR_VOID GetExactGenericsToken(SIZE_T baseStackSlot, virtual void * GetGSCookieAddr(PREGDISPLAY pContext, EECodeInfo * pCodeInfo, - unsigned flags, - CodeManState * pState); + unsigned flags); #ifndef USE_GC_INFO_DECODER @@ -556,6 +519,7 @@ bool IsInPrologOrEpilog( GCInfoToken gcInfoToken, size_t* prologSize); +#ifndef FEATURE_EH_FUNCLETS /* Returns true if the given IP is in the synchronized region of the method (valid for synchronized functions only) */ @@ -564,6 +528,7 @@ bool IsInSynchronizedRegion( DWORD relOffset, GCInfoToken gcInfoToken, unsigned flags); +#endif // FEATURE_EH_FUNCLETS #endif // !USE_GC_INFO_DECODER /* @@ -578,7 +543,7 @@ size_t GetFunctionSize(GCInfoToken gcInfoToken); * returns true. * If hijacking is not possible for some reason, it return false. */ -virtual bool GetReturnAddressHijackInfo(GCInfoToken gcInfoToken, ReturnKind * returnKind); +virtual bool GetReturnAddressHijackInfo(GCInfoToken gcInfoToken X86_ARG(ReturnKind * returnKind)); #ifndef USE_GC_INFO_DECODER /* @@ -592,16 +557,19 @@ unsigned int GetFrameSize(GCInfoToken gcInfoToken); #ifndef FEATURE_EH_FUNCLETS virtual const BYTE* GetFinallyReturnAddr(PREGDISPLAY pReg); -virtual BOOL IsInFilter(GCInfoToken gcInfoToken, - unsigned offset, - PCONTEXT pCtx, - DWORD curNestLevel); virtual BOOL LeaveFinally(GCInfoToken gcInfoToken, unsigned offset, PCONTEXT pCtx); virtual void LeaveCatch(GCInfoToken gcInfoToken, unsigned offset, PCONTEXT pCtx); +#else // FEATURE_EH_FUNCLETS +virtual DWORD_PTR CallFunclet(OBJECTREF throwable, void* pHandler, REGDISPLAY *pRD, ExInfo *pExInfo, bool isFilter); +virtual void ResumeAfterCatch(CONTEXT *pContext, size_t targetSSP, bool fIntercepted); + +#if defined(HOST_AMD64) && defined(HOST_WINDOWS) +virtual void UpdateSSP(PREGDISPLAY pRD); +#endif // HOST_AMD64 && HOST_WINDOWS #endif // FEATURE_EH_FUNCLETS #ifdef FEATURE_REMAP_FUNCTION @@ -622,7 +590,7 @@ HRESULT FixContextForEnC(PCONTEXT pCtx, #endif // #ifndef DACCESS_COMPILE #ifdef FEATURE_EH_FUNCLETS - static void EnsureCallerContextIsValid( PREGDISPLAY pRD, EECodeInfo * pCodeInfo = NULL, unsigned flags = 0); + virtual void EnsureCallerContextIsValid( PREGDISPLAY pRD, EECodeInfo * pCodeInfo = NULL, unsigned flags = 0); static size_t GetCallerSp( PREGDISPLAY pRD ); #ifdef TARGET_X86 static size_t GetResumeSp( PCONTEXT pContext ); @@ -635,21 +603,223 @@ HRESULT FixContextForEnC(PCONTEXT pCtx, }; -#ifdef TARGET_X86 -#include "gc_unwind_x86.h" +#ifdef FEATURE_INTERPRETER + +class InterpreterCodeManager : public ICodeManager { + + VPTR_VTABLE_CLASS_AND_CTOR(InterpreterCodeManager, ICodeManager) + +public: + -/***************************************************************************** - How the stackwalkers buffer will be interpreted +#ifndef DACCESS_COMPILE +#ifndef FEATURE_EH_FUNCLETS +virtual +void FixContext(ContextType ctxType, + EHContext *ctx, + EECodeInfo *pCodeInfo, + DWORD dwRelOffset, + DWORD nestingLevel, + OBJECTREF thrownObject, + size_t ** ppShadowSP, // OUT + size_t ** ppEndRegion) // OUT +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); +} +#endif // !FEATURE_EH_FUNCLETS +#endif // !DACCESS_COMPILE + +#ifdef TARGET_X86 +/* + Gets the ambient stack pointer value at the given nesting level within + the method. */ +virtual +TADDR GetAmbientSP(PREGDISPLAY pContext, + EECodeInfo *pCodeInfo, + DWORD dwRelOffset, + DWORD nestingLevel) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return NULL; +} +#endif // TARGET_X86 + +virtual +ULONG32 GetStackParameterSize(EECodeInfo* pCodeInfo) +{ + return 0; +} + +virtual +bool UnwindStackFrame( + PREGDISPLAY pRD, + EECodeInfo *pCodeInfo, + unsigned flags); + +virtual +void UnwindStackFrame(T_CONTEXT *pContext); + +#ifdef FEATURE_EH_FUNCLETS +virtual +void EnsureCallerContextIsValid(PREGDISPLAY pRD, EECodeInfo * pCodeInfo = NULL, unsigned flags = 0); +#endif // FEATURE_EH_FUNCLETS -struct CodeManStateBuf +virtual +bool IsGcSafe( EECodeInfo *pCodeInfo, + DWORD dwRelOffset); + +#if defined(TARGET_ARM) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) +virtual +bool HasTailCalls(EECodeInfo *pCodeInfo) { - DWORD hdrInfoSize; - hdrInfo hdrInfoBody; -}; + _ASSERTE(FALSE); + return false; +} +#endif // TARGET_ARM || TARGET_ARM64 || TARGET_LOONGARCH64 || defined(TARGET_RISCV64) +virtual +bool EnumGcRefs(PREGDISPLAY pContext, + EECodeInfo *pCodeInfo, + unsigned flags, + GCEnumCallback pCallback, + LPVOID hCallBack, + DWORD relOffsetOverride = NO_OVERRIDE_OFFSET); + +virtual +OBJECTREF GetInstance( + PREGDISPLAY pContext, + EECodeInfo * pCodeInfo); + +virtual +PTR_VOID GetParamTypeArg(PREGDISPLAY pContext, + EECodeInfo * pCodeInfo); + +virtual GenericParamContextType GetParamContextType(PREGDISPLAY pContext, + EECodeInfo * pCodeInfo); + +virtual +void * GetGSCookieAddr(PREGDISPLAY pContext, + EECodeInfo * pCodeInfo, + unsigned flags) +{ + return NULL; +} + + +#ifndef USE_GC_INFO_DECODER +virtual +bool IsInPrologOrEpilog( + DWORD relOffset, + GCInfoToken gcInfoToken, + size_t* prologSize) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return false; +} + +#ifndef FEATURE_EH_FUNCLETS +virtual +bool IsInSynchronizedRegion( + DWORD relOffset, + GCInfoToken gcInfoToken, + unsigned flags) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return false; +} +#endif // FEATURE_EH_FUNCLETS +#endif // !USE_GC_INFO_DECODER + +virtual +size_t GetFunctionSize(GCInfoToken gcInfoToken); + +virtual bool GetReturnAddressHijackInfo(GCInfoToken gcInfoToken X86_ARG(ReturnKind * returnKind)) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return false; +} + +#ifndef USE_GC_INFO_DECODER + +virtual +unsigned int GetFrameSize(GCInfoToken gcInfoToken) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return 0; +} +#endif // USE_GC_INFO_DECODER + +#ifndef DACCESS_COMPILE + +#ifndef FEATURE_EH_FUNCLETS +virtual const BYTE* GetFinallyReturnAddr(PREGDISPLAY pReg) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return NULL; +} + +virtual BOOL LeaveFinally(GCInfoToken gcInfoToken, + unsigned offset, + PCONTEXT pCtx) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); + return FALSE; +} + +virtual void LeaveCatch(GCInfoToken gcInfoToken, + unsigned offset, + PCONTEXT pCtx) +{ + // Interpreter-TODO: Implement this if needed + _ASSERTE(FALSE); +} +#else // FEATURE_EH_FUNCLETS +virtual DWORD_PTR CallFunclet(OBJECTREF throwable, void* pHandler, REGDISPLAY *pRD, ExInfo *pExInfo, bool isFilter); +virtual void ResumeAfterCatch(CONTEXT *pContext, size_t targetSSP, bool fIntercepted); +#if defined(HOST_AMD64) && defined(HOST_WINDOWS) +virtual void UpdateSSP(PREGDISPLAY pRD); +#endif // HOST_AMD64 && HOST_WINDOWS +#endif // FEATURE_EH_FUNCLETS + +#ifdef FEATURE_REMAP_FUNCTION + +virtual +HRESULT FixContextForEnC(PCONTEXT pCtx, + EECodeInfo * pOldCodeInfo, + const ICorDebugInfo::NativeVarInfo * oldMethodVars, + SIZE_T oldMethodVarsCount, + EECodeInfo * pNewCodeInfo, + const ICorDebugInfo::NativeVarInfo * newMethodVars, + SIZE_T newMethodVarsCount) +{ + // Interpreter-TODO: Implement this + _ASSERTE(FALSE); + return E_NOTIMPL; +} +#endif // FEATURE_REMAP_FUNCTION + +#endif // !DACCESS_COMPILE + +#ifdef DACCESS_COMPILE + virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags) + { + // Nothing to do + } #endif +}; + +#endif // FEATURE_INTERPRETER + //***************************************************************************** #endif // _EETWAIN_H //***************************************************************************** diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/eexcp.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/eexcp.h index fb7bccbe0..5c470b78d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/eexcp.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/eexcp.h @@ -112,34 +112,5 @@ inline BOOL IsTypedHandler(EE_ILEXCEPTION_CLAUSE *EHClause) return ! (IsFilterHandler(EHClause) || IsFaultOrFinally(EHClause)); } -inline BOOL IsDuplicateClause(EE_ILEXCEPTION_CLAUSE* pEHClause) -{ - return pEHClause->Flags & COR_ILEXCEPTION_CLAUSE_DUPLICATED; -} - -#if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) -// Finally is the only EH construct that can be part of the execution as being fall-through. -// -// "Cloned" finally is a construct that represents a finally block that is used as -// fall through for normal try-block execution. Such a "cloned" finally will: -// -// 1) Have its try-clause's Start and End PC the same as its handler's start PC (i.e. will have -// zero length try block), AND -// 2) Is marked duplicate -// -// Because of their fall-through nature, JIT guarantees that only finally constructs can be cloned, -// and not catch or fault (since they cannot be fallen through but are invoked as funclets). -// -// The cloned finally construct is also used to mark "call to finally" thunks that are not within -// the EH region protected by the finally, and also not within the enclosing region. This is done -// to prevent ThreadAbortException from creating an infinite loop of calling the same finally. -inline BOOL IsClonedFinally(EE_ILEXCEPTION_CLAUSE* pEHClause) -{ - return ((pEHClause->TryStartPC == pEHClause->TryEndPC) && - (pEHClause->TryStartPC == pEHClause->HandlerStartPC) && - IsFinally(pEHClause) && IsDuplicateClause(pEHClause)); -} -#endif // defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) - #endif // __eexcp_h__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/eventtracebase.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/eventtracebase.h index 316104f64..481e4dfa3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/eventtracebase.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/eventtracebase.h @@ -224,6 +224,15 @@ struct ProfilingScanContext; #include #include #endif //!FEATURE_NATIVEAOT +#else // !defined(HOST_UNIX) + +// +// ETW and EventPipe Event Notification Callback Control Code Keywords +// +#define EVENT_CONTROL_CODE_DISABLE_PROVIDER 0 +#define EVENT_CONTROL_CODE_ENABLE_PROVIDER 1 +#define EVENT_CONTROL_CODE_CAPTURE_STATE 2 + #endif //!defined(HOST_UNIX) @@ -689,7 +698,6 @@ class Module; class Assembly; class MethodDesc; class MethodTable; -class BaseDomain; class AppDomain; class SString; class CrawlFrame; @@ -750,12 +758,11 @@ namespace ETW #ifdef FEATURE_EVENT_TRACE static VOID SendThreadRundownEvent(); static VOID SendGCRundownEvent(); - static VOID IterateDomain(BaseDomain *pDomain, DWORD enumerationOptions); - static VOID IterateAppDomain(AppDomain * pAppDomain, DWORD enumerationOptions); + static VOID IterateAppDomain(DWORD enumerationOptions); static VOID IterateCollectibleLoaderAllocator(AssemblyLoaderAllocator *pLoaderAllocator, DWORD enumerationOptions); static VOID IterateAssembly(Assembly *pAssembly, DWORD enumerationOptions); static VOID IterateModule(Module *pModule, DWORD enumerationOptions); - static VOID EnumerationHelper(Module *moduleFilter, BaseDomain *domainFilter, DWORD enumerationOptions); + static VOID EnumerationHelper(Module *moduleFilter, DWORD enumerationOptions); static DWORD GetEnumerationOptionsFromRuntimeKeywords(); public: typedef union _EnumerationStructs @@ -839,7 +846,7 @@ namespace ETW static VOID SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL bFireDomainModuleEvents=FALSE); static ULONG SendModuleRange(_In_ Module *pModule, _In_ DWORD dwEventOptions); static VOID SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions); - static VOID SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptions, LPCWSTR wszFriendlyName=NULL); + static VOID SendDomainEvent(DWORD dwEventOptions, LPCWSTR wszFriendlyName=NULL); public: typedef union _LoaderStructs { @@ -877,23 +884,21 @@ namespace ETW }LoaderStructs; - static VOID DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL); + static VOID DomainLoadReal(_In_opt_ LPWSTR wszFriendlyName=NULL); - static VOID DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName = NULL) + static VOID DomainLoad(_In_opt_ LPWSTR wszFriendlyName = NULL) { if (ETW_PROVIDER_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER)) { - DomainLoadReal(pDomain, wszFriendlyName); + DomainLoadReal(wszFriendlyName); } } - static VOID DomainUnload(AppDomain *pDomain); static VOID CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator); static VOID ModuleLoad(Module *pModule, LONG liReportedSharedModule); #else public: - static VOID DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL) {}; - static VOID DomainUnload(AppDomain *pDomain) {}; + static VOID DomainLoad(_In_opt_ LPWSTR wszFriendlyName=NULL) {}; static VOID CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator) {}; static VOID ModuleLoad(Module *pModule, LONG liReportedSharedModule) {}; #endif // FEATURE_EVENT_TRACE @@ -904,7 +909,7 @@ namespace ETW { friend class ETW::EnumerationLog; #ifdef FEATURE_EVENT_TRACE - static VOID SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions); + static VOID SendEventsForJitMethods(BOOL getCodeVersionIds, LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions); static VOID SendEventsForJitMethodsHelper( LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions, @@ -953,9 +958,7 @@ namespace ETW static VOID SendMethodDetailsEvent(MethodDesc *pMethodDesc); static VOID SendNonDuplicateMethodDetailsEvent(MethodDesc* pMethodDesc, MethodDescSet* set); static VOID StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName); - static VOID StubsInitialized(PVOID *pHelperStartAddress, PVOID *pHelperNames, LONG ulNoOfHelpers); static VOID MethodRestored(MethodDesc * pMethodDesc); - static VOID MethodTableRestored(MethodTable * pMethodTable); static VOID DynamicMethodDestroyed(MethodDesc *pMethodDesc); static VOID LogMethodInstrumentationData(MethodDesc* method, uint32_t cbData, BYTE *data, TypeHandle* pTypeHandles, uint32_t numTypeHandles, MethodDesc** pMethods, uint32_t numMethods); #else // FEATURE_EVENT_TRACE @@ -965,156 +968,12 @@ namespace ETW static VOID MethodJitting(MethodDesc *pMethodDesc, COR_ILMETHOD_DECODER* methodDecoder, SString *namespaceOrClassName, SString *methodName, SString *methodSignature); static VOID MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName, SString *methodName, SString *methodSignature, PCODE pNativeCodeStartAddress, PrepareCodeConfig *pConfig); static VOID StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName) {}; - static VOID StubsInitialized(PVOID *pHelperStartAddress, PVOID *pHelperNames, LONG ulNoOfHelpers) {}; static VOID MethodRestored(MethodDesc * pMethodDesc) {}; - static VOID MethodTableRestored(MethodTable * pMethodTable) {}; static VOID DynamicMethodDestroyed(MethodDesc *pMethodDesc) {}; static VOID LogMethodInstrumentationData(MethodDesc* method, uint32_t cbData, BYTE *data, TypeHandle* pTypeHandles, uint32_t numTypeHandles, MethodDesc** pMethods, uint32_t numMethods) {}; #endif // FEATURE_EVENT_TRACE }; - // Class to wrap all Security logic for ETW - class SecurityLog - { -#ifdef FEATURE_EVENT_TRACE - public: - static VOID StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName); - static VOID StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName); - - static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName, - LPCWSTR wszModuleName, - DWORD dwAppDomain); - static void FireFieldTransparencyComputationEnd(LPCWSTR wszFieldName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe); - - static void FireMethodTransparencyComputationStart(LPCWSTR wszMethodName, - LPCWSTR wszModuleName, - DWORD dwAppDomain); - static void FireMethodTransparencyComputationEnd(LPCWSTR wszMethodName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe); - - static void FireModuleTransparencyComputationStart(LPCWSTR wszModuleName, DWORD dwAppDomain); - static void FireModuleTransparencyComputationEnd(LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsAllCritical, - BOOL fIsAllTransparent, - BOOL fIsTreatAsSafe, - BOOL fIsOpportunisticallyCritical, - DWORD dwSecurityRuleSet); - - static void FireTokenTransparencyComputationStart(DWORD dwToken, - LPCWSTR wszModuleName, - DWORD dwAppDomain); - static void FireTokenTransparencyComputationEnd(DWORD dwToken, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe); - - static void FireTypeTransparencyComputationStart(LPCWSTR wszTypeName, - LPCWSTR wszModuleName, - DWORD dwAppDomain); - static void FireTypeTransparencyComputationEnd(LPCWSTR wszTypeName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsAllCritical, - BOOL fIsAllTransparent, - BOOL fIsCritical, - BOOL fIsTreatAsSafe); -#else - public: - static VOID StrongNameVerificationStart(DWORD dwInFlags, _In_z_ LPWSTR strFullyQualifiedAssemblyName) {}; - static VOID StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_z_ LPWSTR strFullyQualifiedAssemblyName) {}; - - static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName, - LPCWSTR wszModuleName, - DWORD dwAppDomain) {}; - static void FireFieldTransparencyComputationEnd(LPCWSTR wszFieldName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) {}; - - static void FireMethodTransparencyComputationStart(LPCWSTR wszMethodName, - LPCWSTR wszModuleName, - DWORD dwAppDomain) {}; - static void FireMethodTransparencyComputationEnd(LPCWSTR wszMethodName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) {}; - - static void FireModuleTransparencyComputationStart(LPCWSTR wszModuleName, DWORD dwAppDomain) {}; - static void FireModuleTransparencyComputationEnd(LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsAllCritical, - BOOL fIsAllTransparent, - BOOL fIsTreatAsSafe, - BOOL fIsOpportunisticallyCritical, - DWORD dwSecurityRuleSet) {}; - - static void FireTokenTransparencyComputationStart(DWORD dwToken, - LPCWSTR wszModuleName, - DWORD dwAppDomain) {}; - static void FireTokenTransparencyComputationEnd(DWORD dwToken, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) {}; - - static void FireTypeTransparencyComputationStart(LPCWSTR wszTypeName, - LPCWSTR wszModuleName, - DWORD dwAppDomain) {}; - static void FireTypeTransparencyComputationEnd(LPCWSTR wszTypeName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsAllCritical, - BOOL fIsAllTransparent, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) {}; -#endif // FEATURE_EVENT_TRACE - }; - - // Class to wrap all Binder logic for ETW - class BinderLog - { - public: - typedef union _BinderStructs { - typedef enum _NGENBINDREJECT_REASON { - NGEN_BIND_START_BIND = 0, - NGEN_BIND_NO_INDEX = 1, - NGEN_BIND_SYSTEM_ASSEMBLY_NOT_AVAILABLE = 2, - NGEN_BIND_NO_NATIVE_IMAGE = 3, - NGEN_BIND_REJECT_CONFIG_MASK = 4, - NGEN_BIND_FAIL = 5, - NGEN_BIND_INDEX_CORRUPTION = 6, - NGEN_BIND_REJECT_TIMESTAMP = 7, - NGEN_BIND_REJECT_NATIVEIMAGE_NOT_FOUND = 8, - NGEN_BIND_REJECT_IL_SIG = 9, - NGEN_BIND_REJECT_LOADER_EVAL_FAIL = 10, - NGEN_BIND_MISSING_FOUND = 11, - NGEN_BIND_REJECT_HOSTASM = 12, - NGEN_BIND_REJECT_IL_NOT_FOUND = 13, - NGEN_BIND_REJECT_APPBASE_NOT_FILE = 14, - NGEN_BIND_BIND_DEPEND_REJECT_REF_DEF_MISMATCH = 15, - NGEN_BIND_BIND_DEPEND_REJECT_NGEN_SIG = 16, - NGEN_BIND_APPLY_EXTERNAL_RELOCS_FAILED = 17, - NGEN_BIND_SYSTEM_ASSEMBLY_NATIVEIMAGE_NOT_AVAILABLE = 18, - NGEN_BIND_ASSEMBLY_HAS_DIFFERENT_GRANT = 19, - NGEN_BIND_ASSEMBLY_NOT_DOMAIN_NEUTRAL = 20, - NGEN_BIND_NATIVEIMAGE_VERSION_MISMATCH = 21, - NGEN_BIND_LOADFROM_NOT_ALLOWED = 22, - NGEN_BIND_DEPENDENCY_HAS_DIFFERENT_IDENTITY = 23 - } NGENBINDREJECT_REASON; - } BinderStructs; - }; - // Class to wrap all Exception logic for ETW class ExceptionLog { @@ -1323,27 +1182,25 @@ namespace ETW #define ETW_IS_TRACE_ON(level) ( FALSE ) // for fusion which is eventually going to get removed #define ETW_IS_FLAG_ON(flag) ( FALSE ) // for fusion which is eventually going to get removed -// Commonly used constats for ETW Assembly Loader and Assembly Binder events. -#define ETWLoadContextNotAvailable (LOADCTX_TYPE_HOSTED + 1) -#define ETWAppDomainIdNotAvailable 0 // Valid AppDomain IDs start from 1 - #define ETWFieldUnused 0 // Indicates that a particular field in the ETW event payload template is currently unused. #define ETWLoaderLoadTypeNotAvailable 0 // Static or Dynamic Load is only valid at LoaderPhaseStart and LoaderPhaseEnd events - for other events, 0 indicates "not available" #define ETWLoaderStaticLoad 0 // Static reference load #define ETWLoaderDynamicLoad 1 // Dynamic assembly load +#if defined (FEATURE_EVENT_TRACE) +EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context; +EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_DOTNET_Context; +EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_DOTNET_Context; +EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_DOTNET_Context; +#endif // FEATURE_EVENT_TRACE + #if defined(FEATURE_EVENT_TRACE) && !defined(HOST_UNIX) // // The ONE and only ONE global instantiation of this class // extern ETW::CEtwTracer * g_pEtwTracer; -EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context; -EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_DOTNET_Context; -EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_DOTNET_Context; -EXTERN_C DOTNET_TRACE_CONTEXT MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_DOTNET_Context; - // // Special Handling of Startup events // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/ex.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/ex.h index 9a0cad2b2..efe9acc6a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/ex.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/ex.h @@ -598,7 +598,6 @@ class CAutoTryCleanup DEBUG_NOINLINE CAutoTryCleanup(STATETYPE& refState) : m_refState(refState) { - SCAN_SCOPE_BEGIN; STATIC_CONTRACT_THROWS; STATIC_CONTRACT_SUPPORTS_DAC; @@ -614,7 +613,6 @@ class CAutoTryCleanup DEBUG_NOINLINE ~CAutoTryCleanup() { - SCAN_SCOPE_END; WRAPPER_NO_CONTRACT; m_refState.CleanupTry(); @@ -649,8 +647,9 @@ class CAutoTryCleanup // { // Exception *e = GET_EXCEPTION(); // EX_RETHROW; +// RethrowTerminalExceptions(), RethrowTransientExceptions // } -// EX_END_CATCH(RethrowTerminalExceptions, RethrowTransientExceptions or SwallowAllExceptions) +// EX_END_CATCH // // --------------------------------------------------------------------------- @@ -695,20 +694,17 @@ class CAutoTryCleanup #endif //----------------------------------------------------------------------- -// EX_END_CATCH has a mandatory argument which is one of "RethrowTerminalExceptions", -// "RethrowTransientExceptions", or "SwallowAllExceptions". +// There are a number of "rethrow" macros provided below: "RethrowTerminalExceptions()", +// "RethrowTransientExceptions()". +// +// These macros should be used in the EX_CATCH block to determine how to handle +// exceptions that are caught that aren't handled by the catch block. // // If an exception is considered "terminal" (e->IsTerminal()), it should normally -// be allowed to proceed. Hence, most of the time, you should use RethrowTerminalExceptions. +// be allowed to proceed. Hence, most of the time, you should use RethrowTerminalExceptions(). // // In some cases you will want transient exceptions (terminal plus things like -// resource exhaustion) to proceed as well. Use RethrowTransientExceptions for this cas. -// -// If you have a good reason to use SwallowAllExceptions, (e.g. a hard COM interop boundary) -// use one of the higher level macros for this if available, or consider developing one. -// Otherwise, clearly document why you're swallowing terminal exceptions. Raw uses of -// SwallowAllExceptions will cause the cleanup police to come knocking on your door -// at some point. +// resource exhaustion) to proceed as well. Use RethrowTransientExceptions() for this cas. // // A lot of existing TRY's swallow terminals right now simply because there is // backout code following the END_CATCH that has to be executed. The solution is @@ -716,29 +712,26 @@ class CAutoTryCleanup //----------------------------------------------------------------------- -#define RethrowTransientExceptions \ +#define RethrowTransientExceptions() \ if (GET_EXCEPTION()->IsTransient()) \ { \ EX_RETHROW; \ } \ -#define SwallowAllExceptions ; - // When applied to EX_END_CATCH, this policy will always rethrow Terminal exceptions if they are // encountered. -#define RethrowTerminalExceptions \ +#define RethrowTerminalExceptions() \ if (GET_EXCEPTION()->IsTerminal()) \ { \ - STATIC_CONTRACT_THROWS_TERMINAL; \ EX_RETHROW; \ } \ // Special define to be used in EEStartup that will also check for VM initialization before // commencing on a path that may use the managed thread object. -#define RethrowTerminalExceptionsWithInitCheck \ +#define RethrowTerminalExceptionsWithInitCheck() \ if ((g_fEEStarted == TRUE) && (GetThreadNULLOk() != NULL)) \ - { \ - RethrowTerminalExceptions \ + { \ + RethrowTerminalExceptions() \ } #ifdef _DEBUG @@ -811,60 +804,39 @@ Exception *ExThrowWithInnerHelper(Exception *inner); { \ STATETYPE __state STATEARG; \ typedef DEFAULT_EXCEPTION_TYPE __defaultException_t; \ - SCAN_EHMARKER(); \ PAL_CPP_TRY \ { \ - SCAN_EHMARKER_TRY(); \ - SCAN_EHMARKER(); \ PAL_CPP_TRY \ { \ - SCAN_EHMARKER_TRY(); \ CAutoTryCleanup __autoCleanupTry(__state); \ - /* prevent annotations from being dropped by optimizations in debug */ \ - INDEBUG(static bool __alwayszero;) \ - INDEBUG(VolatileLoad(&__alwayszero);) \ { \ - /* Disallow returns to make exception handling work. */ \ - /* Some work is done after the catch, see EX_ENDTRY. */ \ - DEBUG_ASSURE_NO_RETURN_BEGIN(EX_TRY) \ EX_TRY_HOLDER \ #define EX_CATCH_IMPL_EX(DerivedExceptionClass) \ - DEBUG_ASSURE_NO_RETURN_END(EX_TRY) \ } \ - SCAN_EHMARKER_END_TRY(); \ } \ PAL_CPP_CATCH_NON_DERIVED_NOARG (const std::bad_alloc&) \ { \ - SCAN_EHMARKER_CATCH(); \ __state.SetCaughtCxx(); \ __state.m_pExceptionPtr = Exception::GetOOMException(); \ - SCAN_EHMARKER_END_CATCH(); \ - SCAN_IGNORE_THROW_MARKER; \ ThrowOutOfMemory(); \ } \ PAL_CPP_CATCH_DERIVED (DerivedExceptionClass, __pExceptionRaw) \ { \ - SCAN_EHMARKER_CATCH(); \ __state.SetCaughtCxx(); \ __state.m_pExceptionPtr = __pExceptionRaw; \ - SCAN_EHMARKER_END_CATCH(); \ - SCAN_IGNORE_THROW_MARKER; \ PAL_CPP_RETHROW; \ } \ PAL_CPP_ENDTRY \ - SCAN_EHMARKER_END_TRY(); \ } \ PAL_CPP_CATCH_ALL \ { \ - SCAN_EHMARKER_CATCH(); \ __defaultException_t __defaultException; \ CHECK::ResetAssert(); \ ExceptionHolder __pException(__state.m_pExceptionPtr); \ /* work around unreachable code warning */ \ if (true) { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(EX_CATCH) \ /* don't embed file names in retail to save space and avoid IP */ \ /* a findstr /n will allow you to locate it in a pinch */ \ __state.SetupCatch(INDEBUG_COMMA(__FILE__) __LINE__); \ @@ -875,53 +847,33 @@ Exception *ExThrowWithInnerHelper(Exception *inner); { \ STATETYPE __state STATEARG; \ typedef DEFAULT_EXCEPTION_TYPE __defaultException_t; \ - SCAN_EHMARKER(); \ PAL_CPP_TRY \ { \ - SCAN_EHMARKER_TRY(); \ - SCAN_EHMARKER(); \ PAL_CPP_TRY \ { \ - SCAN_EHMARKER_TRY(); \ CAutoTryCleanup __autoCleanupTry(__state); \ - /* prevent annotations from being dropped by optimizations in debug */ \ - INDEBUG(static bool __alwayszero;) \ - INDEBUG(VolatileLoad(&__alwayszero);) \ { \ - /* Disallow returns to make exception handling work. */ \ - /* Some work is done after the catch, see EX_ENDTRY. */ \ - DEBUG_ASSURE_NO_RETURN_BEGIN(EX_TRY) \ #define EX_CATCH_IMPL_CPP_ONLY \ - DEBUG_ASSURE_NO_RETURN_END(EX_TRY) \ } \ - SCAN_EHMARKER_END_TRY(); \ } \ PAL_CPP_CATCH_NON_DERIVED_NOARG (const std::bad_alloc&) \ { \ - SCAN_EHMARKER_CATCH(); \ __state.SetCaughtCxx(); \ __state.m_pExceptionPtr = Exception::GetOOMException(); \ - SCAN_EHMARKER_END_CATCH(); \ - SCAN_IGNORE_THROW_MARKER; \ ThrowOutOfMemory(); \ } \ PAL_CPP_ENDTRY \ - SCAN_EHMARKER_END_TRY(); \ } \ PAL_CPP_CATCH_DERIVED (Exception, __pExceptionRaw) \ { \ - SCAN_EHMARKER_CATCH(); \ __state.SetCaughtCxx(); \ __state.m_pExceptionPtr = __pExceptionRaw; \ - SCAN_EHMARKER_END_CATCH(); \ - SCAN_IGNORE_THROW_MARKER; \ __defaultException_t __defaultException; \ CHECK::ResetAssert(); \ ExceptionHolder __pException(__state.m_pExceptionPtr); \ /* work around unreachable code warning */ \ if (true) { \ - DEBUG_ASSURE_NO_RETURN_BEGIN(EX_CATCH) \ /* don't embed file names in retail to save space and avoid IP */ \ /* a findstr /n will allow you to locate it in a pinch */ \ __state.SetupCatch(INDEBUG_COMMA(__FILE__) __LINE__); \ @@ -954,24 +906,16 @@ Exception *ExThrowWithInnerHelper(Exception *inner); #endif #define EX_END_CATCH_UNREACHABLE \ - DEBUG_ASSURE_NO_RETURN_END(EX_CATCH) \ } \ - SCAN_EHMARKER_END_CATCH(); \ UNREACHABLE(); \ } \ PAL_CPP_ENDTRY \ } \ -// "terminalexceptionpolicy" must be one of "RethrowTerminalExceptions", -// "RethrowTransientExceptions", or "SwallowAllExceptions" - -#define EX_END_CATCH(terminalexceptionpolicy) \ - terminalexceptionpolicy; \ +#define EX_END_CATCH \ __state.SucceedCatch(); \ - DEBUG_ASSURE_NO_RETURN_END(EX_CATCH) \ } \ - SCAN_EHMARKER_END_CATCH(); \ } \ EX_ENDTRY \ } \ @@ -979,10 +923,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); #define EX_END_CATCH_FOR_HOOK \ __state.SucceedCatch(); \ - DEBUG_ASSURE_NO_RETURN_END(EX_CATCH) \ - ANNOTATION_HANDLER_END; \ } \ - SCAN_EHMARKER_END_CATCH(); \ } \ EX_ENDTRY @@ -1027,7 +968,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); (_hr) = GET_EXCEPTION()->GetHR(); \ _ASSERTE(FAILED(_hr)); \ } \ - EX_END_CATCH(SwallowAllExceptions) + EX_END_CATCH //=================================================================================== @@ -1047,7 +988,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); { \ *ppThrowable = GET_THROWABLE(); \ } \ - EX_END_CATCH(SwallowAllExceptions) + EX_END_CATCH #ifdef FEATURE_COMINTEROP @@ -1081,7 +1022,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); pErr->Release(); \ } \ } \ - EX_END_CATCH(SwallowAllExceptions) + EX_END_CATCH //=================================================================================== // Macro to make conditional catching more succinct. @@ -1110,7 +1051,7 @@ Exception *ExThrowWithInnerHelper(Exception *inner); pErr->Release(); \ } \ } \ - EX_END_CATCH(SwallowAllExceptions) + EX_END_CATCH #else // FEATURE_COMINTEROP @@ -1136,8 +1077,9 @@ Exception *ExThrowWithInnerHelper(Exception *inner); #define EX_SWALLOW_NONTERMINAL \ EX_CATCH \ { \ + RethrowTerminalExceptions() \ } \ - EX_END_CATCH(RethrowTerminalExceptions) \ + EX_END_CATCH \ //=================================================================================== @@ -1158,8 +1100,9 @@ Exception *ExThrowWithInnerHelper(Exception *inner); #define EX_SWALLOW_NONTRANSIENT \ EX_CATCH \ { \ + RethrowTransientExceptions() \ } \ - EX_END_CATCH(RethrowTransientExceptions) \ + EX_END_CATCH \ //=================================================================================== @@ -1217,7 +1160,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); #define EX_END_HOOK \ } \ - ANNOTATION_HANDLER_END; \ EX_RETHROW; \ EX_END_CATCH_FOR_HOOK; \ } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/executableallocator.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/executableallocator.h index 5b9c0d81d..93c475895 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/executableallocator.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/executableallocator.h @@ -182,6 +182,9 @@ class ExecutableAllocator // Return true if double mapping is enabled. static bool IsDoubleMappingEnabled(); + // Release memory allocated via DoubleMapping for either templates or normal double mapped data + void ReleaseWorker(void* pRX, bool releaseTemplate); + // Initialize the allocator instance bool Initialize(); @@ -262,6 +265,18 @@ class ExecutableAllocator // Unmap the RW mapping at the specified address void UnmapRW(void* pRW); + + // Allocate thunks from a template. pTemplate is the return value from CreateTemplate + void* AllocateThunksFromTemplate(void *pTemplate, size_t templateSize, void (*dataPageGenerator)(uint8_t* pageBase, size_t size)); + + // Free a set of thunks allocated from templates. pThunks must have been returned from AllocateThunksFromTemplate + void FreeThunksFromTemplate(void *pThunks, size_t templateSize); + + // Create a template + // If templateInImage is not null, it will attempt to use it as the template, otherwise it will create an temporary in memory file to serve as the template + // Some OS/Architectures may/may not be able to work with this, so this api is permitted to return NULL, and callers should have an alternate approach using + // the codePageGenerator directly. + void* CreateTemplate(void* templateInImage, size_t templateSize, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size)); }; #define ExecutableWriterHolder ExecutableWriterHolderNoLog @@ -285,7 +300,7 @@ class ExecutableWriterHolder void Unmap() { -#if defined(HOST_OSX) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE) +#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE) if (m_addressRX != NULL) { PAL_JitWriteProtect(false); @@ -321,7 +336,7 @@ class ExecutableWriterHolder ExecutableWriterHolder(T* addressRX, size_t size, ExecutableAllocator::CacheableMapping cacheMapping = ExecutableAllocator::AddToCache) { m_addressRX = addressRX; -#if defined(HOST_OSX) && defined(HOST_ARM64) +#if defined(HOST_APPLE) && defined(HOST_ARM64) m_addressRW = addressRX; PAL_JitWriteProtect(true); #else diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/formattype.cpp b/Procfiler/src/cpp/3rdparty/coreclr/inc/formattype.cpp index 64d401ffb..87947ab8c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/formattype.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/formattype.cpp @@ -163,7 +163,7 @@ const char* PrettyPrintSig( out->Shrink(0); appendStr(out,"ERROR PARSING THE SIGNATURE"); } - EX_END_CATCH(SwallowAllExceptions); + EX_END_CATCH return(asString(out)); } @@ -338,7 +338,7 @@ PCCOR_SIGNATURE PrettyPrintSignature( { if(name) // printing the arguments { - PREFIX_ASSUME(typePtr != NULL); + _ASSERTE(typePtr != NULL); if (*typePtr == ELEMENT_TYPE_SENTINEL) { if (needComma) @@ -555,7 +555,7 @@ PCCOR_SIGNATURE PrettyPrintType( case ELEMENT_TYPE_ARRAY : { typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI); - PREFIX_ASSUME(typePtr != NULL); + _ASSERTE(typePtr != NULL); unsigned rank = CorSigUncompressData(typePtr); // what is the syntax for the rank 0 case? if (rank == 0) { @@ -563,11 +563,6 @@ PCCOR_SIGNATURE PrettyPrintType( } else { _ASSERTE(rank != 0); - -#ifdef _PREFAST_ -#pragma prefast(push) -#pragma prefast(disable:22009 "Suppress PREFAST warnings about integer overflow") -#endif int* lowerBounds = (int*) _alloca(sizeof(int)*2*rank); int* sizes = &lowerBounds[rank]; memset(lowerBounds, 0, sizeof(int)*2*rank); @@ -609,9 +604,6 @@ PCCOR_SIGNATURE PrettyPrintType( } } appendChar(out, ']'); -#ifdef _PREFAST_ -#pragma prefast(pop) -#endif } } break; @@ -694,6 +686,44 @@ PCCOR_SIGNATURE PrettyPrintType( appendStr(out, sz); break; } + case ELEMENT_TYPE_CMOD_INTERNAL : + { + // ELEMENT_TYPE_CMOD_INTERNAL + bool required = *typePtr++ != 0; + _ASSERTE(sizeof(TypeHandle) == sizeof(void *)); + TypeHandle typeHandle; + typePtr += CorSigUncompressPointer(typePtr, (void **)&typeHandle); + + MethodTable *pMT = NULL; + if (typeHandle.IsTypeDesc()) + { + pMT = typeHandle.AsTypeDesc()->GetMethodTable(); + if (pMT) + { + PrettyPrintClass(out, pMT->GetCl(), pMT->GetMDImport()); + + // It could be a "native version" of the managed type used in interop + if (typeHandle.AsTypeDesc()->IsNativeValueType()) + appendStr(out, "_NativeValueType"); + } + else + appendStr(out, "(null)"); + } + else + { + pMT = typeHandle.AsMethodTable(); + if (pMT) + PrettyPrintClass(out, pMT->GetCl(), pMT->GetMDImport()); + else + appendStr(out, "(null)"); + } + + const char fmt[] = " mod%s(/* MT: %p */)"; + char sz[Max64BitHexString + ARRAY_SIZE(fmt) + ARRAY_SIZE("req")]; + sprintf_s(sz, ARRAY_SIZE(sz), fmt, required ? "req" : "opt", pMT); + appendStr(out, sz); + break; + } #endif @@ -1068,11 +1098,6 @@ bool TrySigUncompress(PCCOR_SIGNATURE pData, // [IN] compressed dat } } - -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:21000) // Suppress PREFast warning about overly large function -#endif char* DumpMarshaling(IMDInternalImport* pImport, _Inout_updates_(cchszString) char* szString, DWORD cchszString, @@ -1198,18 +1223,11 @@ char* DumpMarshaling(IMDInternalImport* pImport, cbCur += ByteCountLength; if(strLen) { -#ifdef _PREFAST_ -#pragma prefast(push) -#pragma prefast(disable:22009 "Suppress PREFAST warnings about integer overflow") -#endif strTemp = (LPUTF8)_alloca(strLen + 1); memcpy(strTemp, (LPUTF8)&pSigNativeType[cbCur], strLen); strTemp[strLen] = 0; buf.AppendPrintf(", \"%s\"", UnquotedProperName(strTemp)); cbCur += strLen; -#ifdef _PREFAST_ -#pragma prefast(pop) -#endif } } break; @@ -1537,9 +1555,6 @@ char* DumpMarshaling(IMDInternalImport* pImport, } } } -#ifdef _PREFAST_ -#pragma warning(pop) -#endif char* DumpParamAttr(_Inout_updates_(cchszString) char* szString, DWORD cchszString, DWORD dwAttr) { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gc_unwind_x86.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/gc_unwind_x86.h index e5be6b2e4..74fe4e753 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gc_unwind_x86.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gc_unwind_x86.h @@ -26,10 +26,6 @@ enum regNum REGI_NA = REGI_COUNT }; -/***************************************************************************** - Register masks - */ - enum RegMask { RM_EAX = 0x01, @@ -47,6 +43,276 @@ enum RegMask RM_CALLEE_TRASHED = (RM_ALL & ~RM_CALLEE_SAVED), }; +#define CONSTRUCT_ptrArgTP(arg,shift) ptrArgTP((arg), (shift)) + +// Bit vector structure that can hold MAX_PTRARG_OFS bits and efficiently +// handle small vectors. +class ptrArgTP +{ + typedef UINT_PTR ChunkType; // The size of integer type that the machine can operate on directly + + enum + { + IS_BIG = 1, // The low bit is used to discrimate m_val and m_vals + CHUNK_BITS = sizeof(ChunkType)*8, // The number of bits that we can manipuate as a chunk + SMALL_BITS = CHUNK_BITS - 1, // The number of bits we can fit in the small representation + VALS_COUNT = MAX_PTRARG_OFS / CHUNK_BITS, // The number of ChunkType elements in the Vals array + }; + + static const ChunkType MaxVal = ((ChunkType)1 << SMALL_BITS) - 1; // Maximum value that can be stored in m_val + + struct Vals + { + unsigned m_encodedLength; // An encoding of the current length of the 'm_chunks' array + ChunkType m_chunks[VALS_COUNT]; + + bool isBig() const + { + return ((m_encodedLength & IS_BIG) != 0); + } + + unsigned GetLength() const + { + if (isBig()) + { + unsigned length = (m_encodedLength >> 1); + _ASSERTE(length > 0); + return length; + } + else + { + return 0; + } + } + + void SetLength(unsigned length) + { + _ASSERTE(length > 0); + _ASSERTE(length <= VALS_COUNT); + + m_encodedLength = (ChunkType) (length << 1); + m_encodedLength |= (ChunkType) IS_BIG; + } + }; + + union + { + ChunkType m_val; // if m_val bit 0 is false, then bits 1-N are the bit vector + Vals m_vals; // if m_val bit 1 is true, then use Vals + }; + + bool isBig() const + { + LIMITED_METHOD_DAC_CONTRACT; + + return ((m_val & IS_BIG) != 0); + } + + void toBig() + { + LIMITED_METHOD_DAC_CONTRACT; + + if (!isBig()) + { + doBigInit(smallBits()); + } + } + + ChunkType smallBits() const + { + LIMITED_METHOD_DAC_CONTRACT; + + _ASSERTE(!isBig()); + return (m_val >> 1); + } + + void doBigInit(ChunkType arg); + void doBigInit(const ptrArgTP& arg); + void doBigLeftShiftAssign(unsigned arg); + void doBigRightShiftAssign(unsigned arg); + void doBigDiffAssign(const ptrArgTP&); + void doBigAndAssign(const ptrArgTP&); + void doBigOrAssign(const ptrArgTP& arg); + bool doBigEquals(const ptrArgTP&) const; + bool doBigIntersect(const ptrArgTP&) const; + +public: + ptrArgTP() + { + LIMITED_METHOD_DAC_CONTRACT; + + m_val = 0; + } + + explicit ptrArgTP(ChunkType arg) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (arg > MaxVal) + { + doBigInit(arg); + } + else + { + m_val = ChunkType(arg << 1); + } + } + + ptrArgTP(ChunkType arg, UINT shift) + { + LIMITED_METHOD_DAC_CONTRACT; + + if ((arg > MaxVal) || (shift >= SMALL_BITS) || (arg > (MaxVal >> shift))) + { + doBigInit(arg); + doBigLeftShiftAssign(shift); + } + else + { + m_val = ChunkType(arg << (shift+1)); + } + } + + ptrArgTP operator &(const ptrArgTP& arg) const + { + LIMITED_METHOD_DAC_CONTRACT; + + ptrArgTP ret = *this; + ret &= arg; + return ret; + } + + bool operator ==(const ptrArgTP& arg) const + { + LIMITED_METHOD_DAC_CONTRACT; + + if ((m_val | arg.m_val) & IS_BIG) + { + return doBigEquals(arg); + } + else + { + return m_val == arg.m_val; + } + } + + bool operator !=(const ptrArgTP& arg) const + { + LIMITED_METHOD_DAC_CONTRACT; + + return !(*this == arg); + } + + void operator <<=(unsigned shift) + { + LIMITED_METHOD_DAC_CONTRACT; + + if ((m_val == 0) || (shift == 0)) // Zero is a special case, don't need to do anything + return; + + if (isBig() || (shift >= SMALL_BITS) || (m_val > (MaxVal >> (shift-1)))) + { + doBigLeftShiftAssign(shift); + } + else + { + m_val <<= shift; + } + } + + void operator >>=(unsigned shift) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (isBig()) + { + doBigRightShiftAssign(shift); + } + else + { + m_val >>= shift; + m_val &= ~IS_BIG; // clear the isBig bit if it got set + } + } + + void operator |=(const ptrArgTP& arg) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (((m_val | arg.m_val) & IS_BIG) != 0) + { + doBigOrAssign(arg); + } + else + { + m_val |= arg.m_val; + } + } + + void operator &=(const ptrArgTP& arg) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (((m_val | arg.m_val) & IS_BIG) != 0) + { + doBigAndAssign(arg); + } + else + { + m_val &= arg.m_val; + } + } + + friend bool isZero(const ptrArgTP& arg) + { + LIMITED_METHOD_DAC_CONTRACT; + + return arg.m_val == 0; + } + + friend bool intersect(const ptrArgTP& arg1, const ptrArgTP& arg2) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (((arg1.m_val | arg2.m_val) & IS_BIG) != 0) + { + return arg1.doBigIntersect(arg2); + } + else + { + return ((arg1.m_val & arg2.m_val) != 0); + } + } + + friend void setDiff(ptrArgTP& target, const ptrArgTP& arg) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (((target.m_val | arg.m_val) & IS_BIG) != 0) + { + target.doBigDiffAssign(arg); + } + else + { + target.m_val &= ~arg.m_val; + } + } + + friend ChunkType toUnsigned(const ptrArgTP& arg) + { + LIMITED_METHOD_DAC_CONTRACT; + + if (arg.isBig()) + { + return arg.m_vals.m_chunks[0]; // Note truncation + } + else + { + return arg.smallBits(); + } + } +}; + /***************************************************************************** * * Helper to extract basic info from a method info block. @@ -85,7 +351,7 @@ struct hdrInfo bool isSpeculativeStackWalk; // is the stackwalk seeded by an untrusted source (e.g., sampling profiler)? // These always includes EBP for EBP-frames and double-aligned-frames - RegMask savedRegMask:8; // which callee-saved regs are saved on stack + RegMask savedRegMask; // which callee-saved regs are saved on stack // Count of the callee-saved registers, excluding the frame pointer. // This does not include EBP for EBP-frames and double-aligned-frames. @@ -101,6 +367,8 @@ struct hdrInfo unsigned int syncEpilogStart; // The start of the epilog. Synchronized methods are guaranteed to have no more than one epilog. unsigned int revPInvokeOffset; // INVALID_REV_PINVOKE_OFFSET if there is no Reverse PInvoke frame + unsigned int noGCRegionCnt; + enum { NOT_IN_PROLOG = -1, NOT_IN_EPILOG = -1 }; int prologOffs; // NOT_IN_PROLOG if not in prolog @@ -131,8 +399,19 @@ bool UnwindStackFrameX86(PREGDISPLAY pContext, IN_EH_FUNCLETS_COMMA(bool isFunclet) bool updateAllRegs); +unsigned int DecodeGCHdrInfoMethodSize(GCInfoToken gcInfoToken); + size_t DecodeGCHdrInfo(GCInfoToken gcInfoToken, unsigned curOffset, hdrInfo * infoPtr); +bool IsInNoGCRegion(hdrInfo * infoPtr, + PTR_CBYTE table, + unsigned curOffset); + +unsigned FindFirstInterruptiblePoint(hdrInfo * infoPtr, + PTR_CBYTE table, + unsigned offs, + unsigned endOffs); + #endif // _UNWIND_X86_H diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcdecoder.cpp b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcdecoder.cpp index d4a3c4c3a..541011b5f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcdecoder.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcdecoder.cpp @@ -197,7 +197,7 @@ PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header header->syncStartOffset ^= HAS_SYNC_OFFSET; break; case FLIP_REV_PINVOKE_FRAME: - header->revPInvokeOffset = INVALID_REV_PINVOKE_OFFSET ? HAS_REV_PINVOKE_FRAME_OFFSET : INVALID_REV_PINVOKE_OFFSET; + header->revPInvokeOffset ^= (INVALID_REV_PINVOKE_OFFSET ^ HAS_REV_PINVOKE_FRAME_OFFSET); break; case NEXT_OPCODE: @@ -205,9 +205,22 @@ PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header nextByte = *table++; encoding = nextByte & ADJ_ENCODING_MAX; // encoding here always corresponds to codes in InfoHdrAdjust2 set - - _ASSERTE(encoding < SET_RET_KIND_MAX); - header->returnKind = (ReturnKind)encoding; + if (encoding <= SET_RET_KIND_MAX) + { + header->returnKind = (ReturnKind)encoding; + } + else if (encoding < FFFF_NOGCREGION_CNT) + { + header->noGCRegionCnt = encoding - SET_NOGCREGIONS_CNT; + } + else if (encoding == FFFF_NOGCREGION_CNT) + { + header->noGCRegionCnt = HAS_NOGCREGIONS; + } + else + { + _ASSERTE(!"Unexpected encoding"); + } break; } } @@ -470,7 +483,8 @@ bool InfoHdrSmall::isHeaderMatch(const InfoHdr& target) const target.varPtrTableSize != HAS_VARPTR && target.gsCookieOffset != HAS_GS_COOKIE_OFFSET && target.syncStartOffset != HAS_SYNC_OFFSET && - target.revPInvokeOffset != HAS_REV_PINVOKE_FRAME_OFFSET); + target.revPInvokeOffset != HAS_REV_PINVOKE_FRAME_OFFSET && + target.noGCRegionCnt != HAS_NOGCREGIONS); #endif // compare two InfoHdr's up to but not including the untrackCnt field @@ -495,7 +509,10 @@ bool InfoHdrSmall::isHeaderMatch(const InfoHdr& target) const if (target.syncStartOffset != INVALID_SYNC_OFFSET) return false; - if (target.revPInvokeOffset!= INVALID_REV_PINVOKE_OFFSET) + if (target.revPInvokeOffset != INVALID_REV_PINVOKE_OFFSET) + return false; + + if (target.noGCRegionCnt > 0) return false; return true; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfo.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfo.h index d526405c9..cf4a43334 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfo.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfo.h @@ -4,6 +4,7 @@ // ****************************************************************************** // WARNING!!!: These values are used by SOS in the diagnostics repo. Values should // added or removed in a backwards and forwards compatible way. +// There are scenarios in diagnostics that support parsing of old GC Info formats. // See: https://github.com/dotnet/diagnostics/blob/main/src/shared/inc/gcinfo.h // ****************************************************************************** @@ -36,7 +37,18 @@ const unsigned this_OFFSET_FLAG = 0x2; // the offset is "this" // The current GCInfo Version //----------------------------------------------------------------------------- -#define GCINFO_VERSION 3 +#define GCINFO_VERSION 4 + +#ifdef SOS_INCLUDE +extern bool IsRuntimeVersionAtLeast(DWORD major); +inline int GCInfoVersion() +{ + // In SOS we only care about ability to parse/dump the GC Info. + // Since v2 and v3 had the same file format and v1 is no longer supported, + // we can assume that everything before net10.0 uses GCInfo v3. + return IsRuntimeVersionAtLeast(10) ? 4 : 3; +} +#endif //----------------------------------------------------------------------------- // GCInfoToken: A wrapper that contains the GcInfo data and version number. @@ -65,17 +77,15 @@ struct GCInfoToken } #endif + // Keep this in sync with GetR2RGCInfoVersion in cDac (ExecutionManagerCore.ReadyToRunJitManager.cs) static uint32_t ReadyToRunVersionToGcInfoVersion(uint32_t readyToRunMajorVersion, uint32_t readyToRunMinorVersion) { - // Once MINIMUM_READYTORUN_MAJOR_VERSION is bumped to 10+ - // delete the following and just return GCINFO_VERSION - // - // R2R 9.0 and 9.1 use GCInfo v2 - // R2R 9.2 uses GCInfo v3 - if (readyToRunMajorVersion == 9 && readyToRunMinorVersion < 2) - return 2; + if (readyToRunMajorVersion >= 11) + return 4; - return GCINFO_VERSION; + // Since v2 and v3 had the same file format and v1 is no longer supported, + // we can assume GCInfo v3. + return 3; } }; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodecoder.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodecoder.h index 6f62a3f87..87693d89d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodecoder.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodecoder.h @@ -16,6 +16,10 @@ #ifndef _GC_INFO_DECODER_ #define _GC_INFO_DECODER_ +#ifdef SOS_INCLUDE +#define DECODE_OLD_FORMATS +#endif + #define _max(a, b) (((a) > (b)) ? (a) : (b)) #define _min(a, b) (((a) < (b)) ? (a) : (b)) @@ -214,7 +218,7 @@ enum GcInfoDecoderFlags DECODE_INTERRUPTIBILITY = 0x08, DECODE_GC_LIFETIMES = 0x10, DECODE_NO_VALIDATION = 0x20, - DECODE_PSP_SYM = 0x40, + DECODE_PSP_SYM = 0x40, // Unused starting with v4 format DECODE_GENERICS_INST_CONTEXT = 0x80, // stack location of instantiation context for generics // (this may be either the 'this' ptr or the instantiation secret param) DECODE_GS_COOKIE = 0x100, // stack location of the GS cookie @@ -222,7 +226,7 @@ enum GcInfoDecoderFlags DECODE_PROLOG_LENGTH = 0x400, // length of the prolog (used to avoid reporting generics context) DECODE_EDIT_AND_CONTINUE = 0x800, DECODE_REVERSE_PINVOKE_VAR = 0x1000, - DECODE_RETURN_KIND = 0x2000, + DECODE_RETURN_KIND = 0x2000, // Unused starting with v4 format #if defined(TARGET_ARM) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) DECODE_HAS_TAILCALLS = 0x4000, #endif // TARGET_ARM || TARGET_ARM64 || TARGET_LOONGARCH64 @@ -233,7 +237,7 @@ enum GcInfoHeaderFlags GC_INFO_IS_VARARG = 0x1, // unused = 0x2, // was GC_INFO_HAS_SECURITY_OBJECT GC_INFO_HAS_GS_COOKIE = 0x4, - GC_INFO_HAS_PSP_SYM = 0x8, + GC_INFO_HAS_PSP_SYM = 0x8, // Unused starting with v4 format GC_INFO_HAS_GENERICS_INST_CONTEXT_MASK = 0x30, GC_INFO_HAS_GENERICS_INST_CONTEXT_NONE = 0x00, GC_INFO_HAS_GENERICS_INST_CONTEXT_MT = 0x10, @@ -248,7 +252,6 @@ enum GcInfoHeaderFlags GC_INFO_HAS_EDIT_AND_CONTINUE_INFO = 0x100, GC_INFO_REVERSE_PINVOKE_FRAME = 0x200, - GC_INFO_FLAGS_BIT_SIZE_VERSION_1 = 9, GC_INFO_FLAGS_BIT_SIZE = 10, }; @@ -466,6 +469,8 @@ struct GcSlotDesc GcSlotFlags Flags; }; + +template class GcSlotDecoder { public: @@ -508,12 +513,13 @@ class GcSlotDecoder }; #ifdef USE_GC_INFO_DECODER -class GcInfoDecoder +template +class TGcInfoDecoder { public: // If you are not interested in interruptibility or gc lifetime information, pass 0 as instructionOffset - GcInfoDecoder( + TGcInfoDecoder( GCInfoToken gcInfoToken, GcInfoDecoderFlags flags = DECODE_EVERYTHING, UINT32 instructionOffset = 0 @@ -528,14 +534,12 @@ class GcInfoDecoder #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED bool IsSafePoint(); - bool AreSafePointsInterruptible(); - bool IsInterruptibleSafePoint(); - bool CouldBeInterruptibleSafePoint(); + bool CouldBeSafePoint(); - // This is used for gccoverage + // This is used for gcinfodumper bool IsSafePoint(UINT32 codeOffset); - typedef void EnumerateSafePointsCallback (GcInfoDecoder* decoder, UINT32 offset, void * hCallback); + typedef void EnumerateSafePointsCallback (TGcInfoDecoder * decoder, UINT32 offset, void * hCallback); void EnumerateSafePoints(EnumerateSafePointsCallback * pCallback, void * hCallback); #endif @@ -579,6 +583,7 @@ class GcInfoDecoder INT32 GetReversePInvokeFrameStackSlot(); bool HasMethodDescGenericsInstContext(); bool HasMethodTableGenericsInstContext(); + bool HasStackBaseRegister(); bool GetIsVarArg(); bool WantsReportOnlyLeaf(); #if defined(TARGET_ARM) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) @@ -597,6 +602,10 @@ class GcInfoDecoder UINT32 GetSizeOfStackParameterArea(); #endif // FIXED_STACK_PARAMETER_SCRATCH_AREA + inline UINT32 Version() + { + return m_Version; + } private: BitStreamReader m_Reader; @@ -617,6 +626,7 @@ class GcInfoDecoder #ifdef TARGET_ARM64 UINT32 m_SizeOfEditAndContinueFixedStackFrame; #endif + // Unused starting with v4 format ReturnKind m_ReturnKind; #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED UINT32 m_NumSafePoints; @@ -636,6 +646,24 @@ class GcInfoDecoder #endif UINT32 m_Version; + inline UINT32 NormalizeCodeOffset(UINT32 offset) + { +#ifdef DECODE_OLD_FORMATS + if (Version() < 4) + return offset; +#endif + return GcInfoEncoding::NORMALIZE_CODE_OFFSET(offset); + } + + inline UINT32 DenormalizeCodeOffset(UINT32 offset) + { +#ifdef DECODE_OLD_FORMATS + if (Version() < 4) + return offset; +#endif + return GcInfoEncoding::DENORMALIZE_CODE_OFFSET(offset); + } + bool PredecodeFatHeader(int remainingFlags); static bool SetIsInterruptibleCB (UINT32 startOffset, UINT32 stopOffset, void * hCallback); @@ -666,7 +694,7 @@ class GcInfoDecoder bool IsScratchStackSlot(INT32 spOffset, GcStackSlotBase spBase, PREGDISPLAY pRD); void ReportUntrackedSlots( - GcSlotDecoder& slotDecoder, + GcSlotDecoder& slotDecoder, PREGDISPLAY pRD, unsigned flags, GCEnumCallback pCallBack, @@ -694,7 +722,7 @@ class GcInfoDecoder inline void ReportSlotToGC( - GcSlotDecoder& slotDecoder, + GcSlotDecoder& slotDecoder, UINT32 slotIndex, PREGDISPLAY pRD, bool reportScratchSlots, @@ -751,6 +779,12 @@ class GcInfoDecoder } } }; + +typedef TGcInfoDecoder GcInfoDecoder; +#ifdef FEATURE_INTERPRETER +typedef TGcInfoDecoder InterpreterGcInfoDecoder; +#endif // FEATURE_INTERPRETER + #endif // USE_GC_INFO_DECODER diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodumper.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodumper.h index 7b29edc10..7802ccc37 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodumper.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfodumper.h @@ -8,9 +8,10 @@ #include "gcinfodecoder.h" // ***************************************************************************** -// WARNING!!!: These values and code are also used by SOS in the diagnostics -// repo. Should updated in a backwards and forwards compatible way. +// WARNING!!!: These values and code are used in the runtime repo and SOS in the +// diagnostics repo. Should updated in a backwards and forwards compatible way. // See: https://github.com/dotnet/diagnostics/blob/main/src/shared/inc/gcinfodumper.h +// https://github.com/dotnet/runtime/blob/main/src/coreclr/inc/gcinfodumper.h // ***************************************************************************** // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfoencoder.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfoencoder.h index b3199a1a9..273d142a3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfoencoder.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfoencoder.h @@ -23,7 +23,7 @@ - Flag: isVarArg, unused (was hasSecurityObject), hasGSCookie, - hasPSPSymStackSlot, + unused (was hasPSPSymStackSlot), hasGenericsInstContextStackSlot, hasStackBaseregister, wantsReportOnlyLeaf (AMD64 use only), @@ -34,9 +34,9 @@ - CodeLength - Prolog (if hasGenericsInstContextStackSlot || hasGSCookie) - Epilog (if hasGSCookie) - - SecurityObjectStackSlot (if any) + - SecurityObjectStackSlot (if any; no longer used) - GSCookieStackSlot (if any) - - PSPSymStackSlot (if any) + - PSPSymStackSlot (if any; no longer used) - GenericsInstContextStackSlot (if any) - StackBaseRegister (if any) - SizeOfEditAndContinuePreservedArea (if any) @@ -128,7 +128,6 @@ struct GcInfoSize size_t ProEpilogSize; size_t SecObjSize; size_t GsCookieSize; - size_t PspSymSize; size_t GenericsCtxSize; size_t StackBaseSize; size_t ReversePInvokeFrameSize; @@ -290,19 +289,7 @@ class BitStreamWriter *m_pCurrentSlot |= data; } - inline void AllocMemoryBlock() - { - _ASSERTE( IS_ALIGNED( m_MemoryBlockSize, sizeof( size_t ) ) ); - MemoryBlock* pMemBlock = m_MemoryBlocks.AppendNew(m_pAllocator, m_MemoryBlockSize); - - m_pCurrentSlot = pMemBlock->Contents; - m_OutOfBlockSlot = m_pCurrentSlot + m_MemoryBlockSize / sizeof( size_t ); - -#ifdef _DEBUG - m_MemoryBlocksCount++; -#endif - - } + inline void AllocMemoryBlock(); inline void InitCurrentSlot() { @@ -315,16 +302,6 @@ class BitStreamWriter typedef UINT32 GcSlotId; -inline UINT32 GetNormCodeOffsetChunk(UINT32 normCodeOffset) -{ - return normCodeOffset / NUM_NORM_CODE_OFFSETS_PER_CHUNK; -} - -inline UINT32 GetCodeOffsetChunk(UINT32 codeOffset) -{ - return (NORMALIZE_CODE_OFFSET(codeOffset)) / NUM_NORM_CODE_OFFSETS_PER_CHUNK; -} - enum GENERIC_CONTEXTPARAM_TYPE { GENERIC_CONTEXTPARAM_NONE = 0, @@ -335,18 +312,8 @@ enum GENERIC_CONTEXTPARAM_TYPE extern void DECLSPEC_NORETURN ThrowOutOfMemory(); -class GcInfoEncoder +namespace GcInfoEncoderExt { -public: - typedef void (*NoMemoryFunction)(void); - - GcInfoEncoder( - ICorJitInfo* pCorJitInfo, - CORINFO_METHOD_INFO* pMethodInfo, - IAllocator* pJitAllocator, - NoMemoryFunction pNoMem = ::ThrowOutOfMemory - ); - struct LifetimeTransition { UINT32 CodeOffset; @@ -354,7 +321,20 @@ class GcInfoEncoder BYTE BecomesLive; BYTE IsDeleted; }; +} +template +class TGcInfoEncoder +{ +public: + typedef void (*NoMemoryFunction)(void); + + TGcInfoEncoder( + ICorJitInfo* pCorJitInfo, + CORINFO_METHOD_INFO* pMethodInfo, + IAllocator* pJitAllocator, + NoMemoryFunction pNoMem = ::ThrowOutOfMemory + ); #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED void DefineCallSites(UINT32* pCallSites, BYTE* pCallSiteSizes, UINT32 numCallSites); @@ -409,20 +389,12 @@ class GcInfoEncoder GcSlotState slotState ); - - //------------------------------------------------------------------------ - // ReturnKind - //------------------------------------------------------------------------ - - void SetReturnKind(ReturnKind returnKind); - //------------------------------------------------------------------------ // Miscellaneous method information //------------------------------------------------------------------------ void SetPrologSize( UINT32 prologSize ); void SetGSCookieStackSlot( INT32 spOffsetGSCookie, UINT32 validRangeStart, UINT32 validRangeEnd ); - void SetPSPSymStackSlot( INT32 spOffsetPSPSym ); void SetGenericsInstContextStackSlot( INT32 spOffsetGenericsContext, GENERIC_CONTEXTPARAM_TYPE type); void SetReversePInvokeFrameSlot(INT32 spOffset); void SetIsVarArg(); @@ -468,6 +440,12 @@ class GcInfoEncoder // BYTE* Emit(); + // + // Return the size in bytes of the constructed GC info. This is the size passed + // to the VM via `allocGCInfo`. It is only valid after `Emit` is called. + // + size_t GetEncodedGCInfoSize() const; + private: friend struct CompareLifetimeTransitionsByOffsetThenSlot; @@ -489,7 +467,7 @@ class GcInfoEncoder BitStreamWriter m_Info2; // Used for chunk encodings GcInfoArrayList m_InterruptibleRanges; - GcInfoArrayList m_LifetimeTransitions; + GcInfoArrayList m_LifetimeTransitions; bool m_IsVarArg; #if defined(TARGET_AMD64) @@ -500,10 +478,8 @@ class GcInfoEncoder INT32 m_GSCookieStackSlot; UINT32 m_GSCookieValidRangeStart; UINT32 m_GSCookieValidRangeEnd; - INT32 m_PSPSymStackSlot; INT32 m_GenericsInstContextStackSlot; GENERIC_CONTEXTPARAM_TYPE m_contextParamType; - ReturnKind m_ReturnKind; UINT32 m_CodeLength; UINT32 m_StackBaseRegister; UINT32 m_SizeOfEditAndContinuePreservedArea; @@ -534,6 +510,8 @@ class GcInfoEncoder UINT32 m_NumCallSites; #endif // PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED + size_t m_BlockSize; // The byte size passed to the `allocGCInfo` call + void GrowSlotTable(); void WriteSlotStateVector(BitStreamWriter &writer, const BitArray& vector); @@ -542,19 +520,20 @@ class GcInfoEncoder void SizeofSlotStateVarLengthVector(const BitArray& vector, UINT32 baseSkip, UINT32 baseRun, UINT32 * pSizeofSimple, UINT32 * pSizeofRLE, UINT32 * pSizeofRLENeg); UINT32 WriteSlotStateVarLengthVector(BitStreamWriter &writer, const BitArray& vector, UINT32 baseSkip, UINT32 baseRun); -#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED - bool DoNotTrackInPartiallyInterruptible(GcSlotDesc &slot); -#endif // PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED - // Assumes that "*ppTransitions" is has size "numTransitions", is sorted by CodeOffset then by SlotId, // and that "*ppEndTransitions" points one beyond the end of the array. If "*ppTransitions" contains // any dead/live transitions pairs for the same CodeOffset and SlotID, removes those, by allocating a // new array, and copying the non-removed elements into it. If it does this, sets "*ppTransitions" to // point to the new array, "*pNumTransitions" to its shorted length, and "*ppEndTransitions" to // point one beyond the used portion of this array. - void EliminateRedundantLiveDeadPairs(LifetimeTransition** ppTransitions, + void EliminateRedundantLiveDeadPairs(GcInfoEncoderExt::LifetimeTransition** ppTransitions, size_t* pNumTransitions, - LifetimeTransition** ppEndTransitions); + GcInfoEncoderExt::LifetimeTransition** ppEndTransitions); + + static inline UINT32 GetNormCodeOffsetChunk(UINT32 normCodeOffset) + { + return normCodeOffset / GcInfoEncoding::NUM_NORM_CODE_OFFSETS_PER_CHUNK; + } #ifdef _DEBUG bool m_IsSlotTableFrozen; @@ -565,4 +544,10 @@ class GcInfoEncoder #endif }; +typedef TGcInfoEncoder GcInfoEncoder; + +#ifdef FEATURE_INTERPRETER +typedef TGcInfoEncoder InterpreterGcInfoEncoder; +#endif // FEATURE_INTERPRETER + #endif // !__GCINFOENCODER_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfotypes.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfotypes.h index 7457063d4..4d5690505 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfotypes.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcinfotypes.h @@ -14,9 +14,10 @@ #endif // _MSC_VER // ***************************************************************************** -// WARNING!!!: These values and code are also used by SOS in the diagnostics -// repo. Should updated in a backwards and forwards compatible way. +// WARNING!!!: These values and code are used in the runtime repo and SOS in the +// diagnostics repo. Should updated in a backwards and forwards compatible way. // See: https://github.com/dotnet/diagnostics/blob/main/src/shared/inc/gcinfotypes.h +// https://github.com/dotnet/runtime/blob/main/src/coreclr/inc/gcinfotypes.h // ***************************************************************************** #define PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED @@ -107,6 +108,8 @@ struct GcStackSlot } }; +// ReturnKind is not encoded in GCInfo v4 and later, except on x86. + //-------------------------------------------------------------------------------- // ReturnKind -- encoding return type information in GcInfo // @@ -131,61 +134,6 @@ struct GcStackSlot // //-------------------------------------------------------------------------------- -// RT_Unset: An intermediate step for staged bringup. -// When ReturnKind is RT_Unset, it means that the JIT did not set -// the ReturnKind in the GCInfo, and therefore the VM cannot rely on it, -// and must use other mechanisms (similar to GcInfo ver 1) to determine -// the Return type's GC information. -// -// RT_Unset is only used in the following situations: -// X64: Used by JIT64 until updated to use GcInfo v2 API -// ARM: Used by JIT32 until updated to use GcInfo v2 API -// -// RT_Unset should have a valid encoding, whose bits are actually stored in the image. -// For X86, there are no free bits, and there's no RT_Unused enumeration. - -#if defined(TARGET_X86) - -// 00 RT_Scalar -// 01 RT_Object -// 10 RT_ByRef -// 11 RT_Float - -#elif defined(TARGET_ARM) - -// 00 RT_Scalar -// 01 RT_Object -// 10 RT_ByRef -// 11 RT_Unset - -#elif defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) - -// Slim Header: - -// 00 RT_Scalar -// 01 RT_Object -// 10 RT_ByRef -// 11 RT_Unset - -// Fat Header: - -// 0000 RT_Scalar -// 0001 RT_Object -// 0010 RT_ByRef -// 0011 RT_Unset -// 0100 RT_Scalar_Obj -// 1000 RT_Scalar_ByRef -// 0101 RT_Obj_Obj -// 1001 RT_Obj_ByRef -// 0110 RT_ByRef_Obj -// 1010 RT_ByRef_ByRef - -#else -#ifdef PORTABILITY_WARNING -PORTABILITY_WARNING("Need ReturnKind for new Platform") -#endif // PORTABILITY_WARNING -#endif // Target checks - enum ReturnKind { // Cases for Return in one register @@ -258,15 +206,6 @@ inline bool IsPointerFieldReturnKind(ReturnKind returnKind) return (returnKind == RT_Object || returnKind == RT_ByRef); } -inline bool IsValidReturnRegister(size_t regNo) -{ - return (regNo == 0) -#ifdef FEATURE_MULTIREG_RETURN - || (regNo == 1) -#endif // FEATURE_MULTIREG_RETURN - ; -} - inline bool IsStructReturnKind(ReturnKind returnKind) { // Two bits encode integer/ref/float return-kinds. @@ -307,7 +246,6 @@ inline ReturnKind GetStructReturnKind(ReturnKind reg0, ReturnKind reg1) inline ReturnKind ExtractRegReturnKind(ReturnKind returnKind, size_t returnRegOrdinal, bool& moreRegs) { _ASSERTE(IsValidReturnKind(returnKind)); - _ASSERTE(IsValidReturnRegister(returnRegOrdinal)); // Return kind of each return register is encoded in two bits at returnRegOrdinal*2 position from LSB ReturnKind regReturnKind = (ReturnKind)((returnKind >> (returnRegOrdinal * 2)) & 3); @@ -349,7 +287,8 @@ inline const char *ReturnKindToString(ReturnKind returnKind) #ifdef TARGET_X86 #include // For memcmp() -#include "bitvector.h" // for ptrArgTP + +#define MAX_PTRARG_OFS 1024 #ifndef FASTCALL #define FASTCALL __fastcall @@ -366,7 +305,8 @@ enum infoHdrAdjustConstants { SET_EPILOGSIZE_MAX = 10, // Change to 6 SET_EPILOGCNT_MAX = 4, SET_UNTRACKED_MAX = 3, - SET_RET_KIND_MAX = 4, // 2 bits for ReturnKind + SET_RET_KIND_MAX = 3, // 2 bits for ReturnKind + SET_NOGCREGIONS_MAX = 4, ADJ_ENCODING_MAX = 0x7f, // Maximum valid encoding in a byte // Also used to mask off next bit from each encoding byte. MORE_BYTES_TO_FOLLOW = 0x80 // If the High-bit of a header or adjustment byte @@ -418,10 +358,13 @@ enum infoHdrAdjust { // Second set of opcodes, when first code is 0x4F enum infoHdrAdjust2 { SET_RETURNKIND = 0, // 0x00-SET_RET_KIND_MAX Set ReturnKind to value + SET_NOGCREGIONS_CNT = SET_RETURNKIND + SET_RET_KIND_MAX + 1, // 0x04 + FFFF_NOGCREGION_CNT = SET_NOGCREGIONS_CNT + SET_NOGCREGIONS_MAX + 1 // 0x09 There is a count (>SET_NOGCREGIONS_MAX) after the header encoding }; #define HAS_UNTRACKED ((unsigned int) -1) #define HAS_VARPTR ((unsigned int) -1) +#define HAS_NOGCREGIONS ((unsigned int) -1) // 0 is a valid offset for the Reverse P/Invoke block // So use -1 as the sentinel for invalid and -2 as the sentinel for present. @@ -470,7 +413,7 @@ struct InfoHdrSmall { unsigned short argCount; // 5,6 in bytes unsigned int frameSize; // 7,8,9,10 in bytes unsigned int untrackedCnt; // 11,12,13,14 - unsigned int varPtrTableSize; // 15.16,17,18 + unsigned int varPtrTableSize; // 15,16,17,18 // Checks whether "this" is compatible with "target". // It is not an exact bit match as "this" could have some @@ -488,7 +431,8 @@ struct InfoHdr : public InfoHdrSmall { unsigned int syncStartOffset; // 23,24,25,26 unsigned int syncEndOffset; // 27,28,29,30 unsigned int revPInvokeOffset; // 31,32,33,34 Available GcInfo v2 onwards, previously undefined - // 35 bytes total + unsigned int noGCRegionCnt; // 35,36,37,38 + // 39 bytes total // Checks whether "this" is compatible with "target". // It is not an exact bit match as "this" could have some @@ -503,7 +447,8 @@ struct InfoHdr : public InfoHdrSmall { target.varPtrTableSize != HAS_VARPTR && target.gsCookieOffset != HAS_GS_COOKIE_OFFSET && target.syncStartOffset != HAS_SYNC_OFFSET && - target.revPInvokeOffset != HAS_REV_PINVOKE_FRAME_OFFSET); + target.revPInvokeOffset != HAS_REV_PINVOKE_FRAME_OFFSET && + target.noGCRegionCnt != HAS_NOGCREGIONS); #endif // compare two InfoHdr's up to but not including the untrackCnt field @@ -534,6 +479,13 @@ struct InfoHdr : public InfoHdrSmall { (target.revPInvokeOffset == INVALID_REV_PINVOKE_OFFSET)) return false; + if (noGCRegionCnt != target.noGCRegionCnt) { + if (target.noGCRegionCnt <= SET_NOGCREGIONS_MAX) + return false; + else if (noGCRegionCnt != HAS_UNTRACKED) + return false; + } + return true; } }; @@ -564,6 +516,7 @@ inline void GetInfoHdr(int index, InfoHdr * header) header->syncStartOffset = INVALID_SYNC_OFFSET; header->syncEndOffset = INVALID_SYNC_OFFSET; header->revPInvokeOffset = INVALID_REV_PINVOKE_OFFSET; + header->noGCRegionCnt = 0; } PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header); @@ -610,284 +563,293 @@ void FASTCALL decodeCallPattern(int pattern, #ifndef TARGET_POINTER_SIZE #define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target #endif -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64) -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6) -#define NORMALIZE_STACK_SLOT(x) ((x)>>3) -#define DENORMALIZE_STACK_SLOT(x) ((x)<<3) -#define NORMALIZE_CODE_LENGTH(x) (x) -#define DENORMALIZE_CODE_LENGTH(x) (x) -// Encode RBP as 0 -#define NORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5) -#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5) -#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3) -#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3) -#define CODE_OFFSETS_NEED_NORMALIZATION 0 -#define NORMALIZE_CODE_OFFSET(x) (x) -#define DENORMALIZE_CODE_OFFSET(x) (x) -#define NORMALIZE_REGISTER(x) (x) -#define DENORMALIZE_REGISTER(x) (x) -#define NORMALIZE_NUM_SAFE_POINTS(x) (x) -#define DENORMALIZE_NUM_SAFE_POINTS(x) (x) -#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) -#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) - -#define PSP_SYM_STACK_SLOT_ENCBASE 6 -#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6 -#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6 -#define GS_COOKIE_STACK_SLOT_ENCBASE 6 -#define CODE_LENGTH_ENCBASE 8 -#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2 -#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4 -#define STACK_BASE_REGISTER_ENCBASE 3 -#define SIZE_OF_STACK_AREA_ENCBASE 3 -#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4 -#define REVERSE_PINVOKE_FRAME_ENCBASE 6 -#define NUM_REGISTERS_ENCBASE 2 -#define NUM_STACK_SLOTS_ENCBASE 2 -#define NUM_UNTRACKED_SLOTS_ENCBASE 1 -#define NORM_PROLOG_SIZE_ENCBASE 5 -#define NORM_EPILOG_SIZE_ENCBASE 3 -#define NORM_CODE_OFFSET_DELTA_ENCBASE 3 -#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6 -#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6 -#define REGISTER_ENCBASE 3 -#define REGISTER_DELTA_ENCBASE 2 -#define STACK_SLOT_ENCBASE 6 -#define STACK_SLOT_DELTA_ENCBASE 4 -#define NUM_SAFE_POINTS_ENCBASE 2 -#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1 -#define NUM_EH_CLAUSES_ENCBASE 2 -#define POINTER_SIZE_ENCBASE 3 -#define LIVESTATE_RLE_RUN_ENCBASE 2 -#define LIVESTATE_RLE_SKIP_ENCBASE 4 + +#define TargetGcInfoEncoding AMD64GcInfoEncoding + +struct AMD64GcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return ((x)>>3); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return ((x)<<3); } + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return (x); } + + // Encode RBP as 0 + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x) ^ 5); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x) ^ 5); } + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)>>3); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)<<3); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = false; + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return (x); } + + static const int PSP_SYM_STACK_SLOT_ENCBASE = 6; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 6; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 6; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 6; + static const int CODE_LENGTH_ENCBASE = 8; + static const int SIZE_OF_RETURN_KIND_IN_SLIM_HEADER = 2; + static const int SIZE_OF_RETURN_KIND_IN_FAT_HEADER = 4; + static const int STACK_BASE_REGISTER_ENCBASE = 3; + static const int SIZE_OF_STACK_AREA_ENCBASE = 3; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 4; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 6; + static const int NUM_REGISTERS_ENCBASE = 2; + static const int NUM_STACK_SLOTS_ENCBASE = 2; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 1; + static const int NORM_PROLOG_SIZE_ENCBASE = 5; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 6; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 6; + static const int REGISTER_ENCBASE = 3; + static const int REGISTER_DELTA_ENCBASE = 2; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 2; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 1; + static const int NUM_EH_CLAUSES_ENCBASE = 2; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; #elif defined(TARGET_ARM) #ifndef TARGET_POINTER_SIZE #define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target #endif -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64) -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6) -#define NORMALIZE_STACK_SLOT(x) ((x)>>2) -#define DENORMALIZE_STACK_SLOT(x) ((x)<<2) -#define NORMALIZE_CODE_LENGTH(x) ((x)>>1) -#define DENORMALIZE_CODE_LENGTH(x) ((x)<<1) -// Encode R11 as zero -#define NORMALIZE_STACK_BASE_REGISTER(x) ((((x) - 4) & 7) ^ 7) -#define DENORMALIZE_STACK_BASE_REGISTER(x) (((x) ^ 7) + 4) -#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>2) -#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<2) -#define CODE_OFFSETS_NEED_NORMALIZATION 1 -#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 2/4 bytes long in Thumb/ARM states, -#define DENORMALIZE_CODE_OFFSET(x) (x) // but the safe-point offsets are encoded with a -1 adjustment. -#define NORMALIZE_REGISTER(x) (x) -#define DENORMALIZE_REGISTER(x) (x) -#define NORMALIZE_NUM_SAFE_POINTS(x) (x) -#define DENORMALIZE_NUM_SAFE_POINTS(x) (x) -#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) -#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) - -// The choices of these encoding bases only affects space overhead -// and performance, not semantics/correctness. -#define PSP_SYM_STACK_SLOT_ENCBASE 5 -#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 5 -#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 5 -#define GS_COOKIE_STACK_SLOT_ENCBASE 5 -#define CODE_LENGTH_ENCBASE 7 -#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2 -#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2 -#define STACK_BASE_REGISTER_ENCBASE 1 -#define SIZE_OF_STACK_AREA_ENCBASE 3 -#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3 -#define REVERSE_PINVOKE_FRAME_ENCBASE 5 -#define NUM_REGISTERS_ENCBASE 2 -#define NUM_STACK_SLOTS_ENCBASE 3 -#define NUM_UNTRACKED_SLOTS_ENCBASE 3 -#define NORM_PROLOG_SIZE_ENCBASE 5 -#define NORM_EPILOG_SIZE_ENCBASE 3 -#define NORM_CODE_OFFSET_DELTA_ENCBASE 3 -#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 4 -#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6 -#define REGISTER_ENCBASE 2 -#define REGISTER_DELTA_ENCBASE 1 -#define STACK_SLOT_ENCBASE 6 -#define STACK_SLOT_DELTA_ENCBASE 4 -#define NUM_SAFE_POINTS_ENCBASE 3 -#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 2 -#define NUM_EH_CLAUSES_ENCBASE 3 -#define POINTER_SIZE_ENCBASE 3 -#define LIVESTATE_RLE_RUN_ENCBASE 2 -#define LIVESTATE_RLE_SKIP_ENCBASE 4 + +#define TargetGcInfoEncoding ARM32GcInfoEncoding + +struct ARM32GcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return ((x)>>2); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return ((x)<<2); } + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)>>1); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)<<1); } + // Encode R11 as zero + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((((x) - 4) & 7) ^ 7); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return (((x) ^ 7) + 4); } + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)<<2); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = true; + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)>>1) /* Instructions are 2/4 bytes long in Thumb/ARM states */; } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)<<1); } + + // The choices of these encoding bases only affects space overhead + // and performance, not semantics/correctness. + static const int PSP_SYM_STACK_SLOT_ENCBASE = 5; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 5; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 5; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 5; + static const int CODE_LENGTH_ENCBASE = 7; + static const int SIZE_OF_RETURN_KIND_IN_SLIM_HEADER = 2; + static const int SIZE_OF_RETURN_KIND_IN_FAT_HEADER = 2; + static const int STACK_BASE_REGISTER_ENCBASE = 1; + static const int SIZE_OF_STACK_AREA_ENCBASE = 3; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 3; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 5; + static const int NUM_REGISTERS_ENCBASE = 2; + static const int NUM_STACK_SLOTS_ENCBASE = 3; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 3; + static const int NORM_PROLOG_SIZE_ENCBASE = 5; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 4; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 6; + static const int REGISTER_ENCBASE = 2; + static const int REGISTER_DELTA_ENCBASE = 1; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 3; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 2; + static const int NUM_EH_CLAUSES_ENCBASE = 3; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; #elif defined(TARGET_ARM64) #ifndef TARGET_POINTER_SIZE #define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target #endif -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64) -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6) -#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned -#define DENORMALIZE_STACK_SLOT(x) ((x)<<3) -#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long -#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2) -#define NORMALIZE_STACK_BASE_REGISTER(x) ((x)^29) // Encode Frame pointer X29 as zero -#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x)^29) -#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3) -#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3) -#define CODE_OFFSETS_NEED_NORMALIZATION 0 -#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point -#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment. -#define NORMALIZE_REGISTER(x) (x) -#define DENORMALIZE_REGISTER(x) (x) -#define NORMALIZE_NUM_SAFE_POINTS(x) (x) -#define DENORMALIZE_NUM_SAFE_POINTS(x) (x) -#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) -#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) - -#define PSP_SYM_STACK_SLOT_ENCBASE 6 -#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6 -#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6 -#define GS_COOKIE_STACK_SLOT_ENCBASE 6 -#define CODE_LENGTH_ENCBASE 8 -#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2 -#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4 -#define STACK_BASE_REGISTER_ENCBASE 2 // FP encoded as 0, SP as 2. -#define SIZE_OF_STACK_AREA_ENCBASE 3 -#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4 -#define SIZE_OF_EDIT_AND_CONTINUE_FIXED_STACK_FRAME_ENCBASE 4 -#define REVERSE_PINVOKE_FRAME_ENCBASE 6 -#define NUM_REGISTERS_ENCBASE 3 -#define NUM_STACK_SLOTS_ENCBASE 2 -#define NUM_UNTRACKED_SLOTS_ENCBASE 1 -#define NORM_PROLOG_SIZE_ENCBASE 5 -#define NORM_EPILOG_SIZE_ENCBASE 3 -#define NORM_CODE_OFFSET_DELTA_ENCBASE 3 -#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6 -#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6 -#define REGISTER_ENCBASE 3 -#define REGISTER_DELTA_ENCBASE 2 -#define STACK_SLOT_ENCBASE 6 -#define STACK_SLOT_DELTA_ENCBASE 4 -#define NUM_SAFE_POINTS_ENCBASE 3 -#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1 -#define NUM_EH_CLAUSES_ENCBASE 2 -#define POINTER_SIZE_ENCBASE 3 -#define LIVESTATE_RLE_RUN_ENCBASE 2 -#define LIVESTATE_RLE_SKIP_ENCBASE 4 + +#define TargetGcInfoEncoding ARM64GcInfoEncoding + +struct ARM64GcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + // GC Pointers are 8-bytes aligned + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return ((x)>>3); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return ((x)<<3); } + // All Instructions are 4 bytes long + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)<<2); } + // Encode Frame pointer X29 as zero + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x)^29); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x)^29); } + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)>>3); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)<<3); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = true; + // Instructions are 4 bytes long + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)<<2); } + + static const int PSP_SYM_STACK_SLOT_ENCBASE = 6; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 6; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 6; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 6; + static const int CODE_LENGTH_ENCBASE = 8; + static const int SIZE_OF_RETURN_KIND_IN_SLIM_HEADER = 2; + static const int SIZE_OF_RETURN_KIND_IN_FAT_HEADER = 4; + // FP encoded as 0, SP as 2. + static const int STACK_BASE_REGISTER_ENCBASE = 2; + static const int SIZE_OF_STACK_AREA_ENCBASE = 3; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 4; + static const int SIZE_OF_EDIT_AND_CONTINUE_FIXED_STACK_FRAME_ENCBASE = 4; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 6; + static const int NUM_REGISTERS_ENCBASE = 3; + static const int NUM_STACK_SLOTS_ENCBASE = 2; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 1; + static const int NORM_PROLOG_SIZE_ENCBASE = 5; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 6; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 6; + static const int REGISTER_ENCBASE = 3; + static const int REGISTER_DELTA_ENCBASE = 2; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 3; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 1; + static const int NUM_EH_CLAUSES_ENCBASE = 2; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; #elif defined(TARGET_LOONGARCH64) #ifndef TARGET_POINTER_SIZE #define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target #endif -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64) -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6) -#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned -#define DENORMALIZE_STACK_SLOT(x) ((x)<<3) -#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long -#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2) -#define NORMALIZE_STACK_BASE_REGISTER(x) ((x) == 22 ? 0 : 1) // Encode Frame pointer fp=$22 as zero -#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x) == 0 ? 22 : 3) -#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3) -#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3) -#define CODE_OFFSETS_NEED_NORMALIZATION 0 -#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point -#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment. -#define NORMALIZE_REGISTER(x) (x) -#define DENORMALIZE_REGISTER(x) (x) -#define NORMALIZE_NUM_SAFE_POINTS(x) (x) -#define DENORMALIZE_NUM_SAFE_POINTS(x) (x) -#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) -#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) - -#define PSP_SYM_STACK_SLOT_ENCBASE 6 -#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6 -#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6 -#define GS_COOKIE_STACK_SLOT_ENCBASE 6 -#define CODE_LENGTH_ENCBASE 8 -#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2 -#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4 -// FP/SP encoded as 0 or 1. -#define STACK_BASE_REGISTER_ENCBASE 2 -#define SIZE_OF_STACK_AREA_ENCBASE 3 -#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4 -#define REVERSE_PINVOKE_FRAME_ENCBASE 6 -#define NUM_REGISTERS_ENCBASE 3 -#define NUM_STACK_SLOTS_ENCBASE 2 -#define NUM_UNTRACKED_SLOTS_ENCBASE 1 -#define NORM_PROLOG_SIZE_ENCBASE 5 -#define NORM_EPILOG_SIZE_ENCBASE 3 -#define NORM_CODE_OFFSET_DELTA_ENCBASE 3 -#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6 -#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6 -#define REGISTER_ENCBASE 3 -#define REGISTER_DELTA_ENCBASE 2 -#define STACK_SLOT_ENCBASE 6 -#define STACK_SLOT_DELTA_ENCBASE 4 -#define NUM_SAFE_POINTS_ENCBASE 3 -#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1 -#define NUM_EH_CLAUSES_ENCBASE 2 -#define POINTER_SIZE_ENCBASE 3 -#define LIVESTATE_RLE_RUN_ENCBASE 2 -#define LIVESTATE_RLE_SKIP_ENCBASE 4 + +#define TargetGcInfoEncoding LoongArch64GcInfoEncoding + +struct LoongArch64GcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + // GC Pointers are 8-bytes aligned + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return ((x)>>3); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return ((x)<<3); } + // All Instructions are 4 bytes long + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)<<2); } + // Encode Frame pointer fp=$22 as zero + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x) == 22 ? 0u : 1u); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x) == 0 ? 22u : 3u); } + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)>>3); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)<<3); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = true; + // Instructions are 4 bytes long + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)<<2); } + + static const int PSP_SYM_STACK_SLOT_ENCBASE = 6; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 6; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 6; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 6; + static const int CODE_LENGTH_ENCBASE = 8; + static const int SIZE_OF_RETURN_KIND_IN_SLIM_HEADER = 2; + static const int SIZE_OF_RETURN_KIND_IN_FAT_HEADER = 4; + // FP/SP encoded as 0 or 1. + static const int STACK_BASE_REGISTER_ENCBASE = 2; + static const int SIZE_OF_STACK_AREA_ENCBASE = 3; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 4; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 6; + static const int NUM_REGISTERS_ENCBASE = 3; + static const int NUM_STACK_SLOTS_ENCBASE = 2; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 1; + static const int NORM_PROLOG_SIZE_ENCBASE = 5; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 6; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 6; + static const int REGISTER_ENCBASE = 3; + static const int REGISTER_DELTA_ENCBASE = 2; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 3; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 1; + static const int NUM_EH_CLAUSES_ENCBASE = 2; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; #elif defined(TARGET_RISCV64) #ifndef TARGET_POINTER_SIZE #define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target #endif -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64) -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6) -#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned -#define DENORMALIZE_STACK_SLOT(x) ((x)<<3) -#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long -#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2) -#define NORMALIZE_STACK_BASE_REGISTER(x) ((x) == 8 ? 0 : 1) // Encode Frame pointer X8 as zero, sp/x2 as 1 -#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x) == 0 ? 8 : 2) -#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3) -#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3) -#define CODE_OFFSETS_NEED_NORMALIZATION 0 -#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point -#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment. -#define NORMALIZE_REGISTER(x) (x) -#define DENORMALIZE_REGISTER(x) (x) -#define NORMALIZE_NUM_SAFE_POINTS(x) (x) -#define DENORMALIZE_NUM_SAFE_POINTS(x) (x) -#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) -#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) - -#define PSP_SYM_STACK_SLOT_ENCBASE 6 -#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6 -#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6 -#define GS_COOKIE_STACK_SLOT_ENCBASE 6 -#define CODE_LENGTH_ENCBASE 8 -#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2 -#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4 -#define STACK_BASE_REGISTER_ENCBASE 2 -// FP encoded as 0, SP as 1 -#define SIZE_OF_STACK_AREA_ENCBASE 3 -#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4 -#define SIZE_OF_EDIT_AND_CONTINUE_FIXED_STACK_FRAME_ENCBASE 4 -#define REVERSE_PINVOKE_FRAME_ENCBASE 6 -#define NUM_REGISTERS_ENCBASE 3 -#define NUM_STACK_SLOTS_ENCBASE 2 -#define NUM_UNTRACKED_SLOTS_ENCBASE 1 -#define NORM_PROLOG_SIZE_ENCBASE 5 -#define NORM_EPILOG_SIZE_ENCBASE 3 -#define NORM_CODE_OFFSET_DELTA_ENCBASE 3 -#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6 -#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6 -#define REGISTER_ENCBASE 3 -#define REGISTER_DELTA_ENCBASE 2 -#define STACK_SLOT_ENCBASE 6 -#define STACK_SLOT_DELTA_ENCBASE 4 -#define NUM_SAFE_POINTS_ENCBASE 3 -#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1 -#define NUM_EH_CLAUSES_ENCBASE 2 -#define POINTER_SIZE_ENCBASE 3 -#define LIVESTATE_RLE_RUN_ENCBASE 2 -#define LIVESTATE_RLE_SKIP_ENCBASE 4 +#define TargetGcInfoEncoding RISCV64GcInfoEncoding + +struct RISCV64GcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + // GC Pointers are 8-bytes aligned + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return ((x)>>3); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return ((x)<<3); } + // All Instructions are 4 bytes long + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return ((x)<<2); } + // Encode Frame pointer X8 as zero, sp/x2 as 1 + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x) == 8 ? 0u : 1u); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return ((x) == 0 ? 8u : 2u); } + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)>>3); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return ((x)<<3); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = true; + // Instructions are 4 bytes long + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)>>2); } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return ((x)<<2); } + + static const int PSP_SYM_STACK_SLOT_ENCBASE = 6; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 6; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 6; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 6; + static const int CODE_LENGTH_ENCBASE = 8; + static const int SIZE_OF_RETURN_KIND_IN_SLIM_HEADER = 2; + static const int SIZE_OF_RETURN_KIND_IN_FAT_HEADER = 4; + static const int STACK_BASE_REGISTER_ENCBASE = 2; + // FP encoded as 0, SP as 1 + static const int SIZE_OF_STACK_AREA_ENCBASE = 3; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 4; + static const int SIZE_OF_EDIT_AND_CONTINUE_FIXED_STACK_FRAME_ENCBASE = 4; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 6; + static const int NUM_REGISTERS_ENCBASE = 3; + static const int NUM_STACK_SLOTS_ENCBASE = 2; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 1; + static const int NORM_PROLOG_SIZE_ENCBASE = 5; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 6; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 6; + static const int REGISTER_ENCBASE = 3; + static const int REGISTER_DELTA_ENCBASE = 2; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 3; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 1; + static const int NUM_EH_CLAUSES_ENCBASE = 2; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; -#else +#else // defined(TARGET_xxx) #ifndef TARGET_X86 #ifdef PORTABILITY_WARNING @@ -898,57 +860,115 @@ PORTABILITY_WARNING("Please specialize these definitions for your platform!") #ifndef TARGET_POINTER_SIZE #define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target #endif -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64) -#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6) -#define NORMALIZE_STACK_SLOT(x) (x) -#define DENORMALIZE_STACK_SLOT(x) (x) -#define NORMALIZE_CODE_LENGTH(x) (x) -#define DENORMALIZE_CODE_LENGTH(x) (x) -#define NORMALIZE_STACK_BASE_REGISTER(x) (x) -#define DENORMALIZE_STACK_BASE_REGISTER(x) (x) -#define NORMALIZE_SIZE_OF_STACK_AREA(x) (x) -#define DENORMALIZE_SIZE_OF_STACK_AREA(x) (x) -#define CODE_OFFSETS_NEED_NORMALIZATION 0 -#define NORMALIZE_CODE_OFFSET(x) (x) -#define DENORMALIZE_CODE_OFFSET(x) (x) -#define NORMALIZE_REGISTER(x) (x) -#define DENORMALIZE_REGISTER(x) (x) -#define NORMALIZE_NUM_SAFE_POINTS(x) (x) -#define DENORMALIZE_NUM_SAFE_POINTS(x) (x) -#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) -#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x) - -#define PSP_SYM_STACK_SLOT_ENCBASE 6 -#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6 -#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6 -#define GS_COOKIE_STACK_SLOT_ENCBASE 6 -#define CODE_LENGTH_ENCBASE 6 -#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2 -#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2 -#define STACK_BASE_REGISTER_ENCBASE 3 -#define SIZE_OF_STACK_AREA_ENCBASE 6 -#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3 -#define REVERSE_PINVOKE_FRAME_ENCBASE 6 -#define NUM_REGISTERS_ENCBASE 3 -#define NUM_STACK_SLOTS_ENCBASE 5 -#define NUM_UNTRACKED_SLOTS_ENCBASE 5 -#define NORM_PROLOG_SIZE_ENCBASE 4 -#define NORM_EPILOG_SIZE_ENCBASE 3 -#define NORM_CODE_OFFSET_DELTA_ENCBASE 3 -#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 5 -#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 5 -#define REGISTER_ENCBASE 3 -#define REGISTER_DELTA_ENCBASE REGISTER_ENCBASE -#define STACK_SLOT_ENCBASE 6 -#define STACK_SLOT_DELTA_ENCBASE 4 -#define NUM_SAFE_POINTS_ENCBASE 4 -#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1 -#define NUM_EH_CLAUSES_ENCBASE 2 -#define POINTER_SIZE_ENCBASE 3 -#define LIVESTATE_RLE_RUN_ENCBASE 2 -#define LIVESTATE_RLE_SKIP_ENCBASE 4 -#endif +#define TargetGcInfoEncoding X86GcInfoEncoding + +struct X86GcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return (x); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return (x); } + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return (x); } + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return (x); } + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return (x); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = false; + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return (x); } + + static const int PSP_SYM_STACK_SLOT_ENCBASE = 6; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 6; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 6; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 6; + static const int CODE_LENGTH_ENCBASE = 6; + static const int SIZE_OF_RETURN_KIND_IN_SLIM_HEADER = 2; + static const int SIZE_OF_RETURN_KIND_IN_FAT_HEADER = 2; + static const int STACK_BASE_REGISTER_ENCBASE = 3; + static const int SIZE_OF_STACK_AREA_ENCBASE = 6; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 3; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 6; + static const int NUM_REGISTERS_ENCBASE = 3; + static const int NUM_STACK_SLOTS_ENCBASE = 5; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 5; + static const int NORM_PROLOG_SIZE_ENCBASE = 4; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 5; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 5; + static const int REGISTER_ENCBASE = 3; + static const int REGISTER_DELTA_ENCBASE = REGISTER_ENCBASE; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 4; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 1; + static const int NUM_EH_CLAUSES_ENCBASE = 2; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; -#endif // !__GCINFOTYPES_H__ +#endif // defined(TARGET_xxx) + +#ifdef FEATURE_INTERPRETER + +struct InterpreterGcInfoEncoding { + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK = (64); + + static const uint32_t NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 = (6); + // Interpreter-FIXME: Interpreter has fixed-size stack slots so we could normalize them based on that. + static inline constexpr int32_t NORMALIZE_STACK_SLOT (int32_t x) { return (x); } + static inline constexpr int32_t DENORMALIZE_STACK_SLOT (int32_t x) { return (x); } + // Interpreter-FIXME: Interpreter has fixed-size opcodes so code length is a multiple of that. + static inline constexpr uint32_t NORMALIZE_CODE_LENGTH (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_CODE_LENGTH (uint32_t x) { return (x); } + + static inline constexpr uint32_t NORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_STACK_BASE_REGISTER (uint32_t x) { return (x); } + // Interpreter-FIXME: Interpreter has fixed-size stack slots so we could normalize them based on that. + static inline constexpr uint32_t NORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_SIZE_OF_STACK_AREA (uint32_t x) { return (x); } + static const bool CODE_OFFSETS_NEED_NORMALIZATION = false; + // Interpreter-FIXME: Interpreter has fixed-size opcodes so code length is a multiple of that. + static inline constexpr uint32_t NORMALIZE_CODE_OFFSET (uint32_t x) { return (x); } + static inline constexpr uint32_t DENORMALIZE_CODE_OFFSET (uint32_t x) { return (x); } + + static const int PSP_SYM_STACK_SLOT_ENCBASE = 6; + static const int GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE = 6; + static const int SECURITY_OBJECT_STACK_SLOT_ENCBASE = 6; + static const int GS_COOKIE_STACK_SLOT_ENCBASE = 6; + static const int CODE_LENGTH_ENCBASE = 8; + static const int STACK_BASE_REGISTER_ENCBASE = 3; + static const int SIZE_OF_STACK_AREA_ENCBASE = 3; + static const int SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE = 4; + // Interpreter-FIXME: This constant is only used on certain architectures. + static const int SIZE_OF_EDIT_AND_CONTINUE_FIXED_STACK_FRAME_ENCBASE = 4; + static const int REVERSE_PINVOKE_FRAME_ENCBASE = 6; + static const int NUM_REGISTERS_ENCBASE = 2; + static const int NUM_STACK_SLOTS_ENCBASE = 2; + static const int NUM_UNTRACKED_SLOTS_ENCBASE = 1; + static const int NORM_PROLOG_SIZE_ENCBASE = 5; + static const int NORM_EPILOG_SIZE_ENCBASE = 3; + static const int NORM_CODE_OFFSET_DELTA_ENCBASE = 3; + static const int INTERRUPTIBLE_RANGE_DELTA1_ENCBASE = 6; + static const int INTERRUPTIBLE_RANGE_DELTA2_ENCBASE = 6; + static const int REGISTER_ENCBASE = 3; + static const int REGISTER_DELTA_ENCBASE = 2; + static const int STACK_SLOT_ENCBASE = 6; + static const int STACK_SLOT_DELTA_ENCBASE = 4; + static const int NUM_SAFE_POINTS_ENCBASE = 2; + static const int NUM_INTERRUPTIBLE_RANGES_ENCBASE = 1; + static const int NUM_EH_CLAUSES_ENCBASE = 2; + static const int POINTER_SIZE_ENCBASE = 3; + static const int LIVESTATE_RLE_RUN_ENCBASE = 2; + static const int LIVESTATE_RLE_SKIP_ENCBASE = 4; +}; + +#endif // FEATURE_INTERPRETER +#ifdef debug_instrumented_return +#define return debug_instrumented_return +#endif // debug_instrumented_return + +#endif // !__GCINFOTYPES_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcmsg.inl b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcmsg.inl index d2461a3cd..d1da723b0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/gcmsg.inl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/gcmsg.inl @@ -41,12 +41,33 @@ return "%d gc thread waiting... Done"; } - static const char* gcDetailedStartMsg() +#define GC_DETAILED_START_PREFIX "*GC* %d(gen0:%d)(%d)" +#define GC_DETAILED_START_STRESSLOG "(alloced for %.3fms, g0 %zd (b: %zd, %zd/h) (%.3fmb/ms), g3 %zd (%.3fmb/ms), g4 %zd (%.3fmb/ms))(%s)(%d)(%d)" +#define GC_DETAILED_START_DPRINTF_EXTRA "(heap size: %.3fmb max: %.3fmb)" + + static const char* gcDetailedStartPrefix() + { + STATIC_CONTRACT_LEAF; + return GC_DETAILED_START_PREFIX; + } + + static const char* gcDetailedStartMsg(bool compatibleWithStressLog) { STATIC_CONTRACT_LEAF; - return "*GC* %d(gen0:%d)(%d)(alloced for %.3fms, g0 %zd (b: %zd, %zd/h) (%.3fmb/ms), g3 %zd (%.3fmb/ms), g4 %zd (%.3fmb/ms))(%s)(%d)(%d)(heap size: %.3fmb max: %.3fmb)"; + if (compatibleWithStressLog) + { + return GC_DETAILED_START_PREFIX GC_DETAILED_START_STRESSLOG; + } + else + { + return GC_DETAILED_START_PREFIX GC_DETAILED_START_STRESSLOG GC_DETAILED_START_DPRINTF_EXTRA; + } } +#undef GC_DETAILED_START_PREFIX +#undef GC_DETAILED_START_STRESSLOG +#undef GC_DETAILED_START_DPRINTF_EXTRA + static const char* gcDetailedEndMsg() { STATIC_CONTRACT_LEAF; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/genheaders.cs b/Procfiler/src/cpp/3rdparty/coreclr/inc/genheaders.cs deleted file mode 100644 index 3a3995493..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/genheaders.cs +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Xml; -using System.Xml.Schema; -using System.IO; - -public class GenerateHeaders { - - public static void Main(string[] args) { - - if (args.Length != 3) { - Console.WriteLine("Usage:genheaders XML-file header-file resource-file"); - return; - } - - ValidateXML(args[0]); - String Message=null; - String SymbolicName=null; - String NumericValue=null; - String tempheaderfile = "temp.h"; - String temprcfile = "temp.rc"; - - StreamWriter HSW=File.CreateText(tempheaderfile); - StreamWriter RSW=File.CreateText(temprcfile); - - int FaciltyUrt=0x13; - int SeveritySuccess=0; - int SeverityError=1; - - int minSR = MakeHresult(SeveritySuccess,FaciltyUrt,0); - int maxSR = MakeHresult(SeveritySuccess,FaciltyUrt,0xffff); - int minHR = MakeHresult(SeverityError,FaciltyUrt,0); - int maxHR = MakeHresult(SeverityError,FaciltyUrt,0xffff); - - PrintLicenseHeader(HSW); - PrintHeader(HSW); - PrintLicenseHeader(RSW); - PrintResourceHeader(RSW); - - XmlTextReader rdr = new XmlTextReader(args[0]); - rdr.WhitespaceHandling = WhitespaceHandling.None; - - while (rdr.Read()) { - - switch (rdr.NodeType) { - - case XmlNodeType.Element: - - if (rdr.Name.ToString() == "HRESULT") { - NumericValue=rdr.GetAttribute("NumericValue"); - } - if (rdr.Name.ToString() == "Message") { - Message = rdr.ReadString(); - } - if (rdr.Name.ToString() == "SymbolicName") { - SymbolicName = rdr.ReadString(); - } - - break; - - case XmlNodeType.EndElement: - if(rdr.Name.ToString() == "HRESULT"){ - - // For CLR Hresult's we take the last 4 digits as the resource strings. - - if ( (NumericValue.StartsWith("0x")) || (NumericValue.StartsWith("0X")) ) { - - String HexResult = NumericValue.Substring(2); - int num = int.Parse(HexResult, System.Globalization.NumberStyles.HexNumber); - - if ((num>minSR) && (num <= maxSR)) { - num = num & 0xffff; - HSW.WriteLine("#define " + SymbolicName + " SMAKEHR(0x" + num.ToString("x") + ")"); - } else if ((num>minHR) && (num <= maxHR)) { - num = num & 0xffff; - HSW.WriteLine("#define " + SymbolicName + " EMAKEHR(0x" + num.ToString("x") + ")"); - } else { - HSW.WriteLine("#define " + SymbolicName + " " + NumericValue ); - } - - - - } else { - HSW.WriteLine("#define " + SymbolicName + " " + NumericValue ); - } - - if (Message != null) { - RSW.Write("\tMSG_FOR_URT_HR(" + SymbolicName + ") "); - RSW.WriteLine(Message); - } - - SymbolicName = null; - NumericValue = null; - Message = null; - } - break; - - } - } - - PrintFooter(HSW); - PrintResourceFooter(RSW); - - HSW.Close(); - RSW.Close(); - - bool AreFilesEqual = false; - - if (File.Exists(args[1])) { - StreamReader sr1 = new StreamReader(tempheaderfile); - StreamReader sr2 = new StreamReader(args[1]); - AreFilesEqual = CompareFiles(sr1, sr2); - sr1.Close(); - sr2.Close(); - } - - if (!AreFilesEqual) { - File.Copy(tempheaderfile, args[1], true); - File.Copy(temprcfile, args[2], true); - } - - if (!File.Exists(args[2])) { - File.Copy(temprcfile, args[2], true); - } - - File.Delete(tempheaderfile); - File.Delete(temprcfile); - } - - private static void ValidateXML (String XMLFile) { - - // Set the validation settings on the XmlReaderSettings object. - XmlReaderSettings settings = new XmlReaderSettings(); - - settings.ValidationType = ValidationType.Schema; - settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema; - - settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack); - - // Create the XmlReader object. - XmlReader reader = XmlReader.Create(XMLFile, settings); - - // Parse the file. - - while (reader.Read()) { - } - } - - // Display any validation errors. - private static void ValidationCallBack(object sender, ValidationEventArgs e) { - Console.WriteLine("Validation Error: {0}", e.Message); - Environment.Exit(-1); - } - - private static void PrintLicenseHeader(StreamWriter SW) { - SW.WriteLine("// Licensed to the .NET Foundation under one or more agreements."); - SW.WriteLine("// The .NET Foundation licenses this file to you under the MIT license."); - SW.WriteLine(); - } - - private static void PrintHeader(StreamWriter SW) { - - SW.WriteLine("#ifndef __COMMON_LANGUAGE_RUNTIME_HRESULTS__"); - SW.WriteLine("#define __COMMON_LANGUAGE_RUNTIME_HRESULTS__"); - SW.WriteLine(); - SW.WriteLine("#include "); - SW.WriteLine(); - SW.WriteLine(); - SW.WriteLine("//"); - SW.WriteLine("//This file is AutoGenerated -- Do Not Edit by hand!!!"); - SW.WriteLine("//"); - SW.WriteLine("//Add new HRESULTS along with their corresponding error messages to"); - SW.WriteLine("//corerror.xml"); - SW.WriteLine("//"); - SW.WriteLine(); - SW.WriteLine("#ifndef FACILITY_URT"); - SW.WriteLine("#define FACILITY_URT 0x13"); - SW.WriteLine("#endif"); - SW.WriteLine("#ifndef EMAKEHR"); - SW.WriteLine("#define SMAKEHR(val) MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_URT, val)"); - SW.WriteLine("#define EMAKEHR(val) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_URT, val)"); - SW.WriteLine("#endif"); - SW.WriteLine(); - } - - private static void PrintFooter(StreamWriter SW) { - SW.WriteLine(); - SW.WriteLine(); - SW.WriteLine("#endif // __COMMON_LANGUAGE_RUNTIME_HRESULTS__"); - } - - private static void PrintResourceHeader(StreamWriter SW) { - SW.WriteLine("STRINGTABLE DISCARDABLE"); - SW.WriteLine("BEGIN"); - } - - private static void PrintResourceFooter(StreamWriter SW) { - SW.WriteLine("END"); - } - - private static bool CompareFiles(StreamReader sr1, StreamReader sr2) { - String line1,line2; - - while (true) { - line1 = sr1.ReadLine(); - line2 = sr2.ReadLine(); - - if ( (line1 == null) && (line2 == null) ) { - return true; - } - - if (line1 != line2) { - return false; - } - - } - - } - - private static int MakeHresult(int sev, int fac, int code) { - return ((sev<<31) | (fac<<16) | (code)); - } -} - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/genrops.pl b/Procfiler/src/cpp/3rdparty/coreclr/inc/genrops.pl deleted file mode 100644 index f90aee281..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/genrops.pl +++ /dev/null @@ -1,90 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# -# GENREFOPS.PL -# -# PERL script used to generate the numbering of the reference opcodes -# -#use strict 'vars'; -#use strict 'subs'; -#use strict 'refs'; - -print "Reference opcodes\n"; -print "This file is presently only for human consumption\n"; -print "This file is generated from opcode.def using the genrops.pl script\n\n"; -print "Name String Name refop encode\n"; -print "-----------------------------------------------------------------\n"; - -my $ret = 0; -my %oneByte; -my %twoByte; -$count = 0; -while (<>) -{ - # Process only OPDEF(....) lines - if (/OPDEF\(\s*/) - { - chop; # Strip off trailing CR - s/^OPDEF\(\s*//; # Strip off "OP(" - s/\)$//; # Strip off ")" at end - s/,\s*/,/g; # Remove whitespace - - # Split the line up into its basic parts - ($enumname, $stringname, $pop, $push, $operand, $type, $size, $s1, $s2, $ctrl) = split(/,/); - $s1 =~ s/0x//; - $s1 = hex($s1); - $s2 =~ s/0x//; - $s2 = hex($s2); - - - my $line = sprintf("%-24s %-24s 0x%03x", - $enumname, $stringname, $count); - if ($size == 1) { - $line .= sprintf(" 0x%02x\n", $s2); - if ($oneByte{$s2}) { - printf("Error opcode 0x%x already defined!\n", $s2); - print " Old = $oneByte{$s2}"; - print " New = $line"; - $ret = -1; - } - $oneByte{$s2} = $line; - } - elsif ($size == 2) { - if ($twoByte{$s2}) { - printf("Error opcode 0x%x 0x%x already defined!\n", $s1, $s2); - print " Old = $twoByte{$s2}"; - print " New = $line"; - $ret = -1; - } - $line .= sprintf(" 0x%02x 0x%02x\n", $s1, $s2); - $twoByte{$s2 + 256 * $s1} = $line; - } - else { - $line .= "\n"; - push(@deprecated, $line); - } - $count++; - } -} - -my $opcode; -my $lastOp = -1; -foreach $opcode (sort {$a <=> $b} keys(%oneByte)) { - printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0); - print $oneByte{$opcode}; - $lastOp = $opcode; -} - -$lastOp = -1; -foreach $opcode (sort {$a <=> $b} keys(%twoByte)) { - printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0); - print $twoByte{$opcode}; - $lastOp = $opcode; -} - -print @deprecated; - -exit($ret); - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/holder.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/holder.h index 6e5532a67..495441026 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/holder.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/holder.h @@ -10,6 +10,7 @@ #include "staticcontract.h" #include "volatile.h" #include "palclr.h" +#include #include #include @@ -143,8 +144,6 @@ class HolderBase }; // class HolderBase<> -#ifndef _PREFAST_ // Work around an ICE error in EspX.dll - template BOOL CompareDefault(TYPE value, TYPE defaultValue) { @@ -152,17 +151,6 @@ BOOL CompareDefault(TYPE value, TYPE defaultValue) return value == defaultValue; } -#else - -template -BOOL CompareDefault(TYPE value, TYPE defaultValue) -{ - return FALSE; -} - -#endif - - template BOOL NoNull(TYPE value, TYPE defaultValue) { @@ -909,8 +897,10 @@ FORCEINLINE void DoTheRelease(TYPE *value) template using DoNothingHolder = SpecializedWrapper<_TYPE, DoNothing<_TYPE*>>; +#ifndef SOS_INCLUDE template using ReleaseHolder = SpecializedWrapper<_TYPE, DoTheRelease<_TYPE>>; +#endif // SOS_INCLUDE template using NonVMComHolder = SpecializedWrapper<_TYPE, DoTheRelease<_TYPE>>; @@ -1112,7 +1102,6 @@ using FieldNuller = SpecializedWrapper<_TYPE, detail::ZeroMem<_TYPE>::Invoke>; FORCEINLINE void VoidCloseHandle(HANDLE h) { if (h != NULL) CloseHandle(h); } // (UINT_PTR) -1 is INVALID_HANDLE_VALUE FORCEINLINE void VoidCloseFileHandle(HANDLE h) { if (h != ((HANDLE)((LONG_PTR) -1))) CloseHandle(h); } -FORCEINLINE void VoidFindClose(HANDLE h) { FindClose(h); } FORCEINLINE void VoidUnmapViewOfFile(void *ptr) { UnmapViewOfFile(ptr); } template @@ -1122,7 +1111,6 @@ FORCEINLINE void TypeUnmapViewOfFile(TYPE *ptr) { UnmapViewOfFile(ptr); } //@TODO: Dangerous default value. Some Win32 functions return INVALID_HANDLE_VALUE, some return NULL (such as CreatEvent). typedef Wrapper, VoidCloseHandle, (UINT_PTR) -1> HandleHolder; typedef Wrapper, VoidCloseFileHandle, (UINT_PTR) -1> FileHandleHolder; -typedef Wrapper, VoidFindClose, (UINT_PTR) -1> FindHandleHolder; typedef Wrapper MapViewHolder; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/hostinformation.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/hostinformation.h index d57b4729d..5a9a62fec 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/hostinformation.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/hostinformation.h @@ -11,6 +11,9 @@ class HostInformation public: static void SetContract(_In_ host_runtime_contract* hostContract); static bool GetProperty(_In_z_ const char* name, SString& value); + + static bool HasExternalProbe(); + static bool ExternalAssemblyProbe(_In_ const SString& path, _Out_ void** data, _Out_ int64_t* size); }; #endif // _HOSTINFORMATION_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/iceefilegen.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/iceefilegen.h index c3dc26f4d..43d92e4f2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/iceefilegen.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/iceefilegen.h @@ -62,10 +62,9 @@ typedef HRESULT (__stdcall * PFN_DestroyICeeFileGen)(ICeeFileGen ** ceeFileGen); #define ICEE_CREATE_MACHINE_MASK 0x0000FF00 // space for up to 256 machine targets (note: most users just do a bit check, not an equality compare after applying the mask) #define ICEE_CREATE_MACHINE_ILLEGAL 0x00000000 // An illegal machine name #define ICEE_CREATE_MACHINE_I386 0x00000100 // Create a IMAGE_FILE_MACHINE_I386 -#define ICEE_CREATE_MACHINE_IA64 0x00000200 // Create a IMAGE_FILE_MACHINE_IA64 -#define ICEE_CREATE_MACHINE_AMD64 0x00000400 // Create a IMAGE_FILE_MACHINE_AMD64 -#define ICEE_CREATE_MACHINE_ARM 0x00000800 // Create a IMAGE_FILE_MACHINE_ARMNT -#define ICEE_CREATE_MACHINE_ARM64 0x00001000 // Create a IMAGE_FILE_MACHINE_ARM64 +#define ICEE_CREATE_MACHINE_AMD64 0x00000200 // Create a IMAGE_FILE_MACHINE_AMD64 +#define ICEE_CREATE_MACHINE_ARM 0x00000400 // Create a IMAGE_FILE_MACHINE_ARMNT +#define ICEE_CREATE_MACHINE_ARM64 0x00000800 // Create a IMAGE_FILE_MACHINE_ARM64 // Pass this to CreateCeeFileEx to create a pure IL Exe or DLL #define ICEE_CREATE_FILE_PURE_IL ICEE_CREATE_FILE_PE32 | \ @@ -150,12 +149,13 @@ class ICeeFileGen { // Emit the metadata from "emitter". // If 'section != 0, it will put the data in 'buffer'. This // buffer is assumed to be in 'section' at 'offset' and of size 'buffLen' - // (should use GetSaveSize to insure that buffer is big enough + // (should use GetSaveSize to ensure that buffer is big enough virtual HRESULT EmitMetaDataAt (HCEEFILE ceeFile, IMetaDataEmit *emitter, HCEESECTION section, DWORD offset, BYTE* buffer, unsigned buffLen); virtual HRESULT GetFileTimeStamp (HCEEFILE ceeFile, DWORD *pTimeStamp); + virtual HRESULT SetFileHeaderTimeStamp(HCEEFILE ceeFile, DWORD timeStamp); virtual HRESULT SetFileAlignment(HCEEFILE ceeFile, ULONG fileAlignment); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/icorjitinfoimpl_generated.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/icorjitinfoimpl_generated.h index 821f2b712..6f4908d9c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/icorjitinfoimpl_generated.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/icorjitinfoimpl_generated.h @@ -99,12 +99,20 @@ CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg) override; +CORINFO_METHOD_HANDLE getInstantiatedEntry( + CORINFO_METHOD_HANDLE ftn, + CORINFO_METHOD_HANDLE* methodArg, + CORINFO_CLASS_HANDLE* classArg) override; + CORINFO_CLASS_HANDLE getDefaultComparerClass( CORINFO_CLASS_HANDLE elemType) override; CORINFO_CLASS_HANDLE getDefaultEqualityComparerClass( CORINFO_CLASS_HANDLE elemType) override; +CORINFO_CLASS_HANDLE getSZArrayHelperEnumeratorClass( + CORINFO_CLASS_HANDLE elemType) override; + void expandRawHandleIntrinsic( CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, @@ -181,6 +189,10 @@ CORINFO_CLASS_HANDLE getTypeInstantiationArgument( CORINFO_CLASS_HANDLE cls, unsigned index) override; +CORINFO_CLASS_HANDLE getMethodInstantiationArgument( + CORINFO_METHOD_HANDLE ftn, + unsigned index) override; + size_t printClassName( CORINFO_CLASS_HANDLE cls, char* buffer, @@ -269,9 +281,6 @@ CorInfoHelpFunc getSharedCCtorHelper( CORINFO_CLASS_HANDLE getTypeForBox( CORINFO_CLASS_HANDLE cls) override; -CORINFO_CLASS_HANDLE getTypeForBoxOnStack( - CORINFO_CLASS_HANDLE cls) override; - CorInfoHelpFunc getBoxHelper( CORINFO_CLASS_HANDLE cls) override; @@ -389,7 +398,7 @@ CORINFO_CLASS_HANDLE getFieldClass( CorInfoType getFieldType( CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE* structType, - CORINFO_CLASS_HANDLE memberParent) override; + CORINFO_CLASS_HANDLE fieldOwnerHint) override; unsigned getFieldOffset( CORINFO_FIELD_HANDLE field) override; @@ -486,7 +495,8 @@ bool runWithSPMIErrorTrap( void getEEInfo( CORINFO_EE_INFO* pEEInfoOut) override; -const char16_t* getJitTimeLogFilename() override; +void getAsyncInfo( + CORINFO_ASYNC_INFO* pAsyncInfoOut) override; mdMethodDef getMethodDefFromMethod( CORINFO_METHOD_HANDLE hMethod) override; @@ -525,9 +535,10 @@ uint32_t getThreadTLSIndex( int32_t* getAddrOfCaptureThreadGlobal( void** ppIndirection) override; -void* getHelperFtn( +void getHelperFtn( CorInfoHelpFunc ftnNum, - void** ppIndirection) override; + CORINFO_CONST_LOOKUP* pNativeEntrypoint, + CORINFO_METHOD_HANDLE* pMethod) override; void getFunctionEntryPoint( CORINFO_METHOD_HANDLE ftn, @@ -539,10 +550,6 @@ void getFunctionFixedEntryPoint( bool isUnsafeFunctionPointer, CORINFO_CONST_LOOKUP* pResult) override; -void* getMethodSync( - CORINFO_METHOD_HANDLE ftn, - void** ppIndirection) override; - CorInfoHelpFunc getLazyStringLiteralHelper( CORINFO_MODULE_HANDLE handle) override; @@ -580,7 +587,7 @@ void* GetCookieForPInvokeCalliSig( CORINFO_SIG_INFO* szMetaSig, void** ppIndirection) override; -bool canGetCookieForPInvokeCalliSig( +void* GetCookieForInterpreterCalliSig( CORINFO_SIG_INFO* szMetaSig) override; CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle( @@ -618,11 +625,9 @@ CORINFO_CLASS_HANDLE getStaticFieldCurrentClass( CORINFO_VARARGS_HANDLE getVarArgsHandle( CORINFO_SIG_INFO* pSig, + CORINFO_METHOD_HANDLE methHnd, void** ppIndirection) override; -bool canGetVarArgsHandle( - CORINFO_SIG_INFO* pSig) override; - InfoAccessType constructStringLiteral( CORINFO_MODULE_HANDLE module, mdToken metaTok, @@ -650,6 +655,8 @@ bool getTailCallHelpers( CORINFO_GET_TAILCALL_HELPERS_FLAGS flags, CORINFO_TAILCALL_HELPERS* pResult) override; +CORINFO_METHOD_HANDLE getAsyncResumptionStub() override; + bool convertPInvokeCalliToCall( CORINFO_RESOLVED_TOKEN* pResolvedToken, bool mustConvert) override; @@ -736,6 +743,9 @@ uint32_t getJitFlags( CORJIT_FLAGS* flags, uint32_t sizeInBytes) override; +CORINFO_METHOD_HANDLE getSpecialCopyHelper( + CORINFO_CLASS_HANDLE type) override; + /**********************************************************************************/ // clang-format on /**********************************************************************************/ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/il_kywd.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/il_kywd.h index 3a3b86a85..8c284460a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/il_kywd.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/il_kywd.h @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // // -// COM+ IL keywords, symbols and values +// CLR IL keywords, symbols and values // // This is the master table used in ILASM (asmparse.y) // and ILDASM (dis.cpp) @@ -109,6 +109,7 @@ KYWD( "noinlining", NOINLINING_, NO_VALUE ) KYWD( "nooptimization", NOOPTIMIZATION_, NO_VALUE ) KYWD( "aggressiveoptimization", AGGRESSIVEOPTIMIZATION_, NO_VALUE ) + KYWD( "async", ASYNC_, NO_VALUE ) KYWD( "nomangle", NOMANGLE_, NO_VALUE ) KYWD( "lasterr", LASTERR_, NO_VALUE ) KYWD( "winapi", WINAPI_, NO_VALUE ) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/jiteeversionguid.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/jiteeversionguid.h index ed55e30de..203f13bb6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/jiteeversionguid.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/jiteeversionguid.h @@ -11,7 +11,7 @@ // the EE changes (by adding or removing methods to any interface shared between them), this GUID should // be changed. This is the identifier verified by ICorJitCompiler::getVersionIdentifier(). // -// You can use "uuidgen.exe -s" to generate this value. +// You can use src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat (or .sh on Unix) to update this file. // // Note that this file is parsed by some tools, namely superpmi.py, so make sure the first line is exactly // of the form: @@ -32,26 +32,16 @@ ////////////////////////////////////////////////////////////////////////////////////////////////////////// // -#ifndef GUID_DEFINED -typedef struct _GUID { - uint32_t Data1; // NOTE: diff from Win32, for LP64 - uint16_t Data2; - uint16_t Data3; - uint8_t Data4[ 8 ]; -} GUID; -typedef const GUID *LPCGUID; -#define GUID_DEFINED -#endif // !GUID_DEFINED +#ifndef JIT_EE_VERSIONING_GUID_H +#define JIT_EE_VERSIONING_GUID_H -constexpr GUID JITEEVersionIdentifier = { /* d6218a78-9a34-4c6f-8db5-077a06022fae */ - 0xd6218a78, - 0x9a34, - 0x4c6f, - {0x8d, 0xb5, 0x07, 0x7a, 0x06, 0x02, 0x2f, 0xae} +#include + +constexpr GUID JITEEVersionIdentifier = { /* 7a8cbc56-9e19-4321-80b9-a0d2c578c945 */ + 0x7a8cbc56, + 0x9e19, + 0x4321, + {0x80, 0xb9, 0xa0, 0xd2, 0xc5, 0x78, 0xc9, 0x45} }; -////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// END JITEEVersionIdentifier -// -////////////////////////////////////////////////////////////////////////////////////////////////////////// +#endif // JIT_EE_VERSIONING_GUID_H diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/jithelpers.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/jithelpers.h index 81d603baa..88396948b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/jithelpers.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/jithelpers.h @@ -23,24 +23,39 @@ #define DYNAMICJITHELPER(code,fn,binderId) JITHELPER(code,fn,binderId) #endif -// pfnHelper is set to NULL if it is a stubbed helper. -// It will be set in InitJITHelpers2 +#ifndef DYNAMICJITHELPER_NOINDIRECT +//I should try to call these methods via a non-indirect call, as those are typically smaller +//and that is an improvement for these dynamic helpers. +#define DYNAMICJITHELPER_NOINDIRECT(code,fn,binderId) DYNAMICJITHELPER(code,fn,binderId) +#endif + +#if defined(TARGET_32BIT) && defined (TARGET_ARM) +#define FEATURE_USE_HELPERS_FOR_32BIT_INT_DIV +#endif + +// pfnHelper is set to NULL if it is an unused helper. JITHELPER(CORINFO_HELP_UNDEF, NULL, METHOD__NIL) // Arithmetic - JITHELPER(CORINFO_HELP_DIV, JIT_Div, METHOD__NIL) - JITHELPER(CORINFO_HELP_MOD, JIT_Mod, METHOD__NIL) - JITHELPER(CORINFO_HELP_UDIV, JIT_UDiv, METHOD__NIL) - JITHELPER(CORINFO_HELP_UMOD, JIT_UMod, METHOD__NIL) +#ifdef FEATURE_USE_HELPERS_FOR_32BIT_INT_DIV + DYNAMICJITHELPER(CORINFO_HELP_DIV, NULL, METHOD__MATH__DIV_INT32) + DYNAMICJITHELPER(CORINFO_HELP_MOD, NULL, METHOD__MATH__MOD_INT32) + DYNAMICJITHELPER(CORINFO_HELP_UDIV, NULL, METHOD__MATH__DIV_UINT32) + DYNAMICJITHELPER(CORINFO_HELP_UMOD, NULL, METHOD__MATH__MOD_UINT32) +#else + JITHELPER(CORINFO_HELP_DIV, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_MOD, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_UDIV, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_UMOD, NULL, METHOD__NIL) +#endif - // CORINFO_HELP_DBL2INT, CORINFO_HELP_DBL2UINT, and CORINFO_HELP_DBL2LONG get - // patched for CPUs that support SSE2 (P4 and above). -#ifndef TARGET_64BIT +#ifdef TARGET_32BIT JITHELPER(CORINFO_HELP_LLSH, JIT_LLsh, METHOD__NIL) JITHELPER(CORINFO_HELP_LRSH, JIT_LRsh, METHOD__NIL) JITHELPER(CORINFO_HELP_LRSZ, JIT_LRsz, METHOD__NIL) -#else // !TARGET_64BIT +#else // TARGET_32BIT + JITHELPER(CORINFO_HELP_LLSH, NULL, METHOD__NIL) JITHELPER(CORINFO_HELP_LRSH, NULL, METHOD__NIL) JITHELPER(CORINFO_HELP_LRSZ, NULL, METHOD__NIL) @@ -49,21 +64,32 @@ #ifndef TARGET_64BIT DYNAMICJITHELPER(CORINFO_HELP_LMUL_OVF, NULL, METHOD__MATH__MULTIPLY_CHECKED_INT64) DYNAMICJITHELPER(CORINFO_HELP_ULMUL_OVF, NULL, METHOD__MATH__MULTIPLY_CHECKED_UINT64) -#else - DYNAMICJITHELPER(CORINFO_HELP_LMUL_OVF, NULL, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ULMUL_OVF, NULL, METHOD__NIL) -#endif // TARGET_64BIT +#if defined(TARGET_X86) && defined(TARGET_WINDOWS) JITHELPER(CORINFO_HELP_LDIV, JIT_LDiv, METHOD__NIL) JITHELPER(CORINFO_HELP_LMOD, JIT_LMod, METHOD__NIL) JITHELPER(CORINFO_HELP_ULDIV, JIT_ULDiv, METHOD__NIL) JITHELPER(CORINFO_HELP_ULMOD, JIT_ULMod, METHOD__NIL) +#else + DYNAMICJITHELPER(CORINFO_HELP_LDIV, NULL, METHOD__MATH__DIV_INT64) + DYNAMICJITHELPER(CORINFO_HELP_LMOD, NULL, METHOD__MATH__MOD_INT64) + DYNAMICJITHELPER(CORINFO_HELP_ULDIV, NULL, METHOD__MATH__DIV_UINT64) + DYNAMICJITHELPER(CORINFO_HELP_ULMOD, NULL, METHOD__MATH__MOD_UINT64) +#endif // TARGET_X86 && TARGET_WINDOWS +#else // TARGET_64BIT + JITHELPER(CORINFO_HELP_LMUL_OVF, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_ULMUL_OVF, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_LDIV, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_LMOD, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_ULDIV, NULL, METHOD__NIL) + JITHELPER(CORINFO_HELP_ULMOD, NULL, METHOD__NIL) +#endif // TARGET_64BIT + JITHELPER(CORINFO_HELP_LNG2FLT, JIT_Lng2Flt, METHOD__NIL) JITHELPER(CORINFO_HELP_LNG2DBL, JIT_Lng2Dbl, METHOD__NIL) + JITHELPER(CORINFO_HELP_ULNG2FLT, JIT_ULng2Flt, METHOD__NIL) JITHELPER(CORINFO_HELP_ULNG2DBL, JIT_ULng2Dbl, METHOD__NIL) - JITHELPER(CORINFO_HELP_DBL2INT, JIT_Dbl2Int, METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_DBL2INT_OVF, NULL, METHOD__MATH__CONVERT_TO_INT32_CHECKED) JITHELPER(CORINFO_HELP_DBL2LNG, JIT_Dbl2Lng, METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_DBL2LNG_OVF, NULL, METHOD__MATH__CONVERT_TO_INT64_CHECKED) - JITHELPER(CORINFO_HELP_DBL2UINT, JIT_Dbl2UInt, METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_DBL2UINT_OVF, NULL, METHOD__MATH__CONVERT_TO_UINT32_CHECKED) JITHELPER(CORINFO_HELP_DBL2ULNG, JIT_Dbl2ULng, METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_DBL2ULNG_OVF, NULL, METHOD__MATH__CONVERT_TO_UINT64_CHECKED) @@ -71,26 +97,26 @@ JITHELPER(CORINFO_HELP_DBLREM, JIT_DblRem, METHOD__NIL) // Allocating a new object - JITHELPER(CORINFO_HELP_NEWFAST, JIT_New, METHOD__NIL) - JITHELPER(CORINFO_HELP_NEWFAST_MAYBEFROZEN, JIT_NewMaybeFrozen,METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST, JIT_New, METHOD__NIL) - JITHELPER(CORINFO_HELP_NEWSFAST_FINALIZE, NULL, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_New, METHOD__NIL) - JITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8_VC, NULL, METHOD__NIL) - JITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8_FINALIZE, NULL, METHOD__NIL) - JITHELPER(CORINFO_HELP_NEW_MDARR, JIT_NewMDArr,METHOD__NIL) - JITHELPER(CORINFO_HELP_NEW_MDARR_RARE, JIT_NewMDArr,METHOD__NIL) - JITHELPER(CORINFO_HELP_NEWARR_1_DIRECT, JIT_NewArr1,METHOD__NIL) - JITHELPER(CORINFO_HELP_NEWARR_1_MAYBEFROZEN, JIT_NewArr1MaybeFrozen,METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1,METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_VC, JIT_NewArr1,METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_ALIGN8, JIT_NewArr1,METHOD__NIL) - - JITHELPER(CORINFO_HELP_STRCNS, JIT_StrCns, METHOD__NIL) + JITHELPER(CORINFO_HELP_NEWFAST, RhpNew, METHOD__NIL) + JITHELPER(CORINFO_HELP_NEWFAST_MAYBEFROZEN, RhpNewMaybeFrozen, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST, RhpNew, METHOD__NIL) + JITHELPER(CORINFO_HELP_NEWSFAST_FINALIZE, NULL, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8, RhpNew, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8_VC, RhpNew, METHOD__NIL) + JITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8_FINALIZE, NULL, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEW_MDARR, NULL, METHOD__ARRAY__CREATEINSTANCEMDARRAY) + DYNAMICJITHELPER(CORINFO_HELP_NEW_MDARR_RARE, NULL, METHOD__ARRAY__CREATEINSTANCEMDARRAY) + JITHELPER(CORINFO_HELP_NEWARR_1_DIRECT, RhpNewVariableSizeObject, METHOD__NIL) + JITHELPER(CORINFO_HELP_NEWARR_1_MAYBEFROZEN, RhpNewArrayMaybeFrozen, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_PTR, RhpNewVariableSizeObject, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_VC, RhpNewVariableSizeObject, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_ALIGN8, RhpNewVariableSizeObject, METHOD__NIL) + + DYNAMICJITHELPER(CORINFO_HELP_STRCNS, NULL, METHOD__STRING__STRCNS) // Object model - JITHELPER(CORINFO_HELP_INITCLASS, JIT_InitClass, METHOD__NIL) - JITHELPER(CORINFO_HELP_INITINSTCLASS, JIT_InitInstantiatedClass, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_INITCLASS, NULL, METHOD__INITHELPERS__INITCLASS) + DYNAMICJITHELPER(CORINFO_HELP_INITINSTCLASS, NULL, METHOD__INITHELPERS__INITINSTANTIATEDCLASS) // Casting helpers DYNAMICJITHELPER(CORINFO_HELP_ISINSTANCEOFINTERFACE, NULL, METHOD__CASTHELPERS__ISINSTANCEOFINTERFACE) @@ -105,29 +131,30 @@ JITHELPER(CORINFO_HELP_ISINSTANCEOF_EXCEPTION, JIT_IsInstanceOfException, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_BOX, JIT_Box, METHOD__NIL) - JITHELPER(CORINFO_HELP_BOX_NULLABLE, JIT_Box, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_UNBOX, NULL, METHOD__CASTHELPERS__UNBOX) - JITHELPER(CORINFO_HELP_UNBOX_TYPETEST, JIT_Unbox_TypeTest, METHOD__NIL) - JITHELPER(CORINFO_HELP_UNBOX_NULLABLE, JIT_Unbox_Nullable, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_BOX, NULL, METHOD__CASTHELPERS__BOX) + DYNAMICJITHELPER(CORINFO_HELP_BOX_NULLABLE, NULL, METHOD__CASTHELPERS__BOX_NULLABLE) + DYNAMICJITHELPER(CORINFO_HELP_UNBOX, NULL, METHOD__CASTHELPERS__UNBOX) + DYNAMICJITHELPER(CORINFO_HELP_UNBOX_TYPETEST, NULL, METHOD__CASTHELPERS__UNBOX_TYPETEST) + DYNAMICJITHELPER(CORINFO_HELP_UNBOX_NULLABLE, NULL, METHOD__CASTHELPERS__UNBOX_NULLABLE) - JITHELPER(CORINFO_HELP_GETREFANY, JIT_GetRefAny, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_GETREFANY, NULL, METHOD__TYPED_REFERENCE__GETREFANY) DYNAMICJITHELPER(CORINFO_HELP_ARRADDR_ST, NULL, METHOD__CASTHELPERS__STELEMREF) DYNAMICJITHELPER(CORINFO_HELP_LDELEMA_REF, NULL, METHOD__CASTHELPERS__LDELEMAREF) // Exceptions DYNAMICJITHELPER(CORINFO_HELP_THROW, IL_Throw, METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_RETHROW, IL_Rethrow, METHOD__NIL) - JITHELPER(CORINFO_HELP_USER_BREAKPOINT, JIT_UserBreakpoint, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_RNGCHKFAIL, NULL, METHOD__THROWHELPERS__THROWINDEXOUTOFRANGEEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_OVERFLOW, NULL, METHOD__THROWHELPERS__THROWOVERFLOWEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROWDIVZERO, NULL, METHOD__THROWHELPERS__THROWDIVIDEBYZEROEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROWNULLREF, NULL, METHOD__THROWHELPERS__THROWNULLREFEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_VERIFICATION, NULL, METHOD__THROWHELPERS__THROWVERIFICATIONEXCEPTION) + DYNAMICJITHELPER(CORINFO_HELP_THROWEXACT, IL_ThrowExact, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_USER_BREAKPOINT, NULL, METHOD__DEBUGGER__USERBREAKPOINT) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_RNGCHKFAIL, NULL, METHOD__THROWHELPERS__THROWINDEXOUTOFRANGEEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_OVERFLOW, NULL, METHOD__THROWHELPERS__THROWOVERFLOWEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROWDIVZERO, NULL, METHOD__THROWHELPERS__THROWDIVIDEBYZEROEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROWNULLREF, NULL, METHOD__THROWHELPERS__THROWNULLREFEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_VERIFICATION, NULL, METHOD__THROWHELPERS__THROWVERIFICATIONEXCEPTION) JITHELPER(CORINFO_HELP_FAIL_FAST, JIT_FailFast, METHOD__NIL) - JITHELPER(CORINFO_HELP_METHOD_ACCESS_EXCEPTION,JIT_ThrowMethodAccessException, METHOD__NIL) - JITHELPER(CORINFO_HELP_FIELD_ACCESS_EXCEPTION,JIT_ThrowFieldAccessException, METHOD__NIL) - JITHELPER(CORINFO_HELP_CLASS_ACCESS_EXCEPTION,JIT_ThrowClassAccessException, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_METHOD_ACCESS_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWMETHODACCESSEXCEPTION) + DYNAMICJITHELPER(CORINFO_HELP_FIELD_ACCESS_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWFIELDACCESSEXCEPTION) + DYNAMICJITHELPER(CORINFO_HELP_CLASS_ACCESS_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWCLASSACCESSEXCEPTION) #ifdef FEATURE_EH_FUNCLETS JITHELPER(CORINFO_HELP_ENDCATCH, NULL, METHOD__NIL) @@ -135,41 +162,47 @@ JITHELPER(CORINFO_HELP_ENDCATCH, JIT_EndCatch, METHOD__NIL) #endif - JITHELPER(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, METHOD__NIL) - JITHELPER(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, METHOD__NIL) - JITHELPER(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,METHOD__NIL) - JITHELPER(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,METHOD__NIL) +// +// The legacy x86 monitor helpers do not need a state argument +// +#if defined(FEATURE_EH_FUNCLETS) + DYNAMICJITHELPER(CORINFO_HELP_MON_ENTER, NULL, METHOD__MONITOR__RELIABLEENTER) + DYNAMICJITHELPER(CORINFO_HELP_MON_EXIT, NULL, METHOD__MONITOR__EXIT_IF_TAKEN) +#else + DYNAMICJITHELPER(CORINFO_HELP_MON_ENTER, NULL, METHOD__MONITOR__ENTER) + DYNAMICJITHELPER(CORINFO_HELP_MON_EXIT, NULL, METHOD__MONITOR__EXIT) +#endif JITHELPER(CORINFO_HELP_GETCLASSFROMMETHODPARAM, JIT_GetClassFromMethodParam, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETSYNCFROMCLASSHANDLE, JIT_GetSyncFromClassHandle, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_GETSYNCFROMCLASSHANDLE, NULL, METHOD__RT_TYPE_HANDLE__GETRUNTIMETYPEFROMHANDLE) // GC support DYNAMICJITHELPER(CORINFO_HELP_STOP_FOR_GC, JIT_RareDisableHelper, METHOD__NIL) - JITHELPER(CORINFO_HELP_POLL_GC, JIT_PollGC, METHOD__NIL) - JITHELPER(CORINFO_HELP_STRESS_GC, JIT_StressGC, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_POLL_GC, JIT_PollGC, METHOD__THREAD__POLLGC) JITHELPER(CORINFO_HELP_CHECK_OBJ, JIT_CheckObj, METHOD__NIL) // GC Write barrier support - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF, JIT_WriteBarrier, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, JIT_CheckedWriteBarrier,METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF, RhpAssignRef, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, RhpCheckedAssignRef,METHOD__NIL) JITHELPER(CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, JIT_WriteBarrierEnsureNonHeapTarget,METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_BYREF, JIT_ByRefWriteBarrier,METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_BYREF, RhpByRefAssignRef,METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_BULK_WRITEBARRIER, NULL, METHOD__BUFFER__MEMCOPYGC) // Accessing fields - JITHELPER(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,METHOD__NIL) - JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR, JIT_GetStaticFieldAddr,METHOD__NIL) - JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_GETFIELDADDR, NULL, METHOD__FIELD_HANDLE__GETFIELDADDR) + DYNAMICJITHELPER(CORINFO_HELP_GETSTATICFIELDADDR, NULL, METHOD__FIELD_HANDLE__GETSTATICFIELDADDR) + JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, METHOD__NIL) + + DYNAMICJITHELPER(CORINFO_HELP_GET_GCSTATIC_BASE, JIT_GetGCStaticBase, METHOD__STATICSHELPERS__GET_GC_STATIC) + DYNAMICJITHELPER(CORINFO_HELP_GET_NONGCSTATIC_BASE, JIT_GetNonGCStaticBase, METHOD__STATICSHELPERS__GET_NONGC_STATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_GCSTATIC_BASE, JIT_GetDynamicGCStaticBase, METHOD__STATICSHELPERS__GET_DYNAMIC_GC_STATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCSTATIC_BASE, JIT_GetDynamicNonGCStaticBase, METHOD__STATICSHELPERS__GET_DYNAMIC_NONGC_STATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETPINNED_GCSTATIC_BASE, JIT_GetDynamicGCStaticBase, METHOD__STATICSHELPERS__GET_DYNAMIC_GC_STATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETPINNED_NONGCSTATIC_BASE, JIT_GetDynamicNonGCStaticBase, METHOD__STATICSHELPERS__GET_DYNAMIC_NONGC_STATIC) - JITHELPER(CORINFO_HELP_GET_GCSTATIC_BASE, JIT_GetGCStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GET_NONGCSTATIC_BASE, JIT_GetNonGCStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_GCSTATIC_BASE, JIT_GetDynamicGCStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCSTATIC_BASE, JIT_GetDynamicNonGCStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETPINNED_GCSTATIC_BASE, JIT_GetDynamicGCStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETPINNED_NONGCSTATIC_BASE, JIT_GetDynamicNonGCStaticBase, METHOD__NIL) JITHELPER(CORINFO_HELP_GET_GCSTATIC_BASE_NOCTOR, JIT_GetGCStaticBaseNoCtor, METHOD__NIL) JITHELPER(CORINFO_HELP_GET_NONGCSTATIC_BASE_NOCTOR, JIT_GetNonGCStaticBaseNoCtor, METHOD__NIL) JITHELPER(CORINFO_HELP_GETDYNAMIC_GCSTATIC_BASE_NOCTOR, JIT_GetDynamicGCStaticBaseNoCtor, METHOD__NIL) @@ -178,17 +211,18 @@ JITHELPER(CORINFO_HELP_GETPINNED_NONGCSTATIC_BASE_NOCTOR,JIT_GetDynamicNonGCStaticBaseNoCtor, METHOD__NIL) // Thread statics - JITHELPER(CORINFO_HELP_GET_GCTHREADSTATIC_BASE, JIT_GetGCThreadStaticBase,METHOD__NIL) - JITHELPER(CORINFO_HELP_GET_NONGCTHREADSTATIC_BASE, JIT_GetNonGCThreadStaticBase,METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE, JIT_GetDynamicGCThreadStaticBase,METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE, JIT_GetDynamicNonGCThreadStaticBase,METHOD__NIL) - JITHELPER(CORINFO_HELP_GET_GCTHREADSTATIC_BASE_NOCTOR, JIT_GetGCThreadStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GET_NONGCTHREADSTATIC_BASE_NOCTOR, JIT_GetNonGCThreadStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR, JIT_GetDynamicGCThreadStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR,JIT_GetDynamicNonGCThreadStaticBase, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED,JIT_GetGCThreadStaticBaseOptimized, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED,JIT_GetNonGCThreadStaticBaseOptimized, METHOD__NIL) - JITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED2,JIT_GetNonGCThreadStaticBaseOptimized2, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_GET_GCTHREADSTATIC_BASE, NULL, METHOD__STATICSHELPERS__GET_GC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GET_NONGCTHREADSTATIC_BASE, NULL, METHOD__STATICSHELPERS__GET_NONGC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE, NULL, METHOD__STATICSHELPERS__GET_DYNAMIC_GC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE, NULL, METHOD__STATICSHELPERS__GET_DYNAMIC_NONGC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GET_GCTHREADSTATIC_BASE_NOCTOR, NULL, METHOD__STATICSHELPERS__GET_GC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GET_NONGCTHREADSTATIC_BASE_NOCTOR, NULL, METHOD__STATICSHELPERS__GET_NONGC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR, NULL, METHOD__STATICSHELPERS__GET_DYNAMIC_GC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR, NULL, METHOD__STATICSHELPERS__GET_DYNAMIC_NONGC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED, NULL, METHOD__STATICSHELPERS__GET_OPTIMIZED_GC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED, NULL, METHOD__STATICSHELPERS__GET_OPTIMIZED_NONGC_THREADSTATIC) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED2, JIT_GetNonGCThreadStaticBaseOptimized2, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED2_NOJITOPT, JIT_GetNonGCThreadStaticBaseOptimized2, METHOD__NIL) // Debugger JITHELPER(CORINFO_HELP_DBG_IS_JUST_MY_CODE, JIT_DbgIsJustMyCode,METHOD__NIL) @@ -199,8 +233,6 @@ DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_TAILCALL, JIT_ProfilerEnterLeaveTailcallStub, METHOD__NIL) // Miscellaneous - JITHELPER(CORINFO_HELP_BBT_FCN_ENTER, JIT_LogMethodEnter,METHOD__NIL) - JITHELPER(CORINFO_HELP_PINVOKE_CALLI, GenericPInvokeCalliHelper, METHOD__NIL) #if defined(TARGET_X86) && !defined(UNIX_X86_ABI) @@ -211,30 +243,24 @@ JITHELPER(CORINFO_HELP_GETCURRENTMANAGEDTHREADID, JIT_GetCurrentManagedThreadId, METHOD__NIL) -#ifdef TARGET_64BIT JITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, JIT_InitPInvokeFrame, METHOD__NIL) -#else - DYNAMICJITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, METHOD__NIL) -#endif - DYNAMICJITHELPER(CORINFO_HELP_MEMSET, NULL, METHOD__SPAN_HELPERS__MEMSET) - DYNAMICJITHELPER(CORINFO_HELP_MEMZERO, NULL, METHOD__SPAN_HELPERS__MEMZERO) - DYNAMICJITHELPER(CORINFO_HELP_MEMCPY, NULL, METHOD__SPAN_HELPERS__MEMCOPY) + DYNAMICJITHELPER(CORINFO_HELP_MEMSET, NULL, METHOD__SPAN_HELPERS__MEMSET) + DYNAMICJITHELPER(CORINFO_HELP_MEMZERO, NULL, METHOD__SPAN_HELPERS__MEMZERO) + DYNAMICJITHELPER(CORINFO_HELP_MEMCPY, NULL, METHOD__SPAN_HELPERS__MEMCOPY) JITHELPER(CORINFO_HELP_NATIVE_MEMSET, Jit_NativeMemSet, METHOD__NIL) // Generics - JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD, JIT_GenericHandleMethod, METHOD__NIL) - JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG,JIT_GenericHandleMethodLogging, METHOD__NIL) - JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS, JIT_GenericHandleClass, METHOD__NIL) - JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, JIT_GenericHandleClassLogging, METHOD__NIL) - JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, JIT_GetRuntimeType, METHOD__NIL) - JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, JIT_GetRuntimeType_MaybeNull, METHOD__NIL) - JITHELPER(CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, JIT_GetRuntimeMethodStub,METHOD__NIL) - JITHELPER(CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, JIT_GetRuntimeFieldStub, METHOD__NIL) - JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE, JIT_GetRuntimeType, METHOD__NIL) - JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_MAYBENULL, JIT_GetRuntimeType_MaybeNull, METHOD__NIL) - - JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR, JIT_VirtualFunctionPointer, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD, NULL, METHOD__GENERICSHELPERS__METHOD) + DYNAMICJITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS, NULL, METHOD__GENERICSHELPERS__CLASS) + DYNAMICJITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, NULL, METHOD__RT_TYPE_HANDLE__GETRUNTIMETYPEFROMHANDLE) + DYNAMICJITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, NULL, METHOD__RT_TYPE_HANDLE__GETRUNTIMETYPEFROMHANDLEMAYBENULL) + DYNAMICJITHELPER(CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, NULL, METHOD__STUBMETHODINFO__FROMPTR) + DYNAMICJITHELPER(CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, NULL, METHOD__STUBFIELDINFO__FROMPTR) + DYNAMICJITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE, NULL, METHOD__RT_TYPE_HANDLE__GETRUNTIMETYPEFROMHANDLE) + DYNAMICJITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_MAYBENULL, NULL, METHOD__RT_TYPE_HANDLE__GETRUNTIMETYPEFROMHANDLEMAYBENULL) + + DYNAMICJITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR, NULL, METHOD__VIRTUALDISPATCHHELPERS__VIRTUALFUNCTIONPOINTER) JITHELPER(CORINFO_HELP_READYTORUN_NEW, NULL, METHOD__NIL) JITHELPER(CORINFO_HELP_READYTORUN_NEWARR_1, NULL, METHOD__NIL) @@ -259,19 +285,19 @@ #endif // !FEATURE_EH_FUNCLETS #ifdef TARGET_X86 - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EAX, JIT_WriteBarrierEAX, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EBX, JIT_WriteBarrierEBX, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_ECX, JIT_WriteBarrierECX, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_ESI, JIT_WriteBarrierESI, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EDI, JIT_WriteBarrierEDI, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EBP, JIT_WriteBarrierEBP, METHOD__NIL) - - JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, JIT_CheckedWriteBarrierEAX, METHOD__NIL) - JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, JIT_CheckedWriteBarrierEBX, METHOD__NIL) - JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, JIT_CheckedWriteBarrierECX, METHOD__NIL) - JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, JIT_CheckedWriteBarrierESI, METHOD__NIL) - JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, JIT_CheckedWriteBarrierEDI, METHOD__NIL) - JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, JIT_CheckedWriteBarrierEBP, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EAX, RhpAssignRefEAX, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EBX, RhpAssignRefEBX, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_ECX, RhpAssignRefECX, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_ESI, RhpAssignRefESI, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EDI, RhpAssignRefEDI, METHOD__NIL) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF_EBP, RhpAssignRefEBP, METHOD__NIL) + + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, RhpCheckedAssignRefEAX, METHOD__NIL) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, RhpCheckedAssignRefEBX, METHOD__NIL) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, RhpCheckedAssignRefECX, METHOD__NIL) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, RhpCheckedAssignRefESI, METHOD__NIL) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, RhpCheckedAssignRefEDI, METHOD__NIL) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, RhpCheckedAssignRefEBP, METHOD__NIL) #else JITHELPER(CORINFO_HELP_ASSIGN_REF_EAX, NULL, METHOD__NIL) JITHELPER(CORINFO_HELP_ASSIGN_REF_EBX, NULL, METHOD__NIL) @@ -291,13 +317,13 @@ JITHELPER(CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, JIT_LoopCloneChoiceAddr, METHOD__NIL) JITHELPER(CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, JIT_DebugLogLoopCloning, METHOD__NIL) - DYNAMICJITHELPER(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, NULL, METHOD__THROWHELPERS__THROWARGUMENTEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, NULL, METHOD__THROWHELPERS__THROWARGUMENTOUTOFRANGEEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROW_NOT_IMPLEMENTED, NULL, METHOD__THROWHELPERS__THROWNOTIMPLEMENTEDEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, NULL, METHOD__THROWHELPERS__THROWPLATFORMNOTSUPPORTEDEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED, NULL, METHOD__THROWHELPERS__THROWTYPENOTSUPPORTED) - DYNAMICJITHELPER(CORINFO_HELP_THROW_AMBIGUOUS_RESOLUTION_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWAMBIGUOUSRESOLUTIONEXCEPTION) - DYNAMICJITHELPER(CORINFO_HELP_THROW_ENTRYPOINT_NOT_FOUND_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWENTRYPOINTNOTFOUNDEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, NULL, METHOD__THROWHELPERS__THROWARGUMENTEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, NULL, METHOD__THROWHELPERS__THROWARGUMENTOUTOFRANGEEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_NOT_IMPLEMENTED, NULL, METHOD__THROWHELPERS__THROWNOTIMPLEMENTEDEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, NULL, METHOD__THROWHELPERS__THROWPLATFORMNOTSUPPORTEDEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED, NULL, METHOD__THROWHELPERS__THROWTYPENOTSUPPORTED) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_AMBIGUOUS_RESOLUTION_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWAMBIGUOUSRESOLUTIONEXCEPTION) + DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_THROW_ENTRYPOINT_NOT_FOUND_EXCEPTION, NULL, METHOD__THROWHELPERS__THROWENTRYPOINTNOTFOUNDEXCEPTION) JITHELPER(CORINFO_HELP_JIT_PINVOKE_BEGIN, JIT_PInvokeBegin, METHOD__NIL) JITHELPER(CORINFO_HELP_JIT_PINVOKE_END, JIT_PInvokeEnd, METHOD__NIL) @@ -316,7 +342,7 @@ #endif JITHELPER(CORINFO_HELP_PATCHPOINT, JIT_Patchpoint, METHOD__NIL) - JITHELPER(CORINFO_HELP_PARTIAL_COMPILATION_PATCHPOINT, JIT_PartialCompilationPatchpoint, METHOD__NIL) + JITHELPER(CORINFO_HELP_PATCHPOINT_FORCED, JIT_PatchpointForced, METHOD__NIL) JITHELPER(CORINFO_HELP_CLASSPROFILE32, JIT_ClassProfile32, METHOD__NIL) JITHELPER(CORINFO_HELP_CLASSPROFILE64, JIT_ClassProfile64, METHOD__NIL) @@ -341,7 +367,11 @@ JITHELPER(CORINFO_HELP_DISPATCH_INDIRECT_CALL, NULL, METHOD__NIL) #endif + DYNAMICJITHELPER(CORINFO_HELP_ALLOC_CONTINUATION, NULL, METHOD__ASYNC_HELPERS__ALLOC_CONTINUATION) + DYNAMICJITHELPER(CORINFO_HELP_ALLOC_CONTINUATION_METHOD, NULL, METHOD__ASYNC_HELPERS__ALLOC_CONTINUATION_METHOD) + DYNAMICJITHELPER(CORINFO_HELP_ALLOC_CONTINUATION_CLASS, NULL, METHOD__ASYNC_HELPERS__ALLOC_CONTINUATION_CLASS) + #undef JITHELPER #undef DYNAMICJITHELPER #undef JITHELPER -#undef DYNAMICJITHELPER +#undef DYNAMICJITHELPER_NOINDIRECT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/loaderheap.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/loaderheap.h index b155d0188..79228c7eb 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/loaderheap.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/loaderheap.h @@ -143,6 +143,7 @@ struct LoaderHeapBlock #endif }; + struct LoaderHeapFreeBlock; // Collection of methods for helping in debugging heap corruptions @@ -157,7 +158,7 @@ struct LoaderHeapEvent; // When an interleaved LoaderHeap is constructed, this is the interleaving size inline UINT32 GetStubCodePageSize() { -#if defined(TARGET_ARM64) && defined(TARGET_UNIX) +#if (defined(TARGET_ARM64) && defined(TARGET_UNIX)) || defined(TARGET_WASM) return max(16*1024u, GetOsPageSize()); #elif defined(TARGET_ARM) return 4096; // ARM is special as the 32bit instruction set does not easily permit a 16KB offset @@ -166,87 +167,96 @@ inline UINT32 GetStubCodePageSize() #endif } +enum class LoaderHeapImplementationKind +{ + Data, + Executable, + Interleaved +}; +class UnlockedLoaderHeapBaseTraversable +{ +protected: +#ifdef DACCESS_COMPILE + UnlockedLoaderHeapBaseTraversable() {} +#else + UnlockedLoaderHeapBaseTraversable() : + m_pFirstBlock(NULL) + { + LIMITED_METHOD_CONTRACT; + } +#endif +public: +#ifdef DACCESS_COMPILE +public: + void EnumMemoryRegions(enum CLRDataEnumMemoryFlags flags); + +typedef bool EnumPageRegionsCallback (PTR_VOID pvArgs, PTR_VOID pvAllocationBase, SIZE_T cbReserved); + void EnumPageRegions (EnumPageRegionsCallback *pCallback, PTR_VOID pvArgs); +#endif + +protected: + // Linked list of ClrVirtualAlloc'd pages + PTR_LoaderHeapBlock m_pFirstBlock; +}; //=============================================================================== -// This is the base class for LoaderHeap and ExplicitControlLoaderHeap. Unfortunately, -// this class has become schizophrenic. Sometimes, it's used as a simple -// allocator that's semantically (but not perfwise!) equivalent to a blackbox -// alloc/free heap. Othertimes, it's used by callers who are actually aware -// of how it reserves addresses and want direct control over the range over which -// this thing allocates. These two types of allocations are handed out -// from two independent pools inside the heap. -// -// The backout strategy we use for the simple heap probably isn't -// directly applicable to the more advanced uses. -// -// We don't have time to refactor this so as a second-best measure, -// we make most of UnlockedLoaderHeap's methods protected and force everyone -// to use it them through two public derived classes that are mutual siblings. -// -// The LoaderHeap is the black-box heap and has a Backout() method but none -// of the advanced features that let you control address ranges. -// -// The ExplicitControlLoaderHeap exposes all the advanced features but -// has no Backout() feature. (If someone wants a backout feature, they need -// to design an appropriate one into this class.) +// This is the base class for LoaderHeap and InterleavedLoaderHeap. It holds the +// common handling for LoaderHeap events, and the data structures used for bump +// pointer allocation (although not the actual allocation routines). //=============================================================================== -class UnlockedLoaderHeap +typedef DPTR(class UnlockedLoaderHeapBase) PTR_UnlockedLoaderHeapBase; +class UnlockedLoaderHeapBase : public UnlockedLoaderHeapBaseTraversable, public ILoaderHeapBackout { #ifdef _DEBUG friend class LoaderHeapSniffer; - friend struct LoaderHeapFreeBlock; #endif - #ifdef DACCESS_COMPILE friend class ClrDataAccess; #endif -public: +protected: + size_t GetBytesAvailCommittedRegion(); - enum class HeapKind - { - Data, - Executable, - Interleaved - }; +#ifndef DACCESS_COMPILE + const +#endif + LoaderHeapImplementationKind m_kind; -private: - // Linked list of ClrVirtualAlloc'd pages - PTR_LoaderHeapBlock m_pFirstBlock; + size_t m_dwTotalAlloc; // Allocation pointer in current block PTR_BYTE m_pAllocPtr; // Points to the end of the committed region in the current block PTR_BYTE m_pPtrToEndOfCommittedRegion; - PTR_BYTE m_pEndReservedRegion; - - // When we need to ClrVirtualAlloc() MEM_RESERVE a new set of pages, number of bytes to reserve - DWORD m_dwReserveBlockSize; - - // When we need to commit pages from our reserved list, number of bytes to commit at a time - DWORD m_dwCommitBlockSize; - - // For interleaved heap (RX pages interleaved with RW ones), this specifies the allocation granularity, - // which is the individual code block size - DWORD m_dwGranularity; - - // Range list to record memory ranges in - RangeList * m_pRangeList; + +public: +#ifdef DACCESS_COMPILE + UnlockedLoaderHeapBase() {} +#else + UnlockedLoaderHeapBase(LoaderHeapImplementationKind kind); + virtual ~UnlockedLoaderHeapBase(); +#endif // DACCESS_COMPILE - size_t m_dwTotalAlloc; + BOOL IsExecutable() { return m_kind == LoaderHeapImplementationKind::Executable || m_kind == LoaderHeapImplementationKind::Interleaved; } + BOOL IsInterleaved() { return m_kind == LoaderHeapImplementationKind::Interleaved; } - HeapKind m_kind; +#ifdef _DEBUG + size_t DebugGetWastedBytes() + { + WRAPPER_NO_CONTRACT; + return m_dwDebugWastedBytes + GetBytesAvailCommittedRegion(); + } - LoaderHeapFreeBlock *m_pFirstFreeBlock; + void DumpFreeList(); - // This is used to hold on to a block of reserved memory provided to the - // constructor. We do this instead of adding it as the first block because - // that requires comitting the first page of the reserved block, and for - // startup working set reasons we want to delay that as long as possible. - LoaderHeapBlock m_reservedBlock; +// Extra CallTracing support + void UnlockedClearEvents(); //Discard saved events + void UnlockedCompactEvents(); //Discard matching alloc/free events + void UnlockedPrintEvents(); //Print event list +#endif public: @@ -265,39 +275,51 @@ class UnlockedLoaderHeap #endif - #ifdef _DEBUG size_t m_dwDebugWastedBytes; static DWORD s_dwNumInstancesOfLoaderHeaps; #endif +}; +//=============================================================================== +// This is the base class for LoaderHeap It's used as a simple +// allocator that's semantically (but not perfwise!) equivalent to a blackbox +// alloc/free heap. The ability to free is via a "backout" mechanism that is +// not considered to have good performance. +// +//=============================================================================== +class UnlockedLoaderHeap : public UnlockedLoaderHeapBase +{ #ifdef _DEBUG - size_t DebugGetWastedBytes() - { - WRAPPER_NO_CONTRACT; - return m_dwDebugWastedBytes + GetBytesAvailCommittedRegion(); - } + friend class LoaderHeapSniffer; #endif - -#ifdef _DEBUG - // Stubs allocated from a LoaderHeap will have unwind info registered with NT. - // The info must be unregistered when the heap is destroyed. - BOOL m_fPermitStubsWithUnwindInfo; - BOOL m_fStubUnwindInfoUnregistered; +#ifdef DACCESS_COMPILE + friend class ClrDataAccess; #endif + friend struct LoaderHeapFreeBlock; public: - BOOL m_fExplicitControl; // Am I a LoaderHeap or an ExplicitControlLoaderHeap? - void (*m_codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size); -#ifdef DACCESS_COMPILE -public: - void EnumMemoryRegions(enum CLRDataEnumMemoryFlags flags); -#endif +private: + // Points to the end of the reserved region for the current block + PTR_BYTE m_pEndReservedRegion; -public: - typedef bool EnumPageRegionsCallback (PTR_VOID pvArgs, PTR_VOID pvAllocationBase, SIZE_T cbReserved); - void EnumPageRegions (EnumPageRegionsCallback *pCallback, PTR_VOID pvArgs); + // When we need to ClrVirtualAlloc() MEM_RESERVE a new set of pages, number of bytes to reserve + DWORD m_dwReserveBlockSize; + + // When we need to commit pages from our reserved list, number of bytes to commit at a time + DWORD m_dwCommitBlockSize; + + // Range list to record memory ranges in + RangeList * m_pRangeList; + + // This is used to hold on to a block of reserved memory provided to the + // constructor. We do this instead of adding it as the first block because + // that requires comitting the first page of the reserved block, and for + // startup working set reasons we want to delay that as long as possible. + LoaderHeapBlock m_reservedBlock; + + LoaderHeapFreeBlock *m_pFirstFreeBlock; #ifndef DACCESS_COMPILE protected: @@ -309,15 +331,12 @@ class UnlockedLoaderHeap const BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, RangeList *pRangeList = NULL, - HeapKind kind = HeapKind::Data, - void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size) = NULL, - DWORD dwGranularity = 1); + LoaderHeapImplementationKind kind = LoaderHeapImplementationKind::Data); - ~UnlockedLoaderHeap(); + virtual ~UnlockedLoaderHeap(); #endif private: - size_t GetBytesAvailCommittedRegion(); size_t GetBytesAvailReservedRegion(); protected: @@ -365,10 +384,6 @@ class UnlockedLoaderHeap #endif ); - - - - protected: // Allocates memory aligned on power-of-2 boundary. // @@ -430,28 +445,252 @@ class UnlockedLoaderHeap return m_dwTotalAlloc; } - BOOL IsExecutable(); - BOOL IsInterleaved(); - size_t AllocMem_TotalSize(size_t dwRequestedSize); - public: #ifdef _DEBUG void DumpFreeList(); #endif +private: + static void ValidateFreeList(UnlockedLoaderHeap *pHeap); + static void WeGotAFaultNowWhat(UnlockedLoaderHeap *pHeap); +}; + +struct InterleavedLoaderHeapConfig +{ + uint32_t StubSize; + void* Template; + void (*CodePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size); + void (*DataPageGenerator)(uint8_t* pageBase, size_t size); +}; + +void InitializeLoaderHeapConfig(InterleavedLoaderHeapConfig *pConfig, size_t stubSize, void* templateInImage, void (*codePageGenerator)(uint8_t* pageBase, uint8_t* pageBaseRX, size_t size), void (*dataPageGenerator)(uint8_t* pageBase, size_t size)); + +//=============================================================================== +// This is the base class for InterleavedLoaderHeap. It's used as a simple +// allocator for stubs in a scheme where each stub is a small fixed size, and is paired +// with memory which is GetStubCodePageSize() bytes away. In addition there is an +// ability to free is via a "backout" mechanism that is not considered to have good performance. +// +//=============================================================================== +class UnlockedInterleavedLoaderHeap : public UnlockedLoaderHeapBase +{ +#ifdef _DEBUG + friend class LoaderHeapSniffer; + friend struct LoaderHeapFreeBlock; +#endif + +#ifdef DACCESS_COMPILE + friend class ClrDataAccess; +#endif public: -// Extra CallTracing support + +private: + PTR_BYTE m_pEndReservedRegion; + + // For interleaved heap (RX pages interleaved with RW ones), this specifies the allocation granularity, + // which is the individual code block size + DWORD m_dwGranularity; + + // Range list to record memory ranges in + RangeList * m_pRangeList; + + struct InterleavedStubFreeListNode + { + InterleavedStubFreeListNode *m_pNext; + }; + + InterleavedStubFreeListNode *m_pFreeListHead; + + const InterleavedLoaderHeapConfig *m_pConfig; + +#ifndef DACCESS_COMPILE +protected: + UnlockedInterleavedLoaderHeap( + RangeList *pRangeList, + const InterleavedLoaderHeapConfig *pConfig); + + virtual ~UnlockedInterleavedLoaderHeap(); +#endif + +private: + size_t GetBytesAvailReservedRegion(); + +protected: + // number of bytes available in region + size_t UnlockedGetReservedBytesFree() + { + LIMITED_METHOD_CONTRACT; + return m_pEndReservedRegion - m_pAllocPtr; + } + + PTR_BYTE UnlockedGetAllocPtr() + { + LIMITED_METHOD_CONTRACT; + return m_pAllocPtr; + } + +private: + // Get some more committed pages - either commit some more in the current reserved region, or, if it + // has run out, reserve another set of pages + BOOL GetMoreCommittedPages(size_t dwMinSize); + + // Commit memory pages starting at the specified adress + BOOL CommitPages(void* pData, size_t dwSizeToCommitPart); + +protected: + // Reserve some pages at any address + BOOL UnlockedReservePages(size_t dwCommitBlockSize); + +protected: + // Allocates memory for a single stub which is a pair of memory addresses + // The first address is the pointer at the stub code, and the second + // address is the data for the stub. These are separated by GetStubCodePageSize() + // bytes. + // + // The return value is a pointer that's guaranteed to be aligned. + // + // Here is how to properly backout the memory: + // + // void *pMem = UnlockedAllocStub(d); + // UnlockedBackoutStub(pMem); + // + // If you use the AllocMemHolder or AllocMemTracker, all this is taken care of + // behind the scenes. + // + // + void *UnlockedAllocStub( #ifdef _DEBUG - void UnlockedClearEvents(); //Discard saved events - void UnlockedCompactEvents(); //Discard matching alloc/free events - void UnlockedPrintEvents(); //Print event list + _In_ _In_z_ const char *szFile + ,int lineNum #endif + ); + + void *UnlockedAllocStub_NoThrow( +#ifdef _DEBUG + _In_ _In_z_ const char *szFile + ,int lineNum +#endif + ); protected: - void *UnlockedAllocMemForCode_NoThrow(size_t dwHeaderSize, size_t dwCodeSize, DWORD dwCodeAlignment, size_t dwReserveForJumpStubs); + // This frees memory allocated by UnlockedAllocStub. It's given this horrible name to emphasize + // that it's purpose is for error path leak prevention purposes. You shouldn't + // use LoaderHeap's as general-purpose alloc-free heaps. + void UnlockedBackoutStub(void *pMem +#ifdef _DEBUG + , _In_ _In_z_ const char *szFile + , int lineNum + , _In_ _In_z_ const char *szAllocFile + , int AllocLineNum +#endif + ); +}; + +//=============================================================================== +// This is the class used for CodeManager allocations. At one point it the logic +// was shared with UnlockedLoaderHeap, but that has been changed. This heap is designed +// to provide an api surface that can be used to control the memory regions where +// allocations occur, and provides an alloc only api surface. +// +// Caller is responsible for synchronization. ExplicitControlLoaderHeap is +// not multithread safe. +//=============================================================================== +typedef DPTR(class ExplicitControlLoaderHeap) PTR_ExplicitControlLoaderHeap; +class ExplicitControlLoaderHeap : public UnlockedLoaderHeapBaseTraversable +{ +#ifdef DACCESS_COMPILE + friend class ClrDataAccess; +#endif + +private: + // Allocation pointer in current block + PTR_BYTE m_pAllocPtr; + + // Points to the end of the committed region in the current block + PTR_BYTE m_pPtrToEndOfCommittedRegion; + PTR_BYTE m_pEndReservedRegion; + + size_t m_dwTotalAlloc; + + // When we need to commit pages from our reserved list, number of bytes to commit at a time + DWORD m_dwCommitBlockSize; + + // Is this an executable heap? + bool m_fExecutableHeap; + + // This is used to hold on to a block of reserved memory provided to the + // constructor. We do this instead of adding it as the first block because + // that requires comitting the first page of the reserved block, and for + // startup working set reasons we want to delay that as long as possible. + LoaderHeapBlock m_reservedBlock; + +public: + +#ifdef _DEBUG + size_t m_dwDebugWastedBytes; + static DWORD s_dwNumInstancesOfLoaderHeaps; +#endif + +#ifdef _DEBUG + size_t DebugGetWastedBytes() + { + WRAPPER_NO_CONTRACT; + return m_dwDebugWastedBytes + GetBytesAvailCommittedRegion(); + } +#endif + +#ifndef DACCESS_COMPILE +public: + ExplicitControlLoaderHeap(bool fMakeExecutable = false); + + ~ExplicitControlLoaderHeap(); +#endif + +private: + size_t GetBytesAvailCommittedRegion(); + size_t GetBytesAvailReservedRegion(); + +public: + // number of bytes available in region + size_t GetReservedBytesFree() + { + LIMITED_METHOD_CONTRACT; + return m_pEndReservedRegion - m_pAllocPtr; + } + + PTR_BYTE GetAllocPtr() + { + LIMITED_METHOD_CONTRACT; + return m_pAllocPtr; + } + +private: + // Get some more committed pages - either commit some more in the current reserved region, or, if it + // has run out, reserve another set of pages + BOOL GetMoreCommittedPages(size_t dwMinSize); + + // Commit memory pages starting at the specified adress + BOOL CommitPages(void* pData, size_t dwSizeToCommitPart); + +public: + // Reserve some pages at any address + BOOL ReservePages(size_t dwCommitBlockSize); + + // Perf Counter reports the size of the heap + size_t GetSize () + { + LIMITED_METHOD_CONTRACT; + return m_dwTotalAlloc; + } + + size_t AllocMem_TotalSize(size_t dwRequestedSize); + +public: - void UnlockedSetReservedRegion(BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, BOOL fReleaseMemory); + void *AllocMemForCode_NoThrow(size_t dwHeaderSize, size_t dwCodeSize, DWORD dwCodeAlignment, size_t dwReserveForJumpStubs); + + void SetReservedRegion(BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, BOOL fReleaseMemory); }; //=============================================================================== @@ -463,11 +702,10 @@ inline CRITSEC_COOKIE CreateLoaderHeapLock() } //=============================================================================== -// The LoaderHeap is the black-box heap and has a Backout() method but none -// of the advanced features that let you control address ranges. +// Thread-safe variant of UnlockedLoaderHeap. //=============================================================================== typedef DPTR(class LoaderHeap) PTR_LoaderHeap; -class LoaderHeap : public UnlockedLoaderHeap, public ILoaderHeapBackout +class LoaderHeap : public UnlockedLoaderHeap { private: CRITSEC_COOKIE m_CriticalSection; @@ -477,22 +715,17 @@ class LoaderHeap : public UnlockedLoaderHeap, public ILoaderHeapBackout LoaderHeap(DWORD dwReserveBlockSize, DWORD dwCommitBlockSize, RangeList *pRangeList = NULL, - UnlockedLoaderHeap::HeapKind kind = UnlockedLoaderHeap::HeapKind::Data, - BOOL fUnlocked = FALSE, - void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size) = NULL, - DWORD dwGranularity = 1 + LoaderHeapImplementationKind kind = LoaderHeapImplementationKind::Data, + BOOL fUnlocked = FALSE ) : UnlockedLoaderHeap(dwReserveBlockSize, dwCommitBlockSize, NULL, 0, pRangeList, - kind, - codePageGenerator, - dwGranularity), + kind), m_CriticalSection(fUnlocked ? NULL : CreateLoaderHeapLock()) { WRAPPER_NO_CONTRACT; - m_fExplicitControl = FALSE; } public: @@ -501,22 +734,18 @@ class LoaderHeap : public UnlockedLoaderHeap, public ILoaderHeapBackout const BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, RangeList *pRangeList = NULL, - UnlockedLoaderHeap::HeapKind kind = UnlockedLoaderHeap::HeapKind::Data, - BOOL fUnlocked = FALSE, - void (*codePageGenerator)(BYTE* pageBase, BYTE* pageBaseRX, SIZE_T size) = NULL, - DWORD dwGranularity = 1 + LoaderHeapImplementationKind kind = LoaderHeapImplementationKind::Data, + BOOL fUnlocked = FALSE ) : UnlockedLoaderHeap(dwReserveBlockSize, dwCommitBlockSize, dwReservedRegionAddress, dwReservedRegionSize, pRangeList, - kind, - codePageGenerator, dwGranularity), + kind), m_CriticalSection(fUnlocked ? NULL : CreateLoaderHeapLock()) { WRAPPER_NO_CONTRACT; - m_fExplicitControl = FALSE; } #endif // DACCESS_COMPILE @@ -742,7 +971,7 @@ class LoaderHeap : public UnlockedLoaderHeap, public ILoaderHeapBackout public: - // This frees memory allocated by AllocMem. It's given this horrible name to emphasize + // This frees memory allocated by RealAllocMem. It's given this horrible name to emphasize // that it's purpose is for error path leak prevention purposes. You shouldn't // use LoaderHeap's as general-purpose alloc-free heaps. void RealBackoutMem(void *pMem @@ -796,112 +1025,137 @@ class LoaderHeap : public UnlockedLoaderHeap, public ILoaderHeapBackout }; - - +#ifdef _DEBUG +#define AllocStub() RealAllocStub(__FILE__, __LINE__) +#else +#define AllocStub() RealAllocStub() +#endif //=============================================================================== -// The ExplicitControlLoaderHeap exposes all the advanced features but -// has no Backout() feature. (If someone wants a backout feature, they need -// to design an appropriate one into this class.) -// -// Caller is responsible for synchronization. ExplicitControlLoaderHeap is -// not multithread safe. +// Thread-safe variant of UnlockedInterleavedLoaderHeap. //=============================================================================== -typedef DPTR(class ExplicitControlLoaderHeap) PTR_ExplicitControlLoaderHeap; -class ExplicitControlLoaderHeap : public UnlockedLoaderHeap +typedef DPTR(class InterleavedLoaderHeap) PTR_InterleavedLoaderHeap; +class InterleavedLoaderHeap : public UnlockedInterleavedLoaderHeap { +private: + CRITSEC_COOKIE m_CriticalSection; + #ifndef DACCESS_COMPILE public: - ExplicitControlLoaderHeap(RangeList *pRangeList = NULL, - BOOL fMakeExecutable = FALSE + InterleavedLoaderHeap(RangeList *pRangeList, + BOOL fUnlocked, + const InterleavedLoaderHeapConfig *pConfig ) - : UnlockedLoaderHeap(0, 0, NULL, 0, + : UnlockedInterleavedLoaderHeap( pRangeList, - fMakeExecutable ? UnlockedLoaderHeap::HeapKind::Executable : UnlockedLoaderHeap::HeapKind::Data) + pConfig), + m_CriticalSection(fUnlocked ? NULL : CreateLoaderHeapLock()) { WRAPPER_NO_CONTRACT; - m_fExplicitControl = TRUE; } + #endif // DACCESS_COMPILE -public: - void *RealAllocMem(size_t dwSize -#ifdef _DEBUG - ,_In_ _In_z_ const char *szFile - ,int lineNum -#endif - ) + virtual ~InterleavedLoaderHeap() { WRAPPER_NO_CONTRACT; - void *pResult; - - pResult = UnlockedAllocMem(dwSize -#ifdef _DEBUG - , szFile - , lineNum -#endif - ); - return pResult; +#ifndef DACCESS_COMPILE + if (m_CriticalSection != NULL) + { + ClrDeleteCriticalSection(m_CriticalSection); + } +#endif // DACCESS_COMPILE } - void *RealAllocMem_NoThrow(size_t dwSize +public: + TaggedMemAllocPtr RealAllocStub( #ifdef _DEBUG - ,_In_ _In_z_ const char *szFile - ,int lineNum + _In_ _In_z_ const char *szFile + ,int lineNum #endif - ) + ) { WRAPPER_NO_CONTRACT; + CRITSEC_Holder csh(m_CriticalSection); + + + TaggedMemAllocPtr tmap; void *pResult; - pResult = UnlockedAllocMem_NoThrow(dwSize + pResult = UnlockedAllocStub( #ifdef _DEBUG - , szFile - , lineNum + szFile + ,lineNum #endif - ); - return pResult; - } + ); + tmap.m_pMem = pResult; + tmap.m_dwRequestedSize = 1; + tmap.m_pHeap = this; + tmap.m_dwExtra = 0; +#ifdef _DEBUG + tmap.m_szFile = szFile; + tmap.m_lineNum = lineNum; +#endif -public: - void *AllocMemForCode_NoThrow(size_t dwHeaderSize, size_t dwCodeSize, DWORD dwCodeAlignment, size_t dwReserveForJumpStubs) - { - WRAPPER_NO_CONTRACT; - return UnlockedAllocMemForCode_NoThrow(dwHeaderSize, dwCodeSize, dwCodeAlignment, dwReserveForJumpStubs); + return tmap; } - void SetReservedRegion(BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, BOOL fReleaseMemory) + +public: + // This frees memory allocated by RealAllocStub. It's given this horrible name to emphasize + // that it's purpose is for error path leak prevention purposes. You shouldn't + // use LoaderHeap's as general-purpose alloc-free heaps. + void RealBackoutMem(void *pMem + , size_t dwSize +#ifdef _DEBUG + , _In_ _In_z_ const char *szFile + , int lineNum + , _In_ _In_z_ const char *szAllocFile + , int allocLineNum +#endif + ) { WRAPPER_NO_CONTRACT; - return UnlockedSetReservedRegion(dwReservedRegionAddress, dwReservedRegionSize, fReleaseMemory); + CRITSEC_Holder csh(m_CriticalSection); + UnlockedBackoutStub(pMem +#ifdef _DEBUG + , szFile + , lineNum + , szAllocFile + , allocLineNum +#endif + ); } public: - // number of bytes available in region - size_t GetReservedBytesFree() +// Extra CallTracing support +#ifdef _DEBUG + void ClearEvents() { WRAPPER_NO_CONTRACT; - return UnlockedGetReservedBytesFree(); + CRITSEC_Holder csh(m_CriticalSection); + UnlockedClearEvents(); } - PTR_BYTE GetAllocPtr() + void CompactEvents() { WRAPPER_NO_CONTRACT; - return UnlockedGetAllocPtr(); + CRITSEC_Holder csh(m_CriticalSection); + UnlockedCompactEvents(); } - void ReservePages(size_t size) + void PrintEvents() { WRAPPER_NO_CONTRACT; - UnlockedReservePages(size); + CRITSEC_Holder csh(m_CriticalSection); + UnlockedPrintEvents(); } +#endif }; - - //============================================================================== // AllocMemHolder : Allocated memory from LoaderHeap // @@ -1116,14 +1370,11 @@ class AllocMemTracker AllocMemTrackerNode m_Node[kAllocMemTrackerBlockSize]; }; - AllocMemTrackerBlock *m_pFirstBlock; AllocMemTrackerBlock m_FirstBlock; // Stack-allocate the first block - "new" the rest. protected: BOOL m_fReleased; - }; #endif // __LoaderHeap_h__ - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/longfilepathwrappers.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/longfilepathwrappers.h index 640768090..88c22095d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/longfilepathwrappers.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/longfilepathwrappers.h @@ -25,18 +25,6 @@ CreateFileWrapper( _In_opt_ HANDLE hTemplateFile ); -DWORD -GetFileAttributesWrapper( - _In_ LPCWSTR lpFileName - ); - -BOOL -GetFileAttributesExWrapper( - _In_ LPCWSTR lpFileName, - _In_ GET_FILEEX_INFO_LEVELS fInfoLevelId, - _Out_writes_bytes_(sizeof(WIN32_FILE_ATTRIBUTE_DATA)) LPVOID lpFileInformation - ); - BOOL CopyFileExWrapper( _In_ LPCWSTR lpExistingFileName, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/mdfileformat.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/mdfileformat.h index 4c07670b0..594957a88 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/mdfileformat.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/mdfileformat.h @@ -36,13 +36,6 @@ #define FILE_VER_MAJOR 1 #define FILE_VER_MINOR 1 -// These are the last legitimate 0.x version macros. The file format has -// sinced move up to 1.x (see macros above). After COM+ 1.0/NT 5 RTM's, these -// macros should no longer be required or ever seen. -#define FILE_VER_MAJOR_v0 0 - -#define FILE_VER_MINOR_v0 19 - #define MAXSTREAMNAME 32 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/metadata.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/metadata.h index 65ac90742..4fe9f5dd2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/metadata.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/metadata.h @@ -464,7 +464,7 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) STDMETHOD(FindMethodDef)( mdTypeDef classdef, // [IN] given typedef LPCSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob mdMethodDef *pmd) PURE; // [OUT] matching memberdef @@ -507,7 +507,7 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) __checkReturn STDMETHOD(GetNameAndSigOfMethodDef)( mdMethodDef methoddef, // [IN] given memberdef - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to a blob value of CLR signature + PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to a blob value of signature ULONG *pcbSigBlob, // [OUT] count of bytes in the signature blob LPCSTR *pszName) PURE; @@ -679,7 +679,7 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) __checkReturn STDMETHOD(GetNameAndSigOfMemberRef)( // return name here mdMemberRef memberref, // given memberref - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to a blob value of CLR signature + PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to a blob value of signature ULONG *pcbSigBlob, // [OUT] count of bytes in the signature blob LPCSTR *pszName) PURE; @@ -838,7 +838,7 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) STDMETHOD(ConvertTextSigToComSig)( // Return hresult. BOOL fCreateTrIfNotFound, // [IN] create typeref if not found LPCSTR pSignature, // [IN] class file format signature - CQuickBytes *pqbNewSig, // [OUT] place holder for CLR signature + CQuickBytes *pqbNewSig, // [OUT] place holder for signature ULONG *pcbCount) PURE; // [OUT] the result size of signature //***************************************************************************** @@ -966,7 +966,7 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) STDMETHOD(FindMethodDefUsingCompare)( mdTypeDef classdef, // [IN] given typedef LPCSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature + PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of signature ULONG cbSigBlob, // [IN] count of bytes in the signature blob PSIGCOMPARE pSignatureCompare, // [IN] Routine to compare signatures void* pSignatureArgs, // [IN] Additional info to supply the compare function @@ -1035,7 +1035,6 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) mdToken *tkEnclosedToken) PURE; // [OUT] The enclosed type token #define MD_STREAM_VER_1X 0x10000 -#define MD_STREAM_VER_2_B1 0x10001 #define MD_STREAM_VER_2 0x20000 STDMETHOD_(DWORD, GetMetadataStreamVersion)() PURE; //returns DWORD with major version of // MD stream in senior word and minor version--in junior word @@ -1046,30 +1045,6 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown) LPCUTF8 *pszNamespace, // [OUT] Namespace of Custom Attribute. LPCUTF8 *pszName) PURE; // [OUT] Name of Custom Attribute. - STDMETHOD(SetOptimizeAccessForSpeed)(// S_OK or error - BOOL fOptSpeed) PURE; - - STDMETHOD(SetVerifiedByTrustedSource)(// S_OK or error - BOOL fVerified) PURE; - - STDMETHOD(GetRvaOffsetData)( - DWORD *pFirstMethodRvaOffset, // [OUT] Offset (from start of metadata) to the first RVA field in MethodDef table. - DWORD *pMethodDefRecordSize, // [OUT] Size of each record in MethodDef table. - DWORD *pMethodDefCount, // [OUT] Number of records in MethodDef table. - DWORD *pFirstFieldRvaOffset, // [OUT] Offset (from start of metadata) to the first RVA field in FieldRVA table. - DWORD *pFieldRvaRecordSize, // [OUT] Size of each record in FieldRVA table. - DWORD *pFieldRvaCount // [OUT] Number of records in FieldRVA table. - ) PURE; - - //---------------------------------------------------------------------------------------- - // !!! READ THIS !!! - // - // New methods have to be added at the end. The order and signatures of the existing methods - // have to be preserved. We need to maintain a backward compatibility for this interface to - // allow ildasm to work on SingleCLR. - // - //---------------------------------------------------------------------------------------- - }; // IMDInternalImport diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/metadataexports.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/metadataexports.h deleted file mode 100644 index 5c0031851..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/metadataexports.h +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -//***************************************************************************** -// MDCommon.h -// - -// -// Header for functions exported by metadata. These are consumed 2 ways: -// 1. Mscoree provides public exports that plumb to some of these functions to invoke these dynamically. -// 2. Standalone metadata (statically linked) -// -//***************************************************************************** - - -#ifndef _METADATA_EXPORTS_ -#define _METADATA_EXPORTS_ - - - -// General creation function for ClassFactory semantics. -STDAPI MetaDataDllGetClassObject(REFCLSID rclsid, REFIID riid, void ** ppv); - -// Specific creation function to get IMetaDataDispenser(Ex) interface. -HRESULT InternalCreateMetaDataDispenser(REFIID riid, void ** pMetaDataDispenserOut); - -STDAPI GetMDInternalInterface( - LPVOID pData, - ULONG cbData, - DWORD flags, // [IN] MDInternal_OpenForRead or MDInternal_OpenForENC - REFIID riid, // [in] The interface desired. - void **ppIUnk); // [out] Return interface on success. - -STDAPI GetMDInternalInterfaceFromPublic( - IUnknown *pIUnkPublic, // [IN] Given scope. - REFIID riid, // [in] The interface desired. - void **ppIUnkInternal); // [out] Return interface on success. - -STDAPI GetMDPublicInterfaceFromInternal( - void *pIUnkPublic, // [IN] Given scope. - REFIID riid, // [in] The interface desired. - void **ppIUnkInternal); // [out] Return interface on success. - -STDAPI MDReOpenMetaDataWithMemory( - void *pImport, // [IN] Given scope. public interfaces - LPCVOID pData, // [in] Location of scope data. - ULONG cbData); // [in] Size of the data pointed to by pData. - -STDAPI MDReOpenMetaDataWithMemoryEx( - void *pImport, // [IN] Given scope. public interfaces - LPCVOID pData, // [in] Location of scope data. - ULONG cbData, // [in] Size of the data pointed to by pData. - DWORD dwReOpenFlags); // [in] ReOpen flags - - - -#endif // _METADATA_EXPORTS_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/metahost.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/metahost.idl index 5bc51f6d1..27c6e9a5c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/metahost.idl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/metahost.idl @@ -60,6 +60,9 @@ cpp_quote("EXTERN_GUID(IID_ICLRDebuggingLibraryProvider, 0x3151c08d, 0x4d09, 0x4 // IID ICLRDebuggingLibraryProvider2 interface : uuid{E04E2FF1-DCFD-45D5-BCD1-16FFF2FAF7BA} cpp_quote("EXTERN_GUID(IID_ICLRDebuggingLibraryProvider2, 0xE04E2FF1, 0xDCFD, 0x45D5, 0xBC, 0xD1, 0x16, 0xFF, 0xF2, 0xFA, 0xF7, 0xBA);") +// IID ICLRDebuggingLibraryProvider3 interface : uuid{DE3AAB18-46A0-48B4-BF0D-2C336E69EA1B} +cpp_quote("EXTERN_GUID(IID_ICLRDebuggingLibraryProvider3, 0xde3aab18, 0x46a0, 0x48b4, 0xbf, 0xd, 0x2c, 0x33, 0x6e, 0x69, 0xea, 0x1b);") + // For use in ICLRMetaHost::RequestRuntimeLoadedNotification interface ICLRRuntimeInfo; @@ -71,6 +74,13 @@ typedef void (__stdcall *RuntimeLoadedCallbackFnPtr)( CallbackThreadSetFnPtr pfnCallbackThreadSet, CallbackThreadUnsetFnPtr pfnCallbackThreadUnset); +typedef enum +{ + UnknownIndex = 0, + Identity = 1, + Runtime = 2, +} LIBRARY_PROVIDER_INDEX_TYPE; + /************************************************************************************** ** ICLRMetaHost ** ** Activated using mscoree!CLRCreateInstance. Does not do any policy decisions, get ** @@ -290,6 +300,104 @@ interface ICLRDebuggingLibraryProvider2 : IUnknown [out] LPWSTR* ppResolvedModulePath); } + /************************************************************************************** + ** ICLRDebuggingLibraryProvider3 ** + ** Implemented by API user ** + ** This interface allows the debugger to provide module paths which are needed for ** + ** debugging a particular CLR such as mscordbi and mscordacwks. ** + **************************************************************************************/ +[ + uuid(DE3AAB18-46A0-48B4-BF0D-2C336E69EA1B), + version(1.0), + helpstring("CLR debugging LibraryProvider callback interface"), + local +] +interface ICLRDebuggingLibraryProvider3 : IUnknown +{ + /********************************************************************************** + ** The goal of this method is to allow the debugger to provide a module path ** + ** which is needed for debugging. The debugger may use any available means to ** + ** locate and/or procure the module. See the security note below for important ** + ** information about implementing this method securely. ** + ** Arguments: ** + ** pwzFileName - The name of the module being requested ** + ** ** + ** pwszRuntimeModule - The runtime module path or the module path of the ** + ** single-file app. NULL when called from the ** + ** OpenVirtualProcess API. ** + ** ** + ** indexType - The type of time stamp/file size is either the identity of the ** + ** requested module or the runtime (coreclr) module's. ** + ** ** + ** dwTimeStamp - The date time stamp stored in the COFF file header of PE files ** + ** ** + ** dwSizeOfImage - The SizeOfImage field stored in the COFF optional file header ** + ** of PE files ** + ** ** + ** ppResolvedModulePath - Where *ppResolvedModulePath is a null terminated ** + ** path to the module dll. On Windows it should be ** + ** allocated with CoTaskMemAlloc. On Unix it should be ** + ** allocated with malloc. Failure leave it untouched. See ** + ** security note below! ** + ** ** + ** Return value - S_OK if the module was provided, or any other convenient ** + ** error HRESULT if the module could not be provided ** + ** ** + ** !!!!!!!!!!!!!! ** + ** SECURITY NOTE: Anything the caller would not be willing to execute itself, it ** + ** should not provide to the this API call ** + ***********************************************************************************/ + HRESULT ProvideWindowsLibrary( + [in] const WCHAR* pwszFileName, + [in] const WCHAR* pwszRuntimeModule, + [in] LIBRARY_PROVIDER_INDEX_TYPE indexType, + [in] DWORD dwTimestamp, + [in] DWORD dwSizeOfImage, + [out] LPWSTR* ppResolvedModulePath); + + /********************************************************************************** + ** The goal of this method is to allow the debugger to provide a module path ** + ** which is needed for debugging. The debugger may use any available means to ** + ** locate and/or procure the module. See the security note below for important ** + ** information about implementing this method securely. ** + ** Arguments: ** + ** pwszFileName - The name of the module being requested ** + ** ** + ** pwszRuntimeModule - The runtime module path or the module path of the ** + ** single-file app. NULL when called from the ** + ** OpenVirtualProcess API. ** + ** ** + ** indexType - The type of the build id either the identity of the requested ** + ** module or the runtime (coreclr) module's. Normally it will ** + ** be the identity index type and the runtime index for Linux ** + ** cross-DAC on Windows or for non-singlefile apps on Linux/MacOS. ** + ** ** + ** pbBuildId - The Linux or MacOS module build id ** + ** ** + ** iBuildIdSize - The number of bytes in the build id ** + ** ** + ** ppResolvedModulePath - Where *ppResolvedModulePath is a null terminated ** + ** path to the module dll. On Windows it should be ** + ** allocated with CoTaskMemAlloc. On Unix it should be ** + ** allocated with malloc. Failure leave it untouched. See ** + ** security note below! ** + ** ** + ** Return value - S_OK if the module was provided, or any other convenient ** + ** error HRESULT if the module could not be provided ** + ** ** + ** !!!!!!!!!!!!!! ** + ** SECURITY NOTE: Anything the caller would not be willing to execute itself, it ** + ** should not provide to the this API call ** + ***********************************************************************************/ + HRESULT ProvideUnixLibrary( + [in] const WCHAR* pwszFileName, + [in] const WCHAR* pwszRuntimeModule, + [in] LIBRARY_PROVIDER_INDEX_TYPE indexType, + [in] BYTE* pbBuildId, + [in] int iBuildIdSize, + [out] LPWSTR* ppResolvedModulePath); +} + /************************************************************************************** ** ICLRDebugging ** ** Activated using mscoree!CLRCreateInstance. ** diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/mscoree.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/mscoree.idl index 1a5124ffb..1b8e414b8 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/mscoree.idl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/mscoree.idl @@ -36,58 +36,18 @@ cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0 typedef HRESULT (__stdcall *FExecuteInAppDomainCallback) (void* cookie); -// By default GC is concurrent and only the base system library is loaded into the domain-neutral area. typedef enum { STARTUP_CONCURRENT_GC = 0x1, - STARTUP_LOADER_OPTIMIZATION_MASK = 0x3<<1, // loader optimization mask - STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = 0x1<<1, // no domain neutral loading - STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = 0x2<<1, // all domain neutral loading - STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = 0x3<<1, // strong name domain neutral loading - - - STARTUP_LOADER_SAFEMODE = 0x10, // Do not apply runtime version policy to the version passed in - STARTUP_LOADER_SETPREFERENCE = 0x100, // Set preferred runtime. Do not actally start it - STARTUP_SERVER_GC = 0x1000, // Use server GC STARTUP_HOARD_GC_VM = 0x2000, // GC keeps virtual address used - STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000, // Disallow mixing hosting interface - STARTUP_LEGACY_IMPERSONATION = 0x10000, // Do not flow impersonation across async points by default - STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000, // Don't eagerly commit thread stack - STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000, // Force flow impersonation across async points - // (impersonations achieved thru p/invoke and managed will flow. - // default is to flow only managed impersonation) - STARTUP_TRIM_GC_COMMIT = 0x80000, // GC uses less committed space when system memory low - STARTUP_ETW = 0x100000, - STARTUP_ARM = 0x400000, // Enable the ARM feature. - STARTUP_SINGLE_APPDOMAIN = 0x800000, // application runs in default domain, no more domains are created - STARTUP_APPX_APP_MODEL = 0x1000000, // jupiter app - STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000 // Disable the randomized string hashing (not supported) } STARTUP_FLAGS; typedef enum { - APPDOMAIN_SECURITY_DEFAULT =0x0, - APPDOMAIN_SECURITY_SANDBOXED = 0x1, // appdomain is sandboxed - APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2, // no cross ad reverse pinvokes - APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4, // APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x08, // do not pump messages during wait operations, do not call sync context - // When passed by the host, this flag will allow any assembly to perform PInvoke or COMInterop operations. - // Otherwise, by default, only platform assemblies can perform those operations. - APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10, - - APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40, - APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80, - - APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100, } APPDOMAIN_SECURITY_FLAGS; -typedef enum { - WAIT_MSGPUMP = 0x1, - WAIT_ALERTABLE = 0x2, - WAIT_NOTINDEADLOCK = 0x4 -}WAIT_OPTION; - typedef enum { // Default to minidump DUMP_FLAVOR_Mini = 0, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/new.hpp b/Procfiler/src/cpp/3rdparty/coreclr/inc/new.hpp deleted file mode 100644 index 09eec5d1f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/new.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// - -#ifndef __new__hpp -#define __new__hpp - -#if defined(_MSC_VER) && _MSC_VER < 1900 -#define NOEXCEPT -#else -#define NOEXCEPT noexcept -#endif - -struct NoThrow { int x; }; -extern const NoThrow nothrow; - -void * __cdecl operator new(size_t n, const NoThrow&) NOEXCEPT; -void * __cdecl operator new[](size_t n, const NoThrow&) NOEXCEPT; - -#ifdef _DEBUG -void DisableThrowCheck(); -#endif - -#endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblemapmacros.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblemapmacros.h index b9da5b39f..75279f296 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblemapmacros.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblemapmacros.h @@ -17,12 +17,71 @@ // Because we cannot guarantee that jitblocks always start at // multiples of 32 bytes we cannot use a simple bitmap; instead we // use a nibble (4 bit) per bucket and encode the offset of the header -// inside the bucket (in DWORDS). In order to make initialization +// inside the bucket (in DWORDS). Each 32-bit DWORD represents 256 bytes +// in the mapped code region. In order to make initialization // easier we add one to the real offset, a nibble-value of zero // means that there is no header start in the resp. bucket. // In order to speed up "backwards scanning" we start numbering // nibbles inside a DWORD from the highest bits (28..31). Because // of that we can scan backwards inside the DWORD with right shifts. +// +// To have constant time reads, we store pointers relative to the map +// base in DWORDs which represent code regions that are completely +// covered by a function. A DWORD is a pointer if the nibble value +// in the lowest bits of the DWORD have a value > 8. +// +// Pointers are encoded in DWORDS by using the top 28 bits as normal. +// The bottom 4 bits are read as a nibble (the value must be greater than 8 +// to identify the DWORD as a pointer) which encodes the final 2 bits of +// information. +// +/////////////////////////////////////////////////////////////////////// +//// Set Algorithm +/////////////////////////////////////////////////////////////////////// +// +// 1. Write encoded nibble at offset corresponding to PC. +// 2. If codeSize completely covers one or more subsequent DWORDs, +// insert relative pointers into each covered DWORD. +// +/////////////////////////////////////////////////////////////////////// +//// Delete Algorithm +/////////////////////////////////////////////////////////////////////// +// +// 1. Delete the nibble corresponding to the PC. +// 2. Delete all following pointers which match the offset of PC. +// We must check the pointers refer to the PC because there may +// one or more subsequent nibbles in the DWORD. In that case the +// following pointers would not refer to PC but a different offset. +// +/////////////////////////////////////////////////////////////////////// +//// Read Algorithm +/////////////////////////////////////////////////////////////////////// +// +// 1. Look up DWORD representing given PC. +// 2. If DWORD is a pointer, then return pointer + mapBase. +// 3. If nibble corresponding to PC is initialized and the value +// it represents precedes the PC return that value. +// 4. Find the first preceding initialized nibble in the DWORD. +// If found, return the value the nibble represents. +// 5. Execute steps 2 and 4 on the proceeding DWORD. +// If this DWORD does not contain a pointer or any initialized nibbles, +// then we must not be in a function and can return an nullptr. +// +/////////////////////////////////////////////////////////////////////// +//// Concurrency +/////////////////////////////////////////////////////////////////////// +// +// Writes to the nibblemap (set and delete) require holding a critical +// section and therefore can not be done concurrently. Reads can be done +// without a lock and can occur at any time. +// +// The read algorithm is designed so that as long as no tearing occurs +// on a DWORD, the read will always be valid. This is because the read +// only depends on a single DWORD. Either the first if that contains a +// pointer/preceeding initialized nibble, or second if that contains a +// pointer/nibble. Given that DWORDs are 32-bits and aligned to 4-byte +// boundaries, these reads should not tear. +// #if defined(HOST_64BIT) // TODO: bump up the windows CODE_ALIGN to 16 and iron out any nibble map bugs that exist. @@ -32,23 +91,44 @@ # define CODE_ALIGN sizeof(DWORD) // 4 byte boundry # define LOG2_CODE_ALIGN 2 #endif -#define NIBBLE_MASK 0xf +#define NIBBLE_MASK 0xfu #define NIBBLE_SIZE 4 // 4 bits #define LOG2_NIBBLE_SIZE 2 -#define NIBBLES_PER_DWORD ((8*sizeof(DWORD)) >> LOG2_NIBBLE_SIZE) // 8 (4-bit) nibbles per dword +#define NIBBLES_PER_DWORD (2 * sizeof(DWORD)) // 8 (4-bit) nibbles per dword #define NIBBLES_PER_DWORD_MASK (NIBBLES_PER_DWORD - 1) // 7 #define LOG2_NIBBLES_PER_DWORD 3 #define BYTES_PER_BUCKET (NIBBLES_PER_DWORD * CODE_ALIGN) // 32 bytes per bucket #define LOG2_BYTES_PER_BUCKET (LOG2_CODE_ALIGN + LOG2_NIBBLES_PER_DWORD) // 5 bits per bucket #define MASK_BYTES_PER_BUCKET (BYTES_PER_BUCKET - 1) // 31 +#define BYTES_PER_DWORD (NIBBLES_PER_DWORD * BYTES_PER_BUCKET) // 256 bytes per dword +#define LOG2_BYTES_PER_DWORD (LOG2_NIBBLES_PER_DWORD + LOG2_BYTES_PER_BUCKET) // 8 bits per dword #define HIGHEST_NIBBLE_BIT (32 - NIBBLE_SIZE) // 28 (i.e 32 - 4) #define HIGHEST_NIBBLE_MASK (NIBBLE_MASK << HIGHEST_NIBBLE_BIT) // 0xf0000000 #define ADDR2POS(x) ((x) >> LOG2_BYTES_PER_BUCKET) #define ADDR2OFFS(x) (DWORD) ((((x) & MASK_BYTES_PER_BUCKET) >> LOG2_CODE_ALIGN) + 1) #define POSOFF2ADDR(pos, of) (size_t) (((pos) << LOG2_BYTES_PER_BUCKET) + (((of) - 1) << LOG2_CODE_ALIGN)) -#define HEAP2MAPSIZE(x) (((x) / (BYTES_PER_BUCKET * NIBBLES_PER_DWORD)) * CODE_ALIGN) +#define HEAP2MAPSIZE(x) (((x) / (BYTES_PER_DWORD) + 1) * sizeof(DWORD)) #define POS2SHIFTCOUNT(x) (DWORD) (HIGHEST_NIBBLE_BIT - (((x) & NIBBLES_PER_DWORD_MASK) << LOG2_NIBBLE_SIZE)) #define POS2MASK(x) (DWORD) ~(HIGHEST_NIBBLE_MASK >> (((x) & NIBBLES_PER_DWORD_MASK) << LOG2_NIBBLE_SIZE)) +namespace NibbleMap +{ + FORCEINLINE bool IsPointer(DWORD dword) + { + return (dword & NIBBLE_MASK) > 8; + } + + FORCEINLINE DWORD EncodePointer(size_t relativePointer) + { + return (DWORD) ((relativePointer & ~NIBBLE_MASK) + (((relativePointer & NIBBLE_MASK) >> 2) + 9)); + } + + FORCEINLINE size_t DecodePointer(DWORD dword) + { + return (size_t) ((dword & ~NIBBLE_MASK) + (((dword & NIBBLE_MASK) - 9) << 2)); + } +} + + #endif // NIBBLEMAPMACROS_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblestream.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblestream.h index aa4212cba..512b79a51 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblestream.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/nibblestream.h @@ -58,7 +58,10 @@ class NibbleWriter void Flush() { if (m_fPending) + { m_SigBuilder.AppendByte(m_PendingNibble); + m_fPending = false; + } } PVOID GetBlob(DWORD * pdwLength) @@ -79,12 +82,7 @@ class NibbleWriter // Write a single nibble to the stream. void WriteNibble(NIBBLE i) { - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - } - CONTRACTL_END; + WRAPPER_NO_CONTRACT; _ASSERTE(i <= 0xF); @@ -111,12 +109,7 @@ class NibbleWriter void WriteEncodedU32(DWORD dw) { - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - } - CONTRACTL_END; + WRAPPER_NO_CONTRACT; // Fast path for common small inputs if (dw <= 63) @@ -148,12 +141,7 @@ class NibbleWriter // Write a signed 32 bit value. void WriteEncodedI32(int x) { - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - } - CONTRACTL_END; + WRAPPER_NO_CONTRACT; DWORD dw = (x < 0) ? (((-x) << 1) + 1) : (x << 1); WriteEncodedU32(dw); @@ -175,6 +163,12 @@ class NibbleWriter } } + void WriteRawByte(uint8_t b) + { + Flush(); + m_SigBuilder.AppendByte(b); + } + protected: NIBBLE m_PendingNibble; // Pending value, not yet written out. bool m_fPending; @@ -188,15 +182,47 @@ class NibbleWriter class NibbleReader { public: +#ifdef BIGENDIAN + typedef uint8_t NibbleChunkType; // Alternatively we could byteswap the data after we load it, but I don't have a convenient helper here, so we just use a byte type +#else +#ifdef HOST_64BIT + typedef uint64_t NibbleChunkType; +#else + typedef uint32_t NibbleChunkType; +#endif // HOST_64BIT +#endif // !BIGENDIAN NibbleReader(PTR_BYTE pBuffer, size_t size) { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; _ASSERTE(pBuffer != NULL); - m_pBuffer = pBuffer; - m_cBytes = size; - m_cNibble = 0; + TADDR pBufferAddr = dac_cast(pBuffer); + TADDR pBufferChunkAddr = AlignDown(pBufferAddr, sizeof(NibbleChunkType)); + + m_pNibblesBuffer = dac_cast(pBufferChunkAddr); + m_curNibbleData = m_pNibblesBuffer[0]; + m_cNibbleMapOffset = (pBufferAddr - pBufferChunkAddr); + m_curNibbleData >>= 8 * m_cNibbleMapOffset; // Adjust to the first nibble in the first chunk + m_nibblesInCurrentNibbleData = (uint32_t)((sizeof(NibbleChunkType) * 2) - m_cNibbleMapOffset * 2); // Calculate how many nibbles are in the first chunk + + m_cNibbleChunksConsumed = 1; + + if (size >= 0xFFFFFFFF) + { + m_cNibbleChunksTotal = 0xFFFFFFFF; + } + else + { + if ((m_nibblesInCurrentNibbleData / 2) >= size) + { + m_cNibbleChunksTotal = 1; // No more chunks to read, we have enough nibbles in the first chunk + } + else + { + m_cNibbleChunksTotal = 1 + AlignUp((size * 2 - m_nibblesInCurrentNibbleData), sizeof(NibbleChunkType) * 2)/(sizeof(NibbleChunkType) * 2); + } + } } // Get the index of the next Byte. @@ -207,7 +233,10 @@ class NibbleReader LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - return (m_cNibble + 1) / 2; + size_t nextNibbleChunkOffset = m_cNibbleChunksConsumed * sizeof(NibbleChunkType) - m_cNibbleMapOffset; + size_t result = nextNibbleChunkOffset - m_nibblesInCurrentNibbleData / 2; + + return result; } NIBBLE ReadNibble() @@ -220,27 +249,23 @@ class NibbleReader } CONTRACTL_END; - NIBBLE i = 0; - // Bufer should have been allocated large enough to hold data. - if (!(m_cNibble / 2 < m_cBytes)) + if (m_nibblesInCurrentNibbleData == 0) { - // We should never get here in a normal retail scenario. - // We could wind up here if somebody provided us invalid data (maybe by corrupting an ngenned image). - EX_THROW(HRException, (E_INVALIDARG)); - } + // We have consumed all nibbles in the current nibble data. + // Move to the next chunk of nibbles. + if (m_cNibbleChunksConsumed >= m_cNibbleChunksTotal) + { + // No more nibbles left to read. + EX_THROW(HRException, (E_INVALIDARG)); + } - BYTE p = m_pBuffer[m_cNibble / 2]; - if ((m_cNibble & 1) == 0) - { - // Read the low nibble first - i = (NIBBLE) (p & 0xF); - } - else - { - // Read the high nibble after the low nibble has been read - i = (NIBBLE) (p >> 4) & 0xF; + m_curNibbleData = m_pNibblesBuffer[m_cNibbleChunksConsumed++]; + m_nibblesInCurrentNibbleData = (sizeof(NibbleChunkType) * 2); } - m_cNibble++; + + m_nibblesInCurrentNibbleData--; + NIBBLE i = (NIBBLE) (m_curNibbleData & 0xF); + m_curNibbleData >>= 4; // Shift right to get the next nibble for the next call return i; } @@ -289,6 +314,68 @@ class NibbleReader return dw; } + FORCEINLINE NIBBLE ReadNibble_NoThrow() + { + LIMITED_METHOD_DAC_CONTRACT; + + if (m_nibblesInCurrentNibbleData == 0) + { + // We have consumed all nibbles in the current nibble data. + // Move to the next chunk of nibbles. + if (m_cNibbleChunksConsumed < m_cNibbleChunksTotal) + { + // Read the next nibble chunk. If we're past the end, we'll just skip + // that, and the nibble data will just be 0. + m_curNibbleData = m_pNibblesBuffer[m_cNibbleChunksConsumed++]; + } + + m_nibblesInCurrentNibbleData = (sizeof(NibbleChunkType) * 2); + } + + m_nibblesInCurrentNibbleData--; + NIBBLE i = (NIBBLE) (m_curNibbleData & 0xF); + m_curNibbleData >>= 4; // Shift right to get the next nibble for the next call + + return i; + } + + // Read an unsigned int that was encoded via variable length nibble encoding + // from NibbleWriter::WriteEncodedU32. + DWORD ReadEncodedU32_NoThrow() + { + LIMITED_METHOD_DAC_CONTRACT; + + DWORD dw = 0; + +#if defined(_DEBUG) || defined(DACCESS_COMPILE) + int dwCount = 0; +#endif + + // The encoding is variably lengthed, with the high-bit of every nibble indicating whether + // there is another nibble in the value. Each nibble contributes 3 bits to the value. + NIBBLE n; + do + { +#if defined(_DEBUG) || defined(DACCESS_COMPILE) + // If we've already read 11 nibbles (with 3 bits of usable data each), then we + // should be done reading a 32-bit integer. + // Avoid working with corrupted data and potentially long loops by failing + if(dwCount > 11) + { + _ASSERTE_MSG(false, "Corrupt nibble stream - value exceeded 32-bits in size"); +#ifdef DACCESS_COMPILE + DacError(CORDBG_E_TARGET_INCONSISTENT); +#endif + } + dwCount++; +#endif + + n = ReadNibble_NoThrow(); + dw = (dw << 3) + (n & 0x7); + } while((n & 0x8) > 0); + + return dw; + } int ReadEncodedI32() { CONTRACTL @@ -304,6 +391,15 @@ class NibbleReader return (dw & 1) ? (-x) : (x); } + int ReadEncodedI32_NoThrow() + { + LIMITED_METHOD_DAC_CONTRACT; + + DWORD dw = ReadEncodedU32_NoThrow(); + int x = dw >> 1; + return (dw & 1) ? (-x) : (x); + } + DWORD ReadUnencodedU32() { CONTRACTL @@ -324,10 +420,27 @@ class NibbleReader return result; } + DWORD ReadUnencodedU32_NoThrow() + { + LIMITED_METHOD_DAC_CONTRACT; + + DWORD result = 0; + + for (int i = 0; i < 8; i++) + { + result |= static_cast(ReadNibble_NoThrow()) << (i * 4); + } + + return result; + } + protected: - PTR_BYTE m_pBuffer; - size_t m_cBytes; // size of buffer. - size_t m_cNibble; // Which nibble are we at? + DPTR(NibbleChunkType) m_pNibblesBuffer; + size_t m_cNibbleChunksTotal; // size of buffer remaining + size_t m_cNibbleChunksConsumed; // How many chunks of nibbles have we consumed? + size_t m_cNibbleMapOffset; // Offset in the nibble stream the nibble stream started + NibbleChunkType m_curNibbleData; + uint32_t m_nibblesInCurrentNibbleData; }; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/nsutilpriv.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/nsutilpriv.h index 238b34618..fdd82daac 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/nsutilpriv.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/nsutilpriv.h @@ -1,10 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + //***************************************************************************** // NSUtilPriv.h // // Helpers for converting namespace separators. -// //***************************************************************************** #ifndef __NSUTILPRIV_H__ @@ -15,7 +15,6 @@ class SString; struct ns { - //***************************************************************************** // Determine how many chars large a fully qualified name would be given the // two parts of the name. The return value includes room for every character @@ -43,7 +42,6 @@ static int IsValidName( // true if valid, false invalid. LPCUTF8 szName); // Name to parse. - //***************************************************************************** // Scan the string from the rear looking for the first valid separator. If // found, return a pointer to it. Else return null. This code is smart enough @@ -61,34 +59,22 @@ static LPUTF8 FindSep( // Pointer to separator or null. LPCUTF8 szPath); // The path to look in. - //***************************************************************************** // Take a path and find the last separator (nsFindSep), and then replace the // separator with a '\0' and return a pointer to the name. So for example: // a.b.c // becomes two strings "a.b" and "c" and the return value points to "c". //***************************************************************************** -static -WCHAR *SplitInline( // Pointer to name portion. - __inout __inout_z WCHAR *szPath); // The path to split. - static LPUTF8 SplitInline( // Pointer to name portion. __inout __inout_z LPUTF8 szPath); // The path to split. -static -void SplitInline( - __inout __inout_z LPWSTR szPath, // Path to split. - LPCWSTR &szNameSpace, // Return pointer to namespace. - LPCWSTR &szName); // Return pointer to name. - static void SplitInline( __inout __inout_z LPUTF8 szPath, // Path to split. LPCUTF8 &szNameSpace, // Return pointer to namespace. LPCUTF8 &szName); // Return pointer to name. - //***************************************************************************** // Split the last parsable element from the end of the string as the name, // the first part as the namespace. @@ -109,7 +95,6 @@ int SplitPath( // true ok, false trunction. _Out_writes_opt_ (cchName) LPUTF8 szName, // Output for name. int cchName); // Max chars for output. - //***************************************************************************** // Take two values and put them together in a fully qualified path using the // correct separator. @@ -128,31 +113,6 @@ int MakePath( // true ok, false truncation. LPCUTF8 szNameSpace, // Namespace. LPCUTF8 szName); // Name. -static -int MakePath( // true ok, false truncation. - _Out_writes_(cchChars) WCHAR *szOut, // output path for name. - int cchChars, // max chars for output path. - LPCUTF8 szNameSpace, // Namespace. - LPCUTF8 szName); // Name. - -static -int MakePath( // true ok, false out of memory - CQuickBytes &qb, // Where to put results. - LPCUTF8 szNameSpace, // Namespace for name. - LPCUTF8 szName); // Final part of name. - -static -int MakePath( // true ok, false out of memory - CQuickArray &qa, // Where to put results. - LPCUTF8 szNameSpace, // Namespace for name. - LPCUTF8 szName); // Final part of name. - -static -int MakePath( // true ok, false out of memory - CQuickBytes &qb, // Where to put results. - const WCHAR *szNameSpace, // Namespace for name. - const WCHAR *szName); // Final part of name. - static void MakePath( // throws on out of memory SString &ssBuf, // Where to put results. @@ -176,46 +136,12 @@ bool MakeAssemblyQualifiedName( // true o int dwTypeName, // Number of characters (not including null) const WCHAR *szAssemblyName, // Final part of name. int dwAssemblyName); // Number of characters (not including null) - -static -int MakeNestedTypeName( // true ok, false out of memory - CQuickBytes &qb, // Where to put results. - LPCUTF8 szEnclosingName, // Full name for enclosing type - LPCUTF8 szNestedName); // Full name for nested type - -static -int MakeNestedTypeName( // true ok, false truncation. - _Out_writes_ (cchChars) LPUTF8 szOut, // output path for name. - int cchChars, // max chars for output path. - LPCUTF8 szEnclosingName, // Full name for enclosing type - LPCUTF8 szNestedName); // Full name for nested type - -static -void MakeNestedTypeName( // throws on out of memory - SString &ssBuf, // output path for name. - const SString &ssEnclosingName, // Full name for enclosing type - const SString &ssNestedName); // Full name for nested type }; // struct ns -#ifndef NAMESPACE_SEPARATOR_CHAR #define NAMESPACE_SEPARATOR_CHAR '.' #define NAMESPACE_SEPARATOR_WCHAR W('.') #define NAMESPACE_SEPARATOR_STR "." #define NAMESPACE_SEPARATOR_WSTR W(".") -#define NAMESPACE_SEPARATOR_LEN 1 -#define ASSEMBLY_SEPARATOR_CHAR ',' -#define ASSEMBLY_SEPARATOR_WCHAR W(',') -#define ASSEMBLY_SEPARATOR_STR ", " -#define ASSEMBLY_SEPARATOR_WSTR W(", ") -#define ASSEMBLY_SEPARATOR_LEN 2 -#define NESTED_SEPARATOR_CHAR '+' -#define NESTED_SEPARATOR_WCHAR W('+') -#define NESTED_SEPARATOR_STR "+" -#define NESTED_SEPARATOR_WSTR W("+") -#endif - -#define EMPTY_STR "" -#define EMPTY_WSTR W("") #define MAKE_FULL_PATH_ON_STACK_UTF8(toptr, pnamespace, pname) \ { \ @@ -224,20 +150,11 @@ void MakeNestedTypeName( // throws on out of memory ns::MakePath(toptr, __i##toptr, pnamespace, pname); \ } -#define MAKE_FULL_PATH_ON_STACK_UNICODE(toptr, pnamespace, pname) \ -{ \ - int __i##toptr = ns::GetFullLength(pnamespace, pname); \ - toptr = (WCHAR *) alloca(__i##toptr * sizeof(WCHAR)); \ - ns::MakePath(toptr, __i##toptr, pnamespace, pname); \ -} - -#define MAKE_FULLY_QUALIFIED_NAME(pszFullyQualifiedName, pszNameSpace, pszName) MAKE_FULL_PATH_ON_STACK_UTF8(pszFullyQualifiedName, pszNameSpace, pszName) - #define MAKE_FULLY_QUALIFIED_MEMBER_NAME(ptr, pszNameSpace, pszClassName, pszMemberName, pszSig) \ { \ int __i##ptr = ns::GetFullLength(pszNameSpace, pszClassName); \ __i##ptr += (pszMemberName ? (int) strlen(pszMemberName) : 0); \ - __i##ptr += (NAMESPACE_SEPARATOR_LEN * 2); \ + __i##ptr += (int)strlen(NAMESPACE_SEPARATOR_STR) * 2; \ __i##ptr += (pszSig ? (int) strlen(pszSig) : 0); \ ptr = (LPUTF8) alloca(__i##ptr); \ ns::MakePath(ptr, __i##ptr, pszNameSpace, pszClassName); \ @@ -252,12 +169,4 @@ void MakeNestedTypeName( // throws on out of memory } \ } -#ifdef _PREFAST_ -// need to eliminate the expansion of MAKE_FULLY_QUALIFIED_MEMBER_NAME in prefast -// builds to prevent it complaining about the potential for NULLs to strlen and strcat -#undef MAKE_FULLY_QUALIFIED_MEMBER_NAME -// need to set ptr=NULL so we don't get a build error because ptr isn't inited in a couple cases -#define MAKE_FULLY_QUALIFIED_MEMBER_NAME(ptr, pszNameSpace, pszClassName, pszMemberName, pszSig) ptr=NULL; -#endif - -#endif +#endif // __NSUTILPRIV_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/opcode.def b/Procfiler/src/cpp/3rdparty/coreclr/inc/opcode.def index 652b95920..368e332f3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/opcode.def +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/opcode.def @@ -3,7 +3,7 @@ /***************************************************************************** ** ** - ** Opcode.def - COM+ Intrinsic Opcodes and Macros. ** + ** Opcode.def - CLR Intrinsic Opcodes and Macros. ** ** ** ** This is the master table from which all opcode lists ** ** are derived. New instructions must be added to this ** diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/ostype.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/ostype.h index 58a8f726d..53f606af6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/ostype.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/ostype.h @@ -5,11 +5,11 @@ #include "staticcontract.h" #ifndef WRAPPER_NO_CONTRACT -#define WRAPPER_NO_CONTRACT ANNOTATION_WRAPPER +#define WRAPPER_NO_CONTRACT #endif #ifndef LIMITED_METHOD_CONTRACT -#define LIMITED_METHOD_CONTRACT ANNOTATION_FN_LEAF +#define LIMITED_METHOD_CONTRACT #endif //***************************************************************************** diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr.h index 98321ba87..dd9db6958 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr.h @@ -8,12 +8,11 @@ // =========================================================================== - -#if defined(HOST_WINDOWS) - #ifndef __PALCLR_H__ #define __PALCLR_H__ +#if defined(HOST_WINDOWS) + // This macro is used to standardize the wide character string literals between UNIX and Windows. // Unix L"" is UTF32, and on windows it's UTF16. Because of built-in assumptions on the size // of string literals, it's important to match behaviour between Unix and Windows. Unix will be defined @@ -48,8 +47,6 @@ #endif // !_MSC_VER #endif // !NOINLINE -#define ANALYZER_NORETURN - #ifdef _MSC_VER #define EMPTY_BASES_DECL __declspec(empty_bases) #else @@ -320,17 +317,14 @@ { \ bool __exHandled; __exHandled = false; \ DWORD __exCode; __exCode = 0; \ - SCAN_EHMARKER(); \ __try \ - { \ - SCAN_EHMARKER_TRY(); + { #define PAL_EXCEPT_NAKED(Disposition) \ } \ __except(__exCode = GetExceptionCode(), Disposition) \ { \ __exHandled = true; \ - SCAN_EHMARKER_CATCH(); \ PAL_SEH_RESTORE_GUARD_PAGE #define PAL_EXCEPT_FILTER_NAKED(pfnFilter, param) \ @@ -339,7 +333,6 @@ pfnFilter(GetExceptionInformation(), param)) \ { \ __exHandled = true; \ - SCAN_EHMARKER_CATCH(); \ PAL_SEH_RESTORE_GUARD_PAGE #define PAL_FINALLY_NAKED \ @@ -349,7 +342,6 @@ #define PAL_ENDTRY_NAKED \ } \ - PAL_ENDTRY_NAKED_DBG \ } \ @@ -370,30 +362,6 @@ { \ PAL_TRY_HANDLER_DBG_BEGIN -// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by -// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods -// as on PAL. -#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) \ -{ \ - struct __HandlerData { \ - __ParamType __param; \ - COMPILER_INSTANCE *__ciPtr; \ - }; \ - __HandlerData handlerData; \ - handlerData.__param = __paramRef; \ - handlerData.__ciPtr = ciPtr; \ - __HandlerData* __param = &handlerData; \ - __ParamType __paramToPassToFilter = __paramRef; \ - class __Body \ - { \ - public: \ - static void Run(__HandlerData* __pHandlerData) \ - { \ - PAL_TRY_HANDLER_DBG_BEGIN \ - COMPILER_INSTANCE *ciPtr = __pHandlerData->__ciPtr; \ - __ParamType __paramDef = __pHandlerData->__param; - - #define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason) \ { \ __ParamType __param = __paramRef; \ @@ -442,11 +410,6 @@ PAL_TRY_NAKED \ PAL_TRY_HANDLER_DBG_BEGIN -// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by -// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods -// as on PAL. -#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) PAL_TRY(__ParamType, __paramDef, __paramRef) - #define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason) \ { \ __ParamType __param = __paramRef; \ @@ -472,14 +435,10 @@ #endif // _DEBUG -// Executes the handler if the specified exception code matches -// the one in the exception. Otherwise, returns EXCEPTION_CONTINUE_SEARCH. -#define PAL_EXCEPT_IF_EXCEPTION_CODE(dwExceptionCode) PAL_EXCEPT((GetExceptionCode() == (dwExceptionCode))?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH) - #define PAL_CPP_TRY try #define PAL_CPP_ENDTRY -#define PAL_CPP_THROW(type, obj) do { SCAN_THROW_MARKER; throw obj; } while (false) -#define PAL_CPP_RETHROW do { SCAN_THROW_MARKER; throw; } while (false) +#define PAL_CPP_THROW(type, obj) do { throw obj; } while (false) +#define PAL_CPP_RETHROW do { throw; } while (false) #define PAL_CPP_CATCH_DERIVED(type, obj) catch (type * obj) #define PAL_CPP_CATCH_NON_DERIVED(type, obj) catch (type obj) #define PAL_CPP_CATCH_NON_DERIVED_NOARG(type) catch (type) @@ -530,13 +489,10 @@ } \ } -#define PAL_ENDTRY_NAKED_DBG - #else -#define PAL_TRY_HANDLER_DBG_BEGIN ANNOTATION_TRY_BEGIN; -#define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) ANNOTATION_TRY_BEGIN; -#define PAL_TRY_HANDLER_DBG_END ANNOTATION_TRY_END; -#define PAL_ENDTRY_NAKED_DBG +#define PAL_TRY_HANDLER_DBG_BEGIN +#define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) +#define PAL_TRY_HANDLER_DBG_END #endif // defined(ENABLE_CONTRACTS_IMPL) @@ -604,12 +560,18 @@ #define __clr_reserved __reserved -#endif // __PALCLR_H__ - -#include "palclr_win.h" +// Native system libray handle. +// In Windows, NATIVE_LIBRARY_HANDLE is the same as HMODULE. +typedef HMODULE NATIVE_LIBRARY_HANDLE; #ifndef IMAGE_FILE_MACHINE_LOONGARCH64 #define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264 // LOONGARCH64. #endif +#ifndef IMAGE_FILE_MACHINE_RISCV64 +#define IMAGE_FILE_MACHINE_RISCV64 0x5064 // RISCV64. +#endif + #endif // defined(HOST_WINDOWS) + +#endif // __PALCLR_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr_win.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr_win.h deleted file mode 100644 index be0b725e1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/palclr_win.h +++ /dev/null @@ -1,143 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// =========================================================================== -// File: palclr.h -// -// Various macros and constants that are necessary to make the CLR portable. -// - -// =========================================================================== - -#ifndef __PALCLR_WIN_H__ -#define __PALCLR_WIN_H__ - -// PAL SEH -// Macros for portable exception handling. The Win32 SEH is emulated using -// these macros and setjmp/longjmp on Unix -// -// Usage notes: -// -// - The filter has to be a function taking two parameters: -// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv) -// -// - It is not possible to directly use the local variables in the filter. -// All the local information that the filter has to need to know about should -// be passed through pv parameter -// -// - Do not use goto to jump out of the PAL_TRY block -// (jumping out of the try block is not a good idea even on Win32, because of -// it causes stack unwind) -// -// -// Simple examples: -// -// PAL_TRY { -// .... -// } WIN_PAL_FINALLY { -// .... -// } -// WIN_PAL_ENDTRY -// -// -// PAL_TRY { -// .... -// } WIN_PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { -// .... -// } -// WIN_PAL_ENDTRY -// -// -// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv) -// { -// ... -// } -// PAL_TRY { -// .... -// } WIN_PAL_EXCEPT_FILTER(MyFilter, NULL) { -// .... -// } -// WIN_PAL_ENDTRY -// -// -// Complex example: -// -// struct MyParams -// { -// ... -// } params; -// -// PAL_TRY { -// PAL_TRY { -// ... -// if (error) goto Done; -// ... -// Done: ; -// } WIN_PAL_EXCEPT_FILTER(OtherFilter, ¶ms) { -// ... -// } -// WIN_PAL_ENDTRY -// } -// WIN_PAL_FINALLY { -// } -// WIN_PAL_ENDTRY -// - - - -#if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(HOST_ARM) // @ARMTODO -#define WIN_PAL_TRY_HANDLER_DBG_BEGIN \ - BOOL ___oldOkayToThrowValue = FALSE; \ - ClrDebugState *___pState = GetClrDebugState(); \ - __try \ - { \ - ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \ - ___pState->SetOkToThrow(TRUE); \ - ANNOTATION_TRY_BEGIN; - -// Special version that avoids touching the debug state after doing work in a DllMain for process or thread detach. -#define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) \ - BOOL ___oldOkayToThrowValue = FALSE; \ - BOOL ___oldSOTolerantState = FALSE; \ - ClrDebugState *___pState = CheckClrDebugState(); \ - __try \ - { \ - if (___pState) \ - { \ - ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \ - ___pState->SetOkToThrow(TRUE); \ - } \ - if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH)) \ - { \ - ___pState = NULL; \ - } \ - ANNOTATION_TRY_BEGIN; - -#define WIN_PAL_TRY_HANDLER_DBG_END \ - ANNOTATION_TRY_END; \ - } \ - __finally \ - { \ - if (___pState != NULL) \ - { \ - _ASSERTE(___pState == CheckClrDebugState()); \ - ___pState->SetOkToThrow(___oldOkayToThrowValue); \ - ___pState->SetSOTolerance(___oldSOTolerantState); \ - } \ - } - -#define WIN_PAL_ENDTRY_NAKED_DBG - -#else -#define WIN_PAL_TRY_HANDLER_DBG_BEGIN ANNOTATION_TRY_BEGIN; -#define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) ANNOTATION_TRY_BEGIN; -#define WIN_PAL_TRY_HANDLER_DBG_END ANNOTATION_TRY_END; -#define WIN_PAL_ENDTRY_NAKED_DBG -#endif // defined(ENABLE_CONTRACTS_IMPL) - -#if defined(HOST_WINDOWS) -// Native system libray handle. -// In Windows, NATIVE_LIBRARY_HANDLE is the same as HMODULE. -typedef HMODULE NATIVE_LIBRARY_HANDLE; -#endif // HOST_WINDOWS - -#endif // __PALCLR_WIN_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/patchpointinfo.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/patchpointinfo.h index 02b9fd89f..f2c01d351 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/patchpointinfo.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/patchpointinfo.h @@ -12,7 +12,7 @@ // -------------------------------------------------------------------------------- // Describes information needed to make an OSR transition -// - location of IL-visible locals and other important state on the +// - location of IL-visible locals and other important state on the // original (Tier0) method frame, with respect to top of frame // (hence these offsets will be negative as stack grows down) // - total size of the original frame @@ -26,18 +26,19 @@ struct PatchpointInfo { // Determine how much storage is needed to hold this info - static unsigned ComputeSize(unsigned localCount) + static uint32_t ComputeSize(uint32_t localCount) { - unsigned baseSize = sizeof(PatchpointInfo); - unsigned variableSize = localCount * sizeof(int); - unsigned totalSize = baseSize + variableSize; + uint32_t baseSize = sizeof(PatchpointInfo); + uint32_t variableSize = localCount * sizeof(int32_t); + uint32_t totalSize = baseSize + variableSize; return totalSize; } // Initialize - void Initialize(unsigned localCount, int totalFrameSize) + void Initialize(uint32_t localCount, int32_t totalFrameSize) { m_calleeSaveRegisters = 0; + m_tier0Version = 0; m_totalFrameSize = totalFrameSize; m_numberOfLocals = localCount; m_genericContextArgOffset = -1; @@ -50,37 +51,38 @@ struct PatchpointInfo void Copy(const PatchpointInfo* original) { m_calleeSaveRegisters = original->m_calleeSaveRegisters; + m_tier0Version = original->m_tier0Version; m_genericContextArgOffset = original->m_genericContextArgOffset; m_keptAliveThisOffset = original->m_keptAliveThisOffset; m_securityCookieOffset = original->m_securityCookieOffset; m_monitorAcquiredOffset = original->m_monitorAcquiredOffset; - for (unsigned i = 0; i < original->m_numberOfLocals; i++) + for (uint32_t i = 0; i < original->m_numberOfLocals; i++) { m_offsetAndExposureData[i] = original->m_offsetAndExposureData[i]; } } // Total size of this patchpoint info record, in bytes - unsigned PatchpointInfoSize() const + uint32_t PatchpointInfoSize() const { return ComputeSize(m_numberOfLocals); } // Total frame size of the original method - int TotalFrameSize() const + int32_t TotalFrameSize() const { return m_totalFrameSize; } // Number of locals in the original method (including special locals) - unsigned NumberOfLocals() const + uint32_t NumberOfLocals() const { return m_numberOfLocals; } // Original method caller SP offset for generic context arg - int GenericContextArgOffset() const + int32_t GenericContextArgOffset() const { return m_genericContextArgOffset; } @@ -90,13 +92,13 @@ struct PatchpointInfo return m_genericContextArgOffset != -1; } - void SetGenericContextArgOffset(int offset) + void SetGenericContextArgOffset(int32_t offset) { m_genericContextArgOffset = offset; } // Original method FP relative offset for kept-alive this - int KeptAliveThisOffset() const + int32_t KeptAliveThisOffset() const { return m_keptAliveThisOffset; } @@ -106,13 +108,13 @@ struct PatchpointInfo return m_keptAliveThisOffset != -1; } - void SetKeptAliveThisOffset(int offset) + void SetKeptAliveThisOffset(int32_t offset) { m_keptAliveThisOffset = offset; } // Original method FP relative offset for security cookie - int SecurityCookieOffset() const + int32_t SecurityCookieOffset() const { return m_securityCookieOffset; } @@ -122,13 +124,13 @@ struct PatchpointInfo return m_securityCookieOffset != -1; } - void SetSecurityCookieOffset(int offset) + void SetSecurityCookieOffset(int32_t offset) { m_securityCookieOffset = offset; } // Original method FP relative offset for monitor acquired flag - int MonitorAcquiredOffset() const + int32_t MonitorAcquiredOffset() const { return m_monitorAcquiredOffset; } @@ -138,24 +140,24 @@ struct PatchpointInfo return m_monitorAcquiredOffset != -1; } - void SetMonitorAcquiredOffset(int offset) + void SetMonitorAcquiredOffset(int32_t offset) { m_monitorAcquiredOffset = offset; } // True if this local was address exposed in the original method - bool IsExposed(unsigned localNum) const + bool IsExposed(uint32_t localNum) const { return ((m_offsetAndExposureData[localNum] & EXPOSURE_MASK) != 0); } // FP relative offset of this local in the original method - int Offset(unsigned localNum) const + int32_t Offset(uint32_t localNum) const { return (m_offsetAndExposureData[localNum] >> OFFSET_SHIFT); } - void SetOffsetAndExposure(unsigned localNum, int offset, bool isExposed) + void SetOffsetAndExposure(uint32_t localNum, int32_t offset, bool isExposed) { m_offsetAndExposureData[localNum] = (offset << OFFSET_SHIFT) | (isExposed ? EXPOSURE_MASK : 0); } @@ -173,6 +175,16 @@ struct PatchpointInfo m_calleeSaveRegisters = registerMask; } + PCODE GetTier0EntryPoint() const + { + return m_tier0Version; + } + + void SetTier0EntryPoint(PCODE ip) + { + m_tier0Version = ip; + } + private: enum { @@ -181,13 +193,14 @@ struct PatchpointInfo }; uint64_t m_calleeSaveRegisters; - unsigned m_numberOfLocals; - int m_totalFrameSize; - int m_genericContextArgOffset; - int m_keptAliveThisOffset; - int m_securityCookieOffset; - int m_monitorAcquiredOffset; - int m_offsetAndExposureData[]; + PCODE m_tier0Version; + uint32_t m_numberOfLocals; + int32_t m_totalFrameSize; + int32_t m_genericContextArgOffset; + int32_t m_keptAliveThisOffset; + int32_t m_securityCookieOffset; + int32_t m_monitorAcquiredOffset; + int32_t m_offsetAndExposureData[]; }; typedef DPTR(struct PatchpointInfo) PTR_PatchpointInfo; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.h index 057dfa9a2..7aac8a84a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.h @@ -52,6 +52,8 @@ typedef DPTR(IMAGE_COR20_HEADER) PTR_IMAGE_COR20_HEADER; class Module; +template struct cdac_data; + // -------------------------------------------------------------------------------- // RVA definition // -------------------------------------------------------------------------------- @@ -89,6 +91,8 @@ inline CHECK CheckOverflow(RVA value1, COUNT_T value2) #define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_UNKNOWN #elif defined(TARGET_RISCV64) #define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_RISCV64 +#elif defined(TARGET_WASM) +#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_UNKNOWN #else #error "port me" #endif @@ -403,6 +407,9 @@ class PEDecoder PTR_IMAGE_NT_HEADERS m_pNTHeaders; PTR_IMAGE_COR20_HEADER m_pCorHeader; PTR_READYTORUN_HEADER m_pReadyToRunHeader; + + // to allow inherited classes to access, friend to all specializations of cdac_data + template friend struct ::cdac_data; }; // @@ -424,12 +431,19 @@ class MethodSectionIterator BYTE *m_current; public: + MethodSectionIterator() = default; //If code is a target pointer, then GetMethodCode and FindMethodCode return //target pointers. codeTable may be a pointer of either type, since it is //converted internally into a host pointer. - MethodSectionIterator(const void *code, SIZE_T codeSize, - const void *codeTable, SIZE_T codeTableSize); + MethodSectionIterator(void *code, SIZE_T codeSize, + void *codeTable, SIZE_T codeTableSize); + + MethodSectionIterator(MethodSectionIterator const&) = delete; + MethodSectionIterator& operator=(MethodSectionIterator const&) = delete; + MethodSectionIterator(MethodSectionIterator&&) = default; + MethodSectionIterator& operator=(MethodSectionIterator&&) = default; + BOOL Next(); BYTE *GetMethodCode() { return m_current; } // Get the start of method code of the current method in the iterator }; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.inl b/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.inl index 7257bd9a7..485d7661c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.inl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/pedecoder.inl @@ -690,7 +690,7 @@ inline RVA PEDecoder::OffsetToRva(COUNT_T fileOffset) const if(fileOffset > 0) { IMAGE_SECTION_HEADER *section = OffsetToSection(fileOffset); - PREFIX_ASSUME (section!=NULL); //TODO: actually it is possible that it si null we need to rethink how we handle this cases and do better there + _ASSERTE (section!=NULL); //TODO: actually it is possible that it si null we need to rethink how we handle this cases and do better there return fileOffset - VAL32(section->PointerToRawData) + VAL32(section->VirtualAddress); } @@ -825,7 +825,7 @@ inline PTR_VOID PEDecoder::GetTlsRange(COUNT_T * pSize) const if (pSize != 0) *pSize = (COUNT_T) (VALPTR(pTlsHeader->EndAddressOfRawData) - VALPTR(pTlsHeader->StartAddressOfRawData)); - PREFIX_ASSUME (pTlsHeader!=NULL); + _ASSERTE (pTlsHeader!=NULL); RETURN PTR_VOID(GetInternalAddressData(pTlsHeader->StartAddressOfRawData)); } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/pesectionman.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/pesectionman.h index 79e70c7dc..d74770dcd 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/pesectionman.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/pesectionman.h @@ -99,10 +99,6 @@ class PESection : public CeeSectionImpl { CeeSectionRelocType reloc = srRelocHighLow, CeeSectionRelocExtra *extra=0); - // Add a base reloc for the given offset in the current section - HRESULT addBaseReloc(unsigned offset, CeeSectionRelocType reloc = srRelocHighLow, - CeeSectionRelocExtra *extra = 0); - // section name unsigned char *name() { LIMITED_METHOD_CONTRACT; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.h index 7967a600e..49322fdcf 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.h @@ -13,6 +13,9 @@ #ifndef _ProfilePriv_h_ #define _ProfilePriv_h_ +#ifndef FEATURE_PERFTRACING +typedef struct _EventPipeProvider EventPipeProvider; +#endif //FEATURE_PERFTRACING // Forward declarations class EEToProfInterfaceImpl; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.inl b/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.inl index 5b50e4e8e..66c3b93e3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.inl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/profilepriv.inl @@ -2114,7 +2114,7 @@ FORCEINLINE BOOL CORProfilerTrackEventPipe() // These macros must be placed around any callbacks to g_profControlBlock by // the EE. Example: // { -// BEGIN_PROFILER_CALLBACK(CORProfilerTrackAppDomainLoads; +// BEGIN_PROFILER_CALLBACK(CORProfilerTrackAppDomainLoads()); // g_profControlBlock.AppDomainCreationStarted(MyAppDomainID); // END_PROFILER_CALLBACK(); // } @@ -2129,7 +2129,7 @@ FORCEINLINE BOOL CORProfilerTrackEventPipe() // block. Example: // // { -// BEGIN_PROFILER_CALLBACK(CorProfilerTrackTransitions); +// BEGIN_PROFILER_CALLBACK(CorProfilerTrackTransitions()); // if (!pNSL->pMD->IsQCall()) // { // g_profControlBlock. diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/random.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/random.h index 6a8d7001b..98d24d2f1 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/random.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/random.h @@ -19,6 +19,7 @@ #define _CLRRANDOM_H_ #include +#include "minipal/time.h" // // Forbid the use of srand()/rand(), as these are globally shared facilities and our use of them would @@ -73,10 +74,7 @@ class CLRRandom void Init() { LIMITED_METHOD_CONTRACT; - LARGE_INTEGER time; - if (!QueryPerformanceCounter(&time)) - time.QuadPart = GetTickCount(); - Init((int)time.u.LowPart ^ GetCurrentThreadId() ^ GetCurrentProcessId()); + Init((int)minipal_hires_ticks() ^ GetCurrentThreadId() ^ GetCurrentProcessId()); } void Init(int Seed) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorun.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorun.h index d13c66099..134b685ff 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorun.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorun.h @@ -19,10 +19,10 @@ // src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h // If you update this, ensure you run `git grep MINIMUM_READYTORUN_MAJOR_VERSION` // and handle pending work. -#define READYTORUN_MAJOR_VERSION 10 -#define READYTORUN_MINOR_VERSION 0x0001 +#define READYTORUN_MAJOR_VERSION 16 +#define READYTORUN_MINOR_VERSION 0x0000 -#define MINIMUM_READYTORUN_MAJOR_VERSION 10 +#define MINIMUM_READYTORUN_MAJOR_VERSION 16 // R2R Version 2.1 adds the InliningInfo section // R2R Version 2.2 adds the ProfileDataInfo section @@ -36,8 +36,17 @@ // R2R Version 9.2 adds MemZero and NativeMemSet helpers // R2R Version 9.3 adds BulkWriteBarrier helper // uses GCInfo v3, which makes safe points in partially interruptible code interruptible. -// R2R Version 10.0 adds support for the statics being allocated on a per type basis instead of on a per module basis +// R2R Version 10.0 adds support for the statics being allocated on a per type basis instead of on a per module basis, disable support for LogMethodEnter helper // R2R Version 10.1 adds Unbox_TypeTest helper +// R2R Version 11 uses GCInfo v4, which encodes safe points without -1 offset and does not track return kinds in GCInfo +// R2R Version 12 requires all return buffers to be always on the stack +// R2R Version 13 removes usage of PSPSym, changes ABI for funclets to match NativeAOT, changes register for +// exception parameter on AMD64, and redefines generics instance context stack slot in GCInfo v4 +// to be SP/FP relative +// R2R Version 13.1 added long/ulong to float helper calls +// R2R Version 14 changed x86 code generation to use funclets +// R2R Version 15 removes double to int/uint helper calls +// R2R Version 16 replaces the compression format for debug boundaries with a new format that is smaller and more efficient to parse struct READYTORUN_CORE_HEADER { @@ -281,6 +290,9 @@ enum ReadyToRunFixupKind READYTORUN_FIXUP_Check_IL_Body = 0x35, /* Check to see if an IL method is defined the same at runtime as at compile time. A failed match will cause code not to be used. */ READYTORUN_FIXUP_Verify_IL_Body = 0x36, /* Verify an IL body is defined the same at compile time and runtime. A failed match will cause a hard runtime failure. */ + + READYTORUN_FIXUP_ModuleOverride = 0x80, /* followed by sig-encoded UInt with assemblyref index into either the assemblyref table of the MSIL metadata of the master context module for the signature or */ + /* into the extra assemblyref table in the manifest metadata R2R header table (used in cases inlining brings in references to assemblies not seen in the MSIL). */ }; // @@ -346,7 +358,7 @@ enum ReadyToRunHelper READYTORUN_HELPER_GetString = 0x50, // Used by /Tuning for Profile optimizations - READYTORUN_HELPER_LogMethodEnter = 0x51, + READYTORUN_HELPER_LogMethodEnter = 0x51, // No longer supported as of READYTORUN_MAJOR_VERSION 10.0 // Reflection helpers READYTORUN_HELPER_GetRuntimeTypeHandle = 0x54, @@ -395,14 +407,16 @@ enum ReadyToRunHelper READYTORUN_HELPER_UMod = 0xCF, // Floating point conversions - READYTORUN_HELPER_Dbl2Int = 0xD0, + READYTORUN_HELPER_Dbl2Int = 0xD0, // Unused since READYTORUN_MAJOR_VERSION 15.0 READYTORUN_HELPER_Dbl2IntOvf = 0xD1, READYTORUN_HELPER_Dbl2Lng = 0xD2, READYTORUN_HELPER_Dbl2LngOvf = 0xD3, - READYTORUN_HELPER_Dbl2UInt = 0xD4, + READYTORUN_HELPER_Dbl2UInt = 0xD4, // Unused since READYTORUN_MAJOR_VERSION 15.0 READYTORUN_HELPER_Dbl2UIntOvf = 0xD5, READYTORUN_HELPER_Dbl2ULng = 0xD6, READYTORUN_HELPER_Dbl2ULngOvf = 0xD7, + READYTORUN_HELPER_Lng2Flt = 0xD8, + READYTORUN_HELPER_ULng2Flt = 0xD9, // Floating point ops READYTORUN_HELPER_DblRem = 0xE0, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorunhelpers.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorunhelpers.h index 58ad7f384..c6e1a09ca 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorunhelpers.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/readytorunhelpers.h @@ -34,8 +34,6 @@ HELPER(READYTORUN_HELPER_MemZero, CORINFO_HELP_MEMZERO, HELPER(READYTORUN_HELPER_NativeMemSet, CORINFO_HELP_NATIVE_MEMSET, ) HELPER(READYTORUN_HELPER_MemCpy, CORINFO_HELP_MEMCPY, ) -HELPER(READYTORUN_HELPER_LogMethodEnter, CORINFO_HELP_BBT_FCN_ENTER, ) - HELPER(READYTORUN_HELPER_GetRuntimeTypeHandle, CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, ) HELPER(READYTORUN_HELPER_GetRuntimeMethodHandle, CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, ) HELPER(READYTORUN_HELPER_GetRuntimeFieldHandle, CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, ) @@ -80,14 +78,14 @@ HELPER(READYTORUN_HELPER_Mod, CORINFO_HELP_MOD, HELPER(READYTORUN_HELPER_UDiv, CORINFO_HELP_UDIV, ) HELPER(READYTORUN_HELPER_UMod, CORINFO_HELP_UMOD, ) -HELPER(READYTORUN_HELPER_Dbl2Int, CORINFO_HELP_DBL2INT, ) HELPER(READYTORUN_HELPER_Dbl2IntOvf, CORINFO_HELP_DBL2INT_OVF, ) HELPER(READYTORUN_HELPER_Dbl2Lng, CORINFO_HELP_DBL2LNG, ) HELPER(READYTORUN_HELPER_Dbl2LngOvf, CORINFO_HELP_DBL2LNG_OVF, ) -HELPER(READYTORUN_HELPER_Dbl2UInt, CORINFO_HELP_DBL2UINT, ) HELPER(READYTORUN_HELPER_Dbl2UIntOvf, CORINFO_HELP_DBL2UINT_OVF, ) HELPER(READYTORUN_HELPER_Dbl2ULng, CORINFO_HELP_DBL2ULNG, ) HELPER(READYTORUN_HELPER_Dbl2ULngOvf, CORINFO_HELP_DBL2ULNG_OVF, ) +HELPER(READYTORUN_HELPER_Lng2Flt, CORINFO_HELP_LNG2FLT, ) +HELPER(READYTORUN_HELPER_ULng2Flt, CORINFO_HELP_ULNG2FLT, ) HELPER(READYTORUN_HELPER_FltRem, CORINFO_HELP_FLTREM, ) HELPER(READYTORUN_HELPER_DblRem, CORINFO_HELP_DBLREM, ) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/readytoruninstructionset.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/readytoruninstructionset.h index 4ad8c6b4e..ee9e5fdc4 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/readytoruninstructionset.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/readytoruninstructionset.h @@ -54,7 +54,43 @@ enum ReadyToRunInstructionSet READYTORUN_INSTRUCTION_Sve=43, READYTORUN_INSTRUCTION_Avx10v1=44, READYTORUN_INSTRUCTION_Avx10v1_V512=46, - READYTORUN_INSTRUCTION_EVEX=47, + READYTORUN_INSTRUCTION_Evex=47, + READYTORUN_INSTRUCTION_Apx=48, + READYTORUN_INSTRUCTION_Pclmulqdq_V256=49, + READYTORUN_INSTRUCTION_Pclmulqdq_V512=50, + READYTORUN_INSTRUCTION_Avx10v2=51, + READYTORUN_INSTRUCTION_Avx10v2_V512=52, + READYTORUN_INSTRUCTION_Gfni=53, + READYTORUN_INSTRUCTION_Gfni_V256=54, + READYTORUN_INSTRUCTION_Gfni_V512=55, + READYTORUN_INSTRUCTION_RiscV64Base=56, + READYTORUN_INSTRUCTION_Zba=57, + READYTORUN_INSTRUCTION_Zbb=58, + READYTORUN_INSTRUCTION_Sve2=59, + READYTORUN_INSTRUCTION_AvxVnniInt8=60, + READYTORUN_INSTRUCTION_AvxVnniInt8_V512=61, + READYTORUN_INSTRUCTION_AvxVnniInt16=62, + READYTORUN_INSTRUCTION_AvxVnniInt16_V512=63, + READYTORUN_INSTRUCTION_Aes_V256=64, + READYTORUN_INSTRUCTION_Aes_V512=65, + READYTORUN_INSTRUCTION_AvxIfma=66, + READYTORUN_INSTRUCTION_F16C=67, + READYTORUN_INSTRUCTION_Sha=68, + READYTORUN_INSTRUCTION_WaitPkg=69, + READYTORUN_INSTRUCTION_Avx512Bitalg=70, + READYTORUN_INSTRUCTION_Avx512Bitalg_VL=71, + READYTORUN_INSTRUCTION_Avx512Bf16=72, + READYTORUN_INSTRUCTION_Avx512Bf16_VL=73, + READYTORUN_INSTRUCTION_Avx512Fp16=74, + READYTORUN_INSTRUCTION_Avx512Fp16_VL=75, + READYTORUN_INSTRUCTION_Avx512Ifma=76, + READYTORUN_INSTRUCTION_Avx512Vbmi2=77, + READYTORUN_INSTRUCTION_Avx512Vbmi2_VL=78, + READYTORUN_INSTRUCTION_Avx512Vnni=79, + READYTORUN_INSTRUCTION_Avx512Vp2intersect=80, + READYTORUN_INSTRUCTION_Avx512Vp2intersect_VL=81, + READYTORUN_INSTRUCTION_Avx512Vpopcntdq=82, + READYTORUN_INSTRUCTION_Avx512Vpopcntdq_VL=83, }; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/regdisp.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/regdisp.h index b4431c351..7a5cf9d9d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/regdisp.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/regdisp.h @@ -132,12 +132,24 @@ inline TADDR GetRegdisplayFP(REGDISPLAY *display) { inline LPVOID GetRegdisplayFPAddress(REGDISPLAY *display) { LIMITED_METHOD_CONTRACT; +#ifdef FEATURE_EH_FUNCLETS + return &display->pCurrentContext->Ebp; +#else return (LPVOID)display->GetEbpLocation(); +#endif +} + +inline TADDR GetRegdisplayPCTAddr(REGDISPLAY *display) +{ + return display->PCTAddr; } inline void SetRegdisplayPCTAddr(REGDISPLAY *display, TADDR addr) { display->PCTAddr = addr; +#ifdef FEATURE_EH_FUNCLETS + display->pCurrentContext->Eip = *PTR_PCODE(addr); +#endif display->ControlPC = *PTR_PCODE(addr); } @@ -145,22 +157,12 @@ inline void SetRegdisplayPCTAddr(REGDISPLAY *display, TADDR addr) // This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer) { LIMITED_METHOD_CONTRACT; - -#ifdef FEATURE_EH_FUNCLETS - return stackPointer < ((LPVOID)(display->SP)); -#else - return (TADDR)stackPointer < display->PCTAddr; -#endif + return (TADDR)stackPointer < GetRegdisplayPCTAddr(display); } inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) { LIMITED_METHOD_DAC_CONTRACT; -#ifdef FEATURE_EH_FUNCLETS - _ASSERTE(GetRegdisplaySP(display) == GetSP(display->pCurrentContext)); - return GetRegdisplaySP(display); -#else - return display->PCTAddr; -#endif + return GetRegdisplayPCTAddr(display); } #elif defined(TARGET_64BIT) @@ -345,6 +347,25 @@ inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) { return GetSP(display->pCallerContext); } +#elif defined(TARGET_WASM) +struct REGDISPLAY : public REGDISPLAY_BASE { + REGDISPLAY() + { + // Initialize + memset(this, 0, sizeof(REGDISPLAY)); + } +}; + +inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD) +{ +} + +// This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame +inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer) { + _ASSERTE("IsInCalleesFrames is not implemented on wasm"); + return FALSE; +} + #else // none of the above processors #error "RegDisplay functions are not implemented on this platform." #endif @@ -379,7 +400,7 @@ inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD) #if defined(TARGET_64BIT) pRD->SP = (INT_PTR)GetSP(pRD->pCurrentContext); - pRD->ControlPC = INT_PTR(GetIP(pRD->pCurrentContext)); + pRD->ControlPC = (INT_PTR)GetIP(pRD->pCurrentContext); #elif defined(TARGET_ARM) pRD->SP = (DWORD)GetSP(pRD->pCurrentContext); pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext); @@ -421,7 +442,6 @@ inline void FillContextPointers(PT_KNONVOLATILE_CONTEXT_POINTERS pCtxPtrs, PT_CO *(&pCtxPtrs->S6) = &pCtx->S6; *(&pCtxPtrs->S7) = &pCtx->S7; *(&pCtxPtrs->S8) = &pCtx->S8; - *(&pCtxPtrs->Tp) = &pCtx->Tp; *(&pCtxPtrs->Fp) = &pCtx->Fp; *(&pCtxPtrs->Ra) = &pCtx->Ra; #elif defined(TARGET_ARM) // TARGET_LOONGARCH64 @@ -514,6 +534,10 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC // This will setup the PC and SP SyncRegDisplayToCurrentContext(pRD); +#ifdef TARGET_X86 + pRD->PCTAddr = (UINT_PTR)&(pctx->Eip); +#endif + #if !defined(DACCESS_COMPILE) #if defined(TARGET_AMD64) && defined(TARGET_WINDOWS) pRD->SSP = GetSSP(pctx); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/safemath.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/safemath.h index e40e26798..8c8283b9e 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/safemath.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/safemath.h @@ -48,12 +48,6 @@ // function are based on static type information and as such will // be optimized away. In particular, the case where the signs are // identical will result in no code branches. - -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:6326) // PREfast warning: Potential comparison of a constant with another constant -#endif // _PREFAST_ - template inline bool FitsIn(Src val) { @@ -140,10 +134,6 @@ inline bool DoubleFitsInIntType(double val) return DstMinD <= val && val <= DstMaxD; } -#ifdef _PREFAST_ -#pragma warning(pop) -#endif //_PREFAST_ - #define ovadd_lt(a, b, rhs) (((a) + (b) < (rhs) ) && ((a) + (b) >= (a))) #define ovadd_le(a, b, rhs) (((a) + (b) <= (rhs) ) && ((a) + (b) >= (a))) #define ovadd_gt(a, b, rhs) (((a) + (b) > (rhs) ) || ((a) + (b) < (a))) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/sbuffer.inl b/Procfiler/src/cpp/3rdparty/coreclr/inc/sbuffer.inl index 402cda72f..af4890cd8 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/sbuffer.inl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/sbuffer.inl @@ -268,7 +268,7 @@ inline void SBuffer::Set(const SBuffer &buffer) // PreFix seems to think it can choose m_allocation==0 and buffer.m_size > 0 here. // From the code for Resize and EnsureMutable, this is clearly impossible. - PREFIX_ASSUME( (this->m_buffer != NULL) || (buffer.m_size == 0) ); + _ASSERTE( (this->m_buffer != NULL) || (buffer.m_size == 0) ); MoveMemory(m_buffer, buffer.m_buffer, buffer.m_size); } @@ -294,7 +294,7 @@ inline void SBuffer::Set(const BYTE *buffer, COUNT_T size) // PreFix seems to think it can choose m_allocation==0 and size > 0 here. // From the code for Resize, this is clearly impossible. - PREFIX_ASSUME( (this->m_buffer != NULL) || (size == 0) ); + _ASSERTE( (this->m_buffer != NULL) || (size == 0) ); if (size != 0) MoveMemory(m_buffer, buffer, size); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/shimload.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/shimload.h deleted file mode 100644 index 9e1e88eeb..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/shimload.h +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Header: ShimLoad.hpp -** -** Purpose: Delay load hook used to images to bind to -** dll's shim shipped with the EE -** -** -===========================================================*/ -#ifndef _SHIMLOAD_H -#define _SHIMLOAD_H - - -//***************************************************************************** -// Sets/Gets the directory based on the location of the module. This routine -// is called at COR setup time. Set is called during EEStartup and by the -// MetaData dispenser. -//***************************************************************************** -HRESULT SetInternalSystemDirectory(); -HRESULT GetInternalSystemDirectory(_Out_writes_opt_(*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength); - -#endif - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/sigparser.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/sigparser.h index 4446a37e3..c5f539599 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/sigparser.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/sigparser.h @@ -116,7 +116,7 @@ class SigParser void GetSignature( PCCOR_SIGNATURE * pSig, - uint32_t * pcbSigSize) + uint32_t * pcbSigSize) const { *pSig = m_ptr; *pcbSigSize = m_dwLen; @@ -582,19 +582,32 @@ class SigParser return hr; while ((ELEMENT_TYPE_CMOD_REQD == bElementType) || - (ELEMENT_TYPE_CMOD_OPT == bElementType)) + (ELEMENT_TYPE_CMOD_OPT == bElementType) || + (ELEMENT_TYPE_CMOD_INTERNAL == bElementType)) { sigTemp.SkipBytes(1); + if (ELEMENT_TYPE_CMOD_INTERNAL == bElementType) + { + void * pMT; + // If this custom modifier is required or optional + uint8_t required; + if (FAILED(hr = sigTemp.GetByte(&required))) + return hr; + + if (FAILED(hr = sigTemp.GetPointer(&pMT))) + return hr; + } + else + { + mdToken token; - mdToken token; - - hr = sigTemp.GetToken(&token); + hr = sigTemp.GetToken(&token); - if (FAILED(hr)) - return hr; + if (FAILED(hr)) + return hr; + } - hr = sigTemp.PeekByte(&bElementType); - if (FAILED(hr)) + if (FAILED(hr = sigTemp.PeekByte(&bElementType))) return hr; } @@ -643,19 +656,31 @@ class SigParser while (ELEMENT_TYPE_CMOD_REQD == bElementType || ELEMENT_TYPE_CMOD_OPT == bElementType || ELEMENT_TYPE_MODIFIER == bElementType || - ELEMENT_TYPE_PINNED == bElementType) + ELEMENT_TYPE_PINNED == bElementType || + ELEMENT_TYPE_CMOD_INTERNAL == bElementType) { sigTemp.SkipBytes(1); + if (ELEMENT_TYPE_CMOD_INTERNAL == bElementType) + { + void * pMT; + uint8_t required; + if (FAILED(hr = sigTemp.GetByte(&required))) + return hr; + + if (FAILED(hr = sigTemp.GetPointer(&pMT))) + return hr; + } + else + { + mdToken token; - mdToken token; - - hr = sigTemp.GetToken(&token); + hr = sigTemp.GetToken(&token); - if (FAILED(hr)) - return hr; + if (FAILED(hr)) + return hr; + } - hr = sigTemp.PeekByte(&bElementType); - if (FAILED(hr)) + if (FAILED(hr = sigTemp.PeekByte(&bElementType))) return hr; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/slist.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/slist.h index ebd892b18..487c5dca3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/slist.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/slist.h @@ -120,6 +120,7 @@ class SList PTR_SLink m_pHead; PTR_SLink m_pTail; + // as a generic data structure, friend to all specializations of cdac_data template friend struct ::cdac_data; // get the list node within the object diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/sospriv.idl b/Procfiler/src/cpp/3rdparty/coreclr/inc/sospriv.idl index 141f597dc..0820d2038 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/sospriv.idl +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/sospriv.idl @@ -562,3 +562,13 @@ interface ISOSDacInterface15 : IUnknown { HRESULT GetMethodTableSlotEnumerator(CLRDATA_ADDRESS mt, ISOSMethodEnum **enumerator); } + +[ + object, + local, + uuid(4ba12ff8-daac-4e43-ac56-98cf8d5c595d) +] +interface ISOSDacInterface16 : IUnknown +{ + HRESULT GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode); +} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/sstring.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/sstring.h index 1b58f299b..9ca98ada6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/sstring.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/sstring.h @@ -647,8 +647,6 @@ class EMPTY_BASES_DECL SString : private SBuffer static const BYTE s_EmptyBuffer[2]; - static UINT s_ACP; - SPTR_DECL(SString,s_Empty); COUNT_T GetRawCount() const; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/stacktrace.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/stacktrace.h index b843eee74..0df8da9d9 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/stacktrace.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/stacktrace.h @@ -63,16 +63,6 @@ void MagicDeinit(void); ******************************************************************** robch */ void GetStringFromStackLevels(UINT ifrStart, UINT cfrTotal, _Out_writes_(cchMaxAssertStackLevelStringLen * cfrTotal) CHAR *pszString, struct _CONTEXT * pContext = NULL); -/**************************************************************************** -* GetStringFromAddr * -*-------------------* -* Description: -* Builds a string from an address in the format: -* -* 0x
: ! + 0x -******************************************************************** robch */ -void GetStringFromAddr(DWORD_PTR dwAddr, _Out_writes_(cchMaxAssertStackLevelStringLen) LPSTR szString); - #if defined(HOST_X86) && !defined(TARGET_UNIX) /**************************************************************************** * ClrCaptureContext * diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/staticcontract.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/staticcontract.h index df2638359..b4558c9f0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/staticcontract.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/staticcontract.h @@ -4,346 +4,39 @@ // StaticContract.h // --------------------------------------------------------------------------- - #ifndef __STATIC_CONTRACT_H_ #define __STATIC_CONTRACT_H_ -// Make sure we have the WCHAR defines available. -#include "palclr.h" - -#define SCAN_WIDEN2(x) L ## x -#define SCAN_WIDEN(x) SCAN_WIDEN2(x) - -#ifndef NOINLINE -#if __GNUC__ -#define NOINLINE __attribute__((noinline)) -#else -#define NOINLINE __declspec(noinline) -#endif -#endif - -// -// PDB annotations for the static contract analysis tool. These are separated -// from Contract.h to allow their inclusion in any part of the system. -// - -#if defined(_DEBUG) && defined(TARGET_X86) -#define METHOD_CANNOT_BE_FOLDED_DEBUG \ - static int _noFold = 0; \ - _noFold++; -#else -#define METHOD_CANNOT_BE_FOLDED_DEBUG -#endif - -#ifdef TARGET_X86 - -// -// currently, only x86 has a static contract analysis tool, so let's not -// bloat the PDBs of all the other architectures too.. -// -#define ANNOTATION_TRY_BEGIN __annotation(W("TRY_BEGIN")) -#define ANNOTATION_TRY_END __annotation(W("TRY_END")) -#define ANNOTATION_HANDLER_BEGIN __annotation(W("HANDLER_BEGIN")) -#define ANNOTATION_HANDLER_END __annotation(W("HANDLER_END")) -#define ANNOTATION_NOTHROW __annotation(W("NOTHROW")) -#define ANNOTATION_CANNOT_TAKE_LOCK __annotation(W("CANNOT_TAKE_LOCK")) -#define ANNOTATION_WRAPPER __annotation(W("WRAPPER")) -#define ANNOTATION_FAULT __annotation(W("FAULT")) -#define ANNOTATION_FORBID_FAULT __annotation(W("FORBID_FAULT")) -#define ANNOTATION_COOPERATIVE __annotation(W("MODE_COOPERATIVE")) -#define ANNOTATION_MODE_COOPERATIVE __annotation(W("MODE_PREEMPTIVE")) -#define ANNOTATION_MODE_ANY __annotation(W("MODE_ANY")) -#define ANNOTATION_GC_TRIGGERS __annotation(W("GC_TRIGGERS")) -#define ANNOTATION_IGNORE_THROW __annotation(W("THROWS"), W("NOTHROW"), W("CONDITIONAL_EXEMPT")) -#define ANNOTATION_IGNORE_LOCK __annotation(W("CAN_TAKE_LOCK"), W("CANNOT_TAKE_LOCK"), W("CONDITIONAL_EXEMPT")) -#define ANNOTATION_IGNORE_FAULT __annotation(W("FAULT"), W("FORBID_FAULT"), W("CONDITIONAL_EXEMPT")) -#define ANNOTATION_IGNORE_TRIGGER __annotation(W("GC_TRIGGERS"), W("GC_NOTRIGGER"), W("CONDITIONAL_EXEMPT")) -#define ANNOTATION_VIOLATION(violationmask) __annotation(W("VIOLATION(") L#violationmask W(")")) -#define ANNOTATION_UNCHECKED(thecheck) __annotation(W("UNCHECKED(") L#thecheck W(")")) - -#define ANNOTATION_MARK_BLOCK_ANNOTATION __annotation(W("MARK")) -#define ANNOTATION_USE_BLOCK_ANNOTATION __annotation(W("USE")) -#define ANNOTATION_END_USE_BLOCK_ANNOTATION __annotation(W("END_USE")) - -// here is the plan: -// -// a special holder which implements a violation -// - -#define ANNOTATION_FN_SPECIAL_HOLDER_BEGIN __annotation(W("SPECIAL_HOLDER_BEGIN ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_SPECIAL_HOLDER_END __annotation(W("SPECIAL_HOLDER_END")) -#define ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT __annotation(W("SPECIAL_HOLDER_DYNAMIC")) - -#define ANNOTATION_SO_PROBE_BEGIN(probeAmount) __annotation(W("SO_PROBE_BEGIN(") L#probeAmount W(")")) -#define ANNOTATION_SO_PROBE_END __annotation(W("SO_PROBE_END")) - -// -// these annotations are all function-name qualified -// -#define ANNOTATION_FN_LEAF __annotation(W("LEAF ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_WRAPPER __annotation(W("WRAPPER ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_THROWS __annotation(W("THROWS ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_NOTHROW __annotation(W("NOTHROW ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_CAN_TAKE_LOCK __annotation(W("CAN_TAKE_LOCK ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_CANNOT_TAKE_LOCK __annotation(W("CANNOT_TAKE_LOCK ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_FAULT __annotation(W("FAULT ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_FORBID_FAULT __annotation(W("FORBID_FAULT ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_GC_TRIGGERS __annotation(W("GC_TRIGGERS ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_GC_NOTRIGGER __annotation(W("GC_NOTRIGGER ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_MODE_COOPERATIVE __annotation(W("MODE_COOPERATIVE ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_MODE_PREEMPTIVE __annotation(W("MODE_PREEMPTIVE ") SCAN_WIDEN(__FUNCTION__)) -#define ANNOTATION_FN_MODE_ANY __annotation(W("MODE_ANY ") SCAN_WIDEN(__FUNCTION__)) - -#define ANNOTATION_ENTRY_POINT __annotation(W("SO_EP ") SCAN_WIDEN(__FUNCTION__)) - - -// for DacCop -#define ANNOTATION_SUPPORTS_DAC __annotation(W("SUPPORTS_DAC")) -#define ANNOTATION_SUPPORTS_DAC_HOST_ONLY __annotation(W("SUPPORTS_DAC_HOST_ONLY")) - -#ifdef _DEBUG -// @todo : put correct annotation in and fixup the static analysis tool -// This is used to flag debug-only functions that we want to ignore in our static analysis -#define ANNOTATION_DEBUG_ONLY __annotation(W("DBG_ONLY")) - -#endif - -#else // TARGET_X86 - -#define ANNOTATION_TRY_BEGIN { } -#define ANNOTATION_TRY_END { } -#define ANNOTATION_HANDLER_BEGIN { } -#define ANNOTATION_HANDLER_END { } -#define ANNOTATION_NOTHROW { } -#define ANNOTATION_CANNOT_TAKE_LOCK { } -#define ANNOTATION_WRAPPER { } -#define ANNOTATION_FAULT { } -#define ANNOTATION_FORBID_FAULT { } -#define ANNOTATION_COOPERATIVE { } -#define ANNOTATION_MODE_COOPERATIVE { } -#define ANNOTATION_MODE_ANY { } -#define ANNOTATION_GC_TRIGGERS { } -#define ANNOTATION_IGNORE_THROW { } -#define ANNOTATION_IGNORE_LOCK { } -#define ANNOTATION_IGNORE_FAULT { } -#define ANNOTATION_IGNORE_TRIGGER { } -#define ANNOTATION_VIOLATION(violationmask) { } -#define ANNOTATION_UNCHECKED(thecheck) { } - -#define ANNOTATION_TRY_MARKER { } -#define ANNOTATION_CATCH_MARKER { } - -#define ANNOTATION_FN_SPECIAL_HOLDER_BEGIN { } -#define ANNOTATION_SPECIAL_HOLDER_END { } -#define ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT { } - -#define ANNOTATION_FN_LEAF { } -#define ANNOTATION_FN_WRAPPER { } -#define ANNOTATION_FN_THROWS { } -#define ANNOTATION_FN_NOTHROW { } -#define ANNOTATION_FN_CAN_TAKE_LOCK { } -#define ANNOTATION_FN_CANNOT_TAKE_LOCK { } -#define ANNOTATION_FN_FAULT { } -#define ANNOTATION_FN_FORBID_FAULT { } -#define ANNOTATION_FN_GC_TRIGGERS { } -#define ANNOTATION_FN_GC_NOTRIGGER { } -#define ANNOTATION_FN_MODE_COOPERATIVE { } -#define ANNOTATION_FN_MODE_PREEMPTIVE { } -#define ANNOTATION_FN_MODE_ANY { } - -#define ANNOTATION_SUPPORTS_DAC { } -#define ANNOTATION_SUPPORTS_DAC_HOST_ONLY { } - -#define ANNOTATION_SO_PROBE_BEGIN(probeAmount) { } -#define ANNOTATION_SO_PROBE_END { } - -#define ANNOTATION_ENTRY_POINT { } -#ifdef _DEBUG -#define ANNOTATION_DEBUG_ONLY { } -#endif - -#endif // TARGET_X86 - -#define STATIC_CONTRACT_THROWS ANNOTATION_FN_THROWS -#define STATIC_CONTRACT_NOTHROW ANNOTATION_FN_NOTHROW -#define STATIC_CONTRACT_CAN_TAKE_LOCK ANNOTATION_FN_CAN_TAKE_LOCK -#define STATIC_CONTRACT_CANNOT_TAKE_LOCK ANNOTATION_FN_CANNOT_TAKE_LOCK -#define STATIC_CONTRACT_FAULT ANNOTATION_FN_FAULT -#define STATIC_CONTRACT_FORBID_FAULT ANNOTATION_FN_FORBID_FAULT -#define STATIC_CONTRACT_GC_TRIGGERS ANNOTATION_FN_GC_TRIGGERS -#define STATIC_CONTRACT_GC_NOTRIGGER ANNOTATION_FN_GC_NOTRIGGER - -#define STATIC_CONTRACT_SUPPORTS_DAC ANNOTATION_SUPPORTS_DAC -#define STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY ANNOTATION_SUPPORTS_DAC_HOST_ONLY - -#define STATIC_CONTRACT_MODE_COOPERATIVE ANNOTATION_FN_MODE_COOPERATIVE -#define STATIC_CONTRACT_MODE_PREEMPTIVE ANNOTATION_FN_MODE_PREEMPTIVE -#define STATIC_CONTRACT_MODE_ANY ANNOTATION_FN_MODE_ANY -#define STATIC_CONTRACT_LEAF ANNOTATION_FN_LEAF -#define STATIC_CONTRACT_LIMITED_METHOD ANNOTATION_FN_LEAF -#define STATIC_CONTRACT_WRAPPER ANNOTATION_FN_WRAPPER +#define STATIC_CONTRACT_THROWS +#define STATIC_CONTRACT_NOTHROW +#define STATIC_CONTRACT_CAN_TAKE_LOCK +#define STATIC_CONTRACT_CANNOT_TAKE_LOCK +#define STATIC_CONTRACT_FAULT +#define STATIC_CONTRACT_FORBID_FAULT +#define STATIC_CONTRACT_GC_TRIGGERS +#define STATIC_CONTRACT_GC_NOTRIGGER + +#define STATIC_CONTRACT_SUPPORTS_DAC +#define STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY + +#define STATIC_CONTRACT_MODE_COOPERATIVE +#define STATIC_CONTRACT_MODE_PREEMPTIVE +#define STATIC_CONTRACT_MODE_ANY +#define STATIC_CONTRACT_LEAF +#define STATIC_CONTRACT_LIMITED_METHOD +#define STATIC_CONTRACT_WRAPPER #define STATIC_CONTRACT_ENTRY_POINT #ifdef _DEBUG #define STATIC_CONTRACT_DEBUG_ONLY \ - ANNOTATION_DEBUG_ONLY; \ - STATIC_CONTRACT_CANNOT_TAKE_LOCK; \ - ANNOTATION_VIOLATION(TakesLockViolation); + STATIC_CONTRACT_CANNOT_TAKE_LOCK; #else #define STATIC_CONTRACT_DEBUG_ONLY #endif -#define STATIC_CONTRACT_VIOLATION(mask) \ - ANNOTATION_VIOLATION(mask) - -#define SCAN_SCOPE_BEGIN \ - METHOD_CANNOT_BE_FOLDED_DEBUG; \ - ANNOTATION_FN_SPECIAL_HOLDER_BEGIN; - -#define SCAN_SCOPE_END \ - METHOD_CANNOT_BE_FOLDED_DEBUG; \ - ANNOTATION_SPECIAL_HOLDER_END; - -namespace StaticContract -{ - struct ScanThrowMarkerStandard - { - NOINLINE ScanThrowMarkerStandard() - { - METHOD_CANNOT_BE_FOLDED_DEBUG; - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - } - - static void used() - { - } - }; - - struct ScanThrowMarkerTerminal - { - NOINLINE ScanThrowMarkerTerminal() - { - METHOD_CANNOT_BE_FOLDED_DEBUG; - } - - static void used() - { - } - }; - - struct ScanThrowMarkerIgnore - { - NOINLINE ScanThrowMarkerIgnore() - { - METHOD_CANNOT_BE_FOLDED_DEBUG; - } - - static void used() - { - } - }; -} -typedef StaticContract::ScanThrowMarkerStandard ScanThrowMarker; - -// This is used to annotate code as throwing a terminal exception, and should -// be used immediately before the throw so that infer that it can be inferred -// that the block in which this annotation appears throws unconditionally. -#define SCAN_THROW_MARKER do { ScanThrowMarker __throw_marker; } while (0) - -#define SCAN_IGNORE_THROW_MARKER \ - typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; if (0) ScanThrowMarker::used(); - -// Terminal exceptions are asynchronous and cannot be included in THROWS contract -// analysis. As such, this uses typedef to reassign the ScanThrowMarker to a -// non-annotating struct so that SCAN does not see the block as throwing. -#define STATIC_CONTRACT_THROWS_TERMINAL \ - typedef StaticContract::ScanThrowMarkerTerminal ScanThrowMarker; if (0) ScanThrowMarker::used(); - -#ifdef _MSC_VER -#define SCAN_IGNORE_THROW typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; ANNOTATION_IGNORE_THROW -#define SCAN_IGNORE_LOCK ANNOTATION_IGNORE_LOCK -#define SCAN_IGNORE_FAULT ANNOTATION_IGNORE_FAULT -#define SCAN_IGNORE_TRIGGER ANNOTATION_IGNORE_TRIGGER -#else -#define SCAN_IGNORE_THROW -#define SCAN_IGNORE_LOCK -#define SCAN_IGNORE_FAULT -#define SCAN_IGNORE_TRIGGER -#endif - - -// we use BlockMarker's only for SCAN -#if defined(_DEBUG) && defined(TARGET_X86) && !defined(DACCESS_COMPILE) - -template -class BlockMarker -{ -public: - NOINLINE void MarkBlock() - { - ANNOTATION_MARK_BLOCK_ANNOTATION; - METHOD_CANNOT_BE_FOLDED_DEBUG; - return; - } - - NOINLINE void UseMarkedBlockAnnotation() - { - ANNOTATION_USE_BLOCK_ANNOTATION; - METHOD_CANNOT_BE_FOLDED_DEBUG; - return; - } - - NOINLINE void EndUseMarkedBlockAnnotation() - { - ANNOTATION_END_USE_BLOCK_ANNOTATION; - METHOD_CANNOT_BE_FOLDED_DEBUG; - return; - } -}; - -#define SCAN_BLOCKMARKER() BlockMarker<__COUNTER__> __blockMarker_onlyOneAllowedPerScope -#define SCAN_BLOCKMARKER_MARK() __blockMarker_onlyOneAllowedPerScope.MarkBlock() -#define SCAN_BLOCKMARKER_USE() __blockMarker_onlyOneAllowedPerScope.UseMarkedBlockAnnotation() -#define SCAN_BLOCKMARKER_END_USE() __blockMarker_onlyOneAllowedPerScope.EndUseMarkedBlockAnnotation() - -#define SCAN_BLOCKMARKER_N(num) BlockMarker<__COUNTER__> __blockMarker_onlyOneAllowedPerScope##num -#define SCAN_BLOCKMARKER_MARK_N(num) __blockMarker_onlyOneAllowedPerScope##num.MarkBlock() -#define SCAN_BLOCKMARKER_USE_N(num) __blockMarker_onlyOneAllowedPerScope##num.UseMarkedBlockAnnotation() -#define SCAN_BLOCKMARKER_END_USE_N(num) __blockMarker_onlyOneAllowedPerScope##num.EndUseMarkedBlockAnnotation() - -#define SCAN_EHMARKER() BlockMarker<__COUNTER__> __marker_onlyOneAllowedPerScope -#define SCAN_EHMARKER_TRY() __annotation(W("SCOPE(BLOCK);SCAN_TRY_BEGIN")); __marker_onlyOneAllowedPerScope.MarkBlock() -#define SCAN_EHMARKER_END_TRY() __annotation(W("SCOPE(BLOCK);SCAN_TRY_END")) -#define SCAN_EHMARKER_CATCH() __marker_onlyOneAllowedPerScope.UseMarkedBlockAnnotation() -#define SCAN_EHMARKER_END_CATCH() __marker_onlyOneAllowedPerScope.EndUseMarkedBlockAnnotation() - -#else - -#define SCAN_BLOCKMARKER() -#define SCAN_BLOCKMARKER_MARK() -#define SCAN_BLOCKMARKER_USE() -#define SCAN_BLOCKMARKER_END_USE() - -#define SCAN_BLOCKMARKER_N(num) -#define SCAN_BLOCKMARKER_MARK_N(num) -#define SCAN_BLOCKMARKER_USE_N(num) -#define SCAN_BLOCKMARKER_END_USE_N(num) - -#define SCAN_EHMARKER() -#define SCAN_EHMARKER_TRY() -#define SCAN_EHMARKER_END_TRY() -#define SCAN_EHMARKER_CATCH() -#define SCAN_EHMARKER_END_CATCH() - -#endif - +#define STATIC_CONTRACT_VIOLATION(mask) -// -// @todo remove this... if there really are cases where a function just shouldn't have a contract, then perhaps -// we can add a more descriptive name for it... -// -#define CANNOT_HAVE_CONTRACT __annotation(W("NO_CONTRACT")) +#define CANNOT_HAVE_CONTRACT #endif // __STATIC_CONTRACT_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/stdmacros.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/stdmacros.h index 79f922532..917437bde 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/stdmacros.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/stdmacros.h @@ -4,7 +4,7 @@ // // -// common.h - precompiled headers include for the COM+ Execution Engine +// common.h - precompiled headers include for the CLR Execution Engine // // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/stgpool.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/stgpool.h index 39390a201..3293fb59b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/stgpool.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/stgpool.h @@ -49,6 +49,8 @@ class StgStringPool; class StgBlobPool; class StgCodePool; +template struct cdac_data; + // Perform binary search on index table. // class RIDBinarySearch : public CBinarySearch @@ -188,12 +190,6 @@ friend class VerifyLayoutsMD; virtual int IsValidCookie(UINT32 nCookie) { WRAPPER_NO_CONTRACT; return (IsValidOffset(nCookie)); } - -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:6387) // Suppress PREFast warning: '*pszString' might be '0': this does not adhere to the specification for the function - // *pszString may be NULL only if method fails, but warning 6387 doesn't respect __success(SUCCEEDED(return)) which is part of HRESULT definition -#endif //***************************************************************************** // Return a pointer to a null terminated string given an offset previously // handed out by AddString or FindString. @@ -217,7 +213,7 @@ friend class VerifyLayoutsMD; &stringData)); _ASSERTE(hr == S_OK); // Raw data are always at least 1 byte long, otherwise it would be invalid offset and hr != S_OK - PREFAST_ASSUME(stringData.GetDataPointer() != NULL); + _ASSERTE(stringData.GetDataPointer() != NULL); // Fills output string *pszString = reinterpret_cast(stringData.GetDataPointer()); //_ASSERTE(stringData.GetSize() > strlen(*pszString)); @@ -253,7 +249,7 @@ friend class VerifyLayoutsMD; &stringData)); _ASSERTE(hr == S_OK); // Raw data are always at least 1 byte long, otherwise it would be invalid offset and hr != S_OK - PREFAST_ASSUME(stringData.GetDataPointer() != NULL); + _ASSERTE(stringData.GetDataPointer() != NULL); // Fills output string *pszString = reinterpret_cast(stringData.GetDataPointer()); //_ASSERTE(stringData.GetSize() > strlen(*pszString)); @@ -265,9 +261,6 @@ friend class VerifyLayoutsMD; return hr; } -#ifdef _PREFAST_ -#pragma warning(pop) -#endif //***************************************************************************** // Convert a string to UNICODE into the caller's buffer. @@ -1500,6 +1493,15 @@ class CGrowableStream : public IStream IStream ** ppstm); #endif // DACCESS_COMPILE + + friend struct cdac_data; }; // class CGrowableStream +template<> +struct cdac_data +{ + static constexpr size_t Buffer = offsetof(CGrowableStream, m_swBuffer); + static constexpr size_t Size = offsetof(CGrowableStream, m_dwBufferSize); +}; + #endif // __StgPool_h__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/stresslog.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/stresslog.h index 39a0d6c5b..9219a4b32 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/stresslog.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/stresslog.h @@ -17,9 +17,10 @@ extension (eg. strike). There is no memory allocation system calls etc to purtub things */ // ****************************************************************************** -// WARNING!!!: These classes are used by SOS in the diagnostics repo. Values should -// added or removed in a backwards and forwards compatible way. +// WARNING!!!: These classes are used by the runtime and SOS in the diagnostics +// repo. Values should added or removed in a backwards and forwards compatible way. // See: https://github.com/dotnet/diagnostics/blob/main/src/shared/inc/stresslog.h +// https://github.com/dotnet/runtime/blob/main/src/coreclr/inc/stresslog.h // Parser: https://github.com/dotnet/diagnostics/blob/main/src/SOS/Strike/stressLogDump.cpp // ****************************************************************************** @@ -31,7 +32,6 @@ #include "log.h" #if defined(STRESS_LOG) && !defined(FEATURE_NO_STRESSLOG) -#ifndef STRESS_LOG_ANALYZER #include "holder.h" #include "staticcontract.h" #include "mscoree.h" @@ -45,9 +45,6 @@ #ifndef _ASSERTE #define _ASSERTE(expr) #endif -#else -#include // offsetof -#endif // STRESS_LOG_ANALYZER /* The STRESS_LOG* macros work like printf. In fact the use printf in their implementation so all printf format specifications work. In addition the Stress log dumper knows @@ -78,7 +75,7 @@ #define STRESS_LOG0(facility, level, msg) do { \ if (StressLog::StressLogOn(facility, level)) \ - StressLog::LogMsg(facility, level, 0, msg); \ + StressLog::LogMsg(level, facility, 0, msg); \ } while(0) #define STRESS_LOG1(facility, level, msg, data1) \ @@ -171,6 +168,9 @@ void ReplacePid(LPCWSTR original, LPWSTR replaced, size_t replacedLength); +template +struct cdac_offsets; + class ThreadStressLog; struct StressLogMsg; @@ -179,12 +179,12 @@ struct StressLogMsg; /* a log is a circular queue of messages */ class StressLog { + template friend struct ::cdac_offsets; public: static void Initialize(unsigned facilities, unsigned level, unsigned maxBytesPerThread, unsigned maxBytesTotal, void* moduleBase, LPWSTR logFilename = nullptr); static void Terminate(BOOL fProcessDetach=FALSE); static void ThreadDetach(); // call at DllMain THREAD_DETACH if you want to recycle thread logs -#ifndef STRESS_LOG_ANALYZER static int NewChunk () { return InterlockedIncrement (&theLog.totalChunk); @@ -193,7 +193,6 @@ class StressLog { { return InterlockedDecrement (&theLog.totalChunk); } -#endif //STRESS_LOG_ANALYZER //the result is not 100% accurate. If multiple threads call this function at the same time, //we could allow the total size be bigger than required. But the memory won't grow forever @@ -245,28 +244,6 @@ class StressLog { #endif #endif -#ifdef STRESS_LOG_ANALYZER - static size_t writing_base_address; - static size_t reading_base_address; - - template - static T* TranslateMemoryMappedPointer(T* input) - { - if (input == nullptr) - { - return nullptr; - } - - return ((T*)(((uint8_t*)input) - writing_base_address + reading_base_address)); - } -#else - template - static T* TranslateMemoryMappedPointer(T* input) - { - return input; - } -#endif - #ifdef MEMORY_MAPPED_STRESSLOG // @@ -370,19 +347,24 @@ typedef USHORT static StressLog theLog; // We only have one log, and this is it }; - -template<> -void* StressLog::ConvertArgument(float arg) = delete; - #if TARGET_64BIT template<> inline void* StressLog::ConvertArgument(double arg) { return (void*)(size_t)(*((uint64_t*)&arg)); } + +// COMPAT: Convert 32-bit floats to 64-bit doubles. +template<> +inline void* StressLog::ConvertArgument(float arg) +{ + return StressLog::ConvertArgument((double)arg); +} #else template<> void* StressLog::ConvertArgument(double arg) = delete; +template<> +void* StressLog::ConvertArgument(float arg) = delete; // COMPAT: Truncate 64-bit integer arguments to 32-bit template<> @@ -398,9 +380,7 @@ inline void* StressLog::ConvertArgument(int64_t arg) } #endif -#ifndef STRESS_LOG_ANALYZER typedef Holder> StressLogLockHolder; -#endif //!STRESS_LOG_ANALYZER #if defined(DACCESS_COMPILE) inline BOOL StressLog::LogOn(unsigned facility, unsigned level) @@ -413,6 +393,30 @@ inline BOOL StressLog::LogOn(unsigned facility, unsigned level) } #endif +template<> +struct cdac_offsets +{ + static constexpr size_t facilitiesToLog = offsetof(StressLog, facilitiesToLog); + static constexpr size_t levelToLog = offsetof(StressLog, levelToLog); + static constexpr size_t MaxSizePerThread = offsetof(StressLog, MaxSizePerThread); + static constexpr size_t MaxSizeTotal = offsetof(StressLog, MaxSizeTotal); + static constexpr size_t totalChunk = offsetof(StressLog, totalChunk); + static constexpr size_t logs = offsetof(StressLog, logs); + static constexpr size_t tickFrequency = offsetof(StressLog, tickFrequency); + static constexpr size_t startTimeStamp = offsetof(StressLog, startTimeStamp); + static constexpr size_t startTime = offsetof(StressLog, startTime); + static constexpr size_t moduleOffset = offsetof(StressLog, moduleOffset); + static constexpr size_t MAX_MODULES = StressLog::MAX_MODULES; + static constexpr size_t modules = offsetof(StressLog, modules); + + struct ModuleDesc + { + static constexpr size_t type_size = sizeof(StressLog::ModuleDesc); + static constexpr size_t baseAddress = offsetof(StressLog::ModuleDesc, baseAddress); + static constexpr size_t size = offsetof(StressLog::ModuleDesc, size); + }; +}; + /*************************************************************************************/ /* private classes */ @@ -480,10 +484,9 @@ struct StressMsg timeStamp = time; } - static const size_t maxArgCnt = 63; + static constexpr size_t maxArgCnt = 63; static const int64_t maxOffset = (int64_t)1 << (formatOffsetLowBits + formatOffsetHighBits); - static size_t maxMsgSize () - { return sizeof(StressMsg) + maxArgCnt*sizeof(void*); } + static constexpr size_t maxMsgSize = sizeof(uint64_t) * 2 + maxArgCnt * sizeof(void*); }; static_assert(sizeof(StressMsg) == sizeof(uint64_t) * 2, "StressMsg bitfields aren't aligned correctly"); @@ -549,7 +552,7 @@ struct StressLogChunk #endif //!STRESS_LOG_READONLY StressLogChunk (StressLogChunk * p = NULL, StressLogChunk * n = NULL) - :prev (p), next (n), dwSig1 (0xCFCFCFCF), dwSig2 (0xCFCFCFCF) + :prev (p), next (n), dwSig1 (ValidChunkSig), dwSig2 (ValidChunkSig) {} char * StartPtr () @@ -564,8 +567,10 @@ struct StressLogChunk BOOL IsValid () const { - return dwSig1 == 0xCFCFCFCF && dwSig2 == 0xCFCFCFCF; + return dwSig1 == ValidChunkSig && dwSig2 == ValidChunkSig; } + + static constexpr uint32_t ValidChunkSig = 0xCFCFCFCF; }; // This class implements a circular stack of variable sized elements @@ -581,9 +586,7 @@ struct StressLogChunk // readPtr / curPtr fields. thecaller is responsible for reading/writing // to the corresponding field class ThreadStressLog { -#ifdef STRESS_LOG_ANALYZER -public: -#endif + template friend struct ::cdac_offsets; ThreadStressLog* next; // we keep a linked list of these uint64_t threadId; // the id for the thread using this buffer uint8_t isDead; // Is this thread dead @@ -612,7 +615,7 @@ class ThreadStressLog { #endif //STRESS_LOG_READONLY friend class StressLog; -#if !defined(STRESS_LOG_READONLY) && !defined(STRESS_LOG_ANALYZER) +#if !defined(STRESS_LOG_READONLY) FORCEINLINE BOOL GrowChunkList () { _ASSERTE (chunkListLength >= 1); @@ -633,10 +636,10 @@ class ThreadStressLog { return TRUE; } -#endif //!STRESS_LOG_READONLY && !STRESS_LOG_ANALYZER +#endif //!STRESS_LOG_READONLY public: -#if !defined(STRESS_LOG_READONLY) && !defined(STRESS_LOG_ANALYZER) +#if !defined(STRESS_LOG_READONLY) ThreadStressLog () { chunkListHead = chunkListTail = curWriteChunk = NULL; @@ -664,9 +667,9 @@ class ThreadStressLog { chunkListLength = 1; } -#endif //!STRESS_LOG_READONLY && !STRESS_LOG_ANALYZER +#endif //!STRESS_LOG_READONLY -#if defined(MEMORY_MAPPED_STRESSLOG) && !defined(STRESS_LOG_ANALYZER) +#if defined(MEMORY_MAPPED_STRESSLOG) void* __cdecl operator new(size_t n, const std::nothrow_t&) noexcept; void __cdecl operator delete (void * chunk); #endif @@ -678,9 +681,9 @@ class ThreadStressLog { { return; } -#if !defined(STRESS_LOG_READONLY) && !defined(STRESS_LOG_ANALYZER) +#if !defined(STRESS_LOG_READONLY) _ASSERTE (chunkListLength >= 1 && chunkListLength <= StressLog::theLog.totalChunk); -#endif //!STRESS_LOG_READONLY && !STRESS_LOG_ANALYZER +#endif //!STRESS_LOG_READONLY StressLogChunk * chunk = chunkListHead; do @@ -688,9 +691,9 @@ class ThreadStressLog { StressLogChunk * tmp = chunk; chunk = chunk->next; delete tmp; -#if !defined(STRESS_LOG_READONLY) && !defined(STRESS_LOG_ANALYZER) +#if !defined(STRESS_LOG_READONLY) StressLog::ChunkDeleted (); -#endif //!STRESS_LOG_READONLY && !STRESS_LOG_ANALYZER +#endif //!STRESS_LOG_READONLY } while (chunk != chunkListHead); } @@ -711,7 +714,7 @@ class ThreadStressLog { // a previous record. Update curPtr to reflect the last safe beginning of a record, // but curPtr shouldn't wrap around, otherwise it'll break our assumptions about stress // log - curPtr = (StressMsg*)((char*)curPtr - StressMsg::maxMsgSize()); + curPtr = (StressMsg*)((char*)curPtr - StressMsg::maxMsgSize); if (curPtr < (StressMsg*)curWriteChunk->StartPtr()) { curPtr = (StressMsg *)curWriteChunk->StartPtr(); @@ -726,7 +729,7 @@ class ThreadStressLog { BOOL IsValid () const { - return chunkListHead != NULL && (!curWriteChunk || StressLog::TranslateMemoryMappedPointer(curWriteChunk)->IsValid ()); + return chunkListHead != NULL && (!curWriteChunk || curWriteChunk->IsValid ()); } #ifdef STRESS_LOG_READONLY @@ -758,6 +761,18 @@ class ThreadStressLog { #endif //STRESS_LOG_READONLY }; +template<> +struct cdac_offsets +{ + static const size_t next = offsetof(ThreadStressLog, next); + static const size_t threadId = offsetof(ThreadStressLog, threadId); + static const size_t writeHasWrapped = offsetof(ThreadStressLog, writeHasWrapped); + static const size_t curPtr = offsetof(ThreadStressLog, curPtr); + static const size_t chunkListHead = offsetof(ThreadStressLog, chunkListHead); + static const size_t chunkListTail = offsetof(ThreadStressLog, chunkListTail); + static const size_t curWriteChunk = offsetof(ThreadStressLog, curWriteChunk); +}; + #ifdef STRESS_LOG_READONLY /*********************************************************************************/ // Called when dumping the log (by StressLog::Dump()) @@ -793,7 +808,7 @@ inline StressMsg* ThreadStressLog::AdvReadPastBoundary() { } curReadChunk = curReadChunk->next; void** p = (void**)curReadChunk->StartPtr(); - while (*p == NULL && (size_t)(p-(void**)curReadChunk->StartPtr()) < (StressMsg::maxMsgSize() / sizeof(void*))) + while (*p == NULL && (size_t)(p-(void**)curReadChunk->StartPtr()) < (StressMsg::maxMsgSize / sizeof(void*))) { ++p; } @@ -838,7 +853,7 @@ inline StressMsg* ThreadStressLog::AdvanceWrite(int cArgs) { // In addition it writes NULLs b/w the startPtr and curPtr inline StressMsg* ThreadStressLog::AdvWritePastBoundary(int cArgs) { STATIC_CONTRACT_WRAPPER; -#if !defined(STRESS_LOG_READONLY) && !defined(STRESS_LOG_ANALYZER) +#if !defined(STRESS_LOG_READONLY) //zeroed out remaining buffer memset (curWriteChunk->StartPtr (), 0, (BYTE *)curPtr - (BYTE *)curWriteChunk->StartPtr ()); @@ -847,7 +862,7 @@ inline StressMsg* ThreadStressLog::AdvWritePastBoundary(int cArgs) { { GrowChunkList (); } -#endif //!STRESS_LOG_READONLY && !STRESS_LOG_ANALYZER +#endif //!STRESS_LOG_READONLY curWriteChunk = curWriteChunk->prev; #ifndef STRESS_LOG_READONLY diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/strongnameholders.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/strongnameholders.h deleted file mode 100644 index 6d687c0f3..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/strongnameholders.h +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#ifndef __STRONGNAME_HOLDERS_H__ -#define __STRONGNAME_HOLDERS_H__ - -#include -#include - -// -// Holder classes for types returned from and used in strong name APIs -// - -// Holder for any memory allocated by the strong name APIs -template -void VoidStrongNameFreeBuffer(_In_ T *pBuffer) -{ - StrongNameFreeBuffer(reinterpret_cast(pBuffer)); -} -template -using StrongNameBufferHolder = SpecializedWrapper<_TYPE, VoidStrongNameFreeBuffer<_TYPE>>; - -#endif // !__STRONGNAME_HOLDERS_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/switches.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/switches.h index 06fdaa5f3..7915e0944 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/switches.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/switches.h @@ -43,13 +43,15 @@ #define GC_STATS #endif -#if defined(TARGET_X86) || defined(TARGET_ARM) +#if defined(TARGET_X86) || defined(TARGET_ARM) || defined(TARGET_BROWSER) #define USE_LAZY_PREFERRED_RANGE 0 -#elif defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_S390X) || defined(TARGET_LOONGARCH64) || defined(TARGET_POWERPC64) || defined(TARGET_RISCV64) +#elif defined(TARGET_64BIT) + +#define FEATURE_ON_STACK_REPLACEMENT #if defined(HOST_UNIX) - // In PAL we have a smechanism that reserves memory on start up that is + // In PAL we have a mechanism that reserves memory on start up that is // close to libcoreclr and intercepts calls to VirtualAlloc to serve back // from this area. #define USE_LAZY_PREFERRED_RANGE 0 @@ -144,17 +146,26 @@ #define FEATURE_HFA #endif -// ARM requires that 64-bit primitive types are aligned at 64-bit boundaries for interlocked-like operations. -// Additionally the platform ABI requires these types and composite type containing them to be similarly -// aligned when passed as arguments. -#ifdef TARGET_ARM +// Some 32-bit platform ABIs require that 64-bit primitive types and composite types containing them are aligned at 64-bit boundaries. +#if defined(TARGET_ARM) || defined(TARGET_WASM) #define FEATURE_64BIT_ALIGNMENT #endif -// Prefer double alignment for structs and arrays with doubles. Put arrays of doubles more agressively -// into large object heap for performance because large object heap is 8 byte aligned +// Prefer double alignment for structs with doubles on the stack. #if !defined(FEATURE_64BIT_ALIGNMENT) && !defined(HOST_64BIT) #define FEATURE_DOUBLE_ALIGNMENT_HINT #endif #define FEATURE_MINIMETADATA_IN_TRIAGEDUMPS + +#ifdef FEATURE_VIRTUAL_STUB_DISPATCH +#define CHAIN_LOOKUP +#endif // FEATURE_VIRTUAL_STUB_DISPATCH + +// If this is uncommented, leaves a file "StubLog_.log" with statistics on the behavior +// of stub-based interface dispatch. +//#define STUB_LOGGING + +#ifdef TARGET_WASM +#define PEIMAGE_FLAT_LAYOUT_ONLY +#endif // !TARGET_WASM diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/targetosarch.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/targetosarch.h index 06f22d8ee..217db1de7 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/targetosarch.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/targetosarch.h @@ -22,7 +22,7 @@ class TargetOS static bool OSSettingConfigured; static bool IsApplePlatform; #else -#if defined(TARGET_OSX) +#if defined(TARGET_APPLE) static const bool IsApplePlatform = true; #else static const bool IsApplePlatform = false; @@ -95,6 +95,14 @@ class TargetArchitecture static const bool IsArmArch = false; static const bool IsLoongArch64 = false; static const bool IsRiscV64 = true; +#elif defined(TARGET_WASM) + static const bool IsX86 = false; + static const bool IsX64 = false; + static const bool IsArm64 = false; + static const bool IsArm32 = false; + static const bool IsArmArch = false; + static const bool IsLoongArch64 = false; + static const bool IsRiscV64 = false; #else #error Unknown architecture #endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/thekey.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/thekey.h deleted file mode 100644 index a972e2ca5..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/thekey.h +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -#pragma once -// This file allows customization of the strongname key used to replace the ECMA key - -static const BYTE g_rbTheKey[] = -{ -0x00,0x24,0x00,0x00,0x04,0x80,0x00,0x00,0x94,0x00,0x00,0x00,0x06,0x02,0x00,0x00, -0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x04,0x00,0x00,0x01,0x00,0x01,0x00, -0x07,0xd1,0xfa,0x57,0xc4,0xae,0xd9,0xf0,0xa3,0x2e,0x84,0xaa,0x0f,0xae,0xfd,0x0d, -0xe9,0xe8,0xfd,0x6a,0xec,0x8f,0x87,0xfb,0x03,0x76,0x6c,0x83,0x4c,0x99,0x92,0x1e, -0xb2,0x3b,0xe7,0x9a,0xd9,0xd5,0xdc,0xc1,0xdd,0x9a,0xd2,0x36,0x13,0x21,0x02,0x90, -0x0b,0x72,0x3c,0xf9,0x80,0x95,0x7f,0xc4,0xe1,0x77,0x10,0x8f,0xc6,0x07,0x77,0x4f, -0x29,0xe8,0x32,0x0e,0x92,0xea,0x05,0xec,0xe4,0xe8,0x21,0xc0,0xa5,0xef,0xe8,0xf1, -0x64,0x5c,0x4c,0x0c,0x93,0xc1,0xab,0x99,0x28,0x5d,0x62,0x2c,0xaa,0x65,0x2c,0x1d, -0xfa,0xd6,0x3d,0x74,0x5d,0x6f,0x2d,0xe5,0xf1,0x7e,0x5e,0xaf,0x0f,0xc4,0x96,0x3d, -0x26,0x1c,0x8a,0x12,0x43,0x65,0x18,0x20,0x6d,0xc0,0x93,0x34,0x4d,0x5a,0xd2,0x93 -}; - -static const BYTE g_rbTheKeyToken[] = {0xb0,0x3f,0x5f,0x7f,0x11,0xd5,0x0a,0x3a}; - - -static const BYTE g_rbTheSilverlightPlatformKey[] = -{ -0x00,0x24,0x00,0x00,0x04,0x80,0x00,0x00,0x94,0x00,0x00,0x00,0x06,0x02,0x00,0x00, -0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x04,0x00,0x00,0x01,0x00,0x01,0x00, -0x8d,0x56,0xc7,0x6f,0x9e,0x86,0x49,0x38,0x30,0x49,0xf3,0x83,0xc4,0x4b,0xe0,0xec, -0x20,0x41,0x81,0x82,0x2a,0x6c,0x31,0xcf,0x5e,0xb7,0xef,0x48,0x69,0x44,0xd0,0x32, -0x18,0x8e,0xa1,0xd3,0x92,0x07,0x63,0x71,0x2c,0xcb,0x12,0xd7,0x5f,0xb7,0x7e,0x98, -0x11,0x14,0x9e,0x61,0x48,0xe5,0xd3,0x2f,0xba,0xab,0x37,0x61,0x1c,0x18,0x78,0xdd, -0xc1,0x9e,0x20,0xef,0x13,0x5d,0x0c,0xb2,0xcf,0xf2,0xbf,0xec,0x3d,0x11,0x58,0x10, -0xc3,0xd9,0x06,0x96,0x38,0xfe,0x4b,0xe2,0x15,0xdb,0xf7,0x95,0x86,0x19,0x20,0xe5, -0xab,0x6f,0x7d,0xb2,0xe2,0xce,0xef,0x13,0x6a,0xc2,0x3d,0x5d,0xd2,0xbf,0x03,0x17, -0x00,0xae,0xc2,0x32,0xf6,0xc6,0xb1,0xc7,0x85,0xb4,0x30,0x5c,0x12,0x3b,0x37,0xab -}; - -static const BYTE g_rbTheSilverlightPlatformKeyToken[] = {0x7c,0xec,0x85,0xd7,0xbe,0xa7,0x79,0x8e}; - -static const BYTE g_rbTheSilverlightKey[] = -{ -0x00,0x24,0x00,0x00,0x04,0x80,0x00,0x00,0x94,0x00,0x00,0x00,0x06,0x02,0x00,0x00, -0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x04,0x00,0x00,0x01,0x00,0x01,0x00, -0xb5,0xfc,0x90,0xe7,0x02,0x7f,0x67,0x87,0x1e,0x77,0x3a,0x8f,0xde,0x89,0x38,0xc8, -0x1d,0xd4,0x02,0xba,0x65,0xb9,0x20,0x1d,0x60,0x59,0x3e,0x96,0xc4,0x92,0x65,0x1e, -0x88,0x9c,0xc1,0x3f,0x14,0x15,0xeb,0xb5,0x3f,0xac,0x11,0x31,0xae,0x0b,0xd3,0x33, -0xc5,0xee,0x60,0x21,0x67,0x2d,0x97,0x18,0xea,0x31,0xa8,0xae,0xbd,0x0d,0xa0,0x07, -0x2f,0x25,0xd8,0x7d,0xba,0x6f,0xc9,0x0f,0xfd,0x59,0x8e,0xd4,0xda,0x35,0xe4,0x4c, -0x39,0x8c,0x45,0x43,0x07,0xe8,0xe3,0x3b,0x84,0x26,0x14,0x3d,0xae,0xc9,0xf5,0x96, -0x83,0x6f,0x97,0xc8,0xf7,0x47,0x50,0xe5,0x97,0x5c,0x64,0xe2,0x18,0x9f,0x45,0xde, -0xf4,0x6b,0x2a,0x2b,0x12,0x47,0xad,0xc3,0x65,0x2b,0xf5,0xc3,0x08,0x05,0x5d,0xa9 -}; - -static const BYTE g_rbTheSilverlightKeyToken[] = {0x31,0xBF,0x38,0x56,0xAD,0x36,0x4E,0x35}; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/unreachable.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/unreachable.h index a770209ab..7cb857a17 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/unreachable.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/unreachable.h @@ -8,7 +8,7 @@ #ifndef __UNREACHABLE_H__ #define __UNREACHABLE_H__ -#if defined(_MSC_VER) || defined(_PREFIX_) +#if defined(_MSC_VER) #define __UNREACHABLE() __assume(0) #else #define __UNREACHABLE() __builtin_unreachable() diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/utilcode.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/utilcode.h index 9eefb4787..6c7023f32 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/utilcode.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/utilcode.h @@ -35,7 +35,9 @@ using std::nothrow; #include "contract.h" -#include +#include +#include +#include #include #include "clrnt.h" @@ -47,12 +49,8 @@ using std::nothrow; #define CoreLibName_W W("System.Private.CoreLib") #define CoreLibName_IL_W W("System.Private.CoreLib.dll") -#define CoreLibName_NI_W W("System.Private.CoreLib.ni.dll") -#define CoreLibName_TLB_W W("System.Private.CoreLib.tlb") #define CoreLibName_A "System.Private.CoreLib" #define CoreLibName_IL_A "System.Private.CoreLib.dll" -#define CoreLibName_NI_A "System.Private.CoreLib.ni.dll" -#define CoreLibName_TLB_A "System.Private.CoreLib.tlb" #define CoreLibNameLen 22 #define CoreLibSatelliteName_A "System.Private.CoreLib.resources" #define CoreLibSatelliteNameLen 32 @@ -149,14 +147,10 @@ typedef LPSTR LPUTF8; #endif #endif -#include // for offsetof -#include - #define IS_DIGIT(ch) (((ch) >= W('0')) && ((ch) <= W('9'))) #define DIGIT_TO_INT(ch) ((ch) - W('0')) #define INT_TO_DIGIT(i) ((WCHAR)(W('0') + (i))) - // Helper will 4 byte align a value, rounding up. #define ALIGN4BYTE(val) (((val) + 3) & ~0x3) @@ -225,8 +219,10 @@ typedef LPSTR LPUTF8; } \ LPSTR ptrname = (LPSTR)__CQuickBytes##ptrname.Ptr() +// ptrname will be deleted when it goes out of scope. #define MAKE_UTF8PTR_FROMWIDE(ptrname, widestr) CQuickBytes _##ptrname; _##ptrname.ConvertUnicode_Utf8(widestr); LPSTR ptrname = (LPSTR) _##ptrname.Ptr(); +// ptrname will be deleted when it goes out of scope. #define MAKE_UTF8PTR_FROMWIDE_NOTHROW(ptrname, widestr) \ CQuickBytes __qb##ptrname; \ int __l##ptrname = (int)u16_strlen(widestr); \ @@ -483,7 +479,7 @@ class CCulturedHInstance void AddThreadPreferredUILanguages(StringArrayList* pArray); #endif //***************************************************************************** -// CCompRC manages string Resource access for COM+. This includes loading +// CCompRC manages string Resource access for CLR. This includes loading // the MsCorRC.dll for resources as well allowing each thread to use a // a different localized version. //***************************************************************************** @@ -729,8 +725,6 @@ void SplitPathInterior( #include "ostype.h" -#define CLRGetTickCount64() GetTickCount64() - // // Allocate free memory within the range [pMinAddr..pMaxAddr] using // ClrVirtualQuery to find free memory and ClrVirtualAlloc to allocate it. @@ -850,13 +844,14 @@ inline void SetBit(BYTE * pcBits,int iBit,int bOn) #endif template -class SimpleListNode +class SimpleListNode final { public: - SimpleListNode(const T& _t) + SimpleListNode(T const& _t) + : data{ _t } + , next{} { - data = _t; - next = 0; + LIMITED_METHOD_CONTRACT; } T data; @@ -864,44 +859,46 @@ class SimpleListNode }; template -class SimpleList +class SimpleList final { public: - typedef SimpleListNode NodeType; + typedef SimpleListNode Node; SimpleList() + : _head{} { - head = NULL; + LIMITED_METHOD_CONTRACT; } - void LinkHead(NodeType* pNode) + void LinkHead(Node* pNode) { - pNode->next = head; - head = pNode; + LIMITED_METHOD_CONTRACT; + pNode->next = _head; + _head = pNode; } - NodeType* UnlinkHead() + Node* UnlinkHead() { - NodeType* ret = head; + LIMITED_METHOD_CONTRACT; + Node* ret = _head; - if (head) + if (_head) { - head = head->next; + _head = _head->next; } return ret; } - NodeType* Head() + Node* Head() { - return head; + LIMITED_METHOD_CONTRACT; + return _head; } -protected: - - NodeType* head; +private: + Node* _head; }; - //***************************************************************************** // This class implements a dynamic array of structures for which the order of // the elements is unimportant. This means that any item placed in the list @@ -943,6 +940,37 @@ class CUnorderedArrayWithAllocator ALLOCATOR::Free(this, m_pTable); } + CUnorderedArrayWithAllocator(CUnorderedArrayWithAllocator const&) = delete; + CUnorderedArrayWithAllocator& operator=(CUnorderedArrayWithAllocator const&) = delete; + CUnorderedArrayWithAllocator(CUnorderedArrayWithAllocator&& other) + : m_iCount{ 0 } + , m_iSize{ 0 } + , m_pTable{ NULL} + { + LIMITED_METHOD_CONTRACT; + other.m_iCount = 0; + other.m_iSize = 0; + other.m_pTable = NULL; + } + CUnorderedArrayWithAllocator& operator=(CUnorderedArrayWithAllocator&& other) + { + LIMITED_METHOD_CONTRACT; + if (this != &other) + { + if (m_pTable != NULL) + ALLOCATOR::Free(this, m_pTable); + + m_iCount = other.m_iCount; + m_iSize = other.m_iSize; + m_pTable = other.m_pTable; + + other.m_iCount = 0; + other.m_iSize = 0; + other.m_pTable = NULL; + } + return *this; + } + void Clear() { WRAPPER_NO_CONTRACT; @@ -1063,12 +1091,11 @@ class CUnorderedArrayWithAllocator #endif // #ifndef DACCESS_COMPILE - USHORT Count() + INT32 Count() { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - _ASSERTE(FitsIn(m_iCount)); - return static_cast(m_iCount); + return m_iCount; } private: @@ -2885,7 +2912,6 @@ class MethodNamesListBase MethodName *pNames; // List of names - bool IsInList(LPCUTF8 methodName, LPCUTF8 className, int numArgs); public: void Init() @@ -2894,7 +2920,7 @@ class MethodNamesListBase pNames = 0; } - void Init(_In_ _In_z_ LPWSTR list) + void Init(_In_z_ LPWSTR list) { WRAPPER_NO_CONTRACT; pNames = 0; @@ -2903,9 +2929,9 @@ class MethodNamesListBase void Destroy(); - void Insert(_In_ _In_z_ LPWSTR list); + void Insert(_In_z_ LPWSTR list); - bool IsInList(LPCUTF8 methodName, LPCUTF8 className, PCCOR_SIGNATURE sig = NULL); + bool IsInList(LPCUTF8 methodName, LPCUTF8 className, int numArgs = -1); bool IsInList(LPCUTF8 methodName, LPCUTF8 className, CORINFO_SIG_INFO* pSigInfo); bool IsEmpty() { @@ -3009,7 +3035,7 @@ class ConfigMethodSet return m_list.IsEmpty(); } - bool contains(LPCUTF8 methodName, LPCUTF8 className, PCCOR_SIGNATURE sig = NULL); + bool contains(LPCUTF8 methodName, LPCUTF8 className, int argCount = -1); bool contains(LPCUTF8 methodName, LPCUTF8 className, CORINFO_SIG_INFO* pSigInfo); inline void ensureInit(const CLRConfig::ConfigStringInfo & info) @@ -3030,23 +3056,6 @@ class ConfigMethodSet BYTE m_inited; }; -// 38 characters + 1 null terminating. -#define GUID_STR_BUFFER_LEN (ARRAY_SIZE("{12345678-1234-1234-1234-123456789abc}")) - -//***************************************************************************** -// Convert a GUID into a pointer to a string -//***************************************************************************** -int GuidToLPSTR( - REFGUID guid, // [IN] The GUID to convert. - LPSTR szGuid, // [OUT] String into which the GUID is stored - DWORD cchGuid); // [IN] Size in chars of szGuid - -template -int GuidToLPSTR(REFGUID guid, CHAR (&s)[N]) -{ - return GuidToLPSTR(guid, s, N); -} - //***************************************************************************** // Convert a pointer to a string into a GUID. //***************************************************************************** @@ -3098,35 +3107,58 @@ class RangeList return this->AddRangeWorker(start, end, id); } - void RemoveRanges(void *id, const BYTE *start = NULL, const BYTE *end = NULL) + void RemoveRanges(void *id) { - return this->RemoveRangesWorker(id, start, end); + return this->RemoveRangesWorker(id); } - BOOL IsInRange(TADDR address, TADDR *pID = NULL) + BOOL IsInRange(TADDR address) { SUPPORTS_DAC; - return this->IsInRangeWorker(address, pID); + return this->IsInRangeWorker(address); } #ifndef DACCESS_COMPILE // You can overload these two for synchronization (as LockedRangeList does) virtual BOOL AddRangeWorker(const BYTE *start, const BYTE *end, void *id); - // If both "start" and "end" are NULL, then this method deletes all ranges with - // the given id (i.e. the original behaviour). Otherwise, it ignores the given - // id and deletes all ranges falling in the region [start, end). - virtual void RemoveRangesWorker(void *id, const BYTE *start = NULL, const BYTE *end = NULL); + // Deletes all ranges with the given id + virtual void RemoveRangesWorker(void *id); #else virtual BOOL AddRangeWorker(const BYTE *start, const BYTE *end, void *id) { return TRUE; } - virtual void RemoveRangesWorker(void *id, const BYTE *start = NULL, const BYTE *end = NULL) { } + virtual void RemoveRangesWorker(void *id) { } #endif // !DACCESS_COMPILE - virtual BOOL IsInRangeWorker(TADDR address, TADDR *pID = NULL); + virtual BOOL IsInRangeWorker(TADDR address); + + template + void ForEachInRangeWorker(TADDR address, F func) const + { + CONTRACTL + { + INSTANCE_CHECK; + NOTHROW; + FORBID_FAULT; + GC_NOTRIGGER; + } + CONTRACTL_END + + SUPPORTS_DAC; + + for (const RangeListBlock* b = &m_starterBlock; b != nullptr; b = b->next) + { + for (const Range r : b->ranges) + { + if (r.id != (TADDR)nullptr && address >= r.start && address < r.end) + func(r.id); + } + } + } + #ifdef DACCESS_COMPILE void EnumMemoryRegions(enum CLRDataEnumMemoryFlags flags); @@ -3196,14 +3228,6 @@ inline HRESULT FakeCoCreateInstance(REFCLSID rclsid, return FakeCoCreateInstanceEx(rclsid, NULL, riid, ppv, NULL); }; -//***************************************************************************** -// Gets the directory based on the location of the module. This routine -// is called at COR setup time. Set is called during EEStartup and by the -// MetaData dispenser. -//***************************************************************************** -HRESULT GetInternalSystemDirectory(_Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength); -LPCWSTR GetInternalSystemDirectory(_Out_opt_ DWORD * pdwLength = NULL); - //***************************************************************************** // This function validates the given Method/Field/Standalone signature. (util.cpp) //***************************************************************************** @@ -3215,13 +3239,6 @@ HRESULT validateTokenSig( DWORD dwFlags, // [IN] Method flags. IMDInternalImport* pImport); // [IN] Internal MD Import interface ptr -//***************************************************************************** -// Determine the version number of the runtime that was used to build the -// specified image. The pMetadata pointer passed in is the pointer to the -// metadata contained in the image. -//***************************************************************************** -HRESULT GetImageRuntimeVersionString(PVOID pMetaData, LPCSTR* pString); - //***************************************************************************** // The registry keys and values that contain the information regarding // the default registered unmanaged debugger. @@ -3331,6 +3348,16 @@ void PutLoongArch64PC12(UINT32 * pCode, INT64 imm); //***************************************************************************** void PutLoongArch64JIR(UINT32 * pCode, INT64 imm); +//***************************************************************************** +// Extract the PC-Relative offset from auipc + I-type adder (addi/ld/jalr) +//***************************************************************************** +INT64 GetRiscV64AuipcItype(UINT32 * pCode); + +//***************************************************************************** +// Deposit the PC-Relative offset into auipc + I-type adder (addi/ld/jalr) +//***************************************************************************** +void PutRiscV64AuipcItype(UINT32 * pCode, INT64 offset); + //***************************************************************************** // Returns whether the offset fits into bl instruction //***************************************************************************** diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/volatile.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/volatile.h index efcb25f8a..5f1863520 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/volatile.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/volatile.h @@ -68,11 +68,16 @@ #error The Volatile type is currently only defined for Visual C++ and GNU C++ #endif -#if defined(__GNUC__) && !defined(HOST_X86) && !defined(HOST_AMD64) && !defined(HOST_ARM) && !defined(HOST_ARM64) && !defined(HOST_LOONGARCH64) && !defined(HOST_RISCV64) && !defined(HOST_S390X) && !defined(HOST_POWERPC64) +#if defined(__GNUC__) && !defined(HOST_X86) && !defined(HOST_AMD64) && !defined(HOST_ARM) && !defined(HOST_ARM64) && !defined(HOST_LOONGARCH64) && !defined(HOST_RISCV64) && !defined(HOST_S390X) && !defined(HOST_POWERPC64) && !defined(HOST_WASM) #error The Volatile type is currently only defined for GCC when targeting x86, AMD64, ARM, ARM64, LOONGARCH64, RISCV64, PPC64LE, or S390X CPUs #endif #if defined(__GNUC__) +#if defined(HOST_X86) || defined(HOST_AMD64) +#define SFENCE_MEMORY_BARRIER() asm volatile ("sfence" : : : "memory") +#else +#define SFENCE_MEMORY_BARRIER() +#endif #if defined(HOST_ARMV6) // DMB ISH not valid on ARMv6 #define VOLATILE_MEMORY_BARRIER() asm volatile ("mcr p15, 0, r0, c7, c10, 5" : : : "memory") @@ -97,13 +102,22 @@ // #define VOLATILE_MEMORY_BARRIER() asm volatile ("" : : : "memory") #endif // HOST_ARM || HOST_ARM64 + #elif (defined(HOST_ARM) || defined(HOST_ARM64)) && _ISO_VOLATILE // ARM & ARM64 have a very weak memory model and very few tools to control that model. We're forced to perform a full // memory barrier to preserve the volatile semantics. Technically this is only necessary on MP systems but we // currently don't have a cheap way to determine the number of CPUs from this header file. Revisit this if it // turns out to be a performance issue for the uni-proc case. + #define VOLATILE_MEMORY_BARRIER() MemoryBarrier() +#define SFENCE_MEMORY_BARRIER() #else + +#if defined(HOST_X86) || defined(HOST_AMD64) +#define SFENCE_MEMORY_BARRIER() _mm_sfence() +#else +#define SFENCE_MEMORY_BARRIER() +#endif // // On VC++, reorderings at the compiler and machine level are prevented by the use of the // "volatile" keyword in VolatileLoad and VolatileStore. This should work on any CPU architecture diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/vptr_list.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/vptr_list.h index de8b5bfc9..8fade7caa 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/vptr_list.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/vptr_list.h @@ -9,6 +9,10 @@ VPTR_CLASS(EEJitManager) #ifdef FEATURE_READYTORUN VPTR_CLASS(ReadyToRunJitManager) #endif +#ifdef FEATURE_INTERPRETER +VPTR_CLASS(InterpreterJitManager) +VPTR_CLASS(InterpreterCodeManager) +#endif VPTR_CLASS(EECodeManager) VPTR_CLASS(RangeList) @@ -21,13 +25,9 @@ VPTR_CLASS(EditAndContinueModule) VPTR_CLASS(Module) VPTR_CLASS(ReflectionModule) -VPTR_CLASS(AppDomain) -VPTR_CLASS(SystemDomain) - VPTR_CLASS(PrecodeStubManager) VPTR_CLASS(StubLinkStubManager) VPTR_CLASS(ThePreStubManager) -VPTR_CLASS(ThunkHeapStubManager) VPTR_CLASS(VirtualCallStubManager) VPTR_CLASS(VirtualCallStubManagerManager) VPTR_CLASS(JumpStubStubManager) @@ -42,55 +42,9 @@ VPTR_CLASS(CallCountingStubManager) VPTR_CLASS(PEImageLayout) VPTR_CLASS(ConvertedImageLayout) VPTR_CLASS(LoadedImageLayout) +VPTR_CLASS(NativeImageLayout) VPTR_CLASS(FlatImageLayout) -#ifdef FEATURE_COMINTEROP -VPTR_CLASS(ComMethodFrame) -VPTR_CLASS(CLRToCOMMethodFrame) -VPTR_CLASS(ComPrestubMethodFrame) -#endif // FEATURE_COMINTEROP - -#ifdef FEATURE_INTERPRETER -VPTR_CLASS(InterpreterFrame) -#endif // FEATURE_INTERPRETER -VPTR_CLASS(DebuggerClassInitMarkFrame) -VPTR_CLASS(DebuggerSecurityCodeMarkFrame) -VPTR_CLASS(DebuggerExitFrame) -VPTR_CLASS(DebuggerU2MCatchHandlerFrame) -VPTR_CLASS(FaultingExceptionFrame) -VPTR_CLASS(FuncEvalFrame) -VPTR_CLASS(HelperMethodFrame) -VPTR_CLASS(HelperMethodFrame_1OBJ) -VPTR_CLASS(HelperMethodFrame_2OBJ) -VPTR_CLASS(HelperMethodFrame_3OBJ) -VPTR_CLASS(HelperMethodFrame_PROTECTOBJ) -#ifdef FEATURE_HIJACK -VPTR_CLASS(HijackFrame) -#endif -VPTR_CLASS(InlinedCallFrame) -VPTR_CLASS(PInvokeCalliFrame) -VPTR_CLASS(PrestubMethodFrame) -VPTR_CLASS(ProtectByRefsFrame) -VPTR_CLASS(ProtectValueClassFrame) -#ifdef FEATURE_HIJACK -VPTR_CLASS(ResumableFrame) -VPTR_CLASS(RedirectedThreadFrame) -#endif -VPTR_CLASS(StubDispatchFrame) -VPTR_CLASS(CallCountingHelperFrame) -VPTR_CLASS(ExternalMethodFrame) -#ifdef FEATURE_READYTORUN -VPTR_CLASS(DynamicHelperFrame) -#endif -#if defined(TARGET_X86) && !defined(UNIX_X86_ABI) -VPTR_CLASS(TailCallFrame) -#endif -VPTR_CLASS(ExceptionFilterFrame) - -#ifdef _DEBUG -VPTR_CLASS(AssumeByrefFromJITStack) -#endif - #ifdef DEBUGGING_SUPPORTED VPTR_CLASS(Debugger) VPTR_CLASS(EEDbgInterfaceImpl) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/inc/winwrap.h b/Procfiler/src/cpp/3rdparty/coreclr/inc/winwrap.h index a222b6bba..4f5569343 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/inc/winwrap.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/inc/winwrap.h @@ -42,11 +42,9 @@ #ifdef HOST_WINDOWS #define WszLoadLibrary LoadLibraryExWrapper #define WszCreateFile CreateFileWrapper -#define WszGetFileAttributesEx GetFileAttributesExWrapper #else // HOST_WINDOWS #define WszLoadLibrary LoadLibraryExW #define WszCreateFile CreateFileW -#define WszGetFileAttributesEx GetFileAttributesExW #endif // HOST_WINDOWS //APIS which have a buffer as an out parameter diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/CMakeLists.txt index 9213941ba..01ddee53d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/CMakeLists.txt @@ -6,7 +6,12 @@ include_directories(${COREPAL_SOURCE_DIR}/inc) include_directories(${COREPAL_SOURCE_DIR}/src) include_directories(${COREPAL_SOURCE_DIR}/../inc) -add_compile_options(-fexceptions) +if (NOT CLR_CMAKE_TARGET_BROWSER) + add_compile_options(-fexceptions) +else() + add_compile_options(-fwasm-exceptions) + add_link_options(-fwasm-exceptions -sEXIT_RUNTIME=1) +endif() add_subdirectory(src) add_subdirectory(tests) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal.h index b5c4bb7f2..e7b2cd47c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal.h @@ -99,7 +99,6 @@ extern bool g_arm64_atomics_present; /******************* ABI-specific glue *******************************/ #define MAX_PATH 260 -#define _MAX_PATH 260 #define _MAX_DRIVE 3 /* max. length of drive component */ #define _MAX_DIR 256 /* max. length of path component */ #define _MAX_FNAME 256 /* max. length of file name component */ @@ -110,9 +109,7 @@ extern bool g_arm64_atomics_present; #define MAX_PATH_FNAME MAX_PATH #define MAX_LONGPATH 1024 /* max. length of full pathname */ -#define MAXSHORT 0x7fff #define MAXLONG 0x7fffffff -#define MAXCHAR 0x7f #define MAXDWORD 0xffffffff // Sorting IDs. @@ -131,17 +128,15 @@ extern bool g_arm64_atomics_present; #define DECLSPEC_NORETURN PAL_NORETURN -#ifdef __clang_analyzer__ -#define ANALYZER_NORETURN __attribute((analyzer_noreturn)) -#else -#define ANALYZER_NORETURN -#endif - #define EMPTY_BASES_DECL - #if !defined(_MSC_VER) || defined(SOURCE_FORMATTING) -#define __assume(x) (void)0 +#if __has_builtin(__builtin_assume) +#define __assume(condition) do { bool assume_cond = (condition); __builtin_assume(assume_cond); } while (0) +#else +#define __assume(condition) do { if (!(condition)) __builtin_unreachable(); } while (0) +#endif // __has_builtin(__builtin_assume) + #define __annotation(x) #endif //!MSC_VER @@ -169,13 +164,6 @@ extern bool g_arm64_atomics_present; /******************* PAL-Specific Entrypoints *****************************/ -#define IsDebuggerPresent PAL_IsDebuggerPresent - -PALIMPORT -BOOL -PALAPI -PAL_IsDebuggerPresent(); - #define DLL_PROCESS_ATTACH 1 #define DLL_THREAD_ATTACH 2 #define DLL_THREAD_DETACH 3 @@ -365,13 +353,6 @@ PALAPI PAL_UnregisterModule( IN HINSTANCE hInstance); -PALIMPORT -VOID -PALAPI -PAL_Random( - IN OUT LPVOID lpBuffer, - IN DWORD dwLength); - PALIMPORT BOOL PALAPI @@ -434,7 +415,6 @@ PAL_PerfJitDump_Finish(); #define MB_OKCANCEL 0x00000001L #define MB_ABORTRETRYIGNORE 0x00000002L -#define MB_ICONQUESTION 0x00000020L #define MB_ICONEXCLAMATION 0x00000030L #define MB_TASKMODAL 0x00002000L @@ -536,138 +516,6 @@ SearchPathW( #define SearchPath SearchPathW -PALIMPORT -BOOL -PALAPI -CopyFileW( - IN LPCWSTR lpExistingFileName, - IN LPCWSTR lpNewFileName, - IN BOOL bFailIfExists); - -#ifdef UNICODE -#define CopyFile CopyFileW -#else -#define CopyFile CopyFileA -#endif - -typedef struct _WIN32_FIND_DATAA { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - DWORD dwReserved0; - DWORD dwReserved1; - CHAR cFileName[ MAX_PATH_FNAME ]; - CHAR cAlternateFileName[ 14 ]; -} WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA; - -typedef struct _WIN32_FIND_DATAW { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - DWORD dwReserved0; - DWORD dwReserved1; - WCHAR cFileName[ MAX_PATH_FNAME ]; - WCHAR cAlternateFileName[ 14 ]; -} WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW; - -#ifdef UNICODE -typedef WIN32_FIND_DATAW WIN32_FIND_DATA; -typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA; -typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA; -#else -typedef WIN32_FIND_DATAA WIN32_FIND_DATA; -typedef PWIN32_FIND_DATAA PWIN32_FIND_DATA; -typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA; -#endif - -PALIMPORT -HANDLE -PALAPI -FindFirstFileW( - IN LPCWSTR lpFileName, - OUT LPWIN32_FIND_DATAW lpFindFileData); - -#ifdef UNICODE -#define FindFirstFile FindFirstFileW -#else -#define FindFirstFile FindFirstFileA -#endif - -PALIMPORT -BOOL -PALAPI -FindNextFileW( - IN HANDLE hFindFile, - OUT LPWIN32_FIND_DATAW lpFindFileData); - -#ifdef UNICODE -#define FindNextFile FindNextFileW -#else -#define FindNextFile FindNextFileA -#endif - -PALIMPORT -BOOL -PALAPI -FindClose( - IN OUT HANDLE hFindFile); - -PALIMPORT -DWORD -PALAPI -GetFileAttributesW( - IN LPCWSTR lpFileName); - -#ifdef UNICODE -#define GetFileAttributes GetFileAttributesW -#else -#define GetFileAttributes GetFileAttributesA -#endif - -typedef enum _GET_FILEEX_INFO_LEVELS { - GetFileExInfoStandard -} GET_FILEEX_INFO_LEVELS; - -typedef enum _FINDEX_INFO_LEVELS { - FindExInfoStandard, - FindExInfoBasic, - FindExInfoMaxInfoLevel -} FINDEX_INFO_LEVELS; - -typedef enum _FINDEX_SEARCH_OPS { - FindExSearchNameMatch, - FindExSearchLimitToDirectories, - FindExSearchLimitToDevices, - FindExSearchMaxSearchOp -} FINDEX_SEARCH_OPS; - -typedef struct _WIN32_FILE_ATTRIBUTE_DATA { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; -} WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA; - -PALIMPORT -BOOL -PALAPI -GetFileAttributesExW( - IN LPCWSTR lpFileName, - IN GET_FILEEX_INFO_LEVELS fInfoLevelId, - OUT LPVOID lpFileInformation); - -#ifdef UNICODE -#define GetFileAttributesEx GetFileAttributesExW -#endif - typedef struct _OVERLAPPED { ULONG_PTR Internal; ULONG_PTR InternalHigh; @@ -795,21 +643,6 @@ GetFullPathNameW( #define GetFullPathName GetFullPathNameA #endif -PALIMPORT -UINT -PALAPI -GetTempFileNameW( - IN LPCWSTR lpPathName, - IN LPCWSTR lpPrefixString, - IN UINT uUnique, - OUT LPWSTR lpTempFileName); - -#ifdef UNICODE -#define GetTempFileName GetTempFileNameW -#else -#define GetTempFileName GetTempFileNameA -#endif - PALIMPORT DWORD PALAPI @@ -931,6 +764,7 @@ PALAPI PAL_CreateMutexW( IN BOOL bInitialOwner, IN LPCWSTR lpName, + IN BOOL bCurrentUserOnly, IN LPSTR lpSystemCallErrors, IN DWORD dwSystemCallErrorsBufferSize); @@ -952,6 +786,7 @@ HANDLE PALAPI PAL_OpenMutexW( IN LPCWSTR lpName, + IN BOOL bCurrentUserOnly, IN LPSTR lpSystemCallErrors, IN DWORD dwSystemCallErrorsBufferSize); @@ -1383,12 +1218,14 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS { #define XSTATE_AVX512_KMASK (5) #define XSTATE_AVX512_ZMM_H (6) #define XSTATE_AVX512_ZMM (7) +#define XSTATE_APX (19) #define XSTATE_MASK_GSSE (UI64(1) << (XSTATE_GSSE)) #define XSTATE_MASK_AVX (XSTATE_MASK_GSSE) #define XSTATE_MASK_AVX512 ((UI64(1) << (XSTATE_AVX512_KMASK)) | \ (UI64(1) << (XSTATE_AVX512_ZMM_H)) | \ (UI64(1) << (XSTATE_AVX512_ZMM))) +#define XSTATE_MASK_APX (UI64(1) << (XSTATE_APX)) typedef struct DECLSPEC_ALIGN(16) _M128A { ULONGLONG Low; @@ -1625,6 +1462,27 @@ typedef struct DECLSPEC_ALIGN(16) _CONTEXT { M512 Zmm30; M512 Zmm31; }; + + struct + { + DWORD64 R16; + DWORD64 R17; + DWORD64 R18; + DWORD64 R19; + DWORD64 R20; + DWORD64 R21; + DWORD64 R22; + DWORD64 R23; + DWORD64 R24; + DWORD64 R25; + DWORD64 R26; + DWORD64 R27; + DWORD64 R28; + DWORD64 R29; + DWORD64 R30; + DWORD64 R31; + }; + } CONTEXT, *PCONTEXT, *LPCONTEXT; // @@ -2037,6 +1895,9 @@ typedef union IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY_XDATA { #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) +#define CONTEXT_LSX 0x10 +#define CONTEXT_LASX 0x20 + #define CONTEXT_EXCEPTION_ACTIVE 0x8000000 #define CONTEXT_SERVICE_ACTIVE 0x10000000 #define CONTEXT_EXCEPTION_REQUEST 0x40000000 @@ -2131,7 +1992,6 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS { PDWORD64 S7; PDWORD64 S8; PDWORD64 Fp; - PDWORD64 Tp; PDWORD64 Ra; PDWORD64 F24; @@ -2524,6 +2384,28 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS { // } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; +#elif defined(HOST_WASM) +#define CONTEXT_CONTROL 0 +#define CONTEXT_INTEGER 0 +#define CONTEXT_FLOATING_POINT 0 +#define CONTEXT_DEBUG_REGISTERS 0 +#define CONTEXT_FULL 0 +#define CONTEXT_ALL 0 + +#define CONTEXT_XSTATE 0 + +#define CONTEXT_EXCEPTION_ACTIVE 0x8000000L +#define CONTEXT_SERVICE_ACTIVE 0x10000000L +#define CONTEXT_EXCEPTION_REQUEST 0x40000000L +#define CONTEXT_EXCEPTION_REPORTING 0x80000000L + +typedef struct _CONTEXT { + ULONG ContextFlags; +} CONTEXT, *PCONTEXT, *LPCONTEXT; + +typedef struct _KNONVOLATILE_CONTEXT_POINTERS { + DWORD none; +} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; #else #error Unknown architecture for defining CONTEXT. @@ -2611,77 +2493,10 @@ typedef BOOL(*UnwindReadMemoryCallback)(PVOID address, PVOID buffer, SIZE_T size PALIMPORT BOOL PALAPI PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers); -PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback); +PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback); PALIMPORT BOOL PALAPI PAL_GetUnwindInfoSize(SIZE_T baseAddress, ULONG64 ehFrameHdrAddr, UnwindReadMemoryCallback readMemoryCallback, PULONG64 ehFrameStart, PULONG64 ehFrameSize); -/* PAL_CS_NATIVE_DATA_SIZE is defined as sizeof(PAL_CRITICAL_SECTION_NATIVE_DATA) */ - -#if defined(__APPLE__) && defined(__i386__) -#define PAL_CS_NATIVE_DATA_SIZE 76 -#elif defined(__APPLE__) && defined(HOST_AMD64) -#define PAL_CS_NATIVE_DATA_SIZE 120 -#elif defined(__APPLE__) && defined(HOST_ARM64) -#define PAL_CS_NATIVE_DATA_SIZE 120 -#elif defined(__FreeBSD__) && defined(HOST_X86) -#define PAL_CS_NATIVE_DATA_SIZE 12 -#elif defined(__FreeBSD__) && defined(__x86_64__) -#define PAL_CS_NATIVE_DATA_SIZE 24 -#elif defined(__FreeBSD__) && defined(HOST_ARM64) -#define PAL_CS_NATIVE_DATA_SIZE 24 -#elif defined(__linux__) && defined(HOST_ARM) -#define PAL_CS_NATIVE_DATA_SIZE 80 -#elif defined(__linux__) && defined(HOST_ARM64) -#define PAL_CS_NATIVE_DATA_SIZE 104 -#elif defined(__linux__) && defined(__i386__) -#define PAL_CS_NATIVE_DATA_SIZE 76 -#elif defined(__linux__) && defined(__x86_64__) -#define PAL_CS_NATIVE_DATA_SIZE 96 -#elif defined(__linux__) && defined(HOST_S390X) -#define PAL_CS_NATIVE_DATA_SIZE 96 -#elif defined(__linux__) && defined(HOST_POWERPC64) -#define PAL_CS_NATIVE_DATA_SIZE 96 -#elif defined(__NetBSD__) && defined(__amd64__) -#define PAL_CS_NATIVE_DATA_SIZE 96 -#elif defined(__NetBSD__) && defined(__earm__) -#define PAL_CS_NATIVE_DATA_SIZE 56 -#elif defined(__NetBSD__) && defined(__i386__) -#define PAL_CS_NATIVE_DATA_SIZE 56 -#elif defined(__sun) && defined(__x86_64__) -#define PAL_CS_NATIVE_DATA_SIZE 48 -#elif defined(__linux__) && defined(__loongarch64) -#define PAL_CS_NATIVE_DATA_SIZE 96 -#elif defined(__linux__) && defined(__riscv) && __riscv_xlen == 64 -#define PAL_CS_NATIVE_DATA_SIZE 96 -#else -#error PAL_CS_NATIVE_DATA_SIZE is not defined for this architecture -#endif - -// -typedef struct _CRITICAL_SECTION { - PVOID DebugInfo; - LONG LockCount; - LONG RecursionCount; - HANDLE OwningThread; - ULONG_PTR SpinCount; - -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - BOOL bInternal; -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA - volatile DWORD dwInitState; - - union CSNativeDataStorage - { - BYTE rgNativeDataStorage[PAL_CS_NATIVE_DATA_SIZE]; - PVOID pvAlign; // make sure the storage is machine-pointer-size aligned - } csnds; -} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION; - -PALIMPORT VOID PALAPI EnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection); -PALIMPORT VOID PALAPI LeaveCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection); -PALIMPORT VOID PALAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection); -PALIMPORT VOID PALAPI DeleteCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection); - #define PAGE_NOACCESS 0x01 #define PAGE_READONLY 0x02 #define PAGE_READWRITE 0x04 @@ -2923,14 +2738,14 @@ VirtualFree( IN DWORD dwFreeType); -#if defined(HOST_OSX) && defined(HOST_ARM64) +#if defined(HOST_APPLE) && defined(HOST_ARM64) PALIMPORT VOID PALAPI PAL_JitWriteProtect(bool writeEnable); -#endif // defined(HOST_OSX) && defined(HOST_ARM64) +#endif // defined(HOST_APPLE) && defined(HOST_ARM64) PALIMPORT @@ -2976,11 +2791,6 @@ FlushInstructionCache( #define MAX_LEADBYTES 12 #define MAX_DEFAULTCHAR 2 -PALIMPORT -UINT -PALAPI -GetACP(void); - typedef struct _cpinfo { UINT MaxCharSize; BYTE DefaultChar[MAX_DEFAULTCHAR]; @@ -3207,30 +3017,6 @@ RaiseFailFastException( IN PCONTEXT pContextRecord, IN DWORD dwFlags); -PALIMPORT -DWORD -PALAPI -GetTickCount(); - -PALIMPORT -ULONGLONG -PALAPI -GetTickCount64(); - -PALIMPORT -BOOL -PALAPI -QueryPerformanceCounter( - OUT LARGE_INTEGER *lpPerformanceCount - ); - -PALIMPORT -BOOL -PALAPI -QueryPerformanceFrequency( - OUT LARGE_INTEGER *lpFrequency - ); - PALIMPORT BOOL PALAPI @@ -3670,6 +3456,27 @@ Define_InterlockMethod( ((PVOID)(UINT_PTR)InterlockedCompareExchange((PLONG)(UINT_PTR)(Destination), (LONG)(UINT_PTR)(ExChange), (LONG)(UINT_PTR)(Comperand))) #endif +#if defined(HOST_64BIT) && defined(FEATURE_CACHED_INTERFACE_DISPATCH) +FORCEINLINE uint8_t _InterlockedCompareExchange128(int64_t volatile *pDst, int64_t iValueHigh, int64_t iValueLow, int64_t *pComparandAndResult) +{ + __int128_t iComparand = ((__int128_t)pComparandAndResult[1] << 64) + (uint64_t)pComparandAndResult[0]; + // TODO-LOONGARCH64: the 128-bit CAS is supported starting from the 3A6000 CPU (ISA1.1). + // When running on older hardware that doesn't support native CAS-128, the system falls back + // to a mutex-based approach via libatomic, which is not suitable for runtime requirements. + // + // TODO-RISCV64: double-check if libatomic's emulated CAS-128 works as expected once AOT applications are + // functional on linux-riscv64: https://github.com/dotnet/runtime/issues/106223. + // CAS-128 is natively supported starting with the Zacas extension in Linux 6.8; however, hardware support + // for RVA23 profile is not available at the time of writing. + // + // See https://github.com/dotnet/runtime/issues/109276. + __int128_t iResult = __sync_val_compare_and_swap((__int128_t volatile*)pDst, iComparand, ((__int128_t)iValueHigh << 64) + (uint64_t)iValueLow); + PAL_InterlockedOperationBarrier(); + pComparandAndResult[0] = (int64_t)iResult; pComparandAndResult[1] = (int64_t)(iResult >> 64); + return iComparand == iResult; +} +#endif + /*++ Function: MemoryBarrier @@ -3961,30 +3768,9 @@ unsigned int __cdecl _rotr(unsigned int value, int shift) PALIMPORT DLLEXPORT char * __cdecl PAL_getenv(const char *); PALIMPORT DLLEXPORT int __cdecl _putenv(const char *); +#ifndef ERANGE #define ERANGE 34 - -/****************PAL Perf functions for PInvoke*********************/ -#if PAL_PERF -PALIMPORT -VOID -PALAPI -PAL_EnableProcessProfile(); - -PALIMPORT -VOID -PALAPI -PAL_DisableProcessProfile(); - -PALIMPORT -BOOL -PALAPI -PAL_IsProcessProfileEnabled(); - -PALIMPORT -INT64 -PALAPI -PAL_GetCpuTickCount(); -#endif // PAL_PERF +#endif /******************* PAL functions for exceptions *******/ @@ -4132,7 +3918,6 @@ struct PAL_SEHException typedef BOOL (*PHARDWARE_EXCEPTION_HANDLER)(PAL_SEHException* ex); typedef BOOL (*PHARDWARE_EXCEPTION_SAFETY_CHECK_FUNCTION)(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord); -typedef VOID (*PTERMINATION_REQUEST_HANDLER)(int terminationExitCode); typedef DWORD (*PGET_GCMARKER_EXCEPTION_CODE)(LPVOID ip); PALIMPORT @@ -4155,12 +3940,6 @@ PAL_ThrowExceptionFromContext( IN CONTEXT* context, IN PAL_SEHException* ex); -PALIMPORT -VOID -PALAPI -PAL_SetTerminationRequestHandler( - IN PTERMINATION_REQUEST_HANDLER terminationRequestHandler); - PALIMPORT VOID PALAPI @@ -4557,4 +4336,10 @@ class NativeExceptionHolderFactory } #endif +#ifndef TARGET_WASM +#define _ReturnAddress() __builtin_return_address(0) +#else +#define _ReturnAddress() 0 +#endif + #endif // __PAL_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_error.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_error.h index b387e6854..b03f9cefa 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_error.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_error.h @@ -147,7 +147,6 @@ #define ERROR_PALINIT_TLS 65295L #define ERROR_PALINIT_ENV 65296L #define ERROR_PALINIT_DBG_CHANNELS 65297L -#define ERROR_PALINIT_SHARED_MEMORY_MANAGER 65298L #define ERROR_PALINIT_SHM 65299L #define ERROR_PALINIT_MODULE_MANAGER 65300L diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_mstypes.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_mstypes.h index e3423c41f..1db60e5ff 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_mstypes.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/pal_mstypes.h @@ -316,17 +316,6 @@ typedef union _LARGE_INTEGER { LONGLONG QuadPart; } LARGE_INTEGER, *PLARGE_INTEGER; -#ifndef GUID_DEFINED -typedef struct _GUID { - ULONG Data1; // NOTE: diff from Win32, for LP64 - USHORT Data2; - USHORT Data3; - UCHAR Data4[ 8 ]; -} GUID; -typedef const GUID *LPCGUID; -#define GUID_DEFINED -#endif // !GUID_DEFINED - typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/palprivate.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/palprivate.h index 35a05cec3..17c5a045e 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/palprivate.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/palprivate.h @@ -20,15 +20,6 @@ CreateFileA( IN DWORD dwFlagsAndAttributes, IN HANDLE hTemplateFile); -PALIMPORT -BOOL -PALAPI -CopyFileA( - IN LPCSTR lpExistingFileName, - IN LPCSTR lpNewFileName, - IN BOOL bFailIfExists); - - PALIMPORT BOOL PALAPI @@ -49,40 +40,6 @@ CreateDirectoryW( IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes); -PALIMPORT -HANDLE -PALAPI -FindFirstFileA( - IN LPCSTR lpFileName, - OUT LPWIN32_FIND_DATAA lpFindFileData); - -PALIMPORT -BOOL -PALAPI -FindNextFileA( - IN HANDLE hFindFile, - OUT LPWIN32_FIND_DATAA lpFindFileData); - -PALIMPORT -DWORD -PALAPI -GetFileAttributesA( - IN LPCSTR lpFileName); - -PALIMPORT -BOOL -PALAPI -SetFileAttributesA( - IN LPCSTR lpFileName, - IN DWORD dwFileAttributes); - -PALIMPORT -BOOL -PALAPI -SetFileAttributesW( - IN LPCWSTR lpFileName, - IN DWORD dwFileAttributes); - PALIMPORT DWORD PALAPI @@ -92,15 +49,6 @@ GetFullPathNameA( OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart); -PALIMPORT -UINT -PALAPI -GetTempFileNameA( - IN LPCSTR lpPathName, - IN LPCSTR lpPrefixString, - IN UINT uUnique, - OUT LPSTR lpTempFileName); - PALIMPORT DWORD PALAPI diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/conio.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/conio.h deleted file mode 100644 index 9dd9c0a06..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/conio.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: conio.h -// -// =========================================================================== -// dummy conio.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/assert.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/assert.h deleted file mode 100644 index 7493b151d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/assert.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: assert.h -// -// =========================================================================== -// dummy assert.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/cstdlib b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/cstdlib deleted file mode 100644 index 1cfd40828..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/cstdlib +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// -// clrosdev -// -// =========================================================================== -// File: cstdlib -// -// =========================================================================== -// dummy cstdlib for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/ctype.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/ctype.h deleted file mode 100644 index cb41fcd88..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/ctype.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: ctype.h -// -// =========================================================================== -// dummy ctype.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/emmintrin.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/emmintrin.h deleted file mode 100644 index f2e8e0c1f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/emmintrin.h +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// From llvm-3.9/clang-3.9.1 emmintrin.h: - -/*===---- emmintrin.h - SSE2 intrinsics ------------------------------------=== - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - *===-----------------------------------------------------------------------=== - */ - -#include "palrt.h" -#ifdef __GNUC__ -#ifndef __EMMINTRIN_H -#define __IMMINTRIN_H - -typedef long long __m128i __attribute__((__vector_size__(16))); - -typedef unsigned long long __v2du __attribute__ ((__vector_size__ (16))); -typedef short __v8hi __attribute__((__vector_size__(16))); -typedef char __v16qi __attribute__((__vector_size__(16))); - - -/* Define the default attribute for the functions in this file. */ -#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, NODEBUG_ATTRIBUTE)) - -/// \brief Performs a bitwise OR of two 128-bit integer vectors. -/// -/// \headerfile -/// -/// This intrinsic corresponds to the \c VPOR / POR instruction. -/// -/// \param __a -/// A 128-bit integer vector containing one of the source operands. -/// \param __b -/// A 128-bit integer vector containing one of the source operands. -/// \returns A 128-bit integer vector containing the bitwise OR of the values -/// in both operands. -static __inline__ __m128i __DEFAULT_FN_ATTRS -_mm_or_si128(__m128i __a, __m128i __b) -{ - return (__m128i)((__v2du)__a | (__v2du)__b); -} - -/// \brief Compares each of the corresponding 16-bit values of the 128-bit -/// integer vectors for equality. Each comparison yields 0h for false, FFFFh -/// for true. -/// -/// \headerfile -/// -/// This intrinsic corresponds to the \c VPCMPEQW / PCMPEQW instruction. -/// -/// \param __a -/// A 128-bit integer vector. -/// \param __b -/// A 128-bit integer vector. -/// \returns A 128-bit integer vector containing the comparison results. -static __inline__ __m128i __DEFAULT_FN_ATTRS -_mm_cmpeq_epi16(__m128i __a, __m128i __b) -{ - return (__m128i)((__v8hi)__a == (__v8hi)__b); -} - -/// \brief Moves packed integer values from an unaligned 128-bit memory location -/// to elements in a 128-bit integer vector. -/// -/// \headerfile -/// -/// This intrinsic corresponds to the \c VMOVDQU / MOVDQU instruction. -/// -/// \param __p -/// A pointer to a memory location containing integer values. -/// \returns A 128-bit integer vector containing the moved values. -static __inline__ __m128i __DEFAULT_FN_ATTRS -_mm_loadu_si128(__m128i const *__p) -{ - struct __loadu_si128 { - __m128i __v; - } __attribute__((__packed__, __may_alias__)); - return ((struct __loadu_si128*)__p)->__v; -} - -/// \brief Initializes all values in a 128-bit vector of [8 x i16] with the -/// specified 16-bit value. -/// -/// \headerfile -/// -/// This intrinsic is a utility function and does not correspond to a specific -/// instruction. -/// -/// \param __w -/// A 16-bit value used to initialize the elements of the destination integer -/// vector. -/// \returns An initialized 128-bit vector of [8 x i16] with all elements -/// containing the value provided in the operand. -static __inline__ __m128i __DEFAULT_FN_ATTRS -_mm_set1_epi16(short __w) -{ - return (__m128i)(__v8hi){ __w, __w, __w, __w, __w, __w, __w, __w }; -} - -static __inline__ int __DEFAULT_FN_ATTRS -_mm_movemask_epi8(__m128i __a) -{ - return __builtin_ia32_pmovmskb128((__v16qi)__a); -} - -#undef __DEFAULT_FN_ATTRS - -#endif /* __EMMINTRIN_H */ -#endif // __GNUC__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/fcntl.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/fcntl.h deleted file mode 100644 index 556145a9f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/fcntl.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: fcntl.h -// -// =========================================================================== -// dummy fcntl.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/float.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/float.h deleted file mode 100644 index a1dc80338..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/float.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: float.h -// -// =========================================================================== -// dummy float.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/io.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/io.h deleted file mode 100644 index 64f3a52df..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/io.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: io.h -// -// =========================================================================== -// dummy io.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/limits.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/limits.h deleted file mode 100644 index bd667f14e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/limits.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: limits.h -// -// =========================================================================== -// dummy limits.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/malloc.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/malloc.h deleted file mode 100644 index 255a2c7f2..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/malloc.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: malloc.h -// -// =========================================================================== -// dummy malloc.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/math.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/math.h deleted file mode 100644 index e42c1852c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/math.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: math.h -// -// =========================================================================== -// dummy math.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/memory.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/memory.h deleted file mode 100644 index bcc0d7d9c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/memory.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: memory.h -// -// =========================================================================== -// dummy memory.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdarg.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdarg.h deleted file mode 100644 index 59d0d046d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdarg.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: stdarg.h -// -// =========================================================================== -// dummy stdarg.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stddef.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stddef.h deleted file mode 100644 index b347dbf41..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stddef.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: stddef.h -// -// =========================================================================== -// dummy stddef.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdint.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdint.h deleted file mode 100644 index b23533a29..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdint.h +++ /dev/null @@ -1,4 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdio.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdio.h deleted file mode 100644 index 33c1912bb..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdio.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: stdio.h -// -// =========================================================================== -// dummy stdio.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdlib.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdlib.h deleted file mode 100644 index d2d49357b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/stdlib.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: stdlib.h -// -// =========================================================================== -// dummy stdlib.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/string.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/string.h deleted file mode 100644 index b66d88333..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/string.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: string.h -// -// =========================================================================== -// dummy string.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/time.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/time.h deleted file mode 100644 index 00c83f99d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/time.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: time.h -// -// =========================================================================== -// dummy time.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/wchar.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/wchar.h deleted file mode 100644 index 5497d729e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/wchar.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: wchar.h -// -// =========================================================================== -// dummy wchar.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/xmmintrin.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/xmmintrin.h deleted file mode 100644 index 826d2d788..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/cpp/xmmintrin.h +++ /dev/null @@ -1,117 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// From llvm-3.9/clang-3.9.1 xmmintrin.h: - -/*===---- xmmintrin.h - SSE intrinsics -------------------------------------=== -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -* THE SOFTWARE. -* -*===-----------------------------------------------------------------------=== -*/ - -#ifdef __GNUC__ - -typedef float __m128 __attribute__((__vector_size__(16))); - -/* Define the default attributes for the functions in this file. */ -#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, NODEBUG_ATTRIBUTE)) - -/// \brief Loads a 128-bit floating-point vector of [4 x float] from an aligned -/// memory location. -/// -/// \headerfile -/// -/// This intrinsic corresponds to the \c VMOVAPS / MOVAPS instruction. -/// -/// \param __p -/// A pointer to a 128-bit memory location. The address of the memory -/// location has to be 128-bit aligned. -/// \returns A 128-bit vector of [4 x float] containing the loaded valus. -static __inline__ __m128 __DEFAULT_FN_ATTRS -_mm_load_ps(const float *__p) -{ - return *(__m128*)__p; -} - -/// \brief Loads a 128-bit floating-point vector of [4 x float] from an -/// unaligned memory location. -/// -/// \headerfile -/// -/// This intrinsic corresponds to the \c VMOVUPS / MOVUPS instruction. -/// -/// \param __p -/// A pointer to a 128-bit memory location. The address of the memory -/// location does not have to be aligned. -/// \returns A 128-bit vector of [4 x float] containing the loaded values. -static __inline__ __m128 __DEFAULT_FN_ATTRS -_mm_loadu_ps(const float *__p) -{ - struct __loadu_ps - { - __m128 __v; - } __attribute__((__packed__, __may_alias__)); - return ((struct __loadu_ps*)__p)->__v; -} - -/// \brief Stores float values from a 128-bit vector of [4 x float] to an -/// unaligned memory location. -/// -/// \headerfile -/// -/// This intrinsic corresponds to the \c VMOVUPS / MOVUPS instruction. -/// -/// \param __p -/// A pointer to a 128-bit memory location. The address of the memory -/// location does not have to be aligned. -/// \param __a -/// A 128-bit vector of [4 x float] containing the values to be stored. -static __inline__ void __DEFAULT_FN_ATTRS -_mm_storeu_ps(float *__p, __m128 __a) -{ - struct __storeu_ps - { - __m128 __v; - } __attribute__((__packed__, __may_alias__)); - ((struct __storeu_ps*)__p)->__v = __a; -} - -/// \brief Stores the lower 32 bits of a 128-bit vector of [4 x float] into -/// four contiguous elements in an aligned memory location. -/// -/// \headerfile -/// -/// This intrinsic corresponds to \c VMOVAPS / MOVAPS + \c shuffling -/// instruction. -/// -/// \param __p -/// A pointer to a 128-bit memory location. -/// \param __a -/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each -/// of the four contiguous elements pointed by __p. -static __inline__ void __DEFAULT_FN_ATTRS -_mm_store_ps(float *__p, __m128 __a) -{ - *(__m128*)__p = __a; -} - -#undef __DEFAULT_FN_ATTRS - -#endif // __GNUC__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/dbghelp.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/dbghelp.h deleted file mode 100644 index 1d231d34f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/dbghelp.h +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ BUILD Version: 0000 Increment this if a change has global effects - - - -Module Name: - - dbghelp.h - -Abstract: - - This module defines the prototypes and constants required for the image - help routines. - - Contains debugging support routines that are redistributable. - -Revision History: - ---*/ - -#ifndef _DBGHELP_ -#define _DBGHELP_ - -#if _MSC_VER > 1020 -#pragma once -#endif - -// -// options that are set/returned by SymSetOptions() & SymGetOptions() -// these are used as a mask -// -#define SYMOPT_LOAD_LINES 0x00000010 - -#endif // _DBGHELP_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/ntimage.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/ntimage.h index 3c7de0523..8f88791ef 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/ntimage.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/ntimage.h @@ -1015,17 +1015,6 @@ typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; #define IMAGE_REL_IA64_GPREL32 0x001C #define IMAGE_REL_IA64_ADDEND 0x001F -// -// LOONGARCH64 relocation types -// -#define IMAGE_REL_LOONGARCH64_PC 0x0003 -#define IMAGE_REL_LOONGARCH64_JIR 0x0004 - -// -// RISCV64 relocation types -// -#define IMAGE_REL_RISCV64_PC 0x0003 - // // CEF relocation types. // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/oaidl.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/oaidl.h deleted file mode 100644 index ed7491c58..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/oaidl.h +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: oaidl.h -// -// =========================================================================== - -#ifndef __OAIDL_H__ -#define __OAIDL_H__ - -// Pointer to IErrorInfo is still used in non-Windows code -// Prevent accidentally using its member -struct IErrorInfo; - -#endif //__OAIDL_H__ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/palrt.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/palrt.h index 18e25222c..d615d7539 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/palrt.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/palrt.h @@ -2,27 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // -// -// =========================================================================== -// File: palrt.h -// -// =========================================================================== - /*++ - - Abstract: PAL runtime functions. These are functions which are ordinarily implemented as part of the Win32 API set, but when compiling CoreCLR for Unix-like systems, are implemented as a runtime library on top of the PAL. - -Author: - - - -Revision History: - --*/ #ifndef __PALRT_H__ @@ -208,6 +193,18 @@ typedef enum tagEFaultRepRetVal #define REFGUID const GUID * #endif +#ifdef _WIN32 +#include +#else // _WIN32 +typedef struct minipal_guid__ +{ + uint32_t Data1; + uint16_t Data2; + uint16_t Data3; + uint8_t Data4[8]; +} GUID; +#endif // _WIN32 + EXTERN_C const GUID GUID_NULL; typedef GUID *LPGUID; @@ -274,10 +271,6 @@ typedef union _ULARGE_INTEGER { } ULARGE_INTEGER, *PULARGE_INTEGER; /******************* OLE, BSTR, VARIANT *************************/ - -STDAPI_VIS(DLLEXPORT, LPVOID) CoTaskMemAlloc(SIZE_T cb); -STDAPI_VIS(DLLEXPORT, void) CoTaskMemFree(LPVOID pv); - typedef SHORT VARIANT_BOOL; #define VARIANT_TRUE ((VARIANT_BOOL)-1) #define VARIANT_FALSE ((VARIANT_BOOL)0) @@ -489,9 +482,6 @@ struct tagVARIANT typedef VARIANT VARIANTARG, *LPVARIANTARG; -STDAPI_(void) VariantInit(VARIANT * pvarg); -STDAPI_(HRESULT) VariantClear(VARIANT * pvarg); - #define V_VT(X) ((X)->n1.n2.vt) #define V_UNION(X, Y) ((X)->n1.n2.n3.Y) #define V_RECORDINFO(X) ((X)->n1.n2.n3.brecVal.pRecInfo) @@ -556,8 +546,6 @@ STDAPI_(HRESULT) VariantClear(VARIANT * pvarg); #define V_ISBYREF(X) (V_VT(X)&VT_BYREF) -STDAPI CreateStreamOnHGlobal(PVOID hGlobal, BOOL fDeleteOnRelease, interface IStream** ppstm); - #define STGM_DIRECT 0x00000000L #define STGM_READ 0x00000000L @@ -716,8 +704,6 @@ typename std::remove_reference::type&& move( T&& t ); #define __RPC__inout #define __RPC__deref_out_ecount_full_opt(x) -typedef DWORD OLE_COLOR; - typedef HANDLE HWND; typedef struct _LIST_ENTRY { @@ -789,8 +775,6 @@ typedef struct _LIST_ENTRY { #define RUNTIME_FUNCTION_INDIRECT 0x1 #endif -#define _ReturnAddress() __builtin_return_address(0) - #define DIRECTORY_SEPARATOR_CHAR_A '/' #define DIRECTORY_SEPARATOR_CHAR_W W('/') #define DIRECTORY_SEPARATOR_STR_A "/" @@ -1041,6 +1025,14 @@ typedef struct _DISPATCHER_CONTEXT { DWORD Reserved; } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; +#elif defined(HOST_WASM) + +typedef struct _DISPATCHER_CONTEXT { + // WASM does not build the JIT at this point, + // so we only add necessary fields. + UINT32 ControlPc; +} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; + #else #error Unknown architecture for defining DISPATCHER_CONTEXT. @@ -1076,33 +1068,6 @@ typedef LONG (WINAPI *PTOP_LEVEL_EXCEPTION_FILTER)( ); typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; -/******************** PAL RT APIs *******************************/ - -typedef struct _HSATELLITE *HSATELLITE; - -EXTERN_C HSATELLITE PALAPI PAL_LoadSatelliteResourceW(LPCWSTR SatelliteResourceFileName); -EXTERN_C HSATELLITE PALAPI PAL_LoadSatelliteResourceA(LPCSTR SatelliteResourceFileName); -EXTERN_C BOOL PALAPI PAL_FreeSatelliteResource(HSATELLITE SatelliteResource); -EXTERN_C UINT PALAPI PAL_LoadSatelliteStringW(HSATELLITE SatelliteResource, - UINT uID, - LPWSTR lpBuffer, - UINT nBufferMax); -EXTERN_C UINT PALAPI PAL_LoadSatelliteStringA(HSATELLITE SatelliteResource, - UINT uID, - LPSTR lpBuffer, - UINT nBufferMax); - -EXTERN_C HRESULT PALAPI PAL_CoCreateInstance(REFCLSID rclsid, - REFIID riid, - void **ppv); - -// So we can have CoCreateInstance in most of the code base, -// instead of spreading around of if'def FEATURE_PALs for PAL_CoCreateInstance. -#define CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv) PAL_CoCreateInstance(rclsid, riid, ppv) - -STDAPI -CoCreateGuid(OUT GUID * pguid); - /************** Byte swapping & unaligned access ******************/ #include diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/safecrt.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/safecrt.h index 4ee17f4fe..59a78e82d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/safecrt.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/safecrt.h @@ -112,15 +112,6 @@ typedef int errno_t; /* standard */ /* error codes */ #if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) #define _SECURECRT_ERRCODE_VALUES_DEFINED -#if !defined(EINVAL) -#define EINVAL 22 -#endif -#if !defined(ERANGE) -#define ERANGE 34 -#endif -#if !defined(EILSEQ) -#define EILSEQ 42 -#endif #if !defined(STRUNCATE) #define STRUNCATE 80 #endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/specstrings.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/specstrings.h index 1cccb42e1..f9b278037 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/specstrings.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/specstrings.h @@ -465,27 +465,6 @@ __inner_analysis_assume_nullterminated_dec } #endif -#ifdef _PREFIX_ -/************************************************************************** -* Definition of __pfx_assume and __pfx_assert. Thse should be the only -* definitions of these functions. -***************************************************************************/ -#if __cplusplus -extern "C" void __pfx_assert(bool, const char *); -extern "C" void __pfx_assume(bool, const char *); -#else -void __pfx_assert(int, const char *); -void __pfx_assume(int, const char *); -#endif -/************************************************************************** -* Redefinition of __analysis_assume and __analysis_assert for PREFIX build -**************************************************************************/ -#undef __analysis_assume -#undef __analysis_assert -#define __analysis_assume(e) (__pfx_assume(e,"pfx_assume"),__assume(e)); -#define __analysis_assert(e) (__pfx_assert(e,"pfx_assert"),__assume(e)); -#endif /* ifdef _PREFIX_ */ - /************************************************************************** * This include should always be the last thing in this file. * Must avoid redfinitions of macros to workaround rc.exe issues. diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/verrsrc.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/verrsrc.h deleted file mode 100644 index 0bd710332..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/verrsrc.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: verrsrc.h -// -// =========================================================================== -// dummy verrsrc.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/winternl.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/winternl.h deleted file mode 100644 index a5e42c667..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/winternl.h +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: winternl.h -// -// =========================================================================== -// dummy winternl.h for PAL - -#include "palrt.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/winver.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/winver.h deleted file mode 100644 index b0f441e1a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/rt/winver.h +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// - -// -// =========================================================================== -// File: winver.h -// -// =========================================================================== -// winver.h for PAL -// Included in .rc files. - -#define VS_VERSION_INFO 1 -#define VS_FFI_FILEFLAGSMASK 0x0000003FL - -#define VS_FF_DEBUG 0x00000001L -#define VS_FF_PRERELEASE 0x00000002L -#define VS_FF_PATCHED 0x00000004L -#define VS_FF_PRIVATEBUILD 0x00000008L -#define VS_FF_INFOINFERRED 0x00000010L -#define VS_FF_SPECIALBUILD 0x00000020L - -#define VFT_UNKNOWN 0x00000000L -#define VFT_APP 0x00000001L -#define VFT_DLL 0x00000002L - -#define VFT2_UNKNOWN 0x00000000L - -#define VOS__WINDOWS32 0x00000004L diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacros.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacros.inc index 120b26543..83b5ce152 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacros.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacros.inc @@ -38,6 +38,23 @@ .equiv \New, \Old .endm +// GC type flags +#define GC_ALLOC_FINALIZE 1 +#define GC_ALLOC_ALIGN8_BIAS 4 +#define GC_ALLOC_ALIGN8 8 + +#define G_FREE_OBJECT_METHOD_TABLE g_pFreeObjectMethodTable + +// Offset of ee_alloc_context relative to INLINE_GET_ALLOC_CONTEXT_BASE. +// +// Since we have a disparity on how thread locals are accessed on various platforms and +// the current value of OFFSETOF__RuntimeThreadLocals__ee_alloc_context is zero we expect +// the helpers to add the OFFSETOF__RuntimeThreadLocals__ee_alloc_context constant to the +// base and set the additional offset to zero. +// In other words, we treat INLINE_GET_ALLOC_CONTEXT_BASE as returning the same value as +// GetThreadEEAllocContext. +#define OFFSETOF__ee_alloc_context 0 + #if defined(HOST_X86) #include "unixasmmacrosx86.inc" #elif defined(HOST_AMD64) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosamd64.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosamd64.inc index 31093a407..1d3d11c7d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosamd64.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosamd64.inc @@ -23,6 +23,16 @@ C_FUNC(\Name) = . .endm +.macro ALTERNATE_ENTRY Name +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name) + .private_extern C_FUNC(\Name) +#else + .global C_FUNC(\Name) +#endif +C_FUNC(\Name): +.endm + .macro LEAF_ENTRY Name, Section .global C_FUNC(\Name) #if defined(__APPLE__) @@ -30,6 +40,7 @@ #else .type \Name, %function #endif + .p2align 4 C_FUNC(\Name): .cfi_startproc .endm @@ -42,8 +53,13 @@ C_FUNC(\Name): .endm .macro LEAF_END_MARKED Name, Section -C_FUNC(\Name\()_End): +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name\()_End) + .private_extern C_FUNC(\Name\()_End) +#else .global C_FUNC(\Name\()_End) +#endif +C_FUNC(\Name\()_End): LEAF_END \Name, \Section // make sure this symbol gets its own address nop @@ -211,6 +227,12 @@ C_FUNC(\Name\()_End): .endm +.macro SKIP_ARGUMENT_REGISTERS + + add rsp, 6 * 8 + +.endm + .macro SAVE_FLOAT_ARGUMENT_REGISTERS ofs save_xmm128_postrsp xmm0, \ofs @@ -333,7 +355,7 @@ C_FUNC(\Name\()_End): .macro EPILOG_WITH_TRANSITION_BLOCK_RETURN free_stack __PWTB_StackAlloc - POP_ARGUMENT_REGISTERS + SKIP_ARGUMENT_REGISTERS POP_CALLEE_SAVED_REGISTERS ret @@ -356,3 +378,57 @@ C_FUNC(\Name\()_End): .cfi_same_value rbp .endm + +.macro INLINE_GET_TLS_VAR Var + .att_syntax +#if defined(__APPLE__) + movq _\Var@TLVP(%rip), %rdi + callq *(%rdi) +#else + .byte 0x66 // data16 prefix - padding to have space for linker relaxations + leaq \Var@TLSGD(%rip), %rdi + .byte 0x66 // + .byte 0x66 // + .byte 0x48 // rex.W prefix, also for padding + callq __tls_get_addr@PLT +#endif + .intel_syntax noprefix +.endm + + +// Inlined version of GetThreadEEAllocContext. Trashes volatile registers. +.macro INLINE_GET_ALLOC_CONTEXT_BASE +#ifdef FEATURE_EMULATED_TLS + call C_FUNC(GetThreadEEAllocContext) +#else + INLINE_GET_TLS_VAR t_runtime_thread_locals + + .ifnc OFFSETOF__RuntimeThreadLocals__ee_alloc_context, 0 + lea rax, [rax + OFFSETOF__RuntimeThreadLocals__ee_alloc_context] + .endif +#endif +.endm + +// Pushes a TransitionBlock on the stack without saving the argument registers. +// See the PROLOG_WITH_TRANSITION_BLOCK macro for the stack layout. +.macro PUSH_COOP_PINVOKE_FRAME target + set_cfa_register rsp, 8 + + PUSH_CALLEE_SAVED_REGISTERS + // 6 * 8 for argument register space in TransitionBlock + alignment of the stack to 16b + alloc_stack 56 + END_PROLOGUE + + lea \target, [rsp + 8] +.endm + +.macro POP_COOP_PINVOKE_FRAME + free_stack 56 + POP_CALLEE_SAVED_REGISTERS +.endm + +.macro INLINE_GETTHREAD + // Inlined version of call C_FUNC(RhpGetThread) + INLINE_GET_TLS_VAR t_CurrentThreadInfo + mov rax, [rax + OFFSETOF__ThreadLocalInfo__m_pThread] +.endm diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm.inc index f5eb32656..54a6f7d4d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm.inc @@ -44,10 +44,28 @@ C_FUNC(\Name\()_End): nop .endm +.macro GLOBAL_LABEL Name + .global C_FUNC(\Name) +C_FUNC(\Name): +.endm + +.macro ALTERNATE_ENTRY Name + .global C_FUNC(\Name) + .type \Name, %function +C_FUNC(\Name): +.endm + .macro PREPARE_EXTERNAL_VAR Name, HelperReg ldr \HelperReg, [pc, #C_FUNC(\Name)@GOTPCREL] .endm +.macro PREPARE_EXTERNAL_VAR_INDIRECT Name, HelperReg + movw \HelperReg, #:lower16:C_FUNC(\Name) - (. + 12) + movt \HelperReg, #:upper16:C_FUNC(\Name) - (. + 8) + add \HelperReg, pc + ldr \HelperReg, [\HelperReg] +.endm + .macro push_nonvol_reg Register push \Register .save \Register @@ -253,6 +271,29 @@ C_FUNC(\Name\()_End): vpop_nonvol_reg "\RegList" .endm +.macro INLINE_GET_ALLOC_CONTEXT_BASE + bl C_FUNC(GetThreadEEAllocContext) +.endm + +.macro PUSH_COOP_PINVOKE_FRAME target + // Reserve space for argument registers + alloc_stack 16 + PUSH_CALLEE_SAVED_REGISTERS + PROLOG_STACK_SAVE_OFFSET r7, #12 + // let r7 point the saved r7 in the stack (clang FP style) + // align the stack + alloc_stack 4 + CHECK_STACK_ALIGNMENT + END_PROLOGUE + add \target, sp, 4 +.endm + +.macro POP_COOP_PINVOKE_FRAME + free_stack 4 + POP_CALLEE_SAVED_REGISTERS + free_stack 16 +.endm + //----------------------------------------------------------------------------- // Macro used to check (in debug builds only) whether the stack is 64-bit aligned (a requirement before calling // out into C++/OS code). Invoke this directly after your prolog (if the stack frame size is fixed) or directly @@ -271,3 +312,9 @@ C_FUNC(\Name\()_End): 0: #endif .endm + +// Loads a 32bit constant into destination register +.macro MOV32 DestReg, Constant + movw \DestReg, #((\Constant) & 0xFFFF) + movt \DestReg, #((\Constant) >> 16) +.endm diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm64.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm64.inc index 4997e18b3..fa4265ab3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm64.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosarm64.inc @@ -26,6 +26,24 @@ C_FUNC(\Name): .endm +.macro ALTERNATE_ENTRY Name +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name) + .private_extern C_FUNC(\Name) +#else + .global C_FUNC(\Name) + .hidden C_FUNC(\Name) +#endif +C_FUNC(\Name): +.endm + +// On MacOS, local labels cannot be used in arithmetic expressions. +#if defined(__APPLE__) +#define FIXUP_LABEL(name) name +#else +#define FIXUP_LABEL(name) .L##name +#endif + .macro LEAF_ENTRY Name, Section .global C_FUNC(\Name) #if defined(__APPLE__) @@ -46,8 +64,13 @@ C_FUNC(\Name): .endm .macro LEAF_END_MARKED Name, Section -C_FUNC(\Name\()_End): +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name\()_End) + .private_extern C_FUNC(\Name\()_End) +#else .global C_FUNC(\Name\()_End) +#endif +C_FUNC(\Name\()_End): LEAF_END \Name, \Section // make sure this symbol gets its own address nop @@ -103,6 +126,13 @@ C_FUNC(\Name\()_End): .endif .endm +.macro PROLOG_SAVE_REG_PAIR_NO_FP_INDEXED reg1, reg2, ofs + stp \reg1, \reg2, [sp, \ofs]! + .cfi_adjust_cfa_offset -\ofs + .cfi_rel_offset \reg1, 0 + .cfi_rel_offset \reg2, 8 +.endm + .macro EPILOG_RESTORE_REG reg, ofs ldr \reg, [sp, \ofs] .cfi_restore \reg @@ -126,7 +156,7 @@ C_FUNC(\Name\()_End): .endm .macro EMIT_BREAKPOINT - brk #0 + brk #0xf000 .endm //----------------------------------------------------------------------------- @@ -159,6 +189,7 @@ C_FUNC(\Name\()_End): // ArgumentRegisters::x2 // ArgumentRegisters::x1 // ArgumentRegisters::x0 +// ArgumentRegisters::x8 // FloatRegisters::q7 // FloatRegisters::q6 // FloatRegisters::q5 @@ -167,7 +198,7 @@ C_FUNC(\Name\()_End): // FloatRegisters::q2 // FloatRegisters::q1 // FloatRegisters::q0 -.macro PROLOG_WITH_TRANSITION_BLOCK extraLocals = 0, SaveFPArgs = 1 +.macro PROLOG_WITH_TRANSITION_BLOCK extraLocals = 0, SaveFPArgs = 1, SaveGPArgs = 1 __PWTB_FloatArgumentRegisters = \extraLocals __PWTB_SaveFPArgs = \SaveFPArgs @@ -178,9 +209,9 @@ C_FUNC(\Name\()_End): __PWTB_TransitionBlock = __PWTB_FloatArgumentRegisters - .if (__PWTB_SaveFPArgs == 1) - __PWTB_TransitionBlock = __PWTB_TransitionBlock + SIZEOF__FloatArgumentRegisters - .endif + // Always reserve space for the FP arg regs, even if they are not saved in the PROLOG_WITH_TRANSITION_BLOCK + // Some code using this macro saves them optionally + __PWTB_TransitionBlock = __PWTB_TransitionBlock + SIZEOF__FloatArgumentRegisters __PWTB_StackAlloc = __PWTB_TransitionBlock __PWTB_ArgumentRegisters = __PWTB_StackAlloc + 104 @@ -197,8 +228,10 @@ C_FUNC(\Name\()_End): // Allocate space for the rest of the frame PROLOG_STACK_ALLOC __PWTB_StackAlloc - // Spill argument registers. - SAVE_ARGUMENT_REGISTERS sp, __PWTB_ArgumentRegisters + .if (\SaveGPArgs == 1) + // Spill argument registers. + SAVE_ARGUMENT_REGISTERS sp, __PWTB_ArgumentRegisters + .endif .if (__PWTB_SaveFPArgs == 1) SAVE_FLOAT_ARGUMENT_REGISTERS sp, \extraLocals @@ -211,7 +244,7 @@ C_FUNC(\Name\()_End): // base address to be passed in $reg // -// Reserve 64 bytes of memory before calling SAVE_ARGUMENT_REGISTERS +// Reserve 72 bytes of memory before calling SAVE_ARGUMENT_REGISTERS .macro SAVE_ARGUMENT_REGISTERS reg, ofs str x8, [\reg, #(\ofs)] @@ -276,7 +309,6 @@ C_FUNC(\Name\()_End): .endm - //----------------------------------------------------------------------------- // Provides a matching epilog to PROLOG_WITH_TRANSITION_BLOCK and ends by preparing for tail-calling. // Since this is a tail call argument registers are restored. @@ -300,6 +332,95 @@ C_FUNC(\Name\()_End): .endm +// Loads the address of a thread-local variable into the target register, +// which cannot be x0. +// Preserves registers except for xip0 and xip1 on Apple +.macro INLINE_GET_TLS_VAR target, var + .ifc \target, x0 + .error "target cannot be x0" + .endif + + // This sequence of instructions is recognized and potentially patched + // by the linker (GD->IE/LE relaxation). +#if defined(__APPLE__) + + adrp x0, \var@TLVPPAGE + ldr x0, [x0, \var@TLVPPAGEOFF] + ldr \target, [x0] + + blr \target + // End of the sequence + + mov \target, x0 +#else + adrp x0, :tlsdesc:\var + ldr \target, [x0, #:tlsdesc_lo12:\var] + add x0, x0, :tlsdesc_lo12:\var + .tlsdesccall \var + blr \target + // End of the sequence + + mrs \target, tpidr_el0 + add \target, \target, x0 +#endif + +.endm + + +// Inlined version of GetThreadEEAllocContext. Target cannot be x0 or x1. +.macro INLINE_GET_ALLOC_CONTEXT_BASE target + .ifc \target, x0 + .error "target cannot be x0" + .endif + .ifc \target, x1 + .error "target cannot be x1" + .endif + +#if defined(FEATURE_EMULATED_TLS) || defined(__APPLE__) + PROLOG_SAVE_REG_PAIR_INDEXED fp, lr, -0x20 + PROLOG_SAVE_REG_PAIR x0, x1, 0x10 + + bl C_FUNC(GetThreadEEAllocContext) + mov \target, x0 + + EPILOG_RESTORE_REG_PAIR x0, x1, 0x10 + EPILOG_RESTORE_REG_PAIR_INDEXED fp, lr, 0x20 +#else + PROLOG_SAVE_REG_PAIR_INDEXED x0, lr, -0x10 + INLINE_GET_TLS_VAR \target, t_runtime_thread_locals + + .ifnc OFFSETOF__RuntimeThreadLocals__ee_alloc_context, 0 + add \target, x0, OFFSETOF__RuntimeThreadLocals__ee_alloc_context + .endif + + EPILOG_RESTORE_REG_PAIR_INDEXED x0, lr, 0x10 +#endif +.endm + +// Pushes a TransitionBlock on the stack without saving the argument registers. +// See the PROLOG_WITH_TRANSITION_BLOCK macro for the stack layout. +.macro PUSH_COOP_PINVOKE_FRAME target + PROLOG_SAVE_REG_PAIR_INDEXED fp, lr, -176 + + // Spill callee saved registers + PROLOG_SAVE_REG_PAIR x19, x20, 16 + PROLOG_SAVE_REG_PAIR x21, x22, 32 + PROLOG_SAVE_REG_PAIR x23, x24, 48 + PROLOG_SAVE_REG_PAIR x25, x26, 64 + PROLOG_SAVE_REG_PAIR x27, x28, 80 + + mov \target, sp +.endm + +.macro POP_COOP_PINVOKE_FRAME + EPILOG_RESTORE_REG_PAIR x19, x20, 16 + EPILOG_RESTORE_REG_PAIR x21, x22, 32 + EPILOG_RESTORE_REG_PAIR x23, x24, 48 + EPILOG_RESTORE_REG_PAIR x25, x26, 64 + EPILOG_RESTORE_REG_PAIR x27, x28, 80 + EPILOG_RESTORE_REG_PAIR_INDEXED fp, lr, 176 +.endm + // ------------------------------------------------------------------ // Macro to generate Redirection Stubs // @@ -381,3 +502,13 @@ $__RedirectionStubEndFuncName 0: #endif .endm + +#define xip0 x16 +#define xip1 x17 +#define xpr x18 + +// Inlined version of RhpGetThread. Target cannot be x0. +.macro INLINE_GETTHREAD target + INLINE_GET_TLS_VAR \target, C_FUNC(t_CurrentThreadInfo) + ldr \target, [\target, #OFFSETOF__ThreadLocalInfo__m_pThread] +.endm diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosloongarch64.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosloongarch64.inc index 2ff98d29e..66ebdd147 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosloongarch64.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosloongarch64.inc @@ -17,6 +17,12 @@ C_FUNC(\Name): .endm +.macro ALTERNATE_ENTRY Name + .global C_FUNC(\Name) + .hidden C_FUNC(\Name) +C_FUNC(\Name): +.endm + .macro LEAF_ENTRY Name, Section .global C_FUNC(\Name) .type \Name, %function @@ -41,6 +47,16 @@ C_FUNC(\Name\()_End): la.local \HelperReg, \Name .endm +.macro PREPARE_EXTERNAL_VAR_INDIRECT Name, HelperReg + la.local \HelperReg, \Name + ld.d \HelperReg, \HelperReg, 0 +.endm + +.macro PREPARE_EXTERNAL_VAR_INDIRECT_W Name, HelperReg + la.local \HelperReg, \Name + ld.w \HelperReg, \HelperReg, 0 +.endm + .macro PROLOG_STACK_ALLOC Size addi.d $sp, $sp, -\Size //.cfi_adjust_cfa_offset \Size @@ -66,14 +82,8 @@ C_FUNC(\Name\()_End): ////NOTE: reg1 and reg2 must be the number and GPR type !!! .macro PROLOG_SAVE_REG_PAIR reg1, reg2, ofs, __def_cfa_save=0 -//#ifdef FEATURE_LOONGSONISA -// //NOTE:The offset of gssq/gslq must be 16-bytes aligned. -// // here ofs must be 16-bytes aligned. -// gssq \reg2, \reg1, \ofs(sp) -//#else st.d $r\reg1, $sp, \ofs st.d $r\reg2, $sp, \ofs+8 -//#endif .cfi_rel_offset \reg1, \ofs .cfi_rel_offset \reg2, \ofs + 8 @@ -107,23 +117,15 @@ C_FUNC(\Name\()_End): .endm .macro EPILOG_RESTORE_REG_PAIR reg1, reg2, ofs -//#ifdef FEATURE_LOONGSONISA -// gslq \reg2, \reg1, \ofs(sp) -//#else ld.d $r\reg2, $sp, \ofs+8 ld.d $r\reg1, $sp, \ofs -//#endif .cfi_restore \reg2 .cfi_restore \reg1 .endm .macro EPILOG_RESTORE_REG_PAIR_INDEXED reg1, reg2, ssize -//#ifdef FEATURE_LOONGSONISA -// gslq \reg2, \reg1, 0(sp) -//#else ld.d $r\reg2, $sp, 8 ld.d $r\reg1, $sp, 0 -//#endif .cfi_restore \reg2 .cfi_restore \reg1 @@ -160,21 +162,13 @@ C_FUNC(\Name\()_End): PROLOG_SAVE_REG_PAIR 25, 26, \ofs + 32 PROLOG_SAVE_REG_PAIR 27, 28, \ofs + 48 PROLOG_SAVE_REG_PAIR 29, 30, \ofs + 64 - PROLOG_SAVE_REG_PAIR 31, 2, \ofs + 80 + PROLOG_SAVE_REG 31, \ofs + 80 .endm // Reserve 64 bytes of memory before calling SAVE_ARGUMENT_REGISTERS .macro SAVE_ARGUMENT_REGISTERS reg, ofs -//#ifdef FEATURE_LOONGSONISA -// //NOTE:The offset of gssq/gslq must be 16-bytes aligned. -// // here ofs must be 16-bytes aligned. -// gssq a1, a0, \ofs(\reg) -// gssq a3, a2, \ofs+16(\reg) -// gssq a5, a4, \ofs+32(\reg) -// gssq a7, a6, \ofs+48(\reg) -//#else st.d $a0, \reg, \ofs st.d $a1, \reg, \ofs+8 st.d $a2, \reg, \ofs+16 @@ -183,21 +177,12 @@ C_FUNC(\Name\()_End): st.d $a5, \reg, \ofs+40 st.d $a6, \reg, \ofs+48 st.d $a7, \reg, \ofs+56 -//#endif .endm // Reserve 64 bytes of memory before calling SAVE_FLOAT_ARGUMENT_REGISTERS .macro SAVE_FLOAT_ARGUMENT_REGISTERS reg, ofs -//#ifdef FEATURE_LOONGSONISA -// //NOTE:The offset of gssqc1/gslqc1 must be 16-bytes aligned. -// // here ofs must be 16-bytes aligned. -// gssqc1 $f13, $f12, \ofs(\reg) -// gssqc1 $f15, $f14, \ofs+16(\reg) -// gssqc1 $f17, $f16, \ofs+32(\reg) -// gssqc1 $f19, $f18, \ofs+48(\reg) -//#else fst.d $f0, \reg, \ofs fst.d $f1, \reg, \ofs+8 fst.d $f2, \reg, \ofs+16 @@ -206,21 +191,12 @@ C_FUNC(\Name\()_End): fst.d $f5, \reg, \ofs+40 fst.d $f6, \reg, \ofs+48 fst.d $f7, \reg, \ofs+56 -//#endif .endm // Reserve 64 bytes of memory before calling SAVE_FLOAT_CALLEESAVED_REGISTERS .macro SAVE_FLOAT_CALLEESAVED_REGISTERS reg, ofs -//#ifdef FEATURE_LOONGSONISA -// //NOTE:The offset of gssqc1/gslqc1 must be 16-bytes aligned. -// // here ofs must be 16-bytes aligned. -// gssqc1 $f25, $f24, \ofs(\reg) -// gssqc1 $f27, $f26, \ofs+16(\reg) -// gssqc1 $f29, $f28, \ofs+32(\reg) -// gssqc1 $f31, $f30, \ofs+48(\reg) -//#else fst.d $f24, \reg, \ofs fst.d $f25, \reg, \ofs+8 fst.d $f26, \reg, \ofs+16 @@ -229,14 +205,12 @@ C_FUNC(\Name\()_End): fst.d $f29, \reg, \ofs+40 fst.d $f30, \reg, \ofs+48 fst.d $f31, \reg, \ofs+56 -//#endif .endm .macro RESTORE_CALLEESAVED_REGISTERS reg, ofs - EPILOG_RESTORE_REG_PAIR 31, 2 \ofs + 80 - + EPILOG_RESTORE_REG 31, \ofs + 80 EPILOG_RESTORE_REG_PAIR 29, 30, \ofs + 64 EPILOG_RESTORE_REG_PAIR 27, 28, \ofs + 48 EPILOG_RESTORE_REG_PAIR 25, 26, \ofs + 32 @@ -245,14 +219,6 @@ C_FUNC(\Name\()_End): .macro RESTORE_ARGUMENT_REGISTERS reg, ofs -//#ifdef FEATURE_LOONGSONISA -// //NOTE:The offset of gssq/gslq must be 16-bytes aligned. -// // here ofs must be 16-bytes aligned. -// gslq a7, a6, \ofs+48(\reg) -// gslq a5, a4, \ofs+32(\reg) -// gslq a3, a2, \ofs+16(\reg) -// gslq a1, a0, \ofs(\reg) -//#else ld.d $a7, \reg, \ofs+56 ld.d $a6, \reg, \ofs+48 ld.d $a5, \reg, \ofs+40 @@ -261,18 +227,11 @@ C_FUNC(\Name\()_End): ld.d $a2, \reg, \ofs+16 ld.d $a1, \reg, \ofs+8 ld.d $a0, \reg, \ofs -//#endif .endm .macro RESTORE_FLOAT_ARGUMENT_REGISTERS reg, ofs -//#ifdef FEATURE_LOONGSONISA -// gslqc1 $f19, $f18, \ofs+48(\reg) -// gslqc1 $f17, $f16, \ofs+32(\reg) -// gslqc1 $f15, $f14, \ofs+16(\reg) -// gslqc1 $f13, $f12, \ofs(\reg) -//#else fld.d $f7, \reg, \ofs+56 fld.d $f6, \reg, \ofs+48 fld.d $f5, \reg, \ofs+40 @@ -281,20 +240,11 @@ C_FUNC(\Name\()_End): fld.d $f2, \reg, \ofs+16 fld.d $f1, \reg, \ofs+8 fld.d $f0, \reg, \ofs -//#endif .endm .macro RESTORE_FLOAT_CALLEESAVED_REGISTERS reg, ofs -//#ifdef FEATURE_LOONGSONISA -// //NOTE:The offset of gssqc1/gslqc1 must be 16-bytes aligned. -// // here ofs must be 16-bytes aligned. -// gslqc1 $f25, $f24, \ofs(\reg) -// gslqc1 $f27, $f26, \ofs+16(\reg) -// gslqc1 $f29, $f28, \ofs+32(\reg) -// gslqc1 $f31, $f30, \ofs+48(\reg) -//#else fld.d $f24, $r\reg, \ofs fld.d $f25, $r\reg, \ofs+8 fld.d $f26, $r\reg, \ofs+16 @@ -303,7 +253,6 @@ C_FUNC(\Name\()_End): fld.d $f29, $r\reg, \ofs+40 fld.d $f30, $r\reg, \ofs+48 fld.d $f31, $r\reg, \ofs+56 -//#endif .endm @@ -322,7 +271,6 @@ C_FUNC(\Name\()_End): // GPR_a0 // // General Registers: -// GPR_tp // GPR_s8 // GPR_s7 // GPR_s6 @@ -366,7 +314,7 @@ C_FUNC(\Name\()_End): __PWTB_CalleeSavedRegisters = __PWTB_TransitionBlock __PWTB_ArgumentRegisters = __PWTB_TransitionBlock + 96 - // Including fp, ra, s0-s8, tp, and (a0-a7)arguments. (1+1+9+1)*8 + 8*8. + // Including fp, ra, s0-s8, padding, and (a0-a7)arguments. (1+1+9+1)*8 + 8*8. __PWTB_StackAlloc = __PWTB_TransitionBlock + 96 + 64 PROLOG_STACK_ALLOC __PWTB_StackAlloc // $fp,$ra @@ -418,6 +366,44 @@ C_FUNC(\Name\()_End): .endm +// Inlined version of GetThreadEEAllocContext. Target cannot be a0. +.macro INLINE_GET_ALLOC_CONTEXT_BASE target + .ifc \target, $a0 + .error "target cannot be a0" + .endif + + // Save $a0, $ra + PROLOG_SAVE_REG_PAIR_INDEXED 4, 1, 16, 0 + + // This instruction is recognized and potentially patched + // by the linker (GD->IE/LE relaxation). + la.tls.desc $a0, t_runtime_thread_locals + + addi.d \target, $tp, OFFSETOF__RuntimeThreadLocals__ee_alloc_context + add.d \target, \target, $a0 + + // Restore $a0, $ra + EPILOG_RESTORE_REG_PAIR_INDEXED 4, 1, 16 +.endm + +// Pushes a TransitionBlock on the stack without saving the argument registers. +// See the PROLOG_WITH_TRANSITION_BLOCK macro for the stack layout. +.macro PUSH_COOP_PINVOKE_FRAME target + // Including fp, ra, s0-s8, padding, and (a0-a7)arguments. (1+1+9+1)*8 + 8*8 == 96. + PROLOG_STACK_ALLOC 160 + // $fp,$ra + PROLOG_SAVE_REG_PAIR 22, 1, 0, 1 + // Spill callee saved registers. $sp=$r3. + SAVE_CALLEESAVED_REGISTERS 3, 0 + move \target, $sp +.endm + +.macro POP_COOP_PINVOKE_FRAME + RESTORE_CALLEESAVED_REGISTERS 3, 0 + EPILOG_RESTORE_REG_PAIR 22, 1, 0 + EPILOG_STACK_FREE 160 +.endm + // ------------------------------------------------------------------ // Macro to generate Redirection Stubs // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosriscv64.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosriscv64.inc index af7e5336e..8201a0381 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosriscv64.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosriscv64.inc @@ -37,6 +37,12 @@ C_FUNC(\Name\()_End): nop .endm +.macro ALTERNATE_ENTRY Name + .global C_FUNC(\Name) + .hidden C_FUNC(\Name) +C_FUNC(\Name): +.endm + .macro PREPARE_EXTERNAL_VAR Name, HelperReg lla \HelperReg, \Name .endm @@ -222,8 +228,12 @@ C_FUNC(\Name\()_End): // GPR_a1 // GPR_a0 // -// General Registers: +// Callee Saved Registers: +// GPR_gp // GPR_tp +// GPR_s11 +// GPR_s10 +// GPR_s9 // GPR_s8 // GPR_s7 // GPR_s6 @@ -232,7 +242,6 @@ C_FUNC(\Name\()_End): // GPR_s3 // GPR_s2 // GPR_s1 -// GPR_s0 // GPR_ra // GPR_fp // @@ -256,11 +265,8 @@ C_FUNC(\Name\()_End): __PWTB_FloatArgumentRegisters = \extraLocals - // Note, stack (see __PWTB_StackAlloc variable) must be 16 byte aligned, - // SIZEOF__FloatArgumentRegisters (0x40) is 16 byte aligned, that mean initial - // __PWTB_FloatArgumentRegisters value must be not 16 byte aligned and - // after add (120 + 64) provide 16 byte aligned result. - .if ((__PWTB_FloatArgumentRegisters % 16) == 0) + // Note, stack (see __PWTB_StackAlloc variable) must be 16 byte aligned. + .if ((__PWTB_FloatArgumentRegisters % 16) != 0) __PWTB_FloatArgumentRegisters = __PWTB_FloatArgumentRegisters + 8 .endif @@ -272,10 +278,10 @@ C_FUNC(\Name\()_End): __PWTB_CalleeSavedRegisters = __PWTB_TransitionBlock - __PWTB_ArgumentRegisters = __PWTB_TransitionBlock + 120 + __PWTB_ArgumentRegisters = __PWTB_TransitionBlock + 120 + 8 - // Including fp, ra, s1-s11, tp, gp, and (a0-a7)arguments. (1+1+11+1+1)*8 + 8*8. - __PWTB_StackAlloc = __PWTB_TransitionBlock + 120 + 64 + // Including fp, ra, s1-s11, tp, gp, padding and (a0-a7)arguments. (1+1+11+1+1)*8 + 8 + 8*8. + __PWTB_StackAlloc = __PWTB_TransitionBlock + 120 + 8 + 64 PROLOG_STACK_ALLOC __PWTB_StackAlloc PROLOG_SAVE_REG_PAIR fp, ra, __PWTB_CalleeSavedRegisters, 1 @@ -293,7 +299,6 @@ C_FUNC(\Name\()_End): .endm .macro EPILOG_WITH_TRANSITION_BLOCK_RETURN - RESTORE_CALLEESAVED_REGISTERS sp, __PWTB_CalleeSavedRegisters EPILOG_RESTORE_REG_PAIR fp, ra, __PWTB_CalleeSavedRegisters @@ -322,6 +327,28 @@ C_FUNC(\Name\()_End): EPILOG_STACK_FREE __PWTB_StackAlloc .endm +// Inlined version of GetThreadEEAllocContext +.macro INLINE_GET_ALLOC_CONTEXT_BASE + call C_FUNC(GetThreadEEAllocContext) +.endm + +// Pushes a TransitionBlock on the stack without saving the argument registers. +// See the PROLOG_WITH_TRANSITION_BLOCK macro for the stack layout. +.macro PUSH_COOP_PINVOKE_FRAME target + // Including fp, ra, s1-s11, tp, gp, padding and (a0-a7)arguments. (1+1+11+1+1)*8 + 8 + 8*8. + PROLOG_STACK_ALLOC 192 + PROLOG_SAVE_REG_PAIR fp, ra, 0, 1 + // Spill callee saved registers. sp=r2. + SAVE_CALLEESAVED_REGISTERS sp, 0 + mv \target, sp +.endm + +.macro POP_COOP_PINVOKE_FRAME + RESTORE_CALLEESAVED_REGISTERS sp, 0 + EPILOG_RESTORE_REG_PAIR fp, ra, 0 + EPILOG_STACK_FREE 192 +.endm + // ------------------------------------------------------------------ // Macro to generate Redirection Stubs // diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosx86.inc b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosx86.inc index 7bc994a77..c28b2b170 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosx86.inc +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/inc/unixasmmacrosx86.inc @@ -24,6 +24,12 @@ C_FUNC(\Name): C_FUNC(\Name): .endm +.macro ALTERNATE_ENTRY Name + .global C_FUNC(\Name) + .type \Name, %function +C_FUNC(\Name): +.endm + .macro LEAF_END Name, Section .size \Name, .-\Name .cfi_endproc @@ -50,6 +56,11 @@ C_FUNC(\Name\()_End): .cfi_rel_offset \Reg, 0 .endm +.macro PROLOG_ALLOC Size + sub esp, \Size + .cfi_adjust_cfa_offset \Size +.endm + .macro PROLOG_END .cfi_def_cfa_register ebp .cfi_def_cfa_offset 8 @@ -63,6 +74,11 @@ C_FUNC(\Name\()_End): .cfi_restore \Reg .endm +.macro EPILOG_FREE Size + add esp, \Size + .cfi_adjust_cfa_offset -\Size +.endm + .macro EPILOG_END pop ebp .endm @@ -75,8 +91,7 @@ C_FUNC(\Name\()_End): .endm .macro ESP_PROLOG_ALLOC Size - sub esp, \Size - .cfi_adjust_cfa_offset \Size + PROLOG_ALLOC \Size .endm .macro ESP_PROLOG_END @@ -91,8 +106,7 @@ C_FUNC(\Name\()_End): .endm .macro ESP_EPILOG_FREE Size - add esp, \Size - .cfi_adjust_cfa_offset -\Size + EPILOG_FREE \Size .endm .macro ESP_EPILOG_END @@ -109,6 +123,49 @@ C_FUNC(\Name\()_End): .intel_syntax noprefix .endm +.macro PUSH_COOP_PINVOKE_FRAME Target + // push ebp-frame + PROLOG_BEG + + // save CalleeSavedRegisters + PROLOG_PUSH ebx + PROLOG_PUSH esi + PROLOG_PUSH edi + + // make space for ArgumentRegisters (8) + alignment (4) + PROLOG_ALLOC 12 + + // set frame pointer + PROLOG_END + + lea \Target, [esp + 4] +.endm + +// Inlined version of GetThreadEEAllocContext. +.macro INLINE_GET_ALLOC_CONTEXT_BASE + push ecx + push eax + call C_FUNC(GetThreadEEAllocContext) + pop eax + pop ecx +.endm + +.macro POP_COOP_PINVOKE_FRAME + // restore stack pointer + EPILOG_BEG + + // skip over alignment (4) + ArgumentRegisters (8) + EPILOG_FREE 12 + + // pop CalleeSavedRegisters + EPILOG_POP edi + EPILOG_POP esi + EPILOG_POP ebx + + // pop ebp-frame + EPILOG_END +.endm + .macro CHECK_STACK_ALIGNMENT #ifdef _DEBUG test esp, 0x0F diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/corerror/makecorerror.bat b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/corerror/makecorerror.bat deleted file mode 100644 index 939404f75..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/corerror/makecorerror.bat +++ /dev/null @@ -1,10 +0,0 @@ -@if "%_echo%"=="" echo off -REM Licensed to the .NET Foundation under one or more agreements. -REM The .NET Foundation licenses this file to you under the MIT license. -setlocal - -csc ..\..\..\inc\genheaders.cs - -genheaders.exe ..\..\..\inc\corerror.xml ..\inc\corerror.h mscorurt.rc - -del genheaders.exe diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/corerror/readme.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/corerror/readme.txt deleted file mode 100644 index a21a72490..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/corerror/readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -Steps to generate corerror.h for the Unix: - -Open Razzle window -tf edit ..\inc\corerror.h -tf edit mscorurt.rc -makecorerror.bat -tf undo any files that didn't get modified \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/corpub_i.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/corpub_i.cpp deleted file mode 100644 index 8aa67f888..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/corpub_i.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - - -/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ - -/* link this file in with the server and any clients */ - - - /* File created by MIDL compiler version 8.00.0603 */ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - -#include -#include - -#ifdef _MIDL_USE_GUIDDEF_ - -#ifndef INITGUID -#define INITGUID -#include -#undef INITGUID -#else -#include -#endif - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) - -#else // !_MIDL_USE_GUIDDEF_ - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef struct _IID -{ - unsigned long x; - unsigned short s1; - unsigned short s2; - unsigned char c[8]; -} IID; - -#endif // __IID_DEFINED__ - -#ifndef CLSID_DEFINED -#define CLSID_DEFINED -typedef IID CLSID; -#endif // CLSID_DEFINED - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} - -#endif // !_MIDL_USE_GUIDDEF_ - -MIDL_DEFINE_GUID(IID, LIBID_CorpubProcessLib,0xe97ca460,0x657d,0x11d3,0x8d,0x5b,0x00,0x10,0x4b,0x35,0xe7,0xef); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CorpubPublish,0x047a9a40,0x657e,0x11d3,0x8d,0x5b,0x00,0x10,0x4b,0x35,0xe7,0xef); - - -MIDL_DEFINE_GUID(IID, IID_ICorPublish,0x9613A0E7,0x5A68,0x11d3,0x8F,0x84,0x00,0xA0,0xC9,0xB4,0xD5,0x0C); - - -MIDL_DEFINE_GUID(IID, IID_ICorPublishEnum,0xC0B22967,0x5A69,0x11d3,0x8F,0x84,0x00,0xA0,0xC9,0xB4,0xD5,0x0C); - - -MIDL_DEFINE_GUID(IID, IID_ICorPublishProcess,0x18D87AF1,0x5A6A,0x11d3,0x8F,0x84,0x00,0xA0,0xC9,0xB4,0xD5,0x0C); - - -MIDL_DEFINE_GUID(IID, IID_ICorPublishAppDomain,0xD6315C8F,0x5A6A,0x11d3,0x8F,0x84,0x00,0xA0,0xC9,0xB4,0xD5,0x0C); - - -MIDL_DEFINE_GUID(IID, IID_ICorPublishProcessEnum,0xA37FBD41,0x5A69,0x11d3,0x8F,0x84,0x00,0xA0,0xC9,0xB4,0xD5,0x0C); - - -MIDL_DEFINE_GUID(IID, IID_ICorPublishAppDomainEnum,0x9F0C98F5,0x5A6A,0x11d3,0x8F,0x84,0x00,0xA0,0xC9,0xB4,0xD5,0x0C); - -#undef MIDL_DEFINE_GUID - -#ifdef __cplusplus -} -#endif - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/sospriv_i.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/sospriv_i.cpp index 579be51d3..f3c4867a3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/sospriv_i.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/idl/sospriv_i.cpp @@ -127,6 +127,9 @@ MIDL_DEFINE_GUID(IID, IID_ISOSMethodEnum,0x3c0fe725,0xc324,0x4a4f,0x81,0x00,0xd3 MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface15,0x7ed81261,0x52a9,0x4a23,0xa3,0x58,0xc3,0x31,0x3d,0xea,0x30,0xa8); + +MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface16,0x4ba12ff8,0xdaac,0x4e43,0xac,0x56,0x98,0xcf,0x8d,0x5c,0x59,0x5d); + #undef MIDL_DEFINE_GUID #ifdef __cplusplus diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/clrinternal.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/clrinternal.h index 16fd6841d..a7beeef8c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/clrinternal.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/clrinternal.h @@ -73,7 +73,6 @@ enum __MIDL___MIDL_itf_clrinternal_0000_0000_0001 CRST_UNSAFE_COOPGC = 0x4, CRST_UNSAFE_ANYMODE = 0x8, CRST_DEBUGGER_THREAD = 0x10, - CRST_HOST_BREAKABLE = 0x20, CRST_TAKEN_DURING_SHUTDOWN = 0x80, CRST_GC_NOTRIGGER_WHEN_TAKEN = 0x100, CRST_DEBUG_ONLY_CHECK_FORBID_SUSPEND_THREAD = 0x200 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corerror.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corerror.h index 0b4756790..7106a8bbf 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corerror.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corerror.h @@ -213,7 +213,7 @@ #define CORDIAGIPC_E_UNKNOWN_ERROR EMAKEHR(0x1387) #define CORPROF_E_SUSPENSION_IN_PROGRESS EMAKEHR(0x1388) #define CORPROF_E_NOT_GC_OBJECT EMAKEHR(0x1389) -#define CORPROF_E_MODULE_IS_ENC EMAKEHR(0x138A) +#define CORPROF_E_MODULE_IS_ENC EMAKEHR(0x138a) #define CORSEC_E_POLICY_EXCEPTION EMAKEHR(0x1416) #define CORSEC_E_MIN_GRANT_FAIL EMAKEHR(0x1417) #define CORSEC_E_NO_EXEC_PERM EMAKEHR(0x1418) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corprof.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corprof.h index ad54c4e6b..b45d1c8f7 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corprof.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corprof.h @@ -583,9 +583,9 @@ enum __MIDL___MIDL_itf_corprof_0000_0000_0005 COR_PRF_DISABLE_ALL_NGEN_IMAGES = 0x80000000, COR_PRF_ALL = 0x8fffffff, COR_PRF_REQUIRE_PROFILE_IMAGE = ( ( COR_PRF_USE_PROFILE_IMAGES | COR_PRF_MONITOR_CODE_TRANSITIONS ) | COR_PRF_MONITOR_ENTERLEAVE ) , - COR_PRF_ALLOWABLE_AFTER_ATTACH = ( ( ( ( ( ( ( ( ( ( COR_PRF_MONITOR_THREADS | COR_PRF_MONITOR_MODULE_LOADS ) | COR_PRF_MONITOR_ASSEMBLY_LOADS ) | COR_PRF_MONITOR_APPDOMAIN_LOADS ) | COR_PRF_ENABLE_STACK_SNAPSHOT ) | COR_PRF_MONITOR_GC ) | COR_PRF_MONITOR_SUSPENDS ) | COR_PRF_MONITOR_CLASS_LOADS ) | COR_PRF_MONITOR_EXCEPTIONS ) | COR_PRF_MONITOR_JIT_COMPILATION ) | COR_PRF_ENABLE_REJIT ) , + COR_PRF_ALLOWABLE_AFTER_ATTACH = ( ( ( ( ( ( ( ( ( ( ( ( COR_PRF_MONITOR_THREADS | COR_PRF_MONITOR_MODULE_LOADS ) | COR_PRF_MONITOR_ASSEMBLY_LOADS ) | COR_PRF_MONITOR_APPDOMAIN_LOADS ) | COR_PRF_ENABLE_STACK_SNAPSHOT ) | COR_PRF_MONITOR_GC ) | COR_PRF_MONITOR_SUSPENDS ) | COR_PRF_MONITOR_CLASS_LOADS ) | COR_PRF_MONITOR_EXCEPTIONS ) | COR_PRF_MONITOR_JIT_COMPILATION ) | COR_PRF_DISABLE_INLINING ) | COR_PRF_DISABLE_OPTIMIZATIONS ) | COR_PRF_ENABLE_REJIT ) , COR_PRF_ALLOWABLE_NOTIFICATION_PROFILER = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( COR_PRF_MONITOR_FUNCTION_UNLOADS | COR_PRF_MONITOR_CLASS_LOADS ) | COR_PRF_MONITOR_MODULE_LOADS ) | COR_PRF_MONITOR_ASSEMBLY_LOADS ) | COR_PRF_MONITOR_APPDOMAIN_LOADS ) | COR_PRF_MONITOR_JIT_COMPILATION ) | COR_PRF_MONITOR_EXCEPTIONS ) | COR_PRF_MONITOR_OBJECT_ALLOCATED ) | COR_PRF_MONITOR_THREADS ) | COR_PRF_MONITOR_CODE_TRANSITIONS ) | COR_PRF_MONITOR_CCW ) | COR_PRF_MONITOR_SUSPENDS ) | COR_PRF_MONITOR_CACHE_SEARCHES ) | COR_PRF_DISABLE_INLINING ) | COR_PRF_DISABLE_OPTIMIZATIONS ) | COR_PRF_ENABLE_OBJECT_ALLOCATED ) | COR_PRF_MONITOR_CLR_EXCEPTIONS ) | COR_PRF_ENABLE_STACK_SNAPSHOT ) | COR_PRF_USE_PROFILE_IMAGES ) | COR_PRF_DISABLE_ALL_NGEN_IMAGES ) , - COR_PRF_MONITOR_IMMUTABLE = ( ( ( ( ( ( ( ( ( ( ( ( ( ( COR_PRF_MONITOR_CODE_TRANSITIONS | COR_PRF_MONITOR_REMOTING ) | COR_PRF_MONITOR_REMOTING_COOKIE ) | COR_PRF_MONITOR_REMOTING_ASYNC ) | COR_PRF_ENABLE_INPROC_DEBUGGING ) | COR_PRF_ENABLE_JIT_MAPS ) | COR_PRF_DISABLE_OPTIMIZATIONS ) | COR_PRF_DISABLE_INLINING ) | COR_PRF_ENABLE_OBJECT_ALLOCATED ) | COR_PRF_ENABLE_FUNCTION_ARGS ) | COR_PRF_ENABLE_FUNCTION_RETVAL ) | COR_PRF_ENABLE_FRAME_INFO ) | COR_PRF_USE_PROFILE_IMAGES ) | COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST ) | COR_PRF_DISABLE_ALL_NGEN_IMAGES ) + COR_PRF_MONITOR_IMMUTABLE = ( ( ( ( ( ( ( ( ( ( ( ( COR_PRF_MONITOR_CODE_TRANSITIONS | COR_PRF_MONITOR_REMOTING ) | COR_PRF_MONITOR_REMOTING_COOKIE ) | COR_PRF_MONITOR_REMOTING_ASYNC ) | COR_PRF_ENABLE_INPROC_DEBUGGING ) | COR_PRF_ENABLE_JIT_MAPS ) | COR_PRF_ENABLE_OBJECT_ALLOCATED ) | COR_PRF_ENABLE_FUNCTION_ARGS ) | COR_PRF_ENABLE_FUNCTION_RETVAL ) | COR_PRF_ENABLE_FRAME_INFO ) | COR_PRF_USE_PROFILE_IMAGES ) | COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST ) | COR_PRF_DISABLE_ALL_NGEN_IMAGES ) } COR_PRF_MONITOR; typedef /* [public] */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corpub.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corpub.h deleted file mode 100644 index bc1ef7630..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/corpub.h +++ /dev/null @@ -1,820 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.00.0603 */ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __corpub_h__ -#define __corpub_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __CorpubPublish_FWD_DEFINED__ -#define __CorpubPublish_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CorpubPublish CorpubPublish; -#else -typedef struct CorpubPublish CorpubPublish; -#endif /* __cplusplus */ - -#endif /* __CorpubPublish_FWD_DEFINED__ */ - - -#ifndef __ICorPublish_FWD_DEFINED__ -#define __ICorPublish_FWD_DEFINED__ -typedef interface ICorPublish ICorPublish; - -#endif /* __ICorPublish_FWD_DEFINED__ */ - - -#ifndef __ICorPublishEnum_FWD_DEFINED__ -#define __ICorPublishEnum_FWD_DEFINED__ -typedef interface ICorPublishEnum ICorPublishEnum; - -#endif /* __ICorPublishEnum_FWD_DEFINED__ */ - - -#ifndef __ICorPublishProcess_FWD_DEFINED__ -#define __ICorPublishProcess_FWD_DEFINED__ -typedef interface ICorPublishProcess ICorPublishProcess; - -#endif /* __ICorPublishProcess_FWD_DEFINED__ */ - - -#ifndef __ICorPublishAppDomain_FWD_DEFINED__ -#define __ICorPublishAppDomain_FWD_DEFINED__ -typedef interface ICorPublishAppDomain ICorPublishAppDomain; - -#endif /* __ICorPublishAppDomain_FWD_DEFINED__ */ - - -#ifndef __ICorPublishProcessEnum_FWD_DEFINED__ -#define __ICorPublishProcessEnum_FWD_DEFINED__ -typedef interface ICorPublishProcessEnum ICorPublishProcessEnum; - -#endif /* __ICorPublishProcessEnum_FWD_DEFINED__ */ - - -#ifndef __ICorPublishAppDomainEnum_FWD_DEFINED__ -#define __ICorPublishAppDomainEnum_FWD_DEFINED__ -typedef interface ICorPublishAppDomainEnum ICorPublishAppDomainEnum; - -#endif /* __ICorPublishAppDomainEnum_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_corpub_0000_0000 */ -/* [local] */ - -#if 0 -#endif -typedef /* [public][public] */ -enum __MIDL___MIDL_itf_corpub_0000_0000_0001 - { - COR_PUB_MANAGEDONLY = 0x1 - } COR_PUB_ENUMPROCESS; - -#pragma warning(push) -#pragma warning(disable:28718) - - - - - -#pragma warning(pop) - - -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0000_v0_0_s_ifspec; - - -#ifndef __CorpubProcessLib_LIBRARY_DEFINED__ -#define __CorpubProcessLib_LIBRARY_DEFINED__ - -/* library CorpubProcessLib */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_CorpubProcessLib; - -EXTERN_C const CLSID CLSID_CorpubPublish; - -#ifdef __cplusplus - -class DECLSPEC_UUID("047a9a40-657e-11d3-8d5b-00104b35e7ef") -CorpubPublish; -#endif -#endif /* __CorpubProcessLib_LIBRARY_DEFINED__ */ - -#ifndef __ICorPublish_INTERFACE_DEFINED__ -#define __ICorPublish_INTERFACE_DEFINED__ - -/* interface ICorPublish */ -/* [local][unique][uuid][object] */ - - -EXTERN_C const IID IID_ICorPublish; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9613A0E7-5A68-11d3-8F84-00A0C9B4D50C") - ICorPublish : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE EnumProcesses( - /* [in] */ COR_PUB_ENUMPROCESS Type, - /* [out] */ ICorPublishProcessEnum **ppIEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProcess( - /* [in] */ unsigned int pid, - /* [out] */ ICorPublishProcess **ppProcess) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICorPublishVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICorPublish * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICorPublish * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICorPublish * This); - - HRESULT ( STDMETHODCALLTYPE *EnumProcesses )( - ICorPublish * This, - /* [in] */ COR_PUB_ENUMPROCESS Type, - /* [out] */ ICorPublishProcessEnum **ppIEnum); - - HRESULT ( STDMETHODCALLTYPE *GetProcess )( - ICorPublish * This, - /* [in] */ unsigned int pid, - /* [out] */ ICorPublishProcess **ppProcess); - - END_INTERFACE - } ICorPublishVtbl; - - interface ICorPublish - { - CONST_VTBL struct ICorPublishVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICorPublish_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICorPublish_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICorPublish_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICorPublish_EnumProcesses(This,Type,ppIEnum) \ - ( (This)->lpVtbl -> EnumProcesses(This,Type,ppIEnum) ) - -#define ICorPublish_GetProcess(This,pid,ppProcess) \ - ( (This)->lpVtbl -> GetProcess(This,pid,ppProcess) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICorPublish_INTERFACE_DEFINED__ */ - - -#ifndef __ICorPublishEnum_INTERFACE_DEFINED__ -#define __ICorPublishEnum_INTERFACE_DEFINED__ - -/* interface ICorPublishEnum */ -/* [local][unique][uuid][object] */ - - -EXTERN_C const IID IID_ICorPublishEnum; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0B22967-5A69-11d3-8F84-00A0C9B4D50C") - ICorPublishEnum : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Skip( - /* [in] */ ULONG celt) = 0; - - virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clone( - /* [out] */ ICorPublishEnum **ppEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ ULONG *pcelt) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICorPublishEnumVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICorPublishEnum * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICorPublishEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICorPublishEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( - ICorPublishEnum * This, - /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( - ICorPublishEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - ICorPublishEnum * This, - /* [out] */ ICorPublishEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - ICorPublishEnum * This, - /* [out] */ ULONG *pcelt); - - END_INTERFACE - } ICorPublishEnumVtbl; - - interface ICorPublishEnum - { - CONST_VTBL struct ICorPublishEnumVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICorPublishEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICorPublishEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICorPublishEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICorPublishEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define ICorPublishEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define ICorPublishEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) - -#define ICorPublishEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICorPublishEnum_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_corpub_0000_0003 */ -/* [local] */ - -#pragma warning(push) -#pragma warning(disable:28718) - - -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0003_v0_0_s_ifspec; - -#ifndef __ICorPublishProcess_INTERFACE_DEFINED__ -#define __ICorPublishProcess_INTERFACE_DEFINED__ - -/* interface ICorPublishProcess */ -/* [local][unique][uuid][object] */ - - -EXTERN_C const IID IID_ICorPublishProcess; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("18D87AF1-5A6A-11d3-8F84-00A0C9B4D50C") - ICorPublishProcess : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE IsManaged( - /* [out] */ BOOL *pbManaged) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumAppDomains( - /* [out] */ ICorPublishAppDomainEnum **ppEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProcessID( - /* [out] */ unsigned int *pid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayName( - /* [in] */ ULONG32 cchName, - /* [out] */ ULONG32 *pcchName, - /* [length_is][size_is][out] */ WCHAR *szName) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICorPublishProcessVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICorPublishProcess * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICorPublishProcess * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICorPublishProcess * This); - - HRESULT ( STDMETHODCALLTYPE *IsManaged )( - ICorPublishProcess * This, - /* [out] */ BOOL *pbManaged); - - HRESULT ( STDMETHODCALLTYPE *EnumAppDomains )( - ICorPublishProcess * This, - /* [out] */ ICorPublishAppDomainEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetProcessID )( - ICorPublishProcess * This, - /* [out] */ unsigned int *pid); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( - ICorPublishProcess * This, - /* [in] */ ULONG32 cchName, - /* [out] */ ULONG32 *pcchName, - /* [length_is][size_is][out] */ WCHAR *szName); - - END_INTERFACE - } ICorPublishProcessVtbl; - - interface ICorPublishProcess - { - CONST_VTBL struct ICorPublishProcessVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICorPublishProcess_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICorPublishProcess_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICorPublishProcess_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICorPublishProcess_IsManaged(This,pbManaged) \ - ( (This)->lpVtbl -> IsManaged(This,pbManaged) ) - -#define ICorPublishProcess_EnumAppDomains(This,ppEnum) \ - ( (This)->lpVtbl -> EnumAppDomains(This,ppEnum) ) - -#define ICorPublishProcess_GetProcessID(This,pid) \ - ( (This)->lpVtbl -> GetProcessID(This,pid) ) - -#define ICorPublishProcess_GetDisplayName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetDisplayName(This,cchName,pcchName,szName) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICorPublishProcess_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_corpub_0000_0004 */ -/* [local] */ - -#pragma warning(pop) -#pragma warning(push) -#pragma warning(disable:28718) - - -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0004_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0004_v0_0_s_ifspec; - -#ifndef __ICorPublishAppDomain_INTERFACE_DEFINED__ -#define __ICorPublishAppDomain_INTERFACE_DEFINED__ - -/* interface ICorPublishAppDomain */ -/* [local][unique][uuid][object] */ - - -EXTERN_C const IID IID_ICorPublishAppDomain; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D6315C8F-5A6A-11d3-8F84-00A0C9B4D50C") - ICorPublishAppDomain : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetID( - /* [out] */ ULONG32 *puId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetName( - /* [in] */ ULONG32 cchName, - /* [out] */ ULONG32 *pcchName, - /* [length_is][size_is][out] */ WCHAR *szName) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICorPublishAppDomainVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICorPublishAppDomain * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICorPublishAppDomain * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICorPublishAppDomain * This); - - HRESULT ( STDMETHODCALLTYPE *GetID )( - ICorPublishAppDomain * This, - /* [out] */ ULONG32 *puId); - - HRESULT ( STDMETHODCALLTYPE *GetName )( - ICorPublishAppDomain * This, - /* [in] */ ULONG32 cchName, - /* [out] */ ULONG32 *pcchName, - /* [length_is][size_is][out] */ WCHAR *szName); - - END_INTERFACE - } ICorPublishAppDomainVtbl; - - interface ICorPublishAppDomain - { - CONST_VTBL struct ICorPublishAppDomainVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICorPublishAppDomain_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICorPublishAppDomain_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICorPublishAppDomain_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICorPublishAppDomain_GetID(This,puId) \ - ( (This)->lpVtbl -> GetID(This,puId) ) - -#define ICorPublishAppDomain_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICorPublishAppDomain_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_corpub_0000_0005 */ -/* [local] */ - -#pragma warning(pop) - - -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0005_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_corpub_0000_0005_v0_0_s_ifspec; - -#ifndef __ICorPublishProcessEnum_INTERFACE_DEFINED__ -#define __ICorPublishProcessEnum_INTERFACE_DEFINED__ - -/* interface ICorPublishProcessEnum */ -/* [local][unique][uuid][object] */ - - -EXTERN_C const IID IID_ICorPublishProcessEnum; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A37FBD41-5A69-11d3-8F84-00A0C9B4D50C") - ICorPublishProcessEnum : public ICorPublishEnum - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ ICorPublishProcess **objects, - /* [out] */ ULONG *pceltFetched) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICorPublishProcessEnumVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICorPublishProcessEnum * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICorPublishProcessEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICorPublishProcessEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( - ICorPublishProcessEnum * This, - /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( - ICorPublishProcessEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - ICorPublishProcessEnum * This, - /* [out] */ ICorPublishEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - ICorPublishProcessEnum * This, - /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( - ICorPublishProcessEnum * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ ICorPublishProcess **objects, - /* [out] */ ULONG *pceltFetched); - - END_INTERFACE - } ICorPublishProcessEnumVtbl; - - interface ICorPublishProcessEnum - { - CONST_VTBL struct ICorPublishProcessEnumVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICorPublishProcessEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICorPublishProcessEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICorPublishProcessEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICorPublishProcessEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define ICorPublishProcessEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define ICorPublishProcessEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) - -#define ICorPublishProcessEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - - -#define ICorPublishProcessEnum_Next(This,celt,objects,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICorPublishProcessEnum_INTERFACE_DEFINED__ */ - - -#ifndef __ICorPublishAppDomainEnum_INTERFACE_DEFINED__ -#define __ICorPublishAppDomainEnum_INTERFACE_DEFINED__ - -/* interface ICorPublishAppDomainEnum */ -/* [local][unique][uuid][object] */ - - -EXTERN_C const IID IID_ICorPublishAppDomainEnum; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9F0C98F5-5A6A-11d3-8F84-00A0C9B4D50C") - ICorPublishAppDomainEnum : public ICorPublishEnum - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ ICorPublishAppDomain **objects, - /* [out] */ ULONG *pceltFetched) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICorPublishAppDomainEnumVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICorPublishAppDomainEnum * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICorPublishAppDomainEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICorPublishAppDomainEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( - ICorPublishAppDomainEnum * This, - /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( - ICorPublishAppDomainEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - ICorPublishAppDomainEnum * This, - /* [out] */ ICorPublishEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - ICorPublishAppDomainEnum * This, - /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( - ICorPublishAppDomainEnum * This, - /* [in] */ ULONG celt, - /* [length_is][size_is][out] */ ICorPublishAppDomain **objects, - /* [out] */ ULONG *pceltFetched); - - END_INTERFACE - } ICorPublishAppDomainEnumVtbl; - - interface ICorPublishAppDomainEnum - { - CONST_VTBL struct ICorPublishAppDomainEnumVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICorPublishAppDomainEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICorPublishAppDomainEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICorPublishAppDomainEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICorPublishAppDomainEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define ICorPublishAppDomainEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define ICorPublishAppDomainEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) - -#define ICorPublishAppDomainEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) - - -#define ICorPublishAppDomainEnum_Next(This,celt,objects,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICorPublishAppDomainEnum_INTERFACE_DEFINED__ */ - - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/metahost.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/metahost.h index e0fc0fc06..b96f035bf 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/metahost.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/metahost.h @@ -3,11 +3,9 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.01.0622 */ -/* at Mon Jan 18 19:14:07 2038 - */ + /* File created by MIDL compiler version 8.01.0628 */ /* Compiler settings for metahost.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622 + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0628 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: @@ -43,6 +41,14 @@ #pragma once #endif +#ifndef DECLSPEC_XFGVIRT +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + /* Forward Declarations */ #ifndef __ICLRMetaHost_FWD_DEFINED__ @@ -66,6 +72,13 @@ typedef interface ICLRDebuggingLibraryProvider2 ICLRDebuggingLibraryProvider2; #endif /* __ICLRDebuggingLibraryProvider2_FWD_DEFINED__ */ +#ifndef __ICLRDebuggingLibraryProvider3_FWD_DEFINED__ +#define __ICLRDebuggingLibraryProvider3_FWD_DEFINED__ +typedef interface ICLRDebuggingLibraryProvider3 ICLRDebuggingLibraryProvider3; + +#endif /* __ICLRDebuggingLibraryProvider3_FWD_DEFINED__ */ + + #ifndef __ICLRDebugging_FWD_DEFINED__ #define __ICLRDebugging_FWD_DEFINED__ typedef interface ICLRDebugging ICLRDebugging; @@ -101,6 +114,7 @@ EXTERN_GUID(CLSID_CLRDebugging, 0xbacc578d, 0xfbdd, 0x48a4, 0x96, 0x9f, 0x2, 0xd EXTERN_GUID(IID_ICLRRuntimeInfo, 0xBD39D1D2, 0xBA2F, 0x486a, 0x89, 0xB0, 0xB4, 0xB0, 0xCB, 0x46, 0x68, 0x91); EXTERN_GUID(IID_ICLRDebuggingLibraryProvider, 0x3151c08d, 0x4d09, 0x4f9b, 0x88, 0x38, 0x28, 0x80, 0xbf, 0x18, 0xfe, 0x51); EXTERN_GUID(IID_ICLRDebuggingLibraryProvider2, 0xE04E2FF1, 0xDCFD, 0x45D5, 0xBC, 0xD1, 0x16, 0xFF, 0xF2, 0xFA, 0xF7, 0xBA); +EXTERN_GUID(IID_ICLRDebuggingLibraryProvider3, 0xde3aab18, 0x46a0, 0x48b4, 0xbf, 0xd, 0x2c, 0x33, 0x6e, 0x69, 0xea, 0x1b); typedef HRESULT ( __stdcall *CallbackThreadSetFnPtr )( void); @@ -111,6 +125,14 @@ typedef void ( __stdcall *RuntimeLoadedCallbackFnPtr )( CallbackThreadSetFnPtr pfnCallbackThreadSet, CallbackThreadUnsetFnPtr pfnCallbackThreadUnset); +typedef /* [public][public][public] */ +enum __MIDL___MIDL_itf_metahost_0000_0000_0001 + { + UnknownIndex = 0, + Identity = 1, + Runtime = 2 + } LIBRARY_PROVIDER_INDEX_TYPE; + extern RPC_IF_HANDLE __MIDL_itf_metahost_0000_0000_v0_0_c_ifspec; @@ -168,24 +190,29 @@ EXTERN_C const IID IID_ICLRMetaHost; { BEGIN_INTERFACE + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICLRMetaHost * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); + DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( ICLRMetaHost * This); + DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( ICLRMetaHost * This); + DECLSPEC_XFGVIRT(ICLRMetaHost, GetRuntime) HRESULT ( STDMETHODCALLTYPE *GetRuntime )( ICLRMetaHost * This, /* [in] */ LPCWSTR pwzVersion, /* [in] */ REFIID riid, /* [retval][iid_is][out] */ LPVOID *ppRuntime); + DECLSPEC_XFGVIRT(ICLRMetaHost, GetVersionFromFile) HRESULT ( STDMETHODCALLTYPE *GetVersionFromFile )( ICLRMetaHost * This, /* [in] */ LPCWSTR pwzFilePath, @@ -193,24 +220,29 @@ EXTERN_C const IID IID_ICLRMetaHost; _Out_writes_all_(*pcchBuffer) LPWSTR pwzBuffer, /* [out][in] */ DWORD *pcchBuffer); + DECLSPEC_XFGVIRT(ICLRMetaHost, EnumerateInstalledRuntimes) HRESULT ( STDMETHODCALLTYPE *EnumerateInstalledRuntimes )( ICLRMetaHost * This, /* [retval][out] */ IEnumUnknown **ppEnumerator); + DECLSPEC_XFGVIRT(ICLRMetaHost, EnumerateLoadedRuntimes) HRESULT ( STDMETHODCALLTYPE *EnumerateLoadedRuntimes )( ICLRMetaHost * This, /* [in] */ HANDLE hndProcess, /* [retval][out] */ IEnumUnknown **ppEnumerator); + DECLSPEC_XFGVIRT(ICLRMetaHost, RequestRuntimeLoadedNotification) HRESULT ( STDMETHODCALLTYPE *RequestRuntimeLoadedNotification )( ICLRMetaHost * This, /* [in] */ RuntimeLoadedCallbackFnPtr pCallbackFunction); + DECLSPEC_XFGVIRT(ICLRMetaHost, QueryLegacyV2RuntimeBinding) HRESULT ( STDMETHODCALLTYPE *QueryLegacyV2RuntimeBinding )( ICLRMetaHost * This, /* [in] */ REFIID riid, /* [retval][iid_is][out] */ LPVOID *ppUnk); + DECLSPEC_XFGVIRT(ICLRMetaHost, ExitProcess) HRESULT ( STDMETHODCALLTYPE *ExitProcess )( ICLRMetaHost * This, /* [in] */ INT32 iExitCode); @@ -324,18 +356,22 @@ EXTERN_C const IID IID_ICLRDebuggingLibraryProvider; { BEGIN_INTERFACE + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICLRDebuggingLibraryProvider * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); + DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( ICLRDebuggingLibraryProvider * This); + DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( ICLRDebuggingLibraryProvider * This); + DECLSPEC_XFGVIRT(ICLRDebuggingLibraryProvider, ProvideLibrary) HRESULT ( STDMETHODCALLTYPE *ProvideLibrary )( ICLRDebuggingLibraryProvider * This, /* [in] */ const WCHAR *pwszFileName, @@ -410,18 +446,22 @@ EXTERN_C const IID IID_ICLRDebuggingLibraryProvider2; { BEGIN_INTERFACE + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICLRDebuggingLibraryProvider2 * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); + DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( ICLRDebuggingLibraryProvider2 * This); + DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( ICLRDebuggingLibraryProvider2 * This); + DECLSPEC_XFGVIRT(ICLRDebuggingLibraryProvider2, ProvideLibrary2) HRESULT ( STDMETHODCALLTYPE *ProvideLibrary2 )( ICLRDebuggingLibraryProvider2 * This, /* [in] */ const WCHAR *pwszFileName, @@ -466,6 +506,121 @@ EXTERN_C const IID IID_ICLRDebuggingLibraryProvider2; #endif /* __ICLRDebuggingLibraryProvider2_INTERFACE_DEFINED__ */ +#ifndef __ICLRDebuggingLibraryProvider3_INTERFACE_DEFINED__ +#define __ICLRDebuggingLibraryProvider3_INTERFACE_DEFINED__ + +/* interface ICLRDebuggingLibraryProvider3 */ +/* [object][local][helpstring][version][uuid] */ + + +EXTERN_C const IID IID_ICLRDebuggingLibraryProvider3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DE3AAB18-46A0-48B4-BF0D-2C336E69EA1B") + ICLRDebuggingLibraryProvider3 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ProvideWindowsLibrary( + /* [in] */ const WCHAR *pwszFileName, + /* [in] */ const WCHAR *pwszRuntimeModule, + /* [in] */ LIBRARY_PROVIDER_INDEX_TYPE indexType, + /* [in] */ DWORD dwTimestamp, + /* [in] */ DWORD dwSizeOfImage, + /* [out] */ LPWSTR *ppResolvedModulePath) = 0; + + virtual HRESULT STDMETHODCALLTYPE ProvideUnixLibrary( + /* [in] */ const WCHAR *pwszFileName, + /* [in] */ const WCHAR *pwszRuntimeModule, + /* [in] */ LIBRARY_PROVIDER_INDEX_TYPE indexType, + /* [in] */ BYTE *pbBuildId, + /* [in] */ int iBuildIdSize, + /* [out] */ LPWSTR *ppResolvedModulePath) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ICLRDebuggingLibraryProvider3Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICLRDebuggingLibraryProvider3 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICLRDebuggingLibraryProvider3 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ICLRDebuggingLibraryProvider3 * This); + + DECLSPEC_XFGVIRT(ICLRDebuggingLibraryProvider3, ProvideWindowsLibrary) + HRESULT ( STDMETHODCALLTYPE *ProvideWindowsLibrary )( + ICLRDebuggingLibraryProvider3 * This, + /* [in] */ const WCHAR *pwszFileName, + /* [in] */ const WCHAR *pwszRuntimeModule, + /* [in] */ LIBRARY_PROVIDER_INDEX_TYPE indexType, + /* [in] */ DWORD dwTimestamp, + /* [in] */ DWORD dwSizeOfImage, + /* [out] */ LPWSTR *ppResolvedModulePath); + + DECLSPEC_XFGVIRT(ICLRDebuggingLibraryProvider3, ProvideUnixLibrary) + HRESULT ( STDMETHODCALLTYPE *ProvideUnixLibrary )( + ICLRDebuggingLibraryProvider3 * This, + /* [in] */ const WCHAR *pwszFileName, + /* [in] */ const WCHAR *pwszRuntimeModule, + /* [in] */ LIBRARY_PROVIDER_INDEX_TYPE indexType, + /* [in] */ BYTE *pbBuildId, + /* [in] */ int iBuildIdSize, + /* [out] */ LPWSTR *ppResolvedModulePath); + + END_INTERFACE + } ICLRDebuggingLibraryProvider3Vtbl; + + interface ICLRDebuggingLibraryProvider3 + { + CONST_VTBL struct ICLRDebuggingLibraryProvider3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICLRDebuggingLibraryProvider3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICLRDebuggingLibraryProvider3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICLRDebuggingLibraryProvider3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ICLRDebuggingLibraryProvider3_ProvideWindowsLibrary(This,pwszFileName,pwszRuntimeModule,indexType,dwTimestamp,dwSizeOfImage,ppResolvedModulePath) \ + ( (This)->lpVtbl -> ProvideWindowsLibrary(This,pwszFileName,pwszRuntimeModule,indexType,dwTimestamp,dwSizeOfImage,ppResolvedModulePath) ) + +#define ICLRDebuggingLibraryProvider3_ProvideUnixLibrary(This,pwszFileName,pwszRuntimeModule,indexType,pbBuildId,iBuildIdSize,ppResolvedModulePath) \ + ( (This)->lpVtbl -> ProvideUnixLibrary(This,pwszFileName,pwszRuntimeModule,indexType,pbBuildId,iBuildIdSize,ppResolvedModulePath) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ICLRDebuggingLibraryProvider3_INTERFACE_DEFINED__ */ + + #ifndef __ICLRDebugging_INTERFACE_DEFINED__ #define __ICLRDebugging_INTERFACE_DEFINED__ @@ -503,18 +658,22 @@ EXTERN_C const IID IID_ICLRDebugging; { BEGIN_INTERFACE + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICLRDebugging * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); + DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( ICLRDebugging * This); + DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( ICLRDebugging * This); + DECLSPEC_XFGVIRT(ICLRDebugging, OpenVirtualProcess) HRESULT ( STDMETHODCALLTYPE *OpenVirtualProcess )( ICLRDebugging * This, /* [in] */ ULONG64 moduleBaseAddress, @@ -526,6 +685,7 @@ EXTERN_C const IID IID_ICLRDebugging; /* [out][in] */ CLR_DEBUGGING_VERSION *pVersion, /* [out] */ CLR_DEBUGGING_PROCESS_FLAGS *pdwFlags); + DECLSPEC_XFGVIRT(ICLRDebugging, CanUnloadNow) HRESULT ( STDMETHODCALLTYPE *CanUnloadNow )( ICLRDebugging * This, HMODULE hModule); @@ -647,35 +807,42 @@ EXTERN_C const IID IID_ICLRRuntimeInfo; { BEGIN_INTERFACE + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICLRRuntimeInfo * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); + DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( ICLRRuntimeInfo * This); + DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( ICLRRuntimeInfo * This); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, GetVersionString) HRESULT ( STDMETHODCALLTYPE *GetVersionString )( ICLRRuntimeInfo * This, /* [annotation][size_is][out] */ _Out_writes_all_opt_(*pcchBuffer) LPWSTR pwzBuffer, /* [out][in] */ DWORD *pcchBuffer); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, GetRuntimeDirectory) HRESULT ( STDMETHODCALLTYPE *GetRuntimeDirectory )( ICLRRuntimeInfo * This, /* [annotation][size_is][out] */ _Out_writes_all_(*pcchBuffer) LPWSTR pwzBuffer, /* [out][in] */ DWORD *pcchBuffer); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, IsLoaded) HRESULT ( STDMETHODCALLTYPE *IsLoaded )( ICLRRuntimeInfo * This, /* [in] */ HANDLE hndProcess, /* [retval][out] */ BOOL *pbLoaded); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, LoadErrorString) HRESULT ( STDMETHODCALLTYPE *LoadErrorString )( ICLRRuntimeInfo * This, /* [in] */ UINT iResourceID, @@ -684,31 +851,37 @@ EXTERN_C const IID IID_ICLRRuntimeInfo; /* [out][in] */ DWORD *pcchBuffer, /* [lcid][in] */ LONG iLocaleID); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, LoadLibrary) HRESULT ( STDMETHODCALLTYPE *LoadLibrary )( ICLRRuntimeInfo * This, /* [in] */ LPCWSTR pwzDllName, /* [retval][out] */ HMODULE *phndModule); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, GetProcAddress) HRESULT ( STDMETHODCALLTYPE *GetProcAddress )( ICLRRuntimeInfo * This, /* [in] */ LPCSTR pszProcName, /* [retval][out] */ LPVOID *ppProc); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, GetInterface) HRESULT ( STDMETHODCALLTYPE *GetInterface )( ICLRRuntimeInfo * This, /* [in] */ REFCLSID rclsid, /* [in] */ REFIID riid, /* [retval][iid_is][out] */ LPVOID *ppUnk); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, IsLoadable) HRESULT ( STDMETHODCALLTYPE *IsLoadable )( ICLRRuntimeInfo * This, /* [retval][out] */ BOOL *pbLoadable); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, SetDefaultStartupFlags) HRESULT ( STDMETHODCALLTYPE *SetDefaultStartupFlags )( ICLRRuntimeInfo * This, /* [in] */ DWORD dwStartupFlags, /* [in] */ LPCWSTR pwzHostConfigFile); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, GetDefaultStartupFlags) HRESULT ( STDMETHODCALLTYPE *GetDefaultStartupFlags )( ICLRRuntimeInfo * This, /* [out] */ DWORD *pdwStartupFlags, @@ -716,9 +889,11 @@ EXTERN_C const IID IID_ICLRRuntimeInfo; _Out_writes_all_opt_(*pcchHostConfigFile) LPWSTR pwzHostConfigFile, /* [out][in] */ DWORD *pcchHostConfigFile); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, BindAsLegacyV2Runtime) HRESULT ( STDMETHODCALLTYPE *BindAsLegacyV2Runtime )( ICLRRuntimeInfo * This); + DECLSPEC_XFGVIRT(ICLRRuntimeInfo, IsStarted) HRESULT ( STDMETHODCALLTYPE *IsStarted )( ICLRRuntimeInfo * This, /* [out] */ BOOL *pbStarted, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/mscoree.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/mscoree.h index 928a7fad8..5f2f3248a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/mscoree.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/mscoree.h @@ -86,48 +86,16 @@ typedef /* [public][public] */ enum __MIDL___MIDL_itf_mscoree_0000_0000_0001 { STARTUP_CONCURRENT_GC = 0x1, - STARTUP_LOADER_OPTIMIZATION_MASK = ( 0x3 << 1 ) , - STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = ( 0x1 << 1 ) , - STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = ( 0x2 << 1 ) , - STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = ( 0x3 << 1 ) , - STARTUP_LOADER_SAFEMODE = 0x10, - STARTUP_LOADER_SETPREFERENCE = 0x100, STARTUP_SERVER_GC = 0x1000, STARTUP_HOARD_GC_VM = 0x2000, - STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000, - STARTUP_LEGACY_IMPERSONATION = 0x10000, - STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000, - STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000, - STARTUP_TRIM_GC_COMMIT = 0x80000, - STARTUP_ETW = 0x100000, - STARTUP_ARM = 0x400000, - STARTUP_SINGLE_APPDOMAIN = 0x800000, - STARTUP_APPX_APP_MODEL = 0x1000000, - STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000 } STARTUP_FLAGS; typedef /* [public] */ enum __MIDL___MIDL_itf_mscoree_0000_0000_0002 { - APPDOMAIN_SECURITY_DEFAULT = 0, - APPDOMAIN_SECURITY_SANDBOXED = 0x1, - APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2, - APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4, APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x8, - APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10, - APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40, - APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80, - APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100 } APPDOMAIN_SECURITY_FLAGS; -typedef /* [public] */ -enum __MIDL___MIDL_itf_mscoree_0000_0000_0003 - { - WAIT_MSGPUMP = 0x1, - WAIT_ALERTABLE = 0x2, - WAIT_NOTINDEADLOCK = 0x4 - } WAIT_OPTION; - typedef /* [public] */ enum __MIDL___MIDL_itf_mscoree_0000_0000_0004 { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/sospriv.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/sospriv.h index a3d741f74..4ff12d95b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/sospriv.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/prebuilt/inc/sospriv.h @@ -3685,6 +3685,86 @@ EXTERN_C const IID IID_ISOSDacInterface15; #endif /* __ISOSDacInterface15_INTERFACE_DEFINED__ */ +#ifndef __ISOSDacInterface16_INTERFACE_DEFINED__ +#define __ISOSDacInterface16_INTERFACE_DEFINED__ + +/* interface ISOSDacInterface16 */ +/* [uuid][local][object] */ + + +EXTERN_C const IID IID_ISOSDacInterface16; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4ba12ff8-daac-4e43-ac56-98cf8d5c595d") + ISOSDacInterface16 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetGCDynamicAdaptationMode( + int *pDynamicAdaptationMode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ISOSDacInterface16Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISOSDacInterface16 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISOSDacInterface16 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISOSDacInterface16 * This); + + HRESULT ( STDMETHODCALLTYPE *GetGCDynamicAdaptationMode )( + ISOSDacInterface16 * This, + int *pDynamicAdaptationMode); + + END_INTERFACE + } ISOSDacInterface16Vtbl; + + interface ISOSDacInterface16 + { + CONST_VTBL struct ISOSDacInterface16Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISOSDacInterface16_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISOSDacInterface16_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISOSDacInterface16_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISOSDacInterface16_GetGCDynamicAdaptationMode(This,pDynamicAdaptationMode) \ + ( (This)->lpVtbl -> GetGCDynamicAdaptationMode(This,pDynamicAdaptationMode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISOSDacInterface16_INTERFACE_DEFINED__ */ + + /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/CMakeLists.txt index cc301eb27..a850607a2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/CMakeLists.txt @@ -1,8 +1,8 @@ -if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_HAIKU) +if(CLR_CMAKE_TARGET_APPLE OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_HAIKU) # On OSX and *BSD, we use the libunwind that's part of the OS # On Haiku, we used a special port of libunwind set(CLR_CMAKE_USE_SYSTEM_LIBUNWIND 1) -endif(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_HAIKU) +endif(CLR_CMAKE_TARGET_APPLE OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_HAIKU) if(NOT DEFINED ENV{ROOTFS_DIR}) include_directories(SYSTEM /usr/local/include) @@ -10,18 +10,18 @@ elseif (CLR_CMAKE_TARGET_FREEBSD) include_directories(SYSTEM $ENV{ROOTFS_DIR}/usr/local/include) endif() -if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) +if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include) include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include/tdep) include_directories(${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind/include) include_directories(${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind/include/tdep) add_subdirectory(${CLR_SRC_NATIVE_DIR}/external/libunwind_extras ${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind) -elseif(NOT CLR_CMAKE_TARGET_OSX) +elseif(NOT CLR_CMAKE_TARGET_APPLE) find_unwind_libs(UNWIND_LIBS) else() add_subdirectory(${CLR_SRC_NATIVE_DIR}/external/libunwind_extras ${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind) -endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) +endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) include(configure.cmake) @@ -59,6 +59,8 @@ elseif(CLR_CMAKE_HOST_ARCH_S390X) set(PAL_ARCH_SOURCES_DIR s390x) elseif(CLR_CMAKE_HOST_ARCH_POWERPC64) set(PAL_ARCH_SOURCES_DIR ppc64le) +elseif(CLR_CMAKE_HOST_ARCH_WASM) + set(PAL_ARCH_SOURCES_DIR wasm) endif() if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND) @@ -70,13 +72,16 @@ if(CLR_CMAKE_TARGET_OSX) if(CLR_CMAKE_HOST_ARCH_AMD64) add_definitions(-DXSTATE_SUPPORTED) endif() +endif() + +if(CLR_CMAKE_TARGET_APPLE) set(PLATFORM_SOURCES arch/${PAL_ARCH_SOURCES_DIR}/context.S arch/${PAL_ARCH_SOURCES_DIR}/dispatchexceptionwrapper.S exception/machexception.cpp exception/machmessage.cpp ) -endif(CLR_CMAKE_TARGET_OSX) +endif(CLR_CMAKE_TARGET_APPLE) if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) add_definitions(-DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) @@ -110,18 +115,26 @@ endif(CLR_CMAKE_TARGET_HAIKU) # turn off capability to remove unused functions (which was enabled in debug build with sanitizers) set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-gc-sections") -set(ARCH_SOURCES - arch/${PAL_ARCH_SOURCES_DIR}/context2.S - arch/${PAL_ARCH_SOURCES_DIR}/debugbreak.S - arch/${PAL_ARCH_SOURCES_DIR}/exceptionhelper.S -) +if (NOT CLR_CMAKE_TARGET_ARCH_WASM) + set(ARCH_SOURCES + arch/${PAL_ARCH_SOURCES_DIR}/context2.S + arch/${PAL_ARCH_SOURCES_DIR}/debugbreak.S + arch/${PAL_ARCH_SOURCES_DIR}/exceptionhelper.S + ) +endif() -if(NOT CLR_CMAKE_TARGET_OSX) +if (CLR_CMAKE_TARGET_ARCH_WASM) + set(PLATFORM_SOURCES + arch/${PAL_ARCH_SOURCES_DIR}/stubs.cpp + ) +endif() + +if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM) list(APPEND PLATFORM_SOURCES arch/${PAL_ARCH_SOURCES_DIR}/callsignalhandlerwrapper.S arch/${PAL_ARCH_SOURCES_DIR}/signalhandlerhelper.cpp ) -endif(NOT CLR_CMAKE_TARGET_OSX) +endif(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM) if(CLR_CMAKE_HOST_ARCH_ARM) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -134,6 +147,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND (CLR_CMAKE_HOST_ARCH_AMD64 OR CLR_CM endif() set(SOURCES + com/guid.cpp cruntime/wchar.cpp debug/debug.cpp exception/seh.cpp @@ -141,7 +155,6 @@ set(SOURCES file/directory.cpp file/file.cpp file/filetime.cpp - file/find.cpp file/path.cpp handlemgr/handleapi.cpp handlemgr/handlemgr.cpp @@ -149,8 +162,6 @@ set(SOURCES init/sxs.cpp loader/module.cpp locale/unicode.cpp - ${CLR_SRC_NATIVE_DIR}/minipal/utf8.c - ${CLR_SRC_NATIVE_DIR}/minipal/unicodedata.c map/common.cpp map/map.cpp map/virtual.cpp @@ -160,15 +171,14 @@ set(SOURCES misc/error.cpp misc/errorstrings.cpp misc/fmtmessage.cpp - misc/miscpalapi.cpp misc/perfjitdump.cpp misc/strutil.cpp misc/sysinfo.cpp misc/time.cpp misc/utils.cpp objmgr/palobjbase.cpp - objmgr/shmobject.cpp - objmgr/shmobjectmanager.cpp + objmgr/listedobject.cpp + objmgr/listedobjectmanager.cpp safecrt/makepath_s.cpp safecrt/memcpy_s.cpp safecrt/memmove_s.cpp @@ -191,8 +201,6 @@ set(SOURCES safecrt/wcsncpy_s.cpp safecrt/wmakepath_s.cpp sharedmemory/sharedmemory.cpp - shmemory/shmemory.cpp - sync/cs.cpp synchobj/event.cpp synchobj/semaphore.cpp synchobj/mutex.cpp @@ -205,20 +213,30 @@ set(SOURCES thread/threadsusp.cpp ) -if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) +set_source_files_properties( + com/guid.cpp + PROPERTIES + INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/../inc/rt +) + +if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) set(LIBUNWIND_OBJECTS $) -endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) +endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM) -add_library(coreclrpal - STATIC +add_library(coreclrpal_objects + OBJECT ${SOURCES} ${ARCH_SOURCES} ${PLATFORM_SOURCES} +) + +add_library(coreclrpal STATIC + $ ${LIBUNWIND_OBJECTS} ) # Build separate pal library for DAC (addition to regular pal library) -if(CLR_CMAKE_TARGET_OSX) +if(CLR_CMAKE_TARGET_APPLE) set(LIBUNWIND_DAC_OBJECTS $) add_library(coreclrpal_dac STATIC @@ -240,7 +258,7 @@ else() exception/remote-unwind.cpp ) endif(NOT FEATURE_CROSSBITNESS) -endif(CLR_CMAKE_TARGET_OSX) +endif(CLR_CMAKE_TARGET_APPLE) # There is only one function exported in 'tracepointprovider.cpp' namely 'PAL_InitializeTracing', # which is guarded with '#if defined(__linux__)'. On macOS, Xcode issues the following warning: @@ -295,8 +313,7 @@ if(CLR_CMAKE_TARGET_LINUX) else(NOT CLR_CMAKE_TARGET_ANDROID) target_link_libraries(coreclrpal PUBLIC - ${ANDROID_GLOB} - ${LZMA}) + ${ANDROID_GLOB}) endif(NOT CLR_CMAKE_TARGET_ANDROID) target_link_libraries(coreclrpal @@ -338,6 +355,9 @@ if(CLR_CMAKE_TARGET_SUNOS) ) endif(CLR_CMAKE_TARGET_SUNOS) +target_link_libraries(coreclrpal + PRIVATE minipal) + if(FEATURE_EVENT_TRACE) add_subdirectory(eventprovider) endif(FEATURE_EVENT_TRACE) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/asmconstants.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/asmconstants.h index d5a72cf6e..8e97efdbf 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/asmconstants.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/asmconstants.h @@ -8,12 +8,14 @@ #define XSTATE_AVX512_KMASK (5) #define XSTATE_AVX512_ZMM_H (6) #define XSTATE_AVX512_ZMM (7) +#define XSTATE_APX (19) #define XSTATE_MASK_GSSE (1 << (XSTATE_GSSE)) #define XSTATE_MASK_AVX (XSTATE_MASK_GSSE) #define XSTATE_MASK_AVX512 ((1 << (XSTATE_AVX512_KMASK)) | \ (1 << (XSTATE_AVX512_ZMM_H)) | \ (1 << (XSTATE_AVX512_ZMM))) +#define XSTATE_MASK_APX (1 << (XSTATE_APX)) // The arch bit is normally set in the flag constants below. Since this is already arch-specific code and the arch bit is not // relevant, the arch bit is excluded from the flag constants below for simpler tests. @@ -91,7 +93,8 @@ #define CONTEXT_KMask0 CONTEXT_Ymm0H+(16*16) #define CONTEXT_Zmm0H CONTEXT_KMask0+(8*8) #define CONTEXT_Zmm16 CONTEXT_Zmm0H+(32*16) -#define CONTEXT_Size CONTEXT_Zmm16+(64*16) +#define CONTEXT_Egpr CONTEXT_Zmm16+(64*16) +#define CONTEXT_Size CONTEXT_Egpr+(8*16) #else // HOST_64BIT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/context2.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/context2.S index dba772f9d..2b183798f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/context2.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/context2.S @@ -183,6 +183,46 @@ LOCAL_LABEL(Done_Restore_CONTEXT_FLOATING_POINT): kmovq k6, qword ptr [rdi + (CONTEXT_KMask0 + 6 * 8)] kmovq k7, qword ptr [rdi + (CONTEXT_KMask0 + 7 * 8)] + test BYTE PTR [rdi + CONTEXT_XStateFeaturesMask], XSTATE_MASK_APX + je LOCAL_LABEL(Done_Restore_CONTEXT_XSTATE) + + // TODO-XArch-APX: + // we are using raw hex code here to emit EGPRs-related changes, + // we will need to come back and re-write this part when assembler supports EGPRs. + + // mov r16, qword ptr [rdi + CONTEXT_Egpr + 0 * 8] + .byte 0xd5, 0x48, 0x8b, 0x87, 0x20, 0x0c, 0x00, 0x00 + // mov r17, qword ptr [rdi + CONTEXT_Egpr + 1 * 8] + .byte 0xd5, 0x48, 0x8b, 0x8f, 0x28, 0x0c, 0x00, 0x00 + // mov r18, qword ptr [rdi + CONTEXT_Egpr + 2 * 8] + .byte 0xd5, 0x48, 0x8b, 0x97, 0x30, 0x0c, 0x00, 0x00 + // mov r19, qword ptr [rdi + CONTEXT_Egpr + 3 * 8] + .byte 0xd5, 0x48, 0x8b, 0x9f, 0x38, 0x0c, 0x00, 0x00 + // mov r20, qword ptr [rdi + CONTEXT_Egpr + 4 * 8] + .byte 0xd5, 0x48, 0x8b, 0xa7, 0x40, 0x0c, 0x00, 0x00 + // mov r21, qword ptr [rdi + CONTEXT_Egpr + 5 * 8] + .byte 0xd5, 0x48, 0x8b, 0xaf, 0x48, 0x0c, 0x00, 0x00 + // mov r22, qword ptr [rdi + CONTEXT_Egpr + 6 * 8] + .byte 0xd5, 0x48, 0x8b, 0xb7, 0x50, 0x0c, 0x00, 0x00 + // mov r23, qword ptr [rdi + CONTEXT_Egpr + 7 * 8] + .byte 0xd5, 0x48, 0x8b, 0xbf, 0x58, 0x0c, 0x00, 0x00 + // mov r24, qword ptr [rdi + CONTEXT_Egpr + 8 * 8] + .byte 0xd5, 0x4c, 0x8b, 0x87, 0x60, 0x0c, 0x00, 0x00 + // mov r25, qword ptr [rdi + CONTEXT_Egpr + 9 * 8] + .byte 0xd5, 0x4c, 0x8b, 0x8f, 0x68, 0x0c, 0x00, 0x00 + // mov r26, qword ptr [rdi + CONTEXT_Egpr + 10 * 8] + .byte 0xd5, 0x4c, 0x8b, 0x97, 0x70, 0x0c, 0x00, 0x00 + // mov r27, qword ptr [rdi + CONTEXT_Egpr + 11 * 8] + .byte 0xd5, 0x4c, 0x8b, 0x9f, 0x78, 0x0c, 0x00, 0x00 + // mov r28, qword ptr [rdi + CONTEXT_Egpr + 12 * 8] + .byte 0xd5, 0x4c, 0x8b, 0xa7, 0x80, 0x0c, 0x00, 0x00 + // mov r29, qword ptr [rdi + CONTEXT_Egpr + 13 * 8] + .byte 0xd5, 0x4c, 0x8b, 0xaf, 0x88, 0x0c, 0x00, 0x00 + // mov r30, qword ptr [rdi + CONTEXT_Egpr + 14 * 8] + .byte 0xd5, 0x4c, 0x8b, 0xb7, 0x90, 0x0c, 0x00, 0x00 + // mov r31, qword ptr [rdi + CONTEXT_Egpr + 15 * 8] + .byte 0xd5, 0x4c, 0x8b, 0xbf, 0x98, 0x0c, 0x00, 0x00 + LOCAL_LABEL(Done_Restore_CONTEXT_XSTATE): test BYTE PTR [rdi + CONTEXT_ContextFlags], CONTEXT_CONTROL diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/signalhandlerhelper.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/signalhandlerhelper.cpp index d1db9295a..3f70c41d1 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/signalhandlerhelper.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/amd64/signalhandlerhelper.cpp @@ -8,7 +8,10 @@ SET_DEFAULT_DEBUG_CHANNEL(EXCEPT); // some headers have code with asserts, so do #include "pal/context.h" #include "pal/signal.hpp" #include "pal/utils.h" + +#if HAVE_SYS_UCONTEXT_H #include +#endif /*++ Function : diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/asmconstants.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/asmconstants.h index 3676b16fc..3af79d45c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/asmconstants.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/asmconstants.h @@ -19,6 +19,11 @@ #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) +#define CONTEXT_LSX_BIT (4) +#define CONTEXT_LASX_BIT (5) +#define CONTEXT_LSX (1 << CONTEXT_LSX_BIT) +#define CONTEXT_LASX (1 << CONTEXT_LASX_BIT) + #define SIZEOF_LOONGARCH_GPR 8 #define SIZEOF_LOONGARCH_FPR 8 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/context2.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/context2.S index dda4f1922..8a7f7b8e8 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/context2.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/context2.S @@ -16,12 +16,12 @@ LEAF_ENTRY RtlRestoreContext, _TEXT #ifdef HAS_ADDRESS_SANITIZER ld.w $r21, $a0, CONTEXT_ContextFlags - andi $r21, $r21, (1 << CONTEXT_CONTROL_BIT) - beq $r21, $r0, LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT) + andi $r21, $r21, (1 << CONTEXT_CONTROL_BIT) + beqz $r21, LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT) addi.d $sp, $sp, -16 - st.d a0, $sp, 0 - st.d a1, $sp, 8 + st.d $a0, $sp, 0 + st.d $a1, $sp, 8 bl __asan_handle_no_return @@ -37,17 +37,94 @@ LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT): andi $t1, $r21, (1 << CONTEXT_FLOATING_POINT_BIT) beqz $t1, LOCAL_LABEL(No_Restore_CONTEXT_FLOATING_POINT) + andi $t1, $r21, CONTEXT_LASX + bnez $t1, LOCAL_LABEL(Restore_CONTEXT_LASX) + andi $t1, $r21, CONTEXT_LSX + bnez $t1, LOCAL_LABEL(Restore_CONTEXT_LSX) + + // Neither LSX or LASX is supported. + fld.d $f0 , $a0, CONTEXT_FPU_OFFSET + fld.d $f1 , $a0, CONTEXT_FPU_OFFSET + 8*1 + fld.d $f2 , $a0, CONTEXT_FPU_OFFSET + 8*2 + fld.d $f3 , $a0, CONTEXT_FPU_OFFSET + 8*3 + fld.d $f4 , $a0, CONTEXT_FPU_OFFSET + 8*4 + fld.d $f5 , $a0, CONTEXT_FPU_OFFSET + 8*5 + fld.d $f6 , $a0, CONTEXT_FPU_OFFSET + 8*6 + fld.d $f7 , $a0, CONTEXT_FPU_OFFSET + 8*7 + fld.d $f8 , $a0, CONTEXT_FPU_OFFSET + 8*8 + fld.d $f9 , $a0, CONTEXT_FPU_OFFSET + 8*9 + fld.d $f10, $a0, CONTEXT_FPU_OFFSET + 8*10 + fld.d $f11, $a0, CONTEXT_FPU_OFFSET + 8*11 + fld.d $f12, $a0, CONTEXT_FPU_OFFSET + 8*12 + fld.d $f13, $a0, CONTEXT_FPU_OFFSET + 8*13 + fld.d $f14, $a0, CONTEXT_FPU_OFFSET + 8*14 + fld.d $f15, $a0, CONTEXT_FPU_OFFSET + 8*15 + fld.d $f16, $a0, CONTEXT_FPU_OFFSET + 8*16 + fld.d $f17, $a0, CONTEXT_FPU_OFFSET + 8*17 + fld.d $f18, $a0, CONTEXT_FPU_OFFSET + 8*18 + fld.d $f19, $a0, CONTEXT_FPU_OFFSET + 8*19 + fld.d $f20, $a0, CONTEXT_FPU_OFFSET + 8*20 + fld.d $f21, $a0, CONTEXT_FPU_OFFSET + 8*21 + fld.d $f22, $a0, CONTEXT_FPU_OFFSET + 8*22 + fld.d $f23, $a0, CONTEXT_FPU_OFFSET + 8*23 + fld.d $f24, $a0, CONTEXT_FPU_OFFSET + 8*24 + fld.d $f25, $a0, CONTEXT_FPU_OFFSET + 8*25 + fld.d $f26, $a0, CONTEXT_FPU_OFFSET + 8*26 + fld.d $f27, $a0, CONTEXT_FPU_OFFSET + 8*27 + fld.d $f28, $a0, CONTEXT_FPU_OFFSET + 8*28 + fld.d $f29, $a0, CONTEXT_FPU_OFFSET + 8*29 + fld.d $f30, $a0, CONTEXT_FPU_OFFSET + 8*30 + fld.d $f31, $a0, CONTEXT_FPU_OFFSET + 8*31 + b LOCAL_LABEL(Restore_CONTEXT_FLOATING_CONTROL) + +LOCAL_LABEL(Restore_CONTEXT_LSX): + // 128-bits SIMD:LSX. + vld $vr0 , $a0, CONTEXT_FPU_OFFSET + vld $vr1 , $a0, CONTEXT_FPU_OFFSET + 16*1 + vld $vr2 , $a0, CONTEXT_FPU_OFFSET + 16*2 + vld $vr3 , $a0, CONTEXT_FPU_OFFSET + 16*3 + vld $vr4 , $a0, CONTEXT_FPU_OFFSET + 16*4 + vld $vr5 , $a0, CONTEXT_FPU_OFFSET + 16*5 + vld $vr6 , $a0, CONTEXT_FPU_OFFSET + 16*6 + vld $vr7 , $a0, CONTEXT_FPU_OFFSET + 16*7 + vld $vr8 , $a0, CONTEXT_FPU_OFFSET + 16*8 + vld $vr9 , $a0, CONTEXT_FPU_OFFSET + 16*9 + vld $vr10, $a0, CONTEXT_FPU_OFFSET + 16*10 + vld $vr11, $a0, CONTEXT_FPU_OFFSET + 16*11 + vld $vr12, $a0, CONTEXT_FPU_OFFSET + 16*12 + vld $vr13, $a0, CONTEXT_FPU_OFFSET + 16*13 + vld $vr14, $a0, CONTEXT_FPU_OFFSET + 16*14 + vld $vr15, $a0, CONTEXT_FPU_OFFSET + 16*15 + vld $vr16, $a0, CONTEXT_FPU_OFFSET + 16*16 + vld $vr17, $a0, CONTEXT_FPU_OFFSET + 16*17 + vld $vr18, $a0, CONTEXT_FPU_OFFSET + 16*18 + vld $vr19, $a0, CONTEXT_FPU_OFFSET + 16*19 + vld $vr20, $a0, CONTEXT_FPU_OFFSET + 16*20 + vld $vr21, $a0, CONTEXT_FPU_OFFSET + 16*21 + vld $vr22, $a0, CONTEXT_FPU_OFFSET + 16*22 + vld $vr23, $a0, CONTEXT_FPU_OFFSET + 16*23 + vld $vr24, $a0, CONTEXT_FPU_OFFSET + 16*24 + vld $vr25, $a0, CONTEXT_FPU_OFFSET + 16*25 + vld $vr26, $a0, CONTEXT_FPU_OFFSET + 16*26 + vld $vr27, $a0, CONTEXT_FPU_OFFSET + 16*27 + vld $vr28, $a0, CONTEXT_FPU_OFFSET + 16*28 + vld $vr29, $a0, CONTEXT_FPU_OFFSET + 16*29 + vld $vr30, $a0, CONTEXT_FPU_OFFSET + 16*30 + vld $vr31, $a0, CONTEXT_FPU_OFFSET + 16*31 + b LOCAL_LABEL(Restore_CONTEXT_FLOATING_CONTROL) + +LOCAL_LABEL(Restore_CONTEXT_LASX): // 256-bits SIMD:LASX. - xvld $xr0, $a0, CONTEXT_FPU_OFFSET + 0 - xvld $xr1, $a0, CONTEXT_FPU_OFFSET + 32*1 - xvld $xr2, $a0, CONTEXT_FPU_OFFSET + 32*2 - xvld $xr3, $a0, CONTEXT_FPU_OFFSET + 32*3 - xvld $xr4, $a0, CONTEXT_FPU_OFFSET + 32*4 - xvld $xr5, $a0, CONTEXT_FPU_OFFSET + 32*5 - xvld $xr6, $a0, CONTEXT_FPU_OFFSET + 32*6 - xvld $xr7, $a0, CONTEXT_FPU_OFFSET + 32*7 - xvld $xr8, $a0, CONTEXT_FPU_OFFSET + 32*8 - xvld $xr9, $a0, CONTEXT_FPU_OFFSET + 32*9 + xvld $xr0 , $a0, CONTEXT_FPU_OFFSET + xvld $xr1 , $a0, CONTEXT_FPU_OFFSET + 32*1 + xvld $xr2 , $a0, CONTEXT_FPU_OFFSET + 32*2 + xvld $xr3 , $a0, CONTEXT_FPU_OFFSET + 32*3 + xvld $xr4 , $a0, CONTEXT_FPU_OFFSET + 32*4 + xvld $xr5 , $a0, CONTEXT_FPU_OFFSET + 32*5 + xvld $xr6 , $a0, CONTEXT_FPU_OFFSET + 32*6 + xvld $xr7 , $a0, CONTEXT_FPU_OFFSET + 32*7 + xvld $xr8 , $a0, CONTEXT_FPU_OFFSET + 32*8 + xvld $xr9 , $a0, CONTEXT_FPU_OFFSET + 32*9 xvld $xr10, $a0, CONTEXT_FPU_OFFSET + 32*10 xvld $xr11, $a0, CONTEXT_FPU_OFFSET + 32*11 xvld $xr12, $a0, CONTEXT_FPU_OFFSET + 32*12 @@ -71,6 +148,7 @@ LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT): xvld $xr30, $a0, CONTEXT_FPU_OFFSET + 32*30 xvld $xr31, $a0, CONTEXT_FPU_OFFSET + 32*31 +LOCAL_LABEL(Restore_CONTEXT_FLOATING_CONTROL): ld.d $t1, $a0, CONTEXT_FLOAT_CONTROL_OFFSET movgr2cf $fcc0, $t1 srli.d $t1, $t1, 8 @@ -96,7 +174,6 @@ LOCAL_LABEL(No_Restore_CONTEXT_FLOATING_POINT): andi $t1, $r21, (1 << CONTEXT_INTEGER_BIT) beqz $t1, LOCAL_LABEL(No_Restore_CONTEXT_INTEGER) - ld.d $tp, $a0, CONTEXT_Tp ld.d $a1, $a0, CONTEXT_A1 ld.d $a2, $a0, CONTEXT_A2 ld.d $a3, $a0, CONTEXT_A3 @@ -128,7 +205,7 @@ LOCAL_LABEL(No_Restore_CONTEXT_FLOATING_POINT): LOCAL_LABEL(No_Restore_CONTEXT_INTEGER): andi $r21, $r21, (1 << CONTEXT_CONTROL_BIT) - beq $r21, $r0, LOCAL_LABEL(No_Restore_CONTEXT_CONTROL) + beqz $r21, LOCAL_LABEL(No_Restore_CONTEXT_CONTROL) ld.d $ra, $t4, CONTEXT_Ra ld.d $fp, $t4, CONTEXT_Fp @@ -146,7 +223,6 @@ LEAF_END RtlRestoreContext, _TEXT // Incoming: // a0: Context* - LEAF_ENTRY RtlCaptureContext, _TEXT PROLOG_STACK_ALLOC 16 st.d $r21, $sp, 0 @@ -185,7 +261,6 @@ LOCAL_LABEL(Done_CONTEXT_CONTROL): ld.d $t1, $sp, 8 ld.d $t3, $sp, 16 - st.d $tp, $a0, CONTEXT_Tp st.d $a0, $a0, CONTEXT_A0 st.d $a1, $a0, CONTEXT_A1 st.d $a2, $a0, CONTEXT_A2 @@ -220,8 +295,85 @@ LOCAL_LABEL(Done_CONTEXT_INTEGER): andi $t3, $t1, (1 << CONTEXT_FLOATING_POINT_BIT) beqz $t3, LOCAL_LABEL(Done_CONTEXT_FLOATING_POINT) + andi $t3, $t1, CONTEXT_LASX + bnez $t3, LOCAL_LABEL(Store_CONTEXT_LASX) + andi $t3, $t1, CONTEXT_LSX + bnez $t3, LOCAL_LABEL(Store_CONTEXT_LSX) + + // Neither LSX or LASX is supported. + fst.d $f0 , $a0, CONTEXT_FPU_OFFSET + fst.d $f1 , $a0, CONTEXT_FPU_OFFSET + 8*1 + fst.d $f2 , $a0, CONTEXT_FPU_OFFSET + 8*2 + fst.d $f3 , $a0, CONTEXT_FPU_OFFSET + 8*3 + fst.d $f4 , $a0, CONTEXT_FPU_OFFSET + 8*4 + fst.d $f5 , $a0, CONTEXT_FPU_OFFSET + 8*5 + fst.d $f6 , $a0, CONTEXT_FPU_OFFSET + 8*6 + fst.d $f7 , $a0, CONTEXT_FPU_OFFSET + 8*7 + fst.d $f8 , $a0, CONTEXT_FPU_OFFSET + 8*8 + fst.d $f9 , $a0, CONTEXT_FPU_OFFSET + 8*9 + fst.d $f10, $a0, CONTEXT_FPU_OFFSET + 8*10 + fst.d $f11, $a0, CONTEXT_FPU_OFFSET + 8*11 + fst.d $f12, $a0, CONTEXT_FPU_OFFSET + 8*12 + fst.d $f13, $a0, CONTEXT_FPU_OFFSET + 8*13 + fst.d $f14, $a0, CONTEXT_FPU_OFFSET + 8*14 + fst.d $f15, $a0, CONTEXT_FPU_OFFSET + 8*15 + fst.d $f16, $a0, CONTEXT_FPU_OFFSET + 8*16 + fst.d $f17, $a0, CONTEXT_FPU_OFFSET + 8*17 + fst.d $f18, $a0, CONTEXT_FPU_OFFSET + 8*18 + fst.d $f19, $a0, CONTEXT_FPU_OFFSET + 8*19 + fst.d $f20, $a0, CONTEXT_FPU_OFFSET + 8*20 + fst.d $f21, $a0, CONTEXT_FPU_OFFSET + 8*21 + fst.d $f22, $a0, CONTEXT_FPU_OFFSET + 8*22 + fst.d $f23, $a0, CONTEXT_FPU_OFFSET + 8*23 + fst.d $f24, $a0, CONTEXT_FPU_OFFSET + 8*24 + fst.d $f25, $a0, CONTEXT_FPU_OFFSET + 8*25 + fst.d $f26, $a0, CONTEXT_FPU_OFFSET + 8*26 + fst.d $f27, $a0, CONTEXT_FPU_OFFSET + 8*27 + fst.d $f28, $a0, CONTEXT_FPU_OFFSET + 8*28 + fst.d $f29, $a0, CONTEXT_FPU_OFFSET + 8*29 + fst.d $f30, $a0, CONTEXT_FPU_OFFSET + 8*30 + fst.d $f31, $a0, CONTEXT_FPU_OFFSET + 8*31 + b LOCAL_LABEL(Store_CONTEXT_FLOAT_CONTROL) + +LOCAL_LABEL(Store_CONTEXT_LSX): + // 128-bits SIMD:LSX. + vst $vr0 , $a0, CONTEXT_FPU_OFFSET + vst $vr1 , $a0, CONTEXT_FPU_OFFSET + 16*1 + vst $vr2 , $a0, CONTEXT_FPU_OFFSET + 16*2 + vst $vr3 , $a0, CONTEXT_FPU_OFFSET + 16*3 + vst $vr4 , $a0, CONTEXT_FPU_OFFSET + 16*4 + vst $vr5 , $a0, CONTEXT_FPU_OFFSET + 16*5 + vst $vr6 , $a0, CONTEXT_FPU_OFFSET + 16*6 + vst $vr7 , $a0, CONTEXT_FPU_OFFSET + 16*7 + vst $vr8 , $a0, CONTEXT_FPU_OFFSET + 16*8 + vst $vr9 , $a0, CONTEXT_FPU_OFFSET + 16*9 + vst $vr10, $a0, CONTEXT_FPU_OFFSET + 16*10 + vst $vr11, $a0, CONTEXT_FPU_OFFSET + 16*11 + vst $vr12, $a0, CONTEXT_FPU_OFFSET + 16*12 + vst $vr13, $a0, CONTEXT_FPU_OFFSET + 16*13 + vst $vr14, $a0, CONTEXT_FPU_OFFSET + 16*14 + vst $vr15, $a0, CONTEXT_FPU_OFFSET + 16*15 + vst $vr16, $a0, CONTEXT_FPU_OFFSET + 16*16 + vst $vr17, $a0, CONTEXT_FPU_OFFSET + 16*17 + vst $vr18, $a0, CONTEXT_FPU_OFFSET + 16*18 + vst $vr19, $a0, CONTEXT_FPU_OFFSET + 16*19 + vst $vr20, $a0, CONTEXT_FPU_OFFSET + 16*20 + vst $vr21, $a0, CONTEXT_FPU_OFFSET + 16*21 + vst $vr22, $a0, CONTEXT_FPU_OFFSET + 16*22 + vst $vr23, $a0, CONTEXT_FPU_OFFSET + 16*23 + vst $vr24, $a0, CONTEXT_FPU_OFFSET + 16*24 + vst $vr25, $a0, CONTEXT_FPU_OFFSET + 16*25 + vst $vr26, $a0, CONTEXT_FPU_OFFSET + 16*26 + vst $vr27, $a0, CONTEXT_FPU_OFFSET + 16*27 + vst $vr28, $a0, CONTEXT_FPU_OFFSET + 16*28 + vst $vr29, $a0, CONTEXT_FPU_OFFSET + 16*29 + vst $vr30, $a0, CONTEXT_FPU_OFFSET + 16*30 + vst $vr31, $a0, CONTEXT_FPU_OFFSET + 16*31 + b LOCAL_LABEL(Store_CONTEXT_FLOAT_CONTROL) + +LOCAL_LABEL(Store_CONTEXT_LASX): // 256-bits SIMD:LASX. - xvst $xr0 , $a0, CONTEXT_FPU_OFFSET + 32*0 + xvst $xr0 , $a0, CONTEXT_FPU_OFFSET xvst $xr1 , $a0, CONTEXT_FPU_OFFSET + 32*1 xvst $xr2 , $a0, CONTEXT_FPU_OFFSET + 32*2 xvst $xr3 , $a0, CONTEXT_FPU_OFFSET + 32*3 @@ -254,6 +406,7 @@ LOCAL_LABEL(Done_CONTEXT_INTEGER): xvst $xr30, $a0, CONTEXT_FPU_OFFSET + 32*30 xvst $xr31, $a0, CONTEXT_FPU_OFFSET + 32*31 +LOCAL_LABEL(Store_CONTEXT_FLOAT_CONTROL): ori $t0, $r0, 0 movcf2gr $t0, $fcc0 st.b $t0, $a0, CONTEXT_FLOAT_CONTROL_OFFSET diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/debugbreak.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/debugbreak.S index 93fdfd8c4..54ba721a2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/debugbreak.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/debugbreak.S @@ -4,4 +4,5 @@ #include "unixasmmacros.inc" LEAF_ENTRY DBG_DebugBreak, _TEXT EMIT_BREAKPOINT + jirl $r0, $ra, 0 LEAF_END_MARKED DBG_DebugBreak, _TEXT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/exceptionhelper.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/exceptionhelper.S index b86450da1..911d0d343 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/exceptionhelper.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/loongarch64/exceptionhelper.S @@ -24,7 +24,6 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT .cfi_rel_offset 22, 0 .cfi_rel_offset 1, 8 - ld.d $tp, $a0, CONTEXT_Tp ld.d $s0, $a0, CONTEXT_S0 ld.d $s1, $a0, CONTEXT_S1 ld.d $s2, $a0, CONTEXT_S2 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/ppc64le/context2.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/ppc64le/context2.S index f48c7414a..2134bfe5b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/ppc64le/context2.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/ppc64le/context2.S @@ -137,7 +137,7 @@ LEAF_ENTRY RtlRestoreContext, _TEXT lfd %f31, CONTEXT_F31(%r3) // Restore all general purpose registers - ld %r0, CONTEXT_R0(%R3) + ld %r0, CONTEXT_R0(%r3) ld %r1, CONTEXT_R1(%r3) ld %r2, CONTEXT_R2(%r3) ld %r4, CONTEXT_R4(%r3) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/context2.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/context2.S index 725e4ec9f..5bb06b0ec 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/context2.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/context2.S @@ -139,7 +139,7 @@ LEAF_END RtlCaptureContext, _TEXT // LEAF_ENTRY CONTEXT_CaptureContext, _TEXT - PROLOG_STACK_ALLOC 24 + PROLOG_STACK_ALLOC 32 sd t0, 0(sp) sd t1, 8(sp) sd t3, 16(sp) @@ -149,7 +149,7 @@ LEAF_ENTRY CONTEXT_CaptureContext, _TEXT and t3, t1, t0 bne t3, t0, LOCAL_LABEL(Done_CONTEXT_CONTROL) - addi t0, sp, 24 + addi t0, sp, 32 sd fp, CONTEXT_Fp(a0) sd t0, CONTEXT_Sp(a0) sd ra, CONTEXT_Ra(a0) @@ -243,6 +243,6 @@ LOCAL_LABEL(Done_CONTEXT_INTEGER): LOCAL_LABEL(Done_CONTEXT_FLOATING_POINT): - EPILOG_STACK_FREE 24 + EPILOG_STACK_FREE 32 ret LEAF_END CONTEXT_CaptureContext, _TEXT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/debugbreak.S b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/debugbreak.S index 93fdfd8c4..da73c13b4 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/debugbreak.S +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/arch/riscv64/debugbreak.S @@ -4,4 +4,5 @@ #include "unixasmmacros.inc" LEAF_ENTRY DBG_DebugBreak, _TEXT EMIT_BREAKPOINT + ret LEAF_END_MARKED DBG_DebugBreak, _TEXT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/config.h.in b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/config.h.in index 52405d4c9..941e60e71 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/config.h.in +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/config.h.in @@ -13,14 +13,16 @@ #cmakedefine01 HAVE_CRT_EXTERNS_H #cmakedefine01 HAVE_SYS_TIME_H #cmakedefine01 HAVE_PTHREAD_NP_H +#cmakedefine01 HAVE_SYS_MEMBARRIER_H #cmakedefine01 HAVE_SYS_LWP_H #cmakedefine01 HAVE_LWP_H #cmakedefine01 HAVE_RUNETYPE_H #cmakedefine01 HAVE_GNU_LIBNAMES_H #cmakedefine01 HAVE_PRCTL_H -#cmakedefine01 HAVE_PTHREAD_NP_H #cmakedefine01 HAVE_AUXV_HWCAP_H #cmakedefine01 HAVE_SYS_PTRACE_H +#cmakedefine01 HAVE_SYS_UCONTEXT_H +#cmakedefine01 HAVE_SYS_MOUNT_H #cmakedefine01 HAVE_UCONTEXT_H #cmakedefine01 HAVE_GETAUXVAL @@ -43,6 +45,7 @@ #cmakedefine01 HAVE__LWP_SELF #cmakedefine01 HAVE_MACH_THREADS #cmakedefine01 HAVE_MACH_EXCEPTIONS +#cmakedefine01 HAVE_SIGALTSTACK #cmakedefine01 HAVE_VM_ALLOCATE #cmakedefine01 HAVE_VM_READ #cmakedefine01 HAVE_DIRECTIO @@ -60,10 +63,6 @@ #cmakedefine01 HAVE__FPX_SW_BYTES_WITH_XSTATE_BV #cmakedefine01 HAVE_PR_SET_PTRACER -#cmakedefine01 HAVE_STAT_TIMESPEC -#cmakedefine01 HAVE_STAT_TIM -#cmakedefine01 HAVE_STAT_NSEC - #cmakedefine01 HAVE_BSD_REGS_T #cmakedefine01 HAVE_PT_REGS #cmakedefine01 HAVE_GREGSET_T @@ -83,12 +82,11 @@ #cmakedefine01 HAVE_BROKEN_FIFO_SELECT #cmakedefine01 HAVE_BROKEN_FIFO_KEVENT #cmakedefine01 UNWIND_CONTEXT_IS_UCONTEXT_T +#cmakedefine01 HAVE_GET_PROC_INFO_IN_RANGE #cmakedefine01 HAVE_SCHED_GET_PRIORITY #cmakedefine01 HAVE_WORKING_GETTIMEOFDAY #cmakedefine01 HAVE_WORKING_CLOCK_GETTIME -#cmakedefine01 HAVE_CLOCK_MONOTONIC -#cmakedefine01 HAVE_CLOCK_MONOTONIC_COARSE -#cmakedefine01 HAVE_CLOCK_GETTIME_NSEC_NP +#cmakedefine01 HAVE_CLOCK_THREAD_CPUTIME #cmakedefine01 HAVE_PTHREAD_CONDATTR_SETCLOCK #cmakedefine01 MMAP_ANON_IGNORES_PROTECTION #cmakedefine01 ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS @@ -113,8 +111,6 @@ #cmakedefine01 SET_SCHEDPARAM_NEEDS_PRIVS #define CHECK_TRACE_SPECIFIERS 0 -#define HAVE_GETHRTIME 0 -#define HAVE_READ_REAL_TIME 0 #define OPEN64_IS_USED_INSTEAD_OF_OPEN 0 #define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0 #define SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION 0 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/configure.cmake b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/configure.cmake index 0cc20e3e4..3d89ba2f5 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/configure.cmake +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/configure.cmake @@ -14,7 +14,7 @@ elseif(CLR_CMAKE_TARGET_SUNOS) set(CMAKE_REQUIRED_INCLUDES /opt/local/include) endif() -if(CLR_CMAKE_TARGET_OSX) +if(CLR_CMAKE_TARGET_APPLE) set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE) elseif(NOT CLR_CMAKE_TARGET_FREEBSD AND NOT CLR_CMAKE_TARGET_NETBSD) set(CMAKE_REQUIRED_DEFINITIONS "-D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L") @@ -40,6 +40,7 @@ check_include_files(procfs.h HAVE_PROCFS_H) check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(pthread_np.h HAVE_PTHREAD_NP_H) +check_include_files(sys/membarrier.h HAVE_SYS_MEMBARRIER_H) check_include_files(sys/lwp.h HAVE_SYS_LWP_H) check_include_files(lwp.h HAVE_LWP_H) check_include_files(runetype.h HAVE_RUNETYPE_H) @@ -47,6 +48,8 @@ check_include_files(semaphore.h HAVE_SEMAPHORE_H) check_include_files(sys/prctl.h HAVE_PRCTL_H) check_include_files("sys/auxv.h;asm/hwcap.h" HAVE_AUXV_HWCAP_H) check_include_files("sys/ptrace.h" HAVE_SYS_PTRACE_H) +check_include_files("sys/ucontext.h" HAVE_SYS_UCONTEXT_H) +check_include_files("sys/mount.h" HAVE_SYS_MOUNT_H) check_include_files(ucontext.h HAVE_UCONTEXT_H) check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL) @@ -117,7 +120,20 @@ check_function_exists(statvfs HAVE_STATVFS) check_function_exists(thread_self HAVE_THREAD_SELF) check_function_exists(_lwp_self HAVE__LWP_SELF) check_function_exists(pthread_mach_thread_np HAVE_MACH_THREADS) -check_function_exists(thread_set_exception_ports HAVE_MACH_EXCEPTIONS) +check_cxx_source_compiles(" +#include +int main(int argc, char **argv) { + static mach_port_name_t port; + thread_set_exception_ports(mach_thread_self(), EXC_MASK_BAD_ACCESS, port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + return 0; +}" HAVE_MACH_EXCEPTIONS) +check_cxx_source_compiles(" +#include +#include +int main(int argc, char **argv) { + sigaltstack(NULL, NULL); + return 0; +}" HAVE_SIGALTSTACK) check_function_exists(vm_allocate HAVE_VM_ALLOCATE) check_function_exists(vm_read HAVE_VM_READ) check_function_exists(directio HAVE_DIRECTIO) @@ -135,9 +151,6 @@ int main(int argc, char **argv) { return 0; }" HAVE_CPUSET_T) -check_struct_has_member ("struct stat" st_atimespec "sys/types.h;sys/stat.h" HAVE_STAT_TIMESPEC) -check_struct_has_member ("struct stat" st_atim "sys/types.h;sys/stat.h" HAVE_STAT_TIM) -check_struct_has_member ("struct stat" st_atimensec "sys/types.h;sys/stat.h" HAVE_STAT_NSEC) check_struct_has_member ("ucontext_t" uc_mcontext.gregs[0] ucontext.h HAVE_GREGSET_T) check_struct_has_member ("ucontext_t" uc_mcontext.__gregs[0] ucontext.h HAVE___GREGSET_T) check_struct_has_member ("ucontext_t" uc_mcontext.fpregs->__glibc_reserved1[0] ucontext.h HAVE_FPSTATE_GLIBC_RESERVED1) @@ -382,23 +395,12 @@ int main() { int ret; struct timespec ts; - ret = clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); + ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); exit(ret); -}" HAVE_CLOCK_MONOTONIC_COARSE) +}" HAVE_CLOCK_THREAD_CPUTIME) set(CMAKE_REQUIRED_LIBRARIES) -check_cxx_source_runs(" -#include -#include - -int main() -{ - int ret; - ret = clock_gettime_nsec_np(CLOCK_UPTIME_RAW); - exit((ret == 0) ? 1 : 0); -}" HAVE_CLOCK_GETTIME_NSEC_NP) - check_cxx_source_runs(" #include #include @@ -494,6 +496,7 @@ int main(void) exit(ret != 1); }" ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS) + set(CMAKE_REQUIRED_LIBRARIES pthread) check_cxx_source_runs(" #include @@ -624,6 +627,7 @@ int main(int argc, char **argv) check_symbol_exists(unw_get_save_loc libunwind.h HAVE_UNW_GET_SAVE_LOC) check_symbol_exists(unw_get_accessors libunwind.h HAVE_UNW_GET_ACCESSORS) +check_symbol_exists(unw_get_proc_info_in_range libunwind.h HAVE_GET_PROC_INFO_IN_RANGE) check_cxx_source_compiles(" #include @@ -885,7 +889,7 @@ if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64) set(CMAKE_REQUIRED_LIBRARIES) endif() -if(CLR_CMAKE_TARGET_OSX) +if(CLR_CMAKE_TARGET_APPLE) set(HAVE__NSGETENVIRON 1) set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 1) set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))") @@ -916,15 +920,19 @@ elseif(CLR_CMAKE_TARGET_HAIKU) # Haiku does not have ptrace. set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0) set(HAVE_SCHED_OTHER_ASSIGNABLE 1) +elseif(CLR_CMAKE_TARGET_BROWSER) + set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0) + set(HAVE_SCHED_OTHER_ASSIGNABLE 0) else() # Anything else is Linux - if(NOT HAVE_LTTNG_TRACEPOINT_H AND FEATURE_EVENT_TRACE) + # LTTNG is not available on Android, so don't error out + if(FEATURE_EVENTSOURCE_XPLAT AND NOT HAVE_LTTNG_TRACEPOINT_H) unset(HAVE_LTTNG_TRACEPOINT_H CACHE) message(FATAL_ERROR "Cannot find liblttng-ust-dev. Try installing liblttng-ust-dev (or the appropriate packages for your platform)") endif() set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0) set(PAL_PTRACE "ptrace((cmd), (pid), (void*)(addr), (data))") set(HAVE_SCHED_OTHER_ASSIGNABLE 1) -endif(CLR_CMAKE_TARGET_OSX) +endif(CLR_CMAKE_TARGET_APPLE) check_struct_has_member( "struct statfs" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/file.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/file.cpp deleted file mode 100644 index a7a7a12a3..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/file.cpp +++ /dev/null @@ -1,665 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - file.c - -Abstract: - - Implementation of the file functions in the C runtime library that - are Windows specific. - - - ---*/ - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/file.h" -#include "pal/cruntime.h" - -#include "pal/thread.hpp" -#include "pal/threadsusp.hpp" - -#include -#include -#include -#include - -#if FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL - #define CLEARERR(f) clearerr((f)->bsdFilePtr) -#else - #define CLEARERR(f) -#endif - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -/* Global variables storing the std streams.*/ -PAL_FILE PAL_Stdout; -PAL_FILE PAL_Stdin; -PAL_FILE PAL_Stderr; - -/*++ - -Function: - - CRTInitStdStreams. - - Initializes the standard streams. - Returns TRUE on success, FALSE otherwise. ---*/ -BOOL CRTInitStdStreams() -{ - /* stdout */ - PAL_Stdout.bsdFilePtr = stdout; - PAL_Stdout.PALferrorCode = PAL_FILE_NOERROR; - PAL_Stdout.bTextMode = TRUE; - - /* stdin */ - PAL_Stdin.bsdFilePtr = stdin; - PAL_Stdin.PALferrorCode = PAL_FILE_NOERROR; - PAL_Stdin.bTextMode = TRUE; - - /* stderr */ - PAL_Stderr.bsdFilePtr = stderr; - PAL_Stderr.PALferrorCode = PAL_FILE_NOERROR; - PAL_Stderr.bTextMode = TRUE; - return TRUE; -} - -/*++ -Function : - - MapFileOpenModes - - Maps Windows file open modes to Unix fopen modes and validates. - ---*/ -static LPSTR MapFileOpenModes(LPSTR str , BOOL * bTextMode) -{ - LPSTR retval = NULL; - LPSTR temp = NULL; - - if (NULL == bTextMode) - { - ASSERT("MapFileOpenModes called with a NULL parameter for bTextMode.\n"); - return NULL; - } - - *bTextMode = TRUE; - - if (NULL == str) - { - ASSERT("MapFileOpenModes called with a NULL parameter for str.\n"); - return NULL; - } - - /* The PAL behaves differently for some Windows file open modes: - - c, n, S, R, and T: these are all hints to the system that aren't supported - by the PAL. Since the user cannot depend on this behavior, it's safe to - simply ignore these modes. - - D: specifies a file as temporary. This file is expected to be deleted when - the last file descriptor is closed. The PAL does not support this behavior - and asserts when this mode is used. - - t: represents opening in text mode. Calls to fdopen on Unix don't accept - 't' so it is silently stripped out. However, the PAL supports the mode by - having the PAL wrappers do the translation of CR-LF to LF and vice versa. - - t vs. b: To get binary mode, you must explicitly use 'b'. If neither mode - is specified on Windows, the default mode is defined by the global - variable _fmode. The PAL simply defaults to text mode. After examining - CLR usage patterns, the PAL behavior seems acceptable. */ - - /* Check if the mode specifies deleting the temporary file - automatically when the last file descriptor is closed. - The PAL does not support this behavior. */ - if (NULL != strchr(str,'D')) - { - ASSERT("The PAL doesn't support the 'D' flag for fopen.\n"); - return NULL; - } - - /* Check if the mode specifies opening in binary. - If so, set the bTextMode to false. */ - if(NULL != strchr(str,'b')) - { - *bTextMode = FALSE; - } - - retval = (LPSTR)PAL_malloc( ( strlen( str ) + 1 ) * sizeof( CHAR ) ); - if (NULL == retval) - { - ERROR("Unable to allocate memory.\n"); - return NULL; - } - - temp = retval; - while ( *str ) - { - if ( *str == 'r' || *str == 'w' || *str == 'a' ) - { - *temp = *str; - temp++; - if ( ( ++str != NULL ) && *str == '+' ) - { - *temp = *str; - temp++; - str++; - } - } - else - { - str++; - } - } - *temp = '\0'; - return retval; -} - -#if UNGETC_NOT_RETURN_EOF -/*++ -Function : - - WriteOnlyMode - - Returns TRUE to if a file is opened in write-only mode, - Otherwise FALSE. - ---*/ -static BOOL WriteOnlyMode(FILE* pFile) -{ - INT fd, flags; - - if (pFile != NULL) - { - fd = fileno(pFile); - if ((flags = fcntl(fd, F_GETFL)) >= 0) - { - if ((flags & O_ACCMODE) == O_WRONLY) - { - return TRUE; - } - } - } - return FALSE; -} -#endif //UNGETC_NOT_RETURN_EOF - -/*++ - -Function : - fopen - -see MSDN doc. - ---*/ -PAL_FILE * -__cdecl -PAL_fopen(const char * fileName, const char * mode) -{ - PAL_FILE *f = NULL; - LPSTR supported = NULL; - LPSTR UnixFileName = NULL; - struct stat stat_data; - BOOL bTextMode = TRUE; - - PERF_ENTRY(fopen); - ENTRY("fopen ( fileName=%p (%s) mode=%p (%s))\n", fileName, fileName, mode , mode ); - - _ASSERTE(fileName != NULL); - _ASSERTE(mode != NULL); - - if ( *mode == 'r' || *mode == 'w' || *mode == 'a' ) - { - supported = MapFileOpenModes( (char*)mode,&bTextMode); - - if ( !supported ) - { - goto done; - } - - UnixFileName = PAL__strdup(fileName); - if (UnixFileName == NULL ) - { - ERROR("PAL__strdup() failed\n"); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto done; - } - - /*I am not checking for the case where stat fails - *as fopen will handle the error more gracefully in case - *UnixFileName is invalid*/ - if ((stat(UnixFileName, &stat_data) == 0 ) && - ((stat_data.st_mode & S_IFMT) == S_IFDIR)) - { - goto done; - } - - f = (PAL_FILE*)PAL_malloc( sizeof( PAL_FILE ) ); - if ( f ) - { - f->bsdFilePtr = (FILE*)fopen( UnixFileName, supported ); - f->PALferrorCode = PAL_FILE_NOERROR; - f->bTextMode = bTextMode; - if ( !f->bsdFilePtr ) - { - /* Failed */ - PAL_free( f ); - f = NULL; - } -#if UNGETC_NOT_RETURN_EOF - else - { - f->bWriteOnlyMode = WriteOnlyMode(f->bsdFilePtr); - } -#endif //UNGETC_NOT_RETURN_EOF - } - else - { - ERROR( "Unable to allocate memory to the PAL_FILE wrapper\n" ); - } - } - else - { - ERROR( "The mode flags must start with either an a, w, or r.\n" ); - } - -done: - PAL_free( supported ); - supported = NULL; - PAL_free( UnixFileName ); - - LOGEXIT( "fopen returns FILE* %p\n", f ); - PERF_EXIT(fopen); - return f; -} - -/*++ -Function: - _wfopen - -see MSDN doc. - ---*/ -PAL_FILE * -__cdecl -_wfopen( - const wchar_16 *fileName, - const wchar_16 *mode) -{ - CHAR mbFileName[ _MAX_PATH ]; - CHAR mbMode[ 10 ]; - PAL_FILE * filePtr = NULL; - - PERF_ENTRY(_wfopen); - ENTRY("_wfopen(fileName:%p (%S), mode:%p (%S))\n", fileName, fileName, mode, mode); - - _ASSERTE(fileName != NULL); - _ASSERTE(mode != NULL); - - /* Convert the parameters to ASCII and defer to PAL_fopen */ - if ( WideCharToMultiByte( CP_ACP, 0, fileName, -1, mbFileName, - sizeof mbFileName, NULL, NULL ) != 0 ) - { - if ( WideCharToMultiByte( CP_ACP, 0, mode, -1, mbMode, - sizeof mbMode, NULL, NULL ) != 0 ) - { - filePtr = PAL_fopen(mbFileName, mbMode); - } - else - { - ERROR( "An error occurred while converting mode to ANSI.\n" ); - } - } - else - { - ERROR( "An error occurred while converting" - " fileName to ANSI string.\n" ); - } - LOGEXIT("_wfopen returning FILE* %p\n", filePtr); - PERF_EXIT(_wfopen); - return filePtr; -} - -/*++ -Function - PAL_get_stdout. - - Returns the stdout stream. ---*/ -PAL_FILE * __cdecl PAL_get_stdout(int caller) -{ - PERF_ENTRY(get_stdout); - ENTRY("PAL_get_stdout\n"); - LOGEXIT("PAL_get_stdout returns PAL_FILE * %p\n", &PAL_Stdout ); - PERF_EXIT(get_stdout); - return &PAL_Stdout; -} - -/*++ -Function - PAL_get_stdin. - - Returns the stdin stream. ---*/ -PAL_FILE * __cdecl PAL_get_stdin(int caller) -{ - PERF_ENTRY(get_stdin); - ENTRY("PAL_get_stdin\n"); - LOGEXIT("PAL_get_stdin returns PAL_FILE * %p\n", &PAL_Stdin ); - PERF_EXIT(get_stdin); - return &PAL_Stdin; -} - -/*++ -Function - PAL_get_stderr. - - Returns the stderr stream. ---*/ -PAL_FILE * __cdecl PAL_get_stderr(int caller) -{ - PERF_ENTRY(get_stderr); - ENTRY("PAL_get_stderr\n"); - LOGEXIT("PAL_get_stderr returns PAL_FILE * %p\n", &PAL_Stderr ); - PERF_EXIT(get_stderr); - return &PAL_Stderr; -} - -/*++ - -Function: - - PAL_pread - -See msdn for more details. ---*/ -size_t __cdecl PAL__pread(int fd, void *buf, size_t nbytes, ULONG64 offset) -{ - return pread(fd, buf, nbytes, offset); -} - -/*++ - -Function: - - _close - -See msdn for more details. ---*/ -int __cdecl PAL__close(int handle) -{ - INT nRetVal = 0; - - PERF_ENTRY(_close); - ENTRY( "_close( handle=%d )\n", handle ); - - nRetVal = close( handle ); - - LOGEXIT( "_close returning %d.\n", nRetVal ); - PERF_EXIT(_close); - return nRetVal; -} - -int __cdecl PAL__flushall() -{ - return fflush(NULL); -} - -int __cdecl PAL_getc(PAL_FILE *stream); - -/*++ -Function : - - fread - - See MSDN for more details. ---*/ - -size_t -__cdecl -PAL_fread(void * buffer, size_t size, size_t count, PAL_FILE * f) -{ - size_t nReadBytes = 0; - - PERF_ENTRY(fread); - ENTRY( "fread( buffer=%p, size=%d, count=%d, f=%p )\n", - buffer, size, count, f ); - - _ASSERTE(f != NULL); - - CLEARERR(f); - - if(f->bTextMode != TRUE) - { - nReadBytes = fread( buffer, size, count, f->bsdFilePtr ); - } - else - { - size_t i=0; - if(size > 0) - { - size_t j=0; - LPSTR temp = (LPSTR)buffer; - int nChar = 0; - int nCount =0; - - for(i=0; i< count; i++) - { - for(j=0; j< size; j++) - { - if((nChar = PAL_getc(f)) == EOF) - { - nReadBytes = i; - goto done; - } - else - { - temp[nCount++]= (char)nChar; - } - } - } - } - nReadBytes = i; - } - -done: - LOGEXIT( "fread returning size_t %d\n", nReadBytes ); - PERF_EXIT(fread); - return nReadBytes; -} - - -/*++ -Function : - - ferror - - See MSDN for more details. ---*/ -int -_cdecl -PAL_ferror(PAL_FILE * f) -{ - INT nErrorCode = PAL_FILE_NOERROR; - - PERF_ENTRY(ferror); - ENTRY( "ferror( f=%p )\n", f ); - - _ASSERTE(f != NULL); - - nErrorCode = ferror( f->bsdFilePtr ); - if ( 0 == nErrorCode ) - { - /* See if the PAL file error code is set. */ - nErrorCode = f->PALferrorCode; - } - - LOGEXIT( "ferror returns %d\n", nErrorCode ); - PERF_EXIT(ferror); - return nErrorCode; -} - - -/*++ -Function : - - fclose - - See MSDN for more details. ---*/ -int -_cdecl -PAL_fclose(PAL_FILE * f) -{ - INT nRetVal = 0; - - PERF_ENTRY(fclose); - ENTRY( "fclose( f=%p )\n", f ); - - _ASSERTE(f != NULL); - - CLEARERR(f); - - nRetVal = fclose( f->bsdFilePtr ); - PAL_free( f ); - - LOGEXIT( "fclose returning %d\n", nRetVal ); - PERF_EXIT(fclose); - return nRetVal; -} - -/*++ -Function : - - fputs - - See MSDN for more details. ---*/ -int -_cdecl -PAL_fputs(const char * str, PAL_FILE * f) -{ - INT nRetVal = 0; - - PERF_ENTRY(fputs); - ENTRY( "fputs( %p (%s), %p )\n", str, str, f); - - _ASSERTE(str != NULL); - _ASSERTE(f != NULL); - - CLEARERR(f); - - nRetVal = fputs( str, f->bsdFilePtr ); - - LOGEXIT( "fputs returning %d\n", nRetVal ); - PERF_EXIT(fputs); - return nRetVal; -} - -/*++ -Function : - - ftell - - See MSDN for more details. ---*/ -LONG -_cdecl -PAL_ftell(PAL_FILE * f) -{ - long lRetVal = 0; - - PERF_ENTRY(ftell); - ENTRY( "ftell( %p )\n", f ); - - _ASSERTE(f != NULL); - lRetVal = ftell( f->bsdFilePtr ); - -#ifdef HOST_64BIT - /* Windows does not set an error if the file pointer's position - is greater than _I32_MAX. It just returns -1. */ - if (lRetVal > _I32_MAX) - { - lRetVal = -1; - } -#endif - - LOGEXIT( "ftell returning %ld\n", lRetVal ); - PERF_EXIT(ftell); - /* This explicit cast to LONG is used to silence any potential warnings - due to implicitly casting the native long lRetVal to LONG when returning. */ - return (LONG)lRetVal; -} - -/*++ -Function : - getc - - See MSDN for more details. ---*/ -int -_cdecl -PAL_getc(PAL_FILE * f) -{ - INT nRetVal = 0; - INT temp =0; - - PERF_ENTRY(getc); - ENTRY( "getc( %p )\n", f ); - - _ASSERTE(f != NULL); - - CLEARERR(f); - - nRetVal = getc( f->bsdFilePtr ); - - if ( (f->bTextMode) && (nRetVal == '\r') ) - { - if ((temp = getc( f->bsdFilePtr ))== '\n') - { - nRetVal ='\n'; - } - else if (EOF == ungetc( temp, f->bsdFilePtr )) - { - ERROR("ungetc operation failed\n"); - } - } - - LOGEXIT( "getc returning %d\n", nRetVal ); - PERF_EXIT(getc); - return nRetVal; -} - -/*++ -Function : - - setvbuf - - See MSDN for more details. ---*/ -int -_cdecl -PAL_setvbuf(PAL_FILE *f, char *buf, int type, size_t size) -{ - INT nRetVal = 0; - - PERF_ENTRY(setvbuf); - ENTRY( "setvbuf( %p, %p, %d, %ul )\n", f, buf, type, size); - - _ASSERTE(f != NULL); - - nRetVal = setvbuf(f->bsdFilePtr, buf, type, size); - - LOGEXIT( "setvbuf returning %d\n", nRetVal ); - PERF_EXIT(setvbuf); - return nRetVal; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/filecrt.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/filecrt.cpp deleted file mode 100644 index 5d2fe0e5d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/filecrt.cpp +++ /dev/null @@ -1,378 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - -Module Name: - - filecrt.cpp - -Abstract: - - Implementation of the file functions in the C runtime library that - are Windows specific. - ---*/ - -#include "pal/thread.hpp" -#include "pal/file.hpp" - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/file.h" -#include "pal/cruntime.h" - -#include -#include -#include - -#ifdef __APPLE__ -#include -#endif // __APPLE__ - -using namespace CorUnix; - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -/*++ -Function: - PAL_fflush - -See MSDN for more details. ---*/ -int -_cdecl -PAL_fflush( PAL_FILE *stream ) -{ - int nRetVal = 0; - - PERF_ENTRY(fflush); - ENTRY( "fflush( %p )\n", stream ); - - nRetVal = fflush(stream ? stream->bsdFilePtr : NULL); - - LOGEXIT( "fflush returning %d\n", nRetVal ); - PERF_EXIT(fflush); - return nRetVal; -} - - -/*++ -PAL__open - -Wrapper function for InternalOpen. - -Input parameters: - -szPath = pointer to a pathname of a file to be opened -nFlags = arguments that control how the file should be accessed -mode = file permission settings that are used only when a file is created - -Return value: - File descriptor on success, -1 on failure ---*/ -int -__cdecl -PAL__open( - const char *szPath, - int nFlags, - ... - ) -{ - int nRet = -1; - int mode = 0; - va_list ap; - - // If nFlags does not contain O_CREAT, the mode parameter will be ignored. - if (nFlags & O_CREAT) - { - va_start(ap, nFlags); - mode = va_arg(ap, int); - va_end(ap); - } - - nRet = InternalOpen(szPath, nFlags, mode); - return nRet; -} - -/*++ -InternalOpen - -Wrapper for open. - -Input parameters: - -szPath = pointer to a pathname of a file to be opened -nFlags = arguments that control how the file should be accessed -mode = file permission settings that are used only when a file is created - -Return value: - File descriptor on success, -1 on failure ---*/ -int -CorUnix::InternalOpen( - const char *szPath, - int nFlags, - ... - ) -{ - int nRet = -1; - int mode = 0; - va_list ap; - - // If nFlags does not contain O_CREAT, the mode parameter will be ignored. - if (nFlags & O_CREAT) - { - va_start(ap, nFlags); - mode = va_arg(ap, int); - va_end(ap); - } - - do - { -#if OPEN64_IS_USED_INSTEAD_OF_OPEN - nRet = open64(szPath, nFlags, mode); -#else - nRet = open(szPath, nFlags, mode); -#endif - } - while ((nRet == -1) && (errno == EINTR)); - - return nRet; -} - - -/*++ -PAL_fgets - -Wrapper function for InternalFgets. - -Input parameters: - -sz = stores characters read from the given file stream -nSize = number of characters to be read -pf = stream to read characters from - -Return value: - Returns a pointer to the string storing the characters on success - and NULL on failure. ---*/ -char * -__cdecl -PAL_fgets( - char *sz, - int nSize, - PAL_FILE *pf - ) -{ - char * szBuf; - - PERF_ENTRY(fgets); - ENTRY( "fgets(sz=%p (%s) nSize=%d pf=%p)\n", sz, sz, nSize, pf); - - if (pf != NULL) - { - szBuf = InternalFgets(sz, nSize, pf->bsdFilePtr, pf->bTextMode); - } - else - { - szBuf = NULL; - } - - LOGEXIT("fgets() returns %p\n", szBuf); - PERF_EXIT(fgets); - - return szBuf; -} - -/*++ -InternalFgets - -Wrapper for fgets. - -Input parameters: - -sz = stores characters read from the given file stream -nSize = number of characters to be read -f = stream to read characters from -fTextMode = flag that indicates if file contents are text or binary - -Return value: - Returns a pointer to the string storing the characters on success - and NULL on failure. - -Notes: -In Unix systems, fgets() can return an error if it gets interrupted by a -signal before reading anything, and errno is set to EINTR. When this -happens, it is SOP to call fgets again. ---*/ -char * -CorUnix::InternalFgets( - char *sz, - int nSize, - FILE *f, - bool fTextMode - ) -{ - char *retval = NULL; - - _ASSERTE(sz != NULL); - _ASSERTE(f != NULL); - -#if FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL - clearerr(f); -#endif - - do - { - retval = fgets(sz, nSize, f); - if (NULL==retval) - { - if (feof(f)) - { - TRACE("Reached EOF\n"); - break; - } - /* The man page suggests using ferror and feof to distinguish - between error and EOF, but feof and errno is sufficient. - Not all cases that set errno also flag ferror, so just - checking errno is the best solution. */ - if (EINTR != errno) - { - WARN("got error; errno is %d (%s)\n",errno, strerror(errno)); - break; - } - /* we ignored a EINTR error, reset the stream's error state */ - clearerr(f); - TRACE("call got interrupted (EINTR), trying again\n"); - } - if (fTextMode) - { - int len = strlen(sz); - if ((len>=2) && (sz[len-1]=='\n') && (sz[len-2]=='\r')) - { - sz[len-2]='\n'; - sz[len-1]='\0'; - } - } - } while(NULL == retval); - - return retval; -} - -/*++ -PAL_fwrite - -Wrapper function for InternalFwrite. - -Input parameters: - -pvBuffer = array of objects to write to the given file stream -nSize = size of a object in bytes -nCount = number of objects to write -pf = stream to write characters to - -Return value: - Returns the number of objects written. ---*/ -size_t -__cdecl -PAL_fwrite( - const void *pvBuffer, - size_t nSize, - size_t nCount, - PAL_FILE *pf - ) -{ - size_t nWrittenBytes = 0; - - PERF_ENTRY(fwrite); - ENTRY( "fwrite( pvBuffer=%p, nSize=%d, nCount=%d, pf=%p )\n", - pvBuffer, nSize, nCount, pf); - _ASSERTE(pf != NULL); - - nWrittenBytes = InternalFwrite(pvBuffer, nSize, nCount, pf->bsdFilePtr, &pf->PALferrorCode); - - LOGEXIT( "fwrite returning size_t %d\n", nWrittenBytes ); - PERF_EXIT(fwrite); - return nWrittenBytes; -} - -/*++ -InternalFwrite - -Wrapper for fwrite. - -Input parameters: - -pvBuffer = array of objects to write to the given file stream -nSize = size of a object in bytes -nCount = number of objects to write -f = stream to write characters to -pnErrorCode = reference to a PAL_FILE's fwrite error code field - -Return value: - Returns the number of objects written. ---*/ -size_t -CorUnix::InternalFwrite( - const void *pvBuffer, - size_t nSize, - size_t nCount, - FILE *f, - INT *pnErrorCode - ) -{ - size_t nWrittenBytes = 0; - _ASSERTE(f != NULL); - -#if FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL - clearerr(f); -#endif - - nWrittenBytes = fwrite(pvBuffer, nSize, nCount, f); - - // Make sure no error occurred. - if ( nWrittenBytes < nCount ) - { - // Set the FILE* error code - *pnErrorCode = PAL_FILE_ERROR; - } - - return nWrittenBytes; -} - - -/*++ -PAL_fseek - -Wrapper function for fseek. - -Input parameters: - -pf = a given file stream -lOffset = distance from position to set file-position indicator -nWhence = method used to determine the file_position indicator location relative to lOffset - -Return value: - 0 on success, -1 on failure. ---*/ -int -_cdecl -PAL_fseek( - PAL_FILE * pf, - LONG lOffset, - int nWhence - ) -{ - int nRet = 0; - - PERF_ENTRY(fseek); - ENTRY( "fseek( %p, %ld, %d )\n", pf, lOffset, nWhence ); - - nRet = fseek(pf ? pf->bsdFilePtr : NULL, lOffset, nWhence); - - LOGEXIT("fseek returning %d\n", nRet); - PERF_EXIT(fseek); - return nRet; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/malloc.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/malloc.cpp deleted file mode 100644 index 4351c47e3..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/malloc.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - malloc.cpp - -Abstract: - - Implementation of suspension safe memory allocation functions. - -Revision History: - - - ---*/ - -#include "pal/corunix.hpp" -#include "pal/thread.hpp" -#include "pal/malloc.hpp" -#include "pal/dbgmsg.h" - -#include - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -using namespace CorUnix; - -void * -__cdecl -PAL_realloc( - void* pvMemblock, - size_t szSize - ) -{ - return InternalRealloc(pvMemblock, szSize); -} - -void * -CorUnix::InternalRealloc( - void* pvMemblock, - size_t szSize - ) -{ - void *pvMem; - - PERF_ENTRY(InternalRealloc); - ENTRY("realloc (memblock:%p size=%d)\n", pvMemblock, szSize); - - if (szSize == 0) - { - // If pvMemblock is NULL, there's no reason to call free. - if (pvMemblock != NULL) - { - free(pvMemblock); - } - pvMem = NULL; - } - else - { - pvMem = realloc(pvMemblock, szSize); - } - - LOGEXIT("realloc returns void * %p\n", pvMem); - PERF_EXIT(InternalRealloc); - return pvMem; -} - -void -__cdecl -PAL_free( - void *pvMem - ) -{ - free(pvMem); -} - -void * -__cdecl -PAL_malloc( - size_t szSize - ) -{ - return InternalMalloc(szSize); -} - -void * -CorUnix::InternalMalloc( - size_t szSize - ) -{ - void *pvMem; - - if (szSize == 0) - { - // malloc may return null for a requested size of zero bytes. Force a nonzero size to get a valid pointer. - szSize = 1; - } - - pvMem = (void*)malloc(szSize); - return pvMem; -} - -char * -__cdecl -PAL__strdup( - const char *c_szStr - ) -{ - return strdup(c_szStr); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/math.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/math.cpp deleted file mode 100644 index 14243f43a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/math.cpp +++ /dev/null @@ -1,859 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - math.cpp - -Abstract: - - Implementation of math family functions. - - - ---*/ - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" - -#include - -#if HAVE_IEEEFP_H -#include -#endif // HAVE_IEEEFP_H - -#include - -#define PAL_NAN_DBL sqrt(-1.0) -#define PAL_POSINF_DBL -log(0.0) -#define PAL_NEGINF_DBL log(0.0) - -#define IS_DBL_NEGZERO(x) (((*((INT64*)((void*)&x))) & I64(0xFFFFFFFFFFFFFFFF)) == I64(0x8000000000000000)) - -#define PAL_NAN_FLT sqrtf(-1.0f) -#define PAL_POSINF_FLT -logf(0.0f) -#define PAL_NEGINF_FLT logf(0.0f) - -#define IS_FLT_NEGZERO(x) (((*((INT32*)((void*)&x))) & 0xFFFFFFFF) == 0x80000000) - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -/*++ -Function: - _finite - -Determines whether given double-precision floating point value is finite. - -Return Value - -_finite returns a nonzero value (TRUE) if its argument x is not -infinite, that is, if -INF < x < +INF. It returns 0 (FALSE) if the -argument is infinite or a NaN. - -Parameter - -x Double-precision floating-point value - ---*/ -int __cdecl _finite(double x) -{ - int ret; - PERF_ENTRY(_finite); - ENTRY("_finite (x=%f)\n", x); - - ret = isfinite(x); - - LOGEXIT("_finite returns int %d\n", ret); - PERF_EXIT(_finite); - return ret; -} - -/*++ -Function: - _isnan - -See MSDN doc ---*/ -int __cdecl _isnan(double x) -{ - int ret; - PERF_ENTRY(_isnan); - ENTRY("_isnan (x=%f)\n", x); - - ret = isnan(x); - - LOGEXIT("_isnan returns int %d\n", ret); - PERF_EXIT(_isnan); - return ret; -} - -/*++ -Function: - _copysign - -See MSDN doc ---*/ -double __cdecl _copysign(double x, double y) -{ - double ret; - PERF_ENTRY(_copysign); - ENTRY("_copysign (x=%f, y=%f)\n", x, y); - - ret = copysign(x, y); - - LOGEXIT("_copysign returns double %f\n", ret); - PERF_EXIT(_copysign); - return ret; -} - -/*++ -Function: - acos - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_acos(double x) -{ - double ret; - PERF_ENTRY(acos); - ENTRY("acos (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_ACOS - errno = 0; -#endif // HAVE_COMPATIBLE_ACOS - - ret = acos(x); - -#if !HAVE_COMPATIBLE_ACOS - if (errno == EDOM) - { - ret = PAL_NAN_DBL; // NaN - } -#endif // HAVE_COMPATIBLE_ACOS - - LOGEXIT("acos returns double %f\n", ret); - PERF_EXIT(acos); - return ret; -} - -/*++ -Function: - asin - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_asin(double x) -{ - double ret; - PERF_ENTRY(asin); - ENTRY("asin (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_ASIN - errno = 0; -#endif // HAVE_COMPATIBLE_ASIN - - ret = asin(x); - -#if !HAVE_COMPATIBLE_ASIN - if (errno == EDOM) - { - ret = PAL_NAN_DBL; // NaN - } -#endif // HAVE_COMPATIBLE_ASIN - - LOGEXIT("asin returns double %f\n", ret); - PERF_EXIT(asin); - return ret; -} - -/*++ -Function: - atan2 - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_atan2(double y, double x) -{ - double ret; - PERF_ENTRY(atan2); - ENTRY("atan2 (y=%f, x=%f)\n", y, x); - -#if !HAVE_COMPATIBLE_ATAN2 - errno = 0; -#endif // !HAVE_COMPATIBLE_ATAN2 - - ret = atan2(y, x); - -#if !HAVE_COMPATIBLE_ATAN2 - if ((errno == EDOM) && (x == 0.0) && (y == 0.0)) - { - const double sign_x = copysign(1.0, x); - const double sign_y = copysign(1.0, y); - - if (sign_x > 0) - { - ret = copysign(0.0, sign_y); - } - else - { - ret = copysign(atan2(0.0, -1.0), sign_y); - } - } -#endif // !HAVE_COMPATIBLE_ATAN2 - - LOGEXIT("atan2 returns double %f\n", ret); - PERF_EXIT(atan2); - return ret; -} - -/*++ -Function: - exp - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_exp(double x) -{ - double ret; - PERF_ENTRY(exp); - ENTRY("exp (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_EXP - if (x == 1.0) - { - ret = M_E; - } - else - { -#endif // HAVE_COMPATIBLE_EXP - - ret = exp(x); - -#if !HAVE_COMPATIBLE_EXP - } -#endif // HAVE_COMPATIBLE_EXP - - LOGEXIT("exp returns double %f\n", ret); - PERF_EXIT(exp); - return ret; -} - -/*++ -Function: - ilogb - -See MSDN. ---*/ -PALIMPORT int __cdecl PAL_ilogb(double x) -{ - int ret; - PERF_ENTRY(ilogb); - ENTRY("ilogb (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_ILOGB0 - if (x == 0.0) - { - ret = -2147483648; - } - else -#endif // !HAVE_COMPATIBLE_ILOGB0 - -#if !HAVE_COMPATIBLE_ILOGBNAN - if (isnan(x)) - { - ret = 2147483647; - } - else -#endif // !HAVE_COMPATIBLE_ILOGBNAN - - { - ret = ilogb(x); - } - - LOGEXIT("ilogb returns int %d\n", ret); - PERF_EXIT(ilogb); - return ret; -} - -/*++ -Function: - log - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_log(double x) -{ - double ret; - PERF_ENTRY(log); - ENTRY("log (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_LOG - errno = 0; -#endif // !HAVE_COMPATIBLE_LOG - - ret = log(x); - -#if !HAVE_COMPATIBLE_LOG - if ((errno == EDOM) && (x < 0)) - { - ret = PAL_NAN_DBL; // NaN - } -#endif // !HAVE_COMPATIBLE_LOG - - LOGEXIT("log returns double %f\n", ret); - PERF_EXIT(log); - return ret; -} - -/*++ -Function: - log10 - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_log10(double x) -{ - double ret; - PERF_ENTRY(log10); - ENTRY("log10 (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_LOG10 - errno = 0; -#endif // !HAVE_COMPATIBLE_LOG10 - - ret = log10(x); - -#if !HAVE_COMPATIBLE_LOG10 - if ((errno == EDOM) && (x < 0)) - { - ret = PAL_NAN_DBL; // NaN - } -#endif // !HAVE_COMPATIBLE_LOG10 - - LOGEXIT("log10 returns double %f\n", ret); - PERF_EXIT(log10); - return ret; -} - -/*++ -Function: - pow - -See MSDN. ---*/ -PALIMPORT double __cdecl PAL_pow(double x, double y) -{ - double ret; - PERF_ENTRY(pow); - ENTRY("pow (x=%f, y=%f)\n", x, y); - -#if !HAVE_COMPATIBLE_POW - if ((y == PAL_POSINF_DBL) && !isnan(x)) // +Inf - { - if (x == 1.0) - { - ret = x; - } - else if (x == -1.0) - { - ret = 1.0; - } - else if ((x > -1.0) && (x < 1.0)) - { - ret = 0.0; - } - else - { - ret = PAL_POSINF_DBL; // +Inf - } - } - else if ((y == PAL_NEGINF_DBL) && !isnan(x)) // -Inf - { - if (x == 1.0) - { - ret = x; - } - else if (x == -1.0) - { - ret = 1.0; - } - else if ((x > -1.0) && (x < 1.0)) - { - ret = PAL_POSINF_DBL; // +Inf - } - else - { - ret = 0.0; - } - } - else if (IS_DBL_NEGZERO(x) && (y == -1.0)) - { - ret = PAL_NEGINF_DBL; // -Inf - } - else if ((x == 0.0) && (y < 0.0)) - { - ret = PAL_POSINF_DBL; // +Inf - } - else -#endif // !HAVE_COMPATIBLE_POW - - ret = pow(x, y); - -#if !HAVE_VALID_NEGATIVE_INF_POW - if ((ret == PAL_POSINF_DBL) && (x < 0) && isfinite(x) && (ceil(y / 2) != floor(y / 2))) - { - ret = PAL_NEGINF_DBL; // -Inf - } -#endif // !HAVE_VALID_NEGATIVE_INF_POW - -#if !HAVE_VALID_POSITIVE_INF_POW - /* - * The even/odd test in the if (this one and the one above) used to be ((long long) y % 2 == 0) - * on SPARC (long long) y for large y (>2**63) is always 0x7fffffff7fffffff, which - * is an odd number, so the test ((long long) y % 2 == 0) will always fail for - * large y. Since large double numbers are always even (e.g., the representation of - * 1E20+1 is the same as that of 1E20, the last .+1. is too insignificant to be part - * of the representation), this test will always return the wrong result for large y. - * - * The (ceil(y/2) == floor(y/2)) test is slower, but more robust. - */ - if ((ret == PAL_NEGINF_DBL) && (x < 0) && isfinite(x) && (ceil(y / 2) == floor(y / 2))) - { - ret = PAL_POSINF_DBL; // +Inf - } -#endif // !HAVE_VALID_POSITIVE_INF_POW - - LOGEXIT("pow returns double %f\n", ret); - PERF_EXIT(pow); - return ret; -} - -/*++ -Function: - sincos - -See MSDN. ---*/ -PALIMPORT void __cdecl PAL_sincos(double x, double* sin, double* cos) -{ - PERF_ENTRY(sincos); - ENTRY("sincos (x=%f)\n", x); - -#if defined(__APPLE__) - __sincos(x, sin, cos); -#else - sincos(x, sin, cos); -#endif // !__APPLE__ - - LOGEXIT("sincos returns (double %f, double %f)\n", *sin, *cos); - PERF_EXIT(sincos); -} - -/*++ -Function: - _finitef - -Determines whether given single-precision floating point value is finite. - -Return Value - -_finitef returns a nonzero value (TRUE) if its argument x is not -infinite, that is, if -INF < x < +INF. It returns 0 (FALSE) if the -argument is infinite or a NaN. - -Parameter - -x Single-precision floating-point value - ---*/ -int __cdecl _finitef(float x) -{ - int ret; - PERF_ENTRY(_finitef); - ENTRY("_finitef (x=%f)\n", x); - - ret = isfinite(x); - - LOGEXIT("_finitef returns int %d\n", ret); - PERF_EXIT(_finitef); - return ret; -} - -/*++ -Function: - _isnanf - -See MSDN doc ---*/ -int __cdecl _isnanf(float x) -{ - int ret; - PERF_ENTRY(_isnanf); - ENTRY("_isnanf (x=%f)\n", x); - - ret = isnan(x); - - LOGEXIT("_isnanf returns int %d\n", ret); - PERF_EXIT(_isnanf); - return ret; -} - -/*++ -Function: - _copysignf - -See MSDN doc ---*/ -float __cdecl _copysignf(float x, float y) -{ - float ret; - PERF_ENTRY(_copysignf); - ENTRY("_copysignf (x=%f, y=%f)\n", x, y); - - ret = copysign(x, y); - - LOGEXIT("_copysignf returns float %f\n", ret); - PERF_EXIT(_copysignf); - return ret; -} - -/*++ -Function: - acosf - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_acosf(float x) -{ - float ret; - PERF_ENTRY(acosf); - ENTRY("acosf (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_ACOS - errno = 0; -#endif // HAVE_COMPATIBLE_ACOS - - ret = acosf(x); - -#if !HAVE_COMPATIBLE_ACOS - if (errno == EDOM) - { - ret = PAL_NAN_FLT; // NaN - } -#endif // HAVE_COMPATIBLE_ACOS - - LOGEXIT("acosf returns float %f\n", ret); - PERF_EXIT(acosf); - return ret; -} - -/*++ -Function: - asinf - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_asinf(float x) -{ - float ret; - PERF_ENTRY(asinf); - ENTRY("asinf (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_ASIN - errno = 0; -#endif // HAVE_COMPATIBLE_ASIN - - ret = asinf(x); - -#if !HAVE_COMPATIBLE_ASIN - if (errno == EDOM) - { - ret = PAL_NAN_FLT; // NaN - } -#endif // HAVE_COMPATIBLE_ASIN - - LOGEXIT("asinf returns float %f\n", ret); - PERF_EXIT(asinf); - return ret; -} - -/*++ -Function: - atan2f - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_atan2f(float y, float x) -{ - float ret; - PERF_ENTRY(atan2f); - ENTRY("atan2f (y=%f, x=%f)\n", y, x); - -#if !HAVE_COMPATIBLE_ATAN2 - errno = 0; -#endif // !HAVE_COMPATIBLE_ATAN2 - - ret = atan2f(y, x); - -#if !HAVE_COMPATIBLE_ATAN2 - if ((errno == EDOM) && (x == 0.0f) && (y == 0.0f)) - { - const float sign_x = copysign(1.0f, x); - const float sign_y = copysign(1.0f, y); - - if (sign_x > 0) - { - ret = copysign(0.0f, sign_y); - } - else - { - ret = copysign(atan2f(0.0f, -1.0f), sign_y); - } - } -#endif // !HAVE_COMPATIBLE_ATAN2 - - LOGEXIT("atan2f returns float %f\n", ret); - PERF_EXIT(atan2f); - return ret; -} - -/*++ -Function: - expf - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_expf(float x) -{ - float ret; - PERF_ENTRY(expf); - ENTRY("expf (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_EXP - if (x == 1.0f) - { - ret = M_E; - } - else - { -#endif // HAVE_COMPATIBLE_EXP - - ret = expf(x); - -#if !HAVE_COMPATIBLE_EXP - } -#endif // HAVE_COMPATIBLE_EXP - - LOGEXIT("expf returns float %f\n", ret); - PERF_EXIT(expf); - return ret; -} - -/*++ -Function: - ilogbf - -See MSDN. ---*/ -PALIMPORT int __cdecl PAL_ilogbf(float x) -{ - int ret; - PERF_ENTRY(ilogbf); - ENTRY("ilogbf (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_ILOGB0 - if (x == 0.0f) - { - ret = -2147483648; - } - else -#endif // !HAVE_COMPATIBLE_ILOGB0 - -#if !HAVE_COMPATIBLE_ILOGBNAN - if (isnan(x)) - { - ret = 2147483647; - } - else -#endif // !HAVE_COMPATIBLE_ILOGBNAN - - { - ret = ilogbf(x); - } - - LOGEXIT("ilogbf returns int %d\n", ret); - PERF_EXIT(ilogbf); - return ret; -} - -/*++ -Function: - logf - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_logf(float x) -{ - float ret; - PERF_ENTRY(logf); - ENTRY("logf (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_LOG - errno = 0; -#endif // !HAVE_COMPATIBLE_LOG - - ret = logf(x); - -#if !HAVE_COMPATIBLE_LOG - if ((errno == EDOM) && (x < 0)) - { - ret = PAL_NAN_FLT; // NaN - } -#endif // !HAVE_COMPATIBLE_LOG - - LOGEXIT("logf returns float %f\n", ret); - PERF_EXIT(logf); - return ret; -} - -/*++ -Function: - log10f - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_log10f(float x) -{ - float ret; - PERF_ENTRY(log10f); - ENTRY("log10f (x=%f)\n", x); - -#if !HAVE_COMPATIBLE_LOG10 - errno = 0; -#endif // !HAVE_COMPATIBLE_LOG10 - - ret = log10f(x); - -#if !HAVE_COMPATIBLE_LOG10 - if ((errno == EDOM) && (x < 0)) - { - ret = PAL_NAN_FLT; // NaN - } -#endif // !HAVE_COMPATIBLE_LOG10 - - LOGEXIT("log10f returns float %f\n", ret); - PERF_EXIT(log10f); - return ret; -} - -/*++ -Function: - powf - -See MSDN. ---*/ -PALIMPORT float __cdecl PAL_powf(float x, float y) -{ - float ret; - PERF_ENTRY(powf); - ENTRY("powf (x=%f, y=%f)\n", x, y); - -#if !HAVE_COMPATIBLE_POW - if ((y == PAL_POSINF_FLT) && !isnan(x)) // +Inf - { - if (x == 1.0f) - { - ret = x; - } - else if (x == -1.0f) - { - ret = 1.0f; - } - else if ((x > -1.0f) && (x < 1.0f)) - { - ret = 0.0f; - } - else - { - ret = PAL_POSINF_FLT; // +Inf - } - } - else if ((y == PAL_NEGINF_FLT) && !isnan(x)) // -Inf - { - if (x == 1.0f) - { - ret = x; - } - else if (x == -1.0f) - { - ret = 1.0f; - } - else if ((x > -1.0f) && (x < 1.0f)) - { - ret = PAL_POSINF_FLT; // +Inf - } - else - { - ret = 0.0f; - } - } - else if (IS_FLT_NEGZERO(x) && (y == -1.0f)) - { - ret = PAL_NEGINF_FLT; // -Inf - } - else if ((x == 0.0f) && (y < 0.0f)) - { - ret = PAL_POSINF_FLT; // +Inf - } - else -#endif // !HAVE_COMPATIBLE_POW - - ret = powf(x, y); - -#if !HAVE_VALID_NEGATIVE_INF_POW - if ((ret == PAL_POSINF_FLT) && (x < 0) && isfinite(x) && (ceilf(y / 2) != floorf(y / 2))) - { - ret = PAL_NEGINF_FLT; // -Inf - } -#endif // !HAVE_VALID_NEGATIVE_INF_POW - -#if !HAVE_VALID_POSITIVE_INF_POW - /* - * The (ceil(y/2) == floor(y/2)) test is slower, but more robust for platforms where large y - * will return the wrong result for ((long) y % 2 == 0). See PAL_pow(double) above for more details. - */ - if ((ret == PAL_NEGINF_FLT) && (x < 0) && isfinite(x) && (ceilf(y / 2) == floorf(y / 2))) - { - ret = PAL_POSINF_FLT; // +Inf - } -#endif // !HAVE_VALID_POSITIVE_INF_POW - - LOGEXIT("powf returns float %f\n", ret); - PERF_EXIT(powf); - return ret; -} - -/*++ -Function: - sincosf - -See MSDN. ---*/ -PALIMPORT void __cdecl PAL_sincosf(float x, float* sin, float* cos) -{ - PERF_ENTRY(sincosf); - ENTRY("sincosf (x=%f)\n", x); - -#if defined(__APPLE__) - __sincosf(x, sin, cos); -#else - sincosf(x, sin, cos); -#endif // !__APPLE__ - - LOGEXIT("sincosf returns (float %f, float %f)\n", *sin, *cos); - PERF_EXIT(sincosf); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/misc.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/misc.cpp deleted file mode 100644 index 0820be8c2..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/misc.cpp +++ /dev/null @@ -1,262 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - cruntime/misc.cpp - -Abstract: - - Implementation of C runtime functions that don't fit anywhere else. - - - ---*/ - -#include "pal/thread.hpp" -#include "pal/threadsusp.hpp" -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/misc.h" - -#include -/* needs to be included after "palinternal.h" to avoid name - collision for va_start and va_end */ -#include -#include -#include - -#if defined(HOST_AMD64) || defined(_x86_) -#include -#endif // defined(HOST_AMD64) || defined(_x86_) -#if defined(_DEBUG) -#include -#endif //defined(_DEBUG) - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -using namespace CorUnix; - -/*++ -Function: - _gcvt_s - -See MSDN doc. ---*/ -char * -__cdecl -_gcvt_s( char * buffer, int iSize, double value, int digits ) -{ - PERF_ENTRY(_gcvt); - ENTRY( "_gcvt( value:%f digits=%d, buffer=%p )\n", value, digits, buffer ); - - if ( !buffer ) - { - ERROR( "buffer was an invalid pointer.\n" ); - } - - switch ( digits ) - { - case 7 : - /* Fall through */ - case 8 : - /* Fall through */ - case 15 : - /* Fall through */ - case 17 : - - sprintf_s( buffer, iSize, "%.*g", digits, value ); - break; - - default : - ASSERT( "Only the digits 7, 8, 15, and 17 are valid.\n" ); - *buffer = '\0'; - } - - LOGEXIT( "_gcvt returns %p (%s)\n", buffer , buffer ); - PERF_EXIT(_gcvt); - return buffer; -} - - -/*++ -Function : - - __iscsym - -See MSDN for more details. ---*/ -int -__cdecl -__iscsym( int c ) -{ - PERF_ENTRY(__iscsym); - ENTRY( "__iscsym( c=%d )\n", c ); - - if ( isalnum( c ) || c == '_' ) - { - LOGEXIT( "__iscsym returning 1\n" ); - PERF_EXIT(__iscsym); - return 1; - } - - LOGEXIT( "__iscsym returning 0\n" ); - PERF_EXIT(__iscsym); - return 0; -} - - -/*++ - -Function : - - PAL_errno - - Returns the address of the errno. - ---*/ -int * __cdecl PAL_errno( int caller ) -{ - int *retval; - PERF_ENTRY(errno); - ENTRY( "PAL_errno( void )\n" ); - retval = (INT*)(&errno); - LOGEXIT("PAL_errno returns %p\n",retval); - PERF_EXIT(errno); - return retval; -} - - -/*++ -Function: - - rand - - The RAND_MAX value can vary by platform. - -See MSDN for more details. ---*/ -int -__cdecl -PAL_rand(void) -{ - int ret; - PERF_ENTRY(rand); - ENTRY("rand(void)\n"); - - ret = (rand() % (PAL_RAND_MAX + 1)); - - LOGEXIT("rand() returning %d\n", ret); - PERF_EXIT(rand); - return ret; -} - - -/*++ -Function: - - time - -See MSDN for more details. ---*/ -PAL_time_t -__cdecl -PAL_time(PAL_time_t *tloc) -{ - time_t result; - - PERF_ENTRY(time); - ENTRY( "time( tloc=%p )\n",tloc ); - - time_t t; - result = time(&t); - if (tloc != NULL) - { - *tloc = t; - } - - LOGEXIT( "time returning %#lx\n",result ); - PERF_EXIT(time); - return result; -} - -PALIMPORT -void __cdecl -PAL_qsort(void *base, size_t nmemb, size_t size, - int (__cdecl *compar )(const void *, const void *)) -{ - PERF_ENTRY(qsort); - ENTRY("qsort(base=%p, nmemb=%lu, size=%lu, compar=%p\n", - base,(unsigned long) nmemb,(unsigned long) size, compar); - -/* reset ENTRY nesting level back to zero, qsort will invoke app-defined - callbacks and we want their entry traces... */ -#if _ENABLE_DEBUG_MESSAGES_ -{ - int old_level; - old_level = DBG_change_entrylevel(0); -#endif /* _ENABLE_DEBUG_MESSAGES_ */ - - qsort(base,nmemb,size,compar); - -/* ...and set nesting level back to what it was */ -#if _ENABLE_DEBUG_MESSAGES_ - DBG_change_entrylevel(old_level); -} -#endif /* _ENABLE_DEBUG_MESSAGES_ */ - - LOGEXIT("qsort returns\n"); - PERF_EXIT(qsort); -} - -PALIMPORT -void * __cdecl -PAL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, - int (__cdecl *compar)(const void *, const void *)) -{ - void *retval; - - PERF_ENTRY(bsearch); - ENTRY("bsearch(key=%p, base=%p, nmemb=%lu, size=%lu, compar=%p\n", - key, base, (unsigned long) nmemb, (unsigned long) size, compar); - -/* reset ENTRY nesting level back to zero, bsearch will invoke app-defined - callbacks and we want their entry traces... */ -#if _ENABLE_DEBUG_MESSAGES_ -{ - int old_level; - old_level = DBG_change_entrylevel(0); -#endif /* _ENABLE_DEBUG_MESSAGES_ */ - - retval = bsearch(key,base,nmemb,size,compar); - -/* ...and set nesting level back to what it was */ -#if _ENABLE_DEBUG_MESSAGES_ - DBG_change_entrylevel(old_level); -} -#endif /* _ENABLE_DEBUG_MESSAGES_ */ - - LOGEXIT("bsearch returns %p\n",retval); - PERF_EXIT(bsearch); - return retval; -} - -#ifdef HOST_AMD64 - -PALIMPORT -unsigned int PAL__mm_getcsr(void) -{ - return _mm_getcsr(); -} - -PALIMPORT -void PAL__mm_setcsr(unsigned int i) -{ - _mm_setcsr(i); -} - -#endif // HOST_AMD64 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/printfcpp.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/printfcpp.cpp deleted file mode 100644 index b9c1c92b9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/printfcpp.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - printfcpp.cpp - -Abstract: - - Implementation of suspension safe printf functions. - -Revision History: - - - ---*/ - -#include "pal/corunix.hpp" -#include "pal/thread.hpp" -#include "pal/malloc.hpp" -#include "pal/file.hpp" -#include "pal/printfcpp.hpp" -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/cruntime.h" - -#include - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -extern "C" -{ - -// Forward declare functions that are in header files we can't include yet -int vfprintf(FILE* stream, const char* format, va_list ap); - -/*++ -Function: - PAL_fprintf - -See MSDN doc. ---*/ -int -__cdecl -PAL_fprintf(PAL_FILE *stream,const char *format,...) -{ - LONG Length = 0; - va_list ap; - - PERF_ENTRY(fprintf); - ENTRY("PAL_fprintf(stream=%p,format=%p (%s))\n",stream, format, format); - - va_start(ap, format); - Length = vfprintf(stream->bsdFilePtr, format, ap); - va_end(ap); - - LOGEXIT("PAL_fprintf returns int %d\n", Length); - PERF_EXIT(fprintf); - return Length; -} - -/******************************************************************************* -Function: - PAL_vfprintf - -Parameters: - stream - - out stream - Format - - format string - ap - - stdarg parameter list -*******************************************************************************/ - -int __cdecl PAL_vfprintf(PAL_FILE *stream, const char *format, va_list ap) -{ - return vfprintf(stream->bsdFilePtr, format, ap); -} - -} // end extern "C" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/string.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/string.cpp deleted file mode 100644 index b66c3b20f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/string.cpp +++ /dev/null @@ -1,295 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - string.cpp - -Abstract: - - Implementation of the string functions in the C runtime library that are Windows specific. - - - ---*/ - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/cruntime.h" - -#include -#include -#include -#include -#include -#include - - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -/*++ -Function: - _strnicmp - -compare at most count characters from two strings, ignoring case - -The strnicmp() function compares, with case insensitivity, at most count -characters from s1 to s2. All uppercase characters from s1 and s2 are -mapped to lowercase for the purposes of doing the comparison. - -Returns: - -Value Meaning - -< 0 s1 is less than s2 -0 s1 is equal to s2 -> 0 s1 is greater than s2 - ---*/ -int -__cdecl -_strnicmp( const char *s1, const char *s2, size_t count ) -{ - int ret; - - PERF_ENTRY(_strnicmp); - ENTRY("_strnicmp (s1=%p (%s), s2=%p (%s), count=%d)\n", s1?s1:"NULL", s1?s1:"NULL", s2?s2:"NULL", s2?s2:"NULL", count); - - ret = strncasecmp(s1, s2, count ); - - LOGEXIT("_strnicmp returning int %d\n", ret); - PERF_EXIT(_strnicmp); - return ret; -} - -/*++ -Function: - _stricmp - -compare two strings, ignoring case - -The stricmp() function compares, with case insensitivity, the string -pointed to by s1 to the string pointed to by s2. All uppercase -characters from s1 and s2 are mapped to lowercase for the purposes of -doing the comparison. - -Returns: - -Value Meaning - -< 0 s1 is less than s2 -0 s1 is equal to s2 -> 0 s1 is greater than s2 - ---*/ -int -__cdecl -_stricmp( - const char *s1, - const char *s2) -{ - int ret; - - PERF_ENTRY(_stricmp); - ENTRY("_stricmp (s1=%p (%s), s2=%p (%s))\n", s1?s1:"NULL", s1?s1:"NULL", s2?s2:"NULL", s2?s2:"NULL"); - - ret = strcasecmp(s1, s2); - - LOGEXIT("_stricmp returning int %d\n", ret); - PERF_EXIT(_stricmp); - return ret; -} - - -/*++ -Function: - PAL_strtoul - -Convert string to an unsigned long-integer value. - -Return Value - -strtoul returns the converted value, if any, or UINT32_MAX on -overflow. It returns 0 if no conversion can be performed. errno is -set to ERANGE if overflow or underflow occurs. - -Parameters - -szNumber Null-terminated string to convert to a ULONG -pszEnd Pointer to character that stops scan -nBase Number base to use - -Remarks - -strtoul stops reading the string szNumber at the first character it cannot -recognize as part of a number. This may be the terminating null -character, or it may be the first numeric character greater than or -equal to base. The LC_NUMERIC category setting of the current locale -determines recognition of the radix character in szNumber; for more -information, see setlocale. If pszEnd is not NULL, a pointer to the -character that stopped the scan is stored at the location pointed to -by pszEnd. If no conversion can be performed (no valid digits were -found or an invalid base was specified), the value of szNumber is stored -at the location pointed to by pszEnd. - -Notes : - MSDN states that only space and tab are accepted as leading whitespace, but - tests indicate that other whitespace characters (newline, carriage return, - etc) are also accepted. This matches the behavior on Unix systems. - - For strtoul, we need to check if the value to be returned - is outside the 32 bit range. If so, the returned value needs to be set - as appropriate, according to the MSDN pages and in all instances errno - must be set to ERANGE (The one exception is converting a string - representing a negative value to unsigned long). - Note that on 64 bit Windows, long's are still 32 bit. Thus, to match - Windows behavior, we must return long's in the 32 bit range. - --*/ - -/* The use of ULONG is by design, to ensure that a 32 bit value is always -returned from this function. If "unsigned long" is used instead of ULONG, -then a 64 bit value could be returned on 64 bit platforms like HP-UX, thus -breaking Windows behavior. */ -ULONG -__cdecl -PAL_strtoul(const char *szNumber, char **pszEnd, int nBase) -{ - unsigned long ulResult; - - PERF_ENTRY(strtoul); - ENTRY("strtoul (szNumber=%p (%s), pszEnd=%p, nBase=%d)\n", - szNumber?szNumber:"NULL", - szNumber?szNumber:"NULL", - pszEnd, - nBase); - - ulResult = strtoul(szNumber, pszEnd, nBase); - -#ifdef HOST_64BIT - if (ulResult > UINT32_MAX) - { - char ch = *szNumber; - while (isspace(ch)) - { - ch = *szNumber++; - } - /* If the string represents a positive number that is greater than - _UI32_MAX, set errno to ERANGE. Otherwise, don't set errno - to match Windows behavior. */ - if (ch != '-') - { - ulResult = UINT32_MAX; - errno = ERANGE; - } - } -#endif - - LOGEXIT("strtoul returning unsigned long %lu\n", ulResult); - PERF_EXIT(wcstoul); - - /* When returning unsigned long res from this function, it will be - implicitly cast to ULONG. This handles situations where a string that - represents a negative number is passed in to strtoul. The Windows - behavior is analogous to taking the binary equivalent of the negative - value and treating it as a positive number. Returning a ULONG from - this function, as opposed to native unsigned long, allows us to match - this behavior. The explicit cast to ULONG below is used to silence any - potential warnings due to the implicit casting. */ - return (ULONG)ulResult; - -} - -/*++ -Function: - PAL_strtoull - -Convert string to an unsigned long long-integer value. - -Return Value - -strtoull returns the converted value, if any, or UINT64_MAX on -overflow. It returns 0 if no conversion can be performed. errno is -set to ERANGE if overflow or underflow occurs. - -Parameters - -szNumber Null-terminated string to convert to a ULONGLONG -pszEnd Pointer to character that stops scan -nBase Number base to use - -Remarks - -strtoull stops reading the string szNumber at the first character it cannot -recognize as part of a number. This may be the terminating null -character, or it may be the first numeric character greater than or -equal to base. The LC_NUMERIC category setting of the current locale -determines recognition of the radix character in szNumber; for more -information, see setlocale. If pszEnd is not NULL, a pointer to the -character that stopped the scan is stored at the location pointed to -by pszEnd. If no conversion can be performed (no valid digits were -found or an invalid base was specified), the value of szNumber is stored -at the location pointed to by pszEnd. - -Notes : - MSDN states that only space and tab are accepted as leading whitespace, but - tests indicate that other whitespace characters (newline, carriage return, - etc) are also accepted. This matches the behavior on Unix systems. - - For strtoull, we need to check if the value to be returned - is outside the 64 bit range. If so, the returned value needs to be set - as appropriate, according to the MSDN pages and in all instances errno - must be set to ERANGE (The one exception is converting a string - representing a negative value to unsigned long). - --*/ - -/* The use of ULONGLONG is by design, to ensure that a 64 bit value is always -returned from this function. */ -ULONGLONG -__cdecl -PAL_strtoull(const char *szNumber, char **pszEnd, int nBase) -{ - unsigned long long ullResult; - - PERF_ENTRY(strtoull); - ENTRY("strtoull (szNumber=%p (%s), pszEnd=%p, nBase=%d)\n", - szNumber?szNumber:"NULL", - szNumber?szNumber:"NULL", - pszEnd, - nBase); - - ullResult = strtoull(szNumber, pszEnd, nBase); - - if (ullResult > UINT64_MAX) - { - char ch = *szNumber; - while (isspace(ch)) - { - ch = *szNumber++; - } - /* If the string represents a positive number that is greater than - UINT64_MAX, set errno to ERANGE. Otherwise, don't set errno - to match Windows behavior. */ - if (ch != '-') - { - ullResult = UINT64_MAX; - errno = ERANGE; - } - } - - LOGEXIT("strtoull returning unsigned long long %llu\n", ullResult); - PERF_EXIT(strtoull); - - /* When returning unsigned long long res from this function, it will be - implicitly cast to ULONGLONG. This handles situations where a string that - represents a negative number is passed in to strtoull. The Windows - behavior is analogous to taking the binary equivalent of the negative - value and treating it as a positive number. Returning a ULONGLONG from - this function, as opposed to native unsigned long long, allows us to match - this behavior. The explicit cast to ULONGLONG below is used to silence any - potential warnings due to the implicit casting. */ - return (ULONGLONG)ullResult; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/stringtls.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/stringtls.cpp deleted file mode 100644 index a080e1dd8..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/stringtls.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - stringtls.cpp - -Abstract: - - Implementation of the string functions in the C runtime library that - are Windows specific and depend on per-thread data - - - ---*/ - -#include "pal/thread.hpp" -#include "pal/dbgmsg.h" - -#include -#include -#include -#include -#include - -using namespace CorUnix; - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -/*++ -Function: - PAL_strtok - -Finds the next token in a string. - -Return value: - -A pointer to the next token found in strToken. Returns NULL when no more -tokens are found. Each call modifies strToken by substituting a NULL -character for each delimiter that is encountered. - -Parameters: -strToken String cotaining token(s) -strDelimit Set of delimiter characters - -Remarks: -In FreeBSD, strtok is not re-entrant, strtok_r is. It manages re-entrancy -by using a passed-in context pointer (which will be stored in thread local -storage) According to the strtok MSDN documentation, "Calling these functions -simultaneously from multiple threads does not have undesirable effects", so -we need to use strtok_r. ---*/ -char * -__cdecl -PAL_strtok(char *strToken, const char *strDelimit) -{ - CPalThread *pThread = NULL; - char *retval=NULL; - - PERF_ENTRY(strtok); - ENTRY("strtok (strToken=%p (%s), strDelimit=%p (%s))\n", - strToken?strToken:"NULL", - strToken?strToken:"NULL", strDelimit?strDelimit:"NULL", strDelimit?strDelimit:"NULL"); - - pThread = InternalGetCurrentThread(); - - retval = strtok_r(strToken, strDelimit, &pThread->crtInfo.strtokContext); - - LOGEXIT("strtok returns %p (%s)\n", retval?retval:"NULL", retval?retval:"NULL"); - PERF_EXIT(strtok); - - return retval; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/thread.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/thread.cpp deleted file mode 100644 index 883c5d1b0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/thread.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - thread.c - -Abstract: - - Implementation of the threads/process functions in the C runtime library - that are Windows specific. - - - ---*/ - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/init.h" - -SET_DEFAULT_DEBUG_CHANNEL(CRT); - -void -PAL_exit(int status) -{ - PERF_ENTRY(exit); - ENTRY ("exit(status=%d)\n", status); - - /* should also clean up any resources allocated by pal/cruntime, if any */ - ExitProcess(status); - - LOGEXIT ("exit returns void"); - PERF_EXIT(exit); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/wchar.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/wchar.cpp index fb24f6e35..06e2e9940 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/wchar.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/cruntime/wchar.cpp @@ -958,7 +958,7 @@ _wfopen( const wchar_16 *fileName, const wchar_16 *mode) { - CHAR mbFileName[ _MAX_PATH ]; + CHAR mbFileName[ MAX_PATH ]; CHAR mbMode[ 10 ]; FILE * filePtr = NULL; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/debug/debug.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/debug/debug.cpp index b38810864..64dd8b7e0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/debug/debug.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/debug/debug.cpp @@ -32,7 +32,6 @@ SET_DEFAULT_DEBUG_CHANNEL(DEBUG); // some headers have code with asserts, so do #include "pal/context.h" #include "pal/debug.h" #include "pal/environ.h" -#include "pal/malloc.hpp" #include "pal/module.h" #include "pal/stackstring.hpp" #include "pal/virtual.h" @@ -45,7 +44,7 @@ SET_DEFAULT_DEBUG_CHANNEL(DEBUG); // some headers have code with asserts, so do #include #elif defined(HAVE_TTRACE) // HAVE_PROCFS_CTL #include -#else // defined(HAVE_TTRACE) +#elif HAVE_SYS_PTRACE_H #include #endif // HAVE_PROCFS_CTL #if HAVE_VM_READ @@ -61,7 +60,9 @@ SET_DEFAULT_DEBUG_CHANNEL(DEBUG); // some headers have code with asserts, so do #ifdef __APPLE__ #include +#if defined(TARGET_OSX) #include +#endif #endif // __APPLE__ #if HAVE_MACH_EXCEPTIONS @@ -87,7 +88,7 @@ const BOOL DBG_DETACH = FALSE; #endif static const char PAL_OUTPUTDEBUGSTRING[] = "PAL_OUTPUTDEBUGSTRING"; -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) #define ENABLE_RUN_ON_DEBUG_BREAK 1 #endif // _DEBUG @@ -110,6 +111,9 @@ This is a no-op for x86 architectures where the instruction and data caches are coherent in hardware. For non-X86 architectures, this call usually maps to a kernel API to flush the D-caches on all processors. +It is also no-op on wasm. We don't have a way to flush the instruction +cache and it is also not needed. + --*/ BOOL PALAPI @@ -421,7 +425,12 @@ DebugBreak( BOOL IsInDebugBreak(void *addr) { +#ifdef TARGET_WASM + _ASSERT("IsInDebugBreak not implemented on wasm"); + return false; +#else return (addr >= (void *)DBG_DebugBreak) && (addr <= (void *)DBG_DebugBreak_End); +#endif } /*++ @@ -635,7 +644,7 @@ PAL_CloseProcessMemory( PAL_ReadProcessMemory Abstract - Reads process memory. + Reads process memory. Parameter handle : from PAL_OpenProcessMemory @@ -753,7 +762,7 @@ PAL_ProbeMemory( flags = fcntl(fds[0], F_GETFL, 0); fcntl(fds[0], F_SETFL, flags | O_NONBLOCK); - + flags = fcntl(fds[1], F_GETFL, 0); fcntl(fds[1], F_SETFL, flags | O_NONBLOCK); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/CMakeLists.txt index 143206b5c..ae7b58bb9 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/CMakeLists.txt @@ -1,6 +1,6 @@ set(EVENT_MANIFEST ${VM_DIR}/ClrEtwAll.man) -if(CLR_CMAKE_HOST_LINUX) +if(FEATURE_EVENTSOURCE_XPLAT) add_subdirectory(lttngprovider) else() add_subdirectory(dummyprovider) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/dummyprovider/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/dummyprovider/CMakeLists.txt index 09986597b..9f9c0f6b9 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/dummyprovider/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/eventprovider/dummyprovider/CMakeLists.txt @@ -31,9 +31,14 @@ add_custom_command(OUTPUT ${DUMMY_PROVIDER_SOURCES} COMMAND ${GENERATE_COMMAND} DEPENDS ${EVENT_MANIFEST} ${GENERATE_SCRIPT}) +add_library(eventprovider_objects + OBJECT + ${DUMMY_PROVIDER_SOURCES} +) + add_library(eventprovider STATIC - ${DUMMY_PROVIDER_SOURCES} + $ ) set_target_properties(eventprovider PROPERTIES LINKER_LANGUAGE CXX) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machexception.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machexception.cpp index fdb3d8dc8..f52519959 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machexception.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machexception.cpp @@ -21,16 +21,16 @@ SET_DEFAULT_DEBUG_CHANNEL(EXCEPT); // some headers have code with asserts, so do #include "pal/palinternal.h" #if HAVE_MACH_EXCEPTIONS #include "machexception.h" -#include "pal/critsect.h" #include "pal/debug.h" #include "pal/init.h" #include "pal/utils.h" #include "pal/context.h" -#include "pal/malloc.hpp" #include "pal/process.h" #include "pal/virtual.h" #include "pal/map.hpp" #include "pal/environ.h" + +#include #include #include "machmessage.h" @@ -180,7 +180,7 @@ GetExceptionMask() } else { - if (PAL_IsDebuggerPresent()) + if (minipal_is_native_debugger_present()) { exMode = MachException_SuppressDebugging; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machmessage.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machmessage.cpp index ec0c40857..96fbd08bd 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machmessage.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/machmessage.cpp @@ -16,7 +16,6 @@ Module Name: #include "config.h" #include "pal/dbgmsg.h" #include "pal/environ.h" -#include "pal/malloc.hpp" #include "pal/thread.hpp" #include "machmessage.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/remote-unwind.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/remote-unwind.cpp index 05cba618a..1208ed112 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/remote-unwind.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/remote-unwind.cpp @@ -43,7 +43,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "config.h" #include "pal/palinternal.h" #include "pal/dbgmsg.h" -#include "pal/critsect.h" #include "pal/debug.h" #include "pal_endian.h" #include "pal.h" @@ -114,7 +113,7 @@ typedef BOOL(*UnwindReadMemoryCallback)(PVOID address, PVOID buffer, SIZE_T size #define PRId PRId32 #define PRIA "08" #define PRIxA PRIA PRIx -#elif defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_S390X) || defined(TARGET_LOONGARCH64) || defined(TARGET_POWERPC64) || defined(TARGET_RISCV64) +#elif defined(TARGET_64BIT) #define PRIx PRIx64 #define PRIu PRIu64 #define PRId PRId64 @@ -1684,7 +1683,7 @@ StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_ if (!ReadCompactEncodingRegisterPair(info, &addr, &context->Lr, &context->Fp)) { return false; } - // Strip pointer authentication bits + // Strip pointer authentication bits context->Lr &= MACOS_ARM64_POINTER_AUTH_MASK; } else @@ -1789,123 +1788,6 @@ StepWithCompactEncoding(const libunwindInfo* info, compact_unwind_encoding_t com #endif // defined(__APPLE__) || defined(FEATURE_USE_SYSTEM_LIBUNWIND) -static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, int reg, SIZE_T **contextPointer) -{ -#if defined(HAVE_UNW_GET_SAVE_LOC) - unw_save_loc_t saveLoc; - unw_get_save_loc(cursor, reg, &saveLoc); - if (saveLoc.type == UNW_SLT_MEMORY) - { - SIZE_T *pLoc = (SIZE_T *)saveLoc.u.addr; - // Filter out fake save locations that point to unwContext - if (unwContext == NULL || (pLoc < (SIZE_T *)unwContext) || ((SIZE_T *)(unwContext + 1) <= pLoc)) - *contextPointer = (SIZE_T *)saveLoc.u.addr; - } -#else - // Returning NULL indicates that we don't have context pointers available - *contextPointer = NULL; -#endif -} - -static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers) -{ -#if defined(TARGET_AMD64) - GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp); - GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx); - GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12); - GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13); - GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14); - GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15); -#elif defined(TARGET_X86) - GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx); - GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp); - GetContextPointer(cursor, unwContext, UNW_X86_ESI, &contextPointers->Esi); - GetContextPointer(cursor, unwContext, UNW_X86_EDI, &contextPointers->Edi); -#elif defined(TARGET_ARM) - GetContextPointer(cursor, unwContext, UNW_ARM_R4, &contextPointers->R4); - GetContextPointer(cursor, unwContext, UNW_ARM_R5, &contextPointers->R5); - GetContextPointer(cursor, unwContext, UNW_ARM_R6, &contextPointers->R6); - GetContextPointer(cursor, unwContext, UNW_ARM_R7, &contextPointers->R7); - GetContextPointer(cursor, unwContext, UNW_ARM_R8, &contextPointers->R8); - GetContextPointer(cursor, unwContext, UNW_ARM_R9, &contextPointers->R9); - GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10); - GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11); -#elif defined(TARGET_ARM64) - GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28); - GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp); -#elif defined(TARGET_LOONGARCH64) - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8); -#elif defined(TARGET_S390X) - GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6); - GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7); - GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8); - GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9); - GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10); - GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11); - GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12); - GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13); - GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14); - GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15); -#elif defined(TARGET_POWERPC64) - GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14); - GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15); - GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16); - GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17); - GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18); - GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19); - GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20); - GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21); - GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22); - GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23); - GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24); - GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25); - GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26); - GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27); - GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28); - GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29); - GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30); - GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31); -#elif defined(TARGET_RISCV64) - GetContextPointer(cursor, unwContext, UNW_RISCV_X1, (SIZE_T **)&contextPointers->Ra); - GetContextPointer(cursor, unwContext, UNW_RISCV_X3, (SIZE_T **)&contextPointers->Gp); - GetContextPointer(cursor, unwContext, UNW_RISCV_X4, (SIZE_T **)&contextPointers->Tp); - GetContextPointer(cursor, unwContext, UNW_RISCV_X8, (SIZE_T **)&contextPointers->Fp); - GetContextPointer(cursor, unwContext, UNW_RISCV_X9, (SIZE_T **)&contextPointers->S1); - GetContextPointer(cursor, unwContext, UNW_RISCV_X18, (SIZE_T **)&contextPointers->S2); - GetContextPointer(cursor, unwContext, UNW_RISCV_X19, (SIZE_T **)&contextPointers->S3); - GetContextPointer(cursor, unwContext, UNW_RISCV_X20, (SIZE_T **)&contextPointers->S4); - GetContextPointer(cursor, unwContext, UNW_RISCV_X21, (SIZE_T **)&contextPointers->S5); - GetContextPointer(cursor, unwContext, UNW_RISCV_X22, (SIZE_T **)&contextPointers->S6); - GetContextPointer(cursor, unwContext, UNW_RISCV_X23, (SIZE_T **)&contextPointers->S7); - GetContextPointer(cursor, unwContext, UNW_RISCV_X24, (SIZE_T **)&contextPointers->S8); - GetContextPointer(cursor, unwContext, UNW_RISCV_X25, (SIZE_T **)&contextPointers->S9); - GetContextPointer(cursor, unwContext, UNW_RISCV_X26, (SIZE_T **)&contextPointers->S10); - GetContextPointer(cursor, unwContext, UNW_RISCV_X27, (SIZE_T **)&contextPointers->S11); -#else -#error unsupported architecture -#endif -} - static void UnwindContextToContext(unw_cursor_t *cursor, CONTEXT *winContext) { #if defined(TARGET_AMD64) @@ -1963,7 +1845,6 @@ static void UnwindContextToContext(unw_cursor_t *cursor, CONTEXT *winContext) unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->Pc); unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->Sp); unw_get_reg(cursor, UNW_LOONGARCH64_R1, (unw_word_t *) &winContext->Ra); - unw_get_reg(cursor, UNW_LOONGARCH64_R2, (unw_word_t *) &winContext->Tp); unw_get_reg(cursor, UNW_LOONGARCH64_R22, (unw_word_t *) &winContext->Fp); unw_get_reg(cursor, UNW_LOONGARCH64_R23, (unw_word_t *) &winContext->S0); unw_get_reg(cursor, UNW_LOONGARCH64_R24, (unw_word_t *) &winContext->S1); @@ -1974,7 +1855,7 @@ static void UnwindContextToContext(unw_cursor_t *cursor, CONTEXT *winContext) unw_get_reg(cursor, UNW_LOONGARCH64_R29, (unw_word_t *) &winContext->S6); unw_get_reg(cursor, UNW_LOONGARCH64_R30, (unw_word_t *) &winContext->S7); unw_get_reg(cursor, UNW_LOONGARCH64_R31, (unw_word_t *) &winContext->S8); - TRACE("sp %p pc %p fp %p tp %p ra %p\n", winContext->Sp, winContext->Pc, winContext->Fp, winContext->Tp, winContext->Ra); + TRACE("sp %p pc %p fp %p ra %p\n", winContext->Sp, winContext->Pc, winContext->Fp, winContext->Ra); #elif defined(TARGET_S390X) unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->PSWAddr); unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->R15); @@ -2118,7 +1999,6 @@ access_reg(unw_addr_space_t as, unw_regnum_t regnum, unw_word_t *valp, int write case UNW_AARCH64_PC: *valp = (unw_word_t)winContext->Pc; break; #elif defined(TARGET_LOONGARCH64) case UNW_LOONGARCH64_R1: *valp = (unw_word_t)winContext->Ra; break; - case UNW_LOONGARCH64_R2: *valp = (unw_word_t)winContext->Tp; break; case UNW_LOONGARCH64_R3: *valp = (unw_word_t)winContext->Sp; break; case UNW_LOONGARCH64_R22: *valp = (unw_word_t)winContext->Fp; break; case UNW_LOONGARCH64_R23: *valp = (unw_word_t)winContext->S0; break; @@ -2328,7 +2208,13 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pip, int nee } } -#ifdef FEATURE_USE_SYSTEM_LIBUNWIND +#if HAVE_GET_PROC_INFO_IN_RANGE || !defined(HOST_UNIX) + return unw_get_proc_info_in_range(start_ip, end_ip, ehFrameHdrAddr, ehFrameHdrLen, exidxFrameHdrAddr, exidxFrameHdrLen, as, ip, pip, need_unwind_info, arg); +#else // HAVE_GET_PROC_INFO_IN_RANGE || !defined(HOST_UNIX) + + // This branch is executed when using llvm-libunwind (macOS and similar platforms) + // or HP-libunwind version 1.6 and earlier. + if (ehFrameHdrAddr == 0) { ASSERT("ELF: No PT_GNU_EH_FRAME program header\n"); return -UNW_EINVAL; @@ -2400,9 +2286,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pip, int nee } info->FunctionStart = pip->start_ip; return UNW_ESUCCESS; -#else - return unw_get_proc_info_in_range(start_ip, end_ip, ehFrameHdrAddr, ehFrameHdrLen, exidxFrameHdrAddr, exidxFrameHdrLen, as, ip, pip, need_unwind_info, arg); -#endif // FEATURE_USE_SYSTEM_LIBUNWIND +#endif // HAVE_GET_PROC_INFO_IN_RANGE || !defined(HOST_UNIX) #endif // __APPLE__ } @@ -2447,14 +2331,13 @@ static unw_accessors_t unwind_accessors = init_unwind_accessors(); Parameters: context - the start context in the target - contextPointers - the context of the next frame functionStart - the pointer to return the starting address of the function or nullptr baseAddress - base address of the module to find the unwind info readMemoryCallback - reads memory from the target --*/ BOOL PALAPI -PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback) +PAL_VirtualUnwindOutOfProc(CONTEXT *context, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback) { unw_addr_space_t addrSpace = 0; unw_cursor_t cursor; @@ -2535,10 +2418,6 @@ PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *cont UnwindContextToContext(&cursor, context); - if (contextPointers != NULL) - { - GetContextPointers(&cursor, NULL, contextPointers); - } result = TRUE; exit: @@ -2699,7 +2578,7 @@ PAL_GetUnwindInfoSize(SIZE_T baseAddress, ULONG64 ehFrameHdrAddr, UnwindReadMemo BOOL PALAPI -PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback) +PAL_VirtualUnwindOutOfProc(CONTEXT *context, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback) { return FALSE; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh-unwind.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh-unwind.cpp index 71e94f929..8b6631a52 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh-unwind.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh-unwind.cpp @@ -44,7 +44,7 @@ Module Name: #endif // HOST_UNIX -#if defined(TARGET_OSX) && defined(HOST_ARM64) && !defined(HAVE_UNW_AARCH64_X19) +#if defined(__APPLE__) && defined(HOST_ARM64) && !defined(HAVE_UNW_AARCH64_X19) // MacOS uses ARM64 instead of AARCH64 to describe these registers // Create aliases to reuse more code enum @@ -86,7 +86,7 @@ enum UNW_AARCH64_V30 = UNW_ARM64_D30, UNW_AARCH64_V31 = UNW_ARM64_D31 }; -#endif // defined(TARGET_OSX) && defined(HOST_ARM64) +#endif // defined(__APPLE__) && defined(HOST_ARM64) //---------------------------------------------------------------------- @@ -129,7 +129,6 @@ enum #elif (defined(HOST_UNIX) && defined(HOST_LOONGARCH64)) #define ASSIGN_UNWIND_REGS \ ASSIGN_REG(Pc) \ - ASSIGN_REG(Tp) \ ASSIGN_REG(Sp) \ ASSIGN_REG(Fp) \ ASSIGN_REG(Ra) \ @@ -260,7 +259,7 @@ static void WinContextToUnwindContext(CONTEXT *winContext, unw_context_t *unwCon { unwContext->fpregs[i] = winContext->D[i]; } -#elif defined(HOST_ARM64) && !defined(TARGET_OSX) +#elif defined(HOST_ARM64) && !defined(__APPLE__) unwContext->uc_mcontext.pc = winContext->Pc; unwContext->uc_mcontext.sp = winContext->Sp; unwContext->uc_mcontext.regs[29] = winContext->Fp; @@ -302,7 +301,7 @@ static void WinContextToUnwindCursor(CONTEXT *winContext, unw_cursor_t *cursor) unw_set_reg(cursor, UNW_X86_EBX, winContext->Ebx); unw_set_reg(cursor, UNW_X86_ESI, winContext->Esi); unw_set_reg(cursor, UNW_X86_EDI, winContext->Edi); -#elif defined(HOST_ARM64) && defined(TARGET_OSX) +#elif defined(HOST_ARM64) && defined(__APPLE__) // unw_cursor_t is an opaque data structure on macOS // As noted in WinContextToUnwindContext this didn't work for Linux // TBD whether this will work for macOS. @@ -426,12 +425,12 @@ void UnwindContextToWinContext(unw_cursor_t *cursor, CONTEXT *winContext) unw_get_fpreg(cursor, UNW_AARCH64_V30, (unw_fpreg_t*)&winContext->V[30].Low); unw_get_fpreg(cursor, UNW_AARCH64_V31, (unw_fpreg_t*)&winContext->V[31].Low); -#if defined(TARGET_OSX) && defined(TARGET_ARM64) +#if defined(__APPLE__) && defined(TARGET_ARM64) // Strip pointer authentication bits which seem to be leaking out of libunwind // Seems like ptrauth_strip() / __builtin_ptrauth_strip() should work, but currently // errors with "this target does not support pointer authentication" winContext->Pc = winContext->Pc & 0x7fffffffffffull; -#endif // defined(TARGET_OSX) && defined(TARGET_ARM64) +#endif // defined(__APPLE__) && defined(TARGET_ARM64) #elif (defined(HOST_UNIX) && defined(HOST_S390X)) unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->R15); unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->PSWAddr); @@ -448,7 +447,6 @@ void UnwindContextToWinContext(unw_cursor_t *cursor, CONTEXT *winContext) unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->Pc); unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->Sp); unw_get_reg(cursor, UNW_LOONGARCH64_R1, (unw_word_t *) &winContext->Ra); - unw_get_reg(cursor, UNW_LOONGARCH64_R2, (unw_word_t *) &winContext->Tp); unw_get_reg(cursor, UNW_LOONGARCH64_R22, (unw_word_t *) &winContext->Fp); unw_get_reg(cursor, UNW_LOONGARCH64_R23, (unw_word_t *) &winContext->S0); unw_get_reg(cursor, UNW_LOONGARCH64_R24, (unw_word_t *) &winContext->S1); @@ -499,6 +497,8 @@ void UnwindContextToWinContext(unw_cursor_t *cursor, CONTEXT *winContext) unw_get_reg(cursor, UNW_PPC64_R28, (unw_word_t *) &winContext->R28); unw_get_reg(cursor, UNW_PPC64_R29, (unw_word_t *) &winContext->R29); unw_get_reg(cursor, UNW_PPC64_R30, (unw_word_t *) &winContext->R30); +#elif defined(HOST_WASM) + ASSERT("UnwindContextToWinContext not implemented for WASM"); #else #error unsupported architecture #endif @@ -586,7 +586,6 @@ void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOL GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15); #elif (defined(HOST_UNIX) && defined(HOST_LOONGARCH64)) GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra); - GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp); GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp); GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0); GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1); @@ -634,6 +633,8 @@ void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOL GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29); GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30); GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31); +#elif defined(HOST_WASM) + ASSERT("GetContextPointers not implemented for WASM"); #else #error unsupported architecture #endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh.cpp index f359b9d2e..26c963ff3 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/seh.cpp @@ -21,11 +21,9 @@ Module Name: #include "pal/handleapi.hpp" #include "pal/seh.hpp" #include "pal/dbgmsg.h" -#include "pal/critsect.h" #include "pal/debug.h" #include "pal/init.h" #include "pal/process.h" -#include "pal/malloc.hpp" #include "pal/signal.hpp" #include "pal/virtual.h" @@ -176,7 +174,7 @@ PAL_ThrowExceptionFromContext(CONTEXT* context, PAL_SEHException* ex) // We need to make a copy of the exception off stack, since the "ex" is located in one of the stack // frames that will become obsolete by the ThrowExceptionFromContextInternal and the ThrowExceptionHelper // could overwrite the "ex" object by stack e.g. when allocating the low level exception object for "throw". - static __thread BYTE threadLocalExceptionStorage[sizeof(PAL_SEHException)]; + static thread_local BYTE threadLocalExceptionStorage[sizeof(PAL_SEHException)]; ThrowExceptionFromContextInternal(context, new (threadLocalExceptionStorage) PAL_SEHException(std::move(*ex))); } @@ -250,7 +248,7 @@ Return value: BOOL SEHProcessException(PAL_SEHException* exception) { - g_SEHProcessExceptionReturnAddress = __builtin_return_address(0); + g_SEHProcessExceptionReturnAddress = _ReturnAddress(); CONTEXT* contextRecord = exception->GetContextRecord(); EXCEPTION_RECORD* exceptionRecord = exception->GetExceptionRecord(); @@ -305,9 +303,9 @@ PAL_ERROR SEHEnable(CPalThread *pthrCurrent) { #if HAVE_MACH_EXCEPTIONS return pthrCurrent->EnableMachExceptions(); -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__APPLE__) || defined(__wasm__) return NO_ERROR; -#else// HAVE_MACH_EXCEPTIONS +#else // HAVE_MACH_EXCEPTIONS #error not yet implemented #endif // HAVE_MACH_EXCEPTIONS } @@ -330,7 +328,7 @@ PAL_ERROR SEHDisable(CPalThread *pthrCurrent) { #if HAVE_MACH_EXCEPTIONS return pthrCurrent->DisableMachExceptions(); -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__APPLE__) || defined(__wasm__) return NO_ERROR; #else // HAVE_MACH_EXCEPTIONS #error not yet implemented @@ -373,12 +371,7 @@ bool CatchHardwareExceptionHolder::IsEnabled() --*/ -#if defined(__GNUC__) -static __thread -#else // __GNUC__ -__declspec(thread) static -#endif // !__GNUC__ -NativeExceptionHolderBase *t_nativeExceptionHolderHead = nullptr; +static thread_local NativeExceptionHolderBase *t_nativeExceptionHolderHead = nullptr; extern "C" NativeExceptionHolderBase ** diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/signal.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/signal.cpp index 3b38ca281..732d1d5db 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/signal.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/exception/signal.cpp @@ -44,11 +44,13 @@ SET_DEFAULT_DEBUG_CHANNEL(EXCEPT); // some headers have code with asserts, so do #include "pal/utils.h" #include -#include #include #include #include +#if HAVE_SYS_UCONTEXT_H +#include +#endif // HAVE_SYS_UCONTEXT_H #endif // !HAVE_MACH_EXCEPTIONS #include "pal/context.h" @@ -186,12 +188,17 @@ BOOL SEHInitializeSignals(CorUnix::CPalThread *pthrCurrent, DWORD flags) handle_signal(SIGINT, sigint_handler, &g_previous_sigint, 0 /* additionalFlags */, true /* skipIgnored */); handle_signal(SIGQUIT, sigquit_handler, &g_previous_sigquit, 0 /* additionalFlags */, true /* skipIgnored */); -#if HAVE_MACH_EXCEPTIONS +#if HAVE_MACH_EXCEPTIONS || !HAVE_SIGALTSTACK handle_signal(SIGSEGV, sigsegv_handler, &g_previous_sigsegv); #else handle_signal(SIGTRAP, sigtrap_handler, &g_previous_sigtrap); + int additionalFlagsForSigSegv = 0; +#ifndef TARGET_SUNOS + // On platforms that support signal handlers that don't return, // SIGSEGV handler runs on a separate stack so that we can handle stack overflow - handle_signal(SIGSEGV, sigsegv_handler, &g_previous_sigsegv, SA_ONSTACK); + additionalFlagsForSigSegv |= SA_ONSTACK; +#endif + handle_signal(SIGSEGV, sigsegv_handler, &g_previous_sigsegv, additionalFlagsForSigSegv); if (!pthrCurrent->EnsureSignalAlternateStack()) { @@ -199,7 +206,7 @@ BOOL SEHInitializeSignals(CorUnix::CPalThread *pthrCurrent, DWORD flags) } // Allocate the minimal stack necessary for handling stack overflow - int stackOverflowStackSize = ALIGN_UP(sizeof(SignalHandlerWorkerReturnPoint), 16) + 7 * 4096; + int stackOverflowStackSize = ALIGN_UP(sizeof(SignalHandlerWorkerReturnPoint), 16) + 9 * 4096; // Align the size to virtual page size and add one virtual page as a stack guard stackOverflowStackSize = ALIGN_UP(stackOverflowStackSize, GetVirtualPageSize()) + GetVirtualPageSize(); int flags = MAP_ANONYMOUS | MAP_PRIVATE; @@ -212,6 +219,7 @@ BOOL SEHInitializeSignals(CorUnix::CPalThread *pthrCurrent, DWORD flags) return FALSE; } +#ifndef TARGET_WASM // create a guard page for the alternate stack int st = mprotect((void*)g_stackOverflowHandlerStack, GetVirtualPageSize(), PROT_NONE); if (st != 0) @@ -219,6 +227,7 @@ BOOL SEHInitializeSignals(CorUnix::CPalThread *pthrCurrent, DWORD flags) munmap((void*)g_stackOverflowHandlerStack, stackOverflowStackSize); return FALSE; } +#endif // TARGET_WASM g_stackOverflowHandlerStack = (void*)((size_t)g_stackOverflowHandlerStack + stackOverflowStackSize); #endif // HAVE_MACH_EXCEPTIONS @@ -344,7 +353,7 @@ Return : --*/ bool IsRunningOnAlternateStack(void *context) { -#if HAVE_MACH_EXCEPTIONS +#if HAVE_MACH_EXCEPTIONS || defined(TARGET_SUNOS) return false; #else bool isRunningOnAlternateStack; @@ -551,8 +560,13 @@ extern "C" void signal_handler_worker(int code, siginfo_t *siginfo, void *contex // fault. We must disassemble the instruction at record.ExceptionAddress // to correctly fill in this value. - // Unmask the activation signal now that we are running on the original stack of the thread - UnmaskActivationSignal(); + if (code != (SIGSEGV | StackOverflowFlag)) + { + // Unmask the activation signal now that we are running on the original stack of the thread + // except for the stack overflow case when we are actually running on a special stack overflow + // stack. + UnmaskActivationSignal(); + } returnPoint->returnFromHandler = common_signal_handler(code, siginfo, context, 2, (size_t)0, (size_t)siginfo->si_addr); @@ -562,6 +576,7 @@ extern "C" void signal_handler_worker(int code, siginfo_t *siginfo, void *contex RtlRestoreContext(&returnPoint->context, NULL); } +#if HAVE_SIGALTSTACK /*++ Function : SwitchStackAndExecuteHandler @@ -574,7 +589,13 @@ Parameters : If sp == 0, execute it on the original stack where the signal has occurred. Return : The return value from the signal handler + +Note: + This function is marked as noinline to reduce the stack frame space of the caller, the + sigsegv_handler. The sigsegv_handler is running on an alternate stack and we want to + avoid running out of stack space in case there are multiple PALs in the process. --*/ +__attribute__((noinline)) static bool SwitchStackAndExecuteHandler(int code, siginfo_t *siginfo, void *context, size_t sp) { // Establish a return point in case the common_signal_handler returns @@ -596,9 +617,16 @@ static bool SwitchStackAndExecuteHandler(int code, siginfo_t *siginfo, void *con return pReturnPoint->returnFromHandler; } +#endif #endif // !HAVE_MACH_EXCEPTIONS +// Temporary locals to debug issue https://github.com/dotnet/runtime/issues/110173 +static SIZE_T stackOverflowThreadId = -1; +static const char StackOverflowOnTheSameThreadMessage[] = "Stack overflow occurred on the same thread again!\n"; +static const char StackOverflowHandlerReturnedMessage[] = "Stack overflow handler has returned, invoking previous action!\n"; +// + /*++ Function : sigsegv_handler @@ -625,50 +653,73 @@ static void sigsegv_handler(int code, siginfo_t *siginfo, void *context) { if (GetCurrentPalThread()) { +#if defined(TARGET_TVOS) + (void)!write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1); + PROCAbort(SIGSEGV, siginfo); +#else // TARGET_TVOS size_t handlerStackTop = __sync_val_compare_and_swap((size_t*)&g_stackOverflowHandlerStack, (size_t)g_stackOverflowHandlerStack, 0); if (handlerStackTop == 0) { // We have only one stack for handling stack overflow preallocated. We let only the first thread that hits stack overflow to // run the exception handling code on that stack (which ends up just dumping the stack trace and aborting the process). // Other threads are held spinning and sleeping here until the process exits. + + // Temporary check to debug issue https://github.com/dotnet/runtime/issues/110173 + if (stackOverflowThreadId == THREADSilentGetCurrentThreadId()) + { + (void)!write(STDERR_FILENO, StackOverflowOnTheSameThreadMessage, sizeof(StackOverflowOnTheSameThreadMessage) - 1); + } + while (true) { sleep(1); } } + else + { + stackOverflowThreadId = THREADSilentGetCurrentThreadId(); + } if (SwitchStackAndExecuteHandler(code | StackOverflowFlag, siginfo, context, (size_t)handlerStackTop)) { PROCAbort(SIGSEGV, siginfo); } + (void)!write(STDERR_FILENO, StackOverflowHandlerReturnedMessage, sizeof(StackOverflowHandlerReturnedMessage) - 1); +#endif // TARGET_TVOS } else { (void)!write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1); - PROCAbort(SIGSEGV, siginfo); } - } - - // Now that we know the SIGSEGV didn't happen due to a stack overflow, execute the common - // hardware signal handler on the original stack. - if (GetCurrentPalThread() && IsRunningOnAlternateStack(context)) - { - if (SwitchStackAndExecuteHandler(code, siginfo, context, 0 /* sp */)) // sp == 0 indicates execution on the original stack - { - return; - } + // The current executable (shared library) doesn't have hardware exception handler installed or opted to not to + // handle it. So this handler will invoke the previously installed handler at the end of this function. } else { - // The code flow gets here when the signal handler is not running on an alternate stack or when it wasn't created - // by coreclr. In both cases, we execute the common_signal_handler directly. - // If thread isn't created by coreclr and has alternate signal stack GetCurrentPalThread() will return NULL too. - // But since in this case we don't handle hardware exceptions (IsSafeToHandleHardwareException returns false) - // we can call common_signal_handler on the alternate stack. - if (common_signal_handler(code, siginfo, context, 2, (size_t)0, (size_t)siginfo->si_addr)) + // Now that we know the SIGSEGV didn't happen due to a stack overflow, execute the common + // hardware signal handler on the original stack. + +#if HAVE_SIGALTSTACK + if (GetCurrentPalThread() && IsRunningOnAlternateStack(context)) { - return; + if (SwitchStackAndExecuteHandler(code, siginfo, context, 0 /* sp */)) // sp == 0 indicates execution on the original stack + { + return; + } + } + else +#endif + { + // The code flow gets here when the signal handler is not running on an alternate stack or when it wasn't created + // by coreclr. In both cases, we execute the common_signal_handler directly. + // If thread isn't created by coreclr and has alternate signal stack GetCurrentPalThread() will return NULL too. + // But since in this case we don't handle hardware exceptions (IsSafeToHandleHardwareException returns false) + // we can call common_signal_handler on the alternate stack. + if (common_signal_handler(code, siginfo, context, 2, (size_t)0, (size_t)siginfo->si_addr)) + { + return; + } } } } @@ -802,15 +853,9 @@ static void sigterm_handler(int code, siginfo_t *siginfo, void *context) { PROCCreateCrashDumpIfEnabled(code, siginfo, false); } - // g_pSynchronizationManager shouldn't be null if PAL is initialized. - _ASSERTE(g_pSynchronizationManager != nullptr); - - g_pSynchronizationManager->SendTerminationRequestToWorkerThread(); - } - else - { - restore_signal_and_resend(SIGTERM, &g_previous_sigterm); } + + restore_signal_and_resend(SIGTERM, &g_previous_sigterm); } #ifdef INJECT_ACTIVATION_SIGNAL @@ -833,7 +878,7 @@ Parameters : __attribute__((noinline)) static void InvokeActivationHandler(CONTEXT *pWinContext) { - g_InvokeActivationHandlerReturnAddress = __builtin_return_address(0); + g_InvokeActivationHandlerReturnAddress = _ReturnAddress(); g_activationFunction(pWinContext); } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/file.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/file.cpp index 23d99e4db..8d0cfa99f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/file.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/file.cpp @@ -18,7 +18,6 @@ SET_DEFAULT_DEBUG_CHANNEL(FILE); // some headers have code with asserts, so do t #include "pal/thread.hpp" #include "pal/file.hpp" -#include "pal/malloc.hpp" #include "pal/stackstring.hpp" #include "pal/palinternal.h" @@ -32,11 +31,14 @@ SET_DEFAULT_DEBUG_CHANNEL(FILE); // some headers have code with asserts, so do t #include #include #include -#include #include #include #include +#if HAVE_SYS_MOUNT_H +#include +#endif + using namespace CorUnix; int MaxWCharToAcpLengthFactor = 3; @@ -60,25 +62,17 @@ void FileCleanupRoutine( CPalThread *pThread, IPalObject *pObjectToCleanup, - bool fShutdown, - bool fCleanupSharedState + bool fShutdown ); CObjectType CorUnix::otFile( otiFile, FileCleanupRoutine, - NULL, // No initialization routine 0, // No immutable data NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine sizeof(CFileProcessLocalData), CFileProcessLocalDataCleanupRoutine, - 0, // No shared data - GENERIC_READ|GENERIC_WRITE, // Ignored -- no Win32 object security support - CObjectType::SecuritySupported, - CObjectType::OSPersistedSecurityInfo, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::UnwaitableObject, CObjectType::SignalingNotApplicable, CObjectType::ThreadReleaseNotApplicable, @@ -119,8 +113,7 @@ void FileCleanupRoutine( CPalThread *pThread, IPalObject *pObjectToCleanup, - bool fShutdown, - bool fCleanupSharedState + bool fShutdown ) { PAL_ERROR palError; @@ -330,9 +323,17 @@ CorUnix::InternalCanonicalizeRealPath(LPCSTR lpUnixPath, PathCharString& lpBuffe } lpFilename = lpExistingPath; } + else if (pchSeparator == lpExistingPath) + { + // This is a path in the root i.e. '/tmp' + // This scenario will probably only come up in WASM where it is normal to + // have a cwd of '/' and store files in the root of the virtual filesystem + lpBuffer.Clear(); + lpBuffer.Append(lpExistingPath, strlen(lpExistingPath)); + return NO_ERROR; + } else { -#if defined(HOST_AMD64) bool fSetFilename = true; // Since realpath implementation cannot handle inexistent filenames, // check if we are going to truncate the "/" corresponding to the @@ -356,8 +357,9 @@ CorUnix::InternalCanonicalizeRealPath(LPCSTR lpUnixPath, PathCharString& lpBuffe fSetFilename = false; } else -#endif // defined(HOST_AMD64) + { *pchSeparator = '\0'; + } if (!RealPathHelper(lpExistingPath, lpBuffer)) { @@ -366,16 +368,12 @@ CorUnix::InternalCanonicalizeRealPath(LPCSTR lpUnixPath, PathCharString& lpBuffe goto LExit; } -#if defined(HOST_AMD64) if (fSetFilename == true) -#endif // defined(HOST_AMD64) lpFilename = pchSeparator + 1; } -#if defined(HOST_AMD64) if (lpFilename == NULL) goto LExit; -#endif // HOST_AMD64 if (!lpBuffer.Append("/",1) || !lpBuffer.Append(lpFilename, strlen(lpFilename))) { @@ -906,100 +904,6 @@ CreateFileW( } -/*++ -Function: - CopyFileW - -See MSDN doc. - -Notes: - There are several (most) error paths here that do not call SetLastError(). -This is because we know that CreateFile, ReadFile, and WriteFile will do so, -and will have a much better idea of the specific error. ---*/ -BOOL -PALAPI -CopyFileW( - IN LPCWSTR lpExistingFileName, - IN LPCWSTR lpNewFileName, - IN BOOL bFailIfExists) -{ - CPalThread *pThread; - PathCharString sourcePathString; - PathCharString destPathString; - char * source; - char * dest; - int src_size, dest_size, length = 0; - BOOL bRet = FALSE; - - PERF_ENTRY(CopyFileW); - ENTRY("CopyFileW(lpExistingFileName=%p (%S), lpNewFileName=%p (%S), bFailIfExists=%d)\n", - lpExistingFileName?lpExistingFileName:W16_NULLSTRING, - lpExistingFileName?lpExistingFileName:W16_NULLSTRING, - lpNewFileName?lpNewFileName:W16_NULLSTRING, - lpNewFileName?lpNewFileName:W16_NULLSTRING, bFailIfExists); - - pThread = InternalGetCurrentThread(); - if (lpExistingFileName != NULL) - { - length = (PAL_wcslen(lpExistingFileName)+1) * MaxWCharToAcpLengthFactor; - } - - source = sourcePathString.OpenStringBuffer(length); - if (NULL == source) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto done; - } - - src_size = WideCharToMultiByte( CP_ACP, 0, lpExistingFileName, -1, source, length, - NULL, NULL ); - - if( src_size == 0 ) - { - sourcePathString.CloseBuffer(0); - DWORD dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - pThread->SetLastError(ERROR_INTERNAL_ERROR); - goto done; - } - - sourcePathString.CloseBuffer(src_size - 1); - length = 0; - - if (lpNewFileName != NULL) - { - length = (PAL_wcslen(lpNewFileName)+1) * MaxWCharToAcpLengthFactor; - } - - dest = destPathString.OpenStringBuffer(length); - if (NULL == dest) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto done; - } - dest_size = WideCharToMultiByte( CP_ACP, 0, lpNewFileName, -1, dest, length, - NULL, NULL ); - - if( dest_size == 0 ) - { - destPathString.CloseBuffer(0); - DWORD dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - pThread->SetLastError(ERROR_INTERNAL_ERROR); - goto done; - } - - destPathString.CloseBuffer(dest_size - 1); - bRet = CopyFileA(source,dest,bFailIfExists); - -done: - LOGEXIT("CopyFileW returns BOOL %d\n", bRet); - PERF_EXIT(CopyFileW); - return bRet; -} - - /*++ Function: DeleteFileA @@ -1065,471 +969,6 @@ DeleteFileA( return bRet; } - -/*++ -Function: - GetFileAttributesA - -Note: - Checking for directory and read-only file. - -Caveats: - There are some important things to note about this implementation, which -are due to the differences between the FAT filesystem and Unix filesystems: - -- fifo's, sockets, and symlinks will return -1, and GetLastError() will - return ERROR_ACCESS_DENIED - -- if a file is write-only, or has no permissions at all, it is treated - the same as if it had mode 'rw'. This is consistent with behaviour on - NTFS files with the same permissions. - -- the following flags will never be returned: - -FILE_ATTRIBUTE_SYSTEM -FILE_ATTRIBUTE_ARCHIVE -FILE_ATTRIBUTE_HIDDEN - ---*/ -DWORD -PALAPI -GetFileAttributesA( - IN LPCSTR lpFileName) -{ - CPalThread *pThread; - struct stat stat_data; - DWORD dwAttr = 0; - DWORD dwLastError = 0; - - PERF_ENTRY(GetFileAttributesA); - ENTRY("GetFileAttributesA(lpFileName=%p (%s))\n", lpFileName?lpFileName:"NULL", lpFileName?lpFileName:"NULL"); - - pThread = InternalGetCurrentThread(); - if (lpFileName == NULL) - { - dwLastError = ERROR_PATH_NOT_FOUND; - goto done; - } - - if ( stat(lpFileName, &stat_data) != 0 ) - { - dwLastError = FILEGetLastErrorFromErrnoAndFilename(lpFileName); - goto done; - } - - if ( (stat_data.st_mode & S_IFMT) == S_IFDIR ) - { - dwAttr |= FILE_ATTRIBUTE_DIRECTORY; - } - else if ( (stat_data.st_mode & S_IFMT) != S_IFREG ) - { - ERROR("Not a regular file or directory, S_IFMT is %#x\n", - stat_data.st_mode & S_IFMT); - dwLastError = ERROR_ACCESS_DENIED; - goto done; - } - - if ( UTIL_IsReadOnlyBitsSet( &stat_data ) ) - { - dwAttr |= FILE_ATTRIBUTE_READONLY; - } - - /* finally, if nothing is set... */ - if ( dwAttr == 0 ) - { - dwAttr = FILE_ATTRIBUTE_NORMAL; - } - -done: - if (dwLastError) - { - pThread->SetLastError(dwLastError); - dwAttr = INVALID_FILE_ATTRIBUTES; - } - - LOGEXIT("GetFileAttributesA returns DWORD %#x\n", dwAttr); - PERF_EXIT(GetFileAttributesA); - return dwAttr; -} - - - - -/*++ -Function: - GetFileAttributesW - -Note: - Checking for directory and read-only file - -See MSDN doc. ---*/ -DWORD -PALAPI -GetFileAttributesW( - IN LPCWSTR lpFileName) -{ - CPalThread *pThread; - int size; - PathCharString filenamePS; - int length = 0; - char * filename; - DWORD dwRet = (DWORD) -1; - - PERF_ENTRY(GetFileAttributesW); - ENTRY("GetFileAttributesW(lpFileName=%p (%S))\n", - lpFileName?lpFileName:W16_NULLSTRING, - lpFileName?lpFileName:W16_NULLSTRING); - - pThread = InternalGetCurrentThread(); - if (lpFileName == NULL) - { - pThread->SetLastError(ERROR_PATH_NOT_FOUND); - goto done; - } - - length = (PAL_wcslen(lpFileName)+1) * MaxWCharToAcpLengthFactor; - filename = filenamePS.OpenStringBuffer(length); - if (NULL == filename) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto done; - } - size = WideCharToMultiByte( CP_ACP, 0, lpFileName, -1, filename, length, - NULL, NULL ); - - if( size == 0 ) - { - filenamePS.CloseBuffer(0); - DWORD dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - pThread->SetLastError(ERROR_INTERNAL_ERROR); - } - else - { - filenamePS.CloseBuffer(size - 1); - dwRet = GetFileAttributesA( filename ); - } - -done: - LOGEXIT("GetFileAttributesW returns DWORD %#x\n", dwRet); - PERF_EXIT(GetFileAttributesW); - return dwRet; -} - - -/*++ -Function: - GetFileAttributesExW - -See MSDN doc, and notes for GetFileAttributesW. ---*/ -BOOL -PALAPI -GetFileAttributesExW( - IN LPCWSTR lpFileName, - IN GET_FILEEX_INFO_LEVELS fInfoLevelId, - OUT LPVOID lpFileInformation) -{ - CPalThread *pThread; - BOOL bRet = FALSE; - DWORD dwLastError = 0; - LPWIN32_FILE_ATTRIBUTE_DATA attr_data; - - struct stat stat_data; - - char * name; - PathCharString namePS; - int length = 0; - int size; - - PERF_ENTRY(GetFileAttributesExW); - ENTRY("GetFileAttributesExW(lpFileName=%p (%S), fInfoLevelId=%d, " - "lpFileInformation=%p)\n", lpFileName?lpFileName:W16_NULLSTRING, lpFileName?lpFileName:W16_NULLSTRING, - fInfoLevelId, lpFileInformation); - - pThread = InternalGetCurrentThread(); - if ( fInfoLevelId != GetFileExInfoStandard ) - { - ASSERT("Unrecognized value for fInfoLevelId=%d\n", fInfoLevelId); - dwLastError = ERROR_INVALID_PARAMETER; - goto done; - } - - if ( !lpFileInformation ) - { - ASSERT("lpFileInformation is NULL\n"); - dwLastError = ERROR_INVALID_PARAMETER; - goto done; - } - - if (lpFileName == NULL) - { - dwLastError = ERROR_PATH_NOT_FOUND; - goto done; - } - - length = (PAL_wcslen(lpFileName)+1) * MaxWCharToAcpLengthFactor; - name = namePS.OpenStringBuffer(length); - if (NULL == name) - { - dwLastError = ERROR_NOT_ENOUGH_MEMORY; - goto done; - } - size = WideCharToMultiByte( CP_ACP, 0, lpFileName, -1, name, length, - NULL, NULL ); - - if( size == 0 ) - { - namePS.CloseBuffer(0); - dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - dwLastError = ERROR_INTERNAL_ERROR; - goto done; - } - - namePS.CloseBuffer(size - 1); - attr_data = (LPWIN32_FILE_ATTRIBUTE_DATA)lpFileInformation; - - attr_data->dwFileAttributes = GetFileAttributesW(lpFileName); - /* assume that GetFileAttributesW will call SetLastError appropriately */ - if ( attr_data->dwFileAttributes == (DWORD)-1 ) - { - goto done; - } - - /* do the stat */ - if ( stat(name, &stat_data) != 0 ) - { - ERROR("stat failed on %S\n", lpFileName); - dwLastError = FILEGetLastErrorFromErrnoAndFilename(name); - goto done; - } - - /* get the file times */ - attr_data->ftCreationTime = - FILEUnixTimeToFileTime( stat_data.st_ctime, - ST_CTIME_NSEC(&stat_data) ); - attr_data->ftLastAccessTime = - FILEUnixTimeToFileTime( stat_data.st_atime, - ST_ATIME_NSEC(&stat_data) ); - attr_data->ftLastWriteTime = - FILEUnixTimeToFileTime( stat_data.st_mtime, - ST_MTIME_NSEC(&stat_data) ); - - /* if Unix mtime is greater than atime, return mtime - as the last access time */ - if (CompareFileTime(&attr_data->ftLastAccessTime, - &attr_data->ftLastWriteTime) < 0) - { - attr_data->ftLastAccessTime = attr_data->ftLastWriteTime; - } - - /* if Unix ctime is greater than mtime, return mtime - as the create time */ - if (CompareFileTime(&attr_data->ftLastWriteTime, - &attr_data->ftCreationTime) < 0) - { - attr_data->ftCreationTime = attr_data->ftLastWriteTime; - } - - /* Get the file size. GetFileSize is not used because it gets the - size of an already-open file */ - attr_data->nFileSizeLow = (DWORD) stat_data.st_size; -#if SIZEOF_OFF_T > 4 - attr_data->nFileSizeHigh = (DWORD)(stat_data.st_size >> 32); -#else - attr_data->nFileSizeHigh = 0; -#endif - - bRet = TRUE; - -done: - if (dwLastError) pThread->SetLastError(dwLastError); - - LOGEXIT("GetFileAttributesExW returns BOOL %d\n", bRet); - PERF_EXIT(GetFileAttributesExW); - return bRet; -} - -/*++ -Function: - SetFileAttributesA - -Notes: - Used for setting read-only attribute on file only. - ---*/ -BOOL -PALAPI -SetFileAttributesA( - IN LPCSTR lpFileName, - IN DWORD dwFileAttributes) -{ - CPalThread *pThread; - struct stat stat_data; - mode_t new_mode; - - DWORD dwLastError = 0; - BOOL bRet = FALSE; - - PERF_ENTRY(SetFileAttributesA); - ENTRY("SetFileAttributesA(lpFileName=%p (%s), dwFileAttributes=%#x)\n", - lpFileName?lpFileName:"NULL", - lpFileName?lpFileName:"NULL", dwFileAttributes); - - pThread = InternalGetCurrentThread(); - - /* Windows behavior for SetFileAttributes is that any valid attributes - are set on a file and any invalid attributes are ignored. SetFileAttributes - returns success and does not set an error even if some or all of the - attributes are invalid. If all the attributes are invalid, SetFileAttributes - sets a file's attribute to NORMAL. */ - - /* If dwFileAttributes does not contain READONLY or NORMAL, set it to NORMAL - and print a warning message. */ - if ( !(dwFileAttributes & (FILE_ATTRIBUTE_READONLY |FILE_ATTRIBUTE_NORMAL)) ) - { - dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - WARN("dwFileAttributes(%#x) contains attributes that are either not supported " - "or cannot be set via SetFileAttributes.\n"); - } - - if ( (dwFileAttributes & FILE_ATTRIBUTE_NORMAL) && - (dwFileAttributes != FILE_ATTRIBUTE_NORMAL) ) - { - WARN("Ignoring FILE_ATTRIBUTE_NORMAL -- it must be used alone\n"); - } - - if (lpFileName == NULL) - { - dwLastError = ERROR_FILE_NOT_FOUND; - goto done; - } - - if ( stat(lpFileName, &stat_data) != 0 ) - { - TRACE("stat failed on %s; errno is %d (%s)\n", - lpFileName, errno, strerror(errno)); - dwLastError = FILEGetLastErrorFromErrnoAndFilename(lpFileName); - goto done; - } - - new_mode = stat_data.st_mode; - TRACE("st_mode is %#x\n", new_mode); - - /* if we can't do GetFileAttributesA on it, don't do SetFileAttributesA */ - if ( !(new_mode & S_IFREG) && !(new_mode & S_IFDIR) ) - { - ERROR("Not a regular file or directory, S_IFMT is %#x\n", - new_mode & S_IFMT); - dwLastError = ERROR_ACCESS_DENIED; - goto done; - } - - /* set or unset the "read-only" attribute */ - if (dwFileAttributes & FILE_ATTRIBUTE_READONLY) - { - /* remove the write bit from everybody */ - new_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); - } - else - { - /* give write permission to the owner if the owner - * already has read permission */ - if ( new_mode & S_IRUSR ) - { - new_mode |= S_IWUSR; - } - } - TRACE("new mode is %#x\n", new_mode); - - bRet = TRUE; - if ( new_mode != stat_data.st_mode ) - { - if ( chmod(lpFileName, new_mode) != 0 ) - { - ERROR("chmod(%s, %#x) failed\n", lpFileName, new_mode); - dwLastError = FILEGetLastErrorFromErrnoAndFilename(lpFileName); - bRet = FALSE; - } - } - -done: - if (dwLastError) - { - pThread->SetLastError(dwLastError); - } - - LOGEXIT("SetFileAttributesA returns BOOL %d\n", bRet); - PERF_EXIT(SetFileAttributesA); - return bRet; -} - -/*++ -Function: - SetFileAttributesW - -Notes: - Used for setting read-only attribute on file only. - ---*/ -BOOL -PALAPI -SetFileAttributesW( - IN LPCWSTR lpFileName, - IN DWORD dwFileAttributes) -{ - CPalThread *pThread; - char * name; - PathCharString namePS; - int length = 0; - int size; - - DWORD dwLastError = 0; - BOOL bRet = FALSE; - - PERF_ENTRY(SetFileAttributesW); - ENTRY("SetFileAttributesW(lpFileName=%p (%S), dwFileAttributes=%#x)\n", - lpFileName?lpFileName:W16_NULLSTRING, - lpFileName?lpFileName:W16_NULLSTRING, dwFileAttributes); - - pThread = InternalGetCurrentThread(); - if (lpFileName == NULL) - { - dwLastError = ERROR_PATH_NOT_FOUND; - goto done; - } - - length = (PAL_wcslen(lpFileName)+1) * MaxWCharToAcpLengthFactor; - name = namePS.OpenStringBuffer(length); - if (NULL == name) - { - dwLastError = ERROR_NOT_ENOUGH_MEMORY; - goto done; - } - size = WideCharToMultiByte( CP_ACP, 0, lpFileName, -1, name, length, - NULL, NULL ); - - if( size == 0 ) - { - namePS.CloseBuffer(0); - dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - dwLastError = ERROR_INVALID_PARAMETER; - goto done; - } - namePS.CloseBuffer(size - 1); - bRet = SetFileAttributesA(name,dwFileAttributes); - -done: - if (dwLastError) pThread->SetLastError(dwLastError); - - LOGEXIT("SetFileAttributes returns BOOL %d\n", bRet); - PERF_EXIT(SetFileAttributesW); - return bRet; -} - /*++ InternalOpen @@ -2595,335 +2034,6 @@ FlushFileBuffers( uUniqueSeed++;\ } -/*++ - Function: - GetTempFileNameA - -uUnique is always 0. - --*/ -const int MAX_PREFIX = 3; -const int MAX_SEEDSIZE = 8; /* length of "unique portion of - the string, plus extension(FFFF.TMP). */ -static USHORT uUniqueSeed = 0; -static BOOL IsInitialized = FALSE; - -UINT -PALAPI -GetTempFileNameA( - IN LPCSTR lpPathName, - IN LPCSTR lpPrefixString, - IN UINT uUnique, - OUT LPSTR lpTempFileName) -{ - CPalThread *pThread; - CHAR * full_name; - PathCharString full_namePS; - int length; - CHAR * file_template; - PathCharString file_templatePS; - CHAR chLastPathNameChar; - - HANDLE hTempFile; - UINT uRet = 0; - DWORD dwError; - USHORT uLoopCounter = 0; - - PERF_ENTRY(GetTempFileNameA); - ENTRY("GetTempFileNameA(lpPathName=%p (%s), lpPrefixString=%p (%s), uUnique=%u, " - "lpTempFileName=%p)\n", lpPathName?lpPathName:"NULL", lpPathName?lpPathName:"NULL", - lpPrefixString?lpPrefixString:"NULL", - lpPrefixString?lpPrefixString:"NULL", uUnique, - lpTempFileName?lpTempFileName:"NULL"); - - pThread = InternalGetCurrentThread(); - if ( !IsInitialized ) - { - uUniqueSeed = (USHORT)( time( NULL ) ); - - /* On the off chance 0 is returned. - 0 being the error return code. */ - ENSURE_UNIQUE_NOT_ZERO - IsInitialized = TRUE; - } - - if ( !lpPathName || *lpPathName == '\0' ) - { - pThread->SetLastError( ERROR_DIRECTORY ); - goto done; - } - - if ( NULL == lpTempFileName ) - { - ERROR( "lpTempFileName cannot be NULL\n" ); - pThread->SetLastError( ERROR_INVALID_PARAMETER ); - goto done; - } - - if ( strlen( lpPathName ) + MAX_SEEDSIZE + MAX_PREFIX >= MAX_LONGPATH ) - { - WARN( "File names larger than MAX_LONGPATH (%d)!\n", MAX_LONGPATH ); - pThread->SetLastError( ERROR_FILENAME_EXCED_RANGE ); - goto done; - } - - length = strlen(lpPathName) + MAX_SEEDSIZE + MAX_PREFIX + 10; - file_template = file_templatePS.OpenStringBuffer(length); - if (NULL == file_template) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto done; - } - *file_template = '\0'; - strcat_s( file_template, file_templatePS.GetSizeOf(), lpPathName ); - file_templatePS.CloseBuffer(length); - - chLastPathNameChar = file_template[strlen(file_template)-1]; - if (chLastPathNameChar != '/') - { - strcat_s( file_template, file_templatePS.GetSizeOf(), "/" ); - } - - if ( lpPrefixString ) - { - strncat_s( file_template, file_templatePS.GetSizeOf(), lpPrefixString, MAX_PREFIX ); - } - strncat_s( file_template, file_templatePS.GetSizeOf(), "%.4x.TMP", MAX_SEEDSIZE ); - - /* Create the file. */ - dwError = GetLastError(); - pThread->SetLastError( NOERROR ); - - length = strlen(file_template) + MAX_SEEDSIZE + MAX_PREFIX; - full_name = full_namePS.OpenStringBuffer(length); - if (NULL == full_name) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto done; - } - sprintf_s( full_name, full_namePS.GetSizeOf(), file_template, (0 == uUnique) ? uUniqueSeed : uUnique); - full_namePS.CloseBuffer(length); - - hTempFile = CreateFileA( full_name, GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_NEW, 0, NULL ); - - if (uUnique == 0) - { - /* The USHORT will overflow back to 0 if we go past - 65536 files, so break the loop after 65536 iterations. - If the CreateFile call was not successful within that - number of iterations, then there are no temp file names - left for that directory. */ - while ( ERROR_PATH_NOT_FOUND != GetLastError() && - INVALID_HANDLE_VALUE == hTempFile && uLoopCounter < 0xFFFF ) - { - uUniqueSeed++; - ENSURE_UNIQUE_NOT_ZERO; - - pThread->SetLastError( NOERROR ); - sprintf_s( full_name, full_namePS.GetSizeOf(), file_template, uUniqueSeed ); - hTempFile = CreateFileA( full_name, GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_NEW, 0, NULL ); - uLoopCounter++; - - } - } - - /* Reset the error code.*/ - if ( NOERROR == GetLastError() ) - { - pThread->SetLastError( dwError ); - } - - /* Windows sets ERROR_FILE_EXISTS,if there - are no available temp files. */ - if ( INVALID_HANDLE_VALUE != hTempFile ) - { - if (0 == uUnique) - { - uRet = uUniqueSeed; - uUniqueSeed++; - ENSURE_UNIQUE_NOT_ZERO; - } - else - { - uRet = uUnique; - } - - if ( CloseHandle( hTempFile ) ) - { - if (strcpy_s( lpTempFileName, MAX_LONGPATH, full_name ) != SAFECRT_SUCCESS) - { - ERROR( "strcpy_s failed!\n"); - pThread->SetLastError( ERROR_FILENAME_EXCED_RANGE ); - *lpTempFileName = '\0'; - uRet = 0; - } - } - else - { - ASSERT( "Unable to close the handle %p\n", hTempFile ); - pThread->SetLastError( ERROR_INTERNAL_ERROR ); - *lpTempFileName = '\0'; - uRet = 0; - } - } - else if ( INVALID_HANDLE_VALUE == hTempFile && uLoopCounter < 0xFFFF ) - { - ERROR( "Unable to create temp file. \n" ); - uRet = 0; - - if ( ERROR_PATH_NOT_FOUND == GetLastError() ) - { - /* CreateFile failed because it could not - find the path. */ - pThread->SetLastError( ERROR_DIRECTORY ); - } /* else use the lasterror value from CreateFileA */ - } - else - { - TRACE( "65535 files already exist in the directory. " - "No temp files available for creation.\n" ); - pThread->SetLastError( ERROR_FILE_EXISTS ); - } - -done: - LOGEXIT("GetTempFileNameA returns UINT %u\n", uRet); - PERF_EXIT(GetTempFileNameA); - return uRet; - -} - -/*++ -Function: - GetTempFileNameW - -uUnique is always 0. ---*/ -UINT -PALAPI -GetTempFileNameW( - IN LPCWSTR lpPathName, - IN LPCWSTR lpPrefixString, - IN UINT uUnique, - OUT LPWSTR lpTempFileName) -{ - CPalThread *pThread; - INT path_size = 0; - INT prefix_size = 0; - CHAR * full_name; - CHAR * prefix_string; - CHAR * tempfile_name = NULL; - PathCharString full_namePS, prefix_stringPS; - INT length = 0; - UINT uRet; - - PERF_ENTRY(GetTempFileNameW); - ENTRY("GetTempFileNameW(lpPathName=%p (%S), lpPrefixString=%p (%S), uUnique=%u, " - "lpTempFileName=%p)\n", lpPathName?lpPathName:W16_NULLSTRING, lpPathName?lpPathName:W16_NULLSTRING, - lpPrefixString?lpPrefixString:W16_NULLSTRING, - lpPrefixString?lpPrefixString:W16_NULLSTRING,uUnique, lpTempFileName); - - pThread = InternalGetCurrentThread(); - /* Sanity checks. */ - if ( !lpPathName || *lpPathName == '\0' ) - { - pThread->SetLastError( ERROR_DIRECTORY ); - uRet = 0; - goto done; - } - - length = (PAL_wcslen(lpPathName)+1) * MaxWCharToAcpLengthFactor; - full_name = full_namePS.OpenStringBuffer(length); - if (NULL == full_name) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - uRet = 0; - goto done; - } - path_size = WideCharToMultiByte( CP_ACP, 0, lpPathName, -1, full_name, - length, NULL, NULL ); - - if( path_size == 0 ) - { - full_namePS.CloseBuffer(0); - DWORD dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - pThread->SetLastError(ERROR_INTERNAL_ERROR); - uRet = 0; - goto done; - } - - full_namePS.CloseBuffer(path_size - 1); - - if (lpPrefixString != NULL) - { - length = (PAL_wcslen(lpPrefixString)+1) * MaxWCharToAcpLengthFactor; - prefix_string = prefix_stringPS.OpenStringBuffer(length); - if (NULL == prefix_string) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - uRet = 0; - goto done; - } - prefix_size = WideCharToMultiByte( CP_ACP, 0, lpPrefixString, -1, - prefix_string, - MAX_LONGPATH - path_size - MAX_SEEDSIZE, - NULL, NULL ); - - if( prefix_size == 0 ) - { - prefix_stringPS.CloseBuffer(0); - DWORD dwLastError = GetLastError(); - ASSERT("WideCharToMultiByte failure! error is %d\n", dwLastError); - pThread->SetLastError(ERROR_INTERNAL_ERROR); - uRet = 0; - goto done; - } - prefix_stringPS.CloseBuffer(prefix_size - 1); - } - - tempfile_name = (char*)malloc(MAX_LONGPATH); - if (tempfile_name == NULL) - { - pThread->SetLastError(ERROR_NOT_ENOUGH_MEMORY); - uRet = 0; - goto done; - } - - uRet = GetTempFileNameA(full_name, - (lpPrefixString == NULL) ? NULL : prefix_string, - 0, tempfile_name); - if (uRet) - { - path_size = MultiByteToWideChar( CP_ACP, 0, tempfile_name, -1, - lpTempFileName, MAX_LONGPATH ); - - if (!path_size) - { - DWORD dwLastError = GetLastError(); - if (dwLastError == ERROR_INSUFFICIENT_BUFFER) - { - WARN("File names larger than MAX_PATH_FNAME (%d)! \n", MAX_LONGPATH); - dwLastError = ERROR_FILENAME_EXCED_RANGE; - } - else - { - ASSERT("MultiByteToWideChar failure! error is %d", dwLastError); - dwLastError = ERROR_INTERNAL_ERROR; - } - pThread->SetLastError(dwLastError); - uRet = 0; - } - } - -done: - free(tempfile_name); - - LOGEXIT("GetTempFileNameW returns UINT %u\n", uRet); - PERF_EXIT(GetTempFileNameW); - return uRet; -} - /*++ Function: FILEGetLastErrorFromErrno @@ -3011,156 +2121,6 @@ DWORD DIRGetLastErrorFromErrno( void ) } -/*++ -Function: - CopyFileA - -See MSDN doc. - -Notes: - There are several (most) error paths here that do not call SetLastError(). -This is because we know that CreateFile, ReadFile, and WriteFile will do so, -and will have a much better idea of the specific error. ---*/ -BOOL -PALAPI -CopyFileA( - IN LPCSTR lpExistingFileName, - IN LPCSTR lpNewFileName, - IN BOOL bFailIfExists) -{ - CPalThread *pThread; - HANDLE hSource = INVALID_HANDLE_VALUE; - HANDLE hDest = INVALID_HANDLE_VALUE; - DWORD dwDestCreationMode; - BOOL bGood = FALSE; - DWORD dwSrcFileAttributes; - struct stat SrcFileStats; - - const int buffer_size = 16*1024; - char *buffer = (char*)alloca(buffer_size); - DWORD bytes_read; - DWORD bytes_written; - int permissions; - - - PERF_ENTRY(CopyFileA); - ENTRY("CopyFileA(lpExistingFileName=%p (%s), lpNewFileName=%p (%s), bFailIfExists=%d)\n", - lpExistingFileName?lpExistingFileName:"NULL", - lpExistingFileName?lpExistingFileName:"NULL", - lpNewFileName?lpNewFileName:"NULL", - lpNewFileName?lpNewFileName:"NULL", bFailIfExists); - - pThread = InternalGetCurrentThread(); - if ( bFailIfExists ) - { - dwDestCreationMode = CREATE_NEW; - } - else - { - dwDestCreationMode = CREATE_ALWAYS; - } - - hSource = CreateFileA( lpExistingFileName, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - 0, - NULL ); - - if ( hSource == INVALID_HANDLE_VALUE ) - { - ERROR("CreateFileA failed for %s\n", lpExistingFileName); - goto done; - } - - /* Need to preserve the file attributes */ - dwSrcFileAttributes = GetFileAttributesA(lpExistingFileName); - if (dwSrcFileAttributes == 0xffffffff) - { - ERROR("GetFileAttributesA failed for %s\n", lpExistingFileName); - goto done; - } - - /* Need to preserve the owner/group and chmod() flags */ - if (stat (lpExistingFileName, &SrcFileStats) == -1) - { - ERROR("stat() failed for %s\n", lpExistingFileName); - pThread->SetLastError(FILEGetLastErrorFromErrnoAndFilename(lpExistingFileName)); - goto done; - } - - hDest = CreateFileA( lpNewFileName, - GENERIC_WRITE, - FILE_SHARE_READ, - NULL, - dwDestCreationMode, - 0, - NULL ); - - if ( hDest == INVALID_HANDLE_VALUE ) - { - ERROR("CreateFileA failed for %s\n", lpNewFileName); - goto done; - } - - // We don't set file attributes in CreateFile. The only attribute - // that is reflected on disk in Unix is read-only, and we set that - // here. - permissions = (S_IRWXU | S_IRWXG | S_IRWXO); - if ((dwSrcFileAttributes & FILE_ATTRIBUTE_READONLY) != 0) - { - permissions &= ~(S_IWUSR | S_IWGRP | S_IWOTH); - } - - /* Make sure the new file has the same chmod() flags. */ - if (chmod(lpNewFileName, SrcFileStats.st_mode & permissions) == -1) - { - WARN ("chmod() failed to set mode 0x%x on new file\n", - SrcFileStats.st_mode & permissions); - pThread->SetLastError(FILEGetLastErrorFromErrnoAndFilename(lpNewFileName)); - goto done; - } - - while( (bGood = ReadFile( hSource, buffer, buffer_size, &bytes_read, NULL )) - && bytes_read > 0 ) - { - bGood = ( WriteFile( hDest, buffer, bytes_read, &bytes_written, NULL ) - && bytes_written == bytes_read); - if (!bGood) break; - } - - if (!bGood) - { - ERROR("Copy failed\n"); - - if ( !CloseHandle(hDest) || - !DeleteFileA(lpNewFileName) ) - { - ERROR("Unable to clean up partial copy\n"); - } - hDest = INVALID_HANDLE_VALUE; - - goto done; - } - -done: - - if ( hSource != INVALID_HANDLE_VALUE ) - { - CloseHandle( hSource ); - } - if ( hDest != INVALID_HANDLE_VALUE ) - { - CloseHandle( hDest ); - } - - LOGEXIT("CopyFileA returns BOOL %d\n", bGood); - PERF_EXIT(CopyFileA); - return bGood; -} - PAL_ERROR CorUnix::InternalCreatePipe( CPalThread *pThread, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/find.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/find.cpp deleted file mode 100644 index ead5c4335..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/find.cpp +++ /dev/null @@ -1,1000 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - find.c - -Abstract: - - Implementation of the FindFile function family - -Revision History: - - - ---*/ - -#include "pal/thread.hpp" -#include "pal/malloc.hpp" -#include "pal/file.hpp" -#include "pal/stackstring.hpp" - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/file.h" -#include "pal/filetime.h" - -#include -#include -#include -#include - -using namespace CorUnix; - -SET_DEFAULT_DEBUG_CHANNEL(FILE); - -namespace CorUnix -{ - int InternalGlob( - const char *szPattern, - int nFlags, -#if ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS - int (*pnErrFunc)(const char *, int), -#else - int (*pnErrFunc)(...), -#endif - glob_t *pgGlob - ); - - /*++ - InternalGlob - - Input parameters: - - szPattern = pointer to a pathname pattern to be expanded - nFlags = arguments to modify the behavior of glob - pnErrFunc = pointer to a routine that handles errors during the glob call - pgGlob = pointer to a glob structure - - Return value: - 0 on success, -1 on failure. - - Some platforms expect the error function for glob to take a variable number - of parameters, whereas other platforms insist that the error function take - a const char * and an int. A test in configure determines which is the case - for each platform and sets ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS - to 1 if the error func must have the char * and int parameters. - --*/ - int - InternalGlob( - const char *szPattern, - int nFlags, -#if ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS - int (*pnErrFunc)(const char *, int), -#else - int (*pnErrFunc)(...), -#endif - glob_t *pgGlob - ) - { - int nRet = -1; - nRet = glob(szPattern, nFlags, pnErrFunc, pgGlob); - return nRet; - } -} - -static BOOL FILEDosGlobA( - CPalThread *pthrCurrent, - const char *pattern, - int flags, - glob_t *pgGlob ); - -static int FILEGlobQsortCompare(const void *in_str1, const void *in_str2); - -static int FILEGlobFromSplitPath( - const char *dir, - const char *fname, - const char *ext, - int flags, - glob_t *pgGlob ); - -/*++ -Function: - FindFirstFileA - -See MSDN doc. ---*/ -HANDLE -PALAPI -FindFirstFileA( - IN LPCSTR lpFileName, - OUT LPWIN32_FIND_DATAA lpFindFileData) -{ - HANDLE hRet = INVALID_HANDLE_VALUE; - DWORD dwLastError = NO_ERROR; - find_obj *find_data = NULL; - CPalThread *pthrCurrent = InternalGetCurrentThread(); - - PERF_ENTRY(FindFirstFileA); - ENTRY("FindFirstFileA(lpFileName=%p (%s), lpFindFileData=%p)\n", - lpFileName?lpFileName:"NULL", - lpFileName?lpFileName:"NULL", lpFindFileData); - - if(NULL == lpFileName) - { - ERROR("lpFileName is NULL!\n"); - dwLastError = ERROR_PATH_NOT_FOUND; - goto done; - } - if(NULL == lpFindFileData) - { - ASSERT("lpFindFileData is NULL!\n"); - dwLastError = ERROR_INVALID_PARAMETER; - goto done; - } - - find_data = (find_obj *)malloc(sizeof(find_obj)); - if ( find_data == NULL ) - { - ERROR("Unable to allocate memory for find_data\n"); - dwLastError = ERROR_NOT_ENOUGH_MEMORY; - goto done; - } - - find_data->self_addr = find_data; - - // Clear the glob_t so we can safely call globfree() on it - // regardless of whether FILEDosGlobA ends up calling glob(). - memset(&(find_data->gGlob), 0, sizeof(find_data->gGlob)); - - if (!FILEDosGlobA(pthrCurrent, lpFileName, 0, &(find_data->gGlob))) - { - // FILEDosGlobA will call SetLastError() on failure. - goto done; - } - else - { - // Check if there's at least one match. - if (find_data->gGlob.gl_pathc == 0) - { - /* Testing has indicated that for this API the - * last errors are as follows - * c:\temp\foo.txt - no error - * c:\temp\foo - ERROR_FILE_NOT_FOUND - * c:\temp\foo\bar - ERROR_PATH_NOT_FOUND - * c:\temp\foo.txt\bar - ERROR_DIRECTORY - * - */ - LPSTR lpTemp = strdup((LPSTR)lpFileName); - if ( !lpTemp ) - { - ERROR( "strdup failed!\n" ); - SetLastError( ERROR_INTERNAL_ERROR ); - goto done; - } - FILEGetProperNotFoundError( lpTemp, &dwLastError ); - - if ( ERROR_PATH_NOT_FOUND == dwLastError ) - { - /* If stripping the last segment reveals a file name then - the error is ERROR_DIRECTORY. */ - struct stat stat_data; - LPSTR lpLastPathSeparator = NULL; - - lpLastPathSeparator = strrchr( lpTemp, '/'); - - if ( lpLastPathSeparator != NULL ) - { - *lpLastPathSeparator = '\0'; - - if ( stat( lpTemp, &stat_data) == 0 && - (stat_data.st_mode & S_IFMT) == S_IFREG ) - { - dwLastError = ERROR_DIRECTORY; - } - } - } - free(lpTemp); - lpTemp = NULL; - goto done; - } - - find_data->next = find_data->gGlob.gl_pathv; - } - - if ( FindNextFileA( (HANDLE)find_data, lpFindFileData ) ) - { - hRet = (HANDLE)find_data; - } - -done: - - if ( hRet == INVALID_HANDLE_VALUE ) - { - if(NULL != find_data) - { - // Call globfree only when there is any pattern match - // otherwise, HPUX C library segfaults. - if (NULL != find_data->gGlob.gl_pathv) - { - globfree( &(find_data->gGlob) ); - } - free(find_data); - } - if (dwLastError) - { - SetLastError(dwLastError); - } - } - - LOGEXIT("FindFirstFileA returns HANDLE %p\n", hRet ); - PERF_EXIT(FindFirstFileA); - return hRet; -} - - -/*++ -Function: - FindFirstFileW - -See MSDN doc. ---*/ -HANDLE -PALAPI -FindFirstFileW( - IN LPCWSTR lpFileName, - OUT LPWIN32_FIND_DATAW lpFindFileData) -{ - // MAX_PATH_FNAME in this context is a file name, not a full path to a file. - HANDLE retval = INVALID_HANDLE_VALUE; - CHAR FileNameA[MAX_PATH_FNAME]; - WIN32_FIND_DATAA FindFileDataA; - - PERF_ENTRY(FindFirstFileW); - ENTRY("FindFirstFileW(lpFileName=%p (%S), lpFindFileData=%p)\n", - lpFileName?lpFileName:W16_NULLSTRING, - lpFileName?lpFileName:W16_NULLSTRING, lpFindFileData); - - if(NULL == lpFileName) - { - ERROR("lpFileName is NULL!\n"); - SetLastError(ERROR_PATH_NOT_FOUND); - goto done; - } - - if(NULL == lpFindFileData) - { - ERROR("lpFindFileData is NULL!\n"); - SetLastError(ERROR_INVALID_PARAMETER); - goto done; - } - if( 0 == WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, lpFileName, -1, - FileNameA, MAX_PATH_FNAME, NULL, NULL)) - { - DWORD dwLastError = GetLastError(); - if (dwLastError == ERROR_INSUFFICIENT_BUFFER) - { - WARN("lpFileName is larger than MAX_PATH_FNAME (%d)!\n", MAX_PATH_FNAME); - SetLastError(ERROR_FILENAME_EXCED_RANGE); - } - else - { - ASSERT("WideCharToMultiByte failed! error is %d\n", dwLastError); - SetLastError(ERROR_INTERNAL_ERROR); - } - goto done; - } - - retval = FindFirstFileA(FileNameA, &FindFileDataA); - if( INVALID_HANDLE_VALUE == retval ) - { - TRACE("FindFirstFileA failed!\n"); - goto done; - } - - lpFindFileData->dwFileAttributes = FindFileDataA.dwFileAttributes; - lpFindFileData->dwReserved0 = FindFileDataA.dwReserved0; - lpFindFileData->dwReserved1 = FindFileDataA.dwReserved1; - lpFindFileData->ftCreationTime = FindFileDataA.ftCreationTime; - lpFindFileData->ftLastAccessTime = FindFileDataA.ftLastAccessTime; - lpFindFileData->ftLastWriteTime = FindFileDataA.ftLastWriteTime; - lpFindFileData->nFileSizeHigh = FindFileDataA.nFileSizeHigh; - lpFindFileData->nFileSizeLow = FindFileDataA.nFileSizeLow; - - /* no 8.3 file names */ - lpFindFileData->cAlternateFileName[0] = 0; - - if( 0 == MultiByteToWideChar(CP_ACP, 0, FindFileDataA.cFileName, -1, - lpFindFileData->cFileName, MAX_PATH_FNAME)) - { - DWORD dwLastError = GetLastError(); - if (dwLastError == ERROR_INSUFFICIENT_BUFFER) - { - WARN("FindFileDataA.cFileName is larger than MAX_PATH_FNAME (%d)!\n", MAX_PATH_FNAME); - SetLastError(ERROR_FILENAME_EXCED_RANGE); - } - else - { - ASSERT("MultiByteToWideChar failed! error is %d\n", dwLastError); - SetLastError(ERROR_INTERNAL_ERROR); - } - FindClose(retval); - retval = INVALID_HANDLE_VALUE; - } -done: - LOGEXIT("FindFirstFileW returns HANDLE %p\n", retval); - PERF_EXIT(FindFirstFileW); - return retval; -} - - -/*++ -Function: - FindNextFileA - -See MSDN doc. ---*/ -BOOL -PALAPI -FindNextFileA( - IN HANDLE hFindFile, - OUT LPWIN32_FIND_DATAA lpFindFileData) -{ - find_obj *find_data; - - BOOL bRet = FALSE; - DWORD dwLastError = 0; - DWORD Attr; - - PERF_ENTRY(FindNextFileA); - ENTRY("FindNextFileA(hFindFile=%p, lpFindFileData=%p)\n", - hFindFile, lpFindFileData); - - find_data = (find_obj*)hFindFile; - - if ( hFindFile == INVALID_HANDLE_VALUE || - find_data == NULL || - find_data->self_addr != find_data ) - { - TRACE("FindNextFileA received an invalid handle\n"); - dwLastError = ERROR_INVALID_HANDLE; - goto done; - } - - if ( find_data->next) - { - struct stat stat_data; - char ext[_MAX_EXT]; - int stat_result; - - while (*(find_data->next)) - { - char *path = *(find_data->next); - - TRACE("Found [%s]\n", path); - - // Split the path into a dir and filename. - if (_splitpath_s(path, NULL, 0, find_data->dir, _MAX_DIR, find_data->fname, _MAX_PATH, ext, _MAX_EXT) != 0) - { - ASSERT("_splitpath_s failed on %s\n", path); - dwLastError = ERROR_INTERNAL_ERROR; - goto done; - } - strcat_s( find_data->fname, sizeof(find_data->fname), ext ); - - /* get the attributes, but continue if it fails */ - Attr = GetFileAttributesA(path); - if (Attr == INVALID_FILE_ATTRIBUTES) - { - WARN("GetFileAttributes returned -1 on file [%s]\n", - *(find_data->next)); - } - lpFindFileData->dwFileAttributes = Attr; - - /* Note that cFileName is NOT the relative path */ - if (strcpy_s( lpFindFileData->cFileName, sizeof(lpFindFileData->cFileName), find_data->fname ) != SAFECRT_SUCCESS) - { - TRACE("strcpy_s failed!\n"); - dwLastError = ERROR_FILENAME_EXCED_RANGE; - goto done; - } - - /* we don't support 8.3 filenames, so just leave it empty */ - lpFindFileData->cAlternateFileName[0] = 0; - - /* get the filetimes */ - stat_result = stat(path, &stat_data) == 0 || - lstat(path, &stat_data) == 0; - - find_data->next++; - - if ( stat_result ) - { - lpFindFileData->ftCreationTime = - FILEUnixTimeToFileTime( stat_data.st_ctime, - ST_CTIME_NSEC(&stat_data) ); - lpFindFileData->ftLastAccessTime = - FILEUnixTimeToFileTime( stat_data.st_atime, - ST_ATIME_NSEC(&stat_data) ); - lpFindFileData->ftLastWriteTime = - FILEUnixTimeToFileTime( stat_data.st_mtime, - ST_MTIME_NSEC(&stat_data) ); - - /* if Unix mtime is greater than atime, return mtime - as the last access time */ - if (CompareFileTime(&lpFindFileData->ftLastAccessTime, - &lpFindFileData->ftLastWriteTime) < 0) - { - lpFindFileData->ftLastAccessTime = lpFindFileData->ftLastWriteTime; - } - - /* if Unix ctime is greater than mtime, return mtime - as the create time */ - if (CompareFileTime(&lpFindFileData->ftLastWriteTime, - &lpFindFileData->ftCreationTime) < 0) - { - lpFindFileData->ftCreationTime = lpFindFileData->ftLastWriteTime; - } - - /* get file size */ - lpFindFileData->nFileSizeLow = (DWORD)stat_data.st_size; - #if SIZEOF_OFF_T > 4 - lpFindFileData->nFileSizeHigh = - (DWORD)(stat_data.st_size >> 32); - #else - lpFindFileData->nFileSizeHigh = 0; - #endif - - bRet = TRUE; - break; - } - } - if(!bRet) - { - dwLastError = ERROR_NO_MORE_FILES; - } - } - else - { - - ASSERT("find_data->next is (mysteriously) NULL\n"); - } - -done: - if (dwLastError) - { - SetLastError(dwLastError); - } - - LOGEXIT("FindNextFileA returns BOOL %d\n", bRet); - PERF_EXIT(FindNextFileA); - return bRet; -} - - -/*++ -Function: - FindNextFileW - -See MSDN doc. ---*/ -BOOL -PALAPI -FindNextFileW( - IN HANDLE hFindFile, - OUT LPWIN32_FIND_DATAW lpFindFileData) -{ - BOOL retval = FALSE; - WIN32_FIND_DATAA FindFileDataA; - - PERF_ENTRY(FindNextFileW); - ENTRY("FindNextFileW(hFindFile=%p, lpFindFileData=%p)\n", - hFindFile, lpFindFileData); - - retval = FindNextFileA(hFindFile, &FindFileDataA); - if(!retval) - { - WARN("FindNextFileA failed!\n"); - goto done; - } - - lpFindFileData->dwFileAttributes = FindFileDataA.dwFileAttributes; - lpFindFileData->dwReserved0 = FindFileDataA.dwReserved0; - lpFindFileData->dwReserved1 = FindFileDataA.dwReserved1; - lpFindFileData->ftCreationTime = FindFileDataA.ftCreationTime; - lpFindFileData->ftLastAccessTime = FindFileDataA.ftLastAccessTime; - lpFindFileData->ftLastWriteTime = FindFileDataA.ftLastWriteTime; - lpFindFileData->nFileSizeHigh = FindFileDataA.nFileSizeHigh; - lpFindFileData->nFileSizeLow = FindFileDataA.nFileSizeLow; - - /* no 8.3 file names */ - lpFindFileData->cAlternateFileName[0] = 0; - - if( 0 == MultiByteToWideChar(CP_ACP, 0, FindFileDataA.cFileName, -1, - lpFindFileData->cFileName, MAX_PATH_FNAME)) - { - DWORD dwLastError = GetLastError(); - if (dwLastError == ERROR_INSUFFICIENT_BUFFER) - { - WARN("FindFileDataA.cFileName is larger than MAX_PATH_FNAME (%d)!\n", MAX_PATH_FNAME); - SetLastError(ERROR_FILENAME_EXCED_RANGE); - } - else - { - ASSERT("MultiByteToWideChar failed! error is %d\n", dwLastError); - SetLastError(ERROR_INTERNAL_ERROR); - } - retval = FALSE; - } - -done: - LOGEXIT("FindNextFileW returns BOOL %d\n", retval); - PERF_EXIT(FindNextFileW); - return retval; -} - - -/*++ -Function: - FindClose - -See MSDN doc. ---*/ -BOOL -PALAPI -FindClose( - IN OUT HANDLE hFindFile) -{ - find_obj *find_data; - BOOL hRet = TRUE; - DWORD dwLastError = 0; - - PERF_ENTRY(FindClose); - ENTRY("FindClose(hFindFile=%p)\n", hFindFile); - - find_data = (find_obj*)hFindFile; - - if ( hFindFile == INVALID_HANDLE_VALUE || - find_data == NULL || - find_data->self_addr != find_data ) - { - ERROR("Invalid find handle\n"); - hRet = FALSE; - dwLastError = ERROR_INVALID_PARAMETER; - goto done; - } - - find_data->self_addr = NULL; - - // Call globfree only when there is any pattern match - // otherwise, HPUX C library segfaults. - if (NULL != find_data->gGlob.gl_pathv) - { - globfree( &(find_data->gGlob) ); - } - free(find_data); - -done: - if (dwLastError) - { - SetLastError(dwLastError); - } - - LOGEXIT("FindClose returns BOOL %d\n", hRet); - PERF_EXIT(FindClose); - return hRet; -} - - -/*++ -Function: - FILEMakePathA - -Mimics _makepath from windows, except it's a bit safer. -Any or all of dir, fname, and ext can be NULL. ---*/ -static int FILEMakePathA( char *buff, - int buff_size, - const char *dir, - const char *fname, - const char *ext ) -{ - int dir_len = 0; - int fname_len = 0; - int ext_len = 0; - int len; - char *p; - - TRACE("Attempting to assemble path from [%s][%s][%s], buff_size = %d\n", - dir?dir:"NULL", fname?fname:"NULL", ext?ext:"NULL", buff_size); - - if (dir) dir_len = strlen(dir); - if (fname) fname_len = strlen(fname); - if (ext) ext_len = strlen(ext); - - len = dir_len + fname_len + ext_len + 1; - - TRACE("Required buffer size is %d bytes\n", len); - - if ( len > buff_size ) - { - ERROR("Buffer is too small (%d bytes), needs %d bytes\n", - buff_size, len); - return -1; - } - else - { - buff[0] = 0; - - p = buff; - if (dir_len > 0) - { - if (strncpy_s( buff, buff_size, dir, dir_len + 1 ) != SAFECRT_SUCCESS) - { - ERROR("FILEMakePathA: strncpy_s failed\n"); - return -1; - } - - p += dir_len; - buff_size-= dir_len; - } - if (fname_len > 0) - { - if (strncpy_s( p, buff_size, fname, fname_len + 1 ) != SAFECRT_SUCCESS) - { - ERROR("FILEMakePathA: strncpy_s failed\n"); - return -1; - } - - p += fname_len; - buff_size-=fname_len; - } - if (ext_len > 0) - { - if (strncpy_s( p, buff_size, ext, ext_len + 1) != SAFECRT_SUCCESS) - { - ERROR("FILEMakePathA: strncpy_s failed\n"); - return -1; - } - } - - TRACE("FILEMakePathA assembled [%s]\n", buff); - return len - 1; - } -} - - -/*++ - FILEGlobQsortCompare - - Comparison function required by qsort, so that the - . and .. directories end up on top of the sorted list - of directories. ---*/ -static int FILEGlobQsortCompare(const void *in_str1, const void *in_str2) -{ - char **str1 = (char**)in_str1; - char **str2 = (char**)in_str2; - const int FIRST_ARG_LESS = -1; - const int FIRST_ARG_EQUAL = 0; - const int FIRST_ARG_GREATER = 1; - - /* If both strings are equal, return immediately */ - if (strcmp(*(str1), *(str2)) == 0) - { - return(FIRST_ARG_EQUAL); - } - - /* Have '.' always on top than any other search result */ - if (strcmp(*(str1), ".") == 0) - { - return (FIRST_ARG_LESS); - } - if (strcmp(*(str2), ".") == 0) - { - return (FIRST_ARG_GREATER); - } - - /* Have '..' next on top, over any other search result */ - if (strcmp(*(str1), "..") == 0) - { - return (FIRST_ARG_LESS); - } - if (strcmp(*(str2), "..") == 0) - { - return (FIRST_ARG_GREATER); - } - - /* Finally, let strcmp do the rest for us */ - return (strcmp(*(str1),*(str2))); -} - -/*++ -Function: - FILEEscapeSquareBrackets - -Simple helper function to insert backslashes before square brackets -to prevent glob from using them as wildcards. - -note: this functions assumes all backslashes have previously been - converted into forwardslashes by _splitpath_s. ---*/ -static void FILEEscapeSquareBrackets(char *pattern, char *escaped_pattern) -{ - TRACE("Entering FILEEscapeSquareBrackets: [%p (%s)][%p]\n", - pattern,pattern,escaped_pattern); - -#if _ENABLE_DEBUG_MESSAGES_ - char *escaped_pattern_base = escaped_pattern; -#endif // _ENABLE_DEBUG_MESSAGES_ - - while(*pattern) - { - if('[' == *pattern || ']' == *pattern) - { - *escaped_pattern = '\\'; - escaped_pattern++; - } - *escaped_pattern = *pattern; - pattern++; - escaped_pattern++; - } - *escaped_pattern='\0'; - - TRACE("FILEEscapeSquareBrackets done. escaped_pattern=%s\n", - escaped_pattern_base); -} - - -/*++ -Function: - FILEGlobFromSplitPath - -Simple wrapper function around glob(3), except that the pattern is accepted -in broken-down form like _splitpath_s produces. - -ie. calling splitpath on a pattern then calling this function should -produce the same result as just calling glob() on the pattern. ---*/ -static int FILEGlobFromSplitPath( const char *dir, - const char *fname, - const char *ext, - int flags, - glob_t *pgGlob ) -{ - int Ret; - PathCharString PatternPS; - PathCharString EscapedPatternPS; - char * Pattern; - int length = 0; - char * EscapedPattern; - - TRACE("We shall attempt to glob from components [%s][%s][%s]\n", - dir?dir:"NULL", fname?fname:"NULL", ext?ext:"NULL"); - - if (dir) length = strlen(dir); - if (fname) length += strlen(fname); - if (ext) length += strlen(ext); - - Pattern = PatternPS.OpenStringBuffer(length); - if (NULL == Pattern) - { - ERROR("Not Enough memory."); - return -1; - } - FILEMakePathA( Pattern, length+1, dir, fname, ext ); - PatternPS.CloseBuffer(length); - TRACE("Assembled Pattern = [%s]\n", Pattern); - - /* special handling is needed to handle the case where - filename contains '[' and ']' */ - EscapedPattern = EscapedPatternPS.OpenStringBuffer(length*2); - if (NULL == EscapedPattern) - { - ERROR("Not Enough memory."); - return -1; - } - FILEEscapeSquareBrackets( Pattern, EscapedPattern); - EscapedPatternPS.CloseBuffer(strlen(EscapedPattern)); -#ifdef GLOB_QUOTE - flags |= GLOB_QUOTE; -#endif // GLOB_QUOTE - Ret = InternalGlob(EscapedPattern, flags, NULL, pgGlob); - -#ifdef GLOB_NOMATCH - if (Ret == GLOB_NOMATCH) - { - // pgGlob->gl_pathc will be 0 in this case. We'll check - // the return value to see if an error occurred, so we - // don't want to return an error if we simply didn't match - // anything. - Ret = 0; - } -#endif // GLOB_NOMATCH - - /* Ensure that . and .. are placed in front, and sort the rest */ - qsort(pgGlob->gl_pathv, pgGlob->gl_pathc, sizeof(char*), - FILEGlobQsortCompare); - TRACE("Result of glob() is %d\n", Ret); - - return Ret; -} - - -/*++ -Function: - FILEDosGlobA - -Generate pathnames matching a DOS globbing pattern. This function has a similar -prototype to glob(3), and fulfils the same purpose. However, DOS globbing -is slightly different than Unix in the following ways: - -- '.*' at the end of a pattern means "any file extension, or none at all", -whereas Unix has no concept of file extensions, and will match the '.' like -any other character - -- on Unix, filenames beginning with '.' must be explicitly matched. This is -not true in DOS - -- in DOS, the first two entries (if they match) will be '.' and '..', followed -by all other matching entries sorted in ASCII order. In Unix, all entries are -treated equally, so '+file' would appear before '.' and '..' - -- DOS globbing will fail if any wildcard characters occur before the last path -separator - -This implementation of glob implements the DOS behavior in all these cases, -but otherwise attempts to behave exactly like POSIX glob. The only exception -is its return value -- it returns TRUE if it succeeded (finding matches or -finding no matches but without any error occurring) or FALSE if any error -occurs. It calls SetLastError() if it returns FALSE. - -Sorting doesn't seem to be consistent on all Windows platform, and it's -not required for CoreCLR to have the same sorting algorithm as Windows 2000. -This implementation will give slightly different result for the sort list -than Windows 2000. - ---*/ -static BOOL FILEDosGlobA( CPalThread *pthrCurrent, - const char *pattern, - int flags, - glob_t *pgGlob ) -{ - char Dir[_MAX_DIR]; - char FilenameBuff[_MAX_FNAME + 1]; - char *Filename = FilenameBuff + 1; - char Ext[_MAX_EXT]; - int A, B, C; - BOOL result = TRUE; - int globResult = 0; - - Dir[0] = 0; - FilenameBuff[0] = '.'; - FilenameBuff[1] = 0; - Ext[0] = 0; - - _splitpath_s( pattern, NULL, 0, Dir, _MAX_DIR, Filename, _MAX_FNAME+1, Ext, _MAX_EXT); - - /* check to see if _splitpath_s failed */ - if ( Filename[0] == 0 ) - { - if ( Dir[0] == 0 ) - { - ERROR("_splitpath_s failed on path [%s]\n", pattern); - } - else - { - ERROR("Pattern contains a trailing backslash\n"); - } - SetLastError(ERROR_PATH_NOT_FOUND); - result = FALSE; - goto done; - } - - TRACE("glob pattern [%s] split into [%s][%s][%s]\n", - pattern, Dir, Filename, Ext); - - if ( strchr(Dir, '*') != NULL || strchr(Dir, '?') != NULL ) - { - ERROR("Found wildcard character(s) ('*' and/or '?') before " - "last path separator\n"); - SetLastError(ERROR_PATH_NOT_FOUND); - result = FALSE; - goto done; - } - - /* The meat of the routine happens below. Basically, there are three - special things to check for: - - (A) If the extension is _exactly_ '.*', we will need to do two globs, - one for 'filename.*' and one for 'filename', EXCEPT if (B) the last - character of filename is '*', in which case we can eliminate the - extension altogether, since '*.*' and '*' are the same in DOS. - (C) If the first character of the filename is '*', we need to do - an additional glob for each one we have already done, except with - '.' prepended to the filename of the patterns, because in Unix, - hidden files need to be matched explicitly. - - We can ignore the extension by calling FILEGlobFromSplitPath with - the extension parameter as "", and we can prepend '.' to the - filename by using (Filename - 1), since Filename conveniently points - to the second character of a buffer which happens to have '.' as - its first character. - */ - - A = strncmp(Ext, ".*", 3) == 0; - B = (Filename[strlen(Filename) - 1] == '*'); - C = (*Filename == '*'); - - TRACE("Extension IS%s '.*', filename DOES%s end with '*', " - "and filename DOES%s begin with '*'\n", - A?"":" NOT", B?"":" NOT", C?"":" NOT"); - - if ( !(A && B) ) - { - /* the original pattern */ - globResult = FILEGlobFromSplitPath(Dir, Filename, Ext, 0, pgGlob); - if ( globResult != 0 ) - { - goto done; - } - - if (C) - { - /* the original pattern but '.' prepended to filename */ - globResult = FILEGlobFromSplitPath(Dir, Filename - 1, Ext, - GLOB_APPEND, pgGlob); - if ( globResult != 0 ) - { - goto done; - } - } - } - - if (A) - { - /* if (A && B), this is the first glob() call. The first call - to glob must use flags = 0, while proceeding calls should - set the GLOB_APPEND flag. */ - globResult = FILEGlobFromSplitPath(Dir, Filename, "", - (A && B)?0:GLOB_APPEND, pgGlob); - if ( globResult != 0 ) - { - goto done; - } - - if (C) - { - /* omit the extension and prepend '.' to filename */ - globResult = FILEGlobFromSplitPath(Dir, Filename - 1, "", - GLOB_APPEND, pgGlob); - if ( globResult != 0 ) - { - goto done; - } - } - } - -done: - if (globResult != 0) - { - if (globResult == GLOB_NOSPACE) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - else - { - SetLastError(ERROR_INTERNAL_ERROR); - } - result = FALSE; - } - TRACE("Returning %d\n", result); - return result; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/path.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/path.cpp index 62418b240..671180397 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/path.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/file/path.cpp @@ -23,7 +23,6 @@ Revision History: #include "pal/palinternal.h" #include "pal/dbgmsg.h" #include "pal/file.h" -#include "pal/malloc.hpp" #include "pal/stackstring.hpp" #include diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handleapi.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handleapi.cpp index 90683bc2c..5f08f2fae 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handleapi.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handleapi.cpp @@ -169,14 +169,8 @@ CorUnix::InternalDuplicateHandle( goto InternalDuplicateHandleExit; } - /* Since handles can be remoted to others processes using PAL_LocalHsndleToRemote - and PAL_RemoteHandleToLocal, DuplicateHandle needs some special handling - when this scenario occurs. - - if hSourceProcessHandle is from another process OR - hTargetProcessHandle is from another process but both aren't - ( handled above ) return hSourceHandle. - */ + // Handles can't be remoted cross-process. + // Just return the same handle. if (source_process_id != cur_process_id || target_process_id != cur_process_id) { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handlemgr.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handlemgr.cpp index 09405f1ec..da7d72036 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handlemgr.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/handlemgr/handlemgr.cpp @@ -19,8 +19,6 @@ Module Name: #include "pal/thread.hpp" #include "pal/handlemgr.hpp" -#include "pal/cs.hpp" -#include "pal/malloc.hpp" #include "pal/dbgmsg.h" using namespace CorUnix; @@ -42,7 +40,7 @@ CSimpleHandleManager::Initialize( { PAL_ERROR palError = NO_ERROR; - InternalInitializeCriticalSection(&m_csLock); + minipal_mutex_init(&m_mtxLock); m_fLockInitialized = TRUE; m_dwTableGrowthRate = c_BasicGrowthRate; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/context.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/context.h index 932b40c52..2f5310c4d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/context.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/context.h @@ -33,7 +33,9 @@ extern "C" /* A type to wrap the native context type, which is ucontext_t on some * platforms and another type elsewhere. */ #if HAVE_UCONTEXT_T +#if HAVE_UCONTEXT_H #include +#endif // HAVE_UCONTEXT_H typedef ucontext_t native_context_t; #else // HAVE_UCONTEXT_T @@ -58,9 +60,10 @@ using asm_sigcontext::_xstate; #if defined(XSTATE_SUPPORTED) || (defined(HOST_AMD64) && defined(HAVE_MACH_EXCEPTIONS)) bool Xstate_IsAvx512Supported(); +bool Xstate_IsApxSupported(); #endif // XSTATE_SUPPORTED || (HOST_AMD64 && HAVE_MACH_EXCEPTIONS) -#if defined(HOST_64BIT) && defined(HOST_ARM64) && !defined(TARGET_FREEBSD) && !defined(TARGET_OSX) +#if defined(HOST_64BIT) && defined(HOST_ARM64) && !defined(TARGET_FREEBSD) && !defined(__APPLE__) #if !defined(SVE_MAGIC) // Add the missing SVE defines @@ -142,7 +145,7 @@ struct sve_context { (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq)) #endif // SVE_MAGIC -#endif // HOST_64BIT && HOST_ARM64 && !TARGET_FREEBSD && !TARGET_OSX +#endif // HOST_64BIT && HOST_ARM64 && !TARGET_FREEBSD && !__APPLE__ #ifdef HOST_S390X @@ -206,6 +209,11 @@ struct sve_context { #define MCREG_Xer(mc) ((mc).gp_regs[37]) #define MCREG_Ccr(mc) ((mc).gp_regs[38]) +#elif defined(HOST_WASM) + +#define MCREG_Sp(mc) 0 +#define MCREG_Pc(mc) 0 + #elif HAVE___GREGSET_T #ifdef HOST_64BIT @@ -467,6 +475,14 @@ struct sve_context { #define XFEATURE_MASK_AVX512 (XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | XFEATURE_MASK_Hi16_ZMM) #endif // XFEATURE_MASK_AVX512 +#ifndef XSTATE_APX +#define XSTATE_APX 19 +#endif // XSTATE_APX + +#ifndef XFEATURE_MASK_APX +#define XFEATURE_MASK_APX (1 << XSTATE_APX) +#endif // XFEATURE_MASK_APX + #if HAVE__FPX_SW_BYTES_WITH_XSTATE_BV #define FPREG_FpxSwBytes_xfeatures(uc) FPREG_FpxSwBytes(uc)->xstate_bv #else @@ -489,7 +505,7 @@ struct Xstate_ExtendedFeature uint32_t size; }; -#define Xstate_ExtendedFeatures_Count (XSTATE_AVX512_ZMM + 1) +#define Xstate_ExtendedFeatures_Count (XSTATE_APX + 1) extern Xstate_ExtendedFeature Xstate_ExtendedFeatures[Xstate_ExtendedFeatures_Count]; inline _fpx_sw_bytes *FPREG_FpxSwBytes(const ucontext_t *uc) @@ -626,6 +642,27 @@ inline void *FPREG_Xstate_Hi16Zmm(const ucontext_t *uc, uint32_t *featureSize) _ASSERTE(FPREG_HasAvx512Registers(uc)); return FPREG_Xstate_ExtendedFeature(uc, featureSize, XSTATE_AVX512_ZMM); } + +inline bool FPREG_HasApxRegisters(const ucontext_t *uc) +{ + if (!FPREG_HasExtendedState(uc)) + { + return false; + } + + if ((FPREG_FpxSwBytes_xfeatures(uc) & XFEATURE_MASK_APX) != XFEATURE_MASK_APX) + { + return false; + } + + return Xstate_IsApxSupported(); +} + +inline void *FPREG_Xstate_Egpr(const ucontext_t *uc, uint32_t *featureSize) +{ + _ASSERTE(FPREG_HasApxRegisters(uc)); + return FPREG_Xstate_ExtendedFeature(uc, featureSize, XSTATE_APX); +} #endif // XSTATE_SUPPORTED && HOST_AMD64 ///////////////////// @@ -708,7 +745,7 @@ const struct fpregs* GetConstNativeSigSimdContext(const native_context_t *mc) return GetNativeSigSimdContext(const_cast(mc)); } -#elif !defined(TARGET_OSX) // TARGET_FREEBSD +#elif !defined(__APPLE__) // TARGET_FREEBSD #define MCREG_X0(mc) ((mc).regs[0]) #define MCREG_X1(mc) ((mc).regs[1]) @@ -760,7 +797,7 @@ void GetConstNativeSigSimdContext(const native_context_t *mc, fpsimd_context con GetNativeSigSimdContext(const_cast(mc), const_cast(fp_ptr), const_cast(sve_ptr)); } -#else // TARGET_OSX +#else // __APPLE__ #define MCREG_X0(mc) ((mc)->__ss.__x[0]) #define MCREG_X1(mc) ((mc)->__ss.__x[1]) @@ -810,7 +847,7 @@ const _STRUCT_ARM_NEON_STATE64* GetConstNativeSigSimdContext(const native_contex return GetNativeSigSimdContext(const_cast(mc)); } -#endif // TARGET_OSX +#endif // __APPLE__ #elif defined(HOST_LOONGARCH64) @@ -850,7 +887,7 @@ const _STRUCT_ARM_NEON_STATE64* GetConstNativeSigSimdContext(const native_contex #else // HOST_ARM64 -#ifdef TARGET_OSX +#ifdef __APPLE__ #define MCREG_Rbp(mc) ((mc)->__ss.__rbp) #define MCREG_Rip(mc) ((mc)->__ss.__rip) @@ -935,7 +972,42 @@ inline void *FPREG_Xstate_Hi16Zmm(const ucontext_t *uc, uint32_t *featureSize) *featureSize = sizeof(_STRUCT_ZMM_REG) * 16; return reinterpret_cast(&((_STRUCT_X86_AVX512_STATE64&)FPSTATE(uc)).__fpu_zmm16); } -#else //TARGET_OSX +#elif defined(TARGET_HAIKU) + +#define MCREG_Rbp(mc) ((mc).rbp) +#define MCREG_Rip(mc) ((mc).rip) +#define MCREG_Rsp(mc) ((mc).rsp) +#define MCREG_Rsi(mc) ((mc).rsi) +#define MCREG_Rdi(mc) ((mc).rdi) +#define MCREG_Rbx(mc) ((mc).rbx) +#define MCREG_Rdx(mc) ((mc).rdx) +#define MCREG_Rcx(mc) ((mc).rcx) +#define MCREG_Rax(mc) ((mc).rax) +#define MCREG_R8(mc) ((mc).r8) +#define MCREG_R9(mc) ((mc).r9) +#define MCREG_R10(mc) ((mc).r10) +#define MCREG_R11(mc) ((mc).r11) +#define MCREG_R12(mc) ((mc).r12) +#define MCREG_R13(mc) ((mc).r13) +#define MCREG_R14(mc) ((mc).r14) +#define MCREG_R15(mc) ((mc).r15) +#define MCREG_EFlags(mc) ((mc).rflags) +// Haiku: missing SegCs + +#define FPSTATE(uc) ((uc)->uc_mcontext.fpu) +#define FPREG_ControlWord(uc) FPSTATE(uc).fp_fxsave.control +#define FPREG_StatusWord(uc) FPSTATE(uc).fp_fxsave.status +#define FPREG_TagWord(uc) FPSTATE(uc).fp_fxsave.tag +#define FPREG_MxCsr(uc) FPSTATE(uc).fp_fxsave.mxcsr +#define FPREG_MxCsr_Mask(uc) FPSTATE(uc).fp_fxsave.mxcsr_mask +#define FPREG_ErrorOffset(uc) *(DWORD*) &(FPSTATE(uc).fp_fxsave.rip) +#define FPREG_ErrorSelector(uc) *((WORD*) &(FPSTATE(uc).fp_fxsave.rip) + 2) +#define FPREG_DataOffset(uc) *(DWORD*) &(FPSTATE(uc).fp_fxsave.rdp) +#define FPREG_DataSelector(uc) *((WORD*) &(FPSTATE(uc).fp_fxsave.rdp) + 2) + +#define FPREG_Xmm(uc, index) *(M128A*) &(FPSTATE(uc).fp_fxsave.xmm[index]) +#define FPREG_St(uc, index) *(M128A*) &(FPSTATE(uc).fp_fxsave.fp[index].value) +#else //__APPLE__ // For FreeBSD, as found in x86/ucontext.h #define MCREG_Rbp(mc) ((mc).mc_rbp) @@ -972,7 +1044,7 @@ inline void *FPREG_Xstate_Hi16Zmm(const ucontext_t *uc, uint32_t *featureSize) #define FPREG_Xmm(uc, index) *(M128A*) &(FPSTATE(uc)->sv_xmm[index]) #define FPREG_St(uc, index) *(M128A*) &(FPSTATE(uc)->sv_fp[index].fp_acc) -#endif // TARGET_OSX +#endif // __APPLE__ #endif // HOST_ARM64 #else // HOST_64BIT @@ -1322,6 +1394,9 @@ inline static DWORD64 CONTEXTGetPC(LPCONTEXT pContext) return pContext->PSWAddr; #elif defined(HOST_POWERPC64) return pContext->Nip; +#elif defined(HOST_WASM) // wasm has no PC + _ASSERT(false); + return 0; #else return pContext->Pc; #endif @@ -1337,6 +1412,8 @@ inline static void CONTEXTSetPC(LPCONTEXT pContext, DWORD64 pc) pContext->PSWAddr = pc; #elif defined(HOST_POWERPC64) pContext->Nip = pc; +#elif defined(HOST_WASM) // wasm has no PC + _ASSERT(false); #else pContext->Pc = pc; #endif @@ -1354,6 +1431,9 @@ inline static DWORD64 CONTEXTGetFP(LPCONTEXT pContext) return pContext->R11; #elif defined(HOST_POWERPC64) return pContext->R31; +#elif defined(HOST_WASM) // wasm has no PC + _ASSERT(false); + return 0; #else return pContext->Fp; #endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/corunix.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/corunix.hpp index 539b98b58..7e606980d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/corunix.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/corunix.hpp @@ -132,14 +132,6 @@ namespace CorUnix // type when: // 1) The object's refcount drops to 0 // 2) A process is shutting down - // 3) A process has released all local references to the object - // - // The cleanup routine must only cleanup the object's shared state - // when the last parameter (fCleanupSharedSate) is TRUE. When - // fCleanupSharedState is FALSE the cleanup routine must not attempt - // to access the shared data for the object, as another process may - // have already deleted it. ($$REIVEW -- would someone ever need access - // to the shared data in order to cleanup process local state?) // // When the third parameter (fShutdown) is TRUE the process is in // the act of exiting. The cleanup routine should not perform any @@ -151,25 +143,7 @@ namespace CorUnix typedef void (*OBJECTCLEANUPROUTINE) ( CPalThread *, // pThread IPalObject *, // pObjectToCleanup - bool, // fShutdown - bool // fCleanupSharedState - ); - - // - // Signature of the initialization routine that is to be called - // when the first reference within a process to an existing - // object comes into existence. This routine is responsible for - // initializing the object's process local data, based on the - // immutable and shared data. The thread that this routine is - // called on holds an implicit read lock on the shared data. - // - - typedef PAL_ERROR (*OBJECTINITROUTINE) ( - CPalThread *, // pThread - CObjectType *, // pObjectType - void *, // pImmutableData - void *, // pSharedData - void * // pProcessLocalData + bool // fShutdown ); typedef void (*OBJECT_IMMUTABLE_DATA_COPY_ROUTINE) ( @@ -215,24 +189,6 @@ namespace CorUnix // supported generic access rights (e.g., GENERIC_READ) map to the // specific access rights for this object type. // - // If instances of this object may have a security descriptor set on - // them eSecuritySupport should be set to SecuritySupported. If the OS can - // persist security information for the object type (as would be the case - // for, say, files) eSecurityPersistence should be set to - // OSPersistedSecurityInfo. - // - // If the object may have a name eObjectNameSupport should be - // ObjectCanHaveName. A named object can be opened in more than one - // process. - // - // If it is possible to duplicate a handle to an object across process - // boundaries then eHandleDuplicationSupport should be set to - // CrossProcessDuplicationAllowed. Note that it is possible to have - // an object type where eObjectNameSupport is ObjectCanHaveName and - // eHandleDuplicationSupport is LocalDuplicationOnly. For these object - // types an unnamed object instance will only have references from - // the creating process. - // // If the object may be waited on eSynchronizationSupport should be // WaitableObject. (Note that this implies that object type supports // the SYNCHRONIZE access right.) @@ -258,31 +214,6 @@ namespace CorUnix class CObjectType { public: - - enum SecuritySupport - { - SecuritySupported, - SecurityNotSupported - }; - - enum SecurityPersistence - { - OSPersistedSecurityInfo, - SecurityInfoNotPersisted - }; - - enum ObjectNameSupport - { - ObjectCanHaveName, - UnnamedObject - }; - - enum HandleDuplicationSupport - { - CrossProcessDuplicationAllowed, - LocalDuplicationOnly - }; - enum SynchronizationSupport { WaitableObject, @@ -321,19 +252,12 @@ namespace CorUnix PalObjectTypeId m_eTypeId; OBJECTCLEANUPROUTINE m_pCleanupRoutine; - OBJECTINITROUTINE m_pInitRoutine; DWORD m_dwImmutableDataSize; OBJECT_IMMUTABLE_DATA_COPY_ROUTINE m_pImmutableDataCopyRoutine; OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE m_pImmutableDataCleanupRoutine; DWORD m_dwProcessLocalDataSize; OBJECT_PROCESS_LOCAL_DATA_CLEANUP_ROUTINE m_pProcessLocalDataCleanupRoutine; - DWORD m_dwSharedDataSize; - DWORD m_dwSupportedAccessRights; // Generic access rights mapping - SecuritySupport m_eSecuritySupport; - SecurityPersistence m_eSecurityPersistence; - ObjectNameSupport m_eObjectNameSupport; - HandleDuplicationSupport m_eHandleDuplicationSupport; SynchronizationSupport m_eSynchronizationSupport; SignalingSemantics m_eSignalingSemantics; ThreadReleaseSemantics m_eThreadReleaseSemantics; @@ -344,18 +268,11 @@ namespace CorUnix CObjectType( PalObjectTypeId eTypeId, OBJECTCLEANUPROUTINE pCleanupRoutine, - OBJECTINITROUTINE pInitRoutine, DWORD dwImmutableDataSize, OBJECT_IMMUTABLE_DATA_COPY_ROUTINE pImmutableDataCopyRoutine, OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE pImmutableDataCleanupRoutine, DWORD dwProcessLocalDataSize, OBJECT_PROCESS_LOCAL_DATA_CLEANUP_ROUTINE pProcessLocalDataCleanupRoutine, - DWORD dwSharedDataSize, - DWORD dwSupportedAccessRights, - SecuritySupport eSecuritySupport, - SecurityPersistence eSecurityPersistence, - ObjectNameSupport eObjectNameSupport, - HandleDuplicationSupport eHandleDuplicationSupport, SynchronizationSupport eSynchronizationSupport, SignalingSemantics eSignalingSemantics, ThreadReleaseSemantics eThreadReleaseSemantics, @@ -364,18 +281,11 @@ namespace CorUnix : m_eTypeId(eTypeId), m_pCleanupRoutine(pCleanupRoutine), - m_pInitRoutine(pInitRoutine), m_dwImmutableDataSize(dwImmutableDataSize), m_pImmutableDataCopyRoutine(pImmutableDataCopyRoutine), m_pImmutableDataCleanupRoutine(pImmutableDataCleanupRoutine), m_dwProcessLocalDataSize(dwProcessLocalDataSize), m_pProcessLocalDataCleanupRoutine(pProcessLocalDataCleanupRoutine), - m_dwSharedDataSize(dwSharedDataSize), - m_dwSupportedAccessRights(dwSupportedAccessRights), - m_eSecuritySupport(eSecuritySupport), - m_eSecurityPersistence(eSecurityPersistence), - m_eObjectNameSupport(eObjectNameSupport), - m_eHandleDuplicationSupport(eHandleDuplicationSupport), m_eSynchronizationSupport(eSynchronizationSupport), m_eSignalingSemantics(eSignalingSemantics), m_eThreadReleaseSemantics(eThreadReleaseSemantics), @@ -409,14 +319,6 @@ namespace CorUnix return m_pCleanupRoutine; }; - OBJECTINITROUTINE - GetObjectInitRoutine( - void - ) - { - return m_pInitRoutine; - }; - DWORD GetImmutableDataSize( void @@ -473,56 +375,8 @@ namespace CorUnix return m_pProcessLocalDataCleanupRoutine; } - DWORD - GetSharedDataSize( - void - ) - { - return m_dwSharedDataSize; - }; - - DWORD - GetSupportedAccessRights( - void - ) - { - return m_dwSupportedAccessRights; - }; - // Generic access rights mapping - SecuritySupport - GetSecuritySupport( - void - ) - { - return m_eSecuritySupport; - }; - - SecurityPersistence - GetSecurityPersistence( - void - ) - { - return m_eSecurityPersistence; - }; - - ObjectNameSupport - GetObjectNameSupport( - void - ) - { - return m_eObjectNameSupport; - }; - - HandleDuplicationSupport - GetHandleDuplicationSupport( - void - ) - { - return m_eHandleDuplicationSupport; - }; - SynchronizationSupport GetSynchronizationSupport( void @@ -815,24 +669,6 @@ namespace CorUnix ) = 0; }; - // - // The following two enums are part of the local object - // optimizations - // - - enum ObjectDomain - { - ProcessLocalObject, - SharedObject - }; - - enum WaitDomain - { - LocalWait, // All objects in the wait set are local to this process - MixedWait, // Some objects are local; some are shared - SharedWait // All objects in the wait set are shared - }; - class IPalObject { public: @@ -872,15 +708,6 @@ namespace CorUnix void **ppvProcessLocalData // OUT ) = 0; - virtual - PAL_ERROR - GetSharedData( - CPalThread *pThread, // IN, OPTIONAL - LockType eLockRequest, - IDataLock **ppDataLock, // OUT - void **ppvSharedData // OUT - ) = 0; - // // The following two routines obtain the global dispatcher lock. // If a thread needs to make use of a synchronization interface @@ -928,18 +755,6 @@ namespace CorUnix CPalThread *pThread ) = 0; - // - // This routine is mainly intended for the synchronization - // manager. The promotion / process synch lock must be held - // before calling this routine. - // - - virtual - ObjectDomain - GetObjectDomain( - void - ) = 0; - // // This routine is only for use by the synchronization manager // (specifically, for GetSynch*ControllersForObjects). The @@ -1161,10 +976,6 @@ namespace CorUnix CPalThread *pThread ) = 0; - virtual - PAL_ERROR - SendTerminationRequestToWorkerThread() = 0; - // // This routine is primarily meant for use by WaitForMultipleObjects[Ex]. // The caller must individually release each of the returned controller @@ -1200,7 +1011,6 @@ namespace CorUnix PAL_ERROR AllocateObjectSynchData( CObjectType *pObjectType, - ObjectDomain eObjectDomain, VOID **ppvSynchData // OUT ) = 0; @@ -1208,18 +1018,9 @@ namespace CorUnix void FreeObjectSynchData( CObjectType *pObjectType, - ObjectDomain eObjectDomain, VOID *pvSynchData ) = 0; - virtual - PAL_ERROR - PromoteObjectSynchData( - CPalThread *pThread, - VOID *pvLocalSynchData, - VOID **ppvSharedSynchData // OUT - ) = 0; - // // The next two routines provide access to the process-wide // synchronization lock @@ -1248,7 +1049,6 @@ namespace CorUnix CPalThread *pThread, // IN, OPTIONAL CObjectType *pObjectType, VOID *pvSynchData, - ObjectDomain eObjectDomain, ISynchStateController **ppStateController // OUT ) = 0; @@ -1258,7 +1058,6 @@ namespace CorUnix CPalThread *pThread, // IN, OPTIONAL CObjectType *pObjectType, VOID *pvSynchData, - ObjectDomain eObjectDomain, ISynchWaitController **ppWaitController // OUT ) = 0; }; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/critsect.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/critsect.h deleted file mode 100644 index c14baf20a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/critsect.h +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - include/pal/critsect.h - -Abstract: - - Header file for the critical sections functions. - - - ---*/ - -#ifndef _PAL_CRITSECT_H_ -#define _PAL_CRITSECT_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -VOID InternalInitializeCriticalSection(CRITICAL_SECTION *pcs); -VOID InternalDeleteCriticalSection(CRITICAL_SECTION *pcs); - -/* The following PALCEnterCriticalSection and PALCLeaveCriticalSection - functions are intended to provide CorUnix's InternalEnterCriticalSection - and InternalLeaveCriticalSection functionalities to legacy C code, - which has no knowledge of CPalThread, classes and namespaces. -*/ -VOID PALCEnterCriticalSection(CRITICAL_SECTION *pcs); -VOID PALCLeaveCriticalSection(CRITICAL_SECTION *pcs); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif /* _PAL_CRITSECT_H_ */ - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/cs.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/cs.hpp deleted file mode 100644 index cb374ffa1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/cs.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/////////////////////////////////////////////////////////////////////////////// -// -// File: -// cs.cpp -// -// Purpose: -// Header file for critical sections implementation -// - -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _PAL_CS_HPP -#define _PAL_CS_HPP - -#include "corunix.hpp" -#include "critsect.h" - -namespace CorUnix -{ - void CriticalSectionSubSysInitialize(void); - - void InternalInitializeCriticalSectionAndSpinCount( - PCRITICAL_SECTION pCriticalSection, - DWORD dwSpinCount, - bool fInternal); - - void InternalEnterCriticalSection( - CPalThread *pThread, - CRITICAL_SECTION *pcs - ); - - void InternalLeaveCriticalSection( - CPalThread *pThread, - CRITICAL_SECTION *pcs - ); - -#ifdef _DEBUG - void PALCS_ReportStatisticalData(void); - void PALCS_DumpCSList(); -#endif // _DEBUG - -} - -#endif // _PAL_CS_HPP - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/dbgmsg.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/dbgmsg.h index ca8d1454d..0d0c5e4ae 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/dbgmsg.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/dbgmsg.h @@ -494,7 +494,7 @@ if new_level is -1, the nesting level will not be modified --*/ int DBG_change_entrylevel(int new_level); -#ifdef __APPLE__ +#ifdef TARGET_OSX /*++ Function : PAL_DisplayDialog @@ -514,10 +514,10 @@ Function : --*/ void PAL_DisplayDialogFormatted(const char *szTitle, const char *szTextFormat, ...); -#else // __APPLE__ +#else // TARGET_OSX #define PAL_DisplayDialog(_szTitle, _szText) #define PAL_DisplayDialogFormatted(_szTitle, _szTextFormat, args...) -#endif // __APPLE__ +#endif // TARGET_OSX #ifdef __cplusplus } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/environ.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/environ.h index 226279c04..14262470c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/environ.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/environ.h @@ -18,6 +18,8 @@ Module Name: #ifndef __ENVIRON_H_ #define __ENVIRON_H_ +#include + #ifdef __cplusplus extern "C" { @@ -32,7 +34,7 @@ Variables : gcsEnvironment: critical section to synchronize access to palEnvironment --*/ extern char **palEnvironment; -extern CRITICAL_SECTION gcsEnvironment; +extern minipal_mutex gcsEnvironment; /*++ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/file.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/file.h index 0ec765317..2598b664d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/file.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/file.h @@ -21,7 +21,6 @@ Revision History: #ifndef _PAL_FILE_H_ #define _PAL_FILE_H_ -#include "pal/shmemory.h" #include "pal/stackstring.hpp" #include #include diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/filetime.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/filetime.h index cf177058b..efbe99828 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/filetime.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/filetime.h @@ -27,40 +27,6 @@ extern "C" { #endif // __cplusplus -/* Provide consistent access to nanosecond fields, if they exist. */ - -#if HAVE_STAT_TIMESPEC - -#define ST_ATIME_NSEC(statstruct) ((statstruct)->st_atimespec.tv_nsec) -#define ST_MTIME_NSEC(statstruct) ((statstruct)->st_mtimespec.tv_nsec) -#define ST_CTIME_NSEC(statstruct) ((statstruct)->st_ctimespec.tv_nsec) - -#else /* HAVE_STAT_TIMESPEC */ - -#if HAVE_STAT_TIM - -#define ST_ATIME_NSEC(statstruct) ((statstruct)->st_atim.tv_nsec) -#define ST_MTIME_NSEC(statstruct) ((statstruct)->st_mtim.tv_nsec) -#define ST_CTIME_NSEC(statstruct) ((statstruct)->st_ctim.tv_nsec) - -#else /* HAVE_STAT_TIM */ - -#if HAVE_STAT_NSEC - -#define ST_ATIME_NSEC(statstruct) ((statstruct)->st_atimensec) -#define ST_MTIME_NSEC(statstruct) ((statstruct)->st_mtimensec) -#define ST_CTIME_NSEC(statstruct) ((statstruct)->st_ctimensec) - -#else /* HAVE_STAT_NSEC */ - -#define ST_ATIME_NSEC(statstruct) 0 -#define ST_MTIME_NSEC(statstruct) 0 -#define ST_CTIME_NSEC(statstruct) 0 - -#endif /* HAVE_STAT_NSEC */ -#endif /* HAVE_STAT_TIM */ -#endif /* HAVE_STAT_TIMESPEC */ - FILETIME FILEUnixTimeToFileTime( time_t sec, long nsec ); #ifdef __cplusplus diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/handlemgr.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/handlemgr.hpp index 94b40e72c..1e00a6473 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/handlemgr.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/handlemgr.hpp @@ -22,10 +22,8 @@ Module Name: #include "corunix.hpp" -#include "cs.hpp" #include "pal/thread.hpp" -#include "pal/malloc.hpp" - +#include /* Pseudo handles constant for current thread and process */ extern const HANDLE hPseudoCurrentProcess; @@ -73,7 +71,7 @@ namespace CorUnix DWORD m_dwTableGrowthRate; HANDLE_TABLE_ENTRY* m_rghteHandleTable; - CRITICAL_SECTION m_csLock; + minipal_mutex m_mtxLock; bool m_fLockInitialized; bool ValidateHandle(HANDLE h); @@ -96,7 +94,7 @@ namespace CorUnix { if (m_fLockInitialized) { - DeleteCriticalSection(&m_csLock); + minipal_mutex_destroy(&m_mtxLock); } if (NULL != m_rghteHandleTable) @@ -139,7 +137,7 @@ namespace CorUnix CPalThread *pThread ) { - InternalEnterCriticalSection(pThread, &m_csLock); + minipal_mutex_enter(&m_mtxLock); }; void @@ -147,7 +145,7 @@ namespace CorUnix CPalThread *pThread ) { - InternalLeaveCriticalSection(pThread, &m_csLock); + minipal_mutex_leave(&m_mtxLock); }; }; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/malloc.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/malloc.hpp deleted file mode 100644 index 65715fa93..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/malloc.hpp +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - pal/malloc.hpp - -Abstract: - Declarations for suspension safe memory allocation functions - - - ---*/ - -#ifndef _MALLOC_HPP -#define _MALLOC_HPP - -#include "pal/corunix.hpp" -#include "pal/thread.hpp" - -#include -#include -#include - -namespace CorUnix{ - // Define "new" style allocators (which allocate then call a constructor). - template - T* InternalNew(Ts... args) - { - T* pMem = (T*)malloc(sizeof(T)); - - if (pMem == NULL) - return NULL; - - return new (pMem) T(args...); - } - - template T* InternalNewArray(size_t cElements) - { - size_t cbSize = (cElements * sizeof(T)) + sizeof(size_t); - T *pMem; - - pMem = (T*)malloc(cbSize); - - if (pMem == NULL) - return NULL; - - *(size_t*)pMem = cElements; - pMem = (T*)((size_t*)pMem + 1); - - return new (pMem) T[cElements](); - } - - template void InternalDelete(T *p) - { - if (p) - { - p->~T(); - free(p); - } - } - - template void InternalDeleteArray(T *p) - { - if (p) - { - size_t *pRealMem = (size_t*)p - 1; - size_t cElements = *pRealMem; - for (size_t i = 0; i < cElements; i++) - p[i].~T(); - free(pRealMem); - } - } -} - -#endif // _MALLOC_HPP diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/misc.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/misc.h deleted file mode 100644 index ffa6448ed..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/misc.h +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - include/pal/misc.h - -Abstract: - Header file for the initialization and clean up functions - for the misc Win32 functions - - - ---*/ - -#ifndef __MISC_H_ -#define __MISC_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -/*++ -Function : - MsgBoxInitialize - - Initialize the critical sections. - -Return value: - TRUE if initialize succeeded - FALSE otherwise - ---*/ -BOOL MsgBoxInitialize( void ); - -/*++ -Function : - MsgBoxCleanup - - Deletes the critical sections. - ---*/ -void MsgBoxCleanup( void ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif /* __MISC_H_ */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/mutex.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/mutex.hpp index 016668daf..9ff179ca4 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/mutex.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/mutex.hpp @@ -37,6 +37,7 @@ namespace CorUnix LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName, + BOOL bCurrentUserOnly, HANDLE *phMutex ); @@ -51,6 +52,7 @@ namespace CorUnix SharedMemorySystemCallErrors *errors, CPalThread *pThread, LPCSTR lpName, + BOOL bCurrentUserOnly, HANDLE *phMutex ); @@ -216,10 +218,10 @@ class NamedMutexProcessData : public SharedMemoryProcessDataBase bool m_hasRefFromLockOwnerThread; public: - static SharedMemoryProcessDataHeader *CreateOrOpen(SharedMemorySystemCallErrors *errors, LPCSTR name, bool acquireLockIfCreated, bool *createdRef); - static SharedMemoryProcessDataHeader *Open(SharedMemorySystemCallErrors *errors, LPCSTR name); + static SharedMemoryProcessDataHeader *CreateOrOpen(SharedMemorySystemCallErrors *errors, LPCSTR name, bool isUserScope, bool acquireLockIfCreated, bool *createdRef); + static SharedMemoryProcessDataHeader *Open(SharedMemorySystemCallErrors *errors, LPCSTR name, bool isUserScope); private: - static SharedMemoryProcessDataHeader *CreateOrOpen(SharedMemorySystemCallErrors *errors, LPCSTR name, bool createIfNotExist, bool acquireLockIfCreated, bool *createdRef); + static SharedMemoryProcessDataHeader *CreateOrOpen(SharedMemorySystemCallErrors *errors, LPCSTR name, bool isUserScope, bool createIfNotExist, bool acquireLockIfCreated, bool *createdRef); public: NamedMutexProcessData( diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/palinternal.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/palinternal.h index 3fa16f38c..603ea73b0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/palinternal.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/palinternal.h @@ -157,10 +157,6 @@ function_name() to call the system's implementation the header */ #include -#ifdef PAL_PERF -#include "pal_perf.h" -#endif - #ifdef __record_type_class #undef __record_type_class #endif @@ -168,6 +164,7 @@ function_name() to call the system's implementation #undef __real_type_class #endif +#include #include "pal.h" #include "palprivate.h" @@ -193,8 +190,6 @@ function_name() to call the system's implementation #undef sigsetjmp #undef siglongjmp -#undef _SIZE_T_DEFINED - #define _DONT_USE_CTYPE_INLINE_ #if HAVE_RUNETYPE_H #include @@ -256,11 +251,11 @@ extern "C" typedef enum _TimeConversionConstants { - tccSecondsToMillieSeconds = 1000, // 10^3 + tccSecondsToMilliSeconds = 1000, // 10^3 tccSecondsToMicroSeconds = 1000000, // 10^6 tccSecondsToNanoSeconds = 1000000000, // 10^9 - tccMillieSecondsToMicroSeconds = 1000, // 10^3 - tccMillieSecondsToNanoSeconds = 1000000, // 10^6 + tccMilliSecondsToMicroSeconds = 1000, // 10^3 + tccMilliSecondsToNanoSeconds = 1000000, // 10^6 tccMicroSecondsToNanoSeconds = 1000, // 10^3 tccSecondsTo100NanoSeconds = 10000000, // 10^7 tccMicroSecondsTo100NanoSeconds = 10 // 10^1 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/perftrace.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/perftrace.h index 363709aa1..bf0c361de 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/perftrace.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/perftrace.h @@ -24,45 +24,10 @@ Overview of PAL Performance utilities #ifndef _PAL_PERFTRACE_H_ #define _PAL_PERFTRACE_H_ -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -#if PAL_PERF -#define PERF_ENTRY(x) \ - ULONGLONG pal_perf_start_tick = 0;\ - PERFLogFunctionEntry( PAL_PERF_##x, &pal_perf_start_tick ) -#define PERF_EXIT(x) \ - PERFLogFunctionExit( PAL_PERF_##x, &pal_perf_start_tick ) -#define PERF_ENTRY_ONLY(x) \ - PERFNoLatencyProfileEntry( PAL_PERF_##x ) - -BOOL PERFInitialize(LPWSTR command_line, LPWSTR exe_path) ; -void PERFTerminate( ); -BOOL PERFAllocThreadInfo( ); -void PERFLogFunctionExit(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick); -void PERFLogFunctionEntry(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick); -void PERFEnableThreadProfile(BOOL isInternal); -void PERFDisableThreadProfile(BOOL isInternal); -void PERFEnableProcessProfile( ); -void PERFDisableProcessProfile( ); -BOOL PERFIsProcessProfileEnabled( ); -void PERFNoLatencyProfileEntry(unsigned int pal_api_id ); -void PERFCalibrate(const char* msg); - -#else /* PAL_PERF */ - #define PERF_ENTRY(x) #define PERF_ENTRY_ONLY(x) #define PERF_EXIT(x) -#endif /* PAL_PERF */ - -#ifdef __cplusplus -} -#endif // __cplusplus - #endif /* _PAL_PERFTRACE_H_ */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/printfcpp.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/printfcpp.hpp deleted file mode 100644 index 44526cb8a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/printfcpp.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - pal/printfcpp.hpp - -Abstract: - Declarations for suspension safe memory allocation functions - - - ---*/ - -#ifndef _PRINTFCPP_HPP -#define _PRINTFCPP_HPP - -#ifdef __cplusplus -#include "pal/threadinfo.hpp" -#endif - -#include - -#ifdef __cplusplus -typedef char16_t wchar_16; // __wchar_16_cpp (which is defined in palinternal.h) needs to be redefined to wchar_16. -extern "C" -{ -#endif // __cplusplus - - int - __cdecl - PAL_vfprintf( - PAL_FILE *stream, - const char *format, - va_list ap); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _PRINTFCPP_HPP - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.h index fce6d2859..84a35d2b2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.h @@ -27,27 +27,26 @@ #define SHARED_MEMORY_MAX_FILE_NAME_CHAR_COUNT (_MAX_FNAME - 1) #define SHARED_MEMORY_MAX_NAME_CHAR_COUNT (STRING_LENGTH("Global\\") + SHARED_MEMORY_MAX_FILE_NAME_CHAR_COUNT) -#define SHARED_MEMORY_RUNTIME_TEMP_DIRECTORY_NAME ".dotnet" -#define SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME ".dotnet/shm" -#define SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME ".dotnet/lockfiles" -static_assert_no_msg(ARRAY_SIZE(SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME) >= ARRAY_SIZE(SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME)); +#define SHARED_MEMORY_USER_UNSCOPED_RUNTIME_TEMP_DIRECTORY_NAME ".dotnet" +#define SHARED_MEMORY_USER_SCOPED_RUNTIME_TEMP_DIRECTORY_NAME_PREFIX ".dotnet-uid" +#define SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME "shm" +#define SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME "lockfiles" +static_assert_no_msg(STRING_LENGTH(SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME) >= STRING_LENGTH(SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME)); #define SHARED_MEMORY_GLOBAL_DIRECTORY_NAME "global" #define SHARED_MEMORY_SESSION_DIRECTORY_NAME_PREFIX "session" -static_assert_no_msg(ARRAY_SIZE(SHARED_MEMORY_SESSION_DIRECTORY_NAME_PREFIX) >= ARRAY_SIZE(SHARED_MEMORY_GLOBAL_DIRECTORY_NAME)); -#define SHARED_MEMORY_UNIQUE_TEMP_NAME_TEMPLATE ".coreclr.XXXXXX" - -#define SHARED_MEMORY_MAX_SESSION_ID_CHAR_COUNT (10) +#define SHARED_MEMORY_UNIQUE_TEMP_NAME_TEMPLATE ".dotnet.XXXXXX" // Note that this Max size does not include the prefix folder path size which is unknown (in the case of sandbox) until runtime #define SHARED_MEMORY_MAX_FILE_PATH_CHAR_COUNT \ ( \ + STRING_LENGTH(SHARED_MEMORY_USER_SCOPED_RUNTIME_TEMP_DIRECTORY_NAME_PREFIX) + \ + 11 /* user ID, path separator */ + \ STRING_LENGTH(SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME) + \ 1 /* path separator */ + \ STRING_LENGTH(SHARED_MEMORY_SESSION_DIRECTORY_NAME_PREFIX) + \ - SHARED_MEMORY_MAX_SESSION_ID_CHAR_COUNT + \ - 1 /* path separator */ + \ + 11 /* session ID, path separator */ + \ SHARED_MEMORY_MAX_FILE_NAME_CHAR_COUNT \ ) @@ -98,12 +97,17 @@ class SharedMemorySystemCallErrors void Append(LPCSTR format, ...); }; +class SharedMemoryId; + class SharedMemoryHelpers { private: - static const mode_t PermissionsMask_CurrentUser_ReadWriteExecute; + static const mode_t PermissionsMask_OwnerUser_ReadWrite; + static const mode_t PermissionsMask_OwnerUser_ReadWriteExecute; + static const mode_t PermissionsMask_NonOwnerUsers_Write; static const mode_t PermissionsMask_AllUsers_ReadWrite; static const mode_t PermissionsMask_AllUsers_ReadWriteExecute; + static const mode_t PermissionsMask_Sticky; public: static const UINT32 InvalidProcessId; static const SIZE_T InvalidThreadId; @@ -114,17 +118,14 @@ class SharedMemoryHelpers static SIZE_T AlignUp(SIZE_T value, SIZE_T alignment); static void *Alloc(SIZE_T byteCount); - - template static void BuildSharedFilesPath(PathCharString& destination, const char (&suffix)[SuffixByteCount]); - static void BuildSharedFilesPath(PathCharString& destination, const char *suffix, int suffixByteCount); static bool AppendUInt32String(PathCharString& destination, UINT32 value); - static bool EnsureDirectoryExists(SharedMemorySystemCallErrors *errors, const char *path, bool isGlobalLockAcquired, bool createIfNotExist = true, bool isSystemDirectory = false); + static bool EnsureDirectoryExists(SharedMemorySystemCallErrors *errors, const char *path, const SharedMemoryId *id, bool isGlobalLockAcquired, bool createIfNotExist = true, bool isSystemDirectory = false); private: static int Open(SharedMemorySystemCallErrors *errors, LPCSTR path, int flags, mode_t mode = static_cast(0)); public: static int OpenDirectory(SharedMemorySystemCallErrors *errors, LPCSTR path); - static int CreateOrOpenFile(SharedMemorySystemCallErrors *errors, LPCSTR path, bool createIfNotExist = true, bool *createdRef = nullptr); + static int CreateOrOpenFile(SharedMemorySystemCallErrors *errors, LPCSTR path, const SharedMemoryId *id, bool createIfNotExist = true, bool *createdRef = nullptr); static void CloseFile(int fileDescriptor); static int ChangeMode(LPCSTR path, mode_t mode); @@ -150,19 +151,24 @@ class SharedMemoryId LPCSTR m_name; SIZE_T m_nameCharCount; bool m_isSessionScope; // false indicates global scope + bool m_isUserScope; + uid_t m_userScopeUid; public: SharedMemoryId(); - SharedMemoryId(LPCSTR name, SIZE_T nameCharCount, bool isSessionScope); - SharedMemoryId(LPCSTR name); + SharedMemoryId(LPCSTR name, bool isUserScope); public: LPCSTR GetName() const; SIZE_T GetNameCharCount() const; + void ReplaceNamePtr(LPCSTR name); bool IsSessionScope() const; - bool Equals(SharedMemoryId *other) const; + bool IsUserScope() const; + uid_t GetUserScopeUid() const; + bool Equals(const SharedMemoryId *other) const; public: + bool AppendRuntimeTempDirectoryName(PathCharString& path) const; bool AppendSessionDirectoryName(PathCharString& path) const; }; @@ -222,22 +228,22 @@ class SharedMemoryProcessDataHeader SharedMemoryProcessDataHeader *m_nextInProcessDataHeaderList; public: - static SharedMemoryProcessDataHeader *CreateOrOpen(SharedMemorySystemCallErrors *errors, LPCSTR name, SharedMemorySharedDataHeader requiredSharedDataHeader, SIZE_T sharedDataByteCount, bool createIfNotExist, bool *createdRef); + static SharedMemoryProcessDataHeader *CreateOrOpen(SharedMemorySystemCallErrors *errors, LPCSTR name, bool isUserScope, SharedMemorySharedDataHeader requiredSharedDataHeader, SIZE_T sharedDataByteCount, bool createIfNotExist, bool *createdRef); public: static SharedMemoryProcessDataHeader *PalObject_GetProcessDataHeader(CorUnix::IPalObject *object); static void PalObject_SetProcessDataHeader(CorUnix::IPalObject *object, SharedMemoryProcessDataHeader *processDataHeader); - static void PalObject_Close(CorUnix::CPalThread *thread, CorUnix::IPalObject *object, bool isShuttingDown, bool cleanUpPalSharedState); + static void PalObject_Close(CorUnix::CPalThread *thread, CorUnix::IPalObject *object, bool isShuttingDown); private: - SharedMemoryProcessDataHeader(SharedMemoryId *id, int fileDescriptor, SharedMemorySharedDataHeader *sharedDataHeader, SIZE_T sharedDataTotalByteCount); + SharedMemoryProcessDataHeader(const SharedMemoryId *id, int fileDescriptor, SharedMemorySharedDataHeader *sharedDataHeader, SIZE_T sharedDataTotalByteCount); public: - static SharedMemoryProcessDataHeader *New(SharedMemoryId *id, int fileDescriptor, SharedMemorySharedDataHeader *sharedDataHeader, SIZE_T sharedDataTotalByteCount); + static SharedMemoryProcessDataHeader *New(const SharedMemoryId *id, int fileDescriptor, SharedMemorySharedDataHeader *sharedDataHeader, SIZE_T sharedDataTotalByteCount); ~SharedMemoryProcessDataHeader(); void Close(); public: - SharedMemoryId *GetId(); + const SharedMemoryId *GetId() const; SharedMemoryProcessDataBase *GetData() const; void SetData(SharedMemoryProcessDataBase *data); SharedMemorySharedDataHeader *GetSharedDataHeader() const; @@ -253,11 +259,27 @@ class SharedMemoryProcessDataHeader class SharedMemoryManager { private: - static CRITICAL_SECTION s_creationDeletionProcessLock; + static minipal_mutex s_creationDeletionProcessLock; static int s_creationDeletionLockFileDescriptor; - static PathCharString* s_runtimeTempDirectoryPath; - static PathCharString* s_sharedMemoryDirectoryPath; + struct UserScopeUidAndFileDescriptor + { + uid_t userScopeUid; + int fileDescriptor; + + UserScopeUidAndFileDescriptor() : userScopeUid((uid_t)0), fileDescriptor(-1) + { + } + + UserScopeUidAndFileDescriptor(uid_t userScopeUid, int fileDescriptor) + : userScopeUid(userScopeUid), fileDescriptor(fileDescriptor) + { + } + }; + + static UserScopeUidAndFileDescriptor *s_userScopeUidToCreationDeletionLockFDs; + static int s_userScopeUidToCreationDeletionLockFDsCount; + static int s_userScopeUidToCreationDeletionLockFDsCapacity; private: static SharedMemoryProcessDataHeader *s_processDataHeaderListHead; @@ -269,17 +291,16 @@ class SharedMemoryManager #endif // _DEBUG public: - static bool StaticInitialize(); + static void StaticInitialize(); static void StaticClose(); public: static void AcquireCreationDeletionProcessLock(); static void ReleaseCreationDeletionProcessLock(); - static void AcquireCreationDeletionFileLock(SharedMemorySystemCallErrors *errors); - static void ReleaseCreationDeletionFileLock(); - -public: - static bool CopySharedMemoryBasePath(PathCharString& destination); + static void AcquireCreationDeletionFileLock(SharedMemorySystemCallErrors *errors, const SharedMemoryId *id); + static void ReleaseCreationDeletionFileLock(const SharedMemoryId *id); + static void AddUserScopeUidCreationDeletionLockFD(uid_t userScopeUid, int creationDeletionLockFD); + static int FindUserScopeCreationDeletionLockFD(uid_t userScopeUid); #ifdef _DEBUG public: @@ -290,7 +311,7 @@ class SharedMemoryManager public: static void AddProcessDataHeader(SharedMemoryProcessDataHeader *processDataHeader); static void RemoveProcessDataHeader(SharedMemoryProcessDataHeader *processDataHeader); - static SharedMemoryProcessDataHeader *FindProcessDataHeader(SharedMemoryId *id); + static SharedMemoryProcessDataHeader *FindProcessDataHeader(const SharedMemoryId *id); }; #endif // !_PAL_SHARED_MEMORY_H_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.inl b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.inl deleted file mode 100644 index 598172c2b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/sharedmemory.inl +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#ifndef _PAL_SHARED_MEMORY_INL_ -#define _PAL_SHARED_MEMORY_INL_ - -#include "sharedmemory.h" - -#include "dbgmsg.h" - -#include - -template -void SharedMemoryHelpers::BuildSharedFilesPath( - PathCharString& destination, - const char (&suffix)[SuffixByteCount]) -{ - BuildSharedFilesPath(destination, suffix, SuffixByteCount - 1); -} - -#endif // !_PAL_SHARED_MEMORY_INL_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/shm.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/shm.hpp deleted file mode 100644 index 4a6b919ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/shm.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - include/pal/shm.hpp - -Abstract: - C++ typesafe accessors for shared memory routines - - - ---*/ - -#ifndef _SHM_HPP_ -#define _SHM_HPP_ - -#include "shmemory.h" - -// -// Some compilers (e.g., HPUX/IA64) warn about using NULL to initialize -// something of type SHMPTR, since SHMPTR is defined as DWORD_PTR, which -// isn't considered a pointer type... -// - -#define SHMPTR_TO_TYPED_PTR(type, shmptr) reinterpret_cast(shmptr) - -/* Set ptr to NULL if shmPtr == 0, else set ptr to SHMPTR_TO_TYPED_PTR(type, shmptr) - return FALSE if SHMPTR_TO_TYPED_PTR returns NULL ptr from non null shmptr, - TRUE otherwise */ -#define SHMPTR_TO_TYPED_PTR_BOOL(type, ptr, shmptr) \ - ((shmptr != 0) ? ((ptr = SHMPTR_TO_TYPED_PTR(type, shmptr)) != NULL) : ((ptr = NULL) == NULL)) - -#endif // _SHM_HPP_ - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/shmemory.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/shmemory.h deleted file mode 100644 index a43b11b42..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/shmemory.h +++ /dev/null @@ -1,124 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - include/pal/shmemory.h - -Abstract: - Header file for interface to shared memory - -How to use : - -Lock/Release functions must be used when manipulating data in shared memory, to ensure inter-process synchronization. - - - ---*/ - -#ifndef _PAL_SHMEMORY_H_ -#define _PAL_SHMEMORY_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -/* -Type for shared memory blocks - */ -typedef LPVOID SHMPTR; - -typedef enum { - SIID_NAMED_OBJECTS, - SIID_FILE_LOCKS, - - SIID_LAST -} SHM_INFO_ID; - -/*++ -SHMInitialize - -Hook this process into the PAL shared memory system; initialize the shared -memory if no other process has done it. ---*/ -BOOL SHMInitialize(void); - -/*++ -SHMCleanup - -Release all shared memory resources held; remove ourselves from the list of -registered processes, and remove all shared memory files if no process remains ---*/ -void SHMCleanup(void); - -/*++ -SHMLock - -Restrict shared memory access to the current thread of the current process - -(no parameters) - -Return value : - New lock count ---*/ -int SHMLock(void); - -/*++ -SHMRelease - -Release a lock on shared memory taken with SHMLock. - -(no parameters) - -Return value : - New lock count ---*/ -int SHMRelease(void); - - -/*++ -Function : - SHMGetInfo - - Retrieve some information from shared memory - -Parameters : - SHM_INFO_ID element : identifier of element to retrieve - -Return value : - Value of specified element - -Notes : - The SHM lock should be held while manipulating shared memory ---*/ -SHMPTR SHMGetInfo(SHM_INFO_ID element); - -/*++ -Function : - SHMSetInfo - - Place some information into shared memory - -Parameters : - SHM_INFO_ID element : identifier of element to save - SHMPTR value : new value of element - -Return value : - TRUE if successful, FALSE otherwise. - -Notes : - The SHM lock should be held while manipulating shared memory ---*/ -BOOL SHMSetInfo(SHM_INFO_ID element, SHMPTR value); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif /* _PAL_SHMEMORY_H_ */ - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchcache.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchcache.hpp index 821f5096a..81ecec769 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchcache.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchcache.hpp @@ -2,9 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. /*++ - - - Module Name: include/pal/synchcache.hpp @@ -12,16 +9,13 @@ Module Name: Abstract: Simple look-aside cache for unused objects with default constructor or no constructor - - - --*/ #ifndef _SYNCH_CACHE_H_ #define _SYNCH_CACHE_H_ #include "pal/thread.hpp" -#include "pal/malloc.hpp" +#include namespace CorUnix { @@ -36,7 +30,7 @@ namespace CorUnix static const int MaxDepth = 256; Volatile m_pHead; - CRITICAL_SECTION m_cs; + minipal_mutex m_cs; Volatile m_iDepth; int m_iMaxDepth; #ifdef _DEBUG @@ -44,9 +38,9 @@ namespace CorUnix #endif void Lock(CPalThread * pthrCurrent) - { InternalEnterCriticalSection(pthrCurrent, &m_cs); } + { minipal_mutex_enter(&m_cs); } void Unlock(CPalThread * pthrCurrent) - { InternalLeaveCriticalSection(pthrCurrent, &m_cs); } + { minipal_mutex_leave(&m_cs); } public: CSynchCache(int iMaxDepth = MaxDepth) : @@ -57,7 +51,7 @@ namespace CorUnix ,m_iMaxTrackedDepth(0) #endif { - InternalInitializeCriticalSection(&m_cs); + minipal_mutex_init(&m_cs); if (m_iMaxDepth < 0) { m_iMaxDepth = 0; @@ -67,7 +61,7 @@ namespace CorUnix ~CSynchCache() { Flush(NULL, true); - InternalDeleteCriticalSection(&m_cs); + minipal_mutex_destroy(&m_cs); } #ifdef _DEBUG @@ -116,7 +110,7 @@ namespace CorUnix for (j=i;j(); + pvObjRaw = (void *) new(std::nothrow) USynchCacheStackNode(); if (NULL == pvObjRaw) break; #ifdef _DEBUG @@ -159,7 +153,7 @@ namespace CorUnix } else { - InternalDelete((char *)pNode); + delete (char *)pNode; } Unlock(pthrCurrent); } @@ -184,7 +178,7 @@ namespace CorUnix { pTemp = pNode; pNode = pNode->next; - InternalDelete((char *)pTemp); + delete (char *)pTemp; } } }; @@ -205,13 +199,13 @@ namespace CorUnix static const int MaxDepth = 256; static const int PreAllocFactor = 10; // Everytime a Get finds no available - // cached raw intances, it preallocates + // cached raw instances, it preallocates // MaxDepth/PreAllocFactor new raw // instances and store them into the // cache before continuing Volatile m_pHead; - CRITICAL_SECTION m_cs; + minipal_mutex m_cs; Volatile m_iDepth; int m_iMaxDepth; #ifdef _DEBUG @@ -219,9 +213,9 @@ namespace CorUnix #endif void Lock(CPalThread * pthrCurrent) - { InternalEnterCriticalSection(pthrCurrent, &m_cs); } + { minipal_mutex_enter(&m_cs); } void Unlock(CPalThread * pthrCurrent) - { InternalLeaveCriticalSection(pthrCurrent, &m_cs); } + { minipal_mutex_leave(&m_cs); } public: CSHRSynchCache(int iMaxDepth = MaxDepth) : @@ -232,7 +226,7 @@ namespace CorUnix ,m_iMaxTrackedDepth(0) #endif { - InternalInitializeCriticalSection(&m_cs); + minipal_mutex_init(&m_cs); if (m_iMaxDepth < 0) { m_iMaxDepth = 0; @@ -242,7 +236,7 @@ namespace CorUnix ~CSHRSynchCache() { Flush(NULL, true); - InternalDeleteCriticalSection(&m_cs); + minipal_mutex_destroy(&m_cs); } #ifdef _DEBUG diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchobjects.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchobjects.hpp index 2cb957320..089c5bbf0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchobjects.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/synchobjects.hpp @@ -22,14 +22,13 @@ Module Name: #include "corunix.hpp" #include "threadinfo.hpp" #include "mutex.hpp" -#include "shm.hpp" #include "list.h" #include -#define SharedID SHMPTR -#define SharedIDToPointer(shID) SHMPTR_TO_TYPED_PTR(PVOID, shID) -#define SharedIDToTypePointer(TYPE,shID) SHMPTR_TO_TYPED_PTR(TYPE, shID) +typedef LPVOID SharedID; +#define SharedIDToPointer(shID) reinterpret_cast(shID) +#define SharedIDToTypePointer(TYPE,shID) reinterpret_cast(shID) namespace CorUnix { @@ -75,14 +74,12 @@ namespace CorUnix typedef struct _ThreadWaitInfo { WaitType wtWaitType; - WaitDomain wdWaitDomain; LONG lObjCount; - LONG lSharedObjCount; CPalThread * pthrOwner; PWaitingThreadsListNode rgpWTLNodes[MAXIMUM_WAIT_OBJECTS]; - _ThreadWaitInfo() : wtWaitType(SingleObject), wdWaitDomain(LocalWait), - lObjCount(0), lSharedObjCount(0), + _ThreadWaitInfo() : wtWaitType(SingleObject), + lObjCount(0), pthrOwner(NULL) {} } ThreadWaitInfo; @@ -114,7 +111,6 @@ namespace CorUnix THREAD_STATE m_tsThreadState; SharedID m_shridWaitAwakened; Volatile m_lLocalSynchLockCount; - Volatile m_lSharedSynchLockCount; LIST_ENTRY m_leOwnedObjsList; NamedMutexProcessData *m_ownedNamedMutexListHead; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/thread.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/thread.hpp index 411040f39..236bb6d49 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/thread.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/thread.hpp @@ -20,11 +20,8 @@ Module Name: #define _PAL_THREAD_HPP_ #include "corunix.hpp" -#include "shm.hpp" -#include "cs.hpp" #include -#include #if HAVE_MACH_EXCEPTIONS #include #endif // HAVE_MACH_EXCEPTIONS @@ -33,6 +30,8 @@ Module Name: #include "threadinfo.hpp" #include "synchobjects.hpp" #include +#include +#include namespace CorUnix { @@ -91,13 +90,6 @@ namespace CorUnix HANDLE *phThread ); - PAL_ERROR - InternalSetThreadDescription( - CPalThread *, - HANDLE, - PCWSTR - ); - PAL_ERROR CreateThreadData( CPalThread **ppThread @@ -192,14 +184,6 @@ namespace CorUnix int ); - friend - PAL_ERROR - InternalSetThreadDescription( - CPalThread *, - HANDLE, - PCWSTR - ); - friend PAL_ERROR CreateThreadData( @@ -219,7 +203,7 @@ namespace CorUnix CPalThread *m_pNext; DWORD m_dwExitCode; BOOL m_fExitCodeSet; - CRITICAL_SECTION m_csLock; + minipal_mutex m_mtxLock; bool m_fLockInitialized; bool m_fIsDummy; @@ -388,7 +372,7 @@ namespace CorUnix CPalThread *pThread ) { - InternalEnterCriticalSection(pThread, &m_csLock); + minipal_mutex_enter(&m_mtxLock); }; void @@ -396,7 +380,7 @@ namespace CorUnix CPalThread *pThread ) { - InternalLeaveCriticalSection(pThread, &m_csLock); + minipal_mutex_leave(&m_mtxLock); }; // @@ -588,7 +572,7 @@ namespace CorUnix m_pNext = pNext; }; -#if !HAVE_MACH_EXCEPTIONS +#if !HAVE_MACH_EXCEPTIONS && HAVE_SIGALTSTACK BOOL EnsureSignalAlternateStack( void @@ -678,24 +662,6 @@ namespace CorUnix return pThread; } -/*** - - $$TODO: These are needed only to support cross-process thread duplication - - class CThreadImmutableData - { - public: - DWORD dwProcessId; - }; - - class CThreadSharedData - { - public: - DWORD dwThreadId; - DWORD dwExitCode; - }; -***/ - // // The process local information for a thread is just a pointer // to the underlying CPalThread object. @@ -723,50 +689,9 @@ TLSCleanup( extern PAL_ActivationFunction g_activationFunction; extern PAL_SafeActivationCheckFunction g_safeActivationCheckFunction; -/*++ -Macro: - THREADSilentGetCurrentThreadId - -Abstract: - Same as GetCurrentThreadId, but it doesn't output any traces. - It is useful for tracing functions to display the thread ID - without generating any new traces. - - TODO: how does the perf of pthread_self compare to - InternalGetCurrentThread when we find the thread in the - cache? - - If the perf of pthread_self is comparable to that of the stack - bounds based lookaside system, why aren't we using it in the - cache? - - In order to match the thread ids that debuggers use at least for - linux we need to use gettid(). - ---*/ -#if defined(__linux__) -#define PlatformGetCurrentThreadId() (SIZE_T)syscall(SYS_gettid) -#elif defined(__APPLE__) -inline SIZE_T PlatformGetCurrentThreadId() { - uint64_t tid; - pthread_threadid_np(pthread_self(), &tid); - return (SIZE_T)tid; -} -#elif defined(__FreeBSD__) -#include -#define PlatformGetCurrentThreadId() (SIZE_T)pthread_getthreadid_np() -#elif defined(__NetBSD__) -#include -#define PlatformGetCurrentThreadId() (SIZE_T)_lwp_self() -#else -#define PlatformGetCurrentThreadId() (SIZE_T)pthread_self() -#endif - -inline SIZE_T THREADSilentGetCurrentThreadId() { - static __thread SIZE_T tid; - if (!tid) - tid = PlatformGetCurrentThreadId(); - return tid; +inline SIZE_T THREADSilentGetCurrentThreadId() +{ + return minipal_get_current_thread_id(); } #endif // _PAL_THREAD_HPP_ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/threadsusp.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/threadsusp.hpp index d9441372a..4608ea372 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/threadsusp.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/threadsusp.hpp @@ -22,14 +22,6 @@ Module Name: // Need this ifdef since this header is included by .c files so they can use the diagnostic function. #ifdef __cplusplus -// Note: do not include malloc.hpp from this header. The template InternalDelete -// needs to know the layout of class CPalThread, which includes a member of type -// CThreadSuspensionInfo, which is defined later in this header, and it is not -// yet known at this point. -// If any future change should bring this issue back, the circular dependency can -// be further broken by making the InternalDelete's CPalThread argument a -// templatized argument, so that type checking on it takes place only at -// instantiation time. #include "pal/threadinfo.hpp" #include "pal/thread.hpp" #include "pal/mutex.hpp" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/unicodedata.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/unicodedata.h deleted file mode 100644 index c7e9347fe..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/include/pal/unicodedata.h +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#ifndef _PAL_UNICODEDATA_H_ -#define _PAL_UNICODEDATA_H_ - -#include "pal/palinternal.h" - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -#define UPPER_CASE 1 -#define LOWER_CASE 2 - -typedef struct -{ - WCHAR nUnicodeValue; - WORD nFlag; - WCHAR nOpposingCase; -} UnicodeDataRec; - -extern CONST UnicodeDataRec UnicodeData[]; -extern CONST UINT UNICODE_DATA_SIZE; - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif /* _UNICODE_DATA_H_ */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/pal.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/pal.cpp index 63ee86e29..64fffbef6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/pal.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/pal.cpp @@ -19,19 +19,16 @@ SET_DEFAULT_DEBUG_CHANNEL(PAL); // some headers have code with asserts, so do th #include "pal/thread.hpp" #include "pal/synchobjects.hpp" #include "pal/procobj.hpp" -#include "pal/cs.hpp" #include "pal/file.hpp" #include "pal/map.hpp" -#include "../objmgr/shmobjectmanager.hpp" +#include "../objmgr/listedobjectmanager.hpp" #include "pal/seh.hpp" #include "pal/palinternal.h" #include "pal/sharedmemory.h" -#include "pal/shmemory.h" #include "pal/process.h" #include "../thread/procprivate.hpp" #include "pal/module.h" #include "pal/virtual.h" -#include "pal/misc.h" #include "pal/environ.h" #include "pal/utils.h" #include "pal/debug.h" @@ -113,7 +110,7 @@ BOOL g_useDefaultBaseAddr = FALSE; /* critical section to protect access to init_count. This is allocated on the very first PAL_Initialize call, and is freed afterward. */ -static PCRITICAL_SECTION init_critsec = NULL; +static minipal_mutex* init_critsec = NULL; static DWORD g_initializeDLLFlags = PAL_INITIALIZE_DLL; @@ -127,21 +124,6 @@ static BOOL INIT_SharedFilesPath(void); extern void PROCDumpThreadList(void); #endif -#if defined(__APPLE__) -static bool RunningNatively() -{ - int ret = 0; - size_t sz = sizeof(ret); - if (sysctlbyname("sysctl.proc_native", &ret, &sz, nullptr, 0) != 0) - { - // if the sysctl failed, we'll assume this OS does not support - // binary translation - so we must be running natively. - return true; - } - return ret != 0; -} -#endif // __APPLE__ - /*++ Function: PAL_Initialize @@ -266,7 +248,7 @@ EnsureStackSize(SIZE_T stackSize) void InitializeDefaultStackSize() { - CLRConfigNoCache defStackSize = CLRConfigNoCache::Get("DefaultStackSize", /*noprefix*/ false, &getenv); + CLRConfigNoCache defStackSize = CLRConfigNoCache::Get("Thread_DefaultStackSize", /*noprefix*/ false, &getenv); if (defStackSize.IsSet()) { DWORD size; @@ -314,7 +296,7 @@ Initialize( { PAL_ERROR palError = ERROR_GEN_FAILURE; CPalThread *pThread = nullptr; - CSharedMemoryObjectManager *pshmom = nullptr; + CListedObjectManager *plom = nullptr; LPWSTR command_line = nullptr; LPWSTR exe_path = nullptr; int retval = -1; @@ -328,39 +310,29 @@ Initialize( /*Firstly initiate a lastError */ SetLastError(ERROR_GEN_FAILURE); -#ifdef __APPLE__ - if (!RunningNatively()) - { - SetLastError(ERROR_BAD_FORMAT); - goto exit; - } -#endif // __APPLE__ - - CriticalSectionSubSysInitialize(); - if(nullptr == init_critsec) { pthread_mutex_lock(&init_critsec_mutex); // prevents race condition of two threads // initializing the critical section. if(nullptr == init_critsec) { - static CRITICAL_SECTION temp_critsec; + static minipal_mutex temp_critsec; // Want this critical section to NOT be internal to avoid the use of unsafe region markers. - InternalInitializeCriticalSectionAndSpinCount(&temp_critsec, 0, false); + minipal_mutex_init(&temp_critsec); if(nullptr != InterlockedCompareExchangePointer(&init_critsec, &temp_critsec, nullptr)) { // Another thread got in before us! shouldn't happen, if the PAL // isn't initialized there shouldn't be any other threads WARN("Another thread initialized the critical section\n"); - InternalDeleteCriticalSection(&temp_critsec); + minipal_mutex_destroy(&temp_critsec); } } pthread_mutex_unlock(&init_critsec_mutex); } - InternalEnterCriticalSection(pThread, init_critsec); // here pThread is always nullptr + minipal_mutex_enter(init_critsec); if (init_count == 0) { @@ -384,7 +356,7 @@ Initialize( // The gSharedFilesPath is allocated dynamically so its destructor does not get // called unexpectedly during cleanup - gSharedFilesPath = InternalNew(); + gSharedFilesPath = new(std::nothrow) PathCharString(); if (gSharedFilesPath == nullptr) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -425,7 +397,7 @@ Initialize( if (FALSE == EnvironInitialize()) { palError = ERROR_PALINIT_ENV; - goto CLEANUP0; + goto CLEANUP1; } if (!INIT_IncreaseDescriptorLimit()) @@ -435,20 +407,7 @@ Initialize( // we use large numbers of threads or have many open files. } - if (!SharedMemoryManager::StaticInitialize()) - { - ERROR("Shared memory static initialization failed!\n"); - palError = ERROR_PALINIT_SHARED_MEMORY_MANAGER; - goto CLEANUP0; - } - - /* initialize the shared memory infrastructure */ - if (!SHMInitialize()) - { - ERROR("Shared memory initialization failed!\n"); - palError = ERROR_PALINIT_SHM; - goto CLEANUP0; - } + SharedMemoryManager::StaticInitialize(); // // Initialize global process data @@ -505,23 +464,23 @@ Initialize( // Initialize the object manager // - pshmom = InternalNew(); - if (nullptr == pshmom) + plom = new(std::nothrow) CListedObjectManager(); + if (nullptr == plom) { ERROR("Unable to allocate new object manager\n"); palError = ERROR_OUTOFMEMORY; goto CLEANUP1b; } - palError = pshmom->Initialize(); + palError = plom->Initialize(); if (NO_ERROR != palError) { ERROR("object manager initialization failed!\n"); - InternalDelete(pshmom); + delete plom; goto CLEANUP1b; } - g_pObjectManager = pshmom; + g_pObjectManager = plom; // // Initialize the synchronization manager @@ -576,17 +535,6 @@ Initialize( // InitializeProcessCommandLine took ownership of this memory. command_line = nullptr; -#ifdef PAL_PERF - // Initialize the Profiling structure - if(FALSE == PERFInitialize(command_line, exe_path)) - { - ERROR("Performance profiling initial failed\n"); - palError = ERROR_PALINIT_PERF; - goto CLEANUP2; - } - PERFAllocThreadInfo(); -#endif - if (!LOADSetExeName(exe_path)) { ERROR("Unable to set exe name\n"); @@ -640,6 +588,7 @@ Initialize( } } +#ifndef TARGET_WASM if (flags & PAL_INITIALIZE_SYNC_THREAD) { // @@ -652,7 +601,7 @@ Initialize( goto CLEANUP13; } } - +#endif // !TARGET_WASM /* initialize structured exception handling stuff (signals, etc) */ if (FALSE == SEHInitialize(pThread, flags)) { @@ -712,24 +661,13 @@ Initialize( CLEANUP1a: // Cleanup global process data CLEANUP1: - SHMCleanup(); -CLEANUP0: CleanupCGroup(); CLEANUP0a: TLSCleanup(); ERROR("PAL_Initialize failed\n"); SetLastError(palError); done: -#ifdef PAL_PERF - if( retval == 0) - { - PERFEnableProcessProfile(); - PERFEnableThreadProfile(FALSE); - PERFCalibrate("Overhead of PERF entry/exit"); - } -#endif - - InternalLeaveCriticalSection(pThread, init_critsec); + minipal_mutex_leave(init_critsec); if (fFirstTimeInit && 0 == retval) { @@ -741,9 +679,6 @@ Initialize( ASSERT("returning failure, but last error not set\n"); } -#ifdef __APPLE__ -exit : -#endif // __APPLE__ LOGEXIT("PAL_Initialize returns int %d\n", retval); return retval; } @@ -784,6 +719,7 @@ PAL_InitializeCoreCLR(const char *szExePath, BOOL runningInExe) return ERROR_SUCCESS; } +#ifndef TARGET_WASM // we don't use shared libraries on wasm // Now that the PAL is initialized it's safe to call the initialization methods for the code that used to // be dynamically loaded libraries but is now statically linked into CoreCLR just like the PAL, i.e. the // PAL RT and mscorwks. @@ -791,6 +727,7 @@ PAL_InitializeCoreCLR(const char *szExePath, BOOL runningInExe) { return ERROR_DLL_INIT_FAILED; } +#endif // !TARGET_WASM if (!PROCAbortInitialize()) { @@ -801,108 +738,6 @@ PAL_InitializeCoreCLR(const char *szExePath, BOOL runningInExe) return ERROR_SUCCESS; } -/*++ -Function: -PAL_IsDebuggerPresent - -Abstract: -This function should be used to determine if a debugger is attached to the process. ---*/ -PALIMPORT -BOOL -PALAPI -PAL_IsDebuggerPresent() -{ -#if defined(__linux__) - BOOL debugger_present = FALSE; - char buf[2048]; - - int status_fd = open("/proc/self/status", O_RDONLY); - if (status_fd == -1) - { - return FALSE; - } - ssize_t num_read = read(status_fd, buf, sizeof(buf) - 1); - - if (num_read > 0) - { - static const char TracerPid[] = "TracerPid:"; - char *tracer_pid; - - buf[num_read] = '\0'; - tracer_pid = strstr(buf, TracerPid); - if (tracer_pid) - { - debugger_present = !!atoi(tracer_pid + sizeof(TracerPid) - 1); - } - } - - close(status_fd); - - return debugger_present; -#elif defined(__APPLE__) || defined(__FreeBSD__) - struct kinfo_proc info = {}; - size_t size = sizeof(info); - int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() }; - int ret = sysctl(mib, sizeof(mib)/sizeof(*mib), &info, &size, nullptr, 0); - - if (ret == 0) -#if defined(__APPLE__) - return ((info.kp_proc.p_flag & P_TRACED) != 0); -#else // __FreeBSD__ - return ((info.ki_flag & P_TRACED) != 0); -#endif - - return FALSE; -#elif defined(__NetBSD__) - int traced; - kvm_t *kd; - int cnt; - - struct kinfo_proc *info; - - kd = kvm_open(nullptr, nullptr, nullptr, KVM_NO_FILES, "kvm_open"); - if (kd == nullptr) - return FALSE; - - info = kvm_getprocs(kd, KERN_PROC_PID, getpid(), &cnt); - if (info == nullptr || cnt < 1) - { - kvm_close(kd); - return FALSE; - } - - traced = info->kp_proc.p_slflag & PSL_TRACED; - kvm_close(kd); - - if (traced != 0) - return TRUE; - else - return FALSE; -#elif defined(__sun) - int readResult; - char statusFilename[64]; - snprintf(statusFilename, sizeof(statusFilename), "/proc/%d/status", getpid()); - int fd = open(statusFilename, O_RDONLY); - if (fd == -1) - { - return FALSE; - } - - pstatus_t status; - do - { - readResult = read(fd, &status, sizeof(status)); - } - while ((readResult == -1) && (errno == EINTR)); - - close(fd); - return status.pr_flttrace.word[0] != 0; -#else - return FALSE; -#endif -} - /*++ Function: PAL_Shutdown @@ -1046,10 +881,7 @@ BOOL PALInitLock(void) return FALSE; } - CPalThread * pThread = - (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : nullptr); - - InternalEnterCriticalSection(pThread, init_critsec); + minipal_mutex_enter(init_critsec); return TRUE; } @@ -1068,10 +900,7 @@ void PALInitUnlock(void) return; } - CPalThread * pThread = - (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : nullptr); - - InternalLeaveCriticalSection(pThread, init_critsec); + minipal_mutex_leave(init_critsec); } /* Internal functions *********************************************************/ @@ -1089,6 +918,10 @@ Return value: --*/ static BOOL INIT_IncreaseDescriptorLimit(void) { +#ifdef TARGET_WASM + // WebAssembly cannot set limits + return TRUE; +#endif #ifndef DONT_SET_RLIMIT_NOFILE struct rlimit rlp; int result; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/sxs.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/sxs.cpp index 4c1772896..8c55aa99c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/sxs.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/init/sxs.cpp @@ -64,7 +64,7 @@ AllocatePalThread(CPalThread **ppThread) goto exit; } -#if !HAVE_MACH_EXCEPTIONS +#if !HAVE_MACH_EXCEPTIONS && HAVE_SIGALTSTACK // Ensure alternate stack for SIGSEGV handling. Our SIGSEGV handler is set to // run on an alternate stack and the stack needs to be allocated per thread. if (!pThread->EnsureSignalAlternateStack()) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/loader/module.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/loader/module.cpp index 0cda5045e..76fdb966a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/loader/module.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/loader/module.cpp @@ -21,11 +21,9 @@ Module Name: SET_DEFAULT_DEBUG_CHANNEL(LOADER); // some headers have code with asserts, so do this first #include "pal/thread.hpp" -#include "pal/malloc.hpp" #include "pal/file.hpp" #include "pal/palinternal.h" #include "pal/module.h" -#include "pal/cs.hpp" #include "pal/process.h" #include "pal/file.h" #include "pal/utils.h" @@ -75,7 +73,7 @@ using namespace CorUnix; /* static variables ***********************************************************/ /* critical section that regulates access to the module list */ -CRITICAL_SECTION module_critsec; +minipal_mutex module_critsec; /* always the first, in the in-load-order list */ MODSTRUCT exe_module; @@ -95,7 +93,7 @@ static bool LOADConvertLibraryPathWideStringToMultibyteString( INT *multibyteLibraryPathLengthRef); static BOOL LOADValidateModule(MODSTRUCT *module); static LPWSTR LOADGetModuleFileName(MODSTRUCT *module); -static MODSTRUCT *LOADAddModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryNameOrPath); +static MODSTRUCT *LOADAddModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryNameOrPath, /*OUT*/ BOOL* pIsAlreadyLoaded); static NATIVE_LIBRARY_HANDLE LOADLoadLibraryDirect(LPCSTR libraryNameOrPath); static BOOL LOADFreeLibrary(MODSTRUCT *module, BOOL fCallDllMain); static HMODULE LOADRegisterLibraryDirect(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryNameOrPath, BOOL fDynamic); @@ -497,6 +495,7 @@ LPCSTR FixLibCName(LPCSTR shortAsciiName) // As a result, we have to use the full name (i.e. lib.so.6) that is defined by LIBC_SO. // * For macOS, use constant value absolute path "/usr/lib/libc.dylib". // * For FreeBSD, use constant value "libc.so.7". + // * For Haiku, use constant value "libroot.so". // * For rest of Unices, use constant value "libc.so". if (strcmp(shortAsciiName, LIBC_NAME_WITHOUT_EXTENSION) == 0) { @@ -504,6 +503,8 @@ LPCSTR FixLibCName(LPCSTR shortAsciiName) return "/usr/lib/libc.dylib"; #elif defined(__FreeBSD__) return "libc.so.7"; +#elif defined(__HAIKU__) + return "libroot.so"; #elif defined(LIBC_SO) return LIBC_SO; #else @@ -667,7 +668,8 @@ PAL_RegisterModule( if (dl_handle) { // This only creates/adds the module handle and doesn't call DllMain - hinstance = LOADAddModule(dl_handle, lpLibFileName); + BOOL unused; + hinstance = LOADAddModule(dl_handle, lpLibFileName, &unused); } UnlockModuleList(); @@ -924,6 +926,16 @@ PAL_CopyModuleData(PVOID moduleBase, PVOID destinationBufferStart, PVOID destina } return param.result; } +#elif defined(TARGET_WASM) +// WASM-TODO: get rid of whole module loading on wasm +PALIMPORT +int +PALAPI +PAL_CopyModuleData(PVOID moduleBase, PVOID destinationBufferStart, PVOID destinationBufferEnd) +{ + _ASSERTE(!"PAL_CopyModuleData not implemented for wasm"); + return 0; +} #else static int CopyModuleDataCallback(struct dl_phdr_info *info, size_t size, void *data) { @@ -1007,18 +1019,20 @@ BOOL LOADInitializeModules() { _ASSERTE(exe_module.prev == nullptr); - InternalInitializeCriticalSection(&module_critsec); + minipal_mutex_init(&module_critsec); // Initialize module for main executable TRACE("Initializing module for main executable\n"); exe_module.self = (HMODULE)&exe_module; exe_module.dl_handle = dlopen(nullptr, RTLD_LAZY); +#ifndef TARGET_WASM // wasm does not support shared libraries if (exe_module.dl_handle == nullptr) { ERROR("Executable module will be broken : dlopen(nullptr) failed\n"); return FALSE; } +#endif exe_module.lib_name = nullptr; exe_module.refcount = -1; exe_module.next = &exe_module; @@ -1590,10 +1604,11 @@ static MODSTRUCT *LOADAllocModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR name) Return value: PAL handle to the loaded library, or nullptr upon failure (error is set via SetLastError()). */ -static MODSTRUCT *LOADAddModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryNameOrPath) +static MODSTRUCT *LOADAddModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryNameOrPath, /*OUT*/ BOOL* pIsAlreadyLoaded) { _ASSERTE(dl_handle != nullptr); _ASSERTE(g_running_in_exe || (libraryNameOrPath != nullptr && libraryNameOrPath[0] != '\0')); + *pIsAlreadyLoaded = FALSE; #if !RETURNS_NEW_HANDLES_ON_REPEAT_DLOPEN /* search module list for a match. */ @@ -1612,6 +1627,7 @@ static MODSTRUCT *LOADAddModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryN module->refcount++; } dlclose(dl_handle); + *pIsAlreadyLoaded = TRUE; return module; } module = module->next; @@ -1663,7 +1679,8 @@ Return value: */ static HMODULE LOADRegisterLibraryDirect(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryNameOrPath, BOOL fDynamic) { - MODSTRUCT *module = LOADAddModule(dl_handle, libraryNameOrPath); + BOOL isAlreadyLoaded; + MODSTRUCT *module = LOADAddModule(dl_handle, libraryNameOrPath, &isAlreadyLoaded); if (module == nullptr) { return nullptr; @@ -1672,36 +1689,39 @@ static HMODULE LOADRegisterLibraryDirect(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR /* If the module contains a DllMain, call it. */ if (module->pDllMain) { - TRACE("Calling DllMain (%p) for module %S\n", - module->pDllMain, - module->lib_name ? module->lib_name : W16_NULLSTRING); - - if (nullptr == module->hinstance) + if (!isAlreadyLoaded) { - PREGISTER_MODULE registerModule = (PREGISTER_MODULE)dlsym(module->dl_handle, "PAL_RegisterModule"); - if (registerModule != nullptr) - { - module->hinstance = registerModule(libraryNameOrPath); - } - else + TRACE("Calling DllMain (%p) for module %S\n", + module->pDllMain, + module->lib_name ? module->lib_name : W16_NULLSTRING); + + if (nullptr == module->hinstance) { - // If the target module doesn't have the PAL_RegisterModule export, then use this PAL's - // module handle assuming that the target module is referencing this PAL's exported - // functions on said handle. - module->hinstance = (HINSTANCE)module; + PREGISTER_MODULE registerModule = (PREGISTER_MODULE)dlsym(module->dl_handle, "PAL_RegisterModule"); + if (registerModule != nullptr) + { + module->hinstance = registerModule(libraryNameOrPath); + } + else + { + // If the target module doesn't have the PAL_RegisterModule export, then use this PAL's + // module handle assuming that the target module is referencing this PAL's exported + // functions on said handle. + module->hinstance = (HINSTANCE)module; + } } - } - BOOL dllMainRetVal = LOADCallDllMainSafe(module, DLL_PROCESS_ATTACH, fDynamic ? nullptr : (LPVOID)-1); + BOOL dllMainRetVal = LOADCallDllMainSafe(module, DLL_PROCESS_ATTACH, fDynamic ? nullptr : (LPVOID)-1); - // If DlMain(DLL_PROCESS_ATTACH) returns FALSE, we must immediately unload the module - if (!dllMainRetVal) - { - ERROR("DllMain returned FALSE; unloading module.\n"); - module->pDllMain = nullptr; - FreeLibrary((HMODULE)module); - SetLastError(ERROR_DLL_INIT_FAILED); - module = nullptr; + // If DlMain(DLL_PROCESS_ATTACH) returns FALSE, we must immediately unload the module + if (!dllMainRetVal) + { + ERROR("DllMain returned FALSE; unloading module.\n"); + module->pDllMain = nullptr; + FreeLibrary((HMODULE)module); + SetLastError(ERROR_DLL_INIT_FAILED); + module = nullptr; + } } } else @@ -1853,7 +1873,7 @@ void LockModuleList() CPalThread * pThread = (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : nullptr); - InternalEnterCriticalSection(pThread, &module_critsec); + minipal_mutex_enter(&module_critsec); } /*++ @@ -1875,5 +1895,5 @@ void UnlockModuleList() CPalThread * pThread = (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : nullptr); - InternalLeaveCriticalSection(pThread, &module_critsec); + minipal_mutex_leave(&module_critsec); } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicode.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicode.cpp index e966e2282..a66a0edc1 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicode.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicode.cpp @@ -14,6 +14,7 @@ Implementation of all functions related to Unicode support #include "pal/palinternal.h" #include "pal/dbgmsg.h" #include "pal/file.h" +#include #include #include "pal/cruntime.h" #include "pal/stackstring.hpp" @@ -39,31 +40,6 @@ PALAPI GetConsoleOutputCP( VOID) { - UINT nRet = 0; - PERF_ENTRY(GetConsoleOutputCP); - ENTRY("GetConsoleOutputCP()\n"); - nRet = GetACP(); - LOGEXIT("GetConsoleOutputCP returns UINT %d \n", nRet ); - PERF_EXIT(GetConsoleOutputCP); - return nRet; -} - -/*++ -Function: -GetACP - -See MSDN doc. ---*/ -UINT -PALAPI -GetACP(VOID) -{ - PERF_ENTRY(GetACP); - ENTRY("GetACP(VOID)\n"); - - LOGEXIT("GetACP returning UINT %d\n", CP_UTF8); - PERF_EXIT(GetACP); - return CP_UTF8; } @@ -202,7 +178,7 @@ WideCharToMultiByte( if (CodePage == CP_UTF8 || CodePage == CP_ACP) { if (cchWideChar < 0) - cchWideChar = PAL_wcslen(lpWideCharStr) + 1; + cchWideChar = minipal_u16_strlen((CHAR16_T*)lpWideCharStr) + 1; if (!lpMultiByteStr || cbMultiByte == 0) retval = minipal_get_length_utf16_to_utf8((CHAR16_T*)lpWideCharStr, cchWideChar, dwFlags); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicodedata.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicodedata.cpp deleted file mode 100644 index 74ae79819..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicodedata.cpp +++ /dev/null @@ -1,2372 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include "pal/unicodedata.h" - -// -// THIS FILE IS GENERATED. DO NOT HAND EDIT. -// IF YOU NEED TO UPDATE UNICODE VERSION FOLLOW THE GUIDE AT src/libraries/System.Private.CoreLib/Tools/GenUnicodeProp/Updating-Unicode-Versions.md -// - -CONST UnicodeDataRec UnicodeData[] = { - { 0x41, UPPER_CASE, 0x61 }, - { 0x42, UPPER_CASE, 0x62 }, - { 0x43, UPPER_CASE, 0x63 }, - { 0x44, UPPER_CASE, 0x64 }, - { 0x45, UPPER_CASE, 0x65 }, - { 0x46, UPPER_CASE, 0x66 }, - { 0x47, UPPER_CASE, 0x67 }, - { 0x48, UPPER_CASE, 0x68 }, - { 0x49, UPPER_CASE, 0x69 }, - { 0x4A, UPPER_CASE, 0x6A }, - { 0x4B, UPPER_CASE, 0x6B }, - { 0x4C, UPPER_CASE, 0x6C }, - { 0x4D, UPPER_CASE, 0x6D }, - { 0x4E, UPPER_CASE, 0x6E }, - { 0x4F, UPPER_CASE, 0x6F }, - { 0x50, UPPER_CASE, 0x70 }, - { 0x51, UPPER_CASE, 0x71 }, - { 0x52, UPPER_CASE, 0x72 }, - { 0x53, UPPER_CASE, 0x73 }, - { 0x54, UPPER_CASE, 0x74 }, - { 0x55, UPPER_CASE, 0x75 }, - { 0x56, UPPER_CASE, 0x76 }, - { 0x57, UPPER_CASE, 0x77 }, - { 0x58, UPPER_CASE, 0x78 }, - { 0x59, UPPER_CASE, 0x79 }, - { 0x5A, UPPER_CASE, 0x7A }, - { 0x61, LOWER_CASE, 0x41 }, - { 0x62, LOWER_CASE, 0x42 }, - { 0x63, LOWER_CASE, 0x43 }, - { 0x64, LOWER_CASE, 0x44 }, - { 0x65, LOWER_CASE, 0x45 }, - { 0x66, LOWER_CASE, 0x46 }, - { 0x67, LOWER_CASE, 0x47 }, - { 0x68, LOWER_CASE, 0x48 }, - { 0x69, LOWER_CASE, 0x49 }, - { 0x6A, LOWER_CASE, 0x4A }, - { 0x6B, LOWER_CASE, 0x4B }, - { 0x6C, LOWER_CASE, 0x4C }, - { 0x6D, LOWER_CASE, 0x4D }, - { 0x6E, LOWER_CASE, 0x4E }, - { 0x6F, LOWER_CASE, 0x4F }, - { 0x70, LOWER_CASE, 0x50 }, - { 0x71, LOWER_CASE, 0x51 }, - { 0x72, LOWER_CASE, 0x52 }, - { 0x73, LOWER_CASE, 0x53 }, - { 0x74, LOWER_CASE, 0x54 }, - { 0x75, LOWER_CASE, 0x55 }, - { 0x76, LOWER_CASE, 0x56 }, - { 0x77, LOWER_CASE, 0x57 }, - { 0x78, LOWER_CASE, 0x58 }, - { 0x79, LOWER_CASE, 0x59 }, - { 0x7A, LOWER_CASE, 0x5A }, - { 0xB5, LOWER_CASE, 0x39C }, - { 0xC0, UPPER_CASE, 0xE0 }, - { 0xC1, UPPER_CASE, 0xE1 }, - { 0xC2, UPPER_CASE, 0xE2 }, - { 0xC3, UPPER_CASE, 0xE3 }, - { 0xC4, UPPER_CASE, 0xE4 }, - { 0xC5, UPPER_CASE, 0xE5 }, - { 0xC6, UPPER_CASE, 0xE6 }, - { 0xC7, UPPER_CASE, 0xE7 }, - { 0xC8, UPPER_CASE, 0xE8 }, - { 0xC9, UPPER_CASE, 0xE9 }, - { 0xCA, UPPER_CASE, 0xEA }, - { 0xCB, UPPER_CASE, 0xEB }, - { 0xCC, UPPER_CASE, 0xEC }, - { 0xCD, UPPER_CASE, 0xED }, - { 0xCE, UPPER_CASE, 0xEE }, - { 0xCF, UPPER_CASE, 0xEF }, - { 0xD0, UPPER_CASE, 0xF0 }, - { 0xD1, UPPER_CASE, 0xF1 }, - { 0xD2, UPPER_CASE, 0xF2 }, - { 0xD3, UPPER_CASE, 0xF3 }, - { 0xD4, UPPER_CASE, 0xF4 }, - { 0xD5, UPPER_CASE, 0xF5 }, - { 0xD6, UPPER_CASE, 0xF6 }, - { 0xD8, UPPER_CASE, 0xF8 }, - { 0xD9, UPPER_CASE, 0xF9 }, - { 0xDA, UPPER_CASE, 0xFA }, - { 0xDB, UPPER_CASE, 0xFB }, - { 0xDC, UPPER_CASE, 0xFC }, - { 0xDD, UPPER_CASE, 0xFD }, - { 0xDE, UPPER_CASE, 0xFE }, - { 0xE0, LOWER_CASE, 0xC0 }, - { 0xE1, LOWER_CASE, 0xC1 }, - { 0xE2, LOWER_CASE, 0xC2 }, - { 0xE3, LOWER_CASE, 0xC3 }, - { 0xE4, LOWER_CASE, 0xC4 }, - { 0xE5, LOWER_CASE, 0xC5 }, - { 0xE6, LOWER_CASE, 0xC6 }, - { 0xE7, LOWER_CASE, 0xC7 }, - { 0xE8, LOWER_CASE, 0xC8 }, - { 0xE9, LOWER_CASE, 0xC9 }, - { 0xEA, LOWER_CASE, 0xCA }, - { 0xEB, LOWER_CASE, 0xCB }, - { 0xEC, LOWER_CASE, 0xCC }, - { 0xED, LOWER_CASE, 0xCD }, - { 0xEE, LOWER_CASE, 0xCE }, - { 0xEF, LOWER_CASE, 0xCF }, - { 0xF0, LOWER_CASE, 0xD0 }, - { 0xF1, LOWER_CASE, 0xD1 }, - { 0xF2, LOWER_CASE, 0xD2 }, - { 0xF3, LOWER_CASE, 0xD3 }, - { 0xF4, LOWER_CASE, 0xD4 }, - { 0xF5, LOWER_CASE, 0xD5 }, - { 0xF6, LOWER_CASE, 0xD6 }, - { 0xF8, LOWER_CASE, 0xD8 }, - { 0xF9, LOWER_CASE, 0xD9 }, - { 0xFA, LOWER_CASE, 0xDA }, - { 0xFB, LOWER_CASE, 0xDB }, - { 0xFC, LOWER_CASE, 0xDC }, - { 0xFD, LOWER_CASE, 0xDD }, - { 0xFE, LOWER_CASE, 0xDE }, - { 0xFF, LOWER_CASE, 0x178 }, - { 0x100, UPPER_CASE, 0x101 }, - { 0x101, LOWER_CASE, 0x100 }, - { 0x102, UPPER_CASE, 0x103 }, - { 0x103, LOWER_CASE, 0x102 }, - { 0x104, UPPER_CASE, 0x105 }, - { 0x105, LOWER_CASE, 0x104 }, - { 0x106, UPPER_CASE, 0x107 }, - { 0x107, LOWER_CASE, 0x106 }, - { 0x108, UPPER_CASE, 0x109 }, - { 0x109, LOWER_CASE, 0x108 }, - { 0x10A, UPPER_CASE, 0x10B }, - { 0x10B, LOWER_CASE, 0x10A }, - { 0x10C, UPPER_CASE, 0x10D }, - { 0x10D, LOWER_CASE, 0x10C }, - { 0x10E, UPPER_CASE, 0x10F }, - { 0x10F, LOWER_CASE, 0x10E }, - { 0x110, UPPER_CASE, 0x111 }, - { 0x111, LOWER_CASE, 0x110 }, - { 0x112, UPPER_CASE, 0x113 }, - { 0x113, LOWER_CASE, 0x112 }, - { 0x114, UPPER_CASE, 0x115 }, - { 0x115, LOWER_CASE, 0x114 }, - { 0x116, UPPER_CASE, 0x117 }, - { 0x117, LOWER_CASE, 0x116 }, - { 0x118, UPPER_CASE, 0x119 }, - { 0x119, LOWER_CASE, 0x118 }, - { 0x11A, UPPER_CASE, 0x11B }, - { 0x11B, LOWER_CASE, 0x11A }, - { 0x11C, UPPER_CASE, 0x11D }, - { 0x11D, LOWER_CASE, 0x11C }, - { 0x11E, UPPER_CASE, 0x11F }, - { 0x11F, LOWER_CASE, 0x11E }, - { 0x120, UPPER_CASE, 0x121 }, - { 0x121, LOWER_CASE, 0x120 }, - { 0x122, UPPER_CASE, 0x123 }, - { 0x123, LOWER_CASE, 0x122 }, - { 0x124, UPPER_CASE, 0x125 }, - { 0x125, LOWER_CASE, 0x124 }, - { 0x126, UPPER_CASE, 0x127 }, - { 0x127, LOWER_CASE, 0x126 }, - { 0x128, UPPER_CASE, 0x129 }, - { 0x129, LOWER_CASE, 0x128 }, - { 0x12A, UPPER_CASE, 0x12B }, - { 0x12B, LOWER_CASE, 0x12A }, - { 0x12C, UPPER_CASE, 0x12D }, - { 0x12D, LOWER_CASE, 0x12C }, - { 0x12E, UPPER_CASE, 0x12F }, - { 0x12F, LOWER_CASE, 0x12E }, - { 0x130, UPPER_CASE, 0x69 }, - { 0x131, LOWER_CASE, 0x49 }, - { 0x132, UPPER_CASE, 0x133 }, - { 0x133, LOWER_CASE, 0x132 }, - { 0x134, UPPER_CASE, 0x135 }, - { 0x135, LOWER_CASE, 0x134 }, - { 0x136, UPPER_CASE, 0x137 }, - { 0x137, LOWER_CASE, 0x136 }, - { 0x139, UPPER_CASE, 0x13A }, - { 0x13A, LOWER_CASE, 0x139 }, - { 0x13B, UPPER_CASE, 0x13C }, - { 0x13C, LOWER_CASE, 0x13B }, - { 0x13D, UPPER_CASE, 0x13E }, - { 0x13E, LOWER_CASE, 0x13D }, - { 0x13F, UPPER_CASE, 0x140 }, - { 0x140, LOWER_CASE, 0x13F }, - { 0x141, UPPER_CASE, 0x142 }, - { 0x142, LOWER_CASE, 0x141 }, - { 0x143, UPPER_CASE, 0x144 }, - { 0x144, LOWER_CASE, 0x143 }, - { 0x145, UPPER_CASE, 0x146 }, - { 0x146, LOWER_CASE, 0x145 }, - { 0x147, UPPER_CASE, 0x148 }, - { 0x148, LOWER_CASE, 0x147 }, - { 0x14A, UPPER_CASE, 0x14B }, - { 0x14B, LOWER_CASE, 0x14A }, - { 0x14C, UPPER_CASE, 0x14D }, - { 0x14D, LOWER_CASE, 0x14C }, - { 0x14E, UPPER_CASE, 0x14F }, - { 0x14F, LOWER_CASE, 0x14E }, - { 0x150, UPPER_CASE, 0x151 }, - { 0x151, LOWER_CASE, 0x150 }, - { 0x152, UPPER_CASE, 0x153 }, - { 0x153, LOWER_CASE, 0x152 }, - { 0x154, UPPER_CASE, 0x155 }, - { 0x155, LOWER_CASE, 0x154 }, - { 0x156, UPPER_CASE, 0x157 }, - { 0x157, LOWER_CASE, 0x156 }, - { 0x158, UPPER_CASE, 0x159 }, - { 0x159, LOWER_CASE, 0x158 }, - { 0x15A, UPPER_CASE, 0x15B }, - { 0x15B, LOWER_CASE, 0x15A }, - { 0x15C, UPPER_CASE, 0x15D }, - { 0x15D, LOWER_CASE, 0x15C }, - { 0x15E, UPPER_CASE, 0x15F }, - { 0x15F, LOWER_CASE, 0x15E }, - { 0x160, UPPER_CASE, 0x161 }, - { 0x161, LOWER_CASE, 0x160 }, - { 0x162, UPPER_CASE, 0x163 }, - { 0x163, LOWER_CASE, 0x162 }, - { 0x164, UPPER_CASE, 0x165 }, - { 0x165, LOWER_CASE, 0x164 }, - { 0x166, UPPER_CASE, 0x167 }, - { 0x167, LOWER_CASE, 0x166 }, - { 0x168, UPPER_CASE, 0x169 }, - { 0x169, LOWER_CASE, 0x168 }, - { 0x16A, UPPER_CASE, 0x16B }, - { 0x16B, LOWER_CASE, 0x16A }, - { 0x16C, UPPER_CASE, 0x16D }, - { 0x16D, LOWER_CASE, 0x16C }, - { 0x16E, UPPER_CASE, 0x16F }, - { 0x16F, LOWER_CASE, 0x16E }, - { 0x170, UPPER_CASE, 0x171 }, - { 0x171, LOWER_CASE, 0x170 }, - { 0x172, UPPER_CASE, 0x173 }, - { 0x173, LOWER_CASE, 0x172 }, - { 0x174, UPPER_CASE, 0x175 }, - { 0x175, LOWER_CASE, 0x174 }, - { 0x176, UPPER_CASE, 0x177 }, - { 0x177, LOWER_CASE, 0x176 }, - { 0x178, UPPER_CASE, 0xFF }, - { 0x179, UPPER_CASE, 0x17A }, - { 0x17A, LOWER_CASE, 0x179 }, - { 0x17B, UPPER_CASE, 0x17C }, - { 0x17C, LOWER_CASE, 0x17B }, - { 0x17D, UPPER_CASE, 0x17E }, - { 0x17E, LOWER_CASE, 0x17D }, - { 0x17F, LOWER_CASE, 0x53 }, - { 0x180, LOWER_CASE, 0x243 }, - { 0x181, UPPER_CASE, 0x253 }, - { 0x182, UPPER_CASE, 0x183 }, - { 0x183, LOWER_CASE, 0x182 }, - { 0x184, UPPER_CASE, 0x185 }, - { 0x185, LOWER_CASE, 0x184 }, - { 0x186, UPPER_CASE, 0x254 }, - { 0x187, UPPER_CASE, 0x188 }, - { 0x188, LOWER_CASE, 0x187 }, - { 0x189, UPPER_CASE, 0x256 }, - { 0x18A, UPPER_CASE, 0x257 }, - { 0x18B, UPPER_CASE, 0x18C }, - { 0x18C, LOWER_CASE, 0x18B }, - { 0x18E, UPPER_CASE, 0x1DD }, - { 0x18F, UPPER_CASE, 0x259 }, - { 0x190, UPPER_CASE, 0x25B }, - { 0x191, UPPER_CASE, 0x192 }, - { 0x192, LOWER_CASE, 0x191 }, - { 0x193, UPPER_CASE, 0x260 }, - { 0x194, UPPER_CASE, 0x263 }, - { 0x195, LOWER_CASE, 0x1F6 }, - { 0x196, UPPER_CASE, 0x269 }, - { 0x197, UPPER_CASE, 0x268 }, - { 0x198, UPPER_CASE, 0x199 }, - { 0x199, LOWER_CASE, 0x198 }, - { 0x19A, LOWER_CASE, 0x23D }, - { 0x19C, UPPER_CASE, 0x26F }, - { 0x19D, UPPER_CASE, 0x272 }, - { 0x19E, LOWER_CASE, 0x220 }, - { 0x19F, UPPER_CASE, 0x275 }, - { 0x1A0, UPPER_CASE, 0x1A1 }, - { 0x1A1, LOWER_CASE, 0x1A0 }, - { 0x1A2, UPPER_CASE, 0x1A3 }, - { 0x1A3, LOWER_CASE, 0x1A2 }, - { 0x1A4, UPPER_CASE, 0x1A5 }, - { 0x1A5, LOWER_CASE, 0x1A4 }, - { 0x1A6, UPPER_CASE, 0x280 }, - { 0x1A7, UPPER_CASE, 0x1A8 }, - { 0x1A8, LOWER_CASE, 0x1A7 }, - { 0x1A9, UPPER_CASE, 0x283 }, - { 0x1AC, UPPER_CASE, 0x1AD }, - { 0x1AD, LOWER_CASE, 0x1AC }, - { 0x1AE, UPPER_CASE, 0x288 }, - { 0x1AF, UPPER_CASE, 0x1B0 }, - { 0x1B0, LOWER_CASE, 0x1AF }, - { 0x1B1, UPPER_CASE, 0x28A }, - { 0x1B2, UPPER_CASE, 0x28B }, - { 0x1B3, UPPER_CASE, 0x1B4 }, - { 0x1B4, LOWER_CASE, 0x1B3 }, - { 0x1B5, UPPER_CASE, 0x1B6 }, - { 0x1B6, LOWER_CASE, 0x1B5 }, - { 0x1B7, UPPER_CASE, 0x292 }, - { 0x1B8, UPPER_CASE, 0x1B9 }, - { 0x1B9, LOWER_CASE, 0x1B8 }, - { 0x1BC, UPPER_CASE, 0x1BD }, - { 0x1BD, LOWER_CASE, 0x1BC }, - { 0x1BF, LOWER_CASE, 0x1F7 }, - { 0x1C4, UPPER_CASE, 0x1C6 }, - { 0x1C5, LOWER_CASE, 0x1C4 }, - { 0x1C6, LOWER_CASE, 0x1C4 }, - { 0x1C7, UPPER_CASE, 0x1C9 }, - { 0x1C8, LOWER_CASE, 0x1C7 }, - { 0x1C9, LOWER_CASE, 0x1C7 }, - { 0x1CA, UPPER_CASE, 0x1CC }, - { 0x1CB, LOWER_CASE, 0x1CA }, - { 0x1CC, LOWER_CASE, 0x1CA }, - { 0x1CD, UPPER_CASE, 0x1CE }, - { 0x1CE, LOWER_CASE, 0x1CD }, - { 0x1CF, UPPER_CASE, 0x1D0 }, - { 0x1D0, LOWER_CASE, 0x1CF }, - { 0x1D1, UPPER_CASE, 0x1D2 }, - { 0x1D2, LOWER_CASE, 0x1D1 }, - { 0x1D3, UPPER_CASE, 0x1D4 }, - { 0x1D4, LOWER_CASE, 0x1D3 }, - { 0x1D5, UPPER_CASE, 0x1D6 }, - { 0x1D6, LOWER_CASE, 0x1D5 }, - { 0x1D7, UPPER_CASE, 0x1D8 }, - { 0x1D8, LOWER_CASE, 0x1D7 }, - { 0x1D9, UPPER_CASE, 0x1DA }, - { 0x1DA, LOWER_CASE, 0x1D9 }, - { 0x1DB, UPPER_CASE, 0x1DC }, - { 0x1DC, LOWER_CASE, 0x1DB }, - { 0x1DD, LOWER_CASE, 0x18E }, - { 0x1DE, UPPER_CASE, 0x1DF }, - { 0x1DF, LOWER_CASE, 0x1DE }, - { 0x1E0, UPPER_CASE, 0x1E1 }, - { 0x1E1, LOWER_CASE, 0x1E0 }, - { 0x1E2, UPPER_CASE, 0x1E3 }, - { 0x1E3, LOWER_CASE, 0x1E2 }, - { 0x1E4, UPPER_CASE, 0x1E5 }, - { 0x1E5, LOWER_CASE, 0x1E4 }, - { 0x1E6, UPPER_CASE, 0x1E7 }, - { 0x1E7, LOWER_CASE, 0x1E6 }, - { 0x1E8, UPPER_CASE, 0x1E9 }, - { 0x1E9, LOWER_CASE, 0x1E8 }, - { 0x1EA, UPPER_CASE, 0x1EB }, - { 0x1EB, LOWER_CASE, 0x1EA }, - { 0x1EC, UPPER_CASE, 0x1ED }, - { 0x1ED, LOWER_CASE, 0x1EC }, - { 0x1EE, UPPER_CASE, 0x1EF }, - { 0x1EF, LOWER_CASE, 0x1EE }, - { 0x1F1, UPPER_CASE, 0x1F3 }, - { 0x1F2, LOWER_CASE, 0x1F1 }, - { 0x1F3, LOWER_CASE, 0x1F1 }, - { 0x1F4, UPPER_CASE, 0x1F5 }, - { 0x1F5, LOWER_CASE, 0x1F4 }, - { 0x1F6, UPPER_CASE, 0x195 }, - { 0x1F7, UPPER_CASE, 0x1BF }, - { 0x1F8, UPPER_CASE, 0x1F9 }, - { 0x1F9, LOWER_CASE, 0x1F8 }, - { 0x1FA, UPPER_CASE, 0x1FB }, - { 0x1FB, LOWER_CASE, 0x1FA }, - { 0x1FC, UPPER_CASE, 0x1FD }, - { 0x1FD, LOWER_CASE, 0x1FC }, - { 0x1FE, UPPER_CASE, 0x1FF }, - { 0x1FF, LOWER_CASE, 0x1FE }, - { 0x200, UPPER_CASE, 0x201 }, - { 0x201, LOWER_CASE, 0x200 }, - { 0x202, UPPER_CASE, 0x203 }, - { 0x203, LOWER_CASE, 0x202 }, - { 0x204, UPPER_CASE, 0x205 }, - { 0x205, LOWER_CASE, 0x204 }, - { 0x206, UPPER_CASE, 0x207 }, - { 0x207, LOWER_CASE, 0x206 }, - { 0x208, UPPER_CASE, 0x209 }, - { 0x209, LOWER_CASE, 0x208 }, - { 0x20A, UPPER_CASE, 0x20B }, - { 0x20B, LOWER_CASE, 0x20A }, - { 0x20C, UPPER_CASE, 0x20D }, - { 0x20D, LOWER_CASE, 0x20C }, - { 0x20E, UPPER_CASE, 0x20F }, - { 0x20F, LOWER_CASE, 0x20E }, - { 0x210, UPPER_CASE, 0x211 }, - { 0x211, LOWER_CASE, 0x210 }, - { 0x212, UPPER_CASE, 0x213 }, - { 0x213, LOWER_CASE, 0x212 }, - { 0x214, UPPER_CASE, 0x215 }, - { 0x215, LOWER_CASE, 0x214 }, - { 0x216, UPPER_CASE, 0x217 }, - { 0x217, LOWER_CASE, 0x216 }, - { 0x218, UPPER_CASE, 0x219 }, - { 0x219, LOWER_CASE, 0x218 }, - { 0x21A, UPPER_CASE, 0x21B }, - { 0x21B, LOWER_CASE, 0x21A }, - { 0x21C, UPPER_CASE, 0x21D }, - { 0x21D, LOWER_CASE, 0x21C }, - { 0x21E, UPPER_CASE, 0x21F }, - { 0x21F, LOWER_CASE, 0x21E }, - { 0x220, UPPER_CASE, 0x19E }, - { 0x222, UPPER_CASE, 0x223 }, - { 0x223, LOWER_CASE, 0x222 }, - { 0x224, UPPER_CASE, 0x225 }, - { 0x225, LOWER_CASE, 0x224 }, - { 0x226, UPPER_CASE, 0x227 }, - { 0x227, LOWER_CASE, 0x226 }, - { 0x228, UPPER_CASE, 0x229 }, - { 0x229, LOWER_CASE, 0x228 }, - { 0x22A, UPPER_CASE, 0x22B }, - { 0x22B, LOWER_CASE, 0x22A }, - { 0x22C, UPPER_CASE, 0x22D }, - { 0x22D, LOWER_CASE, 0x22C }, - { 0x22E, UPPER_CASE, 0x22F }, - { 0x22F, LOWER_CASE, 0x22E }, - { 0x230, UPPER_CASE, 0x231 }, - { 0x231, LOWER_CASE, 0x230 }, - { 0x232, UPPER_CASE, 0x233 }, - { 0x233, LOWER_CASE, 0x232 }, - { 0x23A, UPPER_CASE, 0x2C65 }, - { 0x23B, UPPER_CASE, 0x23C }, - { 0x23C, LOWER_CASE, 0x23B }, - { 0x23D, UPPER_CASE, 0x19A }, - { 0x23E, UPPER_CASE, 0x2C66 }, - { 0x23F, LOWER_CASE, 0x2C7E }, - { 0x240, LOWER_CASE, 0x2C7F }, - { 0x241, UPPER_CASE, 0x242 }, - { 0x242, LOWER_CASE, 0x241 }, - { 0x243, UPPER_CASE, 0x180 }, - { 0x244, UPPER_CASE, 0x289 }, - { 0x245, UPPER_CASE, 0x28C }, - { 0x246, UPPER_CASE, 0x247 }, - { 0x247, LOWER_CASE, 0x246 }, - { 0x248, UPPER_CASE, 0x249 }, - { 0x249, LOWER_CASE, 0x248 }, - { 0x24A, UPPER_CASE, 0x24B }, - { 0x24B, LOWER_CASE, 0x24A }, - { 0x24C, UPPER_CASE, 0x24D }, - { 0x24D, LOWER_CASE, 0x24C }, - { 0x24E, UPPER_CASE, 0x24F }, - { 0x24F, LOWER_CASE, 0x24E }, - { 0x250, LOWER_CASE, 0x2C6F }, - { 0x251, LOWER_CASE, 0x2C6D }, - { 0x252, LOWER_CASE, 0x2C70 }, - { 0x253, LOWER_CASE, 0x181 }, - { 0x254, LOWER_CASE, 0x186 }, - { 0x256, LOWER_CASE, 0x189 }, - { 0x257, LOWER_CASE, 0x18A }, - { 0x259, LOWER_CASE, 0x18F }, - { 0x25B, LOWER_CASE, 0x190 }, - { 0x25C, LOWER_CASE, 0xA7AB }, - { 0x260, LOWER_CASE, 0x193 }, - { 0x261, LOWER_CASE, 0xA7AC }, - { 0x263, LOWER_CASE, 0x194 }, - { 0x265, LOWER_CASE, 0xA78D }, - { 0x266, LOWER_CASE, 0xA7AA }, - { 0x268, LOWER_CASE, 0x197 }, - { 0x269, LOWER_CASE, 0x196 }, - { 0x26A, LOWER_CASE, 0xA7AE }, - { 0x26B, LOWER_CASE, 0x2C62 }, - { 0x26C, LOWER_CASE, 0xA7AD }, - { 0x26F, LOWER_CASE, 0x19C }, - { 0x271, LOWER_CASE, 0x2C6E }, - { 0x272, LOWER_CASE, 0x19D }, - { 0x275, LOWER_CASE, 0x19F }, - { 0x27D, LOWER_CASE, 0x2C64 }, - { 0x280, LOWER_CASE, 0x1A6 }, - { 0x282, LOWER_CASE, 0xA7C5 }, - { 0x283, LOWER_CASE, 0x1A9 }, - { 0x287, LOWER_CASE, 0xA7B1 }, - { 0x288, LOWER_CASE, 0x1AE }, - { 0x289, LOWER_CASE, 0x244 }, - { 0x28A, LOWER_CASE, 0x1B1 }, - { 0x28B, LOWER_CASE, 0x1B2 }, - { 0x28C, LOWER_CASE, 0x245 }, - { 0x292, LOWER_CASE, 0x1B7 }, - { 0x29D, LOWER_CASE, 0xA7B2 }, - { 0x29E, LOWER_CASE, 0xA7B0 }, - { 0x345, LOWER_CASE, 0x399 }, - { 0x370, UPPER_CASE, 0x371 }, - { 0x371, LOWER_CASE, 0x370 }, - { 0x372, UPPER_CASE, 0x373 }, - { 0x373, LOWER_CASE, 0x372 }, - { 0x376, UPPER_CASE, 0x377 }, - { 0x377, LOWER_CASE, 0x376 }, - { 0x37B, LOWER_CASE, 0x3FD }, - { 0x37C, LOWER_CASE, 0x3FE }, - { 0x37D, LOWER_CASE, 0x3FF }, - { 0x37F, UPPER_CASE, 0x3F3 }, - { 0x386, UPPER_CASE, 0x3AC }, - { 0x388, UPPER_CASE, 0x3AD }, - { 0x389, UPPER_CASE, 0x3AE }, - { 0x38A, UPPER_CASE, 0x3AF }, - { 0x38C, UPPER_CASE, 0x3CC }, - { 0x38E, UPPER_CASE, 0x3CD }, - { 0x38F, UPPER_CASE, 0x3CE }, - { 0x391, UPPER_CASE, 0x3B1 }, - { 0x392, UPPER_CASE, 0x3B2 }, - { 0x393, UPPER_CASE, 0x3B3 }, - { 0x394, UPPER_CASE, 0x3B4 }, - { 0x395, UPPER_CASE, 0x3B5 }, - { 0x396, UPPER_CASE, 0x3B6 }, - { 0x397, UPPER_CASE, 0x3B7 }, - { 0x398, UPPER_CASE, 0x3B8 }, - { 0x399, UPPER_CASE, 0x3B9 }, - { 0x39A, UPPER_CASE, 0x3BA }, - { 0x39B, UPPER_CASE, 0x3BB }, - { 0x39C, UPPER_CASE, 0x3BC }, - { 0x39D, UPPER_CASE, 0x3BD }, - { 0x39E, UPPER_CASE, 0x3BE }, - { 0x39F, UPPER_CASE, 0x3BF }, - { 0x3A0, UPPER_CASE, 0x3C0 }, - { 0x3A1, UPPER_CASE, 0x3C1 }, - { 0x3A3, UPPER_CASE, 0x3C3 }, - { 0x3A4, UPPER_CASE, 0x3C4 }, - { 0x3A5, UPPER_CASE, 0x3C5 }, - { 0x3A6, UPPER_CASE, 0x3C6 }, - { 0x3A7, UPPER_CASE, 0x3C7 }, - { 0x3A8, UPPER_CASE, 0x3C8 }, - { 0x3A9, UPPER_CASE, 0x3C9 }, - { 0x3AA, UPPER_CASE, 0x3CA }, - { 0x3AB, UPPER_CASE, 0x3CB }, - { 0x3AC, LOWER_CASE, 0x386 }, - { 0x3AD, LOWER_CASE, 0x388 }, - { 0x3AE, LOWER_CASE, 0x389 }, - { 0x3AF, LOWER_CASE, 0x38A }, - { 0x3B1, LOWER_CASE, 0x391 }, - { 0x3B2, LOWER_CASE, 0x392 }, - { 0x3B3, LOWER_CASE, 0x393 }, - { 0x3B4, LOWER_CASE, 0x394 }, - { 0x3B5, LOWER_CASE, 0x395 }, - { 0x3B6, LOWER_CASE, 0x396 }, - { 0x3B7, LOWER_CASE, 0x397 }, - { 0x3B8, LOWER_CASE, 0x398 }, - { 0x3B9, LOWER_CASE, 0x399 }, - { 0x3BA, LOWER_CASE, 0x39A }, - { 0x3BB, LOWER_CASE, 0x39B }, - { 0x3BC, LOWER_CASE, 0x39C }, - { 0x3BD, LOWER_CASE, 0x39D }, - { 0x3BE, LOWER_CASE, 0x39E }, - { 0x3BF, LOWER_CASE, 0x39F }, - { 0x3C0, LOWER_CASE, 0x3A0 }, - { 0x3C1, LOWER_CASE, 0x3A1 }, - { 0x3C2, LOWER_CASE, 0x3A3 }, - { 0x3C3, LOWER_CASE, 0x3A3 }, - { 0x3C4, LOWER_CASE, 0x3A4 }, - { 0x3C5, LOWER_CASE, 0x3A5 }, - { 0x3C6, LOWER_CASE, 0x3A6 }, - { 0x3C7, LOWER_CASE, 0x3A7 }, - { 0x3C8, LOWER_CASE, 0x3A8 }, - { 0x3C9, LOWER_CASE, 0x3A9 }, - { 0x3CA, LOWER_CASE, 0x3AA }, - { 0x3CB, LOWER_CASE, 0x3AB }, - { 0x3CC, LOWER_CASE, 0x38C }, - { 0x3CD, LOWER_CASE, 0x38E }, - { 0x3CE, LOWER_CASE, 0x38F }, - { 0x3CF, UPPER_CASE, 0x3D7 }, - { 0x3D0, LOWER_CASE, 0x392 }, - { 0x3D1, LOWER_CASE, 0x398 }, - { 0x3D5, LOWER_CASE, 0x3A6 }, - { 0x3D6, LOWER_CASE, 0x3A0 }, - { 0x3D7, LOWER_CASE, 0x3CF }, - { 0x3D8, UPPER_CASE, 0x3D9 }, - { 0x3D9, LOWER_CASE, 0x3D8 }, - { 0x3DA, UPPER_CASE, 0x3DB }, - { 0x3DB, LOWER_CASE, 0x3DA }, - { 0x3DC, UPPER_CASE, 0x3DD }, - { 0x3DD, LOWER_CASE, 0x3DC }, - { 0x3DE, UPPER_CASE, 0x3DF }, - { 0x3DF, LOWER_CASE, 0x3DE }, - { 0x3E0, UPPER_CASE, 0x3E1 }, - { 0x3E1, LOWER_CASE, 0x3E0 }, - { 0x3E2, UPPER_CASE, 0x3E3 }, - { 0x3E3, LOWER_CASE, 0x3E2 }, - { 0x3E4, UPPER_CASE, 0x3E5 }, - { 0x3E5, LOWER_CASE, 0x3E4 }, - { 0x3E6, UPPER_CASE, 0x3E7 }, - { 0x3E7, LOWER_CASE, 0x3E6 }, - { 0x3E8, UPPER_CASE, 0x3E9 }, - { 0x3E9, LOWER_CASE, 0x3E8 }, - { 0x3EA, UPPER_CASE, 0x3EB }, - { 0x3EB, LOWER_CASE, 0x3EA }, - { 0x3EC, UPPER_CASE, 0x3ED }, - { 0x3ED, LOWER_CASE, 0x3EC }, - { 0x3EE, UPPER_CASE, 0x3EF }, - { 0x3EF, LOWER_CASE, 0x3EE }, - { 0x3F0, LOWER_CASE, 0x39A }, - { 0x3F1, LOWER_CASE, 0x3A1 }, - { 0x3F2, LOWER_CASE, 0x3F9 }, - { 0x3F3, LOWER_CASE, 0x37F }, - { 0x3F4, UPPER_CASE, 0x3B8 }, - { 0x3F5, LOWER_CASE, 0x395 }, - { 0x3F7, UPPER_CASE, 0x3F8 }, - { 0x3F8, LOWER_CASE, 0x3F7 }, - { 0x3F9, UPPER_CASE, 0x3F2 }, - { 0x3FA, UPPER_CASE, 0x3FB }, - { 0x3FB, LOWER_CASE, 0x3FA }, - { 0x3FD, UPPER_CASE, 0x37B }, - { 0x3FE, UPPER_CASE, 0x37C }, - { 0x3FF, UPPER_CASE, 0x37D }, - { 0x400, UPPER_CASE, 0x450 }, - { 0x401, UPPER_CASE, 0x451 }, - { 0x402, UPPER_CASE, 0x452 }, - { 0x403, UPPER_CASE, 0x453 }, - { 0x404, UPPER_CASE, 0x454 }, - { 0x405, UPPER_CASE, 0x455 }, - { 0x406, UPPER_CASE, 0x456 }, - { 0x407, UPPER_CASE, 0x457 }, - { 0x408, UPPER_CASE, 0x458 }, - { 0x409, UPPER_CASE, 0x459 }, - { 0x40A, UPPER_CASE, 0x45A }, - { 0x40B, UPPER_CASE, 0x45B }, - { 0x40C, UPPER_CASE, 0x45C }, - { 0x40D, UPPER_CASE, 0x45D }, - { 0x40E, UPPER_CASE, 0x45E }, - { 0x40F, UPPER_CASE, 0x45F }, - { 0x410, UPPER_CASE, 0x430 }, - { 0x411, UPPER_CASE, 0x431 }, - { 0x412, UPPER_CASE, 0x432 }, - { 0x413, UPPER_CASE, 0x433 }, - { 0x414, UPPER_CASE, 0x434 }, - { 0x415, UPPER_CASE, 0x435 }, - { 0x416, UPPER_CASE, 0x436 }, - { 0x417, UPPER_CASE, 0x437 }, - { 0x418, UPPER_CASE, 0x438 }, - { 0x419, UPPER_CASE, 0x439 }, - { 0x41A, UPPER_CASE, 0x43A }, - { 0x41B, UPPER_CASE, 0x43B }, - { 0x41C, UPPER_CASE, 0x43C }, - { 0x41D, UPPER_CASE, 0x43D }, - { 0x41E, UPPER_CASE, 0x43E }, - { 0x41F, UPPER_CASE, 0x43F }, - { 0x420, UPPER_CASE, 0x440 }, - { 0x421, UPPER_CASE, 0x441 }, - { 0x422, UPPER_CASE, 0x442 }, - { 0x423, UPPER_CASE, 0x443 }, - { 0x424, UPPER_CASE, 0x444 }, - { 0x425, UPPER_CASE, 0x445 }, - { 0x426, UPPER_CASE, 0x446 }, - { 0x427, UPPER_CASE, 0x447 }, - { 0x428, UPPER_CASE, 0x448 }, - { 0x429, UPPER_CASE, 0x449 }, - { 0x42A, UPPER_CASE, 0x44A }, - { 0x42B, UPPER_CASE, 0x44B }, - { 0x42C, UPPER_CASE, 0x44C }, - { 0x42D, UPPER_CASE, 0x44D }, - { 0x42E, UPPER_CASE, 0x44E }, - { 0x42F, UPPER_CASE, 0x44F }, - { 0x430, LOWER_CASE, 0x410 }, - { 0x431, LOWER_CASE, 0x411 }, - { 0x432, LOWER_CASE, 0x412 }, - { 0x433, LOWER_CASE, 0x413 }, - { 0x434, LOWER_CASE, 0x414 }, - { 0x435, LOWER_CASE, 0x415 }, - { 0x436, LOWER_CASE, 0x416 }, - { 0x437, LOWER_CASE, 0x417 }, - { 0x438, LOWER_CASE, 0x418 }, - { 0x439, LOWER_CASE, 0x419 }, - { 0x43A, LOWER_CASE, 0x41A }, - { 0x43B, LOWER_CASE, 0x41B }, - { 0x43C, LOWER_CASE, 0x41C }, - { 0x43D, LOWER_CASE, 0x41D }, - { 0x43E, LOWER_CASE, 0x41E }, - { 0x43F, LOWER_CASE, 0x41F }, - { 0x440, LOWER_CASE, 0x420 }, - { 0x441, LOWER_CASE, 0x421 }, - { 0x442, LOWER_CASE, 0x422 }, - { 0x443, LOWER_CASE, 0x423 }, - { 0x444, LOWER_CASE, 0x424 }, - { 0x445, LOWER_CASE, 0x425 }, - { 0x446, LOWER_CASE, 0x426 }, - { 0x447, LOWER_CASE, 0x427 }, - { 0x448, LOWER_CASE, 0x428 }, - { 0x449, LOWER_CASE, 0x429 }, - { 0x44A, LOWER_CASE, 0x42A }, - { 0x44B, LOWER_CASE, 0x42B }, - { 0x44C, LOWER_CASE, 0x42C }, - { 0x44D, LOWER_CASE, 0x42D }, - { 0x44E, LOWER_CASE, 0x42E }, - { 0x44F, LOWER_CASE, 0x42F }, - { 0x450, LOWER_CASE, 0x400 }, - { 0x451, LOWER_CASE, 0x401 }, - { 0x452, LOWER_CASE, 0x402 }, - { 0x453, LOWER_CASE, 0x403 }, - { 0x454, LOWER_CASE, 0x404 }, - { 0x455, LOWER_CASE, 0x405 }, - { 0x456, LOWER_CASE, 0x406 }, - { 0x457, LOWER_CASE, 0x407 }, - { 0x458, LOWER_CASE, 0x408 }, - { 0x459, LOWER_CASE, 0x409 }, - { 0x45A, LOWER_CASE, 0x40A }, - { 0x45B, LOWER_CASE, 0x40B }, - { 0x45C, LOWER_CASE, 0x40C }, - { 0x45D, LOWER_CASE, 0x40D }, - { 0x45E, LOWER_CASE, 0x40E }, - { 0x45F, LOWER_CASE, 0x40F }, - { 0x460, UPPER_CASE, 0x461 }, - { 0x461, LOWER_CASE, 0x460 }, - { 0x462, UPPER_CASE, 0x463 }, - { 0x463, LOWER_CASE, 0x462 }, - { 0x464, UPPER_CASE, 0x465 }, - { 0x465, LOWER_CASE, 0x464 }, - { 0x466, UPPER_CASE, 0x467 }, - { 0x467, LOWER_CASE, 0x466 }, - { 0x468, UPPER_CASE, 0x469 }, - { 0x469, LOWER_CASE, 0x468 }, - { 0x46A, UPPER_CASE, 0x46B }, - { 0x46B, LOWER_CASE, 0x46A }, - { 0x46C, UPPER_CASE, 0x46D }, - { 0x46D, LOWER_CASE, 0x46C }, - { 0x46E, UPPER_CASE, 0x46F }, - { 0x46F, LOWER_CASE, 0x46E }, - { 0x470, UPPER_CASE, 0x471 }, - { 0x471, LOWER_CASE, 0x470 }, - { 0x472, UPPER_CASE, 0x473 }, - { 0x473, LOWER_CASE, 0x472 }, - { 0x474, UPPER_CASE, 0x475 }, - { 0x475, LOWER_CASE, 0x474 }, - { 0x476, UPPER_CASE, 0x477 }, - { 0x477, LOWER_CASE, 0x476 }, - { 0x478, UPPER_CASE, 0x479 }, - { 0x479, LOWER_CASE, 0x478 }, - { 0x47A, UPPER_CASE, 0x47B }, - { 0x47B, LOWER_CASE, 0x47A }, - { 0x47C, UPPER_CASE, 0x47D }, - { 0x47D, LOWER_CASE, 0x47C }, - { 0x47E, UPPER_CASE, 0x47F }, - { 0x47F, LOWER_CASE, 0x47E }, - { 0x480, UPPER_CASE, 0x481 }, - { 0x481, LOWER_CASE, 0x480 }, - { 0x48A, UPPER_CASE, 0x48B }, - { 0x48B, LOWER_CASE, 0x48A }, - { 0x48C, UPPER_CASE, 0x48D }, - { 0x48D, LOWER_CASE, 0x48C }, - { 0x48E, UPPER_CASE, 0x48F }, - { 0x48F, LOWER_CASE, 0x48E }, - { 0x490, UPPER_CASE, 0x491 }, - { 0x491, LOWER_CASE, 0x490 }, - { 0x492, UPPER_CASE, 0x493 }, - { 0x493, LOWER_CASE, 0x492 }, - { 0x494, UPPER_CASE, 0x495 }, - { 0x495, LOWER_CASE, 0x494 }, - { 0x496, UPPER_CASE, 0x497 }, - { 0x497, LOWER_CASE, 0x496 }, - { 0x498, UPPER_CASE, 0x499 }, - { 0x499, LOWER_CASE, 0x498 }, - { 0x49A, UPPER_CASE, 0x49B }, - { 0x49B, LOWER_CASE, 0x49A }, - { 0x49C, UPPER_CASE, 0x49D }, - { 0x49D, LOWER_CASE, 0x49C }, - { 0x49E, UPPER_CASE, 0x49F }, - { 0x49F, LOWER_CASE, 0x49E }, - { 0x4A0, UPPER_CASE, 0x4A1 }, - { 0x4A1, LOWER_CASE, 0x4A0 }, - { 0x4A2, UPPER_CASE, 0x4A3 }, - { 0x4A3, LOWER_CASE, 0x4A2 }, - { 0x4A4, UPPER_CASE, 0x4A5 }, - { 0x4A5, LOWER_CASE, 0x4A4 }, - { 0x4A6, UPPER_CASE, 0x4A7 }, - { 0x4A7, LOWER_CASE, 0x4A6 }, - { 0x4A8, UPPER_CASE, 0x4A9 }, - { 0x4A9, LOWER_CASE, 0x4A8 }, - { 0x4AA, UPPER_CASE, 0x4AB }, - { 0x4AB, LOWER_CASE, 0x4AA }, - { 0x4AC, UPPER_CASE, 0x4AD }, - { 0x4AD, LOWER_CASE, 0x4AC }, - { 0x4AE, UPPER_CASE, 0x4AF }, - { 0x4AF, LOWER_CASE, 0x4AE }, - { 0x4B0, UPPER_CASE, 0x4B1 }, - { 0x4B1, LOWER_CASE, 0x4B0 }, - { 0x4B2, UPPER_CASE, 0x4B3 }, - { 0x4B3, LOWER_CASE, 0x4B2 }, - { 0x4B4, UPPER_CASE, 0x4B5 }, - { 0x4B5, LOWER_CASE, 0x4B4 }, - { 0x4B6, UPPER_CASE, 0x4B7 }, - { 0x4B7, LOWER_CASE, 0x4B6 }, - { 0x4B8, UPPER_CASE, 0x4B9 }, - { 0x4B9, LOWER_CASE, 0x4B8 }, - { 0x4BA, UPPER_CASE, 0x4BB }, - { 0x4BB, LOWER_CASE, 0x4BA }, - { 0x4BC, UPPER_CASE, 0x4BD }, - { 0x4BD, LOWER_CASE, 0x4BC }, - { 0x4BE, UPPER_CASE, 0x4BF }, - { 0x4BF, LOWER_CASE, 0x4BE }, - { 0x4C0, UPPER_CASE, 0x4CF }, - { 0x4C1, UPPER_CASE, 0x4C2 }, - { 0x4C2, LOWER_CASE, 0x4C1 }, - { 0x4C3, UPPER_CASE, 0x4C4 }, - { 0x4C4, LOWER_CASE, 0x4C3 }, - { 0x4C5, UPPER_CASE, 0x4C6 }, - { 0x4C6, LOWER_CASE, 0x4C5 }, - { 0x4C7, UPPER_CASE, 0x4C8 }, - { 0x4C8, LOWER_CASE, 0x4C7 }, - { 0x4C9, UPPER_CASE, 0x4CA }, - { 0x4CA, LOWER_CASE, 0x4C9 }, - { 0x4CB, UPPER_CASE, 0x4CC }, - { 0x4CC, LOWER_CASE, 0x4CB }, - { 0x4CD, UPPER_CASE, 0x4CE }, - { 0x4CE, LOWER_CASE, 0x4CD }, - { 0x4CF, LOWER_CASE, 0x4C0 }, - { 0x4D0, UPPER_CASE, 0x4D1 }, - { 0x4D1, LOWER_CASE, 0x4D0 }, - { 0x4D2, UPPER_CASE, 0x4D3 }, - { 0x4D3, LOWER_CASE, 0x4D2 }, - { 0x4D4, UPPER_CASE, 0x4D5 }, - { 0x4D5, LOWER_CASE, 0x4D4 }, - { 0x4D6, UPPER_CASE, 0x4D7 }, - { 0x4D7, LOWER_CASE, 0x4D6 }, - { 0x4D8, UPPER_CASE, 0x4D9 }, - { 0x4D9, LOWER_CASE, 0x4D8 }, - { 0x4DA, UPPER_CASE, 0x4DB }, - { 0x4DB, LOWER_CASE, 0x4DA }, - { 0x4DC, UPPER_CASE, 0x4DD }, - { 0x4DD, LOWER_CASE, 0x4DC }, - { 0x4DE, UPPER_CASE, 0x4DF }, - { 0x4DF, LOWER_CASE, 0x4DE }, - { 0x4E0, UPPER_CASE, 0x4E1 }, - { 0x4E1, LOWER_CASE, 0x4E0 }, - { 0x4E2, UPPER_CASE, 0x4E3 }, - { 0x4E3, LOWER_CASE, 0x4E2 }, - { 0x4E4, UPPER_CASE, 0x4E5 }, - { 0x4E5, LOWER_CASE, 0x4E4 }, - { 0x4E6, UPPER_CASE, 0x4E7 }, - { 0x4E7, LOWER_CASE, 0x4E6 }, - { 0x4E8, UPPER_CASE, 0x4E9 }, - { 0x4E9, LOWER_CASE, 0x4E8 }, - { 0x4EA, UPPER_CASE, 0x4EB }, - { 0x4EB, LOWER_CASE, 0x4EA }, - { 0x4EC, UPPER_CASE, 0x4ED }, - { 0x4ED, LOWER_CASE, 0x4EC }, - { 0x4EE, UPPER_CASE, 0x4EF }, - { 0x4EF, LOWER_CASE, 0x4EE }, - { 0x4F0, UPPER_CASE, 0x4F1 }, - { 0x4F1, LOWER_CASE, 0x4F0 }, - { 0x4F2, UPPER_CASE, 0x4F3 }, - { 0x4F3, LOWER_CASE, 0x4F2 }, - { 0x4F4, UPPER_CASE, 0x4F5 }, - { 0x4F5, LOWER_CASE, 0x4F4 }, - { 0x4F6, UPPER_CASE, 0x4F7 }, - { 0x4F7, LOWER_CASE, 0x4F6 }, - { 0x4F8, UPPER_CASE, 0x4F9 }, - { 0x4F9, LOWER_CASE, 0x4F8 }, - { 0x4FA, UPPER_CASE, 0x4FB }, - { 0x4FB, LOWER_CASE, 0x4FA }, - { 0x4FC, UPPER_CASE, 0x4FD }, - { 0x4FD, LOWER_CASE, 0x4FC }, - { 0x4FE, UPPER_CASE, 0x4FF }, - { 0x4FF, LOWER_CASE, 0x4FE }, - { 0x500, UPPER_CASE, 0x501 }, - { 0x501, LOWER_CASE, 0x500 }, - { 0x502, UPPER_CASE, 0x503 }, - { 0x503, LOWER_CASE, 0x502 }, - { 0x504, UPPER_CASE, 0x505 }, - { 0x505, LOWER_CASE, 0x504 }, - { 0x506, UPPER_CASE, 0x507 }, - { 0x507, LOWER_CASE, 0x506 }, - { 0x508, UPPER_CASE, 0x509 }, - { 0x509, LOWER_CASE, 0x508 }, - { 0x50A, UPPER_CASE, 0x50B }, - { 0x50B, LOWER_CASE, 0x50A }, - { 0x50C, UPPER_CASE, 0x50D }, - { 0x50D, LOWER_CASE, 0x50C }, - { 0x50E, UPPER_CASE, 0x50F }, - { 0x50F, LOWER_CASE, 0x50E }, - { 0x510, UPPER_CASE, 0x511 }, - { 0x511, LOWER_CASE, 0x510 }, - { 0x512, UPPER_CASE, 0x513 }, - { 0x513, LOWER_CASE, 0x512 }, - { 0x514, UPPER_CASE, 0x515 }, - { 0x515, LOWER_CASE, 0x514 }, - { 0x516, UPPER_CASE, 0x517 }, - { 0x517, LOWER_CASE, 0x516 }, - { 0x518, UPPER_CASE, 0x519 }, - { 0x519, LOWER_CASE, 0x518 }, - { 0x51A, UPPER_CASE, 0x51B }, - { 0x51B, LOWER_CASE, 0x51A }, - { 0x51C, UPPER_CASE, 0x51D }, - { 0x51D, LOWER_CASE, 0x51C }, - { 0x51E, UPPER_CASE, 0x51F }, - { 0x51F, LOWER_CASE, 0x51E }, - { 0x520, UPPER_CASE, 0x521 }, - { 0x521, LOWER_CASE, 0x520 }, - { 0x522, UPPER_CASE, 0x523 }, - { 0x523, LOWER_CASE, 0x522 }, - { 0x524, UPPER_CASE, 0x525 }, - { 0x525, LOWER_CASE, 0x524 }, - { 0x526, UPPER_CASE, 0x527 }, - { 0x527, LOWER_CASE, 0x526 }, - { 0x528, UPPER_CASE, 0x529 }, - { 0x529, LOWER_CASE, 0x528 }, - { 0x52A, UPPER_CASE, 0x52B }, - { 0x52B, LOWER_CASE, 0x52A }, - { 0x52C, UPPER_CASE, 0x52D }, - { 0x52D, LOWER_CASE, 0x52C }, - { 0x52E, UPPER_CASE, 0x52F }, - { 0x52F, LOWER_CASE, 0x52E }, - { 0x531, UPPER_CASE, 0x561 }, - { 0x532, UPPER_CASE, 0x562 }, - { 0x533, UPPER_CASE, 0x563 }, - { 0x534, UPPER_CASE, 0x564 }, - { 0x535, UPPER_CASE, 0x565 }, - { 0x536, UPPER_CASE, 0x566 }, - { 0x537, UPPER_CASE, 0x567 }, - { 0x538, UPPER_CASE, 0x568 }, - { 0x539, UPPER_CASE, 0x569 }, - { 0x53A, UPPER_CASE, 0x56A }, - { 0x53B, UPPER_CASE, 0x56B }, - { 0x53C, UPPER_CASE, 0x56C }, - { 0x53D, UPPER_CASE, 0x56D }, - { 0x53E, UPPER_CASE, 0x56E }, - { 0x53F, UPPER_CASE, 0x56F }, - { 0x540, UPPER_CASE, 0x570 }, - { 0x541, UPPER_CASE, 0x571 }, - { 0x542, UPPER_CASE, 0x572 }, - { 0x543, UPPER_CASE, 0x573 }, - { 0x544, UPPER_CASE, 0x574 }, - { 0x545, UPPER_CASE, 0x575 }, - { 0x546, UPPER_CASE, 0x576 }, - { 0x547, UPPER_CASE, 0x577 }, - { 0x548, UPPER_CASE, 0x578 }, - { 0x549, UPPER_CASE, 0x579 }, - { 0x54A, UPPER_CASE, 0x57A }, - { 0x54B, UPPER_CASE, 0x57B }, - { 0x54C, UPPER_CASE, 0x57C }, - { 0x54D, UPPER_CASE, 0x57D }, - { 0x54E, UPPER_CASE, 0x57E }, - { 0x54F, UPPER_CASE, 0x57F }, - { 0x550, UPPER_CASE, 0x580 }, - { 0x551, UPPER_CASE, 0x581 }, - { 0x552, UPPER_CASE, 0x582 }, - { 0x553, UPPER_CASE, 0x583 }, - { 0x554, UPPER_CASE, 0x584 }, - { 0x555, UPPER_CASE, 0x585 }, - { 0x556, UPPER_CASE, 0x586 }, - { 0x561, LOWER_CASE, 0x531 }, - { 0x562, LOWER_CASE, 0x532 }, - { 0x563, LOWER_CASE, 0x533 }, - { 0x564, LOWER_CASE, 0x534 }, - { 0x565, LOWER_CASE, 0x535 }, - { 0x566, LOWER_CASE, 0x536 }, - { 0x567, LOWER_CASE, 0x537 }, - { 0x568, LOWER_CASE, 0x538 }, - { 0x569, LOWER_CASE, 0x539 }, - { 0x56A, LOWER_CASE, 0x53A }, - { 0x56B, LOWER_CASE, 0x53B }, - { 0x56C, LOWER_CASE, 0x53C }, - { 0x56D, LOWER_CASE, 0x53D }, - { 0x56E, LOWER_CASE, 0x53E }, - { 0x56F, LOWER_CASE, 0x53F }, - { 0x570, LOWER_CASE, 0x540 }, - { 0x571, LOWER_CASE, 0x541 }, - { 0x572, LOWER_CASE, 0x542 }, - { 0x573, LOWER_CASE, 0x543 }, - { 0x574, LOWER_CASE, 0x544 }, - { 0x575, LOWER_CASE, 0x545 }, - { 0x576, LOWER_CASE, 0x546 }, - { 0x577, LOWER_CASE, 0x547 }, - { 0x578, LOWER_CASE, 0x548 }, - { 0x579, LOWER_CASE, 0x549 }, - { 0x57A, LOWER_CASE, 0x54A }, - { 0x57B, LOWER_CASE, 0x54B }, - { 0x57C, LOWER_CASE, 0x54C }, - { 0x57D, LOWER_CASE, 0x54D }, - { 0x57E, LOWER_CASE, 0x54E }, - { 0x57F, LOWER_CASE, 0x54F }, - { 0x580, LOWER_CASE, 0x550 }, - { 0x581, LOWER_CASE, 0x551 }, - { 0x582, LOWER_CASE, 0x552 }, - { 0x583, LOWER_CASE, 0x553 }, - { 0x584, LOWER_CASE, 0x554 }, - { 0x585, LOWER_CASE, 0x555 }, - { 0x586, LOWER_CASE, 0x556 }, - { 0x10A0, UPPER_CASE, 0x2D00 }, - { 0x10A1, UPPER_CASE, 0x2D01 }, - { 0x10A2, UPPER_CASE, 0x2D02 }, - { 0x10A3, UPPER_CASE, 0x2D03 }, - { 0x10A4, UPPER_CASE, 0x2D04 }, - { 0x10A5, UPPER_CASE, 0x2D05 }, - { 0x10A6, UPPER_CASE, 0x2D06 }, - { 0x10A7, UPPER_CASE, 0x2D07 }, - { 0x10A8, UPPER_CASE, 0x2D08 }, - { 0x10A9, UPPER_CASE, 0x2D09 }, - { 0x10AA, UPPER_CASE, 0x2D0A }, - { 0x10AB, UPPER_CASE, 0x2D0B }, - { 0x10AC, UPPER_CASE, 0x2D0C }, - { 0x10AD, UPPER_CASE, 0x2D0D }, - { 0x10AE, UPPER_CASE, 0x2D0E }, - { 0x10AF, UPPER_CASE, 0x2D0F }, - { 0x10B0, UPPER_CASE, 0x2D10 }, - { 0x10B1, UPPER_CASE, 0x2D11 }, - { 0x10B2, UPPER_CASE, 0x2D12 }, - { 0x10B3, UPPER_CASE, 0x2D13 }, - { 0x10B4, UPPER_CASE, 0x2D14 }, - { 0x10B5, UPPER_CASE, 0x2D15 }, - { 0x10B6, UPPER_CASE, 0x2D16 }, - { 0x10B7, UPPER_CASE, 0x2D17 }, - { 0x10B8, UPPER_CASE, 0x2D18 }, - { 0x10B9, UPPER_CASE, 0x2D19 }, - { 0x10BA, UPPER_CASE, 0x2D1A }, - { 0x10BB, UPPER_CASE, 0x2D1B }, - { 0x10BC, UPPER_CASE, 0x2D1C }, - { 0x10BD, UPPER_CASE, 0x2D1D }, - { 0x10BE, UPPER_CASE, 0x2D1E }, - { 0x10BF, UPPER_CASE, 0x2D1F }, - { 0x10C0, UPPER_CASE, 0x2D20 }, - { 0x10C1, UPPER_CASE, 0x2D21 }, - { 0x10C2, UPPER_CASE, 0x2D22 }, - { 0x10C3, UPPER_CASE, 0x2D23 }, - { 0x10C4, UPPER_CASE, 0x2D24 }, - { 0x10C5, UPPER_CASE, 0x2D25 }, - { 0x10C7, UPPER_CASE, 0x2D27 }, - { 0x10CD, UPPER_CASE, 0x2D2D }, - { 0x10D0, LOWER_CASE, 0x1C90 }, - { 0x10D1, LOWER_CASE, 0x1C91 }, - { 0x10D2, LOWER_CASE, 0x1C92 }, - { 0x10D3, LOWER_CASE, 0x1C93 }, - { 0x10D4, LOWER_CASE, 0x1C94 }, - { 0x10D5, LOWER_CASE, 0x1C95 }, - { 0x10D6, LOWER_CASE, 0x1C96 }, - { 0x10D7, LOWER_CASE, 0x1C97 }, - { 0x10D8, LOWER_CASE, 0x1C98 }, - { 0x10D9, LOWER_CASE, 0x1C99 }, - { 0x10DA, LOWER_CASE, 0x1C9A }, - { 0x10DB, LOWER_CASE, 0x1C9B }, - { 0x10DC, LOWER_CASE, 0x1C9C }, - { 0x10DD, LOWER_CASE, 0x1C9D }, - { 0x10DE, LOWER_CASE, 0x1C9E }, - { 0x10DF, LOWER_CASE, 0x1C9F }, - { 0x10E0, LOWER_CASE, 0x1CA0 }, - { 0x10E1, LOWER_CASE, 0x1CA1 }, - { 0x10E2, LOWER_CASE, 0x1CA2 }, - { 0x10E3, LOWER_CASE, 0x1CA3 }, - { 0x10E4, LOWER_CASE, 0x1CA4 }, - { 0x10E5, LOWER_CASE, 0x1CA5 }, - { 0x10E6, LOWER_CASE, 0x1CA6 }, - { 0x10E7, LOWER_CASE, 0x1CA7 }, - { 0x10E8, LOWER_CASE, 0x1CA8 }, - { 0x10E9, LOWER_CASE, 0x1CA9 }, - { 0x10EA, LOWER_CASE, 0x1CAA }, - { 0x10EB, LOWER_CASE, 0x1CAB }, - { 0x10EC, LOWER_CASE, 0x1CAC }, - { 0x10ED, LOWER_CASE, 0x1CAD }, - { 0x10EE, LOWER_CASE, 0x1CAE }, - { 0x10EF, LOWER_CASE, 0x1CAF }, - { 0x10F0, LOWER_CASE, 0x1CB0 }, - { 0x10F1, LOWER_CASE, 0x1CB1 }, - { 0x10F2, LOWER_CASE, 0x1CB2 }, - { 0x10F3, LOWER_CASE, 0x1CB3 }, - { 0x10F4, LOWER_CASE, 0x1CB4 }, - { 0x10F5, LOWER_CASE, 0x1CB5 }, - { 0x10F6, LOWER_CASE, 0x1CB6 }, - { 0x10F7, LOWER_CASE, 0x1CB7 }, - { 0x10F8, LOWER_CASE, 0x1CB8 }, - { 0x10F9, LOWER_CASE, 0x1CB9 }, - { 0x10FA, LOWER_CASE, 0x1CBA }, - { 0x10FD, LOWER_CASE, 0x1CBD }, - { 0x10FE, LOWER_CASE, 0x1CBE }, - { 0x10FF, LOWER_CASE, 0x1CBF }, - { 0x13A0, UPPER_CASE, 0xAB70 }, - { 0x13A1, UPPER_CASE, 0xAB71 }, - { 0x13A2, UPPER_CASE, 0xAB72 }, - { 0x13A3, UPPER_CASE, 0xAB73 }, - { 0x13A4, UPPER_CASE, 0xAB74 }, - { 0x13A5, UPPER_CASE, 0xAB75 }, - { 0x13A6, UPPER_CASE, 0xAB76 }, - { 0x13A7, UPPER_CASE, 0xAB77 }, - { 0x13A8, UPPER_CASE, 0xAB78 }, - { 0x13A9, UPPER_CASE, 0xAB79 }, - { 0x13AA, UPPER_CASE, 0xAB7A }, - { 0x13AB, UPPER_CASE, 0xAB7B }, - { 0x13AC, UPPER_CASE, 0xAB7C }, - { 0x13AD, UPPER_CASE, 0xAB7D }, - { 0x13AE, UPPER_CASE, 0xAB7E }, - { 0x13AF, UPPER_CASE, 0xAB7F }, - { 0x13B0, UPPER_CASE, 0xAB80 }, - { 0x13B1, UPPER_CASE, 0xAB81 }, - { 0x13B2, UPPER_CASE, 0xAB82 }, - { 0x13B3, UPPER_CASE, 0xAB83 }, - { 0x13B4, UPPER_CASE, 0xAB84 }, - { 0x13B5, UPPER_CASE, 0xAB85 }, - { 0x13B6, UPPER_CASE, 0xAB86 }, - { 0x13B7, UPPER_CASE, 0xAB87 }, - { 0x13B8, UPPER_CASE, 0xAB88 }, - { 0x13B9, UPPER_CASE, 0xAB89 }, - { 0x13BA, UPPER_CASE, 0xAB8A }, - { 0x13BB, UPPER_CASE, 0xAB8B }, - { 0x13BC, UPPER_CASE, 0xAB8C }, - { 0x13BD, UPPER_CASE, 0xAB8D }, - { 0x13BE, UPPER_CASE, 0xAB8E }, - { 0x13BF, UPPER_CASE, 0xAB8F }, - { 0x13C0, UPPER_CASE, 0xAB90 }, - { 0x13C1, UPPER_CASE, 0xAB91 }, - { 0x13C2, UPPER_CASE, 0xAB92 }, - { 0x13C3, UPPER_CASE, 0xAB93 }, - { 0x13C4, UPPER_CASE, 0xAB94 }, - { 0x13C5, UPPER_CASE, 0xAB95 }, - { 0x13C6, UPPER_CASE, 0xAB96 }, - { 0x13C7, UPPER_CASE, 0xAB97 }, - { 0x13C8, UPPER_CASE, 0xAB98 }, - { 0x13C9, UPPER_CASE, 0xAB99 }, - { 0x13CA, UPPER_CASE, 0xAB9A }, - { 0x13CB, UPPER_CASE, 0xAB9B }, - { 0x13CC, UPPER_CASE, 0xAB9C }, - { 0x13CD, UPPER_CASE, 0xAB9D }, - { 0x13CE, UPPER_CASE, 0xAB9E }, - { 0x13CF, UPPER_CASE, 0xAB9F }, - { 0x13D0, UPPER_CASE, 0xABA0 }, - { 0x13D1, UPPER_CASE, 0xABA1 }, - { 0x13D2, UPPER_CASE, 0xABA2 }, - { 0x13D3, UPPER_CASE, 0xABA3 }, - { 0x13D4, UPPER_CASE, 0xABA4 }, - { 0x13D5, UPPER_CASE, 0xABA5 }, - { 0x13D6, UPPER_CASE, 0xABA6 }, - { 0x13D7, UPPER_CASE, 0xABA7 }, - { 0x13D8, UPPER_CASE, 0xABA8 }, - { 0x13D9, UPPER_CASE, 0xABA9 }, - { 0x13DA, UPPER_CASE, 0xABAA }, - { 0x13DB, UPPER_CASE, 0xABAB }, - { 0x13DC, UPPER_CASE, 0xABAC }, - { 0x13DD, UPPER_CASE, 0xABAD }, - { 0x13DE, UPPER_CASE, 0xABAE }, - { 0x13DF, UPPER_CASE, 0xABAF }, - { 0x13E0, UPPER_CASE, 0xABB0 }, - { 0x13E1, UPPER_CASE, 0xABB1 }, - { 0x13E2, UPPER_CASE, 0xABB2 }, - { 0x13E3, UPPER_CASE, 0xABB3 }, - { 0x13E4, UPPER_CASE, 0xABB4 }, - { 0x13E5, UPPER_CASE, 0xABB5 }, - { 0x13E6, UPPER_CASE, 0xABB6 }, - { 0x13E7, UPPER_CASE, 0xABB7 }, - { 0x13E8, UPPER_CASE, 0xABB8 }, - { 0x13E9, UPPER_CASE, 0xABB9 }, - { 0x13EA, UPPER_CASE, 0xABBA }, - { 0x13EB, UPPER_CASE, 0xABBB }, - { 0x13EC, UPPER_CASE, 0xABBC }, - { 0x13ED, UPPER_CASE, 0xABBD }, - { 0x13EE, UPPER_CASE, 0xABBE }, - { 0x13EF, UPPER_CASE, 0xABBF }, - { 0x13F0, UPPER_CASE, 0x13F8 }, - { 0x13F1, UPPER_CASE, 0x13F9 }, - { 0x13F2, UPPER_CASE, 0x13FA }, - { 0x13F3, UPPER_CASE, 0x13FB }, - { 0x13F4, UPPER_CASE, 0x13FC }, - { 0x13F5, UPPER_CASE, 0x13FD }, - { 0x13F8, LOWER_CASE, 0x13F0 }, - { 0x13F9, LOWER_CASE, 0x13F1 }, - { 0x13FA, LOWER_CASE, 0x13F2 }, - { 0x13FB, LOWER_CASE, 0x13F3 }, - { 0x13FC, LOWER_CASE, 0x13F4 }, - { 0x13FD, LOWER_CASE, 0x13F5 }, - { 0x1C80, LOWER_CASE, 0x412 }, - { 0x1C81, LOWER_CASE, 0x414 }, - { 0x1C82, LOWER_CASE, 0x41E }, - { 0x1C83, LOWER_CASE, 0x421 }, - { 0x1C84, LOWER_CASE, 0x422 }, - { 0x1C85, LOWER_CASE, 0x422 }, - { 0x1C86, LOWER_CASE, 0x42A }, - { 0x1C87, LOWER_CASE, 0x462 }, - { 0x1C88, LOWER_CASE, 0xA64A }, - { 0x1C90, UPPER_CASE, 0x10D0 }, - { 0x1C91, UPPER_CASE, 0x10D1 }, - { 0x1C92, UPPER_CASE, 0x10D2 }, - { 0x1C93, UPPER_CASE, 0x10D3 }, - { 0x1C94, UPPER_CASE, 0x10D4 }, - { 0x1C95, UPPER_CASE, 0x10D5 }, - { 0x1C96, UPPER_CASE, 0x10D6 }, - { 0x1C97, UPPER_CASE, 0x10D7 }, - { 0x1C98, UPPER_CASE, 0x10D8 }, - { 0x1C99, UPPER_CASE, 0x10D9 }, - { 0x1C9A, UPPER_CASE, 0x10DA }, - { 0x1C9B, UPPER_CASE, 0x10DB }, - { 0x1C9C, UPPER_CASE, 0x10DC }, - { 0x1C9D, UPPER_CASE, 0x10DD }, - { 0x1C9E, UPPER_CASE, 0x10DE }, - { 0x1C9F, UPPER_CASE, 0x10DF }, - { 0x1CA0, UPPER_CASE, 0x10E0 }, - { 0x1CA1, UPPER_CASE, 0x10E1 }, - { 0x1CA2, UPPER_CASE, 0x10E2 }, - { 0x1CA3, UPPER_CASE, 0x10E3 }, - { 0x1CA4, UPPER_CASE, 0x10E4 }, - { 0x1CA5, UPPER_CASE, 0x10E5 }, - { 0x1CA6, UPPER_CASE, 0x10E6 }, - { 0x1CA7, UPPER_CASE, 0x10E7 }, - { 0x1CA8, UPPER_CASE, 0x10E8 }, - { 0x1CA9, UPPER_CASE, 0x10E9 }, - { 0x1CAA, UPPER_CASE, 0x10EA }, - { 0x1CAB, UPPER_CASE, 0x10EB }, - { 0x1CAC, UPPER_CASE, 0x10EC }, - { 0x1CAD, UPPER_CASE, 0x10ED }, - { 0x1CAE, UPPER_CASE, 0x10EE }, - { 0x1CAF, UPPER_CASE, 0x10EF }, - { 0x1CB0, UPPER_CASE, 0x10F0 }, - { 0x1CB1, UPPER_CASE, 0x10F1 }, - { 0x1CB2, UPPER_CASE, 0x10F2 }, - { 0x1CB3, UPPER_CASE, 0x10F3 }, - { 0x1CB4, UPPER_CASE, 0x10F4 }, - { 0x1CB5, UPPER_CASE, 0x10F5 }, - { 0x1CB6, UPPER_CASE, 0x10F6 }, - { 0x1CB7, UPPER_CASE, 0x10F7 }, - { 0x1CB8, UPPER_CASE, 0x10F8 }, - { 0x1CB9, UPPER_CASE, 0x10F9 }, - { 0x1CBA, UPPER_CASE, 0x10FA }, - { 0x1CBD, UPPER_CASE, 0x10FD }, - { 0x1CBE, UPPER_CASE, 0x10FE }, - { 0x1CBF, UPPER_CASE, 0x10FF }, - { 0x1D79, LOWER_CASE, 0xA77D }, - { 0x1D7D, LOWER_CASE, 0x2C63 }, - { 0x1D8E, LOWER_CASE, 0xA7C6 }, - { 0x1E00, UPPER_CASE, 0x1E01 }, - { 0x1E01, LOWER_CASE, 0x1E00 }, - { 0x1E02, UPPER_CASE, 0x1E03 }, - { 0x1E03, LOWER_CASE, 0x1E02 }, - { 0x1E04, UPPER_CASE, 0x1E05 }, - { 0x1E05, LOWER_CASE, 0x1E04 }, - { 0x1E06, UPPER_CASE, 0x1E07 }, - { 0x1E07, LOWER_CASE, 0x1E06 }, - { 0x1E08, UPPER_CASE, 0x1E09 }, - { 0x1E09, LOWER_CASE, 0x1E08 }, - { 0x1E0A, UPPER_CASE, 0x1E0B }, - { 0x1E0B, LOWER_CASE, 0x1E0A }, - { 0x1E0C, UPPER_CASE, 0x1E0D }, - { 0x1E0D, LOWER_CASE, 0x1E0C }, - { 0x1E0E, UPPER_CASE, 0x1E0F }, - { 0x1E0F, LOWER_CASE, 0x1E0E }, - { 0x1E10, UPPER_CASE, 0x1E11 }, - { 0x1E11, LOWER_CASE, 0x1E10 }, - { 0x1E12, UPPER_CASE, 0x1E13 }, - { 0x1E13, LOWER_CASE, 0x1E12 }, - { 0x1E14, UPPER_CASE, 0x1E15 }, - { 0x1E15, LOWER_CASE, 0x1E14 }, - { 0x1E16, UPPER_CASE, 0x1E17 }, - { 0x1E17, LOWER_CASE, 0x1E16 }, - { 0x1E18, UPPER_CASE, 0x1E19 }, - { 0x1E19, LOWER_CASE, 0x1E18 }, - { 0x1E1A, UPPER_CASE, 0x1E1B }, - { 0x1E1B, LOWER_CASE, 0x1E1A }, - { 0x1E1C, UPPER_CASE, 0x1E1D }, - { 0x1E1D, LOWER_CASE, 0x1E1C }, - { 0x1E1E, UPPER_CASE, 0x1E1F }, - { 0x1E1F, LOWER_CASE, 0x1E1E }, - { 0x1E20, UPPER_CASE, 0x1E21 }, - { 0x1E21, LOWER_CASE, 0x1E20 }, - { 0x1E22, UPPER_CASE, 0x1E23 }, - { 0x1E23, LOWER_CASE, 0x1E22 }, - { 0x1E24, UPPER_CASE, 0x1E25 }, - { 0x1E25, LOWER_CASE, 0x1E24 }, - { 0x1E26, UPPER_CASE, 0x1E27 }, - { 0x1E27, LOWER_CASE, 0x1E26 }, - { 0x1E28, UPPER_CASE, 0x1E29 }, - { 0x1E29, LOWER_CASE, 0x1E28 }, - { 0x1E2A, UPPER_CASE, 0x1E2B }, - { 0x1E2B, LOWER_CASE, 0x1E2A }, - { 0x1E2C, UPPER_CASE, 0x1E2D }, - { 0x1E2D, LOWER_CASE, 0x1E2C }, - { 0x1E2E, UPPER_CASE, 0x1E2F }, - { 0x1E2F, LOWER_CASE, 0x1E2E }, - { 0x1E30, UPPER_CASE, 0x1E31 }, - { 0x1E31, LOWER_CASE, 0x1E30 }, - { 0x1E32, UPPER_CASE, 0x1E33 }, - { 0x1E33, LOWER_CASE, 0x1E32 }, - { 0x1E34, UPPER_CASE, 0x1E35 }, - { 0x1E35, LOWER_CASE, 0x1E34 }, - { 0x1E36, UPPER_CASE, 0x1E37 }, - { 0x1E37, LOWER_CASE, 0x1E36 }, - { 0x1E38, UPPER_CASE, 0x1E39 }, - { 0x1E39, LOWER_CASE, 0x1E38 }, - { 0x1E3A, UPPER_CASE, 0x1E3B }, - { 0x1E3B, LOWER_CASE, 0x1E3A }, - { 0x1E3C, UPPER_CASE, 0x1E3D }, - { 0x1E3D, LOWER_CASE, 0x1E3C }, - { 0x1E3E, UPPER_CASE, 0x1E3F }, - { 0x1E3F, LOWER_CASE, 0x1E3E }, - { 0x1E40, UPPER_CASE, 0x1E41 }, - { 0x1E41, LOWER_CASE, 0x1E40 }, - { 0x1E42, UPPER_CASE, 0x1E43 }, - { 0x1E43, LOWER_CASE, 0x1E42 }, - { 0x1E44, UPPER_CASE, 0x1E45 }, - { 0x1E45, LOWER_CASE, 0x1E44 }, - { 0x1E46, UPPER_CASE, 0x1E47 }, - { 0x1E47, LOWER_CASE, 0x1E46 }, - { 0x1E48, UPPER_CASE, 0x1E49 }, - { 0x1E49, LOWER_CASE, 0x1E48 }, - { 0x1E4A, UPPER_CASE, 0x1E4B }, - { 0x1E4B, LOWER_CASE, 0x1E4A }, - { 0x1E4C, UPPER_CASE, 0x1E4D }, - { 0x1E4D, LOWER_CASE, 0x1E4C }, - { 0x1E4E, UPPER_CASE, 0x1E4F }, - { 0x1E4F, LOWER_CASE, 0x1E4E }, - { 0x1E50, UPPER_CASE, 0x1E51 }, - { 0x1E51, LOWER_CASE, 0x1E50 }, - { 0x1E52, UPPER_CASE, 0x1E53 }, - { 0x1E53, LOWER_CASE, 0x1E52 }, - { 0x1E54, UPPER_CASE, 0x1E55 }, - { 0x1E55, LOWER_CASE, 0x1E54 }, - { 0x1E56, UPPER_CASE, 0x1E57 }, - { 0x1E57, LOWER_CASE, 0x1E56 }, - { 0x1E58, UPPER_CASE, 0x1E59 }, - { 0x1E59, LOWER_CASE, 0x1E58 }, - { 0x1E5A, UPPER_CASE, 0x1E5B }, - { 0x1E5B, LOWER_CASE, 0x1E5A }, - { 0x1E5C, UPPER_CASE, 0x1E5D }, - { 0x1E5D, LOWER_CASE, 0x1E5C }, - { 0x1E5E, UPPER_CASE, 0x1E5F }, - { 0x1E5F, LOWER_CASE, 0x1E5E }, - { 0x1E60, UPPER_CASE, 0x1E61 }, - { 0x1E61, LOWER_CASE, 0x1E60 }, - { 0x1E62, UPPER_CASE, 0x1E63 }, - { 0x1E63, LOWER_CASE, 0x1E62 }, - { 0x1E64, UPPER_CASE, 0x1E65 }, - { 0x1E65, LOWER_CASE, 0x1E64 }, - { 0x1E66, UPPER_CASE, 0x1E67 }, - { 0x1E67, LOWER_CASE, 0x1E66 }, - { 0x1E68, UPPER_CASE, 0x1E69 }, - { 0x1E69, LOWER_CASE, 0x1E68 }, - { 0x1E6A, UPPER_CASE, 0x1E6B }, - { 0x1E6B, LOWER_CASE, 0x1E6A }, - { 0x1E6C, UPPER_CASE, 0x1E6D }, - { 0x1E6D, LOWER_CASE, 0x1E6C }, - { 0x1E6E, UPPER_CASE, 0x1E6F }, - { 0x1E6F, LOWER_CASE, 0x1E6E }, - { 0x1E70, UPPER_CASE, 0x1E71 }, - { 0x1E71, LOWER_CASE, 0x1E70 }, - { 0x1E72, UPPER_CASE, 0x1E73 }, - { 0x1E73, LOWER_CASE, 0x1E72 }, - { 0x1E74, UPPER_CASE, 0x1E75 }, - { 0x1E75, LOWER_CASE, 0x1E74 }, - { 0x1E76, UPPER_CASE, 0x1E77 }, - { 0x1E77, LOWER_CASE, 0x1E76 }, - { 0x1E78, UPPER_CASE, 0x1E79 }, - { 0x1E79, LOWER_CASE, 0x1E78 }, - { 0x1E7A, UPPER_CASE, 0x1E7B }, - { 0x1E7B, LOWER_CASE, 0x1E7A }, - { 0x1E7C, UPPER_CASE, 0x1E7D }, - { 0x1E7D, LOWER_CASE, 0x1E7C }, - { 0x1E7E, UPPER_CASE, 0x1E7F }, - { 0x1E7F, LOWER_CASE, 0x1E7E }, - { 0x1E80, UPPER_CASE, 0x1E81 }, - { 0x1E81, LOWER_CASE, 0x1E80 }, - { 0x1E82, UPPER_CASE, 0x1E83 }, - { 0x1E83, LOWER_CASE, 0x1E82 }, - { 0x1E84, UPPER_CASE, 0x1E85 }, - { 0x1E85, LOWER_CASE, 0x1E84 }, - { 0x1E86, UPPER_CASE, 0x1E87 }, - { 0x1E87, LOWER_CASE, 0x1E86 }, - { 0x1E88, UPPER_CASE, 0x1E89 }, - { 0x1E89, LOWER_CASE, 0x1E88 }, - { 0x1E8A, UPPER_CASE, 0x1E8B }, - { 0x1E8B, LOWER_CASE, 0x1E8A }, - { 0x1E8C, UPPER_CASE, 0x1E8D }, - { 0x1E8D, LOWER_CASE, 0x1E8C }, - { 0x1E8E, UPPER_CASE, 0x1E8F }, - { 0x1E8F, LOWER_CASE, 0x1E8E }, - { 0x1E90, UPPER_CASE, 0x1E91 }, - { 0x1E91, LOWER_CASE, 0x1E90 }, - { 0x1E92, UPPER_CASE, 0x1E93 }, - { 0x1E93, LOWER_CASE, 0x1E92 }, - { 0x1E94, UPPER_CASE, 0x1E95 }, - { 0x1E95, LOWER_CASE, 0x1E94 }, - { 0x1E9B, LOWER_CASE, 0x1E60 }, - { 0x1E9E, UPPER_CASE, 0xDF }, - { 0x1EA0, UPPER_CASE, 0x1EA1 }, - { 0x1EA1, LOWER_CASE, 0x1EA0 }, - { 0x1EA2, UPPER_CASE, 0x1EA3 }, - { 0x1EA3, LOWER_CASE, 0x1EA2 }, - { 0x1EA4, UPPER_CASE, 0x1EA5 }, - { 0x1EA5, LOWER_CASE, 0x1EA4 }, - { 0x1EA6, UPPER_CASE, 0x1EA7 }, - { 0x1EA7, LOWER_CASE, 0x1EA6 }, - { 0x1EA8, UPPER_CASE, 0x1EA9 }, - { 0x1EA9, LOWER_CASE, 0x1EA8 }, - { 0x1EAA, UPPER_CASE, 0x1EAB }, - { 0x1EAB, LOWER_CASE, 0x1EAA }, - { 0x1EAC, UPPER_CASE, 0x1EAD }, - { 0x1EAD, LOWER_CASE, 0x1EAC }, - { 0x1EAE, UPPER_CASE, 0x1EAF }, - { 0x1EAF, LOWER_CASE, 0x1EAE }, - { 0x1EB0, UPPER_CASE, 0x1EB1 }, - { 0x1EB1, LOWER_CASE, 0x1EB0 }, - { 0x1EB2, UPPER_CASE, 0x1EB3 }, - { 0x1EB3, LOWER_CASE, 0x1EB2 }, - { 0x1EB4, UPPER_CASE, 0x1EB5 }, - { 0x1EB5, LOWER_CASE, 0x1EB4 }, - { 0x1EB6, UPPER_CASE, 0x1EB7 }, - { 0x1EB7, LOWER_CASE, 0x1EB6 }, - { 0x1EB8, UPPER_CASE, 0x1EB9 }, - { 0x1EB9, LOWER_CASE, 0x1EB8 }, - { 0x1EBA, UPPER_CASE, 0x1EBB }, - { 0x1EBB, LOWER_CASE, 0x1EBA }, - { 0x1EBC, UPPER_CASE, 0x1EBD }, - { 0x1EBD, LOWER_CASE, 0x1EBC }, - { 0x1EBE, UPPER_CASE, 0x1EBF }, - { 0x1EBF, LOWER_CASE, 0x1EBE }, - { 0x1EC0, UPPER_CASE, 0x1EC1 }, - { 0x1EC1, LOWER_CASE, 0x1EC0 }, - { 0x1EC2, UPPER_CASE, 0x1EC3 }, - { 0x1EC3, LOWER_CASE, 0x1EC2 }, - { 0x1EC4, UPPER_CASE, 0x1EC5 }, - { 0x1EC5, LOWER_CASE, 0x1EC4 }, - { 0x1EC6, UPPER_CASE, 0x1EC7 }, - { 0x1EC7, LOWER_CASE, 0x1EC6 }, - { 0x1EC8, UPPER_CASE, 0x1EC9 }, - { 0x1EC9, LOWER_CASE, 0x1EC8 }, - { 0x1ECA, UPPER_CASE, 0x1ECB }, - { 0x1ECB, LOWER_CASE, 0x1ECA }, - { 0x1ECC, UPPER_CASE, 0x1ECD }, - { 0x1ECD, LOWER_CASE, 0x1ECC }, - { 0x1ECE, UPPER_CASE, 0x1ECF }, - { 0x1ECF, LOWER_CASE, 0x1ECE }, - { 0x1ED0, UPPER_CASE, 0x1ED1 }, - { 0x1ED1, LOWER_CASE, 0x1ED0 }, - { 0x1ED2, UPPER_CASE, 0x1ED3 }, - { 0x1ED3, LOWER_CASE, 0x1ED2 }, - { 0x1ED4, UPPER_CASE, 0x1ED5 }, - { 0x1ED5, LOWER_CASE, 0x1ED4 }, - { 0x1ED6, UPPER_CASE, 0x1ED7 }, - { 0x1ED7, LOWER_CASE, 0x1ED6 }, - { 0x1ED8, UPPER_CASE, 0x1ED9 }, - { 0x1ED9, LOWER_CASE, 0x1ED8 }, - { 0x1EDA, UPPER_CASE, 0x1EDB }, - { 0x1EDB, LOWER_CASE, 0x1EDA }, - { 0x1EDC, UPPER_CASE, 0x1EDD }, - { 0x1EDD, LOWER_CASE, 0x1EDC }, - { 0x1EDE, UPPER_CASE, 0x1EDF }, - { 0x1EDF, LOWER_CASE, 0x1EDE }, - { 0x1EE0, UPPER_CASE, 0x1EE1 }, - { 0x1EE1, LOWER_CASE, 0x1EE0 }, - { 0x1EE2, UPPER_CASE, 0x1EE3 }, - { 0x1EE3, LOWER_CASE, 0x1EE2 }, - { 0x1EE4, UPPER_CASE, 0x1EE5 }, - { 0x1EE5, LOWER_CASE, 0x1EE4 }, - { 0x1EE6, UPPER_CASE, 0x1EE7 }, - { 0x1EE7, LOWER_CASE, 0x1EE6 }, - { 0x1EE8, UPPER_CASE, 0x1EE9 }, - { 0x1EE9, LOWER_CASE, 0x1EE8 }, - { 0x1EEA, UPPER_CASE, 0x1EEB }, - { 0x1EEB, LOWER_CASE, 0x1EEA }, - { 0x1EEC, UPPER_CASE, 0x1EED }, - { 0x1EED, LOWER_CASE, 0x1EEC }, - { 0x1EEE, UPPER_CASE, 0x1EEF }, - { 0x1EEF, LOWER_CASE, 0x1EEE }, - { 0x1EF0, UPPER_CASE, 0x1EF1 }, - { 0x1EF1, LOWER_CASE, 0x1EF0 }, - { 0x1EF2, UPPER_CASE, 0x1EF3 }, - { 0x1EF3, LOWER_CASE, 0x1EF2 }, - { 0x1EF4, UPPER_CASE, 0x1EF5 }, - { 0x1EF5, LOWER_CASE, 0x1EF4 }, - { 0x1EF6, UPPER_CASE, 0x1EF7 }, - { 0x1EF7, LOWER_CASE, 0x1EF6 }, - { 0x1EF8, UPPER_CASE, 0x1EF9 }, - { 0x1EF9, LOWER_CASE, 0x1EF8 }, - { 0x1EFA, UPPER_CASE, 0x1EFB }, - { 0x1EFB, LOWER_CASE, 0x1EFA }, - { 0x1EFC, UPPER_CASE, 0x1EFD }, - { 0x1EFD, LOWER_CASE, 0x1EFC }, - { 0x1EFE, UPPER_CASE, 0x1EFF }, - { 0x1EFF, LOWER_CASE, 0x1EFE }, - { 0x1F00, LOWER_CASE, 0x1F08 }, - { 0x1F01, LOWER_CASE, 0x1F09 }, - { 0x1F02, LOWER_CASE, 0x1F0A }, - { 0x1F03, LOWER_CASE, 0x1F0B }, - { 0x1F04, LOWER_CASE, 0x1F0C }, - { 0x1F05, LOWER_CASE, 0x1F0D }, - { 0x1F06, LOWER_CASE, 0x1F0E }, - { 0x1F07, LOWER_CASE, 0x1F0F }, - { 0x1F08, UPPER_CASE, 0x1F00 }, - { 0x1F09, UPPER_CASE, 0x1F01 }, - { 0x1F0A, UPPER_CASE, 0x1F02 }, - { 0x1F0B, UPPER_CASE, 0x1F03 }, - { 0x1F0C, UPPER_CASE, 0x1F04 }, - { 0x1F0D, UPPER_CASE, 0x1F05 }, - { 0x1F0E, UPPER_CASE, 0x1F06 }, - { 0x1F0F, UPPER_CASE, 0x1F07 }, - { 0x1F10, LOWER_CASE, 0x1F18 }, - { 0x1F11, LOWER_CASE, 0x1F19 }, - { 0x1F12, LOWER_CASE, 0x1F1A }, - { 0x1F13, LOWER_CASE, 0x1F1B }, - { 0x1F14, LOWER_CASE, 0x1F1C }, - { 0x1F15, LOWER_CASE, 0x1F1D }, - { 0x1F18, UPPER_CASE, 0x1F10 }, - { 0x1F19, UPPER_CASE, 0x1F11 }, - { 0x1F1A, UPPER_CASE, 0x1F12 }, - { 0x1F1B, UPPER_CASE, 0x1F13 }, - { 0x1F1C, UPPER_CASE, 0x1F14 }, - { 0x1F1D, UPPER_CASE, 0x1F15 }, - { 0x1F20, LOWER_CASE, 0x1F28 }, - { 0x1F21, LOWER_CASE, 0x1F29 }, - { 0x1F22, LOWER_CASE, 0x1F2A }, - { 0x1F23, LOWER_CASE, 0x1F2B }, - { 0x1F24, LOWER_CASE, 0x1F2C }, - { 0x1F25, LOWER_CASE, 0x1F2D }, - { 0x1F26, LOWER_CASE, 0x1F2E }, - { 0x1F27, LOWER_CASE, 0x1F2F }, - { 0x1F28, UPPER_CASE, 0x1F20 }, - { 0x1F29, UPPER_CASE, 0x1F21 }, - { 0x1F2A, UPPER_CASE, 0x1F22 }, - { 0x1F2B, UPPER_CASE, 0x1F23 }, - { 0x1F2C, UPPER_CASE, 0x1F24 }, - { 0x1F2D, UPPER_CASE, 0x1F25 }, - { 0x1F2E, UPPER_CASE, 0x1F26 }, - { 0x1F2F, UPPER_CASE, 0x1F27 }, - { 0x1F30, LOWER_CASE, 0x1F38 }, - { 0x1F31, LOWER_CASE, 0x1F39 }, - { 0x1F32, LOWER_CASE, 0x1F3A }, - { 0x1F33, LOWER_CASE, 0x1F3B }, - { 0x1F34, LOWER_CASE, 0x1F3C }, - { 0x1F35, LOWER_CASE, 0x1F3D }, - { 0x1F36, LOWER_CASE, 0x1F3E }, - { 0x1F37, LOWER_CASE, 0x1F3F }, - { 0x1F38, UPPER_CASE, 0x1F30 }, - { 0x1F39, UPPER_CASE, 0x1F31 }, - { 0x1F3A, UPPER_CASE, 0x1F32 }, - { 0x1F3B, UPPER_CASE, 0x1F33 }, - { 0x1F3C, UPPER_CASE, 0x1F34 }, - { 0x1F3D, UPPER_CASE, 0x1F35 }, - { 0x1F3E, UPPER_CASE, 0x1F36 }, - { 0x1F3F, UPPER_CASE, 0x1F37 }, - { 0x1F40, LOWER_CASE, 0x1F48 }, - { 0x1F41, LOWER_CASE, 0x1F49 }, - { 0x1F42, LOWER_CASE, 0x1F4A }, - { 0x1F43, LOWER_CASE, 0x1F4B }, - { 0x1F44, LOWER_CASE, 0x1F4C }, - { 0x1F45, LOWER_CASE, 0x1F4D }, - { 0x1F48, UPPER_CASE, 0x1F40 }, - { 0x1F49, UPPER_CASE, 0x1F41 }, - { 0x1F4A, UPPER_CASE, 0x1F42 }, - { 0x1F4B, UPPER_CASE, 0x1F43 }, - { 0x1F4C, UPPER_CASE, 0x1F44 }, - { 0x1F4D, UPPER_CASE, 0x1F45 }, - { 0x1F51, LOWER_CASE, 0x1F59 }, - { 0x1F53, LOWER_CASE, 0x1F5B }, - { 0x1F55, LOWER_CASE, 0x1F5D }, - { 0x1F57, LOWER_CASE, 0x1F5F }, - { 0x1F59, UPPER_CASE, 0x1F51 }, - { 0x1F5B, UPPER_CASE, 0x1F53 }, - { 0x1F5D, UPPER_CASE, 0x1F55 }, - { 0x1F5F, UPPER_CASE, 0x1F57 }, - { 0x1F60, LOWER_CASE, 0x1F68 }, - { 0x1F61, LOWER_CASE, 0x1F69 }, - { 0x1F62, LOWER_CASE, 0x1F6A }, - { 0x1F63, LOWER_CASE, 0x1F6B }, - { 0x1F64, LOWER_CASE, 0x1F6C }, - { 0x1F65, LOWER_CASE, 0x1F6D }, - { 0x1F66, LOWER_CASE, 0x1F6E }, - { 0x1F67, LOWER_CASE, 0x1F6F }, - { 0x1F68, UPPER_CASE, 0x1F60 }, - { 0x1F69, UPPER_CASE, 0x1F61 }, - { 0x1F6A, UPPER_CASE, 0x1F62 }, - { 0x1F6B, UPPER_CASE, 0x1F63 }, - { 0x1F6C, UPPER_CASE, 0x1F64 }, - { 0x1F6D, UPPER_CASE, 0x1F65 }, - { 0x1F6E, UPPER_CASE, 0x1F66 }, - { 0x1F6F, UPPER_CASE, 0x1F67 }, - { 0x1F70, LOWER_CASE, 0x1FBA }, - { 0x1F71, LOWER_CASE, 0x1FBB }, - { 0x1F72, LOWER_CASE, 0x1FC8 }, - { 0x1F73, LOWER_CASE, 0x1FC9 }, - { 0x1F74, LOWER_CASE, 0x1FCA }, - { 0x1F75, LOWER_CASE, 0x1FCB }, - { 0x1F76, LOWER_CASE, 0x1FDA }, - { 0x1F77, LOWER_CASE, 0x1FDB }, - { 0x1F78, LOWER_CASE, 0x1FF8 }, - { 0x1F79, LOWER_CASE, 0x1FF9 }, - { 0x1F7A, LOWER_CASE, 0x1FEA }, - { 0x1F7B, LOWER_CASE, 0x1FEB }, - { 0x1F7C, LOWER_CASE, 0x1FFA }, - { 0x1F7D, LOWER_CASE, 0x1FFB }, - { 0x1F80, LOWER_CASE, 0x1F88 }, - { 0x1F81, LOWER_CASE, 0x1F89 }, - { 0x1F82, LOWER_CASE, 0x1F8A }, - { 0x1F83, LOWER_CASE, 0x1F8B }, - { 0x1F84, LOWER_CASE, 0x1F8C }, - { 0x1F85, LOWER_CASE, 0x1F8D }, - { 0x1F86, LOWER_CASE, 0x1F8E }, - { 0x1F87, LOWER_CASE, 0x1F8F }, - { 0x1F88, UPPER_CASE, 0x1F80 }, - { 0x1F89, UPPER_CASE, 0x1F81 }, - { 0x1F8A, UPPER_CASE, 0x1F82 }, - { 0x1F8B, UPPER_CASE, 0x1F83 }, - { 0x1F8C, UPPER_CASE, 0x1F84 }, - { 0x1F8D, UPPER_CASE, 0x1F85 }, - { 0x1F8E, UPPER_CASE, 0x1F86 }, - { 0x1F8F, UPPER_CASE, 0x1F87 }, - { 0x1F90, LOWER_CASE, 0x1F98 }, - { 0x1F91, LOWER_CASE, 0x1F99 }, - { 0x1F92, LOWER_CASE, 0x1F9A }, - { 0x1F93, LOWER_CASE, 0x1F9B }, - { 0x1F94, LOWER_CASE, 0x1F9C }, - { 0x1F95, LOWER_CASE, 0x1F9D }, - { 0x1F96, LOWER_CASE, 0x1F9E }, - { 0x1F97, LOWER_CASE, 0x1F9F }, - { 0x1F98, UPPER_CASE, 0x1F90 }, - { 0x1F99, UPPER_CASE, 0x1F91 }, - { 0x1F9A, UPPER_CASE, 0x1F92 }, - { 0x1F9B, UPPER_CASE, 0x1F93 }, - { 0x1F9C, UPPER_CASE, 0x1F94 }, - { 0x1F9D, UPPER_CASE, 0x1F95 }, - { 0x1F9E, UPPER_CASE, 0x1F96 }, - { 0x1F9F, UPPER_CASE, 0x1F97 }, - { 0x1FA0, LOWER_CASE, 0x1FA8 }, - { 0x1FA1, LOWER_CASE, 0x1FA9 }, - { 0x1FA2, LOWER_CASE, 0x1FAA }, - { 0x1FA3, LOWER_CASE, 0x1FAB }, - { 0x1FA4, LOWER_CASE, 0x1FAC }, - { 0x1FA5, LOWER_CASE, 0x1FAD }, - { 0x1FA6, LOWER_CASE, 0x1FAE }, - { 0x1FA7, LOWER_CASE, 0x1FAF }, - { 0x1FA8, UPPER_CASE, 0x1FA0 }, - { 0x1FA9, UPPER_CASE, 0x1FA1 }, - { 0x1FAA, UPPER_CASE, 0x1FA2 }, - { 0x1FAB, UPPER_CASE, 0x1FA3 }, - { 0x1FAC, UPPER_CASE, 0x1FA4 }, - { 0x1FAD, UPPER_CASE, 0x1FA5 }, - { 0x1FAE, UPPER_CASE, 0x1FA6 }, - { 0x1FAF, UPPER_CASE, 0x1FA7 }, - { 0x1FB0, LOWER_CASE, 0x1FB8 }, - { 0x1FB1, LOWER_CASE, 0x1FB9 }, - { 0x1FB3, LOWER_CASE, 0x1FBC }, - { 0x1FB8, UPPER_CASE, 0x1FB0 }, - { 0x1FB9, UPPER_CASE, 0x1FB1 }, - { 0x1FBA, UPPER_CASE, 0x1F70 }, - { 0x1FBB, UPPER_CASE, 0x1F71 }, - { 0x1FBC, UPPER_CASE, 0x1FB3 }, - { 0x1FBE, LOWER_CASE, 0x399 }, - { 0x1FC3, LOWER_CASE, 0x1FCC }, - { 0x1FC8, UPPER_CASE, 0x1F72 }, - { 0x1FC9, UPPER_CASE, 0x1F73 }, - { 0x1FCA, UPPER_CASE, 0x1F74 }, - { 0x1FCB, UPPER_CASE, 0x1F75 }, - { 0x1FCC, UPPER_CASE, 0x1FC3 }, - { 0x1FD0, LOWER_CASE, 0x1FD8 }, - { 0x1FD1, LOWER_CASE, 0x1FD9 }, - { 0x1FD8, UPPER_CASE, 0x1FD0 }, - { 0x1FD9, UPPER_CASE, 0x1FD1 }, - { 0x1FDA, UPPER_CASE, 0x1F76 }, - { 0x1FDB, UPPER_CASE, 0x1F77 }, - { 0x1FE0, LOWER_CASE, 0x1FE8 }, - { 0x1FE1, LOWER_CASE, 0x1FE9 }, - { 0x1FE5, LOWER_CASE, 0x1FEC }, - { 0x1FE8, UPPER_CASE, 0x1FE0 }, - { 0x1FE9, UPPER_CASE, 0x1FE1 }, - { 0x1FEA, UPPER_CASE, 0x1F7A }, - { 0x1FEB, UPPER_CASE, 0x1F7B }, - { 0x1FEC, UPPER_CASE, 0x1FE5 }, - { 0x1FF3, LOWER_CASE, 0x1FFC }, - { 0x1FF8, UPPER_CASE, 0x1F78 }, - { 0x1FF9, UPPER_CASE, 0x1F79 }, - { 0x1FFA, UPPER_CASE, 0x1F7C }, - { 0x1FFB, UPPER_CASE, 0x1F7D }, - { 0x1FFC, UPPER_CASE, 0x1FF3 }, - { 0x2126, UPPER_CASE, 0x3C9 }, - { 0x212A, UPPER_CASE, 0x6B }, - { 0x212B, UPPER_CASE, 0xE5 }, - { 0x2132, UPPER_CASE, 0x214E }, - { 0x214E, LOWER_CASE, 0x2132 }, - { 0x2160, UPPER_CASE, 0x2170 }, - { 0x2161, UPPER_CASE, 0x2171 }, - { 0x2162, UPPER_CASE, 0x2172 }, - { 0x2163, UPPER_CASE, 0x2173 }, - { 0x2164, UPPER_CASE, 0x2174 }, - { 0x2165, UPPER_CASE, 0x2175 }, - { 0x2166, UPPER_CASE, 0x2176 }, - { 0x2167, UPPER_CASE, 0x2177 }, - { 0x2168, UPPER_CASE, 0x2178 }, - { 0x2169, UPPER_CASE, 0x2179 }, - { 0x216A, UPPER_CASE, 0x217A }, - { 0x216B, UPPER_CASE, 0x217B }, - { 0x216C, UPPER_CASE, 0x217C }, - { 0x216D, UPPER_CASE, 0x217D }, - { 0x216E, UPPER_CASE, 0x217E }, - { 0x216F, UPPER_CASE, 0x217F }, - { 0x2170, LOWER_CASE, 0x2160 }, - { 0x2171, LOWER_CASE, 0x2161 }, - { 0x2172, LOWER_CASE, 0x2162 }, - { 0x2173, LOWER_CASE, 0x2163 }, - { 0x2174, LOWER_CASE, 0x2164 }, - { 0x2175, LOWER_CASE, 0x2165 }, - { 0x2176, LOWER_CASE, 0x2166 }, - { 0x2177, LOWER_CASE, 0x2167 }, - { 0x2178, LOWER_CASE, 0x2168 }, - { 0x2179, LOWER_CASE, 0x2169 }, - { 0x217A, LOWER_CASE, 0x216A }, - { 0x217B, LOWER_CASE, 0x216B }, - { 0x217C, LOWER_CASE, 0x216C }, - { 0x217D, LOWER_CASE, 0x216D }, - { 0x217E, LOWER_CASE, 0x216E }, - { 0x217F, LOWER_CASE, 0x216F }, - { 0x2183, UPPER_CASE, 0x2184 }, - { 0x2184, LOWER_CASE, 0x2183 }, - { 0x24B6, UPPER_CASE, 0x24D0 }, - { 0x24B7, UPPER_CASE, 0x24D1 }, - { 0x24B8, UPPER_CASE, 0x24D2 }, - { 0x24B9, UPPER_CASE, 0x24D3 }, - { 0x24BA, UPPER_CASE, 0x24D4 }, - { 0x24BB, UPPER_CASE, 0x24D5 }, - { 0x24BC, UPPER_CASE, 0x24D6 }, - { 0x24BD, UPPER_CASE, 0x24D7 }, - { 0x24BE, UPPER_CASE, 0x24D8 }, - { 0x24BF, UPPER_CASE, 0x24D9 }, - { 0x24C0, UPPER_CASE, 0x24DA }, - { 0x24C1, UPPER_CASE, 0x24DB }, - { 0x24C2, UPPER_CASE, 0x24DC }, - { 0x24C3, UPPER_CASE, 0x24DD }, - { 0x24C4, UPPER_CASE, 0x24DE }, - { 0x24C5, UPPER_CASE, 0x24DF }, - { 0x24C6, UPPER_CASE, 0x24E0 }, - { 0x24C7, UPPER_CASE, 0x24E1 }, - { 0x24C8, UPPER_CASE, 0x24E2 }, - { 0x24C9, UPPER_CASE, 0x24E3 }, - { 0x24CA, UPPER_CASE, 0x24E4 }, - { 0x24CB, UPPER_CASE, 0x24E5 }, - { 0x24CC, UPPER_CASE, 0x24E6 }, - { 0x24CD, UPPER_CASE, 0x24E7 }, - { 0x24CE, UPPER_CASE, 0x24E8 }, - { 0x24CF, UPPER_CASE, 0x24E9 }, - { 0x24D0, LOWER_CASE, 0x24B6 }, - { 0x24D1, LOWER_CASE, 0x24B7 }, - { 0x24D2, LOWER_CASE, 0x24B8 }, - { 0x24D3, LOWER_CASE, 0x24B9 }, - { 0x24D4, LOWER_CASE, 0x24BA }, - { 0x24D5, LOWER_CASE, 0x24BB }, - { 0x24D6, LOWER_CASE, 0x24BC }, - { 0x24D7, LOWER_CASE, 0x24BD }, - { 0x24D8, LOWER_CASE, 0x24BE }, - { 0x24D9, LOWER_CASE, 0x24BF }, - { 0x24DA, LOWER_CASE, 0x24C0 }, - { 0x24DB, LOWER_CASE, 0x24C1 }, - { 0x24DC, LOWER_CASE, 0x24C2 }, - { 0x24DD, LOWER_CASE, 0x24C3 }, - { 0x24DE, LOWER_CASE, 0x24C4 }, - { 0x24DF, LOWER_CASE, 0x24C5 }, - { 0x24E0, LOWER_CASE, 0x24C6 }, - { 0x24E1, LOWER_CASE, 0x24C7 }, - { 0x24E2, LOWER_CASE, 0x24C8 }, - { 0x24E3, LOWER_CASE, 0x24C9 }, - { 0x24E4, LOWER_CASE, 0x24CA }, - { 0x24E5, LOWER_CASE, 0x24CB }, - { 0x24E6, LOWER_CASE, 0x24CC }, - { 0x24E7, LOWER_CASE, 0x24CD }, - { 0x24E8, LOWER_CASE, 0x24CE }, - { 0x24E9, LOWER_CASE, 0x24CF }, - { 0x2C00, UPPER_CASE, 0x2C30 }, - { 0x2C01, UPPER_CASE, 0x2C31 }, - { 0x2C02, UPPER_CASE, 0x2C32 }, - { 0x2C03, UPPER_CASE, 0x2C33 }, - { 0x2C04, UPPER_CASE, 0x2C34 }, - { 0x2C05, UPPER_CASE, 0x2C35 }, - { 0x2C06, UPPER_CASE, 0x2C36 }, - { 0x2C07, UPPER_CASE, 0x2C37 }, - { 0x2C08, UPPER_CASE, 0x2C38 }, - { 0x2C09, UPPER_CASE, 0x2C39 }, - { 0x2C0A, UPPER_CASE, 0x2C3A }, - { 0x2C0B, UPPER_CASE, 0x2C3B }, - { 0x2C0C, UPPER_CASE, 0x2C3C }, - { 0x2C0D, UPPER_CASE, 0x2C3D }, - { 0x2C0E, UPPER_CASE, 0x2C3E }, - { 0x2C0F, UPPER_CASE, 0x2C3F }, - { 0x2C10, UPPER_CASE, 0x2C40 }, - { 0x2C11, UPPER_CASE, 0x2C41 }, - { 0x2C12, UPPER_CASE, 0x2C42 }, - { 0x2C13, UPPER_CASE, 0x2C43 }, - { 0x2C14, UPPER_CASE, 0x2C44 }, - { 0x2C15, UPPER_CASE, 0x2C45 }, - { 0x2C16, UPPER_CASE, 0x2C46 }, - { 0x2C17, UPPER_CASE, 0x2C47 }, - { 0x2C18, UPPER_CASE, 0x2C48 }, - { 0x2C19, UPPER_CASE, 0x2C49 }, - { 0x2C1A, UPPER_CASE, 0x2C4A }, - { 0x2C1B, UPPER_CASE, 0x2C4B }, - { 0x2C1C, UPPER_CASE, 0x2C4C }, - { 0x2C1D, UPPER_CASE, 0x2C4D }, - { 0x2C1E, UPPER_CASE, 0x2C4E }, - { 0x2C1F, UPPER_CASE, 0x2C4F }, - { 0x2C20, UPPER_CASE, 0x2C50 }, - { 0x2C21, UPPER_CASE, 0x2C51 }, - { 0x2C22, UPPER_CASE, 0x2C52 }, - { 0x2C23, UPPER_CASE, 0x2C53 }, - { 0x2C24, UPPER_CASE, 0x2C54 }, - { 0x2C25, UPPER_CASE, 0x2C55 }, - { 0x2C26, UPPER_CASE, 0x2C56 }, - { 0x2C27, UPPER_CASE, 0x2C57 }, - { 0x2C28, UPPER_CASE, 0x2C58 }, - { 0x2C29, UPPER_CASE, 0x2C59 }, - { 0x2C2A, UPPER_CASE, 0x2C5A }, - { 0x2C2B, UPPER_CASE, 0x2C5B }, - { 0x2C2C, UPPER_CASE, 0x2C5C }, - { 0x2C2D, UPPER_CASE, 0x2C5D }, - { 0x2C2E, UPPER_CASE, 0x2C5E }, - { 0x2C2F, UPPER_CASE, 0x2C5F }, - { 0x2C30, LOWER_CASE, 0x2C00 }, - { 0x2C31, LOWER_CASE, 0x2C01 }, - { 0x2C32, LOWER_CASE, 0x2C02 }, - { 0x2C33, LOWER_CASE, 0x2C03 }, - { 0x2C34, LOWER_CASE, 0x2C04 }, - { 0x2C35, LOWER_CASE, 0x2C05 }, - { 0x2C36, LOWER_CASE, 0x2C06 }, - { 0x2C37, LOWER_CASE, 0x2C07 }, - { 0x2C38, LOWER_CASE, 0x2C08 }, - { 0x2C39, LOWER_CASE, 0x2C09 }, - { 0x2C3A, LOWER_CASE, 0x2C0A }, - { 0x2C3B, LOWER_CASE, 0x2C0B }, - { 0x2C3C, LOWER_CASE, 0x2C0C }, - { 0x2C3D, LOWER_CASE, 0x2C0D }, - { 0x2C3E, LOWER_CASE, 0x2C0E }, - { 0x2C3F, LOWER_CASE, 0x2C0F }, - { 0x2C40, LOWER_CASE, 0x2C10 }, - { 0x2C41, LOWER_CASE, 0x2C11 }, - { 0x2C42, LOWER_CASE, 0x2C12 }, - { 0x2C43, LOWER_CASE, 0x2C13 }, - { 0x2C44, LOWER_CASE, 0x2C14 }, - { 0x2C45, LOWER_CASE, 0x2C15 }, - { 0x2C46, LOWER_CASE, 0x2C16 }, - { 0x2C47, LOWER_CASE, 0x2C17 }, - { 0x2C48, LOWER_CASE, 0x2C18 }, - { 0x2C49, LOWER_CASE, 0x2C19 }, - { 0x2C4A, LOWER_CASE, 0x2C1A }, - { 0x2C4B, LOWER_CASE, 0x2C1B }, - { 0x2C4C, LOWER_CASE, 0x2C1C }, - { 0x2C4D, LOWER_CASE, 0x2C1D }, - { 0x2C4E, LOWER_CASE, 0x2C1E }, - { 0x2C4F, LOWER_CASE, 0x2C1F }, - { 0x2C50, LOWER_CASE, 0x2C20 }, - { 0x2C51, LOWER_CASE, 0x2C21 }, - { 0x2C52, LOWER_CASE, 0x2C22 }, - { 0x2C53, LOWER_CASE, 0x2C23 }, - { 0x2C54, LOWER_CASE, 0x2C24 }, - { 0x2C55, LOWER_CASE, 0x2C25 }, - { 0x2C56, LOWER_CASE, 0x2C26 }, - { 0x2C57, LOWER_CASE, 0x2C27 }, - { 0x2C58, LOWER_CASE, 0x2C28 }, - { 0x2C59, LOWER_CASE, 0x2C29 }, - { 0x2C5A, LOWER_CASE, 0x2C2A }, - { 0x2C5B, LOWER_CASE, 0x2C2B }, - { 0x2C5C, LOWER_CASE, 0x2C2C }, - { 0x2C5D, LOWER_CASE, 0x2C2D }, - { 0x2C5E, LOWER_CASE, 0x2C2E }, - { 0x2C5F, LOWER_CASE, 0x2C2F }, - { 0x2C60, UPPER_CASE, 0x2C61 }, - { 0x2C61, LOWER_CASE, 0x2C60 }, - { 0x2C62, UPPER_CASE, 0x26B }, - { 0x2C63, UPPER_CASE, 0x1D7D }, - { 0x2C64, UPPER_CASE, 0x27D }, - { 0x2C65, LOWER_CASE, 0x23A }, - { 0x2C66, LOWER_CASE, 0x23E }, - { 0x2C67, UPPER_CASE, 0x2C68 }, - { 0x2C68, LOWER_CASE, 0x2C67 }, - { 0x2C69, UPPER_CASE, 0x2C6A }, - { 0x2C6A, LOWER_CASE, 0x2C69 }, - { 0x2C6B, UPPER_CASE, 0x2C6C }, - { 0x2C6C, LOWER_CASE, 0x2C6B }, - { 0x2C6D, UPPER_CASE, 0x251 }, - { 0x2C6E, UPPER_CASE, 0x271 }, - { 0x2C6F, UPPER_CASE, 0x250 }, - { 0x2C70, UPPER_CASE, 0x252 }, - { 0x2C72, UPPER_CASE, 0x2C73 }, - { 0x2C73, LOWER_CASE, 0x2C72 }, - { 0x2C75, UPPER_CASE, 0x2C76 }, - { 0x2C76, LOWER_CASE, 0x2C75 }, - { 0x2C7E, UPPER_CASE, 0x23F }, - { 0x2C7F, UPPER_CASE, 0x240 }, - { 0x2C80, UPPER_CASE, 0x2C81 }, - { 0x2C81, LOWER_CASE, 0x2C80 }, - { 0x2C82, UPPER_CASE, 0x2C83 }, - { 0x2C83, LOWER_CASE, 0x2C82 }, - { 0x2C84, UPPER_CASE, 0x2C85 }, - { 0x2C85, LOWER_CASE, 0x2C84 }, - { 0x2C86, UPPER_CASE, 0x2C87 }, - { 0x2C87, LOWER_CASE, 0x2C86 }, - { 0x2C88, UPPER_CASE, 0x2C89 }, - { 0x2C89, LOWER_CASE, 0x2C88 }, - { 0x2C8A, UPPER_CASE, 0x2C8B }, - { 0x2C8B, LOWER_CASE, 0x2C8A }, - { 0x2C8C, UPPER_CASE, 0x2C8D }, - { 0x2C8D, LOWER_CASE, 0x2C8C }, - { 0x2C8E, UPPER_CASE, 0x2C8F }, - { 0x2C8F, LOWER_CASE, 0x2C8E }, - { 0x2C90, UPPER_CASE, 0x2C91 }, - { 0x2C91, LOWER_CASE, 0x2C90 }, - { 0x2C92, UPPER_CASE, 0x2C93 }, - { 0x2C93, LOWER_CASE, 0x2C92 }, - { 0x2C94, UPPER_CASE, 0x2C95 }, - { 0x2C95, LOWER_CASE, 0x2C94 }, - { 0x2C96, UPPER_CASE, 0x2C97 }, - { 0x2C97, LOWER_CASE, 0x2C96 }, - { 0x2C98, UPPER_CASE, 0x2C99 }, - { 0x2C99, LOWER_CASE, 0x2C98 }, - { 0x2C9A, UPPER_CASE, 0x2C9B }, - { 0x2C9B, LOWER_CASE, 0x2C9A }, - { 0x2C9C, UPPER_CASE, 0x2C9D }, - { 0x2C9D, LOWER_CASE, 0x2C9C }, - { 0x2C9E, UPPER_CASE, 0x2C9F }, - { 0x2C9F, LOWER_CASE, 0x2C9E }, - { 0x2CA0, UPPER_CASE, 0x2CA1 }, - { 0x2CA1, LOWER_CASE, 0x2CA0 }, - { 0x2CA2, UPPER_CASE, 0x2CA3 }, - { 0x2CA3, LOWER_CASE, 0x2CA2 }, - { 0x2CA4, UPPER_CASE, 0x2CA5 }, - { 0x2CA5, LOWER_CASE, 0x2CA4 }, - { 0x2CA6, UPPER_CASE, 0x2CA7 }, - { 0x2CA7, LOWER_CASE, 0x2CA6 }, - { 0x2CA8, UPPER_CASE, 0x2CA9 }, - { 0x2CA9, LOWER_CASE, 0x2CA8 }, - { 0x2CAA, UPPER_CASE, 0x2CAB }, - { 0x2CAB, LOWER_CASE, 0x2CAA }, - { 0x2CAC, UPPER_CASE, 0x2CAD }, - { 0x2CAD, LOWER_CASE, 0x2CAC }, - { 0x2CAE, UPPER_CASE, 0x2CAF }, - { 0x2CAF, LOWER_CASE, 0x2CAE }, - { 0x2CB0, UPPER_CASE, 0x2CB1 }, - { 0x2CB1, LOWER_CASE, 0x2CB0 }, - { 0x2CB2, UPPER_CASE, 0x2CB3 }, - { 0x2CB3, LOWER_CASE, 0x2CB2 }, - { 0x2CB4, UPPER_CASE, 0x2CB5 }, - { 0x2CB5, LOWER_CASE, 0x2CB4 }, - { 0x2CB6, UPPER_CASE, 0x2CB7 }, - { 0x2CB7, LOWER_CASE, 0x2CB6 }, - { 0x2CB8, UPPER_CASE, 0x2CB9 }, - { 0x2CB9, LOWER_CASE, 0x2CB8 }, - { 0x2CBA, UPPER_CASE, 0x2CBB }, - { 0x2CBB, LOWER_CASE, 0x2CBA }, - { 0x2CBC, UPPER_CASE, 0x2CBD }, - { 0x2CBD, LOWER_CASE, 0x2CBC }, - { 0x2CBE, UPPER_CASE, 0x2CBF }, - { 0x2CBF, LOWER_CASE, 0x2CBE }, - { 0x2CC0, UPPER_CASE, 0x2CC1 }, - { 0x2CC1, LOWER_CASE, 0x2CC0 }, - { 0x2CC2, UPPER_CASE, 0x2CC3 }, - { 0x2CC3, LOWER_CASE, 0x2CC2 }, - { 0x2CC4, UPPER_CASE, 0x2CC5 }, - { 0x2CC5, LOWER_CASE, 0x2CC4 }, - { 0x2CC6, UPPER_CASE, 0x2CC7 }, - { 0x2CC7, LOWER_CASE, 0x2CC6 }, - { 0x2CC8, UPPER_CASE, 0x2CC9 }, - { 0x2CC9, LOWER_CASE, 0x2CC8 }, - { 0x2CCA, UPPER_CASE, 0x2CCB }, - { 0x2CCB, LOWER_CASE, 0x2CCA }, - { 0x2CCC, UPPER_CASE, 0x2CCD }, - { 0x2CCD, LOWER_CASE, 0x2CCC }, - { 0x2CCE, UPPER_CASE, 0x2CCF }, - { 0x2CCF, LOWER_CASE, 0x2CCE }, - { 0x2CD0, UPPER_CASE, 0x2CD1 }, - { 0x2CD1, LOWER_CASE, 0x2CD0 }, - { 0x2CD2, UPPER_CASE, 0x2CD3 }, - { 0x2CD3, LOWER_CASE, 0x2CD2 }, - { 0x2CD4, UPPER_CASE, 0x2CD5 }, - { 0x2CD5, LOWER_CASE, 0x2CD4 }, - { 0x2CD6, UPPER_CASE, 0x2CD7 }, - { 0x2CD7, LOWER_CASE, 0x2CD6 }, - { 0x2CD8, UPPER_CASE, 0x2CD9 }, - { 0x2CD9, LOWER_CASE, 0x2CD8 }, - { 0x2CDA, UPPER_CASE, 0x2CDB }, - { 0x2CDB, LOWER_CASE, 0x2CDA }, - { 0x2CDC, UPPER_CASE, 0x2CDD }, - { 0x2CDD, LOWER_CASE, 0x2CDC }, - { 0x2CDE, UPPER_CASE, 0x2CDF }, - { 0x2CDF, LOWER_CASE, 0x2CDE }, - { 0x2CE0, UPPER_CASE, 0x2CE1 }, - { 0x2CE1, LOWER_CASE, 0x2CE0 }, - { 0x2CE2, UPPER_CASE, 0x2CE3 }, - { 0x2CE3, LOWER_CASE, 0x2CE2 }, - { 0x2CEB, UPPER_CASE, 0x2CEC }, - { 0x2CEC, LOWER_CASE, 0x2CEB }, - { 0x2CED, UPPER_CASE, 0x2CEE }, - { 0x2CEE, LOWER_CASE, 0x2CED }, - { 0x2CF2, UPPER_CASE, 0x2CF3 }, - { 0x2CF3, LOWER_CASE, 0x2CF2 }, - { 0x2D00, LOWER_CASE, 0x10A0 }, - { 0x2D01, LOWER_CASE, 0x10A1 }, - { 0x2D02, LOWER_CASE, 0x10A2 }, - { 0x2D03, LOWER_CASE, 0x10A3 }, - { 0x2D04, LOWER_CASE, 0x10A4 }, - { 0x2D05, LOWER_CASE, 0x10A5 }, - { 0x2D06, LOWER_CASE, 0x10A6 }, - { 0x2D07, LOWER_CASE, 0x10A7 }, - { 0x2D08, LOWER_CASE, 0x10A8 }, - { 0x2D09, LOWER_CASE, 0x10A9 }, - { 0x2D0A, LOWER_CASE, 0x10AA }, - { 0x2D0B, LOWER_CASE, 0x10AB }, - { 0x2D0C, LOWER_CASE, 0x10AC }, - { 0x2D0D, LOWER_CASE, 0x10AD }, - { 0x2D0E, LOWER_CASE, 0x10AE }, - { 0x2D0F, LOWER_CASE, 0x10AF }, - { 0x2D10, LOWER_CASE, 0x10B0 }, - { 0x2D11, LOWER_CASE, 0x10B1 }, - { 0x2D12, LOWER_CASE, 0x10B2 }, - { 0x2D13, LOWER_CASE, 0x10B3 }, - { 0x2D14, LOWER_CASE, 0x10B4 }, - { 0x2D15, LOWER_CASE, 0x10B5 }, - { 0x2D16, LOWER_CASE, 0x10B6 }, - { 0x2D17, LOWER_CASE, 0x10B7 }, - { 0x2D18, LOWER_CASE, 0x10B8 }, - { 0x2D19, LOWER_CASE, 0x10B9 }, - { 0x2D1A, LOWER_CASE, 0x10BA }, - { 0x2D1B, LOWER_CASE, 0x10BB }, - { 0x2D1C, LOWER_CASE, 0x10BC }, - { 0x2D1D, LOWER_CASE, 0x10BD }, - { 0x2D1E, LOWER_CASE, 0x10BE }, - { 0x2D1F, LOWER_CASE, 0x10BF }, - { 0x2D20, LOWER_CASE, 0x10C0 }, - { 0x2D21, LOWER_CASE, 0x10C1 }, - { 0x2D22, LOWER_CASE, 0x10C2 }, - { 0x2D23, LOWER_CASE, 0x10C3 }, - { 0x2D24, LOWER_CASE, 0x10C4 }, - { 0x2D25, LOWER_CASE, 0x10C5 }, - { 0x2D27, LOWER_CASE, 0x10C7 }, - { 0x2D2D, LOWER_CASE, 0x10CD }, - { 0xA640, UPPER_CASE, 0xA641 }, - { 0xA641, LOWER_CASE, 0xA640 }, - { 0xA642, UPPER_CASE, 0xA643 }, - { 0xA643, LOWER_CASE, 0xA642 }, - { 0xA644, UPPER_CASE, 0xA645 }, - { 0xA645, LOWER_CASE, 0xA644 }, - { 0xA646, UPPER_CASE, 0xA647 }, - { 0xA647, LOWER_CASE, 0xA646 }, - { 0xA648, UPPER_CASE, 0xA649 }, - { 0xA649, LOWER_CASE, 0xA648 }, - { 0xA64A, UPPER_CASE, 0xA64B }, - { 0xA64B, LOWER_CASE, 0xA64A }, - { 0xA64C, UPPER_CASE, 0xA64D }, - { 0xA64D, LOWER_CASE, 0xA64C }, - { 0xA64E, UPPER_CASE, 0xA64F }, - { 0xA64F, LOWER_CASE, 0xA64E }, - { 0xA650, UPPER_CASE, 0xA651 }, - { 0xA651, LOWER_CASE, 0xA650 }, - { 0xA652, UPPER_CASE, 0xA653 }, - { 0xA653, LOWER_CASE, 0xA652 }, - { 0xA654, UPPER_CASE, 0xA655 }, - { 0xA655, LOWER_CASE, 0xA654 }, - { 0xA656, UPPER_CASE, 0xA657 }, - { 0xA657, LOWER_CASE, 0xA656 }, - { 0xA658, UPPER_CASE, 0xA659 }, - { 0xA659, LOWER_CASE, 0xA658 }, - { 0xA65A, UPPER_CASE, 0xA65B }, - { 0xA65B, LOWER_CASE, 0xA65A }, - { 0xA65C, UPPER_CASE, 0xA65D }, - { 0xA65D, LOWER_CASE, 0xA65C }, - { 0xA65E, UPPER_CASE, 0xA65F }, - { 0xA65F, LOWER_CASE, 0xA65E }, - { 0xA660, UPPER_CASE, 0xA661 }, - { 0xA661, LOWER_CASE, 0xA660 }, - { 0xA662, UPPER_CASE, 0xA663 }, - { 0xA663, LOWER_CASE, 0xA662 }, - { 0xA664, UPPER_CASE, 0xA665 }, - { 0xA665, LOWER_CASE, 0xA664 }, - { 0xA666, UPPER_CASE, 0xA667 }, - { 0xA667, LOWER_CASE, 0xA666 }, - { 0xA668, UPPER_CASE, 0xA669 }, - { 0xA669, LOWER_CASE, 0xA668 }, - { 0xA66A, UPPER_CASE, 0xA66B }, - { 0xA66B, LOWER_CASE, 0xA66A }, - { 0xA66C, UPPER_CASE, 0xA66D }, - { 0xA66D, LOWER_CASE, 0xA66C }, - { 0xA680, UPPER_CASE, 0xA681 }, - { 0xA681, LOWER_CASE, 0xA680 }, - { 0xA682, UPPER_CASE, 0xA683 }, - { 0xA683, LOWER_CASE, 0xA682 }, - { 0xA684, UPPER_CASE, 0xA685 }, - { 0xA685, LOWER_CASE, 0xA684 }, - { 0xA686, UPPER_CASE, 0xA687 }, - { 0xA687, LOWER_CASE, 0xA686 }, - { 0xA688, UPPER_CASE, 0xA689 }, - { 0xA689, LOWER_CASE, 0xA688 }, - { 0xA68A, UPPER_CASE, 0xA68B }, - { 0xA68B, LOWER_CASE, 0xA68A }, - { 0xA68C, UPPER_CASE, 0xA68D }, - { 0xA68D, LOWER_CASE, 0xA68C }, - { 0xA68E, UPPER_CASE, 0xA68F }, - { 0xA68F, LOWER_CASE, 0xA68E }, - { 0xA690, UPPER_CASE, 0xA691 }, - { 0xA691, LOWER_CASE, 0xA690 }, - { 0xA692, UPPER_CASE, 0xA693 }, - { 0xA693, LOWER_CASE, 0xA692 }, - { 0xA694, UPPER_CASE, 0xA695 }, - { 0xA695, LOWER_CASE, 0xA694 }, - { 0xA696, UPPER_CASE, 0xA697 }, - { 0xA697, LOWER_CASE, 0xA696 }, - { 0xA698, UPPER_CASE, 0xA699 }, - { 0xA699, LOWER_CASE, 0xA698 }, - { 0xA69A, UPPER_CASE, 0xA69B }, - { 0xA69B, LOWER_CASE, 0xA69A }, - { 0xA722, UPPER_CASE, 0xA723 }, - { 0xA723, LOWER_CASE, 0xA722 }, - { 0xA724, UPPER_CASE, 0xA725 }, - { 0xA725, LOWER_CASE, 0xA724 }, - { 0xA726, UPPER_CASE, 0xA727 }, - { 0xA727, LOWER_CASE, 0xA726 }, - { 0xA728, UPPER_CASE, 0xA729 }, - { 0xA729, LOWER_CASE, 0xA728 }, - { 0xA72A, UPPER_CASE, 0xA72B }, - { 0xA72B, LOWER_CASE, 0xA72A }, - { 0xA72C, UPPER_CASE, 0xA72D }, - { 0xA72D, LOWER_CASE, 0xA72C }, - { 0xA72E, UPPER_CASE, 0xA72F }, - { 0xA72F, LOWER_CASE, 0xA72E }, - { 0xA732, UPPER_CASE, 0xA733 }, - { 0xA733, LOWER_CASE, 0xA732 }, - { 0xA734, UPPER_CASE, 0xA735 }, - { 0xA735, LOWER_CASE, 0xA734 }, - { 0xA736, UPPER_CASE, 0xA737 }, - { 0xA737, LOWER_CASE, 0xA736 }, - { 0xA738, UPPER_CASE, 0xA739 }, - { 0xA739, LOWER_CASE, 0xA738 }, - { 0xA73A, UPPER_CASE, 0xA73B }, - { 0xA73B, LOWER_CASE, 0xA73A }, - { 0xA73C, UPPER_CASE, 0xA73D }, - { 0xA73D, LOWER_CASE, 0xA73C }, - { 0xA73E, UPPER_CASE, 0xA73F }, - { 0xA73F, LOWER_CASE, 0xA73E }, - { 0xA740, UPPER_CASE, 0xA741 }, - { 0xA741, LOWER_CASE, 0xA740 }, - { 0xA742, UPPER_CASE, 0xA743 }, - { 0xA743, LOWER_CASE, 0xA742 }, - { 0xA744, UPPER_CASE, 0xA745 }, - { 0xA745, LOWER_CASE, 0xA744 }, - { 0xA746, UPPER_CASE, 0xA747 }, - { 0xA747, LOWER_CASE, 0xA746 }, - { 0xA748, UPPER_CASE, 0xA749 }, - { 0xA749, LOWER_CASE, 0xA748 }, - { 0xA74A, UPPER_CASE, 0xA74B }, - { 0xA74B, LOWER_CASE, 0xA74A }, - { 0xA74C, UPPER_CASE, 0xA74D }, - { 0xA74D, LOWER_CASE, 0xA74C }, - { 0xA74E, UPPER_CASE, 0xA74F }, - { 0xA74F, LOWER_CASE, 0xA74E }, - { 0xA750, UPPER_CASE, 0xA751 }, - { 0xA751, LOWER_CASE, 0xA750 }, - { 0xA752, UPPER_CASE, 0xA753 }, - { 0xA753, LOWER_CASE, 0xA752 }, - { 0xA754, UPPER_CASE, 0xA755 }, - { 0xA755, LOWER_CASE, 0xA754 }, - { 0xA756, UPPER_CASE, 0xA757 }, - { 0xA757, LOWER_CASE, 0xA756 }, - { 0xA758, UPPER_CASE, 0xA759 }, - { 0xA759, LOWER_CASE, 0xA758 }, - { 0xA75A, UPPER_CASE, 0xA75B }, - { 0xA75B, LOWER_CASE, 0xA75A }, - { 0xA75C, UPPER_CASE, 0xA75D }, - { 0xA75D, LOWER_CASE, 0xA75C }, - { 0xA75E, UPPER_CASE, 0xA75F }, - { 0xA75F, LOWER_CASE, 0xA75E }, - { 0xA760, UPPER_CASE, 0xA761 }, - { 0xA761, LOWER_CASE, 0xA760 }, - { 0xA762, UPPER_CASE, 0xA763 }, - { 0xA763, LOWER_CASE, 0xA762 }, - { 0xA764, UPPER_CASE, 0xA765 }, - { 0xA765, LOWER_CASE, 0xA764 }, - { 0xA766, UPPER_CASE, 0xA767 }, - { 0xA767, LOWER_CASE, 0xA766 }, - { 0xA768, UPPER_CASE, 0xA769 }, - { 0xA769, LOWER_CASE, 0xA768 }, - { 0xA76A, UPPER_CASE, 0xA76B }, - { 0xA76B, LOWER_CASE, 0xA76A }, - { 0xA76C, UPPER_CASE, 0xA76D }, - { 0xA76D, LOWER_CASE, 0xA76C }, - { 0xA76E, UPPER_CASE, 0xA76F }, - { 0xA76F, LOWER_CASE, 0xA76E }, - { 0xA779, UPPER_CASE, 0xA77A }, - { 0xA77A, LOWER_CASE, 0xA779 }, - { 0xA77B, UPPER_CASE, 0xA77C }, - { 0xA77C, LOWER_CASE, 0xA77B }, - { 0xA77D, UPPER_CASE, 0x1D79 }, - { 0xA77E, UPPER_CASE, 0xA77F }, - { 0xA77F, LOWER_CASE, 0xA77E }, - { 0xA780, UPPER_CASE, 0xA781 }, - { 0xA781, LOWER_CASE, 0xA780 }, - { 0xA782, UPPER_CASE, 0xA783 }, - { 0xA783, LOWER_CASE, 0xA782 }, - { 0xA784, UPPER_CASE, 0xA785 }, - { 0xA785, LOWER_CASE, 0xA784 }, - { 0xA786, UPPER_CASE, 0xA787 }, - { 0xA787, LOWER_CASE, 0xA786 }, - { 0xA78B, UPPER_CASE, 0xA78C }, - { 0xA78C, LOWER_CASE, 0xA78B }, - { 0xA78D, UPPER_CASE, 0x265 }, - { 0xA790, UPPER_CASE, 0xA791 }, - { 0xA791, LOWER_CASE, 0xA790 }, - { 0xA792, UPPER_CASE, 0xA793 }, - { 0xA793, LOWER_CASE, 0xA792 }, - { 0xA794, LOWER_CASE, 0xA7C4 }, - { 0xA796, UPPER_CASE, 0xA797 }, - { 0xA797, LOWER_CASE, 0xA796 }, - { 0xA798, UPPER_CASE, 0xA799 }, - { 0xA799, LOWER_CASE, 0xA798 }, - { 0xA79A, UPPER_CASE, 0xA79B }, - { 0xA79B, LOWER_CASE, 0xA79A }, - { 0xA79C, UPPER_CASE, 0xA79D }, - { 0xA79D, LOWER_CASE, 0xA79C }, - { 0xA79E, UPPER_CASE, 0xA79F }, - { 0xA79F, LOWER_CASE, 0xA79E }, - { 0xA7A0, UPPER_CASE, 0xA7A1 }, - { 0xA7A1, LOWER_CASE, 0xA7A0 }, - { 0xA7A2, UPPER_CASE, 0xA7A3 }, - { 0xA7A3, LOWER_CASE, 0xA7A2 }, - { 0xA7A4, UPPER_CASE, 0xA7A5 }, - { 0xA7A5, LOWER_CASE, 0xA7A4 }, - { 0xA7A6, UPPER_CASE, 0xA7A7 }, - { 0xA7A7, LOWER_CASE, 0xA7A6 }, - { 0xA7A8, UPPER_CASE, 0xA7A9 }, - { 0xA7A9, LOWER_CASE, 0xA7A8 }, - { 0xA7AA, UPPER_CASE, 0x266 }, - { 0xA7AB, UPPER_CASE, 0x25C }, - { 0xA7AC, UPPER_CASE, 0x261 }, - { 0xA7AD, UPPER_CASE, 0x26C }, - { 0xA7AE, UPPER_CASE, 0x26A }, - { 0xA7B0, UPPER_CASE, 0x29E }, - { 0xA7B1, UPPER_CASE, 0x287 }, - { 0xA7B2, UPPER_CASE, 0x29D }, - { 0xA7B3, UPPER_CASE, 0xAB53 }, - { 0xA7B4, UPPER_CASE, 0xA7B5 }, - { 0xA7B5, LOWER_CASE, 0xA7B4 }, - { 0xA7B6, UPPER_CASE, 0xA7B7 }, - { 0xA7B7, LOWER_CASE, 0xA7B6 }, - { 0xA7B8, UPPER_CASE, 0xA7B9 }, - { 0xA7B9, LOWER_CASE, 0xA7B8 }, - { 0xA7BA, UPPER_CASE, 0xA7BB }, - { 0xA7BB, LOWER_CASE, 0xA7BA }, - { 0xA7BC, UPPER_CASE, 0xA7BD }, - { 0xA7BD, LOWER_CASE, 0xA7BC }, - { 0xA7BE, UPPER_CASE, 0xA7BF }, - { 0xA7BF, LOWER_CASE, 0xA7BE }, - { 0xA7C0, UPPER_CASE, 0xA7C1 }, - { 0xA7C1, LOWER_CASE, 0xA7C0 }, - { 0xA7C2, UPPER_CASE, 0xA7C3 }, - { 0xA7C3, LOWER_CASE, 0xA7C2 }, - { 0xA7C4, UPPER_CASE, 0xA794 }, - { 0xA7C5, UPPER_CASE, 0x282 }, - { 0xA7C6, UPPER_CASE, 0x1D8E }, - { 0xA7C7, UPPER_CASE, 0xA7C8 }, - { 0xA7C8, LOWER_CASE, 0xA7C7 }, - { 0xA7C9, UPPER_CASE, 0xA7CA }, - { 0xA7CA, LOWER_CASE, 0xA7C9 }, - { 0xA7D0, UPPER_CASE, 0xA7D1 }, - { 0xA7D1, LOWER_CASE, 0xA7D0 }, - { 0xA7D6, UPPER_CASE, 0xA7D7 }, - { 0xA7D7, LOWER_CASE, 0xA7D6 }, - { 0xA7D8, UPPER_CASE, 0xA7D9 }, - { 0xA7D9, LOWER_CASE, 0xA7D8 }, - { 0xA7F5, UPPER_CASE, 0xA7F6 }, - { 0xA7F6, LOWER_CASE, 0xA7F5 }, - { 0xAB53, LOWER_CASE, 0xA7B3 }, - { 0xAB70, LOWER_CASE, 0x13A0 }, - { 0xAB71, LOWER_CASE, 0x13A1 }, - { 0xAB72, LOWER_CASE, 0x13A2 }, - { 0xAB73, LOWER_CASE, 0x13A3 }, - { 0xAB74, LOWER_CASE, 0x13A4 }, - { 0xAB75, LOWER_CASE, 0x13A5 }, - { 0xAB76, LOWER_CASE, 0x13A6 }, - { 0xAB77, LOWER_CASE, 0x13A7 }, - { 0xAB78, LOWER_CASE, 0x13A8 }, - { 0xAB79, LOWER_CASE, 0x13A9 }, - { 0xAB7A, LOWER_CASE, 0x13AA }, - { 0xAB7B, LOWER_CASE, 0x13AB }, - { 0xAB7C, LOWER_CASE, 0x13AC }, - { 0xAB7D, LOWER_CASE, 0x13AD }, - { 0xAB7E, LOWER_CASE, 0x13AE }, - { 0xAB7F, LOWER_CASE, 0x13AF }, - { 0xAB80, LOWER_CASE, 0x13B0 }, - { 0xAB81, LOWER_CASE, 0x13B1 }, - { 0xAB82, LOWER_CASE, 0x13B2 }, - { 0xAB83, LOWER_CASE, 0x13B3 }, - { 0xAB84, LOWER_CASE, 0x13B4 }, - { 0xAB85, LOWER_CASE, 0x13B5 }, - { 0xAB86, LOWER_CASE, 0x13B6 }, - { 0xAB87, LOWER_CASE, 0x13B7 }, - { 0xAB88, LOWER_CASE, 0x13B8 }, - { 0xAB89, LOWER_CASE, 0x13B9 }, - { 0xAB8A, LOWER_CASE, 0x13BA }, - { 0xAB8B, LOWER_CASE, 0x13BB }, - { 0xAB8C, LOWER_CASE, 0x13BC }, - { 0xAB8D, LOWER_CASE, 0x13BD }, - { 0xAB8E, LOWER_CASE, 0x13BE }, - { 0xAB8F, LOWER_CASE, 0x13BF }, - { 0xAB90, LOWER_CASE, 0x13C0 }, - { 0xAB91, LOWER_CASE, 0x13C1 }, - { 0xAB92, LOWER_CASE, 0x13C2 }, - { 0xAB93, LOWER_CASE, 0x13C3 }, - { 0xAB94, LOWER_CASE, 0x13C4 }, - { 0xAB95, LOWER_CASE, 0x13C5 }, - { 0xAB96, LOWER_CASE, 0x13C6 }, - { 0xAB97, LOWER_CASE, 0x13C7 }, - { 0xAB98, LOWER_CASE, 0x13C8 }, - { 0xAB99, LOWER_CASE, 0x13C9 }, - { 0xAB9A, LOWER_CASE, 0x13CA }, - { 0xAB9B, LOWER_CASE, 0x13CB }, - { 0xAB9C, LOWER_CASE, 0x13CC }, - { 0xAB9D, LOWER_CASE, 0x13CD }, - { 0xAB9E, LOWER_CASE, 0x13CE }, - { 0xAB9F, LOWER_CASE, 0x13CF }, - { 0xABA0, LOWER_CASE, 0x13D0 }, - { 0xABA1, LOWER_CASE, 0x13D1 }, - { 0xABA2, LOWER_CASE, 0x13D2 }, - { 0xABA3, LOWER_CASE, 0x13D3 }, - { 0xABA4, LOWER_CASE, 0x13D4 }, - { 0xABA5, LOWER_CASE, 0x13D5 }, - { 0xABA6, LOWER_CASE, 0x13D6 }, - { 0xABA7, LOWER_CASE, 0x13D7 }, - { 0xABA8, LOWER_CASE, 0x13D8 }, - { 0xABA9, LOWER_CASE, 0x13D9 }, - { 0xABAA, LOWER_CASE, 0x13DA }, - { 0xABAB, LOWER_CASE, 0x13DB }, - { 0xABAC, LOWER_CASE, 0x13DC }, - { 0xABAD, LOWER_CASE, 0x13DD }, - { 0xABAE, LOWER_CASE, 0x13DE }, - { 0xABAF, LOWER_CASE, 0x13DF }, - { 0xABB0, LOWER_CASE, 0x13E0 }, - { 0xABB1, LOWER_CASE, 0x13E1 }, - { 0xABB2, LOWER_CASE, 0x13E2 }, - { 0xABB3, LOWER_CASE, 0x13E3 }, - { 0xABB4, LOWER_CASE, 0x13E4 }, - { 0xABB5, LOWER_CASE, 0x13E5 }, - { 0xABB6, LOWER_CASE, 0x13E6 }, - { 0xABB7, LOWER_CASE, 0x13E7 }, - { 0xABB8, LOWER_CASE, 0x13E8 }, - { 0xABB9, LOWER_CASE, 0x13E9 }, - { 0xABBA, LOWER_CASE, 0x13EA }, - { 0xABBB, LOWER_CASE, 0x13EB }, - { 0xABBC, LOWER_CASE, 0x13EC }, - { 0xABBD, LOWER_CASE, 0x13ED }, - { 0xABBE, LOWER_CASE, 0x13EE }, - { 0xABBF, LOWER_CASE, 0x13EF }, - { 0xFF21, UPPER_CASE, 0xFF41 }, - { 0xFF22, UPPER_CASE, 0xFF42 }, - { 0xFF23, UPPER_CASE, 0xFF43 }, - { 0xFF24, UPPER_CASE, 0xFF44 }, - { 0xFF25, UPPER_CASE, 0xFF45 }, - { 0xFF26, UPPER_CASE, 0xFF46 }, - { 0xFF27, UPPER_CASE, 0xFF47 }, - { 0xFF28, UPPER_CASE, 0xFF48 }, - { 0xFF29, UPPER_CASE, 0xFF49 }, - { 0xFF2A, UPPER_CASE, 0xFF4A }, - { 0xFF2B, UPPER_CASE, 0xFF4B }, - { 0xFF2C, UPPER_CASE, 0xFF4C }, - { 0xFF2D, UPPER_CASE, 0xFF4D }, - { 0xFF2E, UPPER_CASE, 0xFF4E }, - { 0xFF2F, UPPER_CASE, 0xFF4F }, - { 0xFF30, UPPER_CASE, 0xFF50 }, - { 0xFF31, UPPER_CASE, 0xFF51 }, - { 0xFF32, UPPER_CASE, 0xFF52 }, - { 0xFF33, UPPER_CASE, 0xFF53 }, - { 0xFF34, UPPER_CASE, 0xFF54 }, - { 0xFF35, UPPER_CASE, 0xFF55 }, - { 0xFF36, UPPER_CASE, 0xFF56 }, - { 0xFF37, UPPER_CASE, 0xFF57 }, - { 0xFF38, UPPER_CASE, 0xFF58 }, - { 0xFF39, UPPER_CASE, 0xFF59 }, - { 0xFF3A, UPPER_CASE, 0xFF5A }, - { 0xFF41, LOWER_CASE, 0xFF21 }, - { 0xFF42, LOWER_CASE, 0xFF22 }, - { 0xFF43, LOWER_CASE, 0xFF23 }, - { 0xFF44, LOWER_CASE, 0xFF24 }, - { 0xFF45, LOWER_CASE, 0xFF25 }, - { 0xFF46, LOWER_CASE, 0xFF26 }, - { 0xFF47, LOWER_CASE, 0xFF27 }, - { 0xFF48, LOWER_CASE, 0xFF28 }, - { 0xFF49, LOWER_CASE, 0xFF29 }, - { 0xFF4A, LOWER_CASE, 0xFF2A }, - { 0xFF4B, LOWER_CASE, 0xFF2B }, - { 0xFF4C, LOWER_CASE, 0xFF2C }, - { 0xFF4D, LOWER_CASE, 0xFF2D }, - { 0xFF4E, LOWER_CASE, 0xFF2E }, - { 0xFF4F, LOWER_CASE, 0xFF2F }, - { 0xFF50, LOWER_CASE, 0xFF30 }, - { 0xFF51, LOWER_CASE, 0xFF31 }, - { 0xFF52, LOWER_CASE, 0xFF32 }, - { 0xFF53, LOWER_CASE, 0xFF33 }, - { 0xFF54, LOWER_CASE, 0xFF34 }, - { 0xFF55, LOWER_CASE, 0xFF35 }, - { 0xFF56, LOWER_CASE, 0xFF36 }, - { 0xFF57, LOWER_CASE, 0xFF37 }, - { 0xFF58, LOWER_CASE, 0xFF38 }, - { 0xFF59, LOWER_CASE, 0xFF39 }, - { 0xFF5A, LOWER_CASE, 0xFF3A }, -}; -CONST UINT UNICODE_DATA_SIZE = sizeof(UnicodeData)/sizeof(UnicodeDataRec); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicodedata.cs b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicodedata.cs deleted file mode 100644 index 955b96fe9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/locale/unicodedata.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.IO; - -class Program -{ - static void Main(string[] args) - { - Console.WriteLine("// Licensed to the .NET Foundation under one or more agreements."); - Console.WriteLine("// The .NET Foundation licenses this file to you under the MIT license."); - Console.WriteLine(); - - Console.WriteLine("#include \"pal/unicodedata.h\""); - - Console.WriteLine(); - Console.WriteLine("//"); - Console.WriteLine("// THIS FILE IS GENERATED. DO NOT HAND EDIT."); - Console.WriteLine("// IF YOU NEED TO UPDATE UNICODE VERSION FOLLOW THE GUIDE AT src/libraries/System.Private.CoreLib/Tools/GenUnicodeProp/Updating-Unicode-Versions.md"); - Console.WriteLine("//"); - Console.WriteLine(); - - Console.WriteLine("CONST UnicodeDataRec UnicodeData[] = {"); - - string sourceFileName = args[0]; - - using (StreamReader sourceFile = File.OpenText(sourceFileName)) - while (sourceFile.ReadLine() is string line) - { - var fields = line.Split(';'); - - var code = int.Parse(fields[0], NumberStyles.HexNumber); - - bool hasUpperCaseMapping = fields[12].Length != 0; - bool hasLowerCaseMapping = fields[13].Length != 0; - - if (!hasLowerCaseMapping && !hasUpperCaseMapping) - continue; - - - int opposingCase = hasUpperCaseMapping ? - int.Parse(fields[12], NumberStyles.HexNumber) : - int.Parse(fields[13], NumberStyles.HexNumber); - - // These won't fit in 16 bits - no point carrying them - if (code > 0xFFFF) - continue; - - Debug.Assert(opposingCase <= 0xFFFF); - - string specifier = hasUpperCaseMapping ? "LOWER_CASE" : "UPPER_CASE"; - - Console.WriteLine($" {{ 0x{code:X}, {specifier}, 0x{opposingCase:X} }},"); - } - - Console.WriteLine("};"); - - Console.WriteLine("CONST UINT UNICODE_DATA_SIZE = sizeof(UnicodeData)/sizeof(UnicodeDataRec);"); - } -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/map.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/map.cpp index 95e985ac1..8900ccd10 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/map.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/map.cpp @@ -21,14 +21,12 @@ Module Name: #include "pal/palinternal.h" #include "pal/dbgmsg.h" #include "pal/init.h" -#include "pal/critsect.h" #include "pal/virtual.h" #include "pal/environ.h" #include "common.h" #include "pal/map.hpp" #include "pal/thread.hpp" #include "pal/file.hpp" -#include "pal/malloc.hpp" #include #include @@ -56,7 +54,7 @@ SET_DEFAULT_DEBUG_CHANNEL(VIRTUAL); // this critical section. // -CRITICAL_SECTION mapping_critsec; +minipal_mutex mapping_critsec; LIST_ENTRY MappedViewList; #ifndef CORECLR @@ -112,17 +110,7 @@ void FileMappingCleanupRoutine( CPalThread *pThread, IPalObject *pObjectToCleanup, - bool fShutdown, - bool fCleanupSharedState - ); - -PAL_ERROR -FileMappingInitializationRoutine( - CPalThread *pThread, - CObjectType *pObjectType, - void *pImmutableData, - void *pSharedData, - void *pProcessLocalData + bool fShutdown ); void @@ -139,18 +127,11 @@ CFileMappingImmutableDataCleanupRoutine( CObjectType CorUnix::otFileMapping( otiFileMapping, FileMappingCleanupRoutine, - FileMappingInitializationRoutine, sizeof(CFileMappingImmutableData), CFileMappingImmutableDataCopyRoutine, CFileMappingImmutableDataCleanupRoutine, sizeof(CFileMappingProcessLocalData), NULL, // No process local data cleanup routine - 0, - PAGE_READWRITE | PAGE_READONLY | PAGE_WRITECOPY, - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::UnwaitableObject, CObjectType::SignalingNotApplicable, CObjectType::ThreadReleaseNotApplicable, @@ -188,8 +169,7 @@ void FileMappingCleanupRoutine( CPalThread *pThread, IPalObject *pObjectToCleanup, - bool fShutdown, - bool fCleanupSharedState + bool fShutdown ) { PAL_ERROR palError = NO_ERROR; @@ -198,27 +178,24 @@ FileMappingCleanupRoutine( IDataLock *pLocalDataLock = NULL; bool fDataChanged = FALSE; - if (TRUE == fCleanupSharedState) - { - // - // If we created a temporary file to back this mapping we need - // to unlink it now - // + // + // If we created a temporary file to back this mapping we need + // to unlink it now + // - palError = pObjectToCleanup->GetImmutableData( - reinterpret_cast(&pImmutableData) - ); + palError = pObjectToCleanup->GetImmutableData( + reinterpret_cast(&pImmutableData) + ); - if (NO_ERROR != palError) - { - ASSERT("Unable to obtain immutable data for object to be reclaimed"); - return; - } + if (NO_ERROR != palError) + { + ASSERT("Unable to obtain immutable data for object to be reclaimed"); + return; + } - if (pImmutableData->bPALCreatedTempFile) - { - unlink(pImmutableData->lpFileName); - } + if (pImmutableData->bPALCreatedTempFile) + { + unlink(pImmutableData->lpFileName); } if (FALSE == fShutdown) @@ -261,52 +238,6 @@ FileMappingCleanupRoutine( // } -PAL_ERROR -FileMappingInitializationRoutine( - CPalThread *pThread, - CObjectType *pObjectType, - void *pvImmutableData, - void *pvSharedData, - void *pvProcessLocalData - ) -{ - PAL_ERROR palError = NO_ERROR; - - CFileMappingImmutableData *pImmutableData = - reinterpret_cast(pvImmutableData); - CFileMappingProcessLocalData *pProcessLocalData = - reinterpret_cast(pvProcessLocalData); - - pProcessLocalData->UnixFd = InternalOpen( - pImmutableData->lpFileName, - MAPProtectionToFileOpenFlags(pImmutableData->flProtect) | O_CLOEXEC - ); - - if (-1 == pProcessLocalData->UnixFd) - { - palError = ERROR_INTERNAL_ERROR; - goto ExitFileMappingInitializationRoutine; - } - -#if ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS - struct stat st; - - if (0 == fstat(pProcessLocalData->UnixFd, &st)) - { - pProcessLocalData->MappedFileDevNum = st.st_dev; - pProcessLocalData->MappedFileInodeNum = st.st_ino; - } - else - { - ERROR("Couldn't get inode info for fd=%d to be stored in mapping object\n", pProcessLocalData->UnixFd); - } -#endif - -ExitFileMappingInitializationRoutine: - - return palError; -} - /*++ Function: CreateFileMappingW @@ -988,7 +919,7 @@ CorUnix::InternalMapViewOfFile( goto InternalMapViewOfFileExit; } - InternalEnterCriticalSection(pThread, &mapping_critsec); + minipal_mutex_enter(&mapping_critsec); if (FILE_MAP_COPY == dwDesiredAccess) { @@ -1184,7 +1115,7 @@ CorUnix::InternalMapViewOfFile( InternalMapViewOfFileLeaveCriticalSection: - InternalLeaveCriticalSection(pThread, &mapping_critsec); + minipal_mutex_leave(&mapping_critsec); InternalMapViewOfFileExit: @@ -1212,7 +1143,7 @@ CorUnix::InternalUnmapViewOfFile( PMAPPED_VIEW_LIST pView = NULL; IPalObject *pMappingObject = NULL; - InternalEnterCriticalSection(pThread, &mapping_critsec); + minipal_mutex_enter(&mapping_critsec); pView = MAPGetViewForAddress(lpBaseAddress); if (NULL == pView) @@ -1245,7 +1176,7 @@ CorUnix::InternalUnmapViewOfFile( InternalUnmapViewOfFileExit: - InternalLeaveCriticalSection(pThread, &mapping_critsec); + minipal_mutex_leave(&mapping_critsec); // // We can't dereference the file mapping object until after @@ -1277,7 +1208,7 @@ MAPInitialize( void ) { TRACE( "Initialising the critical section.\n" ); - InternalInitializeCriticalSection(&mapping_critsec); + minipal_mutex_init(&mapping_critsec); InitializeListHead(&MappedViewList); @@ -1299,7 +1230,7 @@ Function : void MAPCleanup( void ) { TRACE( "Deleting the critical section.\n" ); - InternalDeleteCriticalSection(&mapping_critsec); + minipal_mutex_destroy(&mapping_critsec); } /*++ @@ -1733,9 +1664,8 @@ BOOL MAPGetRegionInfo(LPVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer) { BOOL fFound = FALSE; - CPalThread * pThread = InternalGetCurrentThread(); - InternalEnterCriticalSection(pThread, &mapping_critsec); + minipal_mutex_enter(&mapping_critsec); for(LIST_ENTRY *pLink = MappedViewList.Flink; pLink != &MappedViewList; @@ -1776,7 +1706,7 @@ BOOL MAPGetRegionInfo(LPVOID lpAddress, } } - InternalLeaveCriticalSection(pThread, &mapping_critsec); + minipal_mutex_leave(&mapping_critsec); return fFound; } @@ -2110,7 +2040,7 @@ void * MAPMapPEFile(HANDLE hFile, off_t offset) #endif SIZE_T reserveSize = 0; bool forceOveralign = false; - int readWriteFlags = MAP_FILE|MAP_PRIVATE|MAP_FIXED; + int readWriteFlags = MAP_PRIVATE|MAP_FIXED; int readOnlyFlags = readWriteFlags; ENTRY("MAPMapPEFile (hFile=%p offset=%zx)\n", hFile, offset); @@ -2234,7 +2164,7 @@ void * MAPMapPEFile(HANDLE hFile, off_t offset) // and each of the sections, as well as all the space between them that we give PROT_NONE protections. // We're going to start adding mappings to the mapping list, so take the critical section - InternalEnterCriticalSection(pThread, &mapping_critsec); + minipal_mutex_enter(&mapping_critsec); reserveSize = RoundToPage(virtualSize, offset); if ((ntHeader.OptionalHeader.SectionAlignment) > GetVirtualPageSize()) @@ -2317,7 +2247,7 @@ void * MAPMapPEFile(HANDLE hFile, off_t offset) // If PAL_MAP_READONLY_PE_HUGE_PAGE_AS_SHARED is set to 1. map the readonly sections as shared // which works well with the behavior of the hugetlbfs if (mapAsShared != NULL && (strcmp(mapAsShared, "1") == 0)) - readOnlyFlags = MAP_FILE|MAP_SHARED|MAP_FIXED; + readOnlyFlags = MAP_SHARED|MAP_FIXED; } //we have now reserved memory (potentially we got rebased). Walk the PE sections and map each part @@ -2484,7 +2414,7 @@ void * MAPMapPEFile(HANDLE hFile, off_t offset) doneReleaseMappingCriticalSection: - InternalLeaveCriticalSection(pThread, &mapping_critsec); + minipal_mutex_leave(&mapping_critsec); done: @@ -2536,7 +2466,7 @@ BOOL MAPUnmapPEFile(LPCVOID lpAddress) BOOL retval = TRUE; CPalThread * pThread = InternalGetCurrentThread(); - InternalEnterCriticalSection(pThread, &mapping_critsec); + minipal_mutex_enter(&mapping_critsec); PLIST_ENTRY pLink, pLinkNext, pLinkLocal = NULL; unsigned nPESections = 0; @@ -2574,7 +2504,7 @@ BOOL MAPUnmapPEFile(LPCVOID lpAddress) } #endif // _DEBUG - InternalLeaveCriticalSection(pThread, &mapping_critsec); + minipal_mutex_leave(&mapping_critsec); // Now, outside the critical section, do the actual unmapping work @@ -2621,8 +2551,9 @@ BOOL MAPMarkSectionAsNotNeeded(LPCVOID lpAddress) } BOOL retval = TRUE; - CPalThread * pThread = InternalGetCurrentThread(); - InternalEnterCriticalSection(pThread, &mapping_critsec); + +#ifndef TARGET_ANDROID + minipal_mutex_enter(&mapping_critsec); PLIST_ENTRY pLink, pLinkNext = NULL; // Look through the entire MappedViewList for all mappings associated with the @@ -2650,7 +2581,8 @@ BOOL MAPMarkSectionAsNotNeeded(LPCVOID lpAddress) } } - InternalLeaveCriticalSection(pThread, &mapping_critsec); + minipal_mutex_leave(&mapping_critsec); +#endif // TARGET_ANDROID TRACE_(LOADER)("MAPMarkSectionAsNotNeeded returning %d\n", retval); return retval; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/virtual.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/virtual.cpp index 3145faac5..9143917af 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/virtual.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/map/virtual.cpp @@ -22,8 +22,6 @@ Module Name: SET_DEFAULT_DEBUG_CHANNEL(VIRTUAL); // some headers have code with asserts, so do this first #include "pal/thread.hpp" -#include "pal/cs.hpp" -#include "pal/malloc.hpp" #include "pal/file.hpp" #include "pal/seh.hpp" #include "pal/virtual.h" @@ -40,6 +38,7 @@ SET_DEFAULT_DEBUG_CHANNEL(VIRTUAL); // some headers have code with asserts, so d #include #include #include +#include #if HAVE_VM_ALLOCATE #include @@ -48,13 +47,18 @@ SET_DEFAULT_DEBUG_CHANNEL(VIRTUAL); // some headers have code with asserts, so d using namespace CorUnix; -CRITICAL_SECTION virtual_critsec; +minipal_mutex virtual_critsec; // The first node in our list of allocated blocks. static PCMI pVirtualMemory; static size_t s_virtualPageSize = 0; +#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX) +void (*jit_write_protect_np)(int enabled); +#define pthread_jit_write_protect_np jit_write_protect_np +#endif // defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX) + /* We need MAP_ANON. However on some platforms like HP-UX, it is defined as MAP_ANONYMOUS */ #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) #define MAP_ANON MAP_ANONYMOUS @@ -170,7 +174,7 @@ VIRTUALInitialize(bool initializeExecutableMemoryAllocator) TRACE("Initializing the Virtual Critical Sections. \n"); - InternalInitializeCriticalSection(&virtual_critsec); + minipal_mutex_init(&virtual_critsec); pVirtualMemory = NULL; @@ -179,6 +183,15 @@ VIRTUALInitialize(bool initializeExecutableMemoryAllocator) g_executableMemoryAllocator.Initialize(); } +#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX) + jit_write_protect_np = (void (*)(int))dlsym(RTLD_DEFAULT, "pthread_jit_write_protect_np"); + if (jit_write_protect_np == NULL) + { + ERROR("pthread_jit_write_protect_np not available.\n"); + return FALSE; + } +#endif // defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX) + return TRUE; } @@ -193,9 +206,7 @@ void VIRTUALCleanup() { PCMI pEntry; PCMI pTempEntry; - CPalThread * pthrCurrent = InternalGetCurrentThread(); - - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); // Clean up the allocated memory. pEntry = pVirtualMemory; @@ -209,10 +220,10 @@ void VIRTUALCleanup() } pVirtualMemory = NULL; - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); TRACE( "Deleting the Virtual Critical Sections. \n" ); - DeleteCriticalSection( &virtual_critsec ); + minipal_mutex_destroy( &virtual_critsec ); } /*** @@ -330,9 +341,7 @@ static void VIRTUALDisplayList( void ) PCMI p; SIZE_T count; SIZE_T index; - CPalThread * pthrCurrent = InternalGetCurrentThread(); - - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); p = pVirtualMemory; count = 0; @@ -351,7 +360,7 @@ static void VIRTUALDisplayList( void ) p = p->pNext; } - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); } #endif @@ -594,6 +603,10 @@ static LPVOID ReserveVirtualMemory( } #endif +#ifdef __HAIKU__ + mmapFlags |= MAP_NORESERVE; +#endif + LPVOID pRetVal = mmap((LPVOID) StartBoundary, MemSize, PROT_NONE, @@ -628,7 +641,7 @@ static LPVOID ReserveVirtualMemory( } #endif // MMAP_ANON_IGNORES_PROTECTION -#ifdef MADV_DONTDUMP +#if defined(MADV_DONTDUMP) && !defined(TARGET_WASM) // Do not include reserved uncommitted memory in coredump. if (!(fAllocationType & MEM_COMMIT)) { @@ -717,14 +730,16 @@ VIRTUALCommitMemory( nProtect = W32toUnixAccessControl(flProtect); +#ifndef TARGET_WASM // Commit the pages if (mprotect((void *) StartBoundary, MemSize, nProtect) != 0) { ERROR("mprotect() failed! Error(%d)=%s\n", errno, strerror(errno)); goto error; } +#endif -#ifdef MADV_DODUMP +#if defined(MADV_DONTDUMP) && !defined(TARGET_WASM) // Include committed memory in coredump. Any newly allocated memory included by default. if (!IsNewMemory) { @@ -735,7 +750,9 @@ VIRTUALCommitMemory( pRetVal = (void *) StartBoundary; goto done; +#ifndef TARGET_WASM error: +#endif if ( flAllocationType & MEM_RESERVE || IsLocallyReserved ) { munmap( pRetVal, MemSize ); @@ -799,8 +816,7 @@ PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange( // ExecutableMemoryAllocator::AllocateMemory() for the reason why it is done SIZE_T reservationSize = ALIGN_UP(dwSize, VIRTUAL_64KB); - CPalThread *currentThread = InternalGetCurrentThread(); - InternalEnterCriticalSection(currentThread, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); void *address = g_executableMemoryAllocator.AllocateMemoryWithinRange(lpBeginAddress, lpEndAddress, reservationSize); if (address != nullptr) @@ -823,7 +839,7 @@ PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange( address, TRUE); - InternalLeaveCriticalSection(currentThread, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); LOGEXIT("PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange returning %p\n", address); PERF_EXIT(PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange); @@ -921,9 +937,9 @@ VirtualAlloc( if ( flAllocationType & MEM_RESERVE ) { - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); pRetVal = VIRTUALReserveMemory( pthrCurrent, lpAddress, dwSize, flAllocationType, flProtect ); - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); if ( !pRetVal ) { @@ -934,7 +950,7 @@ VirtualAlloc( if ( flAllocationType & MEM_COMMIT ) { - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); if ( pRetVal != NULL ) { /* We are reserving and committing. */ @@ -947,7 +963,7 @@ VirtualAlloc( pRetVal = VIRTUALCommitMemory( pthrCurrent, lpAddress, dwSize, flAllocationType, flProtect ); } - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); } done: @@ -980,7 +996,7 @@ VirtualFree( lpAddress, dwSize, dwFreeType); pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); /* Sanity Checks. */ if ( !lpAddress ) @@ -1038,9 +1054,12 @@ VirtualFree( goto VirtualFreeExit; } - TRACE( "Un-committing the following page(s) %d to %d.\n", - StartBoundary, MemSize ); + TRACE( "Un-committing the following page(s) %p to %p.\n", + StartBoundary, StartBoundary + MemSize ); + // mmap support on emscripten/wasm is very limited and doesn't support location hints + // (when address is not null) +#ifndef TARGET_WASM // Explicitly calling mmap instead of mprotect here makes it // that much more clear to the operating system that we no // longer need these pages. @@ -1058,7 +1077,7 @@ VirtualFree( } #endif // MMAP_ANON_IGNORES_PROTECTION -#ifdef MADV_DONTDUMP +#if defined(MADV_DONTDUMP) && !defined(TARGET_WASM) // Do not include freed memory in coredump. madvise((LPVOID) StartBoundary, MemSize, MADV_DONTDUMP); #endif @@ -1071,6 +1090,13 @@ VirtualFree( pthrCurrent->SetLastError( ERROR_INTERNAL_ERROR ); goto VirtualFreeExit; } +#else // TARGET_WASM + // We can't decommit the mapping (MAP_FIXED doesn't work in emscripten), and we can't + // MADV_DONTNEED it (madvise doesn't work in emscripten), but we can at least zero + // the memory so that if an attempt is made to reuse it later, the memory will be + // empty as PAL tests expect it to be. + ZeroMemory((LPVOID) StartBoundary, MemSize); +#endif // TARGET_WASM } if ( dwFreeType & MEM_RELEASE ) @@ -1129,7 +1155,7 @@ VirtualFree( NULL, bRetVal); - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); LOGEXIT( "VirtualFree returning %s.\n", bRetVal == TRUE ? "TRUE" : "FALSE" ); PERF_EXIT(VirtualFree); return bRetVal; @@ -1157,15 +1183,13 @@ VirtualProtect( SIZE_T Index = 0; SIZE_T NumberOfPagesToChange = 0; SIZE_T OffSet = 0; - CPalThread * pthrCurrent; PERF_ENTRY(VirtualProtect); ENTRY("VirtualProtect(lpAddress=%p, dwSize=%u, flNewProtect=%#x, " "flOldProtect=%p)\n", lpAddress, dwSize, flNewProtect, lpflOldProtect); - pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); StartBoundary = (UINT_PTR) ALIGN_DOWN(lpAddress, GetVirtualPageSize()); MemSize = ALIGN_UP((UINT_PTR)lpAddress + dwSize, GetVirtualPageSize()) - StartBoundary; @@ -1187,9 +1211,11 @@ VirtualProtect( } pEntry = VIRTUALFindRegionInformation( StartBoundary ); +#ifndef TARGET_WASM if ( 0 == mprotect( (LPVOID)StartBoundary, MemSize, W32toUnixAccessControl( flNewProtect ) ) ) { +#endif // !TARGET_WASM /* Reset the access protection. */ TRACE( "Number of pages to change %d, starting page %d \n", NumberOfPagesToChange, OffSet ); @@ -1200,13 +1226,14 @@ VirtualProtect( */ *lpflOldProtect = PAGE_EXECUTE_READWRITE; -#ifdef MADV_DONTDUMP +#if defined(MADV_DONTDUMP) && !defined(TARGET_WASM) // Include or exclude memory from coredump based on the protection. int advise = flNewProtect == PAGE_NOACCESS ? MADV_DONTDUMP : MADV_DODUMP; madvise((LPVOID)StartBoundary, MemSize, advise); #endif bRetVal = TRUE; +#ifndef TARGET_WASM } else { @@ -1220,8 +1247,9 @@ VirtualProtect( SetLastError( ERROR_INVALID_ACCESS ); } } +#endif // !TARGET_WASM ExitVirtualProtect: - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); #if defined _DEBUG VIRTUALDisplayList(); @@ -1231,7 +1259,7 @@ VirtualProtect( return bRetVal; } -#if defined(HOST_OSX) && defined(HOST_ARM64) +#if defined(HOST_APPLE) && defined(HOST_ARM64) PALAPI VOID PAL_JitWriteProtect(bool writeEnable) { thread_local int enabledCount = 0; @@ -1251,7 +1279,7 @@ PALAPI VOID PAL_JitWriteProtect(bool writeEnable) _ASSERTE(enabledCount >= 0); } } -#endif // HOST_OSX && HOST_ARM64 +#endif // HOST_APPLE && HOST_ARM64 #if HAVE_VM_ALLOCATE //--------------------------------------------------------------------------------------- @@ -1416,7 +1444,7 @@ VirtualQuery( lpAddress, lpBuffer, dwLength); pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); if ( !lpBuffer) { @@ -1497,7 +1525,7 @@ VirtualQuery( ExitVirtualQuery: - InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); LOGEXIT( "VirtualQuery returning %d.\n", sizeof( *lpBuffer ) ); PERF_EXIT(VirtualQuery); @@ -1521,9 +1549,9 @@ Function : void* ReserveMemoryFromExecutableAllocator(CPalThread* pThread, SIZE_T allocationSize) { #ifdef HOST_64BIT - InternalEnterCriticalSection(pThread, &virtual_critsec); + minipal_mutex_enter(&virtual_critsec); void* mem = g_executableMemoryAllocator.AllocateMemory(allocationSize); - InternalLeaveCriticalSection(pThread, &virtual_critsec); + minipal_mutex_leave(&virtual_critsec); return mem; #else // !HOST_64BIT diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/cgroup.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/cgroup.cpp index ecdbccf2e..427e9ef13 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/cgroup.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/cgroup.cpp @@ -23,7 +23,7 @@ SET_DEFAULT_DEBUG_CHANNEL(MISC); #if defined(__APPLE__) || defined(__FreeBSD__) #include #include -#else +#elif !defined(__HAIKU__) #include #endif diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/dbgmsg.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/dbgmsg.cpp index 38f101d14..cc1213e8e 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/dbgmsg.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/dbgmsg.cpp @@ -16,13 +16,11 @@ Module Name: /* PAL headers */ #include "pal/thread.hpp" -#include "pal/malloc.hpp" #include "pal/file.hpp" #include "config.h" #include "pal/dbgmsg.h" #include "pal/cruntime.h" -#include "pal/critsect.h" #include "pal/file.h" #include "pal/environ.h" @@ -127,7 +125,7 @@ static const char INDENT_CHAR = '.'; static BOOL DBG_get_indent(DBG_LEVEL_ID level, const char *format, char *indent_string); -static CRITICAL_SECTION fprintf_crit_section; +static minipal_mutex fprintf_crit_section; /* Function definitions */ @@ -362,7 +360,7 @@ BOOL DBG_init_channels(void) } } - InternalInitializeCriticalSection(&fprintf_crit_section); + minipal_mutex_init(&fprintf_crit_section); return TRUE; } @@ -388,7 +386,7 @@ void DBG_close_channels() output_file = NULL; - DeleteCriticalSection(&fprintf_crit_section); + minipal_mutex_destroy(&fprintf_crit_section); /* if necessary, release TLS key for entry nesting level */ if(0 != max_entry_level) @@ -540,9 +538,9 @@ int DBG_printf(DBG_CHANNEL_ID channel, DBG_LEVEL_ID level, BOOL bHeader, avoid holding a libc lock while another thread is calling SuspendThread on this one. */ - InternalEnterCriticalSection(NULL, &fprintf_crit_section); + minipal_mutex_enter(&fprintf_crit_section); fprintf( output_file, "%s%s", indent, buffer ); - InternalLeaveCriticalSection(NULL, &fprintf_crit_section); + minipal_mutex_leave(&fprintf_crit_section); /* flush the output to file */ if ( fflush(output_file) != 0 ) @@ -734,7 +732,7 @@ bool DBG_ShouldCheckStackAlignment() } #endif // _DEBUG && __APPLE__ -#ifdef __APPLE__ +#if defined(TARGET_OSX) #include "CoreFoundation/CFUserNotification.h" #include "CoreFoundation/CFString.h" #include "Security/AuthSession.h" @@ -854,4 +852,4 @@ void PAL_DisplayDialogFormatted(const char *szTitle, const char *szTextFormat, . va_end(args); } -#endif // __APPLE__ +#endif // TARGET_OSX diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/environ.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/environ.cpp index 4980d213f..4a9eb640e 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/environ.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/environ.cpp @@ -20,10 +20,8 @@ Revision History: --*/ #include "pal/palinternal.h" -#include "pal/critsect.h" #include "pal/dbgmsg.h" #include "pal/environ.h" -#include "pal/malloc.hpp" #if HAVE_CRT_EXTERNS_H #include @@ -39,7 +37,7 @@ char **palEnvironment = nullptr; int palEnvironmentCount = 0; int palEnvironmentCapacity = 0; -CRITICAL_SECTION gcsEnvironment; +minipal_mutex gcsEnvironment; /*++ Function: @@ -115,7 +113,7 @@ GetEnvironmentVariableA( // the environment variable value without EnvironGetenv making an // intermediate copy. We will just copy the string to the output // buffer anyway, so just stay in the critical section until then. - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); value = EnvironGetenv(lpName, /* copyValue */ FALSE); @@ -135,7 +133,7 @@ GetEnvironmentVariableA( SetLastError(ERROR_SUCCESS); } - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); } if (value == nullptr) @@ -402,7 +400,7 @@ GetEnvironmentStringsW( ENTRY("GetEnvironmentStringsW()\n"); CPalThread * pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); envNum = 0; len = 0; @@ -434,7 +432,7 @@ GetEnvironmentStringsW( *tempEnviron = 0; /* Put an extra null at the end */ EXIT: - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); LOGEXIT("GetEnvironmentStringsW returning %p\n", wenviron); PERF_EXIT(GetEnvironmentStringsW); @@ -611,7 +609,7 @@ Return Values BOOL ResizeEnvironment(int newSize) { CPalThread * pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); BOOL ret = FALSE; if (newSize >= palEnvironmentCount) @@ -631,7 +629,7 @@ BOOL ResizeEnvironment(int newSize) ASSERT("ResizeEnvironment: newSize < current palEnvironmentCount!\n"); } - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); return ret; } @@ -653,7 +651,7 @@ void EnvironUnsetenv(const char *name) int nameLength = strlen(name); CPalThread * pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); for (int i = 0; palEnvironment[i] != nullptr; ++i) { @@ -681,7 +679,7 @@ void EnvironUnsetenv(const char *name) } } - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); } /*++ @@ -747,7 +745,7 @@ BOOL EnvironPutenv(const char* entry, BOOL deleteIfEmpty) { // See if we are replacing an item or adding one. - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); fOwningCS = true; int i; @@ -802,7 +800,7 @@ BOOL EnvironPutenv(const char* entry, BOOL deleteIfEmpty) if (fOwningCS) { - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); } return result; @@ -884,7 +882,7 @@ Return Value char* EnvironGetenv(const char* name, BOOL copyValue) { CPalThread * pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); char* retValue = FindEnvVarValue(name); @@ -893,7 +891,7 @@ char* EnvironGetenv(const char* name, BOOL copyValue) retValue = strdup(retValue); } - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); return retValue; } @@ -940,10 +938,10 @@ EnvironInitialize(void) { BOOL ret = FALSE; - InternalInitializeCriticalSection(&gcsEnvironment); + minipal_mutex_init(&gcsEnvironment); CPalThread * pthrCurrent = InternalGetCurrentThread(); - InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_enter(&gcsEnvironment); char** sourceEnviron = EnvironGetSystemEnvironment(); @@ -975,7 +973,7 @@ EnvironInitialize(void) palEnvironment[variableCount] = nullptr; } - InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment); + minipal_mutex_leave(&gcsEnvironment); return ret; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/fmtmessage.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/fmtmessage.cpp index 0598914b0..f096156f2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/fmtmessage.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/fmtmessage.cpp @@ -21,9 +21,7 @@ Revision History: #include "pal/palinternal.h" #include "pal/dbgmsg.h" -#include "pal/critsect.h" #include "pal/module.h" -#include "pal/misc.h" #include "errorstrings.h" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/miscpalapi.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/miscpalapi.cpp deleted file mode 100644 index f0d32f038..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/miscpalapi.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - miscpalapi.c - -Abstract: - - Implementation misc PAL APIs - -Revision History: - - - ---*/ - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/file.h" -#include "pal/process.h" -#include "pal/module.h" -#include "pal/malloc.hpp" -#include "pal/stackstring.hpp" - -#include -#include -#include -#include -#include -#include - -#include - -#ifdef __APPLE__ -#include -#endif // __APPLE__ - -SET_DEFAULT_DEBUG_CHANNEL(MISC); - -static const char URANDOM_DEVICE_NAME[]="/dev/urandom"; - -VOID -PALAPI -PAL_Random( - IN OUT LPVOID lpBuffer, - IN DWORD dwLength) -{ - int rand_des = -1; - DWORD i; - long num = 0; - static BOOL sMissingDevURandom; - static BOOL sInitializedMRand; - - PERF_ENTRY(PAL_Random); - ENTRY("PAL_Random(lpBuffer=%p, dwLength=%d)\n", lpBuffer, dwLength); - - if (!sMissingDevURandom) - { - do - { - rand_des = open("/dev/urandom", O_RDONLY | O_CLOEXEC); - } - while ((rand_des == -1) && (errno == EINTR)); - - if (rand_des == -1) - { - if (errno == ENOENT) - { - sMissingDevURandom = TRUE; - } - else - { - ASSERT("PAL__open() failed, errno:%d (%s)\n", errno, strerror(errno)); - } - - // Back off and try mrand48. - } - else - { - DWORD offset = 0; - do - { - ssize_t n = read(rand_des, (BYTE*)lpBuffer + offset , dwLength - offset); - if (n == -1) - { - if (errno == EINTR) - { - continue; - } - ASSERT("read() failed, errno:%d (%s)\n", errno, strerror(errno)); - - break; - } - - offset += n; - } - while (offset != dwLength); - - _ASSERTE(offset == dwLength); - - close(rand_des); - } - } - - if (!sInitializedMRand) - { - srand48(time(NULL)); - sInitializedMRand = TRUE; - } - - // always xor srand48 over the whole buffer to get some randomness - // in case /dev/urandom is not really random - - for (i = 0; i < dwLength; i++) - { - if (i % sizeof(long) == 0) { - num = mrand48(); - } - - *(((BYTE*)lpBuffer) + i) ^= num; - num >>= 8; - } - - LOGEXIT("PAL_Random\n"); - PERF_EXIT(PAL_Random); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perfjitdump.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perfjitdump.cpp index 6223d533a..84680cc2b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perfjitdump.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perfjitdump.cpp @@ -14,6 +14,7 @@ #ifdef JITDUMP_SUPPORTED #include +#include #include #include #include @@ -26,9 +27,14 @@ #include #include #include +#include "minipal/time.h" #include "../inc/llvm/ELF.h" +#if defined(HOST_AMD64) +#include +#endif + SET_DEFAULT_DEBUG_CHANNEL(MISC); namespace @@ -37,6 +43,7 @@ namespace { JIT_DUMP_MAGIC = 0x4A695444, JIT_DUMP_VERSION = 1, + JITDUMP_FLAGS_ARCH_TIMESTAMP = 1 << 0, #if defined(HOST_X86) ELF_MACHINE = EM_386, @@ -61,13 +68,34 @@ namespace JIT_CODE_LOAD = 0, }; + static bool UseArchTimeStamp() + { + static bool initialized = false; + static bool useArchTimestamp = false; + + if (!initialized) + { +#if defined(HOST_AMD64) + const char* archTimestamp = getenv("JITDUMP_USE_ARCH_TIMESTAMP"); + useArchTimestamp = (archTimestamp != nullptr && strcmp(archTimestamp, "1") == 0); +#endif + initialized = true; + } + + return useArchTimestamp; + } + static uint64_t GetTimeStampNS() { - LARGE_INTEGER result; - QueryPerformanceCounter(&result); - return result.QuadPart; +#if defined(HOST_AMD64) + if (UseArchTimeStamp()) { + return static_cast(__rdtsc()); + } +#endif + return (uint64_t)minipal_hires_ticks(); } + struct FileHeader { FileHeader() : @@ -78,7 +106,7 @@ namespace pad1(0), pid(getpid()), timestamp(GetTimeStampNS()), - flags(0) + flags(UseArchTimeStamp() ? JITDUMP_FLAGS_ARCH_TIMESTAMP : 0) {} uint32_t magic; @@ -102,7 +130,7 @@ namespace { JitCodeLoadRecord() : pid(getpid()), - tid((uint32_t)PlatformGetCurrentThreadId()) + tid((uint32_t)THREADSilentGetCurrentThreadId()) { header.id = JIT_CODE_LOAD; header.timestamp = GetTimeStampNS(); @@ -157,16 +185,13 @@ struct PerfJitDumpState { int result = 0; - // On platforms where JITDUMP is used, the PAL QueryPerformanceFrequency - // returns tccSecondsToNanoSeconds, meaning QueryPerformanceCounter - // will return a direct nanosecond value. If this isn't true, + // On platforms where JITDUMP is used, minipal_hires_tick_frequency() + // returns tccSecondsToNanoSeconds. If this isn't true, // then some other method will need to be used to implement GetTimeStampNS. // Validate this is true once in Start here. - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - if (freq.QuadPart != tccSecondsToNanoSeconds) + if (minipal_hires_tick_frequency() != tccSecondsToNanoSeconds) { - _ASSERTE(!"QueryPerformanceFrequency does not return tccSecondsToNanoSeconds. Implement JITDUMP GetTimeStampNS directly for this platform.\n"); + _ASSERTE(!"minipal_hires_tick_frequency() does not return tccSecondsToNanoSeconds. Implement JITDUMP GetTimeStampNS directly for this platform.\n"); FatalError(); } @@ -331,7 +356,7 @@ struct PerfJitDumpState result = close(fd); - if (result == -1) + if (result == -1 && errno != EINTR) return FatalError(); fd = -1; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perftrace.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perftrace.cpp deleted file mode 100644 index 691c9048c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/perftrace.cpp +++ /dev/null @@ -1,1341 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - misc/perftrace.c - -Abstract: - Implementation of PAL Performance trace utilities. - - - ---*/ - -/* PAL headers */ - - - -#ifdef PAL_PERF - -/* PAL Headers */ -#include "pal/palinternal.h" -#include "pal/perftrace.h" -#include "pal/dbgmsg.h" -#include "pal/cruntime.h" -#include "pal/misc.h" - -/* Standard headers */ -#include -#include -#include -#include -#include /* for pthread_self */ -#include -#include - -SET_DEFAULT_DEBUG_CHANNEL(MISC); - - -#define PAL_PERF_MAX_LOGLINE 0x400 /* 1K */ -#define PAL_PERF_MAX_INPUT 0x1000 /* 4k for single line of input file */ -#define PAL_PERF_MAX_FUNCTION_NAME 128 /* any one want a function name longer than 127 bytes? */ -#define PAL_PERF_PROFILE_BUFFER_SIZE 0x400000 /* 4M */ -#define PAL_PERF_BUFFER_FULL (PAL_PERF_PROFILE_BUFFER_SIZE - PAL_PERF_MAX_LOGLINE ) /* (Buffer size - 1K) */ - -typedef struct _pal_perf_api_info -{ - ULONGLONG entries; /* number of PERF_ENTRY calls for an API function */ - ULONGLONG counter; /* number of PERF_EXIT calls for an API function */ - ULONGLONG min_duration; /* Minimum duration in CPU clock ticks in an API function */ - ULONGLONG max_duration; /* Maximum duration in CPU clock ticks in an API function */ - ULONGLONG sum_duration; /* Sum of duration*/ - double sum_of_square_duration; /* Sum of square of durations */ - DWORD *histograms; /* An array to store the histogram of an API execution cpu ticks. */ -} pal_perf_api_info; - - -typedef struct _pal_perf_thread_info -{ - DWORD threadId; - pal_perf_api_info * api_table; - char * pal_write_buf; - DWORD buf_offset; - BOOL profile_enabled; - ULONGLONG start_ticks; - ULONGLONG total_duration; -} pal_perf_thread_info; - -typedef struct _pal_thread_list_node -{ - pal_perf_thread_info * thread_info; - struct _pal_thread_list_node * next; - -} pal_thread_list_node; - -typedef struct _pal_perf_program_info -{ - char command_line[PAL_PERF_MAX_LOGLINE]; - char exe_path[PAL_PERF_MAX_LOGLINE]; - char hostname[PAL_PERF_MAX_FUNCTION_NAME]; - double cpu_clock_frequency; - ULONGLONG start_ticks; - ULONGLONG elapsed_time; /* Duration in CPU clock ticks of the program */ - ULONGLONG total_duration; /* Total CPU clock ticks of all the threads */ - ULONGLONG pal_duration; /* Total CPU clock ticks spent inside PAL */ - - pid_t process_id; - char start_time[32]; /* must be at least 26 characters */ -} pal_perf_program_info; - -static ULONGLONG PERFGetTicks(); -static double PERFComputeStandardDeviation(pal_perf_api_info *api); -static void PERFPrintProgramHeaderInfo(FILE * hFile, BOOL completedExecution); -static BOOL PERFInitProgramInfo(LPWSTR command_line, LPWSTR exe_path); -static BOOL PERFReadSetting( ); -static void PERFLogFileName(PathCharString * destFileString, const char *fileName, const char *suffix, int max_length); -static void PERFlushAllLogs(); -static int PERFWriteCounters(pal_perf_api_info * table); -static BOOL PERFFlushLog(pal_perf_thread_info * local_buffer, BOOL output_header); -static void PERFUpdateApiInfo(pal_perf_api_info *api, ULONGLONG duration); -static char * PERFIsValidPath( const char * path ); -static char * PERFIsValidFile( const char * path, const char * file); - -typedef char PAL_API_NAME[PAL_PERF_MAX_FUNCTION_NAME]; - -static PAL_API_NAME API_list[PAL_API_NUMBER] ; -static pal_perf_program_info program_info; - -static pthread_key_t PERF_tlsTableKey=0 ; - -static pal_thread_list_node * process_pal_thread_list=NULL; -static BOOL pal_profile_on=FALSE; -static BOOL pal_perf_enabled=FALSE; -static char * pal_function_map=NULL; -static char * perf_default_path=NULL; -static char * traced_apis_file=NULL; -static char * enabledapis_path=NULL; -static char * profile_log_path=NULL; -static char * profile_summary_log_name=NULL; -static char * profile_time_log_name=NULL; -static BOOL summary_only=FALSE; -static BOOL nested_tracing=FALSE; -static BOOL calibrate=FALSE; - -/* If report_only_called_apis is TRUE, - those PAL APIs with no function entry or exit - will not be shown in the PAL perf summary file. */ -static BOOL report_only_called_apis=FALSE; - -/* If the wait_for_startup is TRUE, process profiling - will not start until the application - has called PAL_EnableProcessProfile(). */ -static BOOL wait_for_startup=FALSE; - -/* The size of a PAL API execution CPU ticks histogram, i.e., - Number of categories of frequency distrubution of PAL API - execution CPU ticks.*/ -static DWORD pal_perf_histogram_size = 0; - -/* The step size in CPU ticks of each category of the - PAL API execution CPU ticks histogram.*/ -static DWORD pal_perf_histogram_step = 100; - -static const char PAL_PERF_TRACING[]="PAL_PERF_TRACING"; -static const char PAL_DEFAULT_PATH[]="PAL_PERF_DEFAULT_PATH"; -static const char PAL_PERF_TRACEDAPIS_PATH[]="PAL_PERF_TRACEDAPIS_FILE"; -static const char PAL_PERF_LOG_PATH[]="PAL_PERF_LOG_PATH"; -static const char PAL_PERF_SUMMARY_LOG_NAME[]="PAL_PERF_SUMMARY_LOG_NAME"; -static const char PAL_PERF_TIME_LOG_NAME[]="PAL_PERF_TIME_LOG_NAME"; -static const char PAL_PERF_ENABLED_APIS_PATH[]="PAL_PERF_ENABLEDAPIS_FILE"; -static const char PAL_SUMMARY_FLAG[]="PAL_PERF_SUMMARY_ONLY"; -static const char PAL_PERF_NESTED_TRACING[]="PAL_PERF_NESTED_TRACING"; -static const char PAL_PERF_CALIBRATE[]="PAL_PERF_CALIBRATE"; -static const char PAL_PERF_REPORT_ONLY_CALLED_APIS[]="PAL_PERF_REPORT_ONLY_CALLED_APIS"; -static const char PAL_PERF_WAIT_FOR_STARTUP[]="PAL_PERF_WAIT_FOR_STARTUP"; -static const char PAL_PERF_HISTOGRAM_SIZE[]="PAL_PERF_HISTOGRAM_SIZE"; -static const char PAL_PERF_HISTOGRAM_STEP[]="PAL_PERF_HISTOGRAM_STEP"; -static const char traced_apis_filename[]="PerfTracedAPIs.txt"; -static const char perf_enabled_filename[]="AllPerfEnabledAPIs.txt"; -static const char PATH_SEPARATOR[] = "/"; - - - -#define LLFORMAT "%llu" - -static -ULONGLONG -PERFGetTicks(){ -#ifdef HOST_X86 // for BSD and Windows. - unsigned long a, d; - #ifdef _MSC_VER - __asm{ - rdtsc - mov a, eax - mov d, edx - } - #else - #undef volatile - asm volatile("rdtsc":"=a" (a), "=d" (d)); - #define volatile DoNotUseVolatileKeyword - #endif - return ((ULONGLONG)((unsigned int)(d)) << 32) | (unsigned int)(a); -#else - return 0; // on non-BSD and non-Windows, we'll return 0 for now. -#endif // HOST_X86 -} - -static -double -PERFComputeStandardDeviation(pal_perf_api_info *api) -{ - double n; - double sum_of_variance; - if (api->counter <= 1) - return 0.0; - n = (double) api->counter; - // Calculates standard deviation based on the entire population given as arguments. - // Same as stdevp in Excel. - sum_of_variance = (n*api->sum_of_square_duration) - (api->sum_duration*api->sum_duration); - if (sum_of_variance <= 0.0) - return 0.0; - return sqrt(sum_of_variance/(n*n)); -} - - -static -void -PERFPrintProgramHeaderInfo(FILE * hFile, BOOL completedExecution) -{ - ULONGLONG etime = 0; - ULONGLONG ttime = 0; - ULONGLONG ptime = 0; - if (completedExecution) { - etime = program_info.elapsed_time; - ttime = program_info.total_duration; - ptime = program_info.pal_duration; - } - fprintf(hFile,"#LOG\tversion=1.00\n"); - - fprintf(hFile, "#MACHINE\thostname=%s\tcpu_clock_frequency=%g\n", program_info.hostname, - program_info.cpu_clock_frequency); - fprintf(hFile, "#PROCESS\tprocess_id=%d\ttotal_latency=" LLFORMAT "\tthread_times=" LLFORMAT "\tpal_time=" LLFORMAT "\texe_path=%s\tcommand_line=%s\tstart_time=%s", - program_info.process_id, etime, ttime, ptime, - program_info.exe_path,program_info.command_line,program_info.start_time); -} - -static -BOOL -PERFInitProgramInfo(LPWSTR command_line, LPWSTR exe_path) -{ - ULONGLONG start_tick; - struct timeval tv; - - if (WideCharToMultiByte(CP_ACP, 0, command_line, -1, - program_info.command_line, PAL_PERF_MAX_LOGLINE-1, NULL, NULL) == 0) - return FALSE; - if (WideCharToMultiByte(CP_ACP, 0, exe_path, -1, - program_info.exe_path, PAL_PERF_MAX_LOGLINE-1, NULL, NULL) == 0) - return FALSE; - - gethostname(program_info.hostname, PAL_PERF_MAX_FUNCTION_NAME); - program_info.process_id = getpid(); - - gettimeofday(&tv, NULL); - ctime_r(&tv.tv_sec, program_info.start_time); - - // estimate the cpu clock cycles - start_tick = PERFGetTicks(); - if (start_tick != 0) - { - sleep(1); - program_info.cpu_clock_frequency = (double) (PERFGetTicks() - start_tick); - } - else - { - program_info.cpu_clock_frequency = 0.0; - } - - program_info.start_ticks = 0; - program_info.elapsed_time = 0; - program_info.total_duration = 0; - program_info.pal_duration = 0; - - return TRUE; -} - -static -void -PERFCalibrationFunction() -{ - PERF_ENTRY(CalibrationFunction); - PERF_EXIT(CalibrationFunction); -} - -void -PERFCalibrate(const char* msg) -{ - ULONGLONG start_tick, cal_ticks; - int i=0; - int cal_length=100000; - - if (calibrate) { - start_tick = PERFGetTicks(); - for(i=0; ithread_info = local_info; - local_info->api_table=apiTable; - local_info->threadId = THREADSilentGetCurrentThreadId(); - - for (i = 0; i < PAL_API_NUMBER; i++) - { - apiTable[i].entries = 0; - apiTable[i].counter = 0; - apiTable[i].min_duration = _UI64_MAX; - apiTable[i].max_duration = 0; - apiTable[i].sum_duration = 0; - apiTable[i].sum_of_square_duration = 0.0; - if (pal_perf_histogram_size > 0) - { - apiTable[i].histograms = (DWORD *)malloc(pal_perf_histogram_size*sizeof(DWORD)); - if (apiTable[i].histograms == NULL) - { - ret = FALSE; - goto PERFAllocThreadInfoExit; - } - memset(apiTable[i].histograms, 0, pal_perf_histogram_size*sizeof(DWORD)); - } - else - { - apiTable[i].histograms = NULL; - } - } - - log_buf = (char * )malloc( PAL_PERF_PROFILE_BUFFER_SIZE ); - - if(log_buf == NULL) - { - ret = FALSE; - goto PERFAllocThreadInfoExit; - } - - local_info->pal_write_buf=log_buf; - local_info->buf_offset = 0; - local_info->profile_enabled = FALSE; - local_info->total_duration = 0; - local_info->start_ticks = 0; - memset(log_buf, 0, PAL_PERF_PROFILE_BUFFER_SIZE); - - if (pthread_setspecific(PERF_tlsTableKey, local_info) != 0) - ret = FALSE; - -PERFAllocThreadInfoExit: - if (ret == TRUE) - { - node->next = process_pal_thread_list; - process_pal_thread_list = node; - PERFFlushLog(local_info, TRUE); - } - else - { - if (node != NULL) - { - free(node); - } - if (local_info != NULL) - { - free(local_info); - } - if (apiTable != NULL) - { - for (i = 0; i < PAL_API_NUMBER; i++) - { - if (apiTable[i].histograms != NULL) - { - free(apiTable[i].histograms); - } - } - free(apiTable); - } - if (log_buf != NULL) - { - free(log_buf); - } - } - return ret; -} - -static -void -PERFUpdateProgramInfo(pal_perf_thread_info* local_info) -{ - int i; - - if (!local_info) return; - - // add the elapsed time to the program's total - if (local_info->total_duration == 0) - { - // this thread did not go through PERFDisableThreadProfile code - // so compute the total elapsed time for the thread here - local_info->total_duration = PERFGetTicks() - local_info->start_ticks; - } - program_info.total_duration += local_info->total_duration; - - // Add up all the time spent in PAL - if (local_info->api_table) { - for(i=0; iapi_table[i].sum_duration; - } - } -} - - -static -void -PERFlushAllLogs( ) -{ - pal_thread_list_node * current, * node; - pal_perf_api_info * table1, *table0; - int i; - node = process_pal_thread_list; - if(node == NULL || node->thread_info == NULL || node->thread_info->api_table == NULL ) // should not come here - { - return ; - } - process_pal_thread_list = process_pal_thread_list->next; - table0 = node->thread_info->api_table; - - PERFUpdateProgramInfo(node->thread_info); - - while(process_pal_thread_list) - { - current=process_pal_thread_list; - process_pal_thread_list = process_pal_thread_list->next; - if (current->thread_info) - { - if (current->thread_info->api_table) - { - table1 = current->thread_info->api_table; - for(i=0;i table1[i].min_duration) - table0[i].min_duration = table1[i].min_duration; - if (table0[i].max_duration < table1[i].max_duration) - table0[i].max_duration = table1[i].max_duration; - table0[i].sum_duration += table1[i].sum_duration; - table0[i].sum_of_square_duration += table1[i].sum_of_square_duration; - } - PERFUpdateProgramInfo(current->thread_info); - if (table1->histograms != NULL) - { - free(table1->histograms); - } - free(table1); - } - PERFFlushLog(current->thread_info, FALSE); - free(current->thread_info->pal_write_buf); - free(current->thread_info); - } - free(current); - } - PERFWriteCounters(table0); - if (table0->histograms != NULL) - { - free(table0->histograms); - } - free(table0); - PERFFlushLog(node->thread_info, FALSE); - free(node->thread_info->pal_write_buf); - free(node->thread_info); - free(node); -} - -static -void -PERFLogFileName(PathCharString& destFileString, const char *fileName, const char *suffix) -{ - const char *dir_path; - CPalThread* pThread = InternalGetCurrentThread(); - dir_path = (profile_log_path == NULL) ? "." : profile_log_path; - - destFileString.Append(dir_path, strlen(dir_path)); - destFileString.Append(PATH_SEPARATOR, strlen(PATH_SEPARATOR)); - if (fileName != NULL) - { - destFileString.Append(fileName, strlen(fileName)); - } - else - { - char buffer[33]; - char* process_id = itoa(program_info.process_id, buffer, 10); - destFileString.Append(process_id, strlen(process_id)); - destFileString.Append("_", 1); - - char* current_thread = itoa(THREADSilentGetCurrentThreadId(),buffer, 10); - destFileString.Append(current_thread, strlen( current_thread)); - destFileString.Append(suffix, strlen(suffix)); - } - -} - -static -int -PERFWriteCounters( pal_perf_api_info * table ) -{ - PathCharString fileName; - pal_perf_api_info * off; - PERF_FILE * hFile; - int i; - - off = table; - - PERFLogFileName(fileName, profile_summary_log_name, "_perf_summary.log"); - hFile = fopen(fileName, "a+"); - if(hFile != NULL) - { - PERFPrintProgramHeaderInfo(hFile, TRUE); - fprintf(hFile,"#api_name\tapi_id\tperf_entries\tperf_exits\tsum_of_latency\tmin_latency\tmax_latency\tstd_dev_latency\tsum_of_square_latency\n"); - for(i=0;imin_duration == _UI64_MAX) ? 0 : off->min_duration; - if (off->counter >= 1) - { - dev = PERFComputeStandardDeviation(off); - } - else - { - dev = 0.0; - } - - if (off->counter > 0 || !report_only_called_apis) - { - fprintf(hFile,"%s\t%d\t" LLFORMAT "\t" LLFORMAT "\t" LLFORMAT "\t" LLFORMAT "\t" LLFORMAT "\t%g\t%g\n", - API_list[i], i, off->entries, off->counter,off->sum_duration, - min_duration, off->max_duration, dev, off->sum_of_square_duration); - } - - off++; - } - } - else - { - return -1; - } - fclose(hFile); - - if (pal_perf_histogram_size > 0) - { - off = table; - PERFLogFileName(fileName, profile_summary_log_name, "_perf_summary.hist"); - hFile = fopen(fileName, "a+"); - - if (hFile != NULL) - { - DWORD j; - fprintf(hFile,"#api_name\tapi_id"); - for (j = 0; j < pal_perf_histogram_size; j++) - { - fprintf(hFile, "\t%d", j*pal_perf_histogram_step); - } - fprintf(hFile, "\n"); - - for(i = 0; i < PAL_API_NUMBER; i++) - { - if (off->counter > 0) - { - fprintf(hFile,"%s\t%d", API_list[i], i); - - for (j = 0; j < pal_perf_histogram_size; j++) - { - fprintf(hFile, "\t%d", off->histograms[j]); - } - - fprintf(hFile, "\n"); - } - - off++; - } - } - else - { - return -1; - } - fclose(hFile); - } - - return 0; -} - -static -BOOL -PERFReadSetting( ) -{ - // this function is not safe right now. - //more code is required to deal with corrupted input file. - BOOL ret; - unsigned int index; - char line[PAL_PERF_MAX_INPUT]; - char * ptr; - char function_name[PAL_PERF_MAX_FUNCTION_NAME]; //no function can be longer than 127 bytes. - - char * file_name_buf; - PathCharString file_name_bufPS; - char * input_file_name; - char * summary_flag_env; - char * nested_tracing_env; - char * calibrate_env; - char * report_only_called_apis_env; - char * wait_for_startup_env; - char * pal_perf_histogram_size_env; - char * pal_perf_histogram_step_env; - - PAL_FILE * hFile; - - if((pal_function_map == NULL) || (PAL_API_NUMBER < 0) ) - { - // should not be here. - } - - /* do some env setting here */ - summary_flag_env = MiscGetenv(PAL_SUMMARY_FLAG); - if (summary_flag_env == NULL || strlen(summary_flag_env) == 0) - { - summary_only = FALSE; - } - else - { - summary_only = TRUE; - } - nested_tracing_env = MiscGetenv(PAL_PERF_NESTED_TRACING); - if (nested_tracing_env == NULL || strlen(nested_tracing_env) == 0) - { - nested_tracing = FALSE; - } - else - { - nested_tracing = TRUE; - } - - calibrate_env = MiscGetenv(PAL_PERF_CALIBRATE); - if (calibrate_env == NULL || strlen(calibrate_env) == 0) - { - calibrate = FALSE; - } - else - { - calibrate = TRUE; - } - - report_only_called_apis_env = MiscGetenv(PAL_PERF_REPORT_ONLY_CALLED_APIS); - if (report_only_called_apis_env == NULL || strlen(report_only_called_apis_env) == 0) - { - report_only_called_apis = FALSE; - } - else - { - report_only_called_apis = TRUE; - } - - wait_for_startup_env = MiscGetenv(PAL_PERF_WAIT_FOR_STARTUP); - if (wait_for_startup_env == NULL || strlen(wait_for_startup_env) == 0) - { - wait_for_startup = FALSE; - } - else - { - wait_for_startup = TRUE; - } - - pal_perf_histogram_size_env = MiscGetenv(PAL_PERF_HISTOGRAM_SIZE); - if (pal_perf_histogram_size_env != NULL && strlen(pal_perf_histogram_size_env) > 0) - { - long value; - char *endptr; - value = strtol(pal_perf_histogram_size_env, &endptr, 10); - if (value > 0) - { - pal_perf_histogram_size = (DWORD) value; - } - } - - pal_perf_histogram_step_env = MiscGetenv(PAL_PERF_HISTOGRAM_STEP); - if (pal_perf_histogram_step_env != NULL && strlen(pal_perf_histogram_step_env) > 0) - { - long value; - char *endptr; - value = strtol(pal_perf_histogram_step_env, &endptr, 10); - if (value > 0) - { - pal_perf_histogram_step = (DWORD) value; - } - } - - traced_apis_file = PERFIsValidFile("", MiscGetenv(PAL_PERF_TRACEDAPIS_PATH)); - enabledapis_path = PERFIsValidFile("", MiscGetenv(PAL_PERF_ENABLED_APIS_PATH)); - profile_log_path = PERFIsValidPath(MiscGetenv(PAL_PERF_LOG_PATH)); - perf_default_path = PERFIsValidPath( MiscGetenv(PAL_DEFAULT_PATH)); - profile_summary_log_name = MiscGetenv(PAL_PERF_SUMMARY_LOG_NAME); - if (profile_summary_log_name != NULL && strlen(profile_summary_log_name) == 0) - profile_summary_log_name = NULL; - profile_time_log_name = MiscGetenv(PAL_PERF_TIME_LOG_NAME); - if (profile_time_log_name != NULL && strlen(profile_time_log_name) == 0) - profile_time_log_name = NULL; - - if( traced_apis_file == NULL) - { - if(perf_default_path==NULL) - { - ret=FALSE; - input_file_name = NULL; - } - else - { - if( PERFIsValidFile(perf_default_path,traced_apis_filename)) - { - int length = strlen(perf_default_path) + strlen(PATH_SEPARATOR) + strlen(traced_apis_filename); - file_name_buf = file_name_bufPS.OpenStringBuffer(length); - if ((strcpy_s(file_name_buf, file_name_bufPS.GetSizeOf(), perf_default_path) != SAFECRT_SUCCESS) || - (strcat_s(file_name_buf, file_name_bufPS.GetSizeOf(), PATH_SEPARATOR) != SAFECRT_SUCCESS) || - (strcat_s(file_name_buf, file_name_bufPS.GetSizeOf(), traced_apis_filename) != SAFECRT_SUCCESS)) - { - file_name_bufPS.CloseBuffer(0); - ret = FALSE; - input_file_name = NULL; - } - else - { - file_name_bufPS.CloseBuffer(length); - input_file_name = file_name_buf; - } - } - else - { - ret = FALSE; - input_file_name=NULL; - } - } - } - else - { - input_file_name=traced_apis_file; - } - - if(input_file_name) - { - hFile = PAL_fopen(input_file_name, "r+"); - if ( hFile == NULL ) - { - memset(pal_function_map, 1, PAL_API_NUMBER); - ret = FALSE; - } - else - { - memset(pal_function_map, 0, PAL_API_NUMBER); - - PAL_fseek(hFile, 0L, SEEK_SET); - - /* Read a line of data from file: */ - while ( PAL_fgets(line, PAL_PERF_MAX_INPUT, hFile) != NULL ) - { - if(strlen(line)==0) - continue; - ptr = strchr( line, '#'); - if( ptr ) - continue; - sscanf_s(line, "%s %u", function_name,&index); - - if( index >= PAL_API_NUMBER) - { - // some code here to deal with incorrect index. - // use function name to cover it. - } - else if(pal_function_map[index]==1) - { - // some code here to deal with conflict index. - // use function name to cover it. - } - else - { - pal_function_map[index]=1; - } - - } - - PAL_fclose(hFile); - ret = TRUE; - } - } - else - { - memset(pal_function_map, 1, PAL_API_NUMBER); - ret = FALSE; - } - - if( enabledapis_path == NULL) - { - if(perf_default_path==NULL) - { - input_file_name = NULL; - } - else - { - if( PERFIsValidFile(perf_default_path,perf_enabled_filename)) - { - if ((strcpy_s(file_name_buf, sizeof(file_name_buf), perf_default_path) != SAFECRT_SUCCESS) || - (strcat_s(file_name_buf, sizeof(file_name_buf), PATH_SEPARATOR) != SAFECRT_SUCCESS) || - (strcat_s(file_name_buf, sizeof(file_name_buf), perf_enabled_filename) != SAFECRT_SUCCESS)) - { - ret = FALSE; - input_file_name = NULL; - } - else - { - input_file_name = file_name_buf; - } - } - else - { - input_file_name=NULL; - } - } - } - else - { - input_file_name=enabledapis_path; - } - - if(input_file_name == NULL) - { - return ret; - } - - hFile = PAL_fopen(input_file_name, "r+"); - - if ( hFile != NULL ) - { - PAL_fseek(hFile, 0L, SEEK_SET); - - /* Read a line of data from file: */ - while (PAL_fgets(line, PAL_PERF_MAX_INPUT, hFile) != NULL) - { - if(strlen(line)==0) - continue; - ptr = strchr( line, '#'); - if( ptr ) - continue; - sscanf_s(line, "%s %u", function_name,&index); - - if( index >= PAL_API_NUMBER) - { - // some code here to deal with incorrect index. - // use function name to cover it. - continue; - } - - if (strcpy_s(API_list[index], sizeof(API_list[index]), function_name) != SAFECRT_SUCCESS) - { - ret = FALSE; - break; - } - } - - PAL_fclose(hFile); - } - - return ret; - -} - - -static -BOOL -PERFFlushLog(pal_perf_thread_info * local_info, BOOL output_header) -{ - BOOL ret = FALSE; - PathCharString fileName; - int nWrittenBytes = 0; - PERF_FILE * hFile; - - if (summary_only) - return TRUE; - - PERFLogFileName(fileName, profile_time_log_name, "_perf_time.log"); - - hFile = fopen(fileName, "a+"); - - if(hFile) - { - if (output_header) - { - PERFPrintProgramHeaderInfo(hFile, FALSE); - } - if (local_info->buf_offset > 0) - { - nWrittenBytes = fwrite(local_info->pal_write_buf, local_info->buf_offset, 1, hFile); - if (nWrittenBytes < 1) - { - ERROR("fwrite() failed with errno == %d\n", errno); - return ret; - } - local_info->buf_offset = 0; - } - fclose(hFile); - ret = TRUE; - } - - return ret; -} - -void -PERFLogFunctionEntry(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) -{ - pal_perf_thread_info * local_info=NULL; - pal_perf_api_info * table; - char * write_buf; - int32_t buf_off; - short bufused = 0; - - - struct timeval tv; - - - if(!pal_perf_enabled || pal_function_map==NULL || !pal_profile_on ) // haven't initialize, just quit. - return; - - if( pal_function_map[pal_api_id] ) - { - local_info= (pal_perf_thread_info * )pthread_getspecific(PERF_tlsTableKey); - - if (local_info==NULL ) - { - return; - } - if ( !local_info->profile_enabled ) /* prevent recursion. */ - { - return; - } - // turn on this flag before call any other functions - local_info->profile_enabled = FALSE; - table = local_info->api_table; - table[pal_api_id].entries++; - - if(!summary_only) - { - write_buf = (local_info->pal_write_buf); - if(local_info->buf_offset >= PAL_PERF_BUFFER_FULL) - { - PERFFlushLog(local_info, FALSE); - } - - gettimeofday(&tv, NULL); - - buf_off = local_info->buf_offset; - - bufused = snprintf(&write_buf[buf_off], PAL_PERF_MAX_LOGLINE, "----> %d %lu %06u entry.\n", pal_api_id, tv.tv_sec, tv.tv_usec ); - local_info->buf_offset += bufused; - } - if(nested_tracing) - local_info->profile_enabled = TRUE; - *pal_perf_start_tick = PERFGetTicks(); - } - return; -} - -static -void -PERFUpdateApiInfo(pal_perf_api_info *api, ULONGLONG duration) -{ - DWORD iBucket; - - api->counter++; - if (api->min_duration > duration) - api->min_duration = duration; - if (api->max_duration < duration) - api->max_duration = duration; - api->sum_duration += duration; - api->sum_of_square_duration += (double) duration * (double)duration; - - if (pal_perf_histogram_size > 0) - { - iBucket = (DWORD)(duration / pal_perf_histogram_step); - if (iBucket >= pal_perf_histogram_size) - { - iBucket = pal_perf_histogram_size - 1; - } - api->histograms[iBucket]++; - } - -} - -void -PERFLogFunctionExit(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) -{ - - pal_perf_thread_info * local_info; - char * buf; - short bufused = 0; - DWORD off; - ULONGLONG duration = 0; - struct timeval timev; - - - if(!pal_perf_enabled || (pal_function_map == NULL) || !pal_profile_on ) // haven't initiallize yet, just quit. - return; - - if (*pal_perf_start_tick != 0) - { - duration = PERFGetTicks() - *pal_perf_start_tick; - } - else - { - return; // pal_perf_start_tick == 0 indicates that we exited PERFLogFunctionEntry before getting the ticks. - } - - if( pal_function_map[pal_api_id] ) - { - local_info = (pal_perf_thread_info*)pthread_getspecific(PERF_tlsTableKey); - - if (NULL == local_info ){ - return; - } - PERFUpdateApiInfo(&local_info->api_table[pal_api_id], duration); - *pal_perf_start_tick = 0; - - if(summary_only) - { - local_info->profile_enabled = TRUE; - return; - } - - gettimeofday(&timev, NULL); - - buf = local_info->pal_write_buf; - if(local_info->buf_offset >= PAL_PERF_BUFFER_FULL) - { - PERFFlushLog(local_info, FALSE); - } - off = local_info->buf_offset; - - bufused = snprintf(&buf[off], PAL_PERF_MAX_LOGLINE, "<---- %d %lu %06u exit. \n", pal_api_id, timev.tv_sec, timev.tv_usec ); - local_info->buf_offset += bufused; - local_info->profile_enabled = TRUE; - } - return; -} - -void -PERFNoLatencyProfileEntry(unsigned int pal_api_id ) -{ - pal_perf_thread_info * local_info=NULL; - pal_perf_api_info * table; - - if(!pal_perf_enabled || pal_function_map==NULL || !pal_profile_on ) // haven't initialize, just quit. - return; - if( pal_function_map[pal_api_id] ) - { - local_info= (pal_perf_thread_info * )pthread_getspecific(PERF_tlsTableKey); - if (local_info==NULL ) - { - return; - } - else{ - table = local_info->api_table; - table[pal_api_id].entries++; - } - } - return; -} - - -void -PERFEnableThreadProfile(BOOL isInternal) -{ - pal_perf_thread_info * local_info; - if (!pal_perf_enabled) - return; - if (NULL != (local_info = (pal_perf_thread_info*)pthread_getspecific(PERF_tlsTableKey))) - { - if (!isInternal || nested_tracing) { - local_info->profile_enabled = TRUE; - local_info->start_ticks = PERFGetTicks(); - } - } -} - - -void -PERFDisableThreadProfile(BOOL isInternal) -{ - pal_perf_thread_info * local_info; - if (!pal_perf_enabled) - return; - if (NULL != (local_info = (pal_perf_thread_info*)pthread_getspecific(PERF_tlsTableKey))) - { - if (!isInternal || nested_tracing) { - local_info->profile_enabled = FALSE; - local_info->total_duration = PERFGetTicks() - local_info->start_ticks; - } - } -} - - -void -PERFEnableProcessProfile( ) -{ - if (!pal_perf_enabled || wait_for_startup) - return; - pal_profile_on = TRUE; - PERFCalibrate("Overhead when profiling is disabled temporarily for a thread"); - // record the cpu clock ticks at the beginning of the profiling. - program_info.start_ticks = PERFGetTicks(); -} - - -void -PERFDisableProcessProfile( ) -{ - if (!pal_perf_enabled) - return; - pal_profile_on = FALSE; - // compute the total program duration in cpu clock ticks. - if (program_info.start_ticks != 0) - { - program_info.elapsed_time += (PERFGetTicks() - program_info.start_ticks); - program_info.start_ticks = 0; - } -} - -BOOL -PERFIsProcessProfileEnabled( ) -{ - return pal_profile_on; -} - -static -char * -PERFIsValidPath( const char * path ) -{ - DIR * dir; - - if(( path==NULL) || (strlen(path)==0)) - return NULL; - - dir = opendir(path); - if( dir!=NULL) - { - closedir(dir); - return ((char *)path); - } - return NULL; -} - -static -char * -PERFIsValidFile( const char * path, const char * file) -{ - FILE * hFile; - char * temp; - PathCharString tempPS; - - if(file==NULL || strlen(file)==0) - return NULL; - - if ( strcmp(path, "") ) - { - int length = strlen(path) + strlen(PATH_SEPARATOR) + strlen(file); - temp = tempPS.OpenStringBuffer(length); - if ((strcpy_s(temp, sizeof(temp), path) != SAFECRT_SUCCESS) || - (strcat_s(temp, sizeof(temp), PATH_SEPARATOR) != SAFECRT_SUCCESS) || - (strcat_s(temp, sizeof(temp), file) != SAFECRT_SUCCESS)) - { - tempPS.CloseBuffer(0); - return NULL; - } - - tempPS.CloseBuffer(length); - hFile = fopen(temp, "r"); - } - else - { - hFile = fopen(file, "r"); - } - - if(hFile) - { - fclose(hFile); - return ((char *) file); - } - else - return NULL; - -} - -PALIMPORT -VOID -PALAPI -PAL_EnableProcessProfile(VOID) -{ - wait_for_startup = FALSE; - pal_profile_on = TRUE; - PERFEnableProcessProfile(); -} - -PALIMPORT -VOID -PALAPI -PAL_DisableProcessProfile(VOID) -{ - pal_profile_on = FALSE; - PERFDisableProcessProfile(); -} - -PALIMPORT -BOOL -PALAPI -PAL_IsProcessProfileEnabled(VOID) -{ - return PERFIsProcessProfileEnabled(); -} - -PALIMPORT -INT64 -PALAPI -PAL_GetCpuTickCount(VOID) -{ - return PERFGetTicks(); -} - -#endif /* PAL_PERF */ - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/strutil.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/strutil.cpp index e665e22b6..585fbeb37 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/strutil.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/strutil.cpp @@ -18,7 +18,6 @@ Module Name: #include "pal/corunix.hpp" #include "pal/thread.hpp" -#include "pal/malloc.hpp" #include "pal/dbgmsg.h" SET_DEFAULT_DEBUG_CHANNEL(PAL); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/sysinfo.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/sysinfo.cpp index d20fa7b2a..2d6f9edb6 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/sysinfo.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/sysinfo.cpp @@ -58,13 +58,18 @@ Revision History: #include #endif // HAVE_MACHINE_VMPARAM_H -#if defined(TARGET_OSX) +#if defined(__APPLE__) #include #include #include #include -#endif // defined(TARGET_OSX) +#endif // defined(__APPLE__) +#ifdef __HAIKU__ +#include +#endif // __HAIKU__ + +#ifdef __FreeBSD__ // On some platforms sys/user.h ends up defining _DEBUG; if so // remove the definition before including the header and put // back our definition afterwards @@ -78,6 +83,7 @@ Revision History: #define _DEBUG OLD_DEBUG #undef OLD_DEBUG #endif +#endif // __FreeBSD__ #include "pal/dbgmsg.h" #include "pal/process.h" @@ -211,6 +217,12 @@ GetSystemInfo( lpSystemInfo->lpMaximumApplicationAddress = (PVOID) (1ull << 47); #elif defined(__sun) lpSystemInfo->lpMaximumApplicationAddress = (PVOID) 0xfffffd7fffe00000ul; +#elif defined(VM_MAX_PAGE_ADDRESS) + lpSystemInfo->lpMaximumApplicationAddress = (PVOID) VM_MAX_PAGE_ADDRESS; +#elif defined(__HAIKU__) + lpSystemInfo->lpMaximumApplicationAddress = (PVOID) 0x7fffffe00000ul; +#elif defined(__wasm__) + lpSystemInfo->lpMaximumApplicationAddress = (PVOID) (1ul << 31); #elif defined(USERLIMIT) lpSystemInfo->lpMaximumApplicationAddress = (PVOID) USERLIMIT; #elif defined(HOST_64BIT) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/time.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/time.cpp index 7d78ae930..22f0c8387 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/time.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/time.cpp @@ -19,7 +19,6 @@ Module Name: #include "pal/palinternal.h" #include "pal/dbgmsg.h" -#include "pal/misc.h" #include #include @@ -101,7 +100,7 @@ GetSystemTime( int old_seconds; int new_seconds; - lpSystemTime->wMilliseconds = (WORD)(timeval.tv_usec/tccMillieSecondsToMicroSeconds); + lpSystemTime->wMilliseconds = (WORD)(timeval.tv_usec/tccMilliSecondsToMicroSeconds); old_seconds = utPtr->tm_sec; new_seconds = timeval.tv_sec%60; @@ -119,109 +118,6 @@ GetSystemTime( PERF_EXIT(GetSystemTime); } -/*++ -Function: - GetTickCount - -The GetTickCount function retrieves the number of milliseconds that -have elapsed since the system was started. It is limited to the -resolution of the system timer. To obtain the system timer resolution, -use the GetSystemTimeAdjustment function. - -Parameters - -This function has no parameters. - -Return Values - -The return value is the number of milliseconds that have elapsed since -the system was started. - -In the PAL implementation the return value is the elapsed time since -the start of the epoch. - ---*/ -DWORD -PALAPI -GetTickCount( - VOID) -{ - DWORD retval = 0; - PERF_ENTRY(GetTickCount); - ENTRY("GetTickCount ()\n"); - - // Get the 64-bit count from GetTickCount64 and truncate the results. - retval = (DWORD) GetTickCount64(); - - LOGEXIT("GetTickCount returns DWORD %u\n", retval); - PERF_EXIT(GetTickCount); - return retval; -} - -BOOL -PALAPI -QueryPerformanceCounter( - OUT LARGE_INTEGER *lpPerformanceCount - ) -{ - BOOL retval = TRUE; - PERF_ENTRY(QueryPerformanceCounter); - ENTRY("QueryPerformanceCounter()\n"); - -#if HAVE_CLOCK_GETTIME_NSEC_NP - lpPerformanceCount->QuadPart = (LONGLONG)clock_gettime_nsec_np(CLOCK_UPTIME_RAW); -#elif HAVE_CLOCK_MONOTONIC - struct timespec ts; - int result = clock_gettime(CLOCK_MONOTONIC, &ts); - - if (result != 0) - { - ASSERT("clock_gettime(CLOCK_MONOTONIC) failed: %d\n", result); - retval = FALSE; - } - else - { - lpPerformanceCount->QuadPart = - ((LONGLONG)(ts.tv_sec) * (LONGLONG)(tccSecondsToNanoSeconds)) + (LONGLONG)(ts.tv_nsec); - } -#else - #error "The PAL requires either mach_absolute_time() or clock_gettime(CLOCK_MONOTONIC) to be supported." -#endif - - LOGEXIT("QueryPerformanceCounter\n"); - PERF_EXIT(QueryPerformanceCounter); - return retval; -} - -BOOL -PALAPI -QueryPerformanceFrequency( - OUT LARGE_INTEGER *lpFrequency - ) -{ - BOOL retval = TRUE; - PERF_ENTRY(QueryPerformanceFrequency); - ENTRY("QueryPerformanceFrequency()\n"); - -#if HAVE_CLOCK_GETTIME_NSEC_NP - lpFrequency->QuadPart = (LONGLONG)(tccSecondsToNanoSeconds); -#elif HAVE_CLOCK_MONOTONIC - // clock_gettime() returns a result in terms of nanoseconds rather than a count. This - // means that we need to either always scale the result by the actual resolution (to - // get a count) or we need to say the resolution is in terms of nanoseconds. We prefer - // the latter since it allows the highest throughput and should minimize error propagated - // to the user. - - lpFrequency->QuadPart = (LONGLONG)(tccSecondsToNanoSeconds); -#else - #error "The PAL requires either mach_absolute_time() or clock_gettime(CLOCK_MONOTONIC) to be supported." -#endif - - LOGEXIT("QueryPerformanceFrequency\n"); - PERF_EXIT(QueryPerformanceFrequency); - return retval; -} - /*++ Function: QueryThreadCycleTime @@ -260,58 +156,6 @@ QueryThreadCycleTime( return retval; } -/*++ -Function: - GetTickCount64 - -Returns a 64-bit tick count with a millisecond resolution. It tries its best -to return monotonically increasing counts and avoid being affected by changes -to the system clock (either due to drift or due to explicit changes to system -time). ---*/ -PALAPI -ULONGLONG -GetTickCount64() -{ - LONGLONG retval = 0; - -#if HAVE_CLOCK_GETTIME_NSEC_NP - return (LONGLONG)clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / (LONGLONG)(tccMillieSecondsToNanoSeconds); -#elif HAVE_CLOCK_MONOTONIC || HAVE_CLOCK_MONOTONIC_COARSE - struct timespec ts; - -#if HAVE_CLOCK_MONOTONIC_COARSE - // CLOCK_MONOTONIC_COARSE has enough precision for GetTickCount but - // doesn't have the same overhead as CLOCK_MONOTONIC. This allows - // overall higher throughput. See dotnet/coreclr#2257 for more details. - - const clockid_t clockType = CLOCK_MONOTONIC_COARSE; -#else - const clockid_t clockType = CLOCK_MONOTONIC; -#endif - - int result = clock_gettime(clockType, &ts); - - if (result != 0) - { -#if HAVE_CLOCK_MONOTONIC_COARSE - ASSERT("clock_gettime(CLOCK_MONOTONIC_COARSE) failed: %d\n", result); -#else - ASSERT("clock_gettime(CLOCK_MONOTONIC) failed: %d\n", result); -#endif - retval = FALSE; - } - else - { - retval = ((LONGLONG)(ts.tv_sec) * (LONGLONG)(tccSecondsToMillieSeconds)) + ((LONGLONG)(ts.tv_nsec) / (LONGLONG)(tccMillieSecondsToNanoSeconds)); - } -#else - #error "The PAL requires either mach_absolute_time() or clock_gettime(CLOCK_MONOTONIC) to be supported." -#endif - - return (ULONGLONG)(retval); -} - /*++ Function: PAL_nanosleep diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/tracepointprovider.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/tracepointprovider.cpp index 3cfc5e069..dae1e0f73 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/tracepointprovider.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/misc/tracepointprovider.cpp @@ -20,7 +20,6 @@ Revision History: #include "pal/file.h" #include "pal/process.h" #include "pal/module.h" -#include "pal/malloc.hpp" #include "pal/stackstring.hpp" #include diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.cpp index c39b5df7e..b500c448d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.cpp @@ -17,7 +17,6 @@ Module Name: --*/ #include "palobjbase.hpp" -#include "pal/malloc.hpp" #include "pal/dbgmsg.h" SET_DEFAULT_DEBUG_CHANNEL(PAL); @@ -287,7 +286,7 @@ CPalObjectBase::ReleaseReference( if (0 == lRefCount) { - bool fCleanupSharedState = ReleaseObjectDestructionLock(pthr, TRUE); + ReleaseObjectDestructionLock(pthr, TRUE); // // We need to do two things with the calling thread data here: @@ -308,8 +307,7 @@ CPalObjectBase::ReleaseReference( (*m_pot->GetObjectCleanupRoutine())( pthr, static_cast(this), - FALSE, - fCleanupSharedState + FALSE ); } @@ -323,7 +321,7 @@ CPalObjectBase::ReleaseReference( (*m_pot->GetProcessLocalDataCleanupRoutine())(pthr, static_cast(this)); } - InternalDelete(this); + delete this; pthr->ReleaseThreadReference(); } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.hpp index e05aaf0cd..866c26747 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/palobjbase.hpp @@ -20,7 +20,6 @@ Module Name: #define _PALOBJBASE_HPP_ #include "pal/corunix.hpp" -#include "pal/cs.hpp" #include "pal/thread.hpp" namespace CorUnix @@ -29,7 +28,7 @@ namespace CorUnix { private: - CRITICAL_SECTION m_cs; + minipal_mutex m_cs; bool m_fInitialized; public: @@ -44,7 +43,7 @@ namespace CorUnix { if (m_fInitialized) { - InternalDeleteCriticalSection(&m_cs); + minipal_mutex_destroy(&m_cs); } }; @@ -55,7 +54,7 @@ namespace CorUnix { PAL_ERROR palError = NO_ERROR; - InternalInitializeCriticalSection(&m_cs); + minipal_mutex_init(&m_cs); m_fInitialized = TRUE; return palError; @@ -67,7 +66,7 @@ namespace CorUnix IDataLock **pDataLock ) { - InternalEnterCriticalSection(pthr, &m_cs); + minipal_mutex_enter(&m_cs); *pDataLock = static_cast(this); }; @@ -78,15 +77,13 @@ namespace CorUnix bool fDataChanged ) { - InternalLeaveCriticalSection(pthr, &m_cs); + minipal_mutex_leave(&m_cs); }; }; class CPalObjectBase : public IPalObject { - template friend void InternalDelete(T *p); - protected: LONG m_lRefCount; @@ -114,7 +111,7 @@ namespace CorUnix ) = 0; virtual - bool + void ReleaseObjectDestructionLock( CPalThread *pthr, bool fDestructionPending diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobject.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobject.cpp deleted file mode 100644 index 282dd113d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobject.cpp +++ /dev/null @@ -1,1213 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - shmobject.hpp - -Abstract: - Shared memory based object - - - ---*/ - -#include "shmobject.hpp" -#include "pal/malloc.hpp" -#include "pal/cs.hpp" -#include "pal/dbgmsg.h" - -#include - -SET_DEFAULT_DEBUG_CHANNEL(PAL); - -using namespace CorUnix; - -/*++ -Function: - CSharedMemoryObject::Initialize - - Performs possibly-failing initialization for a newly-constructed - object - -Parameters: - pthr -- thread data for calling thread - poa -- the object attributes (e.g., name) for the object ---*/ - -PAL_ERROR -CSharedMemoryObject::Initialize( - CPalThread *pthr, - CObjectAttributes *poa - ) -{ - PAL_ERROR palError = NO_ERROR; - SHMObjData *psmod = NULL; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != poa); - - ENTRY("CSharedMemoryObject::Initialize" - "(this = %p, pthr = %p, poa = %p)\n", - this, - pthr, - poa - ); - - palError = CPalObjectBase::Initialize(pthr, poa); - if (NO_ERROR != palError) - { - goto InitializeExit; - } - - // - // If this is a named object it needs to go into the shared domain; - // otherwise it remains local - // - - if (0 != m_oa.sObjectName.GetStringLength()) - { - m_ObjectDomain = SharedObject; - - palError = AllocateSharedDataItems(&m_shmod, &psmod); - if (NO_ERROR != palError || NULL == psmod) - { - goto InitializeExit; - } - } - - if (0 != m_pot->GetSharedDataSize()) - { - if (SharedObject == m_ObjectDomain) - { - // - // Map the shared data into our address space - // - if (NULL == psmod) - { - ASSERT("psmod should not be NULL"); - palError = ERROR_INTERNAL_ERROR; - goto InitializeExit; - } - - m_pvSharedData = SHMPTR_TO_TYPED_PTR(VOID, psmod->shmObjSharedData); - if (NULL == m_pvSharedData) - { - ASSERT("Unable to map shared data area\n"); - palError = ERROR_INTERNAL_ERROR; - goto InitializeExit; - } - } - else - { - // - // Initialize the local shared data lock. - // - - palError = m_sdlSharedData.Initialize(); - if (NO_ERROR != palError) - { - ERROR("Failure initializing m_sdlSharedData\n"); - goto InitializeExit; - } - - // - // Allocate local memory to hold the shared data - // - - m_pvSharedData = malloc(m_pot->GetSharedDataSize()); - if (NULL == m_pvSharedData) - { - ERROR("Failure allocating m_pvSharedData (local copy)\n"); - palError = ERROR_OUTOFMEMORY; - goto InitializeExit; - } - } - - ZeroMemory(m_pvSharedData, m_pot->GetSharedDataSize()); - } - - -InitializeExit: - - LOGEXIT("CSharedMemoryObject::Initialize returns %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObject::InitializeFromExistingSharedData - - Performs possibly-failing initialization for a newly-constructed - object that is to represent an existing object (i.e., importing - a shared object into this process) - - The shared memory lock must be held when calling this method - -Parameters: - pthr -- thread data for calling thread - poa -- the object attributes for the object ---*/ - -PAL_ERROR -CSharedMemoryObject::InitializeFromExistingSharedData( - CPalThread *pthr, - CObjectAttributes *poa - ) -{ - PAL_ERROR palError = NO_ERROR; - SHMObjData *psmod = NULL; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != poa); - - ENTRY("CSharedMemoryObject::InitializeFromExistingSharedData" - "(this = %p, pthr = %p, poa = %p)\n", - this, - pthr, - poa - ); - - // - // This object is obviously shared... - // - - m_ObjectDomain = SharedObject; - - _ASSERTE(NULL != m_shmod); - - psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, m_shmod); - if (NULL == psmod) - { - ASSERT("Unable to map shared object data\n"); - palError = ERROR_INTERNAL_ERROR; - goto InitializeFromExistingSharedDataExit; - } - - // - // When we're being called on the duplicate handle path the passed - // in object attributes likely won't have an object name in it. - // If there is an object name in the shared data place that in the - // object attributs so that the constructed object has a local copy - // of the name - // - - if (0 == poa->sObjectName.GetStringLength() - && 0 != psmod->dwNameLength) - { - WCHAR *wsz; - - wsz = SHMPTR_TO_TYPED_PTR(WCHAR, psmod->shmObjName); - if (NULL != wsz) - { - poa->sObjectName.SetStringWithLength(wsz, psmod->dwNameLength); - } - else - { - ASSERT("Unable to map object name\n"); - palError = ERROR_INTERNAL_ERROR; - goto InitializeFromExistingSharedDataExit; - } - } -#if _DEBUG - else if (0 != psmod->dwNameLength) - { - WCHAR *wsz; - - // - // Verify that the names are consistent - // - - wsz = SHMPTR_TO_TYPED_PTR(WCHAR, psmod->shmObjName); - _ASSERTE(NULL != wsz); - _ASSERTE(0 == PAL_wcscmp(wsz, poa->sObjectName.GetString())); - } -#endif // debug - - palError = CPalObjectBase::Initialize(pthr, poa); - if (NO_ERROR != palError) - { - goto InitializeFromExistingSharedDataExit; - } - - if (NULL != psmod->shmObjImmutableData) - { - VOID *pv = SHMPTR_TO_TYPED_PTR(VOID, psmod->shmObjImmutableData); - if (NULL != pv) - { - memcpy(m_pvImmutableData, pv, m_pot->GetImmutableDataSize()); - if (NULL != psmod->pCopyRoutine) - { - (*psmod->pCopyRoutine)(pv, m_pvImmutableData); - } - - m_pot->SetImmutableDataCopyRoutine(psmod->pCopyRoutine); - m_pot->SetImmutableDataCleanupRoutine(psmod->pCleanupRoutine); - } - else - { - ASSERT("Unable to map object immutable data\n"); - palError = ERROR_INTERNAL_ERROR; - goto InitializeFromExistingSharedDataExit; - } - } - - if (NULL != psmod->shmObjSharedData) - { - m_pvSharedData = SHMPTR_TO_TYPED_PTR(VOID, psmod->shmObjSharedData); - if (NULL == m_pvSharedData) - { - ASSERT("Unable to map object shared data\n"); - palError = ERROR_INTERNAL_ERROR; - goto InitializeFromExistingSharedDataExit; - } - } - - if (NULL != m_pot->GetObjectInitRoutine()) - { - palError = (*m_pot->GetObjectInitRoutine())( - pthr, - m_pot, - m_pvImmutableData, - m_pvSharedData, - m_pvLocalData - ); - } - -InitializeFromExistingSharedDataExit: - - LOGEXIT("CSharedMemoryObject::InitializeFromExistingSharedData returns %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObject::AllocatedSharedDataItems - - Allocates and initialiazes the shared memory structures necessary to make an - object available to other processes - -Parameters: - pshmObjData -- on success, receives the shared memory pointer for the - shared memory object data - ppsmod -- on success, receives the locally-mapped pointer for the shared - memory object data ---*/ - -PAL_ERROR -CSharedMemoryObject::AllocateSharedDataItems( - SHMPTR *pshmObjData, - SHMObjData **ppsmod - ) -{ - PAL_ERROR palError = NO_ERROR; - SHMPTR shmod = NULL; - SHMObjData *psmod = NULL; - - _ASSERTE(NULL != pshmObjData); - _ASSERTE(NULL != ppsmod); - - ENTRY("CSharedMemoryObject::AllocateSharedDataItems" - "(this = %p, pshmObjData = %p, ppsmod = %p)\n", - this, - pshmObjData, - ppsmod - ); - - // - // We're about to make a number of shared memory allocations, - // so grab the lock for the entirety of the routine. - // - - SHMLock(); - - shmod = malloc(sizeof(SHMObjData)); - if (NULL == shmod) - { - ERROR("Unable to allocate m_shmod for new object\n"); - palError = ERROR_OUTOFMEMORY; - goto AllocateSharedDataItemsExit; - } - - psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, shmod); - _ASSERTE(NULL != psmod); - - ZeroMemory(psmod, sizeof(*psmod)); - - psmod->eTypeId = m_pot->GetId(); - psmod->lProcessRefCount = 1; - - if (0 != m_oa.sObjectName.GetStringLength()) - { - LPCWSTR str = m_oa.sObjectName.GetString(); - _ASSERTE(str); - - psmod->dwNameLength = m_oa.sObjectName.GetStringLength(); - - UINT length = (PAL_wcslen(str) + 1) * sizeof(WCHAR); - psmod->shmObjName = malloc(length); - - if (psmod->shmObjName != 0) - { - memcpy(psmod->shmObjName, str, length); - } - else - { - ERROR("Unable to allocate psmod->shmObjName for new object\n"); - palError = ERROR_OUTOFMEMORY; - goto AllocateSharedDataItemsExit; - } - } - - if (0 != m_pot->GetImmutableDataSize()) - { - // - // The shared copy of the object's immutable data will be initialized - // by CSharedMemoryObjectManager::RegisterObject or PromoteSharedData - // - - psmod->shmObjImmutableData = malloc(m_pot->GetImmutableDataSize()); - if (NULL == psmod->shmObjImmutableData) - { - ERROR("Unable to allocate psmod->shmObjImmutableData for new object\n"); - palError = ERROR_OUTOFMEMORY; - goto AllocateSharedDataItemsExit; - } - } - - if (0 != m_pot->GetSharedDataSize()) - { - psmod->shmObjSharedData = malloc(m_pot->GetSharedDataSize()); - if (NULL == psmod->shmObjSharedData) - { - ERROR("Unable to allocate psmod->shmObjSharedData for new object\n"); - palError = ERROR_OUTOFMEMORY; - goto AllocateSharedDataItemsExit; - } - } - - *pshmObjData = shmod; - *ppsmod = psmod; - -AllocateSharedDataItemsExit: - - if (NO_ERROR != palError && NULL != shmod) - { - FreeSharedDataAreas(shmod); - } - - SHMRelease(); - - LOGEXIT("CSharedMemoryObject::AllocateSharedDataItems returns %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObject::FreeSharedDataItems - - Frees the shared memory structures referenced by the provided shared - memory pointer - -Parameters: - shmObjData -- shared memory pointer to the structures to free ---*/ - -// static -void -CSharedMemoryObject::FreeSharedDataAreas( - SHMPTR shmObjData - ) -{ - SHMObjData *psmod; - - _ASSERTE(NULL != shmObjData); - - ENTRY("CSharedMemoryObject::FreeSharedDataAreas" - "(shmObjData = %p)\n", - shmObjData - ); - - SHMLock(); - - psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, shmObjData); - _ASSERTE(NULL != psmod); - - if (NULL != psmod->shmObjImmutableData) - { - if (NULL != psmod->pCleanupRoutine) - { - (*psmod->pCleanupRoutine)(psmod->shmObjImmutableData); - } - free(psmod->shmObjImmutableData); - } - - if (NULL != psmod->shmObjSharedData) - { - free(psmod->shmObjSharedData); - } - - if (NULL != psmod->shmObjName) - { - free(psmod->shmObjName); - } - - free(shmObjData); - - SHMRelease(); - - LOGEXIT("CSharedMemoryObject::FreeSharedDataAreas\n"); -} - -/*++ -Function: - CSharedMemoryObject::CleanupForProcessShutdown - - Cleanup routine called by the object manager when shutting down - -Parameters: - pthr -- thread data for the calling thread ---*/ - -void -CSharedMemoryObject::CleanupForProcessShutdown( - CPalThread *pthr - ) -{ - bool fCleanupSharedState; - - _ASSERTE(NULL != pthr); - - ENTRY("CSharedMemoryObject::CleanupForProcessShutdown" - "(this = %p, pthr = %p)\n", - this, - pthr - ); - - fCleanupSharedState = DereferenceSharedData(); - - if (NULL != m_pot->GetObjectCleanupRoutine()) - { - (*m_pot->GetObjectCleanupRoutine())( - pthr, - static_cast(this), - TRUE, - fCleanupSharedState - ); - } - - if (NULL != m_pot->GetImmutableDataCleanupRoutine()) - { - (*m_pot->GetImmutableDataCleanupRoutine())(m_pvImmutableData); - } - - if (NULL != m_pot->GetProcessLocalDataCleanupRoutine()) - { - (*m_pot->GetProcessLocalDataCleanupRoutine())(pthr, static_cast(this)); - } - - // - // We need to do two things with the calling thread data here: - // 1) store it in m_pthrCleanup so it is available to the destructors - // 2) Add a reference to it before starting any cleanup, and release - // that reference afterwords. - // - // Step 2 is necessary when we're cleaning up the thread object that - // represents the calling thread -- it ensures that the thread data - // is available throughout the entire cleanup process. - // - - m_pthrCleanup = pthr; - pthr->AddThreadReference(); - - InternalDelete(this); - - pthr->ReleaseThreadReference(); - - LOGEXIT("CSharedMemoryObject::CleanupForProcessShutdown\n"); -} - -/*++ -Function: - CSharedMemoryObject::AcquiteObjectDestructionLock - - Acquires the lock that must be held when decrementing the object's - reference count (and, if the count drops to 0, while removing the - object from the object manager's lists). - -Parameters: - pthr -- thread data for the calling thread ---*/ - -void -CSharedMemoryObject::AcquireObjectDestructionLock( - CPalThread *pthr - ) -{ - _ASSERTE(NULL != pthr); - - ENTRY("CSharedMemoryObject::AcquireObjectDestructionLock" - "(this = %p, pthr = $p)\n", - this, - pthr - ); - - InternalEnterCriticalSection(pthr, m_pcsObjListLock); - - LOGEXIT("CSharedMemoryObject::AcquireObjectDestructionLock\n"); -} - -/*++ -Function: - CSharedMemoryObject::ReleaseObjectDestructionLock - - Releases the lock acquired by AcquireObjectDestructionLock - -Parameters: - pthr -- thread data for the calling thread - fDestructionPending -- if TRUE, the reference count for this - object has dropped to 0; the object will be destroyed after - this routine returns ---*/ - -bool -CSharedMemoryObject::ReleaseObjectDestructionLock( - CPalThread *pthr, - bool fDestructionPending - ) -{ - bool fCleanupSharedState = FALSE; - - _ASSERTE(NULL != pthr); - - ENTRY("CSharedMemoryObject::ReleaseObjectDestructionLock" - "(this = %p, pthr = %p, fDestructionPending = %d\n", - this, - pthr, - fDestructionPending - ); - - if (fDestructionPending) - { - RemoveEntryList(&m_le); - fCleanupSharedState = DereferenceSharedData(); - } - - InternalLeaveCriticalSection(pthr, m_pcsObjListLock); - - LOGEXIT("CSharedMemoryObject::ReleaseObjectDestructionLock returns %d\n", - fCleanupSharedState - ); - - return fCleanupSharedState; -} - -/*++ -Function: - CSharedMemoryObject::DereferenceSharedData - - Called to decrement the global refcount (i.e., the count of - the number of processes that have reference to the object) when - the local reference to the object is being destroyed. - -Return value: - Returns TRUE if this process needs to clean up the object's shared - data (i.e., the global refcount has dropped to 0, or the object - is in the local domain) ---*/ - -bool -CSharedMemoryObject::DereferenceSharedData() -{ - LONG fSharedDataAlreadDereferenced; - - ENTRY("CSharedMemoryObject::DereferenceSharedData(this = %p)\n", this); - - fSharedDataAlreadDereferenced = InterlockedExchange( - &m_fSharedDataDereferenced, - TRUE - ); - - if (!fSharedDataAlreadDereferenced) - { - if (NULL != m_shmod) - { - SHMObjData *psmod; - - SHMLock(); - - psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, m_shmod); - _ASSERTE(NULL != psmod); - - psmod->lProcessRefCount -= 1; - if (0 == psmod->lProcessRefCount) - { - // - // No other process is using this object, so remove - // it from the shared memory named object list (if it - // had been added to it). The final cleanup will happen - // in the object's destructor - // - - m_fDeleteSharedData = TRUE; - - if (psmod->fAddedToList) - { - // - // This object better have a name... - // - - _ASSERTE(0 != psmod->dwNameLength); - - if (NULL != psmod->shmPrevObj) - { - SHMObjData *psmodPrevious = SHMPTR_TO_TYPED_PTR(SHMObjData, psmod->shmPrevObj); - _ASSERTE(NULL != psmodPrevious); - - psmodPrevious->shmNextObj = psmod->shmNextObj; - } - else - { - // - // This object is the head of the shared memory named object - // list -- reset that pointer now - // - - if (!SHMSetInfo(SIID_NAMED_OBJECTS, psmod->shmNextObj)) - { - ASSERT("Failed to set shared named object list head"); - } - } - - if (NULL != psmod->shmNextObj) - { - SHMObjData *psmodNext = SHMPTR_TO_TYPED_PTR(SHMObjData, psmod->shmNextObj); - _ASSERTE(NULL != psmodNext); - - psmodNext->shmPrevObj = psmod->shmPrevObj; - } - } -#if _DEBUG - else - { - _ASSERTE(NULL == psmod->shmPrevObj); - _ASSERTE(NULL == psmod->shmNextObj); - } -#endif - } - - SHMRelease(); - } - else if (ProcessLocalObject == m_ObjectDomain) - { - // - // If the object is local the shared data needs to be - // deleted by definition - // - - m_fDeleteSharedData = TRUE; - } - } - else - { - ASSERT("Multiple calls to DereferenceSharedData\n"); - } - - LOGEXIT("CSharedMemoryObject::DereferenceSharedData returns %d\n", - m_fDeleteSharedData - ); - - return m_fDeleteSharedData; -} - -/*++ -Function: - CSharedMemoryObject::~CSharedMemoryObject - - Destructor; should only be called from ReleaseReference ---*/ - -CSharedMemoryObject::~CSharedMemoryObject() -{ - ENTRY("CSharedMemoryObject::~CSharedMemoryObject(this = %p)\n", this); - - if (!m_fSharedDataDereferenced) - { - ASSERT("DereferenceSharedData not called before object destructor -- delete called directly?\n"); - DereferenceSharedData(); - } - - if (NULL != m_pvSharedData && ProcessLocalObject == m_ObjectDomain) - { - free(m_pvSharedData); - } - else if (NULL != m_shmod && m_fDeleteSharedData) - { - FreeSharedDataAreas(m_shmod); - } - - LOGEXIT("CSharedMemoryObject::~CSharedMemoryObject\n"); -} - -/*++ -Function: - CSharedMemoryObject::GetObjectFromListLink - - Given a list link returns the object that contains it. Since m_le is - protected the caller cannot perform this computation directly - -Parameters: - ple -- the list entry to obtain the object for ---*/ - -// static -CSharedMemoryObject* -CSharedMemoryObject::GetObjectFromListLink(PLIST_ENTRY ple) -{ - CSharedMemoryObject *pshmo; - - _ASSERTE(NULL != ple); - - ENTRY("CSharedMemoryObject::GetObjectFromListLink(ple = %p)\n", ple); - - // - // Ideally we'd use CONTAINING_RECORD here, but it uses offsetof (see above - // comment - // - - pshmo = reinterpret_cast( - reinterpret_cast(ple) - offsetof(CSharedMemoryObject, m_le) - ); - - _ASSERTE(ple == &pshmo->m_le); - - LOGEXIT("CSharedMemoryObject::GetObjectFromListLink returns %p\n", pshmo); - - return pshmo; -} - -/*++ -Function: - CSharedMemoryObject::GetSharedData - - Provides the caller access to the object's shared data (if any) - -Parameters: - pthr -- thread data for calling thread - eLockRequest -- specifies if the caller desires a read lock or a - write lock on the data (currently ignored) - ppDataLock -- on success, receives a pointer to the data lock instance - for the shared data - ppvProcssSharedData -- on success, receives a pointer to the shared data ---*/ - -PAL_ERROR -CSharedMemoryObject::GetSharedData( - CPalThread *pthr, - LockType eLockRequest, - IDataLock **ppDataLock, // OUT - void **ppvSharedData // OUT - ) -{ - IDataLock *pDataLock; - - _ASSERTE(NULL != pthr); - _ASSERTE(ReadLock == eLockRequest || WriteLock == eLockRequest); - _ASSERTE(NULL != ppDataLock); - _ASSERTE(NULL != ppvSharedData); - - ENTRY("CSharedMemoryObject::GetSharedData" - "(this = %p, pthr = %p, eLockRequest = %d, ppDataLock = %p," - " ppvSharedData = %p)\n", - this, - pthr, - eLockRequest, - ppDataLock, - ppvSharedData - ); - - _ASSERTE(0 < m_pot->GetSharedDataSize()); - - if (ProcessLocalObject == m_ObjectDomain) - { - // - // We need to grab the local shared data lock and re-check - // the object's domain, as there's a chance the object might - // have been promoted after we made the above check but before - // we grabbed the lock - // - - m_sdlSharedData.AcquireLock(pthr, &pDataLock); - - if (SharedObject == m_ObjectDomain) - { - pDataLock->ReleaseLock(pthr, FALSE); - m_ssmlSharedData.AcquireLock(pthr, &pDataLock); - } - } - else - { - // - // A shared object can never transition back to local, - // so there's no need to recheck the domain on this path - // - - m_ssmlSharedData.AcquireLock(pthr, &pDataLock); - } - - *ppDataLock = pDataLock; - *ppvSharedData = m_pvSharedData; - - LOGEXIT("CSharedMemoryObject::GetSharedData returns %d\n", NO_ERROR); - - return NO_ERROR; -} - -/*++ -Function: - CSharedMemoryObject::GetSynchStateController - - Obtain a synchronization state controller for this object. Should - never be called. - -Parameters: - pthr -- thread data for calling thread - ppStateController -- on success, receives a pointer to the state controller - instance ---*/ - -PAL_ERROR -CSharedMemoryObject::GetSynchStateController( - CPalThread *pthr, - ISynchStateController **ppStateController // OUT - ) -{ - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != ppStateController); - - // - // This is not a waitable object! - // - - ASSERT("Attempt to obtain a synch state controller on a non-waitable object\n"); - return ERROR_INVALID_HANDLE; -} - -/*++ -Function: - CSharedMemoryObject::GetSynchWaitController - - Obtain a synchronization wait controller for this object. Should - never be called. - -Parameters: - pthr -- thread data for calling thread - ppWaitController -- on success, receives a pointer to the wait controller - instance ---*/ - -PAL_ERROR -CSharedMemoryObject::GetSynchWaitController( - CPalThread *pthr, - ISynchWaitController **ppWaitController // OUT - ) -{ - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != ppWaitController); - - // - // This is not a waitable object!!! - // - - ASSERT("Attempt to obtain a synch wait controller on a non-waitable object\n"); - return ERROR_INVALID_HANDLE; -} - -/*++ -Function: - CSharedMemoryObject::GetObjectDomain - - Returns the object's domain (local or shared) - ---*/ - -ObjectDomain -CSharedMemoryObject::GetObjectDomain( - void - ) -{ - TRACE("CSharedMemoryObject::GetObjectDomain(this = %p)\n", this); - LOGEXIT("CSharedMemoryObject::GetObjectDomain returns %d\n", m_ObjectDomain); - - return m_ObjectDomain; -} - -/*++ -Function: - CSharedMemoryObject::GetObjectSynchData - - Obtain the synchronization data for this object. Should - never be called. - -Parameters: - ppvSynchData -- on success, receives a pointer to the object's synch data ---*/ - -PAL_ERROR -CSharedMemoryObject::GetObjectSynchData( - VOID **ppvSynchData // OUT - ) -{ - _ASSERTE(NULL != ppvSynchData); - - // - // This is not a waitable object!!! - // - - ASSERT("Attempt to obtain a synch data for a non-waitable object\n"); - return ERROR_INVALID_HANDLE; -} - -/*++ -Function: - CSharedMemoryWaitableObject::Initialize - - Performs possibly-failing initialization for a newly-constructed - object - -Parameters: - pthr -- thread data for calling thread - poa -- the object attributes (e.g., name) for the object ---*/ - -PAL_ERROR -CSharedMemoryWaitableObject::Initialize( - CPalThread *pthr, - CObjectAttributes *poa - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != poa); - - ENTRY("CSharedMemoryWaitableObject::Initialize" - "(this = %p, pthr = %p, poa = %p)\n", - this, - pthr, - poa - ); - - palError = CSharedMemoryObject::Initialize(pthr, poa); - if (NO_ERROR != palError) - { - goto InitializeExit; - } - - // - // Sanity check the passed in object type - // - - _ASSERTE(CObjectType::WaitableObject == m_pot->GetSynchronizationSupport()); - - palError = g_pSynchronizationManager->AllocateObjectSynchData( - m_pot, - m_ObjectDomain, - &m_pvSynchData - ); - - if (NO_ERROR == palError && SharedObject == m_ObjectDomain) - { - SHMObjData *pshmod = SHMPTR_TO_TYPED_PTR(SHMObjData, m_shmod); - _ASSERTE(NULL != pshmod); - - pshmod->pvSynchData = m_pvSynchData; - } - -InitializeExit: - - LOGEXIT("CSharedMemoryWaitableObject::Initialize returns %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryWaitableObject::~CSharedMemoryWaitableObject - - Destructor; should only be called from ReleaseReference ---*/ - -CSharedMemoryWaitableObject::~CSharedMemoryWaitableObject() -{ - ENTRY("CSharedMemoryWaitableObject::~CSharedMemoryWaitableObject" - "(this = %p)\n", - this - ); - - if (!m_fSharedDataDereferenced) - { - ASSERT("DereferenceSharedData not called before object destructor -- delete called directly?\n"); - DereferenceSharedData(); - } - - if (NULL != m_pvSynchData && m_fDeleteSharedData) - { - g_pSynchronizationManager->FreeObjectSynchData( - m_pot, - m_ObjectDomain, - m_pvSynchData - ); - } - - LOGEXIT("CSharedMemoryWaitableObject::~CSharedMemoryWaitableObject\n"); -} - -/*++ -Function: - CSharedMemoryWaitableObject::GetSynchStateController - - Obtain a synchronization state controller for this object. - -Parameters: - pthr -- thread data for calling thread - ppStateController -- on success, receives a pointer to the state controller - instance ---*/ - -PAL_ERROR -CSharedMemoryWaitableObject::GetSynchStateController( - CPalThread *pthr, // IN, OPTIONAL - ISynchStateController **ppStateController // OUT - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != ppStateController); - - ENTRY("CSharedMemoryWaitableObject::GetSynchStateController" - "(this = %p, pthr = %p, ppStateController = %p", - this, - pthr, - ppStateController - ); - - // - // We need to grab the local synch lock before creating the controller - // (otherwise we could get promoted after passing in our parameters) - // - - g_pSynchronizationManager->AcquireProcessLock(pthr); - - palError = g_pSynchronizationManager->CreateSynchStateController( - pthr, - m_pot, - m_pvSynchData, - m_ObjectDomain, - ppStateController - ); - - g_pSynchronizationManager->ReleaseProcessLock(pthr); - - LOGEXIT("CSharedMemoryWaitableObject::GetSynchStateController returns %d\n", - palError - ); - - return palError; -} - -/*++ -Function: - CSharedMemoryWaitableObject::GetSynchWaitController - - Obtain a synchronization wait controller for this object. - -Parameters: - pthr -- thread data for calling thread - ppWaitController -- on success, receives a pointer to the wait controller - instance ---*/ - -PAL_ERROR -CSharedMemoryWaitableObject::GetSynchWaitController( - CPalThread *pthr, // IN, OPTIONAL - ISynchWaitController **ppWaitController // OUT - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != ppWaitController); - - ENTRY("CSharedMemoryWaitableObject::GetSynchWaitController" - "(this = %p, pthr = %p, ppWaitController = %p", - this, - pthr, - ppWaitController - ); - - // - // We need to grab the local synch lock before creating the controller - // (otherwise we could get promoted after passing in our parameters) - // - - g_pSynchronizationManager->AcquireProcessLock(pthr); - - palError = g_pSynchronizationManager->CreateSynchWaitController( - pthr, - m_pot, - m_pvSynchData, - m_ObjectDomain, - ppWaitController - ); - - g_pSynchronizationManager->ReleaseProcessLock(pthr); - - LOGEXIT("CSharedMemoryWaitableObject::GetSynchWaitController returns %d\n", - palError - ); - - return palError; -} - -/*++ -Function: - CSharedMemoryWaitableObject::GetObjectSynchData - - Obtain the synchronization data for this object. This method should only - be called by the synchronization manager - -Parameters: - ppvSynchData -- on success, receives a pointer to the object's synch data ---*/ - -PAL_ERROR -CSharedMemoryWaitableObject::GetObjectSynchData( - VOID **ppvSynchData // OUT - ) -{ - _ASSERTE(NULL != ppvSynchData); - - ENTRY("CSharedMemoryWaitableObject::GetObjectSynchData" - "(this = %p, ppvSynchData = %p)\n", - this, - ppvSynchData - ); - - *ppvSynchData = m_pvSynchData; - - LOGEXIT("CSharedMemoryWaitableObject::GetObjectSynchData returns %d\n", - NO_ERROR - ); - - return NO_ERROR; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobject.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobject.hpp deleted file mode 100644 index f50d10e0b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobject.hpp +++ /dev/null @@ -1,374 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - shmobject.hpp - -Abstract: - Shared memory based object - - - ---*/ - -#ifndef _PAL_SHMOBJECT_HPP -#define _PAL_SHMOBJECT_HPP - -#include "palobjbase.hpp" -#include "pal/shm.hpp" - -extern "C" -{ -#include "pal/list.h" -} - -namespace CorUnix -{ - class CSimpleSharedMemoryLock : public IDataLock - { - public: - - void - AcquireLock( - CPalThread *pthr, - IDataLock **ppDataLock - ) - { - SHMLock(); - *ppDataLock = static_cast(this); - }; - - virtual - void - ReleaseLock( - CPalThread *pthr, - bool fDataChanged - ) - { - SHMRelease(); - }; - }; - - typedef struct _SHMObjData - { - SHMPTR shmPrevObj; - SHMPTR shmNextObj; - BOOL fAddedToList; - - SHMPTR shmObjName; - SHMPTR shmObjImmutableData; - SHMPTR shmObjSharedData; - - OBJECT_IMMUTABLE_DATA_COPY_ROUTINE pCopyRoutine; - OBJECT_IMMUTABLE_DATA_CLEANUP_ROUTINE pCleanupRoutine; - - LONG lProcessRefCount; - DWORD dwNameLength; - - PalObjectTypeId eTypeId; - - PVOID pvSynchData; - } SHMObjData; - - class CSharedMemoryObject : public CPalObjectBase - { - template friend void InternalDelete(T *p); - - protected: - - // - // Entry on the process's named or anonymous object list - // - - LIST_ENTRY m_le; - - // - // The lock that guards access to that list - // - - CRITICAL_SECTION *m_pcsObjListLock; - - // - // The SHMObjData for this object, protected by the - // shared memory lock. - // - - SHMPTR m_shmod; - - // - // The shared data (i.e., m_shmObjData->shmObjSharedData) - // for this object, mapped into this process. This will be - // NULL if m_pot->dwSharedDataSize is 0. Access to this data - // is controlled by m_ssmlSharedData when m_ObjectDomain is - // SharedObject, and m_sdlSharedData when it is ProcessLocalObject. - // - - VOID *m_pvSharedData; - - CSimpleSharedMemoryLock m_ssmlSharedData; - CSimpleDataLock m_sdlSharedData; - - // - // Is this object process local or shared? - // - - ObjectDomain m_ObjectDomain; - - // - // m_fSharedDataDereferenced will be TRUE if DereferenceSharedData - // has already been called. (N.B. -- this is a LONG instead of a bool - // because it is passed to InterlockedExchange). If the shared data blob - // should be freed in the object's destructor DereferenceSharedData will - // set m_fDeleteSharedData to TRUE. - // - - LONG m_fSharedDataDereferenced; - LONG m_fDeleteSharedData; - - PAL_ERROR - AllocateSharedDataItems( - SHMPTR *pshmObjData, - SHMObjData **ppsmod - ); - - static - void - FreeSharedDataAreas( - SHMPTR shmObjData - ); - - bool - DereferenceSharedData(); - - virtual - void - AcquireObjectDestructionLock( - CPalThread *pthr - ); - - virtual - bool - ReleaseObjectDestructionLock( - CPalThread *pthr, - bool fDestructionPending - ); - - virtual ~CSharedMemoryObject(); - - public: - - // - // Constructor used for new object - // - - CSharedMemoryObject( - CObjectType *pot, - CRITICAL_SECTION *pcsObjListLock - ) - : - CPalObjectBase(pot), - m_pcsObjListLock(pcsObjListLock), - m_shmod(NULL), - m_pvSharedData(NULL), - m_ObjectDomain(ProcessLocalObject), - m_fSharedDataDereferenced(FALSE), - m_fDeleteSharedData(FALSE) - { - InitializeListHead(&m_le); - }; - - // - // Constructor used to import a shared object into this process. The - // shared memory lock must be held when calling this contstructor - // - - CSharedMemoryObject( - CObjectType *pot, - CRITICAL_SECTION *pcsObjListLock, - SHMPTR shmSharedObjectData, - SHMObjData *psmod, - bool fAddRefSharedData - ) - : - CPalObjectBase(pot), - m_pcsObjListLock(pcsObjListLock), - m_shmod(shmSharedObjectData), - m_pvSharedData(NULL), - m_ObjectDomain(SharedObject), - m_fSharedDataDereferenced(FALSE), - m_fDeleteSharedData(FALSE) - { - InitializeListHead(&m_le); - if (fAddRefSharedData) - { - psmod->lProcessRefCount += 1; - } - }; - - virtual - PAL_ERROR - Initialize( - CPalThread *pthr, - CObjectAttributes *poa - ); - - virtual - PAL_ERROR - InitializeFromExistingSharedData( - CPalThread *pthr, - CObjectAttributes *poa - ); - - void - CleanupForProcessShutdown( - CPalThread *pthr - ); - - SHMPTR - GetShmObjData( - void - ) - { - return m_shmod; - }; - - PLIST_ENTRY - GetObjectListLink( - void - ) - { - return &m_le; - } - - // - // Clients of this object -- in particular, CSharedMemoryObjectManager - // -- can't use CONTAINING_RECORD directly, since they don't have - // access to m_Link. - // - - static - CSharedMemoryObject* - GetObjectFromListLink(PLIST_ENTRY pLink); - - // - // IPalObject routines - // - - virtual - PAL_ERROR - GetSharedData( - CPalThread *pthr, - LockType eLockRequest, - IDataLock **ppDataLock, - void **ppvSharedData - ); - - virtual - PAL_ERROR - GetSynchStateController( - CPalThread *pthr, - ISynchStateController **ppStateController - ); - - virtual - PAL_ERROR - GetSynchWaitController( - CPalThread *pthr, - ISynchWaitController **ppWaitController - ); - - virtual - ObjectDomain - GetObjectDomain( - void - ); - - virtual - PAL_ERROR - GetObjectSynchData( - VOID **ppvSynchData - ); - - }; - - class CSharedMemoryWaitableObject : public CSharedMemoryObject - { - template friend void InternalDelete(T *p); - - protected: - - VOID *m_pvSynchData; - - virtual ~CSharedMemoryWaitableObject(); - - public: - - CSharedMemoryWaitableObject( - CObjectType *pot, - CRITICAL_SECTION *pcsObjListLock - ) - : - CSharedMemoryObject(pot, pcsObjListLock), - m_pvSynchData(NULL) - { - }; - - // - // Constructor used to import a shared object into this process. The - // shared memory lock must be held when calling this contstructor - // - - CSharedMemoryWaitableObject( - CObjectType *pot, - CRITICAL_SECTION *pcsObjListLock, - SHMPTR shmSharedObjectData, - SHMObjData *psmod, - bool fAddRefSharedData - ) - : - CSharedMemoryObject(pot, pcsObjListLock, shmSharedObjectData, psmod, fAddRefSharedData), - m_pvSynchData(psmod->pvSynchData) - { - }; - - virtual - PAL_ERROR - Initialize( - CPalThread *pthr, - CObjectAttributes *poa - ); - - // - // IPalObject routines - // - - virtual - PAL_ERROR - GetSynchStateController( - CPalThread *pthr, - ISynchStateController **ppStateController - ); - - virtual - PAL_ERROR - GetSynchWaitController( - CPalThread *pthr, - ISynchWaitController **ppWaitController - ); - - virtual - PAL_ERROR - GetObjectSynchData( - VOID **ppvSynchData - ); - }; - -} - -#endif // _PAL_SHMOBJECT_HPP - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobjectmanager.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobjectmanager.cpp deleted file mode 100644 index ca960617d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobjectmanager.cpp +++ /dev/null @@ -1,1129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - shmobjectmgr.cpp - -Abstract: - Shared memory based object manager - - - ---*/ - -#include "shmobjectmanager.hpp" -#include "shmobject.hpp" -#include "pal/cs.hpp" -#include "pal/thread.hpp" -#include "pal/procobj.hpp" -#include "pal/dbgmsg.h" - -SET_DEFAULT_DEBUG_CHANNEL(PAL); - -#include "pal/corunix.inl" - -using namespace CorUnix; - -IPalObjectManager * CorUnix::g_pObjectManager; - -static -PAL_ERROR -CheckObjectTypeAndRights( - IPalObject *pobj, - CAllowedObjectTypes *paot - ); - -/*++ -Function: - CSharedMemoryObjectManager::Initialize - - Performs (possibly failing) startup tasks for the object manager - -Parameters: - None ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::Initialize( - void - ) -{ - PAL_ERROR palError = NO_ERROR; - - ENTRY("CSharedMemoryObjectManager::Initialize (this=%p)\n", this); - - InitializeListHead(&m_leNamedObjects); - InitializeListHead(&m_leAnonymousObjects); - - InternalInitializeCriticalSection(&m_csListLock); - m_fListLockInitialized = TRUE; - - palError = m_HandleManager.Initialize(); - - LOGEXIT("CSharedMemoryObjectManager::Initialize returns %d", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::Shutdown - - Cleans up the object manager. This routine will call cleanup routines - for all objects referenced by this process. After this routine is called - no attempt should be made to access an IPalObject. - -Parameters: - pthr -- thread data for calling thread ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::Shutdown( - CPalThread *pthr - ) -{ - PLIST_ENTRY ple; - CSharedMemoryObject *pshmobj; - - _ASSERTE(NULL != pthr); - - ENTRY("CSharedMemoryObjectManager::Shutdown (this=%p, pthr=%p)\n", - this, - pthr - ); - - InternalEnterCriticalSection(pthr, &m_csListLock); - SHMLock(); - - while (!IsListEmpty(&m_leAnonymousObjects)) - { - ple = RemoveTailList(&m_leAnonymousObjects); - pshmobj = CSharedMemoryObject::GetObjectFromListLink(ple); - pshmobj->CleanupForProcessShutdown(pthr); - } - - while (!IsListEmpty(&m_leNamedObjects)) - { - ple = RemoveTailList(&m_leNamedObjects); - pshmobj = CSharedMemoryObject::GetObjectFromListLink(ple); - pshmobj->CleanupForProcessShutdown(pthr); - } - - SHMRelease(); - InternalLeaveCriticalSection(pthr, &m_csListLock); - - LOGEXIT("CSharedMemoryObjectManager::Shutdown returns %d\n", NO_ERROR); - - return NO_ERROR; -} - -/*++ -Function: - CSharedMemoryObjectManager::AllocateObject - - Allocates a new object instance of the specified type. - -Parameters: - pthr -- thread data for calling thread - pot -- type of object to allocate - poa -- attributes (name and SD) of object to allocate - ppobjNew -- on success, receives a reference to the new object ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::AllocateObject( - CPalThread *pthr, - CObjectType *pot, - CObjectAttributes *poa, - IPalObject **ppobjNew // OUT - ) -{ - PAL_ERROR palError = NO_ERROR; - CSharedMemoryObject *pshmobj = NULL; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != pot); - _ASSERTE(NULL != poa); - _ASSERTE(NULL != ppobjNew); - - ENTRY("CSharedMemoryObjectManager::AllocateObject " - "(this=%p, pthr=%p, pot=%p, poa=%p, ppobjNew=%p)\n", - this, - pthr, - pot, - poa, - ppobjNew - ); - - if (CObjectType::WaitableObject == pot->GetSynchronizationSupport()) - { - pshmobj = InternalNew(pot, &m_csListLock); - } - else - { - pshmobj = InternalNew(pot, &m_csListLock); - } - - if (NULL != pshmobj) - { - palError = pshmobj->Initialize(pthr, poa); - if (NO_ERROR == palError) - { - *ppobjNew = static_cast(pshmobj); - } - } - else - { - ERROR("Unable to allocate pshmobj\n"); - palError = ERROR_OUTOFMEMORY; - } - - LOGEXIT("CSharedMemoryObjectManager::AllocateObject returns %d\n", palError); - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::RegisterObject - - Registers a newly-allocated object instance. If the object to be registered - has a name, and a previously registered object has the same name the new - object will not be registered. - -Distinguished return values: - ERROR_ALREADY_EXISTS -- an object of a compatible type was already registered - with the specified name - ERROR_INVALID_HANDLE -- an object of an incompatible type was already - registered with the specified name - -Parameters: - pthr -- thread data for calling thread - pobjToRegister -- the object instance to register. This routine will always - call ReleaseReference on this instance - paot -- object types that are compatible with the new object instance - pHandle -- on success, receives a handle to the registered object - ppobjRegistered -- on success, receives a reference to the registered object - instance. ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::RegisterObject( - CPalThread *pthr, - IPalObject *pobjToRegister, - CAllowedObjectTypes *paot, - HANDLE *pHandle, // OUT - IPalObject **ppobjRegistered // OUT - ) -{ - PAL_ERROR palError = NO_ERROR; - CSharedMemoryObject *pshmobj = static_cast(pobjToRegister); - SHMObjData *psmodNew = NULL; - CObjectAttributes *poa; - CObjectType *potObj; - IPalObject *pobjExisting; - BOOL fShared = FALSE; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != pobjToRegister); - _ASSERTE(NULL != paot); - _ASSERTE(NULL != pHandle); - _ASSERTE(NULL != ppobjRegistered); - - ENTRY("CSharedMemoryObjectManager::RegisterObject " - "(this=%p, pthr=%p, pobjToRegister=%p, paot=%p, " - "pHandle=%p, ppobjRegistered=%p)\n", - this, - pthr, - pobjToRegister, - paot, - pHandle, - ppobjRegistered - ); - - poa = pobjToRegister->GetObjectAttributes(); - _ASSERTE(NULL != poa); - - potObj = pobjToRegister->GetObjectType(); - fShared = (SharedObject == pshmobj->GetObjectDomain()); - - InternalEnterCriticalSection(pthr, &m_csListLock); - - if (fShared) - { - // - // We only need to acquire the shared memory lock if this - // object is actually shared. - // - - SHMLock(); - } - - if (0 != poa->sObjectName.GetStringLength()) - { - SHMPTR shmObjectListHead = NULL; - - // - // The object must be shared - // - - _ASSERTE(fShared); - - // - // Check if an object by this name already exists - // - - palError = LocateObject( - pthr, - &poa->sObjectName, - paot, - &pobjExisting - ); - - if (NO_ERROR == palError) - { - // - // Obtain a new handle to the existing object - // - - palError = ObtainHandleForObject( - pthr, - pobjExisting, - pHandle - ); - - if (NO_ERROR == palError) - { - // - // Transfer object reference to out param - // - - *ppobjRegistered = pobjExisting; - palError = ERROR_ALREADY_EXISTS; - } - else - { - pobjExisting->ReleaseReference(pthr); - } - - goto RegisterObjectExit; - } - else if (ERROR_INVALID_NAME != palError) - { - // - // Something different than an object not found error - // occurred. This is most likely due to a type conflict. - // - - goto RegisterObjectExit; - } - - // - // Insert the object on the named object lists - // - - InsertTailList(&m_leNamedObjects, pshmobj->GetObjectListLink()); - - psmodNew = SHMPTR_TO_TYPED_PTR(SHMObjData, pshmobj->GetShmObjData()); - if (NULL == psmodNew) - { - ASSERT("Failure to map shared object data\n"); - palError = ERROR_INTERNAL_ERROR; - goto RegisterObjectExit; - } - - shmObjectListHead = SHMGetInfo(SIID_NAMED_OBJECTS); - if (NULL != shmObjectListHead) - { - SHMObjData *psmodListHead; - - psmodListHead = SHMPTR_TO_TYPED_PTR(SHMObjData, shmObjectListHead); - if (NULL != psmodListHead) - { - psmodNew->shmNextObj = shmObjectListHead; - psmodListHead->shmPrevObj = pshmobj->GetShmObjData(); - } - else - { - ASSERT("Failure to map shared object data\n"); - palError = ERROR_INTERNAL_ERROR; - goto RegisterObjectExit; - } - } - - psmodNew->fAddedToList = TRUE; - - if (!SHMSetInfo(SIID_NAMED_OBJECTS, pshmobj->GetShmObjData())) - { - ASSERT("Failed to set shared named object list head\n"); - palError = ERROR_INTERNAL_ERROR; - goto RegisterObjectExit; - } - } - else - { - // - // Place the object on the anonymous object list - // - - InsertTailList(&m_leAnonymousObjects, pshmobj->GetObjectListLink()); - } - - // - // Hoist the object's immutable data (if any) into shared memory if - // the object is shared - // - - if (fShared && 0 != potObj->GetImmutableDataSize()) - { - VOID *pvImmutableData; - SHMObjData *psmod; - - palError = pobjToRegister->GetImmutableData(&pvImmutableData); - if (NO_ERROR != palError) - { - ASSERT("Failure to obtain object immutable data\n"); - goto RegisterObjectExit; - } - - psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, pshmobj->GetShmObjData()); - if (NULL != psmod) - { - VOID *pvSharedImmutableData = - SHMPTR_TO_TYPED_PTR(VOID, psmod->shmObjImmutableData); - - if (NULL != pvSharedImmutableData) - { - CopyMemory( - pvSharedImmutableData, - pvImmutableData, - potObj->GetImmutableDataSize() - ); - - if (NULL != potObj->GetImmutableDataCopyRoutine()) - { - (*potObj->GetImmutableDataCopyRoutine())(pvImmutableData, pvSharedImmutableData); - } - - psmod->pCopyRoutine = potObj->GetImmutableDataCopyRoutine(); - psmod->pCleanupRoutine = potObj->GetImmutableDataCleanupRoutine(); - } - else - { - ASSERT("Failure to map psmod->shmObjImmutableData\n"); - palError = ERROR_INTERNAL_ERROR; - goto RegisterObjectExit; - } - } - else - { - ASSERT("Failure to map pshmobj->GetShmObjData()\n"); - palError = ERROR_INTERNAL_ERROR; - goto RegisterObjectExit; - } - } - - // - // Obtain a handle for the new object - // - - palError = ObtainHandleForObject( - pthr, - pobjToRegister, - pHandle - ); - - if (NO_ERROR == palError) - { - // - // Transfer pobjToRegister reference to out param - // - - *ppobjRegistered = pobjToRegister; - pobjToRegister = NULL; - } - -RegisterObjectExit: - - if (fShared) - { - SHMRelease(); - } - - InternalLeaveCriticalSection(pthr, &m_csListLock); - - if (NULL != pobjToRegister) - { - pobjToRegister->ReleaseReference(pthr); - } - - LOGEXIT("CSharedMemoryObjectManager::RegisterObject return %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::LocateObject - - Search for a previously registered object with a give name and type - -Distinguished return values: - ERROR_INVALID_NAME -- no object with the specified name was previously - registered - ERROR_INVALID_HANDLE -- an object with the specified name was previously - registered, but its type is not compatible - -Parameters: - pthr -- thread data for calling thread - psObjectToLocate -- the name of the object to locate - paot -- acceptable types for the object - ppobj -- on success, receives a reference to the object instance ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::LocateObject( - CPalThread *pthr, - CPalString *psObjectToLocate, - CAllowedObjectTypes *paot, - IPalObject **ppobj // OUT - ) -{ - PAL_ERROR palError = NO_ERROR; - IPalObject *pobjExisting = NULL; - SHMPTR shmSharedObjectData = NULL; - SHMPTR shmObjectListEntry = NULL; - SHMObjData *psmod = NULL; - LPWSTR pwsz = NULL; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != psObjectToLocate); - _ASSERTE(NULL != psObjectToLocate->GetString()); - _ASSERTE(PAL_wcslen(psObjectToLocate->GetString()) == psObjectToLocate->GetStringLength()); - _ASSERTE(NULL != ppobj); - - ENTRY("CSharedMemoryObjectManager::LocateObject " - "(this=%p, pthr=%p, psObjectToLocate=%p, paot=%p, " - "ppobj=%p)\n", - this, - pthr, - psObjectToLocate, - paot, - ppobj - ); - - TRACE("Searching for object name %S\n", psObjectToLocate->GetString()); - - InternalEnterCriticalSection(pthr, &m_csListLock); - - // - // Search the local named object list for this object - // - - for (PLIST_ENTRY ple = m_leNamedObjects.Flink; - ple != &m_leNamedObjects; - ple = ple->Flink) - { - CObjectAttributes *poa; - CSharedMemoryObject *pshmobj = - CSharedMemoryObject::GetObjectFromListLink(ple); - - poa = pshmobj->GetObjectAttributes(); - _ASSERTE(NULL != poa); - - if (poa->sObjectName.GetStringLength() != psObjectToLocate->GetStringLength()) - { - continue; - } - - if (0 != PAL_wcscmp(poa->sObjectName.GetString(), psObjectToLocate->GetString())) - { - continue; - } - - // - // This object has the name we're looking for - // - - pobjExisting = static_cast(pshmobj); - break; - } - - if (NULL != pobjExisting) - { - // - // Validate the located object's type - // - - if (paot->IsTypeAllowed( - pobjExisting->GetObjectType()->GetId() - )) - { - TRACE("Local object exists with compatible type\n"); - - // - // Add a reference to the found object - // - - pobjExisting->AddReference(); - *ppobj = pobjExisting; - } - else - { - TRACE("Local object exists w/ incompatible type\n"); - palError = ERROR_INVALID_HANDLE; - } - - goto LocateObjectExit; - } - - // - // Search the shared memory named object list for a matching object - // - - SHMLock(); - - shmObjectListEntry = SHMGetInfo(SIID_NAMED_OBJECTS); - while (NULL != shmObjectListEntry) - { - psmod = SHMPTR_TO_TYPED_PTR(SHMObjData, shmObjectListEntry); - if (NULL != psmod) - { - if (psmod->dwNameLength == psObjectToLocate->GetStringLength()) - { - pwsz = SHMPTR_TO_TYPED_PTR(WCHAR, psmod->shmObjName); - if (NULL != pwsz) - { - if (0 == PAL_wcscmp(pwsz, psObjectToLocate->GetString())) - { - // - // This is the object we were looking for. - // - - shmSharedObjectData = shmObjectListEntry; - break; - } - } - else - { - ASSERT("Unable to map psmod->shmObjName\n"); - break; - } - } - - shmObjectListEntry = psmod->shmNextObj; - } - else - { - ASSERT("Unable to map shmObjectListEntry\n"); - break; - } - } - - if (NULL != shmSharedObjectData) - { - CSharedMemoryObject *pshmobj = NULL; - CObjectAttributes oa(pwsz, NULL); - - // - // Check if the type is allowed - // - - if (!paot->IsTypeAllowed(psmod->eTypeId)) - { - TRACE("Remote object exists w/ incompatible type\n"); - palError = ERROR_INVALID_HANDLE; - goto LocateObjectExitSHMRelease; - } - - // - // Get the local instance of the CObjectType - // - - CObjectType *pot = CObjectType::GetObjectTypeById(psmod->eTypeId); - if (NULL == pot) - { - ASSERT("Invalid object type ID in shared memory info\n"); - goto LocateObjectExitSHMRelease; - } - - TRACE("Remote object exists compatible type -- importing\n"); - - // - // Create the local state for the shared object - // - - palError = ImportSharedObjectIntoProcess( - pthr, - pot, - &oa, - shmSharedObjectData, - psmod, - TRUE, - &pshmobj - ); - - if (NO_ERROR == palError) - { - *ppobj = static_cast(pshmobj); - } - else - { - ERROR("Failure initializing object from shared data\n"); - goto LocateObjectExitSHMRelease; - } - - } - else - { - // - // The object was not found - // - - palError = ERROR_INVALID_NAME; - } - -LocateObjectExitSHMRelease: - - SHMRelease(); - -LocateObjectExit: - - InternalLeaveCriticalSection(pthr, &m_csListLock); - - LOGEXIT("CSharedMemoryObjectManager::LocateObject returns %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::ObtainHandleForObject - - Allocated a new handle for an object - -Parameters: - pthr -- thread data for calling thread - pobj -- the object to allocate a handle for - pNewHandle -- on success, receives the newly allocated handle ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::ObtainHandleForObject( - CPalThread *pthr, - IPalObject *pobj, - HANDLE *pNewHandle // OUT - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != pobj); - _ASSERTE(NULL != pNewHandle); - - ENTRY("CSharedMemoryObjectManager::ObtainHandleForObject " - "(this=%p, pthr=%p, pobj=%p, " - "pNewHandle=%p)\n", - this, - pthr, - pobj, - pNewHandle - ); - - palError = m_HandleManager.AllocateHandle( - pthr, - pobj, - pNewHandle - ); - - LOGEXIT("CSharedMemoryObjectManager::ObtainHandleForObject return %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::RevokeHandle - - Removes a handle from the process's handle table, which in turn releases - the handle's reference on the object instance it refers to - -Parameters: - pthr -- thread data for calling thread - hHandleToRevoke -- the handle to revoke ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::RevokeHandle( - CPalThread *pthr, - HANDLE hHandleToRevoke - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pthr); - - ENTRY("CSharedMemoryObjectManager::RevokeHandle " - "(this=%p, pthr=%p, hHandleToRevoke=%p)\n", - this, - pthr, - hHandleToRevoke - ); - - palError = m_HandleManager.FreeHandle(pthr, hHandleToRevoke); - - LOGEXIT("CSharedMemoryObjectManager::RevokeHandle returns %d\n", palError); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::ReferenceObjectByHandle - - Returns a referenced object instance that a handle refers to - -Parameters: - pthr -- thread data for calling thread - hHandleToReference -- the handle to reference - paot -- acceptable types for the underlying object - granted; currently ignored - ppobj -- on success, receives a reference to the object instance ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::ReferenceObjectByHandle( - CPalThread *pthr, - HANDLE hHandleToReference, - CAllowedObjectTypes *paot, - IPalObject **ppobj // OUT - ) -{ - PAL_ERROR palError; - IPalObject *pobj; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != paot); - _ASSERTE(NULL != ppobj); - - ENTRY("CSharedMemoryObjectManager::ReferenceObjectByHandle " - "(this=%p, pthr=%p, hHandleToReference=%p, paot=%p, ppobj=%p)\n", - this, - pthr, - hHandleToReference, - paot, - ppobj - ); - - palError = m_HandleManager.GetObjectFromHandle( - pthr, - hHandleToReference, - &pobj - ); - - if (NO_ERROR == palError) - { - palError = CheckObjectTypeAndRights( - pobj, - paot - ); - - if (NO_ERROR == palError) - { - // - // Transfer object reference to out parameter - // - - *ppobj = pobj; - } - else - { - pobj->ReleaseReference(pthr); - } - } - - LOGEXIT("CSharedMemoryObjectManager::ReferenceObjectByHandle returns %d\n", - palError - ); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::ReferenceObjectByHandleArray - - Returns the referenced object instances that an array of handles - refer to. - -Parameters: - pthr -- thread data for calling thread - rgHandlesToReference -- the array of handles to reference - dwHandleCount -- the number of handles in the arrayu - paot -- acceptable types for the underlying objects - rgpobjs -- on success, receives references to the object instances; will - be empty on failures ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::ReferenceMultipleObjectsByHandleArray( - CPalThread *pthr, - HANDLE rghHandlesToReference[], - DWORD dwHandleCount, - CAllowedObjectTypes *paot, - IPalObject *rgpobjs[] // OUT (caller allocated) - ) -{ - PAL_ERROR palError = NO_ERROR; - IPalObject *pobj = NULL; - DWORD dw; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != rghHandlesToReference); - _ASSERTE(0 < dwHandleCount); - _ASSERTE(NULL != paot); - _ASSERTE(NULL != rgpobjs); - - ENTRY("CSharedMemoryObjectManager::ReferenceMultipleObjectsByHandleArray " - "(this=%p, pthr=%p, rghHandlesToReference=%p, dwHandleCount=%d, " - "pAllowedTyped=%d, rgpobjs=%p)\n", - this, - pthr, - rghHandlesToReference, - dwHandleCount, - paot, - rgpobjs - ); - - m_HandleManager.Lock(pthr); - - for (dw = 0; dw < dwHandleCount; dw += 1) - { - palError = m_HandleManager.GetObjectFromHandle( - pthr, - rghHandlesToReference[dw], - &pobj - ); - - if (NO_ERROR == palError) - { - palError = CheckObjectTypeAndRights( - pobj, - paot - ); - - if (NO_ERROR == palError) - { - // - // Transfer reference to out array - // - - rgpobjs[dw] = pobj; - pobj = NULL; - } - } - - if (NO_ERROR != palError) - { - break; - } - } - - // - // The handle manager lock must be released before releasing - // any object references, as ReleaseReference will acquire - // the object manager list lock (which needs to be acquired before - // the handle manager lock) - // - - m_HandleManager.Unlock(pthr); - - if (NO_ERROR != palError) - { - // - // dw's current value is the failing index, so we want - // to free from dw - 1. - // - - while (dw > 0) - { - rgpobjs[--dw]->ReleaseReference(pthr); - } - - if (NULL != pobj) - { - pobj->ReleaseReference(pthr); - } - } - - LOGEXIT("CSharedMemoryObjectManager::ReferenceMultipleObjectsByHandleArray" - " returns %d\n", - palError - ); - - return palError; -} - -/*++ -Function: - CSharedMemoryObjectManager::ImportSharedObjectIntoProcess - - Takes an object's shared memory data and from it creates the - necessary in-process structures for the object - -Parameters: - pthr -- thread data for calling thread - pot -- the object's type - poa -- attributes for the object - shmSharedObjectData -- the shared memory pointer for the object's shared - data - psmod -- the shared memory data for the object, mapped into this process's - address space - fAddRefSharedData -- if TRUE, we need to add to the shared data reference - count - ppshmobj -- on success, receives a pointer to the newly created local - object instance ---*/ - -PAL_ERROR -CSharedMemoryObjectManager::ImportSharedObjectIntoProcess( - CPalThread *pthr, - CObjectType *pot, - CObjectAttributes *poa, - SHMPTR shmSharedObjectData, - SHMObjData *psmod, - bool fAddRefSharedData, - CSharedMemoryObject **ppshmobj - ) -{ - PAL_ERROR palError = NO_ERROR; - CSharedMemoryObject *pshmobj; - PLIST_ENTRY pleObjectList; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != pot); - _ASSERTE(NULL != poa); - _ASSERTE(NULL != shmSharedObjectData); - _ASSERTE(NULL != psmod); - _ASSERTE(NULL != ppshmobj); - - ENTRY("CSharedMemoryObjectManager::ImportSharedObjectIntoProcess(pthr=%p, " - "pot=%p, poa=%p, shmSharedObjectData=%p, psmod=%p, fAddRefSharedData=%d, " - "ppshmobj=%p)\n", - pthr, - pot, - poa, - shmSharedObjectData, - psmod, - fAddRefSharedData, - ppshmobj - ); - - if (CObjectType::WaitableObject == pot->GetSynchronizationSupport()) - { - pshmobj = InternalNew(pot, - &m_csListLock, - shmSharedObjectData, - psmod, - fAddRefSharedData); - } - else - { - pshmobj = InternalNew(pot, - &m_csListLock, - shmSharedObjectData, - psmod, - fAddRefSharedData); - } - - if (NULL != pshmobj) - { - palError = pshmobj->InitializeFromExistingSharedData(pthr, poa); - if (NO_ERROR == palError) - { - if (0 != psmod->dwNameLength) - { - pleObjectList = &m_leNamedObjects; - } - else - { - pleObjectList = &m_leAnonymousObjects; - } - - InsertTailList(pleObjectList, pshmobj->GetObjectListLink()); - } - else - { - goto ImportSharedObjectIntoProcessExit; - } - } - else - { - ERROR("Unable to allocate new object\n"); - palError = ERROR_OUTOFMEMORY; - goto ImportSharedObjectIntoProcessExit; - } - - *ppshmobj = pshmobj; - -ImportSharedObjectIntoProcessExit: - - LOGEXIT("CSharedMemoryObjectManager::ImportSharedObjectIntoProcess returns %d\n", palError); - - return palError; -} - -static PalObjectTypeId RemotableObjectTypes[] = - {otiManualResetEvent, otiAutoResetEvent, otiMutex, otiProcess}; - -static CAllowedObjectTypes aotRemotable( - RemotableObjectTypes, - sizeof(RemotableObjectTypes) / sizeof(RemotableObjectTypes[0]) - ); - -/*++ -Function: - CheckObjectTypeAndRights - - Helper routine that determines if: - 1) An object instance is of a specified type - 2) A set of granted access rights satisfies the required access rights - (currently ignored) - -Parameters: - pobj -- the object instance whose type is to be checked - paot -- the acceptable type for the object instance ---*/ - -static -PAL_ERROR -CheckObjectTypeAndRights( - IPalObject *pobj, - CAllowedObjectTypes *paot - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pobj); - _ASSERTE(NULL != paot); - - ENTRY("CheckObjectTypeAndRights (pobj=%p, paot=%p)\n", - pobj, - paot - ); - - if (!paot->IsTypeAllowed(pobj->GetObjectType()->GetId())) - { - palError = ERROR_INVALID_HANDLE; - } - - LOGEXIT("CheckObjectTypeAndRights returns %d\n", palError); - - return palError; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobjectmanager.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobjectmanager.hpp deleted file mode 100644 index b9ec51919..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/objmgr/shmobjectmanager.hpp +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - shmobjectmanager.hpp - -Abstract: - Shared memory based object manager - - - ---*/ - -#ifndef _PAL_SHMOBJECTMANAGER_HPP_ -#define _PAL_SHMOBJECTMANAGER_HPP_ - -#include "pal/corunix.hpp" -#include "pal/handlemgr.hpp" -#include "pal/list.h" -#include "shmobject.hpp" - -namespace CorUnix -{ - class CSharedMemoryObjectManager : public IPalObjectManager - { - protected: - - CRITICAL_SECTION m_csListLock; - bool m_fListLockInitialized; - LIST_ENTRY m_leNamedObjects; - LIST_ENTRY m_leAnonymousObjects; - - CSimpleHandleManager m_HandleManager; - - PAL_ERROR - ImportSharedObjectIntoProcess( - CPalThread *pthr, - CObjectType *pot, - CObjectAttributes *poa, - SHMPTR shmSharedObjectData, - SHMObjData *psmod, - bool fAddRefSharedData, - CSharedMemoryObject **ppshmobj - ); - - public: - - CSharedMemoryObjectManager() - : - m_fListLockInitialized(FALSE) - { - }; - - virtual ~CSharedMemoryObjectManager() - { - }; - - PAL_ERROR - Initialize( - void - ); - - PAL_ERROR - Shutdown( - CPalThread *pthr - ); - - // - // IPalObjectManager routines - // - - virtual - PAL_ERROR - AllocateObject( - CPalThread *pthr, - CObjectType *pot, - CObjectAttributes *poa, - IPalObject **ppobjNew - ); - - virtual - PAL_ERROR - RegisterObject( - CPalThread *pthr, - IPalObject *pobjToRegister, - CAllowedObjectTypes *paot, - HANDLE *pHandle, - IPalObject **ppobjRegistered - ); - - virtual - PAL_ERROR - LocateObject( - CPalThread *pthr, - CPalString *psObjectToLocate, - CAllowedObjectTypes *paot, - IPalObject **ppobj - ); - - virtual - PAL_ERROR - ObtainHandleForObject( - CPalThread *pthr, - IPalObject *pobj, - HANDLE *pNewHandle - ); - - virtual - PAL_ERROR - RevokeHandle( - CPalThread *pthr, - HANDLE hHandleToRevoke - ); - - virtual - PAL_ERROR - ReferenceObjectByHandle( - CPalThread *pthr, - HANDLE hHandleToReference, - CAllowedObjectTypes *paot, - IPalObject **ppobj - ); - - virtual - PAL_ERROR - ReferenceMultipleObjectsByHandleArray( - CPalThread *pthr, - HANDLE rghHandlesToReference[], - DWORD dwHandleCount, - CAllowedObjectTypes *paot, - IPalObject *rgpobjs[] - ); - }; -} - -#endif // _PAL_SHMOBJECTMANAGER_HPP_ - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal.h deleted file mode 100644 index 8c1a6e572..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal.h +++ /dev/null @@ -1,1066 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*internal.h - contains declarations of internal routines and variables -* - -* -*Purpose: -* Declares routines and variables used internally by the C run-time. -* -* [Internal] -* -****/ - -#if _MSC_VER > 1000 -#pragma once -#endif /* _MSC_VER > 1000 */ - -#ifndef _INC_INTERNAL -#define _INC_INTERNAL - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -/* - * Conditionally include windows.h to pick up the definition of - * CRITICAL_SECTION. - */ -#include - -#ifdef _MSC_VER -#pragma pack(push,_CRT_PACKING) -#endif /* _MSC_VER */ - -/* Define function types used in several startup sources */ - -typedef void (__cdecl *_PVFV)(void); -typedef int (__cdecl *_PIFV)(void); -typedef void (__cdecl *_PVFI)(int); - -#if _MSC_VER >= 1400 && defined(_M_CEE) -typedef const void* (__clrcall *_PVFVM)(void); -typedef int (__clrcall *_PIFVM)(void); -typedef void (__clrcall *_CPVFV)(void); -#endif /* _MSC_VER >= 1400 && defined(_M_CEE) */ - -#if defined (_M_CEE_PURE) || (defined (_DLL) && defined (_M_IX86)) -/* Retained for compatibility with VC++ 5.0 and earlier versions */ -_CRTIMP int * __cdecl __p__commode(void); -#endif /* defined (_M_CEE_PURE) || (defined (_DLL) && defined (_M_IX86)) */ -#if defined (SPECIAL_CRTEXE) && defined (_DLL) - extern int _commode; -#else /* defined (SPECIAL_CRTEXE) && defined (_DLL) */ -#ifndef _M_CEE_PURE -_CRTIMP extern int _commode; -#else /* _M_CEE_PURE */ -#define _commode (*__p___commode()) -#endif /* _M_CEE_PURE */ -#endif /* defined (SPECIAL_CRTEXE) && defined (_DLL) */ - -#define __IOINFO_TM_ANSI 0 /* Regular Text */ -#define __IOINFO_TM_UTF8 1 /* UTF8 Encoded */ -#define __IOINFO_TM_UTF16LE 2 /* UTF16 Little Endian Encoded */ - -/* - * Control structure for lowio file handles - */ -typedef struct { - intptr_t osfhnd; /* underlying OS file HANDLE */ - char osfile; /* attributes of file (e.g., open in text mode?) */ - char pipech; /* one char buffer for handles opened on pipes */ - int lockinitflag; - CRITICAL_SECTION lock; -#ifndef _SAFECRT_IMPL - /* Not used in the safecrt downlevel. We do not define them, so we cannot use them accidentally */ - char textmode : 7; /* __IOINFO_TM_ANSI or __IOINFO_TM_UTF8 or __IOINFO_TM_UTF16LE */ - char unicode : 1; /* Was the file opened as unicode? */ - char pipech2[2]; /* 2 more peak ahead chars for UNICODE mode */ -#endif /* _SAFECRT_IMPL */ - } ioinfo; - -/* - * Definition of IOINFO_L2E, the log base 2 of the number of elements in each - * array of ioinfo structs. - */ -#define IOINFO_L2E 5 - -/* - * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array - */ -#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) - -/* - * Definition of IOINFO_ARRAYS, maximum number of supported ioinfo arrays. - */ -#define IOINFO_ARRAYS 64 - -#define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS) - -#define _TZ_STRINGS_SIZE 64 - -/* - * Access macros for getting at an ioinfo struct and its fields from a - * file handle - */ -#define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - \ - 1)) ) -#define _osfhnd(i) ( _pioinfo(i)->osfhnd ) - -#define _osfile(i) ( _pioinfo(i)->osfile ) - -#define _pipech(i) ( _pioinfo(i)->pipech ) - -#define _pipech2(i) ( _pioinfo(i)->pipech2 ) - -#define _textmode(i) ( _pioinfo(i)->textmode ) - -#define _tm_unicode(i) ( _pioinfo(i)->unicode ) - -/* - * Safer versions of the above macros. Currently, only _osfile_safe is - * used. - */ -#define _pioinfo_safe(i) ( (((i) != -1) && ((i) != -2)) ? _pioinfo(i) : &__badioinfo ) - -#define _osfhnd_safe(i) ( _pioinfo_safe(i)->osfhnd ) - -#define _osfile_safe(i) ( _pioinfo_safe(i)->osfile ) - -#define _pipech_safe(i) ( _pioinfo_safe(i)->pipech ) - -#define _pipech2_safe(i) ( _pioinfo_safe(i)->pipech2 ) - -#ifdef _SAFECRT_IMPL -/* safecrt does not have support for textmode, so we always return __IOINFO_TM_ANSI */ -#define _textmode_safe(i) __IOINFO_TM_ANSI -#define _tm_unicode_safe(i) 0 -#else /* _SAFECRT_IMPL */ -#define _textmode_safe(i) ( _pioinfo_safe(i)->textmode ) -#define _tm_unicode_safe(i) ( _pioinfo_safe(i)->unicode ) -#endif /* _SAFECRT_IMPL */ - -#ifndef _M_CEE_PURE -#ifdef _SAFECRT_IMPL -/* We need to get this from the downlevel DLL, even when we build safecrt.lib */ -extern __declspec(dllimport) ioinfo __badioinfo; -extern __declspec(dllimport) ioinfo * __pioinfo[]; -#else /* _SAFECRT_IMPL */ -/* - * Special, static ioinfo structure used only for more graceful handling - * of a C file handle value of -1 (results from common errors at the stdio - * level). - */ -extern _CRTIMP ioinfo __badioinfo; - -/* - * Array of arrays of control structures for lowio files. - */ -extern _CRTIMP ioinfo * __pioinfo[]; -#endif /* _SAFECRT_IMPL */ -#endif /* _M_CEE_PURE */ - -/* - * Current number of allocated ioinfo structures (_NHANDLE_ is the upper - * limit). - */ -extern int _nhandle; - -int __cdecl _alloc_osfhnd(void); -int __cdecl _free_osfhnd(int); -int __cdecl _set_osfhnd(int, intptr_t); - -/* - fileno for stdout, stdin & stderr when there is no console -*/ -#define _NO_CONSOLE_FILENO (intptr_t)-2 - - -extern const char __dnames[]; -extern const char __mnames[]; - -extern int _days[]; -extern int _lpdays[]; - -extern __time32_t __cdecl __loctotime32_t(int, int, int, int, int, int, int); -extern __time64_t __cdecl __loctotime64_t(int, int, int, int, int, int, int); - -extern void __cdecl __tzset(void); - -extern int __cdecl _validdrive(unsigned); - -/* - * If we are only interested in years between 1901 and 2099, we could use this: - * - * #define IS_LEAP_YEAR(y) (y % 4 == 0) - */ - -#define IS_LEAP_YEAR(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0) - -/* - * This variable is in the C start-up; the length must be kept synchronized - * It is used by the *cenvarg.c modules - */ - -extern char _acfinfo[]; /* "_C_FILE_INFO=" */ - -#define CFI_LENGTH 12 /* "_C_FILE_INFO" is 12 bytes long */ - - -/* - * stdio internals - */ -#ifndef _FILE_DEFINED -struct _iobuf { - char *_ptr; - int _cnt; - char *_base; - int _flag; - int _file; - int _charbuf; - int _bufsiz; - char *_tmpfname; - }; -typedef struct _iobuf FILE; -#define _FILE_DEFINED -#endif /* _FILE_DEFINED */ - -#if !defined (_FILEX_DEFINED) && defined (_WINDOWS_) - -/* - * Variation of FILE type used for the dynamically allocated portion of - * __piob[]. For single thread, _FILEX is the same as FILE. For multithread - * models, _FILEX has two fields: the FILE struct and the CRITICAL_SECTION - * struct used to serialize access to the FILE. - */ - -typedef struct { - FILE f; - CRITICAL_SECTION lock; - } _FILEX; - - -#define _FILEX_DEFINED -#endif /* !defined (_FILEX_DEFINED) && defined (_WINDOWS_) */ - -/* - * Number of entries supported in the array pointed to by __piob[]. That is, - * the number of stdio-level files which may be open simultaneously. This - * is normally set to _NSTREAM_ by the stdio initialization code. - */ -extern int _nstream; - -/* - * Pointer to the array of pointers to FILE/_FILEX structures that are used - * to manage stdio-level files. - */ -extern void **__piob; - -FILE * __cdecl _getstream(void); -FILE * __cdecl _openfile(_In_z_ const char * _Filename, _In_z_ const char * _Mode, _In_ int _ShFlag, _Out_ FILE * _File); -FILE * __cdecl _wopenfile(_In_z_ const char16_t * _Filename, _In_z_ const char16_t * _Mode, _In_ int _ShFlag, _Out_ FILE * _File); -void __cdecl _getbuf(_Out_ FILE * _File); -int __cdecl _filwbuf (__inout FILE * _File); -int __cdecl _flswbuf(_In_ int _Ch, __inout FILE * _File); -void __cdecl _freebuf(__inout FILE * _File); -int __cdecl _stbuf(__inout FILE * _File); -void __cdecl _ftbuf(int _Flag, __inout FILE * _File); - -#ifdef _SAFECRT_IMPL - -int __cdecl _output(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList); -int __cdecl _woutput(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList); -int __cdecl _output_s(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList); -int __cdecl _output_p(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList); -typedef int (*OUTPUTFN)(FILE *, const char *, va_list); - -#else /* _SAFECRT_IMPL */ - -int __cdecl _output_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList); -int __cdecl _woutput_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList); -int __cdecl _output_s_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList); -int __cdecl _output_p_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList); -typedef int (*OUTPUTFN)(__inout FILE * _File, const char *, _locale_t, va_list); - -#endif /* _SAFECRT_IMPL */ - -#ifdef _SAFECRT_IMPL - -int __cdecl _input(_In_ FILE * _File, _In_z_ __format_string const unsigned char * _Format, va_list _ArgList); -int __cdecl _winput(_In_ FILE * _File, _In_z_ __format_string const char16_t * _Format, va_list _ArgList); -int __cdecl _input_s(_In_ FILE * _File, _In_z_ __format_string const unsigned char * _Format, va_list _ArgList); -typedef int (*INPUTFN)(FILE *, const unsigned char *, va_list); -typedef int (*WINPUTFN)(FILE *, const char16_t *, va_list); - -#else /* _SAFECRT_IMPL */ - -int __cdecl _input_l(__inout FILE * _File, _In_z_ __format_string const unsigned char *, _In_opt_ _locale_t _Locale, va_list _ArgList); -int __cdecl _winput_l(__inout FILE * _File, _In_z_ __format_string const char16_t *, _In_opt_ _locale_t _Locale, va_list _ArgList); -int __cdecl _input_s_l(__inout FILE * _File, _In_z_ __format_string const unsigned char *, _In_opt_ _locale_t _Locale, va_list _ArgList); -int __cdecl _winput_s_l(__inout FILE * _File, _In_z_ __format_string const char16_t *, _In_opt_ _locale_t _Locale, va_list _ArgList); -typedef int (*INPUTFN)(FILE *, const unsigned char *, _locale_t, va_list); -typedef int (*WINPUTFN)(FILE *, const char16_t *, _locale_t, va_list); - -#ifdef _UNICODE -#define TINPUTFN WINPUTFN -#else /* _UNICODE */ -#define TINPUTFN INPUTFN -#endif /* _UNICODE */ - -#endif /* _SAFECRT_IMPL */ - -int __cdecl _flush(__inout FILE * _File); -void __cdecl _endstdio(void); - -errno_t __cdecl _sopen_helper(_In_z_ const char * _Filename, - _In_ int _OFlag, _In_ int _ShFlag, _In_ int _PMode, - _Out_ int * _PFileHandle, int _BSecure); -errno_t __cdecl _wsopen_helper(_In_z_ const char16_t * _Filename, - _In_ int _OFlag, _In_ int _ShFlag, _In_ int _PMode, - _Out_ int * _PFileHandle, int _BSecure); - -#ifndef CRTDLL -extern int _cflush; -#endif /* CRTDLL */ - -extern unsigned int _tempoff; - -extern unsigned int _old_pfxlen; - -extern int _umaskval; /* the umask value */ - -extern char _pipech[]; /* pipe lookahead */ - -extern char _exitflag; /* callable termination flag */ - -extern int _C_Termination_Done; /* termination done flag */ - -char * __cdecl _getpath(_In_z_ const char * _Src, _Out_writes_z_(_SizeInChars) char * _Dst, _In_ size_t _SizeInChars); -char16_t * __cdecl _wgetpath(_In_z_ const char16_t * _Src, _Out_writes_z_(_SizeInWords) char16_t * _Dst, _In_ size_t _SizeInWords); - -extern int _dowildcard; /* flag to enable argv[] wildcard expansion */ - -#ifndef _PNH_DEFINED -typedef int (__cdecl * _PNH)( size_t ); -#define _PNH_DEFINED -#endif /* _PNH_DEFINED */ - -#if _MSC_VER >= 1400 && defined(_M_CEE) -#ifndef __MPNH_DEFINED -typedef int (__clrcall * __MPNH)( size_t ); -#define __MPNH_DEFINED -#endif /* __MPNH_DEFINED */ -#endif /* _MSC_VER >= 1400 && defined(_M_CEE) */ - - -/* calls the currently installed new handler */ -int __cdecl _callnewh(_In_ size_t _Size); - -extern int _newmode; /* malloc new() handler mode */ - -/* pointer to initial environment block that is passed to [w]main */ -#ifndef _M_CEE_PURE -extern _CRTIMP char16_t **__winitenv; -extern _CRTIMP char **__initenv; -#endif /* _M_CEE_PURE */ - -/* _calloca helper */ -#define _calloca(count, size) ((count<=0 || size<=0 || ((((size_t)_HEAP_MAXREQ) / ((size_t)count)) < ((size_t)size)))? NULL : _malloca(count * size)) - -/* startup set values */ -extern char *_aenvptr; /* environment ptr */ -extern char16_t *_wenvptr; /* wide environment ptr */ - -/* command line */ - -#if defined (_DLL) -_CRTIMP char ** __cdecl __p__acmdln(void); -_CRTIMP char16_t ** __cdecl __p__wcmdln(void); -#endif /* defined (_DLL) */ -#ifndef _M_CEE_PURE -_CRTIMP extern char *_acmdln; -_CRTIMP extern char16_t *_wcmdln; -#else /* _M_CEE_PURE */ -#define _acmdln (*__p__acmdln()) -#define _wcmdln (*__p__wcmdln()) -#endif /* _M_CEE_PURE */ - -/* - * prototypes for internal startup functions - */ -int __cdecl _cwild(void); /* wild.c */ -int __cdecl _wcwild(void); /* wwild.c */ -int __cdecl _mtinit(void); /* tidtable.c */ -void __cdecl _mtterm(void); /* tidtable.c */ -int __cdecl _mtinitlocks(void); /* mlock.c */ -void __cdecl _mtdeletelocks(void); /* mlock.c */ -int __cdecl _mtinitlocknum(int); /* mlock.c */ - -/* Wrapper for InitializeCriticalSection API, with default spin count */ -int __cdecl __crtInitCritSecAndSpinCount(PCRITICAL_SECTION, DWORD); -#define _CRT_SPINCOUNT 4000 - -/* - * C source build only!!!! - * - * more prototypes for internal startup functions - */ -void __cdecl _amsg_exit(int); /* crt0.c */ -void __cdecl __crtExitProcess(int); /* crt0dat.c */ -void __cdecl __crtCorExitProcess(int); /* crt0dat.c */ -void __cdecl __crtdll_callstaticterminators(void); /* crt0dat.c */ - -/* -_cinit now allows the caller to suppress floating point precision init -This allows the DLLs that use the CRT to not initialise FP precision, -allowing the EXE's setting to persist even when a DLL is loaded -*/ -int __cdecl _cinit(int /* initFloatingPrecision */); /* crt0dat.c */ -void __cdecl __doinits(void); /* astart.asm */ -void __cdecl __doterms(void); /* astart.asm */ -void __cdecl __dopreterms(void); /* astart.asm */ -void __cdecl _FF_MSGBANNER(void); -void __cdecl _fpmath(int /*initPrecision*/); -void __cdecl _fpclear(void); -void __cdecl _fptrap(void); /* crt0fp.c */ -int __cdecl _heap_init(int); -void __cdecl _heap_term(void); -void __cdecl _heap_abort(void); -void __cdecl __initconin(void); /* initcon.c */ -void __cdecl __initconout(void); /* initcon.c */ -int __cdecl _ioinit(void); /* crt0.c, crtlib.c */ -void __cdecl _ioterm(void); /* crt0.c, crtlib.c */ -char * __cdecl _GET_RTERRMSG(int); -void __cdecl _NMSG_WRITE(int); -int __CRTDECL _setargv(void); /* setargv.c, stdargv.c */ -int __CRTDECL __setargv(void); /* stdargv.c */ -int __CRTDECL _wsetargv(void); /* wsetargv.c, wstdargv.c */ -int __CRTDECL __wsetargv(void); /* wstdargv.c */ -int __cdecl _setenvp(void); /* stdenvp.c */ -int __cdecl _wsetenvp(void); /* wstdenvp.c */ -void __cdecl __setmbctable(unsigned int); /* mbctype.c */ - -#ifdef MRTDLL -_MRTIMP int __cdecl _onexit_process(_CPVFV); -_MRTIMP int __cdecl _onexit_app_domain(_CPVFV); -#endif /* MRTDLL */ - -#ifndef _MANAGED_MAIN -int __CRTDECL main(_In_ int _Argc, _In_reads_z_(_Argc) char ** _Argv, _In_z_ char ** _Env); -int __CRTDECL wmain(_In_ int _Argc, _In_reads_z_(_Argc) char16_t ** _Argv, _In_z_ char16_t ** _Env); -#endif /* _MANAGED_MAIN */ - -/* helper functions for wide/multibyte environment conversion */ -int __cdecl __mbtow_environ (void); -int __cdecl __wtomb_environ (void); - -/* These two functions take a char ** for the environment option - At some point during their execution, they take ownership of the - memory block passed in using option. At this point, they - NULL out the incoming char * / char16_t * to ensure there is no - double-free -*/ -int __cdecl __crtsetenv(_Outptr_opt_ char ** _POption, _In_ const int _Primary); -int __cdecl __crtwsetenv(_Outptr_opt_ char16_t ** _POption, _In_ const int _Primary); - -#ifndef _M_CEE_PURE -_CRTIMP extern void (__cdecl * _aexit_rtn)(int); -#endif /* _M_CEE_PURE */ - -#if defined (_DLL) || defined (CRTDLL) - -#ifndef _STARTUP_INFO_DEFINED -typedef struct -{ - int newmode; -} _startupinfo; -#define _STARTUP_INFO_DEFINED -#endif /* _STARTUP_INFO_DEFINED */ - -_CRTIMP int __cdecl __getmainargs(_Out_ int * _Argc, _Outptr_result_buffer_(*_Argc) char *** _Argv, - _Outptr_opt_ char *** _Env, _In_ int _DoWildCard, - _In_ _startupinfo * _StartInfo); - -_CRTIMP int __cdecl __wgetmainargs(_Out_ int * _Argc, _Outptr_result_buffer_(*_Argc)char16_t *** _Argv, - _Outptr_opt_ char16_t *** _Env, _In_ int _DoWildCard, - _In_ _startupinfo * _StartInfo); - -#endif /* defined (_DLL) || defined (CRTDLL) */ - -/* - * Prototype, variables and constants which determine how error messages are - * written out. - */ -#define _UNKNOWN_APP 0 -#define _CONSOLE_APP 1 -#define _GUI_APP 2 - -extern int __app_type; - -#if !defined (_M_CEE_PURE) - -extern Volatile __native_startup_lock; - -#define __NO_REASON UINT_MAX -extern Volatile __native_dllmain_reason; -extern Volatile __native_vcclrit_reason; - -#if defined (__cplusplus) - -#pragma warning(push) -#pragma warning(disable: 4483) -#if _MSC_FULL_VER >= 140050415 -#define _NATIVE_STARTUP_NAMESPACE __identifier("") -#else /* _MSC_FULL_VER >= 140050415 */ -#define _NATIVE_STARTUP_NAMESPACE __CrtImplementationDetails -#endif /* _MSC_FULL_VER >= 140050415 */ - -namespace _NATIVE_STARTUP_NAMESPACE -{ - class NativeDll - { - private: - static const unsigned int ProcessDetach = 0; - static const unsigned int ProcessAttach = 1; - static const unsigned int ThreadAttach = 2; - static const unsigned int ThreadDetach = 3; - static const unsigned int ProcessVerifier = 4; - - public: - - inline static bool IsInDllMain() - { - return (__native_dllmain_reason != __NO_REASON); - } - - inline static bool IsInProcessAttach() - { - return (__native_dllmain_reason == ProcessAttach); - } - - inline static bool IsInProcessDetach() - { - return (__native_dllmain_reason == ProcessDetach); - } - - inline static bool IsInVcclrit() - { - return (__native_vcclrit_reason != __NO_REASON); - } - - inline static bool IsSafeForManagedCode() - { - if (!IsInDllMain()) - { - return true; - } - - if (IsInVcclrit()) - { - return true; - } - - return !IsInProcessAttach() && !IsInProcessDetach(); - } - }; -} -#pragma warning(pop) - -#endif /* defined (__cplusplus) */ - -#endif /* !defined (_M_CEE_PURE) */ - -extern int __error_mode; - -_CRTIMP void __cdecl __set_app_type(int); -#if defined (CRTDLL) && !defined (_SYSCRT) -/* - * All these function pointer are used for creating global state of CRT - * functions. Either all of them will be set or all of them will be NULL - */ -typedef void (__cdecl *_set_app_type_function)(int); -typedef int (__cdecl *_get_app_type_function)(); -extern _set_app_type_function __set_app_type_server; -extern _get_app_type_function __get_app_type_server; -#endif /* defined (CRTDLL) && !defined (_SYSCRT) */ - -/* - * C source build only!!!! - * - * map Win32 errors into Xenix errno values -- for modules written in C - */ -_CRTIMP void __cdecl _dosmaperr(unsigned long); -extern int __cdecl _get_errno_from_oserr(unsigned long); - -/* - * internal routines used by the exec/spawn functions - */ - -extern intptr_t __cdecl _dospawn(_In_ int _Mode, _In_opt_z_ const char * _Name, __inout_z char * _Cmd, _In_opt_z_ char * _Env); -extern intptr_t __cdecl _wdospawn(_In_ int _Mode, _In_opt_z_ const char16_t * _Name, __inout_z char16_t * _Cmd, _In_opt_z_ char16_t * _Env); -extern int __cdecl _cenvarg(_In_z_ const char * const * _Argv, _In_opt_z_ const char * const * _Env, - _Outptr_opt_ char ** _ArgBlk, _Outptr_opt_ char ** _EnvBlk, _In_z_ const char *_Name); -extern int __cdecl _wcenvarg(_In_z_ const char16_t * const * _Argv, _In_opt_z_ const char16_t * const * _Env, - _Outptr_opt_ char16_t ** _ArgBlk, _Outptr_opt_ char16_t ** _EnvBlk, _In_z_ const char16_t * _Name); -#ifndef _M_IX86 -extern char ** _capture_argv(_In_ va_list *, _In_z_ const char * _FirstArg, _Out_writes_z_(_MaxCount) char ** _Static_argv, _In_ size_t _MaxCount); -extern char16_t ** _wcapture_argv(_In_ va_list *, _In_z_ const char16_t * _FirstArg, _Out_writes_z_(_MaxCount) char16_t ** _Static_argv, _In_ size_t _MaxCount); -#endif /* _M_IX86 */ - -/* - * internal routine used by the abort - */ - -extern _PHNDLR __cdecl __get_sigabrt(void); - -/* - * Type from ntdef.h - */ - -typedef LONG NTSTATUS; - -/* - * Exception code used in _invalid_parameter - */ - -#ifndef STATUS_INVALID_PARAMETER -#define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL) -#endif /* STATUS_INVALID_PARAMETER */ - -/* - * Exception code used for abort and _CALL_REPORTFAULT - */ - -#ifndef STATUS_FATAL_APP_EXIT -#define STATUS_FATAL_APP_EXIT ((NTSTATUS)0x40000015L) -#endif /* STATUS_FATAL_APP_EXIT */ - -/* - * Validate functions - */ -#include /* _ASSERTE */ -#include - -#define __STR2WSTR(str) L##str - -#define _STR2WSTR(str) __STR2WSTR(str) - -#define __FILEW__ _STR2WSTR(__FILE__) -#define __FUNCTIONW__ _STR2WSTR(__FUNCTION__) - -/* We completely fill the buffer only in debug (see _SECURECRT__FILL_STRING - * and _SECURECRT__FILL_BYTE macros). - */ -#if !defined (_SECURECRT_FILL_BUFFER) -#ifdef _DEBUG -#define _SECURECRT_FILL_BUFFER 1 -#else /* _DEBUG */ -#define _SECURECRT_FILL_BUFFER 0 -#endif /* _DEBUG */ -#endif /* !defined (_SECURECRT_FILL_BUFFER) */ - -#ifndef _SAFECRT_IMPL -/* _invalid_parameter is already defined in safecrt.h and safecrt.lib */ -#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) -extern "C++" -#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */ -_CRTIMP -#endif /* _SAFECRT_IMPL */ -void __cdecl _invalid_parameter(_In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, unsigned int, uintptr_t); - -#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) -extern "C++" -#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */ -_CRTIMP -void __cdecl _invoke_watson(_In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, unsigned int, uintptr_t); - -#ifndef _DEBUG -#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) -extern "C++" -#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */ -_CRTIMP -void __cdecl _invalid_parameter_noinfo(void); -#endif /* _DEBUG */ - -/* Invoke Watson if _ExpressionError is not 0; otherwise simply return _ExpressionError */ -__forceinline -void _invoke_watson_if_error( - errno_t _ExpressionError, - const char16_t *_Expression, - const char16_t *_Function, - const char16_t *_File, - unsigned int _Line, - uintptr_t _Reserved - ) -{ - if (_ExpressionError == 0) - { - return; - } - _invoke_watson(_Expression, _Function, _File, _Line, _Reserved); -} - -/* Invoke Watson if _ExpressionError is not 0 and equal to _ErrorValue1 or _ErrorValue2; otherwise simply return _ExpressionError */ -__forceinline -errno_t _invoke_watson_if_oneof( - errno_t _ExpressionError, - errno_t _ErrorValue1, - errno_t _ErrorValue2, - const char16_t *_Expression, - const char16_t *_Function, - const char16_t *_File, - unsigned int _Line, - uintptr_t _Reserved - ) -{ - if (_ExpressionError == 0 || (_ExpressionError != _ErrorValue1 && _ExpressionError != _ErrorValue2)) - { - return _ExpressionError; - } - _invoke_watson(_Expression, _Function, _File, _Line, _Reserved); - return _ExpressionError; -} - -/* - * Assert in debug builds. - * set errno and return - * - */ -#ifdef _DEBUG -#define _CALL_INVALID_PARAMETER_FUNC(funcname, expr) funcname(expr, __FUNCTIONW__, __FILEW__, __LINE__, 0) -#define _INVOKE_WATSON_IF_ERROR(expr) _invoke_watson_if_error((expr), __STR2WSTR(#expr), __FUNCTIONW__, __FILEW__, __LINE__, 0) -#define _INVOKE_WATSON_IF_ONEOF(expr, errvalue1, errvalue2) _invoke_watson_if_oneof(expr, (errvalue1), (errvalue2), __STR2WSTR(#expr), __FUNCTIONW__, __FILEW__, __LINE__, 0) -#else /* _DEBUG */ -#define _CALL_INVALID_PARAMETER_FUNC(funcname, expr) funcname(NULL, NULL, NULL, 0, 0) -#define _INVOKE_WATSON_IF_ERROR(expr) _invoke_watson_if_error(expr, NULL, NULL, NULL, 0, 0) -#define _INVOKE_WATSON_IF_ONEOF(expr, errvalue1, errvalue2) _invoke_watson_if_oneof((expr), (errvalue1), (errvalue2), NULL, NULL, NULL, 0, 0) -#endif /* _DEBUG */ - -#define _INVALID_PARAMETER(expr) _CALL_INVALID_PARAMETER_FUNC(_invalid_parameter, expr) - -#define _VALIDATE_RETURN_VOID( expr, errorcode ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - errno = errorcode; \ - _INVALID_PARAMETER(_CRT_WIDE(#expr)); \ - return; \ - } \ - } - -/* - * Assert in debug builds. - * set errno and return value - */ - -#ifndef _VALIDATE_RETURN -#define _VALIDATE_RETURN( expr, errorcode, retexpr ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - errno = errorcode; \ - _INVALID_PARAMETER(_CRT_WIDE(#expr) ); \ - return ( retexpr ); \ - } \ - } -#endif /* _VALIDATE_RETURN */ - -#ifndef _VALIDATE_RETURN_NOEXC -#define _VALIDATE_RETURN_NOEXC( expr, errorcode, retexpr ) \ - { \ - if ( !(expr) ) \ - { \ - errno = errorcode; \ - return ( retexpr ); \ - } \ - } -#endif /* _VALIDATE_RETURN_NOEXC */ - -/* - * Assert in debug builds. - * set errno and set retval for later usage - */ - -#define _VALIDATE_SETRET( expr, errorcode, retval, retexpr ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - errno = errorcode; \ - _INVALID_PARAMETER(_CRT_WIDE(#expr)); \ - retval=( retexpr ); \ - } \ - } - -#define _CHECK_FH_RETURN( handle, errorcode, retexpr ) \ - { \ - if(handle == _NO_CONSOLE_FILENO) \ - { \ - errno = errorcode; \ - return ( retexpr ); \ - } \ - } - -/* - We use _VALIDATE_STREAM_ANSI_RETURN to ensure that ANSI file operations( - fprintf etc) aren't called on files opened as UNICODE. We do this check - only if it's an actual FILE pointer & not a string -*/ - -#define _VALIDATE_STREAM_ANSI_RETURN( stream, errorcode, retexpr ) \ - { \ - FILE *_Stream=stream; \ - _VALIDATE_RETURN(( (_Stream->_flag & _IOSTRG) || \ - ( (_textmode_safe(_fileno(_Stream)) == __IOINFO_TM_ANSI) && \ - !_tm_unicode_safe(_fileno(_Stream)))), \ - errorcode, retexpr) \ - } - -/* - We use _VALIDATE_STREAM_ANSI_SETRET to ensure that ANSI file operations( - fprintf etc) aren't called on files opened as UNICODE. We do this check - only if it's an actual FILE pointer & not a string. It doesn't actually return - immediately -*/ - -#define _VALIDATE_STREAM_ANSI_SETRET( stream, errorcode, retval, retexpr) \ - { \ - FILE *_Stream=stream; \ - _VALIDATE_SETRET(( (_Stream->_flag & _IOSTRG) || \ - ( (_textmode_safe(_fileno(_Stream)) == __IOINFO_TM_ANSI) && \ - !_tm_unicode_safe(_fileno(_Stream)))), \ - errorcode, retval, retexpr) \ - } - -/* - * Assert in debug builds. - * Return value (do not set errno) - */ - -#define _VALIDATE_RETURN_NOERRNO( expr, retexpr ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - _INVALID_PARAMETER(_CRT_WIDE(#expr)); \ - return ( retexpr ); \ - } \ - } - -/* - * Assert in debug builds. - * set errno and return errorcode - */ - -#define _VALIDATE_RETURN_ERRCODE( expr, errorcode ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - errno = errorcode; \ - _INVALID_PARAMETER(_CRT_WIDE(#expr)); \ - return ( errorcode ); \ - } \ - } - -#define _VALIDATE_RETURN_ERRCODE_NOEXC( expr, errorcode ) \ - { \ - if (!(expr)) \ - { \ - errno = errorcode; \ - return ( errorcode ); \ - } \ - } - -#define _VALIDATE_CLEAR_OSSERR_RETURN( expr, errorcode, retexpr ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - _doserrno = 0L; \ - errno = errorcode; \ - _INVALID_PARAMETER(_CRT_WIDE(#expr) ); \ - return ( retexpr ); \ - } \ - } - -#define _CHECK_FH_CLEAR_OSSERR_RETURN( handle, errorcode, retexpr ) \ - { \ - if(handle == _NO_CONSOLE_FILENO) \ - { \ - _doserrno = 0L; \ - errno = errorcode; \ - return ( retexpr ); \ - } \ - } - -#define _VALIDATE_CLEAR_OSSERR_RETURN_ERRCODE( expr, errorcode ) \ - { \ - int _Expr_val=!!(expr); \ - _ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \ - if ( !( _Expr_val ) ) \ - { \ - _doserrno = 0L; \ - errno = errorcode; \ - _INVALID_PARAMETER(_CRT_WIDE(#expr)); \ - return ( errorcode ); \ - } \ - } - -#define _CHECK_FH_CLEAR_OSSERR_RETURN_ERRCODE( handle, retexpr ) \ - { \ - if(handle == _NO_CONSOLE_FILENO) \ - { \ - _doserrno = 0L; \ - return ( retexpr ); \ - } \ - } - -#ifdef _DEBUG -extern size_t __crtDebugFillThreshold; -#endif /* _DEBUG */ - -#if !defined (_SECURECRT_FILL_BUFFER_THRESHOLD) -#ifdef _DEBUG -#define _SECURECRT_FILL_BUFFER_THRESHOLD __crtDebugFillThreshold -#else /* _DEBUG */ -#define _SECURECRT_FILL_BUFFER_THRESHOLD ((size_t)0) -#endif /* _DEBUG */ -#endif /* !defined (_SECURECRT_FILL_BUFFER_THRESHOLD) */ - -#if _SECURECRT_FILL_BUFFER -#define _SECURECRT__FILL_STRING(_String, _Size, _Offset) \ - if ((_Size) != ((size_t)-1) && (_Size) != INT_MAX && \ - ((size_t)(_Offset)) < (_Size)) \ - { \ - memset((_String) + (_Offset), \ - _SECURECRT_FILL_BUFFER_PATTERN, \ - (_SECURECRT_FILL_BUFFER_THRESHOLD < ((size_t)((_Size) - (_Offset))) ? \ - _SECURECRT_FILL_BUFFER_THRESHOLD : \ - ((_Size) - (_Offset))) * sizeof(*(_String))); \ - } -#else /* _SECURECRT_FILL_BUFFER */ -#define _SECURECRT__FILL_STRING(_String, _Size, _Offset) -#endif /* _SECURECRT_FILL_BUFFER */ - -#if _SECURECRT_FILL_BUFFER -#define _SECURECRT__FILL_BYTE(_Position) \ - if (_SECURECRT_FILL_BUFFER_THRESHOLD > 0) \ - { \ - (_Position) = _SECURECRT_FILL_BUFFER_PATTERN; \ - } -#else /* _SECURECRT_FILL_BUFFER */ -#define _SECURECRT__FILL_BYTE(_Position) -#endif /* _SECURECRT_FILL_BUFFER */ - -#ifdef __cplusplus -#define _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE extern "C" -#else /* __cplusplus */ -#define _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE -#endif /* __cplusplus */ - -/* helper macros to redirect an mbs function to the corresponding _l version */ -#define _REDIRECT_TO_L_VERSION_1(_ReturnType, _FunctionName, _Type1) \ - _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE \ - _ReturnType __cdecl _FunctionName(_Type1 _Arg1) \ - { \ - return _FunctionName##_l(_Arg1, NULL); \ - } - -#define _REDIRECT_TO_L_VERSION_2(_ReturnType, _FunctionName, _Type1, _Type2) \ - _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE \ - _ReturnType __cdecl _FunctionName(_Type1 _Arg1, _Type2 _Arg2) \ - { \ - return _FunctionName##_l(_Arg1, _Arg2, NULL); \ - } - -#define _REDIRECT_TO_L_VERSION_3(_ReturnType, _FunctionName, _Type1, _Type2, _Type3) \ - _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE \ - _ReturnType __cdecl _FunctionName(_Type1 _Arg1, _Type2 _Arg2, _Type3 _Arg3) \ - { \ - return _FunctionName##_l(_Arg1, _Arg2, _Arg3, NULL); \ - } - -#define _REDIRECT_TO_L_VERSION_4(_ReturnType, _FunctionName, _Type1, _Type2, _Type3, _Type4) \ - _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE \ - _ReturnType __cdecl _FunctionName(_Type1 _Arg1, _Type2 _Arg2, _Type3 _Arg3, _Type4 _Arg4) \ - { \ - return _FunctionName##_l(_Arg1, _Arg2, _Arg3, _Arg4, NULL); \ - } - -#define _REDIRECT_TO_L_VERSION_5(_ReturnType, _FunctionName, _Type1, _Type2, _Type3, _Type4, _Type5) \ - _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE \ - _ReturnType __cdecl _FunctionName(_Type1 _Arg1, _Type2 _Arg2, _Type3 _Arg3, _Type4 _Arg4, _Type5 _Arg5) \ - { \ - return _FunctionName##_l(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, NULL); \ - } - -#define _REDIRECT_TO_L_VERSION_6(_ReturnType, _FunctionName, _Type1, _Type2, _Type3, _Type4, _Type5, _Type6) \ - _REDIRECT_TO_L_VERSION_FUNC_PROLOGUE \ - _ReturnType __cdecl _FunctionName(_Type1 _Arg1, _Type2 _Arg2, _Type3 _Arg3, _Type4 _Arg4, _Type5 _Arg5, _Type6 _Arg6) \ - { \ - return _FunctionName##_l(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, NULL); \ - } - -/* internal helper functions for encoding and decoding pointers */ -void __cdecl _init_pointers(); -_CRTIMP void * __cdecl _encode_pointer(void *); -_CRTIMP void * __cdecl _encoded_null(); -_CRTIMP void * __cdecl _decode_pointer(void *); - -/* internal helper function for communicating with the debugger */ -BOOL DebuggerKnownHandle(); - -#define _ERRCHECK(e) \ - _INVOKE_WATSON_IF_ERROR(e) - -#define _ERRCHECK_EINVAL(e) \ - _INVOKE_WATSON_IF_ONEOF(e, EINVAL, EINVAL) - -#define _ERRCHECK_EINVAL_ERANGE(e) \ - _INVOKE_WATSON_IF_ONEOF(e, EINVAL, ERANGE) - -#define _ERRCHECK_SPRINTF(_PrintfCall) \ - { \ - errno_t _SaveErrno = errno; \ - errno = 0; \ - if ( ( _PrintfCall ) < 0) \ - { \ - _ERRCHECK_EINVAL_ERANGE(errno); \ - } \ - errno = _SaveErrno; \ - } - -/* internal helper function to access environment variable in read-only mode */ -const char16_t * __cdecl _wgetenv_helper_nolock(const char16_t *); -const char * __cdecl _getenv_helper_nolock(const char *); - -/* internal helper routines used to query a PE image header. */ -BOOL __cdecl _ValidateImageBase(PBYTE pImageBase); -PIMAGE_SECTION_HEADER __cdecl _FindPESection(PBYTE pImageBase, DWORD_PTR rva); -BOOL __cdecl _IsNonwritableInCurrentImage(PBYTE pTarget); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#ifdef _MSC_VER -#pragma pack(pop) -#endif /* _MSC_VER */ - -#endif /* _INC_INTERNAL */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal_securecrt.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal_securecrt.h index f5117457c..1c323efe0 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal_securecrt.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/internal_securecrt.h @@ -71,8 +71,6 @@ #define _TRUNCATE ((size_t)-1) #endif /* !defined (_TRUNCATE) */ -/* #include */ - #define _VALIDATE_RETURN_VOID( expr, errorcode ) \ { \ int _Expr_val=!!(expr); \ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/strlen_s.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/strlen_s.cpp deleted file mode 100644 index 0c35d3625..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/strlen_s.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*strlen_s.c - contains strnlen() routine -* - -* -*Purpose: -* strnlen returns the length of a null-terminated string, -* not including the null byte itself, up to the specified max size -* -*******************************************************************************/ - - -#include -#include -#include -#include "internal_securecrt.h" - -#include "mbusafecrt_internal.h" - -/*** -*strnlen - return the length of a null-terminated string -* -*Purpose: -* Finds the length in bytes of the given string, not including -* the final null character. Only the first maxsize characters -* are inspected: if the null character is not found, maxsize is -* returned. -* -*Entry: -* const char * str - string whose length is to be computed -* size_t maxsize -* -*Exit: -* Length of the string "str", exclusive of the final null byte, or -* maxsize if the null character is not found. -* -*Exceptions: -* -*******************************************************************************/ - -size_t __cdecl PAL_strnlen(const char *str, size_t maxsize) -{ - size_t n; - - /* Note that we do not check if str == NULL, because we do not - * return errno_t... - */ - - for (n = 0; n < maxsize && *str; n++, str++) - ; - - return n; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/strtok_s.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/strtok_s.cpp deleted file mode 100644 index c183ad5ab..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/strtok_s.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*strtok_s.c - tokenize a string with given delimiters -* - -* -*Purpose: -* defines strtok_s() - breaks string into series of token -* via repeated calls. -* -*******************************************************************************/ - -#include -#include -#include -#include "internal_securecrt.h" - -#include "mbusafecrt_internal.h" - -#define _FUNC_PROLOGUE -#define _FUNC_NAME strtok_s -#define _CHAR char - -#include "tcstok_s.inl" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/tcstok_s.inl b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/tcstok_s.inl deleted file mode 100644 index f3ed934c1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/tcstok_s.inl +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*tcstok_s.inl - general implementation of _tcstok_s -* - -* -*Purpose: -* This file contains the general algorithm for strtok_s and its variants. -* -****/ - -_FUNC_PROLOGUE -_CHAR * __cdecl _FUNC_NAME(_CHAR *_String, const _CHAR *_Control, _CHAR **_Context) -{ - _CHAR *token; - const _CHAR *ctl; - - /* validation section */ - _VALIDATE_POINTER_ERROR_RETURN(_Context, EINVAL, NULL); - _VALIDATE_POINTER_ERROR_RETURN(_Control, EINVAL, NULL); - _VALIDATE_CONDITION_ERROR_RETURN(_String != NULL || *_Context != NULL, EINVAL, NULL); - - /* If string==NULL, continue with previous string */ - if (!_String) - { - _String = *_Context; - } - - /* Find beginning of token (skip over leading delimiters). Note that - * there is no token iff this loop sets string to point to the terminal null. */ - for ( ; *_String != 0 ; _String++) - { - for (ctl = _Control; *ctl != 0 && *ctl != *_String; ctl++) - ; - if (*ctl == 0) - { - break; - } - } - - token = _String; - - /* Find the end of the token. If it is not the end of the string, - * put a null there. */ - for ( ; *_String != 0 ; _String++) - { - for (ctl = _Control; *ctl != 0 && *ctl != *_String; ctl++) - ; - if (*ctl != 0) - { - *_String++ = 0; - break; - } - } - - /* Update the context */ - *_Context = _String; - - /* Determine if a token has been found. */ - if (token == _String) - { - return NULL; - } - else - { - return token; - } -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/wcstok_s.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/wcstok_s.cpp deleted file mode 100644 index 83751d656..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/wcstok_s.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*wcstok_s.c - tokenize a wide-character string with given delimiters -* - -* -*Purpose: -* defines wcstok_s() - breaks wide-character string into series of token -* via repeated calls. -* -*******************************************************************************/ - -#include -#include -#include -#include "internal_securecrt.h" - -#include "mbusafecrt_internal.h" - -#define _FUNC_PROLOGUE -#define _FUNC_NAME wcstok_s -#define _CHAR char16_t - -#include "tcstok_s.inl" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtoa_s.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtoa_s.cpp deleted file mode 100644 index e535b1b38..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtoa_s.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*strtok_s.c - tokenize a string with given delimiters -* - -* -*Purpose: -* defines strtok_s() - breaks string into series of token -* via repeated calls. -* -*******************************************************************************/ -#include "pal/palinternal.h" -#include -#include -#include -#include "internal_securecrt.h" - -#include "mbusafecrt_internal.h" - -//#define __int64 long long - -#define _SECURE_ITOA - -#define TCHAR char -#define _T(x) x -#include "xtox_s.inl" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtow_s.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtow_s.cpp deleted file mode 100644 index 4a5d07753..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtow_s.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*strtok_s.c - tokenize a string with given delimiters -* - -* -*Purpose: -* defines strtok_s() - breaks string into series of token -* via repeated calls. -* -*******************************************************************************/ - -#include -#include -#include -#include "internal_securecrt.h" - -#include "mbusafecrt_internal.h" - -#define _SECURE_ITOA - -#define _UNICODE -#define TCHAR char16_t -#define _T(x) L##x -#include "xtox_s.inl" diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtox_s.inl b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtox_s.inl deleted file mode 100644 index f2284fa4a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/safecrt/xtox_s.inl +++ /dev/null @@ -1,414 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*** -*xtoa.c - convert integers/longs to ASCII string -* - -* -*Purpose: -* The module has code to convert integers/longs to ASCII strings. See -* -*******************************************************************************/ - -#ifdef _UNICODE -#define xtox_s xtow_s -#define _itox_s _itow_s -#define _ltox_s _ltow_s -#define _ultox_s _ultow_s -#define _i64tox_s _i64tow_s -#define xtox xtow -#define _ltox _ltow -#define _ultox _ultow -#else /* _UNICODE */ -#define xtox_s xtoa_s -#define _itox_s _itoa_s -#define _ltox_s _ltoa_s -#define _ultox_s _ultoa_s -#define _i64tox_s _i64toa_s -#define xtox xtoa -#define _ltox _ltoa -#define _ultox _ultoa -#endif /* _UNICODE */ - -/*** -*char *_itoa_s, *_ltoa_s, *_ultoa_s(val, buf, sizeInTChars, radix) - convert binary int to ASCII -* string -* -*Purpose: -* Converts an int to a character string. -* -*Entry: -* val - number to be converted (int, long or unsigned long) -* char *buf - ptr to buffer to place result -* size_t sizeInTChars - size of the destination buffer -* int radix - base to convert into -* -*Exit: -* Fills in space pointed to by buf with string result. -* Returns the errno_t: err != 0 means that something went wrong, and -* an empty string (buf[0] = 0) is returned. -* -*Exceptions: -* Input parameters and buffer length are validated. -* Refer to the validation section of the function. -* -*******************************************************************************/ - -/* helper routine that does the main job. */ -#ifdef _SECURE_ITOA -static errno_t __stdcall xtox_s - ( - unsigned long val, - TCHAR *buf, - size_t sizeInTChars, - unsigned radix, - int is_neg - ) -#else /* _SECURE_ITOA */ -static void __stdcall xtox - ( - unsigned long val, - TCHAR *buf, - unsigned radix, - int is_neg - ) -#endif /* _SECURE_ITOA */ -{ - TCHAR *p; /* pointer to traverse string */ - TCHAR *firstdig; /* pointer to first digit */ - TCHAR temp; /* temp char */ - unsigned digval; /* value of digit */ -#ifdef _SECURE_ITOA - size_t length; /* current length of the string */ - - /* validation section */ - _VALIDATE_RETURN_ERRCODE(buf != NULL, EINVAL); - _VALIDATE_RETURN_ERRCODE(sizeInTChars > 0, EINVAL); - _RESET_STRING(buf, sizeInTChars); - _VALIDATE_RETURN_ERRCODE(sizeInTChars > (size_t)(is_neg ? 2 : 1), ERANGE); - _VALIDATE_RETURN_ERRCODE(2 <= radix && radix <= 36, EINVAL); - length = 0; - -#endif /* _SECURE_ITOA */ - p = buf; - - if (is_neg) { - /* negative, so output '-' and negate */ - *p++ = _T('-'); -#ifdef _SECURE_ITOA - length++; -#endif /* _SECURE_ITOA */ - val = (unsigned long)(-(long)val); - } - - firstdig = p; /* save pointer to first digit */ - - do { - digval = (unsigned) (val % radix); - val /= radix; /* get next digit */ - - /* convert to ascii and store */ - if (digval > 9) - *p++ = (TCHAR) (digval - 10 + _T('a')); /* a letter */ - else - *p++ = (TCHAR) (digval + _T('0')); /* a digit */ -#ifndef _SECURE_ITOA - } while (val > 0); -#else /* _SECURE_ITOA */ - length++; - } while (val > 0 && length < sizeInTChars); - - /* Check for buffer overrun */ - if (length >= sizeInTChars) - { - buf[0] = '\0'; - _VALIDATE_RETURN_ERRCODE(length < sizeInTChars, ERANGE); - } -#endif /* _SECURE_ITOA */ - /* We now have the digit of the number in the buffer, but in reverse - order. Thus we reverse them now. */ - - *p-- = _T('\0'); /* terminate string; p points to last digit */ - - do { - temp = *p; - *p = *firstdig; - *firstdig = temp; /* swap *p and *firstdig */ - --p; - ++firstdig; /* advance to next two digits */ - } while (firstdig < p); /* repeat until halfway */ -#ifdef _SECURE_ITOA - return 0; -#endif /* _SECURE_ITOA */ -} - -/* Actual functions just call conversion helper with neg flag set correctly, - and return pointer to buffer. */ - -#ifdef _SECURE_ITOA -DLLEXPORT errno_t __cdecl _itox_s ( - int val, - TCHAR *buf, - size_t sizeInTChars, - int radix - ) -{ - errno_t e = 0; - - if (radix == 10 && val < 0) - e = xtox_s((unsigned long)val, buf, sizeInTChars, radix, 1); - else - e = xtox_s((unsigned long)(unsigned int)val, buf, sizeInTChars, radix, 0); - - return e; -} - -errno_t __cdecl _ltox_s ( - long val, - TCHAR *buf, - size_t sizeInTChars, - int radix - ) -{ - return xtox_s((unsigned long)val, buf, sizeInTChars, radix, (radix == 10 && val < 0)); -} - -errno_t __cdecl _ultox_s ( - unsigned long val, - TCHAR *buf, - size_t sizeInTChars, - int radix - ) -{ - return xtox_s(val, buf, sizeInTChars, radix, 0); -} - -#else /* _SECURE_ITOA */ - -/*** -*char *_itoa, *_ltoa, *_ultoa(val, buf, radix) - convert binary int to ASCII -* string -* -*Purpose: -* Converts an int to a character string. -* -*Entry: -* val - number to be converted (int, long or unsigned long) -* int radix - base to convert into -* char *buf - ptr to buffer to place result -* -*Exit: -* fills in space pointed to by buf with string result -* returns a pointer to this buffer -* -*Exceptions: -* Input parameters are validated. The buffer is assumed to be big enough to -* contain the string. Refer to the validation section of the function. -* -*******************************************************************************/ - -/* Actual functions just call conversion helper with neg flag set correctly, - and return pointer to buffer. */ - -TCHAR * __cdecl _ltox ( - long val, - TCHAR *buf, - int radix - ) -{ - xtox((unsigned long)val, buf, radix, (radix == 10 && val < 0)); - return buf; -} - -TCHAR * __cdecl _ultox ( - unsigned long val, - TCHAR *buf, - int radix - ) -{ - xtox(val, buf, radix, 0); - return buf; -} - -#endif /* _SECURE_ITOA */ - -#ifndef _NO_INT64 - -/*** -*char *_i64toa_s(val, buf, sizeInTChars, radix) - convert binary int to ASCII -* string -* -*Purpose: -* Converts an int64 to a character string. -* -*Entry: -* val - number to be converted -* char *buf - ptr to buffer to place result -* size_t sizeInTChars - size of the destination buffer -* int radix - base to convert into -* -*Exit: -* Fills in space pointed to by buf with string result. -* Returns the errno_t: err != 0 means that something went wrong, and -* an empty string (buf[0] = 0) is returned. -* -*Exceptions: -* Input parameters and buffer length are validated. -* Refer to the validation section of the function. -* -*******************************************************************************/ - -#ifdef _SECURE_ITOA -static errno_t __fastcall x64tox_s - (/* stdcall is faster and smaller... Might as well use it for the helper. */ - unsigned __int64 val, - TCHAR *buf, - size_t sizeInTChars, - unsigned radix, - int is_neg - ) -#else /* _SECURE_ITOA */ -static void __fastcall x64tox - (/* stdcall is faster and smaller... Might as well use it for the helper. */ - unsigned __int64 val, - TCHAR *buf, - unsigned radix, - int is_neg - ) -#endif /* _SECURE_ITOA */ -{ - TCHAR *p; /* pointer to traverse string */ - TCHAR *firstdig; /* pointer to first digit */ - TCHAR temp; /* temp char */ - unsigned digval; /* value of digit */ -#ifdef _SECURE_ITOA - size_t length; /* current length of the string */ - - /* validation section */ - _VALIDATE_RETURN_ERRCODE(buf != NULL, EINVAL); - _VALIDATE_RETURN_ERRCODE(sizeInTChars > 0, EINVAL); - _RESET_STRING(buf, sizeInTChars); - _VALIDATE_RETURN_ERRCODE(sizeInTChars > (size_t)(is_neg ? 2 : 1), ERANGE); - _VALIDATE_RETURN_ERRCODE(2 <= radix && radix <= 36, EINVAL); - length = 0; -#endif /* _SECURE_ITOA */ - p = buf; - - if ( is_neg ) - { - *p++ = _T('-'); /* negative, so output '-' and negate */ -#ifdef _SECURE_ITOA - length++; -#endif /* _SECURE_ITOA */ - val = (unsigned __int64)(-(__int64)val); - } - - firstdig = p; /* save pointer to first digit */ - - do { - digval = (unsigned) (val % radix); - val /= radix; /* get next digit */ - - /* convert to ascii and store */ - if (digval > 9) - *p++ = (TCHAR) (digval - 10 + _T('a')); /* a letter */ - else - *p++ = (TCHAR) (digval + _T('0')); /* a digit */ - -#ifndef _SECURE_ITOA - } while (val > 0); -#else /* _SECURE_ITOA */ - length++; - } while (val > 0 && length < sizeInTChars); - - /* Check for buffer overrun */ - if (length >= sizeInTChars) - { - buf[0] = '\0'; - _VALIDATE_RETURN_ERRCODE(length < sizeInTChars, ERANGE); - } -#endif /* _SECURE_ITOA */ - /* We now have the digit of the number in the buffer, but in reverse - order. Thus we reverse them now. */ - - *p-- = _T('\0'); /* terminate string; p points to last digit */ - - do { - temp = *p; - *p = *firstdig; - *firstdig = temp; /* swap *p and *firstdig */ - --p; - ++firstdig; /* advance to next two digits */ - } while (firstdig < p); /* repeat until halfway */ - -#ifdef _SECURE_ITOA - return 0; -#endif /* _SECURE_ITOA */ -} - -#ifdef _SECURE_ITOA - -/* Actual functions just call conversion helper with neg flag set correctly, - and return pointer to buffer. */ - -DLLEXPORT errno_t __cdecl _i64tox_s ( - long long val, - TCHAR *buf, - size_t sizeInTChars, - int radix - ) -{ - return x64tox_s((unsigned __int64)val, buf, sizeInTChars, radix, (radix == 10 && val < 0)); -} - -errno_t __cdecl _ui64tox_s ( - unsigned long long val, - TCHAR *buf, - size_t sizeInTChars, - int radix - ) -{ - return x64tox_s(val, buf, sizeInTChars, radix, 0); -} - -#else /* _SECURE_ITOA */ - -/*** -*char *_i64toa(val, buf, radix) - convert binary int to ASCII -* string -* -*Purpose: -* Converts an int64 to a character string. -* -*Entry: -* val - number to be converted -* int radix - base to convert into -* char *buf - ptr to buffer to place result -* -*Exit: -* fills in space pointed to by buf with string result -* returns a pointer to this buffer -* -*Exceptions: -* Input parameters are validated. The buffer is assumed to be big enough to -* contain the string. Refer to the validation section of the function. -* -*******************************************************************************/ - -/* Actual functions just call conversion helper with neg flag set correctly, - and return pointer to buffer. */ - -TCHAR * __cdecl _ui64tox ( - unsigned __int64 val, - TCHAR *buf, - int radix - ) -{ - x64tox(val, buf, radix, 0); - return buf; -} - -#endif /* _SECURE_ITOA */ - -#endif /* _NO_INT64 */ diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sharedmemory/sharedmemory.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sharedmemory/sharedmemory.cpp index ba9447b88..1ec856585 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sharedmemory/sharedmemory.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sharedmemory/sharedmemory.cpp @@ -7,7 +7,6 @@ SET_DEFAULT_DEBUG_CHANNEL(SHMEM); // some headers have code with asserts, so do #include "pal/sharedmemory.h" #include "pal/file.hpp" -#include "pal/malloc.hpp" #include "pal/thread.hpp" #include "pal/virtual.h" #include "pal/process.h" @@ -26,8 +25,6 @@ SET_DEFAULT_DEBUG_CHANNEL(SHMEM); // some headers have code with asserts, so do using namespace CorUnix; -#include "pal/sharedmemory.inl" - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // AutoFreeBuffer @@ -128,11 +125,14 @@ void SharedMemorySystemCallErrors::Append(LPCSTR format, ...) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SharedMemoryHelpers -const mode_t SharedMemoryHelpers::PermissionsMask_CurrentUser_ReadWriteExecute = S_IRUSR | S_IWUSR | S_IXUSR; +const mode_t SharedMemoryHelpers::PermissionsMask_OwnerUser_ReadWrite = S_IRUSR | S_IWUSR; +const mode_t SharedMemoryHelpers::PermissionsMask_OwnerUser_ReadWriteExecute = S_IRUSR | S_IWUSR | S_IXUSR; +const mode_t SharedMemoryHelpers::PermissionsMask_NonOwnerUsers_Write = S_IWGRP | S_IWOTH; const mode_t SharedMemoryHelpers::PermissionsMask_AllUsers_ReadWrite = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; const mode_t SharedMemoryHelpers::PermissionsMask_AllUsers_ReadWriteExecute = PermissionsMask_AllUsers_ReadWrite | (S_IXUSR | S_IXGRP | S_IXOTH); +const mode_t SharedMemoryHelpers::PermissionsMask_Sticky = S_ISVTX; const UINT32 SharedMemoryHelpers::InvalidProcessId = static_cast(-1); const SIZE_T SharedMemoryHelpers::InvalidThreadId = static_cast(-1); const UINT64 SharedMemoryHelpers::InvalidSharedThreadId = static_cast(-1); @@ -162,15 +162,20 @@ SIZE_T SharedMemoryHelpers::AlignUp(SIZE_T value, SIZE_T alignment) bool SharedMemoryHelpers::EnsureDirectoryExists( SharedMemorySystemCallErrors *errors, const char *path, + const SharedMemoryId *id, bool isGlobalLockAcquired, bool createIfNotExist, bool isSystemDirectory) { _ASSERTE(path != nullptr); + _ASSERTE(id != nullptr); _ASSERTE(!(isSystemDirectory && createIfNotExist)); // should not create or change permissions on system directories _ASSERTE(SharedMemoryManager::IsCreationDeletionProcessLockAcquired()); _ASSERTE(!isGlobalLockAcquired || SharedMemoryManager::IsCreationDeletionFileLockAcquired()); + mode_t permissionsMask = + id->IsUserScope() ? PermissionsMask_OwnerUser_ReadWriteExecute : PermissionsMask_AllUsers_ReadWriteExecute; + // Check if the path already exists struct stat statInfo; int statResult = stat(path, &statInfo); @@ -190,15 +195,16 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( if (isGlobalLockAcquired) { - int operationResult = mkdir(path, PermissionsMask_AllUsers_ReadWriteExecute); + int operationResult = mkdir(path, permissionsMask); if (operationResult != 0) { if (errors != nullptr) { int errorCode = errno; errors->Append( - "mkdir(\"%s\", AllUsers_ReadWriteExecute) == %d; errno == %s;", + "mkdir(\"%s\", %s_ReadWriteExecute) == %d; errno == %s;", path, + id->IsUserScope() ? "OwnerUser" : "AllUsers", operationResult, GetFriendlyErrorCodeString(errorCode)); } @@ -206,15 +212,16 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( throw SharedMemoryException(static_cast(SharedMemoryError::IO)); } - operationResult = ChangeMode(path, PermissionsMask_AllUsers_ReadWriteExecute); + operationResult = ChangeMode(path, permissionsMask); if (operationResult != 0) { if (errors != nullptr) { int errorCode = errno; errors->Append( - "chmod(\"%s\", AllUsers_ReadWriteExecute) == %d; errno == %s;", + "chmod(\"%s\", %s_ReadWriteExecute) == %d; errno == %s;", path, + id->IsUserScope() ? "OwnerUser" : "AllUsers", operationResult, GetFriendlyErrorCodeString(errorCode)); } @@ -227,7 +234,7 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( } PathCharString tempPath; - BuildSharedFilesPath(tempPath, SHARED_MEMORY_UNIQUE_TEMP_NAME_TEMPLATE); + VerifyStringOperation(tempPath.Set(*gSharedFilesPath) && tempPath.Append(SHARED_MEMORY_UNIQUE_TEMP_NAME_TEMPLATE)); if (mkdtemp(tempPath.OpenStringBuffer()) == nullptr) { @@ -243,15 +250,16 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( throw SharedMemoryException(static_cast(SharedMemoryError::IO)); } - int operationResult = ChangeMode(tempPath, PermissionsMask_AllUsers_ReadWriteExecute); + int operationResult = ChangeMode(tempPath, permissionsMask); if (operationResult != 0) { if (errors != nullptr) { int errorCode = errno; errors->Append( - "chmod(\"%s\", AllUsers_ReadWriteExecute) == %d; errno == %s;", + "chmod(\"%s\", %s_ReadWriteExecute) == %d; errno == %s;", (const char *)tempPath, + id->IsUserScope() ? "OwnerUser" : "AllUsers", operationResult, GetFriendlyErrorCodeString(errorCode)); } @@ -301,12 +309,21 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( if (isSystemDirectory) { // For system directories (such as TEMP_DIRECTORY_PATH), require sufficient permissions only for the - // current user. For instance, "docker run --mount ..." to mount /tmp to some directory on the host mounts the + // owner user. For instance, "docker run --mount ..." to mount /tmp to some directory on the host mounts the // destination directory with the same permissions as the source directory, which may not include some permissions for // other users. In the docker container, other user permissions are typically not relevant and relaxing the permissions // requirement allows for that scenario to work without having to work around it by first giving sufficient permissions // for all users. - if ((statInfo.st_mode & PermissionsMask_CurrentUser_ReadWriteExecute) == PermissionsMask_CurrentUser_ReadWriteExecute) + // + // If the directory is being used for user-scoped shared memory data, also ensure that either it has the sticky bit or + // it's owned by the current user and without write access for other users. + permissionsMask = PermissionsMask_OwnerUser_ReadWriteExecute; + if ((statInfo.st_mode & permissionsMask) == permissionsMask && + ( + !id->IsUserScope() || + statInfo.st_mode & PermissionsMask_Sticky || + (statInfo.st_uid == id->GetUserScopeUid() && !(statInfo.st_mode & PermissionsMask_NonOwnerUsers_Write)) + )) { return true; } @@ -314,38 +331,71 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( if (errors != nullptr) { errors->Append( - "stat(\"%s\", &info) == 0; info.st_mode == 0x%x; (info.st_mode & CurrentUser_ReadWriteExecute) != CurrentUser_ReadWriteExecute;", + "stat(\"%s\", &info) == 0; info.st_mode == 0x%x; info.st_uid == %u; info.st_mode || info.st_uid;", path, - (int)statInfo.st_mode); + (int)statInfo.st_mode, + (int)statInfo.st_uid); + } + + throw SharedMemoryException(static_cast(SharedMemoryError::IO)); + } + + // For non-system directories (such as gSharedFilesPath/SHARED_MEMORY_USER_UNSCOPED_RUNTIME_TEMP_DIRECTORY_NAME), + // require the sufficient permissions and try to update them if requested to create the directory, so that + // shared memory files may be shared according to its scope. + + // For user-scoped directories, verify the owner UID + if (id->IsUserScope() && statInfo.st_uid != id->GetUserScopeUid()) + { + if (errors != nullptr) + { + errors->Append( + "stat(\"%s\", &info) == 0; info.st_uid == %u; info.st_uid != %u;", + path, + (int)statInfo.st_uid, + (int)id->GetUserScopeUid()); } throw SharedMemoryException(static_cast(SharedMemoryError::IO)); } - // For non-system directories (such as gSharedFilesPath/SHARED_MEMORY_RUNTIME_TEMP_DIRECTORY_NAME), - // require sufficient permissions for all users and try to update them if requested to create the directory, so that - // shared memory files may be shared by all processes on the system. - if ((statInfo.st_mode & PermissionsMask_AllUsers_ReadWriteExecute) == PermissionsMask_AllUsers_ReadWriteExecute) + // Verify the permissions, or try to change them if possible + if ((statInfo.st_mode & PermissionsMask_AllUsers_ReadWriteExecute) == permissionsMask || + (createIfNotExist && ChangeMode(path, permissionsMask) == 0)) { return true; } - if (!createIfNotExist || ChangeMode(path, PermissionsMask_AllUsers_ReadWriteExecute) != 0) + + // We were not able to verify or set the necessary permissions. For user-scoped directories, this is treated as a failure + // since other users aren't sufficiently restricted in permissions. + if (id->IsUserScope()) { - // We were not asked to create the path or we weren't able to set the new permissions. - // As a last resort, check that at least the current user has full access. - if ((statInfo.st_mode & PermissionsMask_CurrentUser_ReadWriteExecute) != PermissionsMask_CurrentUser_ReadWriteExecute) + if (errors != nullptr) { - if (errors != nullptr) - { - errors->Append( - "stat(\"%s\", &info) == 0; info.st_mode == 0x%x; (info.st_mode & CurrentUser_ReadWriteExecute) != CurrentUser_ReadWriteExecute;", - path, - (int)statInfo.st_mode); - } + errors->Append( + "stat(\"%s\", &info) == 0; info.st_mode == 0x%x; (info.st_mode & AllUsers_ReadWriteExecute) != OwnerUser_ReadWriteExecute;", + path, + (int)statInfo.st_mode); + } - throw SharedMemoryException(static_cast(SharedMemoryError::IO)); + throw SharedMemoryException(static_cast(SharedMemoryError::IO)); + } + + // For user-unscoped directories, as a last resort, check that at least the owner user has full access. + permissionsMask = PermissionsMask_OwnerUser_ReadWriteExecute; + if ((statInfo.st_mode & permissionsMask) != permissionsMask) + { + if (errors != nullptr) + { + errors->Append( + "stat(\"%s\", &info) == 0; info.st_mode == 0x%x; (info.st_mode & OwnerUser_ReadWriteExecute) != OwnerUser_ReadWriteExecute;", + path, + (int)statInfo.st_mode); } + + throw SharedMemoryException(static_cast(SharedMemoryError::IO)); } + return true; } @@ -413,6 +463,7 @@ int SharedMemoryHelpers::OpenDirectory(SharedMemorySystemCallErrors *errors, LPC int SharedMemoryHelpers::CreateOrOpenFile( SharedMemorySystemCallErrors *errors, LPCSTR path, + const SharedMemoryId *id, bool createIfNotExist, bool *createdRef) { @@ -426,12 +477,64 @@ int SharedMemoryHelpers::CreateOrOpenFile( int fileDescriptor = Open(errors, path, openFlags); if (fileDescriptor != -1) { + // For user-scoped files, verify the owner UID and permissions + if (id->IsUserScope()) + { + struct stat statInfo; + int statResult = fstat(fileDescriptor, &statInfo); + if (statResult != 0) + { + if (errors != nullptr) + { + int errorCode = errno; + errors->Append( + "fstat(\"%s\", ...) == %d; errno == %s;", + path, + statResult, + GetFriendlyErrorCodeString(errorCode)); + } + + CloseFile(fileDescriptor); + throw SharedMemoryException((DWORD)SharedMemoryError::IO); + } + + if (statInfo.st_uid != id->GetUserScopeUid()) + { + if (errors != nullptr) + { + errors->Append( + "fstat(\"%s\", &info) == 0; info.st_uid == %u; info.st_uid != %u;", + path, + (int)statInfo.st_uid, + (int)id->GetUserScopeUid()); + } + + CloseFile(fileDescriptor); + throw SharedMemoryException((DWORD)SharedMemoryError::IO); + } + + if ((statInfo.st_mode & PermissionsMask_AllUsers_ReadWriteExecute) != PermissionsMask_OwnerUser_ReadWrite) + { + if (errors != nullptr) + { + errors->Append( + "fstat(\"%s\", &info) == 0; info.st_mode == 0x%x; (info.st_mode & AllUsers_ReadWriteExecute) != OwnerUser_ReadWrite;", + path, + (int)statInfo.st_mode); + } + + CloseFile(fileDescriptor); + throw SharedMemoryException((DWORD)SharedMemoryError::IO); + } + } + if (createdRef != nullptr) { *createdRef = false; } return fileDescriptor; } + _ASSERTE(errno == ENOENT); if (!createIfNotExist) { @@ -444,20 +547,22 @@ int SharedMemoryHelpers::CreateOrOpenFile( // File does not exist, create the file openFlags |= O_CREAT | O_EXCL; - fileDescriptor = Open(errors, path, openFlags, PermissionsMask_AllUsers_ReadWrite); + mode_t permissionsMask = id->IsUserScope() ? PermissionsMask_OwnerUser_ReadWrite : PermissionsMask_AllUsers_ReadWrite; + fileDescriptor = Open(errors, path, openFlags, permissionsMask); _ASSERTE(fileDescriptor != -1); // The permissions mask passed to open() is filtered by the process' permissions umask, so open() may not set all of // the requested permissions. Use chmod() to set the proper permissions. - int operationResult = ChangeMode(path, PermissionsMask_AllUsers_ReadWrite); + int operationResult = ChangeMode(path, permissionsMask); if (operationResult != 0) { if (errors != nullptr) { int errorCode = errno; errors->Append( - "chmod(\"%s\", AllUsers_ReadWrite) == %d; errno == %s;", + "chmod(\"%s\", %s_ReadWrite) == %d; errno == %s;", path, + id->IsUserScope() ? "OwnerUser" : "AllUsers", operationResult, GetFriendlyErrorCodeString(errorCode)); } @@ -477,12 +582,7 @@ int SharedMemoryHelpers::CreateOrOpenFile( void SharedMemoryHelpers::CloseFile(int fileDescriptor) { _ASSERTE(fileDescriptor != -1); - - int closeResult; - do - { - closeResult = close(fileDescriptor); - } while (closeResult != 0 && errno == EINTR); + close(fileDescriptor); } int SharedMemoryHelpers::ChangeMode(LPCSTR path, mode_t mode) @@ -664,14 +764,6 @@ void SharedMemoryHelpers::ReleaseFileLock(int fileDescriptor) } while (flockResult != 0 && errno == EINTR); } -void SharedMemoryHelpers::BuildSharedFilesPath(PathCharString& destination, const char *suffix, int suffixCharCount) -{ - _ASSERTE((int)strlen(suffix) == suffixCharCount); - - VerifyStringOperation(destination.Set(*gSharedFilesPath)); - VerifyStringOperation(destination.Append(suffix, suffixCharCount)); -} - bool SharedMemoryHelpers::AppendUInt32String( PathCharString& destination, UINT32 value) @@ -695,20 +787,12 @@ void SharedMemoryHelpers::VerifyStringOperation(bool success) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SharedMemoryId -SharedMemoryId::SharedMemoryId() : m_name(nullptr) +SharedMemoryId::SharedMemoryId() + : m_name(nullptr), m_nameCharCount(0), m_isSessionScope(false), m_isUserScope(false), m_userScopeUid((uid_t)0) { } -SharedMemoryId::SharedMemoryId(LPCSTR name, SIZE_T nameCharCount, bool isSessionScope) - : m_name(name), m_nameCharCount(nameCharCount), m_isSessionScope(isSessionScope) -{ - _ASSERTE(name != nullptr); - _ASSERTE(nameCharCount != 0); - _ASSERTE(nameCharCount <= SHARED_MEMORY_MAX_FILE_NAME_CHAR_COUNT); - _ASSERTE(strlen(name) == nameCharCount); -} - -SharedMemoryId::SharedMemoryId(LPCSTR name) +SharedMemoryId::SharedMemoryId(LPCSTR name, bool isUserScope) { _ASSERTE(name != nullptr); @@ -747,6 +831,16 @@ SharedMemoryId::SharedMemoryId(LPCSTR name) throw SharedMemoryException(static_cast(SharedMemoryError::NameInvalid)); } } + + m_isUserScope = isUserScope; + m_userScopeUid = isUserScope ? geteuid() : (uid_t)0; + + // The uid_t is converted to UINT32 to create a directory name, verify that it's valid + static_assert_no_msg(sizeof(uid_t) <= sizeof(UINT32)); + if ((uid_t)(UINT32)m_userScopeUid != m_userScopeUid) + { + throw SharedMemoryException(static_cast(SharedMemoryError::IO)); + } } LPCSTR SharedMemoryId::GetName() const @@ -761,20 +855,56 @@ SIZE_T SharedMemoryId::GetNameCharCount() const return m_nameCharCount; } +void SharedMemoryId::ReplaceNamePtr(LPCSTR name) +{ + _ASSERTE(name != nullptr); + _ASSERTE(m_nameCharCount != 0); + _ASSERTE(strlen(name) == m_nameCharCount); + + m_name = name; +} + bool SharedMemoryId::IsSessionScope() const { _ASSERTE(m_name != nullptr); return m_isSessionScope; } -bool SharedMemoryId::Equals(SharedMemoryId *other) const +bool SharedMemoryId::IsUserScope() const +{ + _ASSERTE(m_name != nullptr); + return m_isUserScope; +} + +uid_t SharedMemoryId::GetUserScopeUid() const +{ + _ASSERTE(m_name != nullptr); + _ASSERTE(m_isUserScope); + return m_userScopeUid; +} + +bool SharedMemoryId::Equals(const SharedMemoryId *other) const { return GetNameCharCount() == other->GetNameCharCount() && IsSessionScope() == other->IsSessionScope() && + IsUserScope() == other->IsUserScope() && + (!IsUserScope() || GetUserScopeUid() == other->GetUserScopeUid()) && strcmp(GetName(), other->GetName()) == 0; } +bool SharedMemoryId::AppendRuntimeTempDirectoryName(PathCharString& path) const +{ + if (IsUserScope()) + { + return + path.Append(SHARED_MEMORY_USER_SCOPED_RUNTIME_TEMP_DIRECTORY_NAME_PREFIX) && + SharedMemoryHelpers::AppendUInt32String(path, (UINT32)GetUserScopeUid()); + } + + return path.Append(SHARED_MEMORY_USER_UNSCOPED_RUNTIME_TEMP_DIRECTORY_NAME); +} + bool SharedMemoryId::AppendSessionDirectoryName(PathCharString& path) const { if (IsSessionScope()) @@ -827,6 +957,7 @@ void *SharedMemorySharedDataHeader::GetData() SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( SharedMemorySystemCallErrors *errors, LPCSTR name, + bool isUserScope, SharedMemorySharedDataHeader requiredSharedDataHeader, SIZE_T sharedDataByteCount, bool createIfNotExist, @@ -844,11 +975,11 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( } PathCharString filePath; - SharedMemoryId id(name); + SharedMemoryId id(name, isUserScope); struct AutoCleanup { - bool m_acquiredCreationDeletionFileLock; + const SharedMemoryId *m_acquiredCreationDeletionFileLockForId; PathCharString *m_filePath; SIZE_T m_sessionDirectoryPathCharCount; bool m_createdFile; @@ -859,7 +990,7 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( bool m_cancel; AutoCleanup() - : m_acquiredCreationDeletionFileLock(false), + : m_acquiredCreationDeletionFileLockForId(nullptr), m_filePath(nullptr), m_sessionDirectoryPathCharCount(0), m_createdFile(false), @@ -908,9 +1039,9 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( rmdir(*m_filePath); } - if (m_acquiredCreationDeletionFileLock) + if (m_acquiredCreationDeletionFileLockForId != nullptr) { - SharedMemoryManager::ReleaseCreationDeletionFileLock(); + SharedMemoryManager::ReleaseCreationDeletionFileLock(m_acquiredCreationDeletionFileLockForId); } } } autoCleanup; @@ -925,14 +1056,16 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( return processDataHeader; } - SharedMemoryManager::AcquireCreationDeletionFileLock(errors); - autoCleanup.m_acquiredCreationDeletionFileLock = true; + SharedMemoryManager::AcquireCreationDeletionFileLock(errors, &id); + autoCleanup.m_acquiredCreationDeletionFileLockForId = &id; // Create the session directory - SharedMemoryHelpers::VerifyStringOperation(SharedMemoryManager::CopySharedMemoryBasePath(filePath)); - SharedMemoryHelpers::VerifyStringOperation(filePath.Append('/')); - SharedMemoryHelpers::VerifyStringOperation(id.AppendSessionDirectoryName(filePath)); - if (!SharedMemoryHelpers::EnsureDirectoryExists(errors, filePath, true /* isGlobalLockAcquired */, createIfNotExist)) + SharedMemoryHelpers::VerifyStringOperation( + filePath.Set(*gSharedFilesPath) && + id.AppendRuntimeTempDirectoryName(filePath) && + filePath.Append('/') && filePath.Append(SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME) && + filePath.Append('/') && id.AppendSessionDirectoryName(filePath)); + if (!SharedMemoryHelpers::EnsureDirectoryExists(errors, filePath, &id, true /* isGlobalLockAcquired */, createIfNotExist)) { _ASSERTE(!createIfNotExist); return nullptr; @@ -941,11 +1074,9 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( autoCleanup.m_sessionDirectoryPathCharCount = filePath.GetCount(); // Create or open the shared memory file - SharedMemoryHelpers::VerifyStringOperation(filePath.Append('/')); - SharedMemoryHelpers::VerifyStringOperation(filePath.Append(id.GetName(), id.GetNameCharCount())); - + SharedMemoryHelpers::VerifyStringOperation(filePath.Append('/') && filePath.Append(id.GetName(), id.GetNameCharCount())); bool createdFile; - int fileDescriptor = SharedMemoryHelpers::CreateOrOpenFile(errors, filePath, createIfNotExist, &createdFile); + int fileDescriptor = SharedMemoryHelpers::CreateOrOpenFile(errors, filePath, &id, createIfNotExist, &createdFile); if (fileDescriptor == -1) { _ASSERTE(!createIfNotExist); @@ -1040,8 +1171,8 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( // the shared data. The caller must release the file lock afterwards. if (!createdFile) { - autoCleanup.m_acquiredCreationDeletionFileLock = false; - SharedMemoryManager::ReleaseCreationDeletionFileLock(); + autoCleanup.m_acquiredCreationDeletionFileLockForId = nullptr; + SharedMemoryManager::ReleaseCreationDeletionFileLock(&id); } processDataHeader = SharedMemoryProcessDataHeader::New(&id, fileDescriptor, sharedDataHeader, sharedDataTotalByteCount); @@ -1088,8 +1219,7 @@ void SharedMemoryProcessDataHeader::PalObject_SetProcessDataHeader( void SharedMemoryProcessDataHeader::PalObject_Close( CPalThread *thread, IPalObject *object, - bool isShuttingDown, - bool cleanUpPalSharedState) + bool isShuttingDown) { // This function's signature matches OBJECTCLEANUPROUTINE _ASSERTE(thread != nullptr); @@ -1110,12 +1240,13 @@ void SharedMemoryProcessDataHeader::PalObject_Close( } SharedMemoryProcessDataHeader::SharedMemoryProcessDataHeader( - SharedMemoryId *id, + const SharedMemoryId *id, int fileDescriptor, SharedMemorySharedDataHeader *sharedDataHeader, SIZE_T sharedDataTotalByteCount) : m_refCount(1), + m_id(*id), m_data(nullptr), m_fileDescriptor(fileDescriptor), m_sharedDataHeader(sharedDataHeader), @@ -1133,13 +1264,13 @@ SharedMemoryProcessDataHeader::SharedMemoryProcessDataHeader( char *nameCopy = reinterpret_cast(this + 1); SIZE_T nameByteCount = id->GetNameCharCount() + 1; memcpy_s(nameCopy, nameByteCount, id->GetName(), nameByteCount); - m_id = SharedMemoryId(nameCopy, id->GetNameCharCount(), id->IsSessionScope()); + m_id.ReplaceNamePtr(nameCopy); SharedMemoryManager::AddProcessDataHeader(this); } SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::New( - SharedMemoryId *id, + const SharedMemoryId *id, int fileDescriptor, SharedMemorySharedDataHeader *sharedDataHeader, SIZE_T sharedDataTotalByteCount) @@ -1179,17 +1310,17 @@ void SharedMemoryProcessDataHeader::Close() struct AutoReleaseCreationDeletionFileLock { - bool m_acquired; + const SharedMemoryId *m_acquiredForId; - AutoReleaseCreationDeletionFileLock() : m_acquired(false) + AutoReleaseCreationDeletionFileLock() : m_acquiredForId(nullptr) { } ~AutoReleaseCreationDeletionFileLock() { - if (m_acquired) + if (m_acquiredForId != nullptr) { - SharedMemoryManager::ReleaseCreationDeletionFileLock(); + SharedMemoryManager::ReleaseCreationDeletionFileLock(m_acquiredForId); } } } autoReleaseCreationDeletionFileLock; @@ -1203,8 +1334,8 @@ void SharedMemoryProcessDataHeader::Close() bool releaseSharedData = false; try { - SharedMemoryManager::AcquireCreationDeletionFileLock(nullptr); - autoReleaseCreationDeletionFileLock.m_acquired = true; + SharedMemoryManager::AcquireCreationDeletionFileLock(nullptr, GetId()); + autoReleaseCreationDeletionFileLock.m_acquiredForId = GetId(); SharedMemoryHelpers::ReleaseFileLock(m_fileDescriptor); if (SharedMemoryHelpers::TryAcquireFileLock(nullptr, m_fileDescriptor, LOCK_EX | LOCK_NB)) @@ -1227,7 +1358,7 @@ void SharedMemoryProcessDataHeader::Close() { if (m_data != nullptr) { - InternalDelete(m_data); + delete m_data; } if (releaseSharedData) @@ -1248,11 +1379,12 @@ void SharedMemoryProcessDataHeader::Close() { // Delete the shared memory file, and the session directory if it's not empty PathCharString path; - SharedMemoryHelpers::VerifyStringOperation(SharedMemoryManager::CopySharedMemoryBasePath(path)); - SharedMemoryHelpers::VerifyStringOperation(path.Append('/')); - SharedMemoryHelpers::VerifyStringOperation(m_id.AppendSessionDirectoryName(path)); - SharedMemoryHelpers::VerifyStringOperation(path.Append('/')); - + SharedMemoryHelpers::VerifyStringOperation( + path.Set(*gSharedFilesPath) && + m_id.AppendRuntimeTempDirectoryName(path) && + path.Append('/') && path.Append(SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME) && + path.Append('/') && m_id.AppendSessionDirectoryName(path) && + path.Append('/')); SIZE_T sessionDirectoryPathCharCount = path.GetCount(); SharedMemoryHelpers::VerifyStringOperation(path.Append(m_id.GetName(), m_id.GetNameCharCount())); unlink(path); @@ -1265,7 +1397,7 @@ void SharedMemoryProcessDataHeader::Close() } } -SharedMemoryId *SharedMemoryProcessDataHeader::GetId() +const SharedMemoryId *SharedMemoryProcessDataHeader::GetId() const { return &m_id; } @@ -1338,46 +1470,29 @@ void SharedMemoryProcessDataHeader::DecRefCount() return; } - InternalDelete(this); + delete this; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SharedMemoryManager -CRITICAL_SECTION SharedMemoryManager::s_creationDeletionProcessLock; +minipal_mutex SharedMemoryManager::s_creationDeletionProcessLock; int SharedMemoryManager::s_creationDeletionLockFileDescriptor = -1; +SharedMemoryManager::UserScopeUidAndFileDescriptor *SharedMemoryManager::s_userScopeUidToCreationDeletionLockFDs; +int SharedMemoryManager::s_userScopeUidToCreationDeletionLockFDsCount; +int SharedMemoryManager::s_userScopeUidToCreationDeletionLockFDsCapacity; + SharedMemoryProcessDataHeader *SharedMemoryManager::s_processDataHeaderListHead = nullptr; -PathCharString* SharedMemoryManager::s_runtimeTempDirectoryPath; -PathCharString* SharedMemoryManager::s_sharedMemoryDirectoryPath; #ifdef _DEBUG SIZE_T SharedMemoryManager::s_creationDeletionProcessLockOwnerThreadId = SharedMemoryHelpers::InvalidThreadId; SIZE_T SharedMemoryManager::s_creationDeletionFileLockOwnerThreadId = SharedMemoryHelpers::InvalidThreadId; #endif // _DEBUG -bool SharedMemoryManager::StaticInitialize() +void SharedMemoryManager::StaticInitialize() { - InitializeCriticalSection(&s_creationDeletionProcessLock); - - s_runtimeTempDirectoryPath = InternalNew(); - s_sharedMemoryDirectoryPath = InternalNew(); - - if (s_runtimeTempDirectoryPath && s_sharedMemoryDirectoryPath) - { - try - { - SharedMemoryHelpers::BuildSharedFilesPath(*s_runtimeTempDirectoryPath, SHARED_MEMORY_RUNTIME_TEMP_DIRECTORY_NAME); - SharedMemoryHelpers::BuildSharedFilesPath(*s_sharedMemoryDirectoryPath, SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME); - - return true; - } - catch (SharedMemoryException) - { - // Ignore and let function fail - } - } - return false; + minipal_mutex_init(&s_creationDeletionProcessLock); } void SharedMemoryManager::StaticClose() @@ -1402,7 +1517,7 @@ void SharedMemoryManager::AcquireCreationDeletionProcessLock() _ASSERTE(!IsCreationDeletionProcessLockAcquired()); _ASSERTE(!IsCreationDeletionFileLockAcquired()); - EnterCriticalSection(&s_creationDeletionProcessLock); + minipal_mutex_enter(&s_creationDeletionProcessLock); #ifdef _DEBUG s_creationDeletionProcessLockOwnerThreadId = THREADSilentGetCurrentThreadId(); #endif // _DEBUG @@ -1416,19 +1531,26 @@ void SharedMemoryManager::ReleaseCreationDeletionProcessLock() #ifdef _DEBUG s_creationDeletionProcessLockOwnerThreadId = SharedMemoryHelpers::InvalidThreadId; #endif // _DEBUG - LeaveCriticalSection(&s_creationDeletionProcessLock); + minipal_mutex_leave(&s_creationDeletionProcessLock); } -void SharedMemoryManager::AcquireCreationDeletionFileLock(SharedMemorySystemCallErrors *errors) +void SharedMemoryManager::AcquireCreationDeletionFileLock(SharedMemorySystemCallErrors *errors, const SharedMemoryId *id) { + _ASSERTE(id != nullptr); _ASSERTE(IsCreationDeletionProcessLockAcquired()); _ASSERTE(!IsCreationDeletionFileLockAcquired()); - if (s_creationDeletionLockFileDescriptor == -1) + int creationDeletionLockFD = + id->IsUserScope() ? FindUserScopeCreationDeletionLockFD(id->GetUserScopeUid()) : s_creationDeletionLockFileDescriptor; + if (creationDeletionLockFD == -1) { + // Create the shared files directory + PathCharString dirPath; + SharedMemoryHelpers::VerifyStringOperation(dirPath.Set(*gSharedFilesPath)); if (!SharedMemoryHelpers::EnsureDirectoryExists( errors, - *gSharedFilesPath, + dirPath, + id, false /* isGlobalLockAcquired */, false /* createIfNotExist */, true /* isSystemDirectory */)) @@ -1442,49 +1564,117 @@ void SharedMemoryManager::AcquireCreationDeletionFileLock(SharedMemorySystemCall throw SharedMemoryException(static_cast(SharedMemoryError::IO)); } - SharedMemoryHelpers::EnsureDirectoryExists( - errors, - *s_runtimeTempDirectoryPath, - false /* isGlobalLockAcquired */); + // Create the runtime temp directory + SharedMemoryHelpers::VerifyStringOperation(id->AppendRuntimeTempDirectoryName(dirPath)); + SharedMemoryHelpers::EnsureDirectoryExists(errors, dirPath, id, false /* isGlobalLockAcquired */); - SharedMemoryHelpers::EnsureDirectoryExists( - errors, - *s_sharedMemoryDirectoryPath, - false /* isGlobalLockAcquired */); + // Create the shared memory directory + SharedMemoryHelpers::VerifyStringOperation( + dirPath.Append('/') && dirPath.Append(SHARED_MEMORY_SHARED_MEMORY_DIRECTORY_NAME)); + SharedMemoryHelpers::EnsureDirectoryExists(errors, dirPath, id, false /* isGlobalLockAcquired */); - s_creationDeletionLockFileDescriptor = SharedMemoryHelpers::OpenDirectory(errors, *s_sharedMemoryDirectoryPath); - if (s_creationDeletionLockFileDescriptor == -1) + // Open the shared memory directory + creationDeletionLockFD = SharedMemoryHelpers::OpenDirectory(errors, dirPath); + if (creationDeletionLockFD == -1) { if (errors != nullptr) { int errorCode = errno; errors->Append( "open(\"%s\", O_RDONLY | O_CLOEXEC, 0) == -1; errno == %s;", - (const char *)*s_sharedMemoryDirectoryPath, + (const char *)dirPath, GetFriendlyErrorCodeString(errorCode)); } throw SharedMemoryException(static_cast(SharedMemoryError::IO)); } + + if (id->IsUserScope()) + { + AddUserScopeUidCreationDeletionLockFD(id->GetUserScopeUid(), creationDeletionLockFD); + } + else + { + s_creationDeletionLockFileDescriptor = creationDeletionLockFD; + } } - bool acquiredFileLock = SharedMemoryHelpers::TryAcquireFileLock(errors, s_creationDeletionLockFileDescriptor, LOCK_EX); + bool acquiredFileLock = SharedMemoryHelpers::TryAcquireFileLock(errors, creationDeletionLockFD, LOCK_EX); _ASSERTE(acquiredFileLock); #ifdef _DEBUG s_creationDeletionFileLockOwnerThreadId = THREADSilentGetCurrentThreadId(); #endif // _DEBUG } -void SharedMemoryManager::ReleaseCreationDeletionFileLock() +void SharedMemoryManager::ReleaseCreationDeletionFileLock(const SharedMemoryId *id) { + _ASSERTE(id != nullptr); _ASSERTE(IsCreationDeletionProcessLockAcquired()); _ASSERTE(IsCreationDeletionFileLockAcquired()); - _ASSERTE(s_creationDeletionLockFileDescriptor != -1); + + int creationDeletionLockFD = + id->IsUserScope() ? FindUserScopeCreationDeletionLockFD(id->GetUserScopeUid()) : s_creationDeletionLockFileDescriptor; + _ASSERTE(creationDeletionLockFD != -1); #ifdef _DEBUG s_creationDeletionFileLockOwnerThreadId = SharedMemoryHelpers::InvalidThreadId; #endif // _DEBUG - SharedMemoryHelpers::ReleaseFileLock(s_creationDeletionLockFileDescriptor); + SharedMemoryHelpers::ReleaseFileLock(creationDeletionLockFD); +} + +void SharedMemoryManager::AddUserScopeUidCreationDeletionLockFD(uid_t userScopeUid, int creationDeletionLockFD) +{ + _ASSERTE(IsCreationDeletionProcessLockAcquired()); + _ASSERTE(creationDeletionLockFD != -1); + _ASSERTE(FindUserScopeCreationDeletionLockFD(userScopeUid) == -1); + + int count = s_userScopeUidToCreationDeletionLockFDsCount; + int capacity = s_userScopeUidToCreationDeletionLockFDsCapacity; + if (count >= capacity) + { + int newCapacity = capacity == 0 ? 1 : capacity * 2; + if (newCapacity <= capacity || + newCapacity * sizeof(UserScopeUidAndFileDescriptor) / sizeof(UserScopeUidAndFileDescriptor) != (SIZE_T)newCapacity) + { + throw SharedMemoryException(static_cast(SharedMemoryError::OutOfMemory)); + } + + UserScopeUidAndFileDescriptor *newArray = new(std::nothrow) UserScopeUidAndFileDescriptor[newCapacity]; + if (newArray == nullptr) + { + throw SharedMemoryException(static_cast(SharedMemoryError::OutOfMemory)); + } + + if (count != 0) + { + UserScopeUidAndFileDescriptor *oldArray = s_userScopeUidToCreationDeletionLockFDs; + CopyMemory(newArray, oldArray, count * sizeof(newArray[0])); + delete[] oldArray; + } + + s_userScopeUidToCreationDeletionLockFDs = newArray; + s_userScopeUidToCreationDeletionLockFDsCapacity = newCapacity; + } + + s_userScopeUidToCreationDeletionLockFDs[count] = UserScopeUidAndFileDescriptor(userScopeUid, creationDeletionLockFD); + s_userScopeUidToCreationDeletionLockFDsCount = count + 1; +} + +int SharedMemoryManager::FindUserScopeCreationDeletionLockFD(uid_t userScopeUid) +{ + _ASSERTE(IsCreationDeletionProcessLockAcquired()); + + UserScopeUidAndFileDescriptor *arr = s_userScopeUidToCreationDeletionLockFDs; + for (int i = 0; i < s_userScopeUidToCreationDeletionLockFDsCount; i++) + { + _ASSERTE(arr[i].fileDescriptor != -1); + if (arr[i].userScopeUid == userScopeUid) + { + return arr[i].fileDescriptor; + } + } + + return -1; } #ifdef _DEBUG @@ -1537,7 +1727,7 @@ void SharedMemoryManager::RemoveProcessDataHeader(SharedMemoryProcessDataHeader _ASSERTE(false); } -SharedMemoryProcessDataHeader *SharedMemoryManager::FindProcessDataHeader(SharedMemoryId *id) +SharedMemoryProcessDataHeader *SharedMemoryManager::FindProcessDataHeader(const SharedMemoryId *id) { _ASSERTE(IsCreationDeletionProcessLockAcquired()); @@ -1553,8 +1743,3 @@ SharedMemoryProcessDataHeader *SharedMemoryManager::FindProcessDataHeader(Shared } return nullptr; } - -bool SharedMemoryManager::CopySharedMemoryBasePath(PathCharString& destination) -{ - return destination.Set(*s_sharedMemoryDirectoryPath) != FALSE; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/shmemory/shmemory.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/shmemory/shmemory.cpp deleted file mode 100644 index e2e845c8c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/shmemory/shmemory.cpp +++ /dev/null @@ -1,387 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*++ - - - -Module Name: - - shmemory/shmemory.c - -Abstract: - - Implementation of shared memory infrastructure for IPC - - - ---*/ - -#include "pal/dbgmsg.h" -#include "pal/shmemory.h" -#include "pal/critsect.h" -#include "pal/process.h" - -#if HAVE_YIELD_SYSCALL -#include -#endif /* HAVE_YIELD_SYSCALL */ - -SET_DEFAULT_DEBUG_CHANNEL(SHMEM); - -/* Type definitions ***********************************************************/ - -/* -SHM_HEADER -Global information about the shared memory system - -The spinlock is used to ensure that only one process accesses shared memory at -the same time. A process can only take the spinlock if its contents is 0, and -it takes the spinlock by placing its PID in it. (this allows a process to catch -the special case where it tries to take a spinlock it already owns. -*/ - -typedef struct -{ - Volatile spinlock; - Volatile shm_info[SIID_LAST]; /* basic blocks of shared information.*/ -} SHM_HEADER; - -static SHM_HEADER shm_header; - -/* Static variables ***********************************************************/ - -/* Critical section to ensure that only one thread at a time accesses shared -memory. Rationale : --Using a spinlock means that processes must busy-wait for the lock to be - available. The critical section ensures taht only one thread will busy-wait, - while the rest are put to sleep. --Since the spinlock only contains a PID, it isn't possible to make a difference - between threads of the same process. This could be resolved by using 2 - spinlocks, but this would introduce more busy-wait. -*/ -static CRITICAL_SECTION shm_critsec; - -/* number of locks the process currently holds (SHMLock calls without matching -SHMRelease). Because we take the critical section while inside a -SHMLock/SHMRelease pair, this is actually the number of locks held by a single -thread. */ -static Volatile lock_count; - -/* thread ID of thread holding the SHM lock. used for debugging purposes : - SHMGet/SetInfo will verify that the calling thread holds the lock */ -static Volatile locking_thread; - -/* Public function implementations ********************************************/ - -/*++ -SHMInitialize - -Hook this process into the PAL shared memory system; initialize the shared -memory if no other process has done it. - ---*/ -BOOL SHMInitialize(void) -{ - InternalInitializeCriticalSection(&shm_critsec); - - TRACE("Now initializing global shared memory system\n"); - - InterlockedExchange((LONG *)&shm_header.spinlock, 0); - - /* SHM information array starts with NULLs */ - memset((void *)shm_header.shm_info, 0, SIID_LAST*sizeof(SHMPTR)); - - TRACE("Global shared memory initialization complete.\n"); - - lock_count = 0; - locking_thread = 0; - - return TRUE; -} - -/*++ -SHMCleanup - -Release all shared memory resources held; remove ourselves from the list of -registered processes, and remove all shared memory files if no process remains - -Note that this function does not use thread suspension wrapper for unlink and free -because all thread objects are deleted before this function is called -in PALCommonCleanup. - ---*/ -void SHMCleanup(void) -{ - pid_t my_pid; - - TRACE("Starting shared memory cleanup\n"); - - SHMLock(); - SHMRelease(); - - /* We should not be holding the spinlock at this point. If we are, release - the spinlock. by setting it to 0 */ - my_pid = gPID; - - _ASSERT_MSG(shm_header.spinlock != my_pid, - "SHMCleanup called while the current process still owns the lock " - "[owner thread=%u, current thread: %u]\n", - locking_thread.Load(), THREADSilentGetCurrentThreadId()); - - /* Now for the interprocess stuff. */ - DeleteCriticalSection(&shm_critsec); - - TRACE("SHMCleanup complete!\n"); -} - -/*++ -SHMLock - -Restrict shared memory access to the current thread of the current process - -(no parameters) - -Return value : - New lock count - -Notes : -see comments at the declaration of shm_critsec for rationale of critical -section usage ---*/ -int SHMLock(void) -{ - /* Hold the critical section until the lock is released */ - PALCEnterCriticalSection(&shm_critsec); - - _ASSERTE((0 == lock_count && 0 == locking_thread) || - (0 < lock_count && reinterpret_cast(pthread_self()) == locking_thread)); - - if(lock_count == 0) - { - pid_t my_pid, tmp_pid; - int spincount = 1; - - TRACE("First-level SHM lock : taking spinlock\n"); - - // Store the id of the current thread as the (only) one that is - // trying to grab the spinlock from the current process - locking_thread = reinterpret_cast(pthread_self()); - - my_pid = gPID; - - while(TRUE) - { - // - // Try to grab the spinlock - // - tmp_pid = InterlockedCompareExchange((LONG *) &shm_header.spinlock, my_pid,0); - - if (0 == tmp_pid) - { - // Spinlock acquired: break out of the loop - break; - } - - /* Check if lock holder is alive. If it isn't, we can reset the - spinlock and try to take it again. If it is, we have to wait. - We use "spincount" to do this check only every 8th time through - the loop, for performance reasons.*/ - if( (0 == (spincount&0x7)) && - (-1 == kill(tmp_pid,0)) && - (errno == ESRCH)) - { - TRACE("SHM spinlock owner (%08x) is dead; releasing its lock\n", - tmp_pid); - - InterlockedCompareExchange((LONG *) &shm_header.spinlock, 0, tmp_pid); - } - else - { - /* another process is holding the lock... we want to yield and - give the holder a chance to release the lock - The function sched_yield() only yields to a thread in the - current process; this doesn't help us much, and doesn't help - at all if there's only 1 thread. There doesn't seem to be - any clean way to force a yield to another process, but the - FreeBSD syscall "yield" does the job. We alternate between - both methods to give other threads of this process a chance - to run while we wait. - */ -#if HAVE_YIELD_SYSCALL - if(spincount&1) - { -#endif /* HAVE_YIELD_SYSCALL */ - sched_yield(); -#if HAVE_YIELD_SYSCALL - } - else - { - /* use the syscall first, since we know we'l need to yield - to another process eventually - the lock can't be held - by the current process, thanks to the critical section */ - syscall(SYS_yield, 0); - } -#endif /* HAVE_YIELD_SYSCALL */ - } - - // Increment spincount - spincount++; - } - - _ASSERT_MSG(my_pid == shm_header.spinlock, - "\n(my_pid = %u) != (header->spinlock = %u)\n" - "tmp_pid = %u\n" - "spincount = %d\n" - "locking_thread = %u\n", - (DWORD)my_pid, (DWORD)shm_header.spinlock, - (DWORD)tmp_pid, - (int)spincount, - (HANDLE)locking_thread); - } - - lock_count++; - TRACE("SHM lock level is now %d\n", lock_count.Load()); - return lock_count; -} - -/*++ -SHMRelease - -Release a lock on shared memory taken with SHMLock. - -(no parameters) - -Return value : - New lock count - ---*/ -int SHMRelease(void) -{ - /* prevent a thread from releasing another thread's lock */ - PALCEnterCriticalSection(&shm_critsec); - - if(lock_count==0) - { - ASSERT("SHMRelease called without matching SHMLock!\n"); - PALCLeaveCriticalSection(&shm_critsec); - return 0; - } - - lock_count--; - - _ASSERTE(lock_count >= 0); - - /* If lock count is 0, this call matches the first Lock call; it's time to - set the spinlock back to 0. */ - if(lock_count == 0) - { - pid_t my_pid, tmp_pid; - - TRACE("Releasing first-level SHM lock : resetting spinlock\n"); - - my_pid = gPID; - - /* Make sure we don't touch the spinlock if we don't own it. We're - supposed to own it if we get here, but just in case... */ - tmp_pid = InterlockedCompareExchange((LONG *) &shm_header.spinlock, 0, my_pid); - - if (tmp_pid != my_pid) - { - ASSERT("Process 0x%08x tried to release spinlock owned by process " - "0x%08x! \n", my_pid, tmp_pid); - PALCLeaveCriticalSection(&shm_critsec); - return 0; - } - - /* indicate no thread (in this process) holds the SHM lock */ - locking_thread = 0; - } - - TRACE("SHM lock level is now %d\n", lock_count.Load()); - - /* This matches the EnterCriticalSection from SHMRelease */ - PALCLeaveCriticalSection(&shm_critsec); - - /* This matches the EnterCriticalSection from SHMLock */ - PALCLeaveCriticalSection(&shm_critsec); - - return lock_count; -} - -/*++ -Function : - SHMGetInfo - - Retrieve some information from shared memory - -Parameters : - SHM_INFO_ID element : identifier of element to retrieve - -Return value : - Value of specified element - -Notes : - The SHM lock should be held while manipulating shared memory ---*/ -SHMPTR SHMGetInfo(SHM_INFO_ID element) -{ - SHMPTR retval = 0; - - if(element < 0 || element >= SIID_LAST) - { - ASSERT("Invalid SHM info element %d\n", element); - return 0; - } - - /* verify that this thread holds the SHM lock. No race condition: if the - current thread is here, it can't be in SHMLock or SHMUnlock */ - if( reinterpret_cast(pthread_self()) != locking_thread ) - { - ASSERT("SHMGetInfo called while thread does not hold the SHM lock!\n"); - } - - retval = shm_header.shm_info[element]; - - TRACE("SHM info element %d is %08x\n", element, retval ); - return retval; -} - - -/*++ -Function : - SHMSetInfo - - Place some information into shared memory - -Parameters : - SHM_INFO_ID element : identifier of element to save - SHMPTR value : new value of element - -Return value : - TRUE if successful, FALSE otherwise. - -Notes : - The SHM lock should be held while manipulating shared memory ---*/ -BOOL SHMSetInfo(SHM_INFO_ID element, SHMPTR value) -{ - if(element < 0 || element >= SIID_LAST) - { - ASSERT("Invalid SHM info element %d\n", element); - return FALSE; - } - - /* verify that this thread holds the SHM lock. No race condition: if the - current thread is here, it can't be in SHMLock or SHMUnlock */ - if( reinterpret_cast(pthread_self()) != locking_thread ) - { - ASSERT("SHMGetInfo called while thread does not hold the SHM lock!\n"); - } - - TRACE("Setting SHM info element %d to %08x; used to be %08x\n", - element, value, shm_header.shm_info[element].Load() ); - - shm_header.shm_info[element] = value; - - return TRUE; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sync/cs.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sync/cs.cpp deleted file mode 100644 index d04b2c13b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/sync/cs.cpp +++ /dev/null @@ -1,1458 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/////////////////////////////////////////////////////////////////////////////// -// -// File: -// cs.cpp -// -// Purpose: -// Implementation of critical sections -// -/////////////////////////////////////////////////////////////////////////////// - -#include "pal/thread.hpp" -#include "pal/cs.hpp" -#include "pal/malloc.hpp" -#include "pal/list.h" -#include "pal/dbgmsg.h" -#include "pal/init.h" -#include "pal/process.h" - -#include -#include - -using namespace CorUnix; - -// -// Uncomment the following line to turn CS behavior from -// unfair to fair lock -// -// #define PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - -// -// Uncomment the following line to enable simple mutex based CSs -// Note: when MUTEX_BASED_CSS is defined, PALCS_TRANSFER_OWNERSHIP_ON_RELEASE -// has no effect -// -// #define MUTEX_BASED_CSS - -// -// Important notes on critical sections layout/semantics on Unix -// -// 1) The PAL_CRITICAL_SECTION structure below must match the size of the -// CRITICAL_SECTION defined in pal.h. Besides the "windows part" -// of both the structures must be identical. -// 2) Both PAL_CRITICAL_SECTION and CRITICAL_SECTION currently do not match -// the size of the Windows' CRITICAL_SECTION. -// - From unmanaged code point of view, one should never make assumptions -// on the size and layout of the CRITICAL_SECTION structure, and anyway -// on Unix PAL's CRITICAL_SECTION extends the Windows one, so that some -// assumptions may still work. -// - From managed code point of view, one could try to interop directly -// to unmanaged critical sections APIs (though that would be quite -// meaningless). In order to do that, one would need to define a copy -// of the CRITICAL_SECTION structure in one's code, and that may lead -// to access random data beyond the structure limit, if that managed -// code is compiled on Unix. -// In case such scenario should be supported, the current implementation -// will have to be modified in a way to go back to the original Windows -// CRITICAL_SECTION layout. That would require to dynamically allocate -// the native data and use LockSemaphore as a pointer to it. The current -// solution intentionally avoids that since an effort has been made to -// make CSs objects completely independent from any other PAL subsystem, -// so that they can be used during initialization and shutdown. -// In case the "dynamically allocate native data" solution should be -// implemented, CSs would acquire a dependency on memory allocation and -// thread suspension subsystems, since the first contention on a specific -// CS would trigger the native data allocation. -// 3) The semantics of the LockCount field has not been kept compatible with -// the Windows implementation. -// Both on Windows and Unix the lower bit of LockCount indicates -// whether or not the CS is locked (for both fair and unfair lock -// solution), the second bit indicates whether or not currently there is a -// waiter that has been awakened and that is trying to acquire the CS -// (only unfair lock solution, unused in the fair one); starting from the -// third bit, LockCount represents the number of waiter threads currently -// waiting on the CS. -// Windows, anyway, implements this semantics in negative logic, so that -// an unlocked CS is represented by a LockCount == -1 (i.e. 0xFFFFFFFF, -// all the bits set), while on Unix an unlocked CS has LockCount == 0. -// Windows needs to use negative logic to support legacy code bad enough -// to directly access CS's fields making the assumption that -// LockCount == -1 means CS unlocked. Unix will not support that, and -// it uses positive logic. -// 4) The CRITICAL_SECTION_DEBUG_INFO layout on Unix is intentionally not -// compatible with the Windows layout. -// 5) For legacy code dependencies issues similar to those just described for -// the LockCount field, Windows CS code maintains a per-process list of -// debug info for all the CSs, both on debug and free/retail builds. On -// Unix such a list is maintained only on debug builds, and no debug -// info structure is allocated on free/retail builds -// - -SET_DEFAULT_DEBUG_CHANNEL(CRITSEC); - -#ifdef TRACE_CS_LOGIC -#define CS_TRACE TRACE -#else -#ifdef __GNUC__ -#define CS_TRACE(args...) -#else -#define CS_TRACE(...) -#endif -#endif // TRACE_CS_LOGIC - -// -// Note: PALCS_LOCK_WAITER_INC must be 2 * PALCS_LOCK_AWAKENED_WAITER -// -#define PALCS_LOCK_INIT 0 -#define PALCS_LOCK_BIT 1 -#define PALCS_LOCK_AWAKENED_WAITER 2 -#define PALCS_LOCK_WAITER_INC 4 - -#define PALCS_GETLBIT(val) ((int)(0!=(PALCS_LOCK_BIT&val))) -#define PALCS_GETAWBIT(val) ((int)(0!=(PALCS_LOCK_AWAKENED_WAITER&val))) -#define PALCS_GETWCOUNT(val) (val/PALCS_LOCK_WAITER_INC) - -enum PalCsInitState -{ - PalCsNotInitialized, // Critical section not initialized (InitializedCriticalSection - // has not yet been called, or DeleteCriticalsection has been - // called). - PalCsUserInitialized, // Critical section initialized from the user point of view, - // i.e. InitializedCriticalSection has been called. - PalCsFullyInitializing, // A thread found the CS locked, this is the first contention on - // this CS, and the thread is initializing the CS's native data. - PalCsFullyInitialized // Internal CS's native data has been fully initialized. -}; - -enum PalCsWaiterReturnState -{ - PalCsReturnWaiterAwakened, - PalCsWaiterDidntWait -}; - -struct _PAL_CRITICAL_SECTION; // fwd declaration - -typedef struct _CRITICAL_SECTION_DEBUG_INFO -{ - LIST_ENTRY Link; - struct _PAL_CRITICAL_SECTION * pOwnerCS; - Volatile lAcquireCount; - Volatile lEnterCount; - Volatile lContentionCount; -} CRITICAL_SECTION_DEBUG_INFO, *PCRITICAL_SECTION_DEBUG_INFO; - -typedef struct _PAL_CRITICAL_SECTION_NATIVE_DATA -{ - pthread_mutex_t mutex; - pthread_cond_t condition; - int iPredicate; -} PAL_CRITICAL_SECTION_NATIVE_DATA, *PPAL_CRITICAL_SECTION_NATIVE_DATA; - -typedef struct _PAL_CRITICAL_SECTION { - // Windows part - PCRITICAL_SECTION_DEBUG_INFO DebugInfo; - Volatile LockCount; - LONG RecursionCount; - SIZE_T OwningThread; - ULONG_PTR SpinCount; - // Private Unix part -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - BOOL fInternal; -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA - Volatile cisInitState; - PAL_CRITICAL_SECTION_NATIVE_DATA csndNativeData; -} PAL_CRITICAL_SECTION, *PPAL_CRITICAL_SECTION, *LPPAL_CRITICAL_SECTION; - -#ifdef _DEBUG -namespace CorUnix -{ - PAL_CRITICAL_SECTION g_csPALCSsListLock; - LIST_ENTRY g_PALCSList = { &g_PALCSList, &g_PALCSList}; -} -#endif // _DEBUG - -#define ObtainCurrentThreadId(thread) ObtainCurrentThreadIdImpl(thread, __func__) -static SIZE_T ObtainCurrentThreadIdImpl(CPalThread *pCurrentThread, const char *callingFuncName) -{ - SIZE_T threadId; - if(pCurrentThread) - { - threadId = pCurrentThread->GetThreadId(); - _ASSERTE(threadId == THREADSilentGetCurrentThreadId()); - } - else - { - threadId = THREADSilentGetCurrentThreadId(); - CS_TRACE("Early %s, no pthread data, getting TID internally\n", callingFuncName); - } - _ASSERTE(0 != threadId); - - return threadId; -} - - -/*++ -Function: - InitializeCriticalSection - -See MSDN doc. ---*/ -void InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - PERF_ENTRY(InitializeCriticalSection); - ENTRY("InitializeCriticalSection(lpCriticalSection=%p)\n", - lpCriticalSection); - - InternalInitializeCriticalSectionAndSpinCount(lpCriticalSection, - 0, false); - - LOGEXIT("InitializeCriticalSection returns void\n"); - PERF_EXIT(InitializeCriticalSection); -} - -/*++ -Function: - InitializeCriticalSectionAndSpinCount - -See MSDN doc. ---*/ -BOOL InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION lpCriticalSection, - DWORD dwSpinCount) -{ - BOOL bRet = TRUE; - PERF_ENTRY(InitializeCriticalSectionAndSpinCount); - ENTRY("InitializeCriticalSectionAndSpinCount(lpCriticalSection=%p, " - "dwSpinCount=%u)\n", lpCriticalSection, dwSpinCount); - - InternalInitializeCriticalSectionAndSpinCount(lpCriticalSection, - dwSpinCount, false); - - LOGEXIT("InitializeCriticalSectionAndSpinCount returns BOOL %d\n", - bRet); - PERF_EXIT(InitializeCriticalSectionAndSpinCount); - return bRet; -} - -/*++ -Function: - DeleteCriticalSection - -See MSDN doc. ---*/ -void DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - PERF_ENTRY(DeleteCriticalSection); - ENTRY("DeleteCriticalSection(lpCriticalSection=%p)\n", lpCriticalSection); - - InternalDeleteCriticalSection(lpCriticalSection); - - LOGEXIT("DeleteCriticalSection returns void\n"); - PERF_EXIT(DeleteCriticalSection); -} - -/*++ -Function: - EnterCriticalSection - -See MSDN doc. ---*/ -void EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - PERF_ENTRY(EnterCriticalSection); - ENTRY("EnterCriticalSection(lpCriticalSection=%p)\n", lpCriticalSection); - - CPalThread * pThread = InternalGetCurrentThread(); - - InternalEnterCriticalSection(pThread, lpCriticalSection); - - LOGEXIT("EnterCriticalSection returns void\n"); - PERF_EXIT(EnterCriticalSection); -} - -/*++ -Function: - LeaveCriticalSection - -See MSDN doc. ---*/ -VOID LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - PERF_ENTRY(LeaveCriticalSection); - ENTRY("LeaveCriticalSection(lpCriticalSection=%p)\n", lpCriticalSection); - - CPalThread * pThread = InternalGetCurrentThread(); - - InternalLeaveCriticalSection(pThread, lpCriticalSection); - - LOGEXIT("LeaveCriticalSection returns void\n"); - PERF_EXIT(LeaveCriticalSection); -} - -/*++ -Function: - InternalInitializeCriticalSection - -Initializes a critical section. It assumes the CS is an internal one, -i.e. thread entering it will be marked unsafe for suspension ---*/ -VOID InternalInitializeCriticalSection(CRITICAL_SECTION *pcs) -{ - InternalInitializeCriticalSectionAndSpinCount(pcs, 0, true); -} - -/*++ -Function: - InternalDeleteCriticalSection - -Deletes a critical section ---*/ -VOID InternalDeleteCriticalSection( - PCRITICAL_SECTION pCriticalSection) -{ - PAL_CRITICAL_SECTION * pPalCriticalSection = - reinterpret_cast(pCriticalSection); - - _ASSERT_MSG(PalCsUserInitialized == pPalCriticalSection->cisInitState || - PalCsFullyInitialized == pPalCriticalSection->cisInitState, - "CS %p is not initialized", pPalCriticalSection); - -#ifdef _DEBUG - CPalThread * pThread = - (PALIsThreadDataInitialized() ? GetCurrentPalThread() : NULL); - - if (0 != pPalCriticalSection->LockCount) - { - SIZE_T tid; - tid = ObtainCurrentThreadId(pThread); - int iWaiterCount = (int)PALCS_GETWCOUNT(pPalCriticalSection->LockCount); - - if (0 != (PALCS_LOCK_BIT & pPalCriticalSection->LockCount)) - { - // CS is locked - if (tid != pPalCriticalSection->OwningThread) - { - // not owner - ASSERT("Thread tid=%u deleting a CS owned by thread tid=%u\n", - tid, pPalCriticalSection->OwningThread); - } - else - { - // owner - if (0 != iWaiterCount) - { - ERROR("Thread tid=%u is deleting a CS with %d threads waiting on it\n", - tid, iWaiterCount); - } - else - { - WARN("Thread tid=%u is deleting a critical section it still owns\n", - tid); - } - } - } - else - { - // CS is not locked - if (0 != iWaiterCount) - { - ERROR("Deleting a CS with %d threads waiting on it\n", - iWaiterCount); - } - else - { - ERROR("Thread tid=%u is deleting a critical section currently not " - "owned, but with one waiter awakened\n", tid); - } - } - } - - if (NULL != pPalCriticalSection->DebugInfo) - { - if (pPalCriticalSection != &CorUnix::g_csPALCSsListLock) - { - InternalEnterCriticalSection(pThread, - reinterpret_cast(&g_csPALCSsListLock)); - RemoveEntryList(&pPalCriticalSection->DebugInfo->Link); - InternalLeaveCriticalSection(pThread, - reinterpret_cast(&g_csPALCSsListLock)); - } - else - { - RemoveEntryList(&pPalCriticalSection->DebugInfo->Link); - } - -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - LONG lVal, lNewVal; - Volatile * plDest; - - // Update delete count - InterlockedIncrement(pPalCriticalSection->fInternal ? - &g_lPALCSInternalDeleteCount : &g_lPALCSDeleteCount); - - // Update acquire count - plDest = pPalCriticalSection->fInternal ? - &g_lPALCSInternalAcquireCount : &g_lPALCSAcquireCount; - do { - lVal = *plDest; - lNewVal = lVal + pPalCriticalSection->DebugInfo->lAcquireCount; - lNewVal = InterlockedCompareExchange(plDest, lNewVal, lVal); - } while (lVal != lNewVal); - - // Update enter count - plDest = pPalCriticalSection->fInternal ? - &g_lPALCSInternalEnterCount : &g_lPALCSEnterCount; - do { - lVal = *plDest; - lNewVal = lVal + pPalCriticalSection->DebugInfo->lEnterCount; - lNewVal = InterlockedCompareExchange(plDest, lNewVal, lVal); - } while (lVal != lNewVal); - - // Update contention count - plDest = pPalCriticalSection->fInternal ? - &g_lPALCSInternalContentionCount : &g_lPALCSContentionCount; - do { - lVal = *plDest; - lNewVal = lVal + pPalCriticalSection->DebugInfo->lContentionCount; - lNewVal = InterlockedCompareExchange(plDest, lNewVal, lVal); - } while (lVal != lNewVal); - -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA - - InternalDelete(pPalCriticalSection->DebugInfo); - pPalCriticalSection->DebugInfo = NULL; - } -#endif // _DEBUG - - if (PalCsFullyInitialized == pPalCriticalSection->cisInitState) - { - int iRet; - - // destroy condition - iRet = pthread_cond_destroy(&pPalCriticalSection->csndNativeData.condition); - _ASSERT_MSG(0 == iRet, "Failed destroying condition in CS @ %p " - "[err=%d]\n", pPalCriticalSection, iRet); - - // destroy mutex - iRet = pthread_mutex_destroy(&pPalCriticalSection->csndNativeData.mutex); - _ASSERT_MSG(0 == iRet, "Failed destroying mutex in CS @ %p " - "[err=%d]\n", pPalCriticalSection, iRet); - } - - // Reset critical section state - pPalCriticalSection->cisInitState = PalCsNotInitialized; -} - -// The following PALCEnterCriticalSection and PALCLeaveCriticalSection -// functions are intended to provide CorUnix's InternalEnterCriticalSection -// and InternalLeaveCriticalSection functionalities to legacy C code, -// which has no knowledge of CPalThread, classes and namespaces. - -/*++ -Function: - PALCEnterCriticalSection - -Provides CorUnix's InternalEnterCriticalSection functionality to legacy C code, -which has no knowledge of CPalThread, classes and namespaces. ---*/ -VOID PALCEnterCriticalSection(CRITICAL_SECTION * pcs) -{ - CPalThread * pThread = - (PALIsThreadDataInitialized() ? GetCurrentPalThread() : NULL); - CorUnix::InternalEnterCriticalSection(pThread, pcs); -} - -/*++ -Function: - PALCLeaveCriticalSection - -Provides CorUnix's InternalLeaveCriticalSection functionality to legacy C code, -which has no knowledge of CPalThread, classes and namespaces. ---*/ -VOID PALCLeaveCriticalSection(CRITICAL_SECTION * pcs) -{ - CPalThread * pThread = - (PALIsThreadDataInitialized() ? GetCurrentPalThread() : NULL); - CorUnix::InternalLeaveCriticalSection(pThread, pcs); -} - -namespace CorUnix -{ - static PalCsWaiterReturnState PALCS_WaitOnCS( - PAL_CRITICAL_SECTION * pPalCriticalSection, - LONG lInc); - static PAL_ERROR PALCS_DoActualWait(PAL_CRITICAL_SECTION * pPalCriticalSection); - static PAL_ERROR PALCS_WakeUpWaiter(PAL_CRITICAL_SECTION * pPalCriticalSection); - static bool PALCS_FullyInitialize(PAL_CRITICAL_SECTION * pPalCriticalSection); - -#ifdef _DEBUG - enum CSSubSysInitState - { - CSSubSysNotInitialized, - CSSubSysInitializing, - CSSubSysInitialized - }; - static Volatile csssInitState = CSSubSysNotInitialized; - -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - static Volatile g_lPALCSInitializeCount = 0; - static Volatile g_lPALCSDeleteCount = 0; - static Volatile g_lPALCSAcquireCount = 0; - static Volatile g_lPALCSEnterCount = 0; - static Volatile g_lPALCSContentionCount = 0; - static Volatile g_lPALCSInternalInitializeCount = 0; - static Volatile g_lPALCSInternalDeleteCount = 0; - static Volatile g_lPALCSInternalAcquireCount = 0; - static Volatile g_lPALCSInternalEnterCount = 0; - static Volatile g_lPALCSInternalContentionCount = 0; -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA -#endif // _DEBUG - - - /*++ - Function: - CorUnix::CriticalSectionSubSysInitialize - - Initializes CS subsystem - --*/ - void CriticalSectionSubSysInitialize() - { - static_assert(sizeof(CRITICAL_SECTION) >= sizeof(PAL_CRITICAL_SECTION), - "PAL fatal internal error: sizeof(CRITICAL_SECTION) is " - "smaller than sizeof(PAL_CRITICAL_SECTION)"); - -#ifdef _DEBUG - LONG lRet = InterlockedCompareExchange((LONG *)&csssInitState, - (LONG)CSSubSysInitializing, - (LONG)CSSubSysNotInitialized); - if ((LONG)CSSubSysNotInitialized == lRet) - { - InitializeListHead(&g_PALCSList); - - InternalInitializeCriticalSectionAndSpinCount( - reinterpret_cast(&g_csPALCSsListLock), - 0, true); - InterlockedExchange((LONG *)&csssInitState, - (LONG)CSSubSysInitialized); - } - else - { - while (csssInitState != CSSubSysInitialized) - { - sched_yield(); - } - } -#endif // _DEBUG - } - - /*++ - Function: - CorUnix::InternalInitializeCriticalSectionAndSpinCount - - Initializes a CS with the given spin count. If 'fInternal' is true - the CS will be treatead as an internal one for its whole lifetime, - i.e. any thread that will enter it will be marked as unsafe for - suspension as long as it holds the CS - --*/ - void InternalInitializeCriticalSectionAndSpinCount( - PCRITICAL_SECTION pCriticalSection, - DWORD dwSpinCount, - bool fInternal) - { - PAL_CRITICAL_SECTION * pPalCriticalSection = - reinterpret_cast(pCriticalSection); - -#ifndef PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - // Make sure bits are defined in a usable way - _ASSERTE(PALCS_LOCK_AWAKENED_WAITER * 2 == PALCS_LOCK_WAITER_INC); -#endif // !PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - - // Make sure structure sizes are compatible - _ASSERTE(sizeof(CRITICAL_SECTION) >= sizeof(PAL_CRITICAL_SECTION)); - -#ifdef _DEBUG - if (sizeof(CRITICAL_SECTION) > sizeof(PAL_CRITICAL_SECTION)) - { - WARN("PAL_CS_NATIVE_DATA_SIZE appears to be defined to a value (%d) " - "larger than needed on this platform (%d).\n", - sizeof(CRITICAL_SECTION), sizeof(PAL_CRITICAL_SECTION)); - } -#endif // _DEBUG - - // Init CS data - pPalCriticalSection->DebugInfo = NULL; - pPalCriticalSection->LockCount = 0; - pPalCriticalSection->RecursionCount = 0; - pPalCriticalSection->SpinCount = dwSpinCount; - pPalCriticalSection->OwningThread = 0; - -#ifdef _DEBUG - CPalThread * pThread = - (PALIsThreadDataInitialized() ? GetCurrentPalThread() : NULL); - - pPalCriticalSection->DebugInfo = InternalNew(); - _ASSERT_MSG(NULL != pPalCriticalSection->DebugInfo, - "Failed to allocate debug info for new CS\n"); - - // Init debug info data - pPalCriticalSection->DebugInfo->lAcquireCount = 0; - pPalCriticalSection->DebugInfo->lEnterCount = 0; - pPalCriticalSection->DebugInfo->lContentionCount = 0; - pPalCriticalSection->DebugInfo->pOwnerCS = pPalCriticalSection; - - // Insert debug info struct in global list - if (pPalCriticalSection != &g_csPALCSsListLock) - { - InternalEnterCriticalSection(pThread, - reinterpret_cast(&g_csPALCSsListLock)); - InsertTailList(&g_PALCSList, &pPalCriticalSection->DebugInfo->Link); - InternalLeaveCriticalSection(pThread, - reinterpret_cast(&g_csPALCSsListLock)); - } - else - { - InsertTailList(&g_PALCSList, &pPalCriticalSection->DebugInfo->Link); - } - -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - pPalCriticalSection->fInternal = fInternal; - InterlockedIncrement(fInternal ? - &g_lPALCSInternalInitializeCount : &g_lPALCSInitializeCount); -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA -#endif // _DEBUG - - // Set initializazion state - pPalCriticalSection->cisInitState = PalCsUserInitialized; - -#ifdef MUTEX_BASED_CSS - bool fInit; - do - { - fInit = PALCS_FullyInitialize(pPalCriticalSection); - _ASSERTE(fInit); - } while (!fInit && 0 == sched_yield()); - - if (fInit) - { - // Set initializazion state - pPalCriticalSection->cisInitState = PalCsFullyInitialized; - } -#endif // MUTEX_BASED_CSS - } - -#ifndef MUTEX_BASED_CSS - /*++ - Function: - CorUnix::InternalEnterCriticalSection - - Enters a CS, causing the thread to block if the CS is owned by - another thread - --*/ - void InternalEnterCriticalSection( - CPalThread * pThread, - PCRITICAL_SECTION pCriticalSection) - { - PAL_CRITICAL_SECTION * pPalCriticalSection = - reinterpret_cast(pCriticalSection); - - LONG lSpinCount; - LONG lVal, lNewVal; - LONG lBitsToChange, lWaitInc; - PalCsWaiterReturnState cwrs; - SIZE_T threadId; - - _ASSERTE(PalCsNotInitialized != pPalCriticalSection->cisInitState); - - threadId = ObtainCurrentThreadId(pThread); - - - // Check if the current thread already owns the CS - // - // Note: there is no need for this double check to be atomic. In fact - // if the first check fails, the second doesn't count (and it's not - // even executed). If the first one succeeds and the second one - // doesn't, it doesn't matter if LockCount has already changed by the - // time OwningThread is tested. Instead, if the first one succeeded, - // and the second also succeeds, LockCount cannot have changed in the - // meanwhile, since this is the owning thread and only the owning - // thread can change the lock bit when the CS is owned. - if ((pPalCriticalSection->LockCount & PALCS_LOCK_BIT) && - (pPalCriticalSection->OwningThread == threadId)) - { - pPalCriticalSection->RecursionCount += 1; -#ifdef _DEBUG - if (NULL != pPalCriticalSection->DebugInfo) - { - pPalCriticalSection->DebugInfo->lEnterCount += 1; - } -#endif // _DEBUG - goto IECS_exit; - } - - // Set bits to change and waiter increment for an incoming thread - lBitsToChange = PALCS_LOCK_BIT; - lWaitInc = PALCS_LOCK_WAITER_INC; - lSpinCount = pPalCriticalSection->SpinCount; - - while (TRUE) - { - // Either this is an incoming thread, and therefore lBitsToChange - // is just PALCS_LOCK_BIT, or this is an awakened waiter - _ASSERTE(PALCS_LOCK_BIT == lBitsToChange || - (PALCS_LOCK_BIT | PALCS_LOCK_AWAKENED_WAITER) == lBitsToChange); - - // Make sure the waiter increment is in a valid range - _ASSERTE(PALCS_LOCK_WAITER_INC == lWaitInc || - PALCS_LOCK_AWAKENED_WAITER == lWaitInc); - - do { - lVal = pPalCriticalSection->LockCount; - - while (0 == (lVal & PALCS_LOCK_BIT)) - { - // CS is not locked: try lo lock it - - // Make sure that whether we are an incoming thread - // or the PALCS_LOCK_AWAKENED_WAITER bit is set - _ASSERTE((PALCS_LOCK_BIT == lBitsToChange) || - (PALCS_LOCK_AWAKENED_WAITER & lVal)); - - lNewVal = lVal ^ lBitsToChange; - - // Make sure we are actually trying to lock - _ASSERTE(lNewVal & PALCS_LOCK_BIT); - - CS_TRACE("[ECS %p] Switching from {%d, %d, %d} to " - "{%d, %d, %d} ==>\n", pPalCriticalSection, - PALCS_GETWCOUNT(lVal), PALCS_GETAWBIT(lVal), PALCS_GETLBIT(lVal), - PALCS_GETWCOUNT(lNewVal), PALCS_GETAWBIT(lNewVal), PALCS_GETLBIT(lNewVal)); - - // Try to switch the value - lNewVal = InterlockedCompareExchange (&pPalCriticalSection->LockCount, - lNewVal, lVal); - - CS_TRACE("[ECS %p] ==> %s LockCount={%d, %d, %d} " - "lVal={%d, %d, %d}\n", pPalCriticalSection, - (lNewVal == lVal) ? "OK" : "NO", - PALCS_GETWCOUNT(pPalCriticalSection->LockCount), - PALCS_GETAWBIT(pPalCriticalSection->LockCount), - PALCS_GETLBIT(pPalCriticalSection->LockCount), - PALCS_GETWCOUNT(lVal), PALCS_GETAWBIT(lVal), PALCS_GETLBIT(lVal)); - - if (lNewVal == lVal) - { - // CS successfully acquired - goto IECS_set_ownership; - } - - // Acquisition failed, some thread raced with us; - // update value for next loop - lVal = lNewVal; - } - - if (0 < lSpinCount) - { - sched_yield(); - } - } while (0 <= --lSpinCount); - - cwrs = PALCS_WaitOnCS(pPalCriticalSection, lWaitInc); - - if (PalCsReturnWaiterAwakened == cwrs) - { -#ifdef PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - // - // Fair Critical Sections - // - // In the fair lock case, when a waiter wakes up the CS - // must be locked (i.e. ownership passed on to the waiter) - _ASSERTE(0 != (PALCS_LOCK_BIT & pPalCriticalSection->LockCount)); - - // CS successfully acquired - goto IECS_set_ownership; - -#else // PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - // - // Unfair Critical Sections - // - _ASSERTE(PALCS_LOCK_AWAKENED_WAITER & pPalCriticalSection->LockCount); - - lBitsToChange = PALCS_LOCK_BIT | PALCS_LOCK_AWAKENED_WAITER; - lWaitInc = PALCS_LOCK_AWAKENED_WAITER; -#endif // PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - } - } - - IECS_set_ownership: - // Critical section acquired: set ownership data - pPalCriticalSection->OwningThread = threadId; - pPalCriticalSection->RecursionCount = 1; -#ifdef _DEBUG - if (NULL != pPalCriticalSection->DebugInfo) - { - pPalCriticalSection->DebugInfo->lAcquireCount += 1; - pPalCriticalSection->DebugInfo->lEnterCount += 1; - } -#endif // _DEBUG - - IECS_exit: - return; - } - - /*++ - Function: - CorUnix::InternalLeaveCriticalSection - - Leaves a currently owned CS - --*/ - void InternalLeaveCriticalSection(CPalThread * pThread, - PCRITICAL_SECTION pCriticalSection) - { - PAL_CRITICAL_SECTION * pPalCriticalSection = - reinterpret_cast(pCriticalSection); - LONG lVal, lNewVal; - -#ifdef _DEBUG - SIZE_T threadId; - - _ASSERTE(PalCsNotInitialized != pPalCriticalSection->cisInitState); - - threadId = ObtainCurrentThreadId(pThread); - _ASSERTE(threadId == pPalCriticalSection->OwningThread); -#endif // _DEBUG - - _ASSERT_MSG(PALCS_LOCK_BIT & pPalCriticalSection->LockCount, - "Trying to release an unlocked CS\n"); - _ASSERT_MSG(0 < pPalCriticalSection->RecursionCount, - "Trying to release an unlocked CS\n"); - - if (--pPalCriticalSection->RecursionCount > 0) - { - // Recursion was > 1, still owning the CS - goto ILCS_cs_exit; - } - - // Reset CS ownership - pPalCriticalSection->OwningThread = 0; - - // Load the current LockCount value - lVal = pPalCriticalSection->LockCount; - - while (true) - { - _ASSERT_MSG(0 != (PALCS_LOCK_BIT & lVal), - "Trying to release an unlocked CS\n"); - - // NB: In the fair lock case (PALCS_TRANSFER_OWNERSHIP_ON_RELEASE) the - // PALCS_LOCK_AWAKENED_WAITER bit is not used - if ( (PALCS_LOCK_BIT == lVal) -#ifndef PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - || (PALCS_LOCK_AWAKENED_WAITER & lVal) -#endif // !PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - ) - { - // Whether there are no waiters (PALCS_LOCK_BIT == lVal) - // or a waiter has already been awakened, therefore we - // just need to reset the lock bit and return - lNewVal = lVal & ~PALCS_LOCK_BIT; - CS_TRACE("[LCS-UN %p] Switching from {%d, %d, %d} to " - "{%d, %d, %d} ==>\n", pPalCriticalSection, - PALCS_GETWCOUNT(lVal), PALCS_GETAWBIT(lVal), PALCS_GETLBIT(lVal), - PALCS_GETWCOUNT(lNewVal), PALCS_GETAWBIT(lNewVal), PALCS_GETLBIT(lNewVal)); - - lNewVal = InterlockedCompareExchange(&pPalCriticalSection->LockCount, - lNewVal, lVal); - - CS_TRACE("[LCS-UN %p] ==> %s\n", pPalCriticalSection, - (lNewVal == lVal) ? "OK" : "NO"); - - if (lNewVal == lVal) - { - goto ILCS_cs_exit; - } - } - else - { - // There is at least one waiter, we need to wake it up - -#ifdef PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - // Fair lock case: passing ownership on to the first waiter. - // Here we need only to decrement the waiters count. CS will - // remain locked and ownership will be passed to the waiter, - // which will take care of setting ownership data as soon as - // it wakes up - lNewVal = lVal - PALCS_LOCK_WAITER_INC; -#else // PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - // Unfair lock case: we need to atomically decrement the waiters - // count (we are about ot wake up one of them), set the - // "waiter awakened" bit and to reset the "CS locked" bit. - // Note that, since we know that at this time PALCS_LOCK_BIT - // is set and PALCS_LOCK_AWAKENED_WAITER is not set, none of - // the addenda will affect bits other than its target bit(s), - // i.e. PALCS_LOCK_BIT will not affect PALCS_LOCK_AWAKENED_WAITER, - // PALCS_LOCK_AWAKENED_WAITER will not affect the actual - // count of waiters, and the latter will not change the two - // former ones - lNewVal = lVal - PALCS_LOCK_WAITER_INC + - PALCS_LOCK_AWAKENED_WAITER - PALCS_LOCK_BIT; -#endif // PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - CS_TRACE("[LCS-CN %p] Switching from {%d, %d, %d} to {%d, %d, %d} ==>\n", - pPalCriticalSection, - PALCS_GETWCOUNT(lVal), PALCS_GETAWBIT(lVal), PALCS_GETLBIT(lVal), - PALCS_GETWCOUNT(lNewVal), PALCS_GETAWBIT(lNewVal), PALCS_GETLBIT(lNewVal)); - - lNewVal = InterlockedCompareExchange(&pPalCriticalSection->LockCount, - lNewVal, lVal); - - CS_TRACE("[LCS-CN %p] ==> %s\n", pPalCriticalSection, - (lNewVal == lVal) ? "OK" : "NO"); - - if (lNewVal == lVal) - { - // Wake up the waiter - PALCS_WakeUpWaiter (pPalCriticalSection); - -#ifdef PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - // In the fair lock case, we need to yield here to defeat - // the inherently unfair nature of the condition/predicate - // construct - sched_yield(); -#endif // PALCS_TRANSFER_OWNERSHIP_ON_RELEASE - - goto ILCS_cs_exit; - } - } - - // CS unlock failed due to race with another thread trying to - // register as waiter on it. We need to keep on looping. We - // intentionally do not yield here in order to reserve higher - // priority for the releasing thread. - // - // At this point lNewVal contains the latest LockCount value - // retrieved by one of the two InterlockedCompareExchange above; - // we can use this value as expected LockCount for the next loop, - // without the need to fetch it again. - lVal = lNewVal; - } - - ILCS_cs_exit: - return; - } - -#endif // MUTEX_BASED_CSS - - /*++ - Function: - CorUnix::PALCS_FullyInitialize - - Fully initializes a CS which was previously initialized in InitializeCriticalSection. - This method is called at the first contention on the target CS - --*/ - bool PALCS_FullyInitialize(PAL_CRITICAL_SECTION * pPalCriticalSection) - { - LONG lVal, lNewVal; - bool fRet = true; - - lVal = pPalCriticalSection->cisInitState; - if (PalCsFullyInitialized == lVal) - { - goto PCDI_exit; - } - if (PalCsUserInitialized == lVal) - { - int iRet; - lNewVal = (LONG)PalCsFullyInitializing; - lNewVal = InterlockedCompareExchange( - (LONG *)&pPalCriticalSection->cisInitState, lNewVal, lVal); - if (lNewVal != lVal) - { - if (PalCsFullyInitialized == lNewVal) - { - // Another thread did initialize this CS: we can - // safely return 'true' - goto PCDI_exit; - } - - // Another thread is still initializing this CS: yield and - // spin by returning 'false' - sched_yield(); - fRet = false; - goto PCDI_exit; - } - - // - // Actual native initialization - // - // Mutex - iRet = pthread_mutex_init(&pPalCriticalSection->csndNativeData.mutex, NULL); - if (0 != iRet) - { - ASSERT("Failed initializing mutex in CS @ %p [err=%d]\n", - pPalCriticalSection, iRet); - pPalCriticalSection->cisInitState = PalCsUserInitialized; - fRet = false; - goto PCDI_exit; - } -#ifndef MUTEX_BASED_CSS - // Condition - iRet = pthread_cond_init(&pPalCriticalSection->csndNativeData.condition, NULL); - if (0 != iRet) - { - ASSERT("Failed initializing condition in CS @ %p [err=%d]\n", - pPalCriticalSection, iRet); - pthread_mutex_destroy(&pPalCriticalSection->csndNativeData.mutex); - pPalCriticalSection->cisInitState = PalCsUserInitialized; - fRet = false; - goto PCDI_exit; - } - // Predicate - pPalCriticalSection->csndNativeData.iPredicate = 0; -#endif - - pPalCriticalSection->cisInitState = PalCsFullyInitialized; - } - else if (PalCsFullyInitializing == lVal) - { - // Another thread is still initializing this CS: yield and - // spin by returning 'false' - sched_yield(); - fRet = false; - goto PCDI_exit; - } - else - { - ASSERT("CS %p is not initialized", pPalCriticalSection); - fRet = false; - goto PCDI_exit; - } - - PCDI_exit: - return fRet; - } - - - /*++ - Function: - CorUnix::PALCS_WaitOnCS - - Waits on a CS owned by another thread. It returns PalCsReturnWaiterAwakened - if the thread actually waited on the CS and it has been awakened on CS - release. It returns PalCsWaiterDidntWait if another thread is currently - fully-initializing the CS and therefore the current thread couldn't wait - on it - --*/ - PalCsWaiterReturnState PALCS_WaitOnCS(PAL_CRITICAL_SECTION * pPalCriticalSection, - LONG lInc) - { - DWORD lVal, lNewVal; - PAL_ERROR palErr = NO_ERROR; - - if (PalCsFullyInitialized != pPalCriticalSection->cisInitState) - { - // First contention, the CS native wait support need to be - // initialized at this time - if (!PALCS_FullyInitialize(pPalCriticalSection)) - { - // The current thread failed the full initialization of the CS, - // whether because another thread is race-initializing it, or - // there are no enough memory/resources at this time, or - // InitializeCriticalSection has never been called. By - // returning we will cause the thread to spin on CS trying - // again until the CS is initialized - return PalCsWaiterDidntWait; - } - } - - // Make sure we have a valid waiter increment - _ASSERTE(PALCS_LOCK_WAITER_INC == lInc || - PALCS_LOCK_AWAKENED_WAITER == lInc); - - do { - lVal = pPalCriticalSection->LockCount; - - // Make sure the waiter increment is compatible with the - // awakened waiter bit value - _ASSERTE(PALCS_LOCK_WAITER_INC == lInc || - PALCS_LOCK_AWAKENED_WAITER & lVal); - - if (0 == (lVal & PALCS_LOCK_BIT)) - { - // the CS is no longer locked, let's bail out - return PalCsWaiterDidntWait; - } - - lNewVal = lVal + lInc; - - // Make sure that this thread was whether an incoming one or it - // was an awakened waiter and, in this case, we are now going to - // turn off the awakened waiter bit - _ASSERT_MSG(PALCS_LOCK_WAITER_INC == lInc || - 0 == (PALCS_LOCK_AWAKENED_WAITER & lNewVal)); - - CS_TRACE("[WCS %p] Switching from {%d, %d, %d} to " - "{%d, %d, %d} ==> ", pPalCriticalSection, - PALCS_GETWCOUNT(lVal), PALCS_GETAWBIT(lVal), PALCS_GETLBIT(lVal), - PALCS_GETWCOUNT(lNewVal), PALCS_GETAWBIT(lNewVal), PALCS_GETLBIT(lNewVal)); - - lNewVal = InterlockedCompareExchange (&pPalCriticalSection->LockCount, - lNewVal, lVal); - - CS_TRACE("[WCS %p] ==> %s\n", pPalCriticalSection, - (lNewVal == lVal) ? "OK" : "NO"); - - } while (lNewVal != lVal); - -#ifdef _DEBUG - if (NULL != pPalCriticalSection->DebugInfo) - { - pPalCriticalSection->DebugInfo->lContentionCount += 1; - } -#endif // _DEBUG - - // Do the actual native wait - palErr = PALCS_DoActualWait(pPalCriticalSection); - _ASSERT_MSG(NO_ERROR == palErr, "Native CS wait failed\n"); - - return PalCsReturnWaiterAwakened; - } - - /*++ - Function: - CorUnix::PALCS_DoActualWait - - Performs the actual native wait on the CS - --*/ - PAL_ERROR PALCS_DoActualWait(PAL_CRITICAL_SECTION * pPalCriticalSection) - { - int iRet; - PAL_ERROR palErr = NO_ERROR; - - CS_TRACE("Trying to go to sleep [CS=%p]\n", pPalCriticalSection); - - // Lock the mutex - iRet = pthread_mutex_lock(&pPalCriticalSection->csndNativeData.mutex); - if (0 != iRet) - { - palErr = ERROR_INTERNAL_ERROR; - goto PCDAW_exit; - } - - CS_TRACE("Actually Going to sleep [CS=%p]\n", pPalCriticalSection); - - while (0 == pPalCriticalSection->csndNativeData.iPredicate) - { - // Wait on the condition - iRet = pthread_cond_wait(&pPalCriticalSection->csndNativeData.condition, - &pPalCriticalSection->csndNativeData.mutex); - - CS_TRACE("Got a signal on condition [pred=%d]!\n", - pPalCriticalSection->csndNativeData.iPredicate); - if (0 != iRet) - { - // Failed: unlock the mutex and bail out - ASSERT("Failed waiting on condition in CS %p [err=%d]\n", - pPalCriticalSection, iRet); - pthread_mutex_unlock(&pPalCriticalSection->csndNativeData.mutex); - palErr = ERROR_INTERNAL_ERROR; - goto PCDAW_exit; - } - } - - // Reset the predicate - pPalCriticalSection->csndNativeData.iPredicate = 0; - - // Unlock the mutex - iRet = pthread_mutex_unlock(&pPalCriticalSection->csndNativeData.mutex); - if (0 != iRet) - { - palErr = ERROR_INTERNAL_ERROR; - goto PCDAW_exit; - } - - PCDAW_exit: - - CS_TRACE("Just woken up [CS=%p]\n", pPalCriticalSection); - - return palErr; - } - - /*++ - Function: - CorUnix::PALCS_WakeUpWaiter - - Wakes up the first thread waiting on the CS - --*/ - PAL_ERROR PALCS_WakeUpWaiter(PAL_CRITICAL_SECTION * pPalCriticalSection) - { - int iRet; - PAL_ERROR palErr = NO_ERROR; - - _ASSERT_MSG(PalCsFullyInitialized == pPalCriticalSection->cisInitState, - "Trying to wake up a waiter on CS not fully initialized\n"); - - // Lock the mutex - iRet = pthread_mutex_lock(&pPalCriticalSection->csndNativeData.mutex); - if (0 != iRet) - { - palErr = ERROR_INTERNAL_ERROR; - goto PCWUW_exit; - } - - // Set the predicate - pPalCriticalSection->csndNativeData.iPredicate = 1; - - CS_TRACE("Signaling condition/predicate [pred=%d]!\n", - pPalCriticalSection->csndNativeData.iPredicate); - - // Signal the condition - iRet = pthread_cond_signal(&pPalCriticalSection->csndNativeData.condition); - if (0 != iRet) - { - // Failed: set palErr, but continue in order to unlock - // the mutex anyway - ASSERT("Failed setting condition in CS %p [ret=%d]\n", - pPalCriticalSection, iRet); - palErr = ERROR_INTERNAL_ERROR; - } - - // Unlock the mutex - iRet = pthread_mutex_unlock(&pPalCriticalSection->csndNativeData.mutex); - if (0 != iRet) - { - palErr = ERROR_INTERNAL_ERROR; - goto PCWUW_exit; - } - - PCWUW_exit: - return palErr; - } - -#ifdef _DEBUG - /*++ - Function: - CorUnix::PALCS_ReportStatisticalData - - Report creation/acquisition/contention statistical data for the all the - CSs so far existed and no longer existing in the current process - --*/ - void PALCS_ReportStatisticalData() - { -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - CPalThread * pThread = InternalGetCurrentThread(); - - if (NULL == pThread) DebugBreak(); - - // Take the lock for the global list of CS debug infos - InternalEnterCriticalSection(pThread, (CRITICAL_SECTION*)&g_csPALCSsListLock); - - LONG lPALCSInitializeCount = g_lPALCSInitializeCount; - LONG lPALCSDeleteCount = g_lPALCSDeleteCount; - LONG lPALCSAcquireCount = g_lPALCSAcquireCount; - LONG lPALCSEnterCount = g_lPALCSEnterCount; - LONG lPALCSContentionCount = g_lPALCSContentionCount; - LONG lPALCSInternalInitializeCount = g_lPALCSInternalInitializeCount; - LONG lPALCSInternalDeleteCount = g_lPALCSInternalDeleteCount; - LONG lPALCSInternalAcquireCount = g_lPALCSInternalAcquireCount; - LONG lPALCSInternalEnterCount = g_lPALCSInternalEnterCount; - LONG lPALCSInternalContentionCount = g_lPALCSInternalContentionCount; - - PLIST_ENTRY pItem = g_PALCSList.Flink; - while (&g_PALCSList != pItem) - { - PCRITICAL_SECTION_DEBUG_INFO pDebugInfo = - (PCRITICAL_SECTION_DEBUG_INFO)pItem; - - if (pDebugInfo->pOwnerCS->fInternal) - { - lPALCSInternalAcquireCount += pDebugInfo->lAcquireCount; - lPALCSInternalEnterCount += pDebugInfo->lEnterCount; - lPALCSInternalContentionCount += pDebugInfo->lContentionCount; - } - else - { - lPALCSAcquireCount += pDebugInfo->lAcquireCount; - lPALCSEnterCount += pDebugInfo->lEnterCount; - lPALCSContentionCount += pDebugInfo->lContentionCount; - } - - pItem = pItem->Flink; - } - - // Release the lock for the global list of CS debug infos - InternalLeaveCriticalSection(pThread, (CRITICAL_SECTION*)&g_csPALCSsListLock); - - TRACE("Critical Sections Statistical Data:\n"); - TRACE("{\n"); - TRACE(" Client code CSs:\n"); - TRACE(" {\n"); - TRACE(" Initialize Count: %d\n", lPALCSInitializeCount); - TRACE(" Delete Count: %d\n", lPALCSDeleteCount); - TRACE(" Acquire Count: %d\n", lPALCSAcquireCount); - TRACE(" Enter Count: %d\n", lPALCSEnterCount); - TRACE(" Contention Count: %d\n", lPALCSContentionCount); - TRACE(" }\n"); - TRACE(" Internal PAL CSs:\n"); - TRACE(" {\n"); - TRACE(" Initialize Count: %d\n", lPALCSInternalInitializeCount); - TRACE(" Delete Count: %d\n", lPALCSInternalDeleteCount); - TRACE(" Acquire Count: %d\n", lPALCSInternalAcquireCount); - TRACE(" Enter Count: %d\n", lPALCSInternalEnterCount); - TRACE(" Contention Count: %d\n", lPALCSInternalContentionCount); - TRACE(" }\n"); - TRACE("}\n"); -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA - } - - /*++ - Function: - CorUnix::PALCS_DumpCSList - - Dumps the list of all the CS currently existing in this process. - --*/ - void PALCS_DumpCSList() - { - CPalThread * pThread = InternalGetCurrentThread(); - - // Take the lock for the global list of CS debug infos - InternalEnterCriticalSection(pThread, (CRITICAL_SECTION*)&g_csPALCSsListLock); - - PLIST_ENTRY pItem = g_PALCSList.Flink; - while (&g_PALCSList != pItem) - { - PCRITICAL_SECTION_DEBUG_INFO pDebugInfo = - (PCRITICAL_SECTION_DEBUG_INFO)pItem; - PPAL_CRITICAL_SECTION pCS = pDebugInfo->pOwnerCS; - - printf("CS @ %p \n" - "{\tDebugInfo = %p -> \n", - pCS, pDebugInfo); - - printf("\t{\n\t\t[Link]\n\t\tpOwnerCS = %p\n" - "\t\tAcquireCount \t= %d\n" - "\t\tEnterCount \t= %d\n" - "\t\tContentionCount = %d\n", - pDebugInfo->pOwnerCS, pDebugInfo->lAcquireCount.Load(), - pDebugInfo->lEnterCount.Load(), pDebugInfo->lContentionCount.Load()); - printf("\t}\n"); - - printf("\tLockCount \t= %#x\n" - "\tRecursionCount \t= %d\n" - "\tOwningThread \t= %p\n" - "\tSpinCount \t= %u\n" - "\tfInternal \t= %d\n" - "\teInitState \t= %u\n" - "\tpNativeData \t= %p ->\n", - pCS->LockCount.Load(), pCS->RecursionCount, (void *)pCS->OwningThread, - (unsigned)pCS->SpinCount, -#ifdef PAL_TRACK_CRITICAL_SECTIONS_DATA - (int)pCS->fInternal, -#else - (int)0, -#endif // PAL_TRACK_CRITICAL_SECTIONS_DATA - pCS->cisInitState.Load(), &pCS->csndNativeData); - - printf("\t{\n\t\t[mutex]\n\t\t[condition]\n" - "\t\tPredicate \t= %d\n" - "\t}\n}\n",pCS->csndNativeData.iPredicate); - - printf("}\n"); - - pItem = pItem->Flink; - } - - // Release the lock for the global list of CS debug infos - InternalLeaveCriticalSection(pThread, (CRITICAL_SECTION*)&g_csPALCSsListLock); - } -#endif // _DEBUG - - -#if defined(MUTEX_BASED_CSS) || defined(_DEBUG) - /*++ - Function: - CorUnix::InternalEnterCriticalSection - - Enters a CS, causing the thread to block if the CS is owned by - another thread - --*/ -#ifdef MUTEX_BASED_CSS - void InternalEnterCriticalSection( - CPalThread * pThread, - PCRITICAL_SECTION pCriticalSection) -#else // MUTEX_BASED_CSS - void MTX_InternalEnterCriticalSection( - CPalThread * pThread, - PCRITICAL_SECTION pCriticalSection) -#endif // MUTEX_BASED_CSS - - { - PAL_CRITICAL_SECTION * pPalCriticalSection = - reinterpret_cast(pCriticalSection); - int iRet; - SIZE_T threadId; - - _ASSERTE(PalCsNotInitialized != pPalCriticalSection->cisInitState); - - threadId = ObtainCurrentThreadId(pThread); - - /* check if the current thread already owns the criticalSection */ - if (pPalCriticalSection->OwningThread == threadId) - { - _ASSERTE(0 < pPalCriticalSection->RecursionCount); - pPalCriticalSection->RecursionCount += 1; - return; - } - - iRet = pthread_mutex_lock(&pPalCriticalSection->csndNativeData.mutex); - _ASSERTE(0 == iRet); - - pPalCriticalSection->OwningThread = threadId; - pPalCriticalSection->RecursionCount = 1; - } - - - /*++ - Function: - CorUnix::InternalLeaveCriticalSection - - Leaves a currently owned CS - --*/ -#ifdef MUTEX_BASED_CSS - void InternalLeaveCriticalSection( - CPalThread * pThread, - PCRITICAL_SECTION pCriticalSection) -#else // MUTEX_BASED_CSS - void MTX_InternalLeaveCriticalSection( - CPalThread * pThread, - PCRITICAL_SECTION pCriticalSection) -#endif // MUTEX_BASED_CSS - { - PAL_CRITICAL_SECTION * pPalCriticalSection = - reinterpret_cast(pCriticalSection); - int iRet; -#ifdef _DEBUG - SIZE_T threadId; - - _ASSERTE(PalCsNotInitialized != pPalCriticalSection->cisInitState); - - threadId = ObtainCurrentThreadId(pThread); - _ASSERTE(threadId == pPalCriticalSection->OwningThread); - - if (0 >= pPalCriticalSection->RecursionCount) - DebugBreak(); - - _ASSERTE(0 < pPalCriticalSection->RecursionCount); -#endif // _DEBUG - - if (0 < --pPalCriticalSection->RecursionCount) - return; - - pPalCriticalSection->OwningThread = 0; - - iRet = pthread_mutex_unlock(&pPalCriticalSection->csndNativeData.mutex); - _ASSERTE(0 == iRet); - } - -#endif // MUTEX_BASED_CSS || _DEBUG -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchcontrollers.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchcontrollers.cpp index dc8c99ae7..614944198 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchcontrollers.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchcontrollers.cpp @@ -51,10 +51,8 @@ namespace CorUnix PAL_ERROR CSynchControllerBase::Init( CPalThread * pthrCurrent, ControllerType ctCtrlrType, - ObjectDomain odObjectDomain, CObjectType *potObjectType, - CSynchData * psdSynchData, - WaitDomain wdWaitDomain) + CSynchData * psdSynchData) { VALIDATEOBJECT(psdSynchData); @@ -63,20 +61,14 @@ namespace CorUnix // Initialize internal controller data m_pthrOwner = pthrCurrent; m_ctCtrlrType = ctCtrlrType; - m_odObjectDomain = odObjectDomain; m_potObjectType = potObjectType; m_psdSynchData = psdSynchData; - m_wdWaitDomain = wdWaitDomain; // Add reference to target synch data m_psdSynchData->AddRef(); // Acquire lock implied by the controller CPalSynchronizationManager::AcquireLocalSynchLock(m_pthrOwner); - if (LocalWait != m_wdWaitDomain) - { - CPalSynchronizationManager::AcquireSharedSynchLock(m_pthrOwner); - } return NO_ERROR; } @@ -106,10 +98,6 @@ namespace CorUnix m_psdSynchData->Release(m_pthrOwner); // Release lock implied by the controller - if (LocalWait != m_wdWaitDomain) - { - CPalSynchronizationManager::ReleaseSharedSynchLock(m_pthrOwner); - } CPalSynchronizationManager::ReleaseLocalSynchLock(m_pthrOwner); // Return controller to the appropriate cache @@ -271,7 +259,6 @@ namespace CorUnix SharedID shridNewNode = NULL; ThreadWaitInfo * ptwiWaitInfo; DWORD * pdwWaitState; - bool fSharedObject = (SharedObject == m_odObjectDomain); bool fEarlyDeath = false; bool fSynchDataRefd = false; CPalSynchronizationManager * pSynchManager = @@ -287,28 +274,12 @@ namespace CorUnix pdwWaitState = SharedIDToTypePointer(DWORD, m_pthrOwner->synchronizationInfo.m_shridWaitAwakened); - if (fSharedObject) - { - shridNewNode = pSynchManager->CacheGetSharedWTListNode(m_pthrOwner); - pwtlnNewNode = SharedIDToTypePointer(WaitingThreadsListNode, shridNewNode); - } - else - { - pwtlnNewNode = pSynchManager->CacheGetLocalWTListNode(m_pthrOwner); - } + pwtlnNewNode = pSynchManager->CacheGetLocalWTListNode(m_pthrOwner); if (!pwtlnNewNode) { - if (fSharedObject && (NULL != shridNewNode)) - { - ASSERT("Bad Shared Memory ptr %p\n", shridNewNode); - palErr = ERROR_INTERNAL_ERROR; - } - else - { - ERROR("Out of memory\n"); - palErr = ERROR_NOT_ENOUGH_MEMORY; - } + ERROR("Out of memory\n"); + palErr = ERROR_NOT_ENOUGH_MEMORY; goto RWT_exit; } @@ -322,37 +293,15 @@ namespace CorUnix if (0 == ptwiWaitInfo->lObjCount) { ptwiWaitInfo->wtWaitType = wtWaitType; - ptwiWaitInfo->wdWaitDomain = m_wdWaitDomain; - } - else - { - _ASSERT_MSG(wtWaitType == ptwiWaitInfo->wtWaitType, - "Conflicting wait types in wait registration\n"); - - if (m_wdWaitDomain != ptwiWaitInfo->wdWaitDomain) - { - ptwiWaitInfo->wdWaitDomain = MixedWait; - } } - pwtlnNewNode->shridSHRThis = NULL; pwtlnNewNode->ptwiWaitInfo = ptwiWaitInfo; pwtlnNewNode->dwObjIndex = dwIndex; - pwtlnNewNode->dwProcessId = gPID; pwtlnNewNode->dwThreadId = m_pthrOwner->GetThreadId(); pwtlnNewNode->dwFlags = (MultipleObjectsWaitAll == wtWaitType) ? WTLN_FLAG_WAIT_ALL : 0; pwtlnNewNode->shridWaitingState = m_pthrOwner->synchronizationInfo.m_shridWaitAwakened; - if (fSharedObject) - { - pwtlnNewNode->dwFlags |= WTLN_FLAG_OWNER_OBJECT_IS_SHARED; - pwtlnNewNode->shridSHRThis = shridNewNode; - pwtlnNewNode->ptrOwnerObjSynchData.shrid = m_psdSynchData->GetSharedThis(); - } - else - { - pwtlnNewNode->ptrOwnerObjSynchData.ptr = m_psdSynchData; - } + pwtlnNewNode->ptrOwnerObjSynchData.ptr = m_psdSynchData; // AddRef the synch data (will be released in UnregisterWait) m_psdSynchData->AddRef(); @@ -419,15 +368,7 @@ namespace CorUnix } // Add new node to queue - if (fSharedObject) - { - m_psdSynchData->SharedWaiterEnqueue(shridNewNode, fPrioritize); - ptwiWaitInfo->lSharedObjCount += 1; - } - else - { - m_psdSynchData->WaiterEnqueue(pwtlnNewNode, fPrioritize); - } + m_psdSynchData->WaiterEnqueue(pwtlnNewNode, fPrioritize); // Succeeded: update object count ptwiWaitInfo->lObjCount++; @@ -436,17 +377,13 @@ namespace CorUnix if (palErr != NO_ERROR) { // Unregister any partial wait registration - pSynchManager->UnRegisterWait(m_pthrOwner, ptwiWaitInfo, fSharedObject); + pSynchManager->UnRegisterWait(m_pthrOwner, ptwiWaitInfo); if (fSynchDataRefd) { m_psdSynchData->Release(m_pthrOwner); } - if ((fSharedObject) && (NULL != shridNewNode)) - { - pSynchManager->CacheAddSharedWTListNode(m_pthrOwner, shridNewNode); - } - else if (NULL != pwtlnNewNode) + if (NULL != pwtlnNewNode) { pSynchManager->CacheAddLocalWTListNode(m_pthrOwner, pwtlnNewNode); } @@ -457,9 +394,7 @@ namespace CorUnix // We need to completely release the synch lock(s) before // going to sleep LONG lLocalSynchLockCount; - LONG lSharedSynchLockCount; - lSharedSynchLockCount = CPalSynchronizationManager::ResetSharedSynchLock(m_pthrOwner); lLocalSynchLockCount = CPalSynchronizationManager::ResetLocalSynchLock(m_pthrOwner); _ASSERTE(0 < lLocalSynchLockCount); @@ -571,7 +506,7 @@ namespace CorUnix _ASSERTE(InternalGetCurrentThread() == m_pthrOwner); _ASSERTE(lNewCount >= 0); - m_psdSynchData->Signal(m_pthrOwner, lNewCount, false); + m_psdSynchData->Signal(m_pthrOwner, lNewCount); return NO_ERROR; } @@ -598,7 +533,7 @@ namespace CorUnix "Signal count increment %d would make current signal count %d to " "wrap around\n", lAmountToIncrement, lOldCount); - m_psdSynchData->Signal(m_pthrOwner, lNewCount, false); + m_psdSynchData->Signal(m_pthrOwner, lNewCount); return NO_ERROR; } @@ -730,7 +665,7 @@ namespace CorUnix m_psdSynchData->ResetOwnership(); // Signal it and trigger waiter thread awakening - m_psdSynchData->Signal(m_pthrOwner, 1, false); + m_psdSynchData->Signal(m_pthrOwner, 1); } DOC_exit: @@ -779,17 +714,15 @@ namespace CorUnix { CPalSynchronizationManager * pSynchManager = CPalSynchronizationManager::GetInstance(); - bool fSharedObject = (SharedObject == m_odObjectDomain); - _ASSERT_MSG((fSharedObject && (NULL == m_ptrWTLHead.shrid)) || - (!fSharedObject && (NULL == m_ptrWTLHead.ptr)), + _ASSERT_MSG((NULL == m_ptrWTLHead.ptr), "Final Release on CSynchData with threads still in " "the waiting list\n"); TRACE("Disposing %s waitable object with SynchData @ " - "{shrid=%p, p=%p}\n", - (SharedObject == m_odObjectDomain) ? "shared" : "local", - (PVOID)m_shridThis, this); + "p=%p}\n", + "local", + this); #ifdef SYNCH_STATISTICS @@ -824,14 +757,7 @@ namespace CorUnix lStatContentionCount); #endif // SYNCH_STATISTICS - if (fSharedObject) - { - pSynchManager->CacheAddSharedSynchData(pthrCurrent, m_shridThis); - } - else - { - pSynchManager->CacheAddLocalSynchData(pthrCurrent, this); - } + pSynchManager->CacheAddLocalSynchData(pthrCurrent, this); } return lCount; @@ -846,9 +772,7 @@ namespace CorUnix SynchData (e.g. modifying the object signal count accordingly with its thread release semantics) - Note: this method must be called while holding the appropriate - synchronization locks (the local process synch lock if the target - object is local, both local and shared one if the object is shared). + Note: this method must be called while holding the local process synch lock. --*/ PAL_ERROR CSynchData::ReleaseWaiterWithoutBlocking( CPalThread * pthrCurrent, @@ -922,8 +846,8 @@ namespace CorUnix if (NO_ERROR != palErr) { ERROR("AssignOwnershipToThread failed with error %u; " - "ownership data on object with SynchData {shrid=%p p=%p} " - "may be corrupted\n", palErr, (void *)m_shridThis, this); + "ownership data on object with SynchData {p=%p} " + "may be corrupted\n", palErr, this); } } @@ -1003,13 +927,11 @@ namespace CorUnix --*/ void CSynchData::Signal( CPalThread * pthrCurrent, - LONG lSignalCount, - bool fWorkerThread) + LONG lSignalCount) { VALIDATEOBJECT(this); bool fThreadReleased = false; - bool fDelegatedSignaling = false; bool fReleaseAltersSignalCount = (CObjectType::ThreadReleaseAltersSignalCount == GetObjectType()->GetThreadReleaseSemantics()); @@ -1022,9 +944,7 @@ namespace CorUnix while (m_lSignalCount > 0) { - fThreadReleased = ReleaseFirstWaiter(pthrCurrent, - &fDelegatedSignaling, - fWorkerThread); + fThreadReleased = ReleaseFirstWaiter(pthrCurrent); if (!fThreadReleased) { // No more threads to release: break out of the loop @@ -1036,11 +956,6 @@ namespace CorUnix // Adjust signal count m_lSignalCount--; } - if (fDelegatedSignaling) - { - // Object signaling has been delegated - m_lSignalCount = 0; - } } _ASSERT_MSG(CObjectType::OwnershipTracked != @@ -1071,36 +986,20 @@ namespace CorUnix object is local, both local and shared one if the object is shared). --*/ bool CSynchData::ReleaseFirstWaiter( - CPalThread * pthrCurrent, - bool * pfDelegated, - bool fWorkerThread) + CPalThread * pthrCurrent) { PAL_ERROR palErr = NO_ERROR; - bool fSharedSynchLock = false; - bool fSharedObject = (SharedObject == GetObjectDomain()); bool fThreadAwakened = false; - bool fDelegatedSignaling = false; DWORD * pdwWaitState; DWORD dwObjIdx; SharedID shridItem = NULL, shridNextItem = NULL; WaitingThreadsListNode * pwtlnItem, * pwtlnNextItem; - DWORD dwPid = gPID; CPalSynchronizationManager * pSynchManager = CPalSynchronizationManager::GetInstance(); VALIDATEOBJECT(this); - *pfDelegated = false; - - if (fSharedObject) - { - shridItem = GetWTLHeadShmPtr(); - pwtlnItem = SharedIDToTypePointer(WaitingThreadsListNode, shridItem); - } - else - { - pwtlnItem = GetWTLHeadPtr(); - } + pwtlnItem = GetWTLHeadPtr(); while (pwtlnItem) { @@ -1111,61 +1010,13 @@ namespace CorUnix pdwWaitState = SharedIDToTypePointer(DWORD, pwtlnItem->shridWaitingState); - if (fSharedObject) - { - shridNextItem = pwtlnItem->ptrNext.shrid; - pwtlnNextItem = SharedIDToTypePointer(WaitingThreadsListNode, - shridNextItem); - } - else - { - pwtlnNextItem = pwtlnItem->ptrNext.ptr; - } + pwtlnNextItem = pwtlnItem->ptrNext.ptr; if (fWaitAll) { // Wait All: we need to find out whether the wait is satisfied, - // or it is not, or if that cannot be determined from within - // this process (WaitMayBeSatisfied); in this case we need to - // delegate the object signaling to the process hosting the - // thread that owns the current target WaitingThreadsListNode - - // If the target object is local (fSharedObject == false) - // we're probably not holding the shared lock. - // If the wait is not a LocalWait, it involves at least one - // shared object. If that is the case, at this time we need - // to grab the shared lock. In fact IsRestOfWaitAllSatisfied - // and UnsignalRestOfLocalAwakeningWaitAll must be called - // atomically to prevent that another thread living - // in a different process could race with us stealing the - // signaling from one of the objects involved in the wait-all. - // - // Note: pwtlnItem->ptwiWaitInfo is valid only if the target - // wait originates in the current process. Anyway in the - // following 'if' we don't need to check that since we are - // already making sure that the object is local (!fSharedObject). - // If a wait involves at least one object local to this process, - // it can only be a wait performed by a thread in the current - // process, therefore pwtlnItem->ptwiWaitInfo is valid. - - _ASSERTE(fSharedObject || pwtlnItem->dwProcessId == gPID); - - if (!fSharedSynchLock && !fSharedObject && - LocalWait != pwtlnItem->ptwiWaitInfo->wdWaitDomain) - { - CPalSynchronizationManager::AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - } - - // First check if the current target node is already marked for - // wait all check in progress, and in case skip it by setting - // wcsWaitCompletionState to WaitIsNotSatisfied - bool fMarkedForDelegatedObjectSingalingInProgress = - (0 != (WTLN_FLAG_DELEGATED_OBJECT_SIGNALING_IN_PROGRESS & pwtlnItem->dwFlags)); - - wcsWaitCompletionState = - fMarkedForDelegatedObjectSingalingInProgress ? WaitIsNotSatisfied : - IsRestOfWaitAllSatisfied(pwtlnItem); + // or it is not. + wcsWaitCompletionState = IsRestOfWaitAllSatisfied(pwtlnItem); } else { @@ -1190,171 +1041,74 @@ namespace CorUnix dwObjIdx = pwtlnItem->dwObjIndex; - if (dwPid == pwtlnItem->dwProcessId) + ThreadWaitInfo * ptwiWaitInfo = pwtlnItem->ptwiWaitInfo; + bool fAbandoned = false; + + if (CObjectType::OwnershipTracked == + GetObjectType()->GetOwnershipSemantics()) { - /////////////////////////// - // - // Local Thread Awakening - // - /////////////////////////// - ThreadWaitInfo * ptwiWaitInfo = pwtlnItem->ptwiWaitInfo; - bool fAbandoned = false; - - if (CObjectType::OwnershipTracked == - GetObjectType()->GetOwnershipSemantics()) - { - // Get the abandoned status before resetting it by - // assigning ownership to target thread - fAbandoned = IsAbandoned(); - - // Assign ownership to target thread - // Note: This will cause both ownership count and - // signal count to be greater than zero at the - // same time; the signal count will be anyway - // decremented immediately by the caller - // CsynchData::Signal - palErr = AssignOwnershipToThread(pthrCurrent, - ptwiWaitInfo->pthrOwner); - if (NO_ERROR != palErr) - { - ERROR("Synch Worker: AssignOwnershipToThread " - "failed with error %u; ownership data on " - "object with SynchData %p may be " - "corrupted\n", palErr, this); - } - } + // Get the abandoned status before resetting it by + // assigning ownership to target thread + fAbandoned = IsAbandoned(); - if (fWaitAll) + // Assign ownership to target thread + // Note: This will cause both ownership count and + // signal count to be greater than zero at the + // same time; the signal count will be anyway + // decremented immediately by the caller + // CsynchData::Signal + palErr = AssignOwnershipToThread(pthrCurrent, + ptwiWaitInfo->pthrOwner); + if (NO_ERROR != palErr) { - // Wait all satisfied: unsignal other objects - // involved in the wait - CPalSynchronizationManager::UnsignalRestOfLocalAwakeningWaitAll( - pthrCurrent, - ptwiWaitInfo->pthrOwner, - pwtlnItem, - this); + ERROR("Synch Worker: AssignOwnershipToThread " + "failed with error %u; ownership data on " + "object with SynchData %p may be " + "corrupted\n", palErr, this); } + } - TRACE("Unregistering wait for thread %u and waking it up " - "[pdwWaitState=%p]\n", pwtlnItem->dwThreadId, - pdwWaitState); - - // Unregister the wait - pSynchManager->UnRegisterWait(pthrCurrent, - ptwiWaitInfo, - fSharedObject || fSharedSynchLock); - - // After UnRegisterWait pwtlnItem is invalid - pwtlnItem = NULL; - - palErr = CPalSynchronizationManager::WakeUpLocalThread( + if (fWaitAll) + { + // Wait all satisfied: unsignal other objects + // involved in the wait + CPalSynchronizationManager::UnsignalRestOfLocalAwakeningWaitAll( pthrCurrent, ptwiWaitInfo->pthrOwner, - fAbandoned ? MutexAbandoned : WaitSucceeded, - dwObjIdx); - - if (NO_ERROR != palErr) - { - ERROR("Failed to wakeup local thread %#x: " - "object signaling may be " - "lost\n", ptwiWaitInfo->pthrOwner->GetThreadId()); - } + pwtlnItem, + this); } - else - { - /////////////////////////// - // - // Remote Thread Awakening - // - /////////////////////////// - // Note: if we are here, this cannot be a wait-all - _ASSERT_MSG(!fWaitAll, - "Control should never reach this point if " - "target wait is a wait-all\n"); - - // Wake up remote thread - palErr = CPalSynchronizationManager::WakeUpRemoteThread(shridItem); + TRACE("Unregistering wait for thread %u and waking it up " + "[pdwWaitState=%p]\n", pwtlnItem->dwThreadId, + pdwWaitState); - if (NO_ERROR != palErr) - { - ERROR("Failed to dispatch remote awakening cmd to " - "worker thread in process pid=%d to wake up" - "thread tid=%#x; object signaling may be " - "lost\n", pwtlnItem->dwProcessId, - pwtlnItem->dwThreadId); - } - } + // Unregister the wait + pSynchManager->UnRegisterWait(pthrCurrent, + ptwiWaitInfo); - // A thread has been awakened - fThreadAwakened = true; + // After UnRegisterWait pwtlnItem is invalid + pwtlnItem = NULL; - // break out of the while loop - break; - } - } - else if (WaitMayBeSatisfied == wcsWaitCompletionState) - { - ////////////////////////////////////////// - // - // Wait All with remote thread awakening - // - ////////////////////////////////////////// + palErr = CPalSynchronizationManager::WakeUpLocalThread( + pthrCurrent, + ptwiWaitInfo->pthrOwner, + fAbandoned ? MutexAbandoned : WaitSucceeded, + dwObjIdx); - // - // We need to transfer the object signaling to the process - // hosting the target waiter thread - // + if (NO_ERROR != palErr) + { + ERROR("Failed to wakeup local thread %#x: " + "object signaling may be " + "lost\n", ptwiWaitInfo->pthrOwner->GetThreadId()); + } - _ASSERT_MSG(fWaitAll, - "IsRestOfWaitAllSatisfied() apparently " - "returned -1 on a normal (non wait all) " - "wait\n"); - _ASSERT_MSG(fSharedObject, - "About to delegate object signaling to a remote " - "process, but the signaled object is actually " - "local\n"); - - // Delegate object signaling to target process - palErr = CPalSynchronizationManager::DelegateSignalingToRemoteProcess( - pthrCurrent, - pwtlnItem->dwProcessId, - pwtlnItem->ptrOwnerObjSynchData.shrid); - - TRACE("Delegating object signaling for SynchData shrid=%p\n", - (VOID *)pwtlnItem->ptrOwnerObjSynchData.shrid); - - if (NO_ERROR == palErr) - { - // A remote thread will be awakened - // This will also cause the object to be unsignaled by the - // code calling ReleaseFirstWaiter before releasing the - // synch locks, so no other WaitForMultipleObjects - // involving the target object may race stealing this - // particuklar object signaling + // A thread has been awakened fThreadAwakened = true; - fDelegatedSignaling = true; - // break out of the while loop break; } - else - { - ERROR("Failed to delegate object signaling to remote " - "process %d. Looking for another waiter.\n", - pwtlnItem->dwProcessId); - - // Go on: a different target waiter will be selected - } - } - - if (fWorkerThread && fWaitAll && (dwPid == pwtlnItem->dwProcessId)) - { - // Mark the target wait for object signaling - CPalSynchronizationManager::MarkWaitForDelegatedObjectSignalingInProgress( - pthrCurrent, - pwtlnItem); } // Go to the next item @@ -1362,21 +1116,6 @@ namespace CorUnix pwtlnItem = pwtlnNextItem; } - if (fDelegatedSignaling) - { - *pfDelegated = true; - } - else if (fWorkerThread) - { - // Reset 'delegated object signaling in progress' flags - CPalSynchronizationManager::UnmarkTWListForDelegatedObjectSignalingInProgress( - this); - } - - if (fSharedSynchLock) - { - CPalSynchronizationManager::ReleaseSharedSynchLock(pthrCurrent); - } return fThreadAwakened; } @@ -1396,27 +1135,16 @@ namespace CorUnix { PAL_ERROR palErr = NO_ERROR; LONG lAwakenedCount = 0; - bool fSharedSynchLock = false; - bool fSharedObject = (SharedObject == GetObjectDomain()); DWORD * pdwWaitState; DWORD dwObjIdx; SharedID shridItem = NULL, shridNextItem = NULL; WaitingThreadsListNode * pwtlnItem, * pwtlnNextItem; - DWORD dwPid = gPID; CPalSynchronizationManager * pSynchManager = CPalSynchronizationManager::GetInstance(); VALIDATEOBJECT(this); - if (fSharedObject) - { - shridItem = GetWTLHeadShmPtr(); - pwtlnItem = SharedIDToTypePointer(WaitingThreadsListNode, shridItem); - } - else - { - pwtlnItem = GetWTLHeadPtr(); - } + pwtlnItem = GetWTLHeadPtr(); while (pwtlnItem) { @@ -1426,30 +1154,11 @@ namespace CorUnix pdwWaitState = SharedIDToTypePointer(DWORD, pwtlnItem->shridWaitingState); - if (fSharedObject) - { - shridNextItem = pwtlnItem->ptrNext.shrid; - pwtlnNextItem = SharedIDToTypePointer(WaitingThreadsListNode, - shridNextItem); - } - else - { - pwtlnNextItem = pwtlnItem->ptrNext.ptr; - } + pwtlnNextItem = pwtlnItem->ptrNext.ptr; // See note in similar spot in ReleaseFirstWaiter - _ASSERTE(fSharedObject || pwtlnItem->dwProcessId == gPID); - - if (!fSharedSynchLock && !fSharedObject && - LocalWait != pwtlnItem->ptwiWaitInfo->wdWaitDomain) - { - CPalSynchronizationManager::AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - } - - if( dwPid == pwtlnItem->dwProcessId && - (!fWaitAll || WaitIsSatisfied == IsRestOfWaitAllSatisfied(pwtlnItem)) ) + if(!fWaitAll || WaitIsSatisfied == IsRestOfWaitAllSatisfied(pwtlnItem)) { // // Target wait is satisfied @@ -1505,8 +1214,7 @@ namespace CorUnix // Unregister the wait pSynchManager->UnRegisterWait(pthrCurrent, - ptwiWaitInfo, - fSharedObject || fSharedSynchLock); + ptwiWaitInfo); // After UnRegisterWait pwtlnItem is invalid pwtlnItem = NULL; @@ -1536,10 +1244,6 @@ namespace CorUnix pwtlnItem = pwtlnNextItem; } - if (fSharedSynchLock) - { - CPalSynchronizationManager::ReleaseSharedSynchLock(pthrCurrent); - } return lAwakenedCount; } @@ -1553,10 +1257,6 @@ namespace CorUnix It returns: - WaitIsNotSatisfied if the wait-all is not fully satisfied. - WaitIsSatisfied if the wait-all is fully satisfied. - - WaitMayBeSatisfied if the target thread lives in a different process and - therefore the wait may involve objects local to the remote process, and - as result is generally not possible to say whether or not the wait-all is - fully satisfied from the current process. Note: this method must be called while holding the synchronization locks appropriate to all the objects involved in the wait-all. If any @@ -1580,24 +1280,6 @@ namespace CorUnix _ASSERT_MSG(0 != (WTLN_FLAG_WAIT_ALL & pwtlnNode->dwFlags), "IsRestOfWaitAllSatisfied() called on a normal " "(non wait all) wait"); - _ASSERT_MSG((SharedObject == GetObjectDomain()) == - (0 != (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnNode->dwFlags)), - "WTLN_FLAG_OWNER_OBJECT_IS_SHARED in WaitingThreadsListNode " - "not consistent with target object's domain\n"); - - if(gPID != pwtlnNode->dwProcessId) - { - //////////////////////////// - // - // Remote Thread Awakening - // - //////////////////////////// - - // Cannot determine whether or not the wait all is satisfied from - // this process - wcsWaitCompletionState = WaitMayBeSatisfied; - goto IROWAS_exit; - } /////////////////////////// // @@ -1616,15 +1298,7 @@ namespace CorUnix VALIDATEOBJECT(pwtlnItem); - if (0 != (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnItem->dwFlags)) - { - psdSynchDataItem = SharedIDToTypePointer(CSynchData, - pwtlnItem->ptrOwnerObjSynchData.shrid); - } - else - { - psdSynchDataItem = pwtlnItem->ptrOwnerObjSynchData.ptr; - } + psdSynchDataItem = pwtlnItem->ptrOwnerObjSynchData.ptr; VALIDATEOBJECT(psdSynchDataItem); @@ -1664,7 +1338,6 @@ namespace CorUnix wcsWaitCompletionState = WaitIsSatisfied; } - IROWAS_exit: TRACE("IsRestOfWaitAllSatisfied() returning %u \n", wcsWaitCompletionState); return wcsWaitCompletionState; @@ -1826,13 +1499,6 @@ namespace CorUnix VALIDATEOBJECT(this); VALIDATEOBJECT(pwtlnNewNode); - _ASSERT_MSG(ProcessLocalObject == GetObjectDomain(), - "Trying to enqueue a WaitingThreadsListNode as local " - "on a shared object\n"); - _ASSERT_MSG(0 == (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnNewNode->dwFlags), - "Trying to add a WaitingThreadsListNode marked as shared " - "as it was a local one\n"); - if (!fPrioritize) { // Enqueue normally to the end of the queue @@ -1889,104 +1555,6 @@ namespace CorUnix return; } - /*++ - Method: - CSynchData::SharedWaiterEnqueue - - Adds the WaitingThreadsListNode passed as argument at the end of the - list of WaitingThreadsListNode for the current object, representing - the threads waiting on the current object. The target SynchData is - assumed to be shared among processes - - Note: this method must be called while holding both local and shared - synchronization locks. - --*/ - void CSynchData::SharedWaiterEnqueue(SharedID shridNewNode, bool fPrioritize) - { - VALIDATEOBJECT(this); - - _ASSERT_MSG(SharedObject == GetObjectDomain(), - "Trying to enqueue a WaitingThreadsListNode as shared " - "on a local object\n"); - - if (!fPrioritize) - { - // Enqueue normally to the end of the queue - SharedID shridCurrLast; - WaitingThreadsListNode * pwtlnCurrLast, * pwtlnNewNode; - - shridCurrLast = m_ptrWTLTail.shrid; - pwtlnCurrLast = SharedIDToTypePointer(WaitingThreadsListNode, shridCurrLast); - pwtlnNewNode = SharedIDToTypePointer(WaitingThreadsListNode, shridNewNode); - - _ASSERT_MSG(1 == (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnNewNode->dwFlags), - "Trying to add a WaitingThreadsListNode marked as local " - "as it was a shared one\n"); - - VALIDATEOBJECT(pwtlnNewNode); - - pwtlnNewNode->ptrNext.shrid = NULL; - if (NULL == pwtlnCurrLast) - { - _ASSERT_MSG(NULL == m_ptrWTLHead.shrid, - "Corrupted waiting list on shared CSynchData at " - "{shrid=%p, p=%p}\n", m_shridThis, this); - - pwtlnNewNode->ptrPrev.shrid = NULL; - m_ptrWTLHead.shrid = shridNewNode; - m_ptrWTLTail.shrid = shridNewNode; - } - else - { - VALIDATEOBJECT(pwtlnCurrLast); - - pwtlnNewNode->ptrPrev.shrid = shridCurrLast; - pwtlnCurrLast->ptrNext.shrid = shridNewNode; - m_ptrWTLTail.shrid = shridNewNode; - } - } - else - { - // The wait is prioritized, enqueue to the beginning of the queue - SharedID shridCurrFirst; - WaitingThreadsListNode * pwtlnCurrFirst, * pwtlnNewNode; - - shridCurrFirst = m_ptrWTLHead.shrid; - pwtlnCurrFirst = SharedIDToTypePointer(WaitingThreadsListNode, shridCurrFirst); - pwtlnNewNode = SharedIDToTypePointer(WaitingThreadsListNode, shridNewNode); - - _ASSERT_MSG(1 == (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnNewNode->dwFlags), - "Trying to add a WaitingThreadsListNode marked as local " - "as it was a shared one\n"); - - VALIDATEOBJECT(pwtlnNewNode); - - pwtlnNewNode->ptrPrev.shrid = NULL; - if (NULL == pwtlnCurrFirst) - { - _ASSERT_MSG(NULL == m_ptrWTLTail.shrid, - "Corrupted waiting list on shared CSynchData at " - "{shrid=%p, p=%p}\n", m_shridThis, this); - - pwtlnNewNode->ptrNext.shrid = NULL; - m_ptrWTLHead.shrid = shridNewNode; - m_ptrWTLTail.shrid = shridNewNode; - } - else - { - VALIDATEOBJECT(pwtlnCurrFirst); - - pwtlnNewNode->ptrNext.shrid = shridCurrFirst; - pwtlnCurrFirst->ptrPrev.shrid = shridNewNode; - m_ptrWTLHead.shrid = shridNewNode; - } - } - - m_ulcWaitingThreads += 1; - - return; - } - #ifdef SYNCH_OBJECT_VALIDATION CSynchData::~CSynchData() { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.cpp index f7d505dab..0665df179 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.cpp @@ -40,21 +40,10 @@ SET_DEFAULT_DEBUG_CHANNEL(SYNC); // some headers have code with asserts, so do t #endif // HAVE_POLL #include +#include const int CorUnix::CThreadSynchronizationInfo::PendingSignalingsArraySize; -// We use the synchronization manager's worker thread to handle -// process termination requests. It does so by calling the -// registered handler function. -PTERMINATION_REQUEST_HANDLER g_terminationRequestHandler = NULL; - -// Set the handler for process termination requests. -VOID PALAPI PAL_SetTerminationRequestHandler( - IN PTERMINATION_REQUEST_HANDLER terminationHandler) -{ - g_terminationRequestHandler = terminationHandler; -} - namespace CorUnix { ///////////////////////////////// @@ -152,8 +141,8 @@ namespace CorUnix CPalSynchronizationManager * CPalSynchronizationManager::s_pObjSynchMgr = NULL; Volatile CPalSynchronizationManager::s_lInitStatus = SynchMgrStatusIdle; - CRITICAL_SECTION CPalSynchronizationManager::s_csSynchProcessLock; - CRITICAL_SECTION CPalSynchronizationManager::s_csMonitoredProcessesLock; + minipal_mutex CPalSynchronizationManager::s_csSynchProcessLock; + minipal_mutex CPalSynchronizationManager::s_csMonitoredProcessesLock; CPalSynchronizationManager::CPalSynchronizationManager() : m_dwWorkerThreadTid(0), @@ -232,7 +221,6 @@ namespace CorUnix // Lock AcquireLocalSynchLock(pthrCurrent); - AcquireSharedSynchLock(pthrCurrent); if (AreAPCsPending(pthrCurrent)) { @@ -261,7 +249,6 @@ namespace CorUnix if (fAlertable) { // Unlock - ReleaseSharedSynchLock(pthrCurrent); ReleaseLocalSynchLock(pthrCurrent); } @@ -286,7 +273,6 @@ namespace CorUnix if (fAlertable) { // Unlock - ReleaseSharedSynchLock(pthrCurrent); ReleaseLocalSynchLock(pthrCurrent); } } @@ -402,8 +388,7 @@ namespace CorUnix ptwiWaitInfo = GetThreadWaitInfo(pthrCurrent); // Unregister the wait - // Note: UnRegisterWait will take care of grabbing the shared synch lock, if needed. - UnRegisterWait(pthrCurrent, ptwiWaitInfo, false); + UnRegisterWait(pthrCurrent, ptwiWaitInfo); // Unlock ReleaseLocalSynchLock(pthrCurrent); @@ -564,7 +549,6 @@ namespace CorUnix { PAL_ERROR palErr = NO_ERROR; OwnedObjectsListNode * poolnItem; - bool fSharedSynchLock = false; CThreadSynchronizationInfo * pSynchInfo = &pthrTarget->synchronizationInfo; CPalSynchronizationManager * pSynchManager = GetInstance(); @@ -594,13 +578,6 @@ namespace CorUnix TRACE("Abandoning object with SynchData at %p\n", psdSynchData); - if (!fSharedSynchLock && - (SharedObject == psdSynchData->GetObjectDomain())) - { - AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - } - // Reset ownership data psdSynchData->ResetOwnership(); @@ -612,7 +589,7 @@ namespace CorUnix psdSynchData->SetAbandoned(true); // Signal the object and trigger thread awakening - psdSynchData->Signal(pthrCurrent, 1, false); + psdSynchData->Signal(pthrCurrent, 1); // Release reference to SynchData psdSynchData->Release(pthrCurrent); @@ -661,18 +638,11 @@ namespace CorUnix (0 < pSynchInfo->m_twiWaitInfo.lObjCount)) { // Unregister the wait - // Note: UnRegisterWait will take care of grabbing the shared synch lock, if needed. - UnRegisterWait(pthrCurrent, &pSynchInfo->m_twiWaitInfo, fSharedSynchLock); + UnRegisterWait(pthrCurrent, &pSynchInfo->m_twiWaitInfo); } } // Unlock - if (fSharedSynchLock) - { - ReleaseSharedSynchLock(pthrCurrent); - fSharedSynchLock = false; - } - ReleaseLocalSynchLock(pthrCurrent); if (abandonNamedMutexes) @@ -741,7 +711,6 @@ namespace CorUnix { PAL_ERROR palErr = NO_ERROR; unsigned int uIdx, uCount = 0, uSharedObjectCount = 0; - WaitDomain wdWaitDomain = LocalWait; CObjectType * potObjectType = NULL; unsigned int uErrCleanupIdxFirstNotInitializedCtrlr = 0; unsigned int uErrCleanupIdxLastCtrlr = 0; @@ -790,30 +759,10 @@ namespace CorUnix AcquireLocalSynchLock(pthrCurrent); fLocalSynchLock = true; - for (uIdx=0; uIdxGetObjectDomain()) - { - ++uSharedObjectCount; - } - - if (uSharedObjectCount > 0 && uSharedObjectCount <= uIdx) - { - wdWaitDomain = MixedWait; - break; - } - } - - if (dwObjectCount == uSharedObjectCount) - { - wdWaitDomain = SharedWait; - } - for (uIdx=0;uIdxGetObjectDomain(); palErr = rgObjects[uIdx]->GetObjectSynchData((void **)&pvSData); if (NO_ERROR != palErr) @@ -821,9 +770,7 @@ namespace CorUnix break; } - psdSynchData = (SharedObject == odObjectDomain) ? SharedIDToTypePointer( - CSynchData, reinterpret_cast(pvSData)) : - static_cast(pvSData); + psdSynchData = static_cast(pvSData); VALIDATEOBJECT(psdSynchData); @@ -833,19 +780,15 @@ namespace CorUnix { Ctrlrs.pWaitCtrlrs[uIdx]->Init(pthrCurrent, ctCtrlrType, - odObjectDomain, potObjectType, - psdSynchData, - wdWaitDomain); + psdSynchData); } else { Ctrlrs.pStateCtrlrs[uIdx]->Init(pthrCurrent, ctCtrlrType, - odObjectDomain, potObjectType, - psdSynchData, - wdWaitDomain); + psdSynchData); } if (CSynchControllerBase::WaitController == ctCtrlrType && @@ -963,58 +906,26 @@ namespace CorUnix --*/ PAL_ERROR CPalSynchronizationManager::AllocateObjectSynchData( CObjectType *potObjectType, - ObjectDomain odObjectDomain, VOID **ppvSynchData) { PAL_ERROR palErr = NO_ERROR; CSynchData * psdSynchData = NULL; CPalThread * pthrCurrent = InternalGetCurrentThread(); - if (SharedObject == odObjectDomain) + psdSynchData = m_cacheSynchData.Get(pthrCurrent); + if (NULL == psdSynchData) { - SharedID shridSynchData = m_cacheSHRSynchData.Get(pthrCurrent); - if (NULL == shridSynchData) - { - ERROR("Unable to allocate shared memory\n"); - return ERROR_NOT_ENOUGH_MEMORY; - } - - psdSynchData = SharedIDToTypePointer(CSynchData, shridSynchData); - - VALIDATEOBJECT(psdSynchData); - - _ASSERT_MSG(NULL != psdSynchData, "Bad shared memory pointer\n"); - - // Initialize waiting list pointers - psdSynchData->SetWTLHeadShrPtr(NULL); - psdSynchData->SetWTLTailShrPtr(NULL); - - // Store shared pointer to this object - psdSynchData->SetSharedThis(shridSynchData); - - *ppvSynchData = reinterpret_cast(shridSynchData); + ERROR("Unable to allocate memory\n"); + return ERROR_NOT_ENOUGH_MEMORY; } - else - { - psdSynchData = m_cacheSynchData.Get(pthrCurrent); - if (NULL == psdSynchData) - { - ERROR("Unable to allocate memory\n"); - return ERROR_NOT_ENOUGH_MEMORY; - } - // Initialize waiting list pointers - psdSynchData->SetWTLHeadPtr(NULL); - psdSynchData->SetWTLTailPtr(NULL); + // Initialize waiting list pointers + psdSynchData->SetWTLHeadPtr(NULL); + psdSynchData->SetWTLTailPtr(NULL); - // Set shared this pointer to NULL - psdSynchData->SetSharedThis(NULL); - - *ppvSynchData = static_cast(psdSynchData); - } + *ppvSynchData = static_cast(psdSynchData); // Initialize object domain and object type; - psdSynchData->SetObjectDomain(odObjectDomain); psdSynchData->SetObjectType(potObjectType); return palErr; @@ -1031,27 +942,12 @@ namespace CorUnix --*/ void CPalSynchronizationManager::FreeObjectSynchData( CObjectType *potObjectType, - ObjectDomain odObjectDomain, VOID *pvSynchData) { CSynchData * psdSynchData; CPalThread * pthrCurrent = InternalGetCurrentThread(); - if (odObjectDomain == SharedObject) - { - psdSynchData = SharedIDToTypePointer(CSynchData, - reinterpret_cast(pvSynchData)); - - if (NULL == psdSynchData) - { - ASSERT("Bad shared memory pointer\n"); - return; - } - } - else - { - psdSynchData = static_cast(pvSynchData); - } + psdSynchData = static_cast(pvSynchData); psdSynchData->Release(pthrCurrent); } @@ -1066,16 +962,13 @@ namespace CorUnix CPalThread *pthrCurrent, CObjectType *potObjectType, VOID *pvSynchData, - ObjectDomain odObjectDomain, ISynchStateController **ppStateController) { PAL_ERROR palErr = NO_ERROR; CSynchStateController * pCtrlr = NULL; - WaitDomain wdWaitDomain = (SharedObject == odObjectDomain) ? SharedWait : LocalWait; CSynchData * psdSynchData; - psdSynchData = (SharedObject == odObjectDomain) ? SharedIDToTypePointer(CSynchData, reinterpret_cast(pvSynchData)) - : static_cast(pvSynchData); + psdSynchData = static_cast(pvSynchData); VALIDATEOBJECT(psdSynchData); @@ -1087,10 +980,8 @@ namespace CorUnix pCtrlr->Init(pthrCurrent, CSynchControllerBase::StateController, - odObjectDomain, potObjectType, - psdSynchData, - wdWaitDomain); + psdSynchData); // Succeeded *ppStateController = (ISynchStateController *)pCtrlr; @@ -1113,16 +1004,12 @@ namespace CorUnix CPalThread *pthrCurrent, CObjectType *potObjectType, VOID *pvSynchData, - ObjectDomain odObjectDomain, ISynchWaitController **ppWaitController) { CSynchWaitController * pCtrlr = NULL; - WaitDomain wdWaitDomain = (SharedObject == odObjectDomain) ? SharedWait : LocalWait; CSynchData * psdSynchData; - psdSynchData = (SharedObject == odObjectDomain) ? SharedIDToTypePointer( - CSynchData, reinterpret_cast(pvSynchData)) : - static_cast(pvSynchData); + psdSynchData = static_cast(pvSynchData); VALIDATEOBJECT(psdSynchData); @@ -1134,10 +1021,8 @@ namespace CorUnix pCtrlr->Init(pthrCurrent, CSynchControllerBase::WaitController, - odObjectDomain, potObjectType, - psdSynchData, - wdWaitDomain); + psdSynchData); // Succeeded *ppWaitController = (ISynchWaitController *)pCtrlr; @@ -1162,7 +1047,6 @@ namespace CorUnix DWORD * pdwWaitState; ThreadWaitInfo * pTargetTWInfo = GetThreadWaitInfo(pthrTarget); bool fLocalSynchLock = false; - bool fSharedSynchLock = false; bool fThreadLock = false; ptainNode = m_cacheThreadApcInfoNodes.Get(pthrCurrent); @@ -1180,12 +1064,6 @@ namespace CorUnix AcquireLocalSynchLock(pthrCurrent); fLocalSynchLock = true; - if (LocalWait != pTargetTWInfo->wdWaitDomain) - { - AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - } - pthrTarget->Lock(pthrCurrent); fThreadLock = true; @@ -1235,7 +1113,7 @@ namespace CorUnix if (TWS_ALERTABLE == dwWaitState) { // Unregister the wait - UnRegisterWait(pthrCurrent, pTargetTWInfo, fSharedSynchLock); + UnRegisterWait(pthrCurrent, pTargetTWInfo); // Wake up target thread palErr = WakeUpLocalThread( @@ -1257,11 +1135,6 @@ namespace CorUnix pthrTarget->Unlock(pthrCurrent); } - if (fSharedSynchLock) - { - ReleaseSharedSynchLock(pthrCurrent); - } - if (fLocalSynchLock) { ReleaseLocalSynchLock(pthrCurrent); @@ -1275,25 +1148,6 @@ namespace CorUnix return palErr; } - /*++ - Method: - CPalSynchronizationManager::SendTerminationRequestToWorkerThread - - Send a request to the worker thread to initiate process termination. - --*/ - PAL_ERROR CPalSynchronizationManager::SendTerminationRequestToWorkerThread() - { - PAL_ERROR palErr = GetInstance()->WakeUpLocalWorkerThread(SynchWorkerCmdTerminationRequest); - if (palErr != NO_ERROR) - { - ERROR("Failed to wake up worker thread [errno=%d {%s%}]\n", - errno, strerror(errno)); - palErr = ERROR_INTERNAL_ERROR; - } - - return palErr; - } - /*++ Method: CPalSynchronizationManager::AreAPCsPending @@ -1444,10 +1298,10 @@ namespace CorUnix goto I_exit; } - InternalInitializeCriticalSection(&s_csSynchProcessLock); - InternalInitializeCriticalSection(&s_csMonitoredProcessesLock); + minipal_mutex_init(&s_csSynchProcessLock); + minipal_mutex_init(&s_csMonitoredProcessesLock); - pSynchManager = InternalNew(); + pSynchManager = new(std::nothrow) CPalSynchronizationManager(); if (NULL == pSynchManager) { ERROR("Failed to allocate memory for Synchronization Manager"); @@ -1455,13 +1309,14 @@ namespace CorUnix goto I_exit; } +#ifndef __wasm__ if (!pSynchManager->CreateProcessPipe()) { ERROR("Unable to create process pipe \n"); palErr = ERROR_OPEN_FAILED; goto I_exit; } - +#endif s_pObjSynchMgr = pSynchManager; // Initialization was successful @@ -1480,7 +1335,7 @@ namespace CorUnix s_pObjSynchMgr = NULL; g_pSynchronizationManager = NULL; - InternalDelete(pSynchManager); + delete pSynchManager; } return palErr; @@ -1672,22 +1527,6 @@ namespace CorUnix return palErr; } - // Entry point routine for the thread that initiates process termination. - DWORD PALAPI TerminationRequestHandlingRoutine(LPVOID pArg) - { - // Call the termination request handler if one is registered. - if (g_terminationRequestHandler != NULL) - { - // The process will terminate normally by calling exit. - // We use an exit code of '128 + signo'. This is a convention used in popular - // shells to calculate an exit code when the process was terminated by a signal. - // This is also used by the Process.ExitCode implementation. - g_terminationRequestHandler(128 + SIGTERM); - } - - return 0; - } - /*++ Method: CPalSynchronizationManager::WorkerThread @@ -1708,9 +1547,7 @@ namespace CorUnix reinterpret_cast(pArg); CPalThread * pthrWorker = InternalGetCurrentThread(); - InternalSetThreadDescription(pthrWorker, - PAL_GetCurrentThread(), - W(".NET SynchManager")); + SetThreadDescription(PAL_GetCurrentThread(), W(".NET SynchManager")); while (!fWorkerIsDone) { @@ -1728,31 +1565,6 @@ namespace CorUnix } switch (swcCmd) { - case SynchWorkerCmdTerminationRequest: - // This worker thread is being asked to initiate process termination - - HANDLE hTerminationRequestHandlingThread; - palErr = InternalCreateThread(pthrWorker, - NULL, - 0, - &TerminationRequestHandlingRoutine, - NULL, - 0, - PalWorkerThread, - NULL, - &hTerminationRequestHandlingThread); - - if (NO_ERROR != palErr) - { - ERROR("Unable to create worker thread\n"); - } - - if (hTerminationRequestHandlingThread != NULL) - { - CloseHandle(hTerminationRequestHandlingThread); - } - - break; case SynchWorkerCmdNop: TRACE("Synch Worker: received SynchWorkerCmdNop\n"); if (fShuttingDown) @@ -1784,154 +1596,6 @@ namespace CorUnix } } break; - case SynchWorkerCmdRemoteSignal: - { - // Note: this cannot be a wait all - WaitingThreadsListNode * pWLNode; - ThreadWaitInfo * ptwiWaitInfo; - DWORD dwObjIndex; - bool fSharedSynchLock = false; - - // Lock - AcquireLocalSynchLock(pthrWorker); - AcquireSharedSynchLock(pthrWorker); - fSharedSynchLock = true; - - pWLNode = SharedIDToTypePointer(WaitingThreadsListNode, - shridMarshaledData); - - _ASSERT_MSG(NULL != pWLNode, "Received bad Shared ID %p\n", - shridMarshaledData); - _ASSERT_MSG(gPID == pWLNode->dwProcessId, - "Remote signal apparently sent to the wrong " - "process [target pid=%u current pid=%u]\n", - pWLNode->dwProcessId, gPID); - _ASSERT_MSG(0 == (WTLN_FLAG_WAIT_ALL & pWLNode->dwFlags), - "Wait all with remote awakening delegated " - "through SynchWorkerCmdRemoteSignal rather than " - "SynchWorkerCmdDelegatedObjectSignaling\n"); - - - // Get the object index - dwObjIndex = pWLNode->dwObjIndex; - - // Get the WaitInfo - ptwiWaitInfo = pWLNode->ptwiWaitInfo; - - // Initialize the WakeUpReason to WaitSucceeded - twrWakeUpReason = WaitSucceeded; - - CSynchData * psdSynchData = - SharedIDToTypePointer(CSynchData, - pWLNode->ptrOwnerObjSynchData.shrid); - - TRACE("Synch Worker: received REMOTE SIGNAL cmd " - "[WInfo=%p {Type=%u Domain=%u ObjCount=%d TgtThread=%x} " - "SynchData={shriId=%p p=%p} {SigCount=%d IsAbandoned=%d}\n", - ptwiWaitInfo, ptwiWaitInfo->wtWaitType, ptwiWaitInfo->wdWaitDomain, - ptwiWaitInfo->lObjCount, ptwiWaitInfo->pthrOwner->GetThreadId(), - (VOID *)pWLNode->ptrOwnerObjSynchData.shrid, psdSynchData, - psdSynchData->GetSignalCount(), psdSynchData->IsAbandoned()); - - if (CObjectType::OwnershipTracked == - psdSynchData->GetObjectType()->GetOwnershipSemantics()) - { - // Abandoned status is not propagated through process - // pipe: need to get it from the object itself before - // resetting the data by acquiring the object ownership - if (psdSynchData->IsAbandoned()) - { - twrWakeUpReason = MutexAbandoned; - } - - // Acquire ownership - palErr = psdSynchData->AssignOwnershipToThread( - pthrWorker, - ptwiWaitInfo->pthrOwner); - if (NO_ERROR != palErr) - { - ERROR("Synch Worker: AssignOwnershipToThread " - "failed with error %u; ownership data on " - "object with SynchData %p may be " - "corrupted\n", palErr, psdSynchData); - } - } - - // Unregister the wait - pSynchManager->UnRegisterWait(pthrWorker, - ptwiWaitInfo, - fSharedSynchLock); - - // pWLNode is no longer valid after UnRegisterWait - pWLNode = NULL; - - TRACE("Synch Worker: Waking up local thread %x " - "{WakeUpReason=%u ObjIndex=%u}\n", - ptwiWaitInfo->pthrOwner->GetThreadId(), - twrWakeUpReason, dwObjIndex); - - // Wake up the target thread - palErr = WakeUpLocalThread( - pthrWorker, - ptwiWaitInfo->pthrOwner, - twrWakeUpReason, - dwObjIndex); - if (NO_ERROR != palErr) - { - ERROR("Synch Worker: Failed to wake up local thread " - "%#x while propagating remote signaling: " - "object signaling may be lost\n", - ptwiWaitInfo->pthrOwner->GetThreadId()); - } - - // Unlock - ReleaseSharedSynchLock(pthrWorker); - fSharedSynchLock = false; - ReleaseLocalSynchLock(pthrWorker); - - break; - } - case SynchWorkerCmdDelegatedObjectSignaling: - { - CSynchData * psdSynchData; - - TRACE("Synch Worker: received " - "SynchWorkerCmdDelegatedObjectSignaling\n"); - - psdSynchData = SharedIDToTypePointer(CSynchData, - shridMarshaledData); - - _ASSERT_MSG(NULL != psdSynchData, "Received bad Shared ID %p\n", - shridMarshaledData); - _ASSERT_MSG(0 < dwData && (DWORD)INT_MAX > dwData, - "Received remote signaling with invalid signal " - "count\n"); - - // Lock - AcquireLocalSynchLock(pthrWorker); - AcquireSharedSynchLock(pthrWorker); - - TRACE("Synch Worker: received DELEGATED OBJECT SIGNALING " - "cmd [SynchData={shriId=%p p=%p} SigCount=%u] [Current obj SigCount=%d " - "IsAbandoned=%d]\n", (VOID *)shridMarshaledData, - psdSynchData, dwData, psdSynchData->GetSignalCount(), - psdSynchData->IsAbandoned()); - - psdSynchData->Signal(pthrWorker, - psdSynchData->GetSignalCount() + dwData, - true); - - // Current SynchData has been AddRef'd by remote process in - // order to be marshaled to the current one, therefore at - // this point we need to release it - psdSynchData->Release(pthrWorker); - - // Unlock - ReleaseSharedSynchLock(pthrWorker); - ReleaseLocalSynchLock(pthrWorker); - - break; - } case SynchWorkerCmdShutdown: TRACE("Synch Worker: received SynchWorkerCmdShutdown\n"); @@ -2040,62 +1704,12 @@ namespace CorUnix } _ASSERT_MSG(SynchWorkerCmdNop == swcWorkerCmd || - SynchWorkerCmdRemoteSignal == swcWorkerCmd || - SynchWorkerCmdDelegatedObjectSignaling == swcWorkerCmd || - SynchWorkerCmdShutdown == swcWorkerCmd || - SynchWorkerCmdTerminationRequest == swcWorkerCmd, + SynchWorkerCmdShutdown == swcWorkerCmd, "Unknown worker command code %u\n", swcWorkerCmd); TRACE("Got cmd %u from process pipe\n", swcWorkerCmd); } - if (SynchWorkerCmdRemoteSignal == swcWorkerCmd || - SynchWorkerCmdDelegatedObjectSignaling == swcWorkerCmd) - { - SharedID shridMarshaledId = NULL; - - TRACE("Received %s cmd\n", - (swcWorkerCmd == SynchWorkerCmdRemoteSignal) ? - "REMOTE SIGNAL" : "DELEGATED OBJECT SIGNALING" ); - - iRet = ReadBytesFromProcessPipe(WorkerCmdCompletionTimeout, - (BYTE *)&shridMarshaledId, - sizeof(shridMarshaledId)); - if (sizeof(shridMarshaledId) != iRet) - { - ERROR("Unable to read marshaled Shared ID from the " - "process pipe [pipe=%d ret=%d errno=%d (%s)]\n", - m_iProcessPipeRead, iRet, errno, strerror(errno)); - - return ERROR_INTERNAL_ERROR; - } - - TRACE("Received marshaled shrid=%p\n", (VOID *)shridMarshaledId); - - *pshridMarshaledData = shridMarshaledId; - } - - if (SynchWorkerCmdDelegatedObjectSignaling == swcWorkerCmd) - { - DWORD dwData; - - iRet = ReadBytesFromProcessPipe(WorkerCmdCompletionTimeout, - (BYTE *)&dwData, - sizeof(dwData)); - if (sizeof(dwData) != iRet) - { - ERROR("Unable to read signal count from the " - "process pipe [pipe=%d ret=%d errno=%d (%s)]\n", - m_iProcessPipeRead, iRet, errno, strerror(errno)); - - return ERROR_INTERNAL_ERROR; - } - - TRACE("Received signal count %u\n", dwData); - - *pdwData = dwData; - } - *pswcWorkerCmd = swcWorkerCmd; return NO_ERROR; } @@ -2148,9 +1762,9 @@ namespace CorUnix } else { - tv.tv_usec = (iTimeout % tccSecondsToMillieSeconds) * - tccMillieSecondsToMicroSeconds; - tv.tv_sec = iTimeout / tccSecondsToMillieSeconds; + tv.tv_usec = (iTimeout % tccSecondsToMilliSeconds) * + tccMilliSecondsToMicroSeconds; + tv.tv_sec = iTimeout / tccSecondsToMilliSeconds; ptv = &tv; } @@ -2179,9 +1793,9 @@ namespace CorUnix } else { - ts.tv_nsec = (iTimeout % tccSecondsToMillieSeconds) * - tccMillieSecondsToNanoSeconds; - ts.tv_sec = iTimeout / tccSecondsToMillieSeconds; + ts.tv_nsec = (iTimeout % tccSecondsToMilliSeconds) * + tccMilliSecondsToNanoSeconds; + ts.tv_sec = iTimeout / tccSecondsToMilliSeconds; pts = &ts; } @@ -2430,7 +2044,7 @@ namespace CorUnix // If the array is full, add the target thread object at the end // of the overflow list DeferredSignalingListNode * pdsln = - InternalNew(); + new(std::nothrow) DeferredSignalingListNode(); if (pdsln) { @@ -2513,209 +2127,6 @@ namespace CorUnix return palErr; } - /*++ - Method: - CPalSynchronizationManager::ReadBytesFromProcessPipe - - Wakes up a remote thead currently sleeping for a wait or a sleep - by sending the appropriate cmd to the remote process' worker - thread, which will take care to convert this command into a - WakeUpLocalThread in the remote process - --*/ - PAL_ERROR CPalSynchronizationManager::WakeUpRemoteThread( - SharedID shridWLNode) - { - const int MsgSize = sizeof(BYTE) + sizeof(SharedID); - PAL_ERROR palErr = NO_ERROR; - BYTE rgSendBuf[MsgSize]; - BYTE * pbySrc, * pbyDst = rgSendBuf; - WaitingThreadsListNode * pWLNode = SharedIDToTypePointer(WaitingThreadsListNode, shridWLNode); - - - _ASSERT_MSG(NULL != pWLNode, "Bad shared wait list node identifier (%p)\n", (VOID*)shridWLNode); - _ASSERT_MSG(gPID != pWLNode->dwProcessId, "WakeUpRemoteThread called on local thread\n"); - _ASSERT_MSG(NULL != shridWLNode, "NULL shared identifier\n"); - _ASSERT_MSG(MsgSize <= PIPE_BUF, "Message too long [MsgSize=%d PIPE_BUF=%d]\n", MsgSize, (int)PIPE_BUF); - - TRACE("Waking up remote thread {pid=%x, tid=%x} by sending cmd=%u and shridWLNode=%p over process pipe\n", - pWLNode->dwProcessId, pWLNode->dwThreadId, SynchWorkerCmdRemoteSignal, (VOID *)shridWLNode); - - // Prepare the message - // Cmd - *pbyDst++ = (BYTE)(SynchWorkerCmdRemoteSignal & 0xFF); - - // WaitingThreadsListNode (not aligned, copy byte by byte) - pbySrc = (BYTE *)&shridWLNode; - for (int i = 0; i < (int)sizeof(SharedID); i++) - { - *pbyDst++ = *pbySrc++; - } - - _ASSERT_MSG(pbyDst <= rgSendBuf + MsgSize + 1, "Buffer overrun"); - - // Send the message - palErr = SendMsgToRemoteWorker(pWLNode->dwProcessId, rgSendBuf, MsgSize); - if (NO_ERROR != palErr) - { - ERROR("Failed sending message to remote worker in process %u\n", pWLNode->dwProcessId); - } - - return palErr; - } - - /*++ - Method: - CPalSynchronizationManager::DelegateSignalingToRemoteProcess - - This method transfers an object signaling operation to a remote process, - where it will be performed by the worker thread. Such delegation takes - place when the currently processed thread (among those waiting on the - signald object) lives in a different process as the signaling thread, - and it is performing a wait all. In this case generally is not possible - to find out whether or not the wait all is satisfied, therefore the - signaling operation must be continued in the target process. - --*/ - PAL_ERROR CPalSynchronizationManager::DelegateSignalingToRemoteProcess( - CPalThread * pthrCurrent, - DWORD dwTargetProcessId, - SharedID shridSynchData) - { - const int MsgSize = sizeof(BYTE) + sizeof(SharedID) + sizeof(DWORD); - int i; - PAL_ERROR palErr = NO_ERROR; - BYTE rgSendBuf[MsgSize]; - BYTE * pbySrc, * pbyDst = rgSendBuf; - DWORD dwSigCount; - CSynchData * psdSynchData = - SharedIDToTypePointer(CSynchData, shridSynchData); - - _ASSERT_MSG(gPID != dwTargetProcessId, " called on local thread\n"); - _ASSERT_MSG(NULL != shridSynchData, "NULL shared identifier\n"); - _ASSERT_MSG(NULL != psdSynchData, "Bad shared SynchData identifier (%p)\n", (VOID*)shridSynchData); - _ASSERT_MSG(MsgSize <= PIPE_BUF, "Message too long [MsgSize=%d PIPE_BUF=%d]\n", MsgSize, (int)PIPE_BUF); - - TRACE("Transfering wait all signaling to remote process pid=%x by sending cmd=%u and shridSynchData=%p over process pipe\n", - dwTargetProcessId, SynchWorkerCmdDelegatedObjectSignaling, (VOID *)shridSynchData); - - dwSigCount = psdSynchData->GetSignalCount(); - - // AddRef SynchData to be marshaled to remote process - psdSynchData->AddRef(); - - // - // Prepare the message - // - - // Cmd - *pbyDst++ = (BYTE)(SynchWorkerCmdDelegatedObjectSignaling & 0xFF); - - // CSynchData (not aligned, copy byte by byte) - pbySrc = (BYTE *)&shridSynchData; - for (i=0; i<(int)sizeof(SharedID); i++) - { - *pbyDst++ = *pbySrc++; - } - - // Signal Count (not aligned, copy byte by byte) - pbySrc = (BYTE *)&dwSigCount; - for (i=0; i<(int)sizeof(DWORD); i++) - { - *pbyDst++ = *pbySrc++; - } - - _ASSERT_MSG(pbyDst <= rgSendBuf + MsgSize + 1, "Buffer overrun"); - - // Send the message - palErr = SendMsgToRemoteWorker(dwTargetProcessId, rgSendBuf, MsgSize); - if (NO_ERROR != palErr) - { - TRACE("Failed sending message to remote worker in process %u\n", dwTargetProcessId); - - // Undo refcounting - psdSynchData->Release(pthrCurrent); - } - - return palErr; - } - - /*++ - Method: - CPalSynchronizationManager::SendMsgToRemoteWorker - - Sends a message (command + data) to a remote process's worker thread. - --*/ - PAL_ERROR CPalSynchronizationManager::SendMsgToRemoteWorker( - DWORD dwProcessId, - BYTE * pMsg, - int iMsgSize) - { -#ifndef CORECLR - PAL_ERROR palErr = NO_ERROR; - int iProcessPipe, iBytesToWrite, iRetryCount; - ssize_t sszRet; - char strPipeFilename[MAX_PATH]; - BYTE * pPos = pMsg; - bool fRet; - CPalThread *pthrCurrent = InternalGetCurrentThread(); - - _ASSERT_MSG(gPID != dwProcessId, "SendMsgToRemoteWorker called with local process as target process\n"); - - fRet = GetProcessPipeName(strPipeFilename, MAX_PATH, dwProcessId); - - _ASSERT_MSG(fRet, "Failed to retrieve process pipe's name!\n"); - - iProcessPipe = InternalOpen(strPipeFilename, O_WRONLY); - if (-1 == iProcessPipe) - { - ERROR("Unable to open a process pipe to wake up a remote thread " - "[pid=%u errno=%d (%s) PipeFilename=%s]\n", dwProcessId, - errno, strerror(errno), strPipeFilename); - palErr = ERROR_INTERNAL_ERROR; - goto SMTRW_exit; - } - - pPos = pMsg; - iBytesToWrite = iMsgSize; - while (0 < iBytesToWrite) - { - iRetryCount = 0; - do - { - sszRet = write(iProcessPipe, pPos, iBytesToWrite); - } while (-1 == sszRet && - EAGAIN == errno && - ++iRetryCount < MaxConsecutiveEagains && - 0 == sched_yield()); - - if (0 >= sszRet) - { - ERROR("Error writing message to process pipe %d [target_pid=%u " - "bytes_to_write=%d bytes_written=%d ret=%d errno=%d (%s) " - "PipeFilename=%s]\n", iProcessPipe, dwProcessId, iMsgSize, - iMsgSize - iBytesToWrite, (int)sszRet, errno, strerror(errno), - strPipeFilename); - palErr = ERROR_INTERNAL_ERROR; - break; - } - iBytesToWrite -= (int)sszRet; - pPos += sszRet; - - _ASSERT_MSG(0 == iBytesToWrite, - "Interleaved messages while writing to process pipe %d\n", - iProcessPipe); - } - - // Close the opened pipe - close(iProcessPipe); - - SMTRW_exit: - return palErr; -#else // !CORECLR - ASSERT("There should never be a reason to send a message to a remote worker\n"); - return ERROR_INTERNAL_ERROR; -#endif // !CORECLR - } - /*++ Method: CPalSynchronizationManager::WakeUpLocalWorkerThread @@ -2732,9 +2143,8 @@ namespace CorUnix "Value too big for swcWorkerCmd\n"); _ASSERT_MSG((SynchWorkerCmdNop == swcWorkerCmd) || - (SynchWorkerCmdShutdown == swcWorkerCmd) || - (SynchWorkerCmdTerminationRequest == swcWorkerCmd), - "WakeUpLocalWorkerThread supports only SynchWorkerCmdNop, SynchWorkerCmdShutdown, and SynchWorkerCmdTerminationRequest." + (SynchWorkerCmdShutdown == swcWorkerCmd), + "WakeUpLocalWorkerThread supports only SynchWorkerCmdNop and SynchWorkerCmdShutdown." "[received cmd=%d]\n", swcWorkerCmd); BYTE byCmd = (BYTE)(swcWorkerCmd & 0xFF); @@ -2793,23 +2203,14 @@ namespace CorUnix --*/ void CPalSynchronizationManager::UnRegisterWait( CPalThread * pthrCurrent, - ThreadWaitInfo * ptwiWaitInfo, - bool fHaveSharedLock) + ThreadWaitInfo * ptwiWaitInfo) { int i = 0; CSynchData * psdSynchData = NULL; - bool fSharedSynchLock = false; - if (!fHaveSharedLock && LocalWait != ptwiWaitInfo->wdWaitDomain) - { - AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - } - - TRACE("Unregistering wait for thread=%u [ObjCount=%d WaitType=%u WaitDomain=%u]\n", + TRACE("Unregistering wait for thread=%u [ObjCount=%d WaitType=%u]\n", ptwiWaitInfo->pthrOwner->GetThreadId(), - ptwiWaitInfo->lObjCount, ptwiWaitInfo->wtWaitType, - ptwiWaitInfo->wdWaitDomain); + ptwiWaitInfo->lObjCount, ptwiWaitInfo->wtWaitType); for (i=0; i < ptwiWaitInfo->lObjCount; i++) { @@ -2817,72 +2218,32 @@ namespace CorUnix VALIDATEOBJECT(pwtlnItem); - if (pwtlnItem->dwFlags & WTLN_FLAG_OWNER_OBJECT_IS_SHARED) - { - // Shared object - WaitingThreadsListNode * pwtlnItemNext, * pwtlnItemPrev; - - psdSynchData = SharedIDToTypePointer(CSynchData, - pwtlnItem->ptrOwnerObjSynchData.shrid); - - VALIDATEOBJECT(psdSynchData); - - pwtlnItemNext = SharedIDToTypePointer(WaitingThreadsListNode, - pwtlnItem->ptrNext.shrid); - pwtlnItemPrev = SharedIDToTypePointer(WaitingThreadsListNode, - pwtlnItem->ptrPrev.shrid); - if (pwtlnItemPrev) - { - VALIDATEOBJECT(pwtlnItemPrev); - pwtlnItemPrev->ptrNext.shrid = pwtlnItem->ptrNext.shrid; - } - else - { - psdSynchData->SetWTLHeadShrPtr(pwtlnItem->ptrNext.shrid); - } + psdSynchData = pwtlnItem->ptrOwnerObjSynchData.ptr; - if (pwtlnItemNext) - { - VALIDATEOBJECT(pwtlnItemNext); - pwtlnItemNext->ptrPrev.shrid = pwtlnItem->ptrPrev.shrid; - } - else - { - psdSynchData->SetWTLTailShrPtr(pwtlnItem->ptrPrev.shrid); - } + VALIDATEOBJECT(psdSynchData); - m_cacheSHRWTListNodes.Add(pthrCurrent, pwtlnItem->shridSHRThis); + if (pwtlnItem->ptrPrev.ptr) + { + VALIDATEOBJECT(pwtlnItem); + pwtlnItem->ptrPrev.ptr->ptrNext.ptr = pwtlnItem->ptrNext.ptr; } else { - // Local object - psdSynchData = pwtlnItem->ptrOwnerObjSynchData.ptr; - - VALIDATEOBJECT(psdSynchData); - - if (pwtlnItem->ptrPrev.ptr) - { - VALIDATEOBJECT(pwtlnItem); - pwtlnItem->ptrPrev.ptr->ptrNext.ptr = pwtlnItem->ptrNext.ptr; - } - else - { - psdSynchData->SetWTLHeadPtr(pwtlnItem->ptrNext.ptr); - } - - if (pwtlnItem->ptrNext.ptr) - { - VALIDATEOBJECT(pwtlnItem); - pwtlnItem->ptrNext.ptr->ptrPrev.ptr = pwtlnItem->ptrPrev.ptr; - } - else - { - psdSynchData->SetWTLTailPtr(pwtlnItem->ptrPrev.ptr); - } + psdSynchData->SetWTLHeadPtr(pwtlnItem->ptrNext.ptr); + } - m_cacheWTListNodes.Add(pthrCurrent, pwtlnItem); + if (pwtlnItem->ptrNext.ptr) + { + VALIDATEOBJECT(pwtlnItem); + pwtlnItem->ptrNext.ptr->ptrPrev.ptr = pwtlnItem->ptrPrev.ptr; + } + else + { + psdSynchData->SetWTLTailPtr(pwtlnItem->ptrPrev.ptr); } + m_cacheWTListNodes.Add(pthrCurrent, pwtlnItem); + // Release the node's refcount on the synch data, and decerement // waiting thread count psdSynchData->DecrementWaitingThreadCount(); @@ -2890,16 +2251,8 @@ namespace CorUnix } // Reset wait data in ThreadWaitInfo structure: it is enough - // to reset lObjCount, lSharedObjCount and wdWaitDomain. + // to reset lObjCount. ptwiWaitInfo->lObjCount = 0; - ptwiWaitInfo->lSharedObjCount = 0; - ptwiWaitInfo->wdWaitDomain = LocalWait; - - // Done - if (fSharedSynchLock) - { - ReleaseSharedSynchLock(pthrCurrent); - } return; } @@ -2936,9 +2289,6 @@ namespace CorUnix _ASSERT_MSG(0 != (WTLN_FLAG_WAIT_ALL & pwtlnNode->dwFlags), "UnsignalRestOfLocalAwakeningWaitAll() called on a normal (non wait all) wait"); - _ASSERT_MSG(gPID == pwtlnNode->dwProcessId, - "UnsignalRestOfLocalAwakeningWaitAll() called on a wait all with remote awakening"); - ThreadWaitInfo *ptwiWaitInfo = pwtlnNode->ptwiWaitInfo; int iObjCount = ptwiWaitInfo->lObjCount; @@ -2948,14 +2298,7 @@ namespace CorUnix VALIDATEOBJECT(pwtlnItem); - if (0 != (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnItem->dwFlags)) - { - psdSynchDataItem = SharedIDToTypePointer(CSynchData, pwtlnItem->ptrOwnerObjSynchData.shrid); - } - else - { - psdSynchDataItem = pwtlnItem->ptrOwnerObjSynchData.ptr; - } + psdSynchDataItem = pwtlnItem->ptrOwnerObjSynchData.ptr; VALIDATEOBJECT(psdSynchDataItem); @@ -2978,101 +2321,6 @@ namespace CorUnix _ASSERT_MSG(bOriginatingNodeFound, "Couldn't find originating node while unsignaling rest of the wait all\n"); } - /*++ - Method: - CPalSynchronizationManager::MarkWaitForDelegatedObjectSignalingInProgress - - Marks all the thread waiting list nodes involved in the current wait-all - for "delegated object signaling in progress", so that this wait cannot be - involved in another delegated object signaling that may happen while the - current object singaling is being tranfered to the target process (while - transfering it, synchronization locks are released in this process and later - grabbed again in the target process; in this time window another thread - could signal another object part of the same wait-all. In this case no - signal delegation must take place. - - Note: this method must be called while holding the synchronization locks - appropriate to the target object described by pwtlnNode (i.e. the - local process synch lock if the target object is local, both local - and shared one if the object is shared). - --*/ - void CPalSynchronizationManager::MarkWaitForDelegatedObjectSignalingInProgress( - CPalThread * pthrCurrent, - WaitingThreadsListNode * pwtlnNode) - { - bool fSharedSynchLock = false; - bool fTargetObjectIsShared = (0 != (WTLN_FLAG_OWNER_OBJECT_IS_SHARED & pwtlnNode->dwFlags)); - - VALIDATEOBJECT(pwtlnNode); - - _ASSERT_MSG(gPID == pwtlnNode->dwProcessId, - "MarkWaitForDelegatedObjectSignalingInProgress() called from the wrong process"); - - ThreadWaitInfo *ptwiWaitInfo = pwtlnNode->ptwiWaitInfo; - - if (!fSharedSynchLock && !fTargetObjectIsShared && - LocalWait != ptwiWaitInfo->wdWaitDomain) - { - AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - } - - _ASSERT_MSG(MultipleObjectsWaitAll == ptwiWaitInfo->wtWaitType, - "MarkWaitForDelegatedObjectSignalingInProgress() called on a normal (non wait-all) wait"); - - // Unmark all nodes other than the target one - int iTgtCount = ptwiWaitInfo->lObjCount; - for (int i = 0; i < iTgtCount; i++) - { - VALIDATEOBJECT(ptwiWaitInfo->rgpWTLNodes[i]); - ptwiWaitInfo->rgpWTLNodes[i]->dwFlags &= ~WTLN_FLAG_DELEGATED_OBJECT_SIGNALING_IN_PROGRESS; - } - - // Mark the target node - pwtlnNode->dwFlags |= WTLN_FLAG_DELEGATED_OBJECT_SIGNALING_IN_PROGRESS; - - // Done - if (fSharedSynchLock) - { - ReleaseSharedSynchLock(pthrCurrent); - } - - return; - } - - /*++ - Method: - CPalSynchronizationManager::UnmarkTWListForDelegatedObjectSignalingInProgress - - Resets the "delegated object signaling in progress" flags in all the - nodes of the thread waitin list for the target waitable objects (represented - by its SynchData) - - Note: this method must be called while holding the appropriate - synchronization locks (the local process synch lock if the target - object is local, both local and shared one if the object is shared). - --*/ - void CPalSynchronizationManager::UnmarkTWListForDelegatedObjectSignalingInProgress( - CSynchData * pTgtObjectSynchData) - { - bool fSharedObject = (SharedObject == pTgtObjectSynchData->GetObjectDomain()); - WaitingThreadsListNode * pwtlnNode; - - VALIDATEOBJECT(pTgtObjectSynchData); - - pwtlnNode = fSharedObject ? SharedIDToTypePointer(WaitingThreadsListNode, pTgtObjectSynchData->GetWTLHeadShmPtr()) - : pTgtObjectSynchData->GetWTLHeadPtr(); - - while (pwtlnNode) - { - VALIDATEOBJECT(pwtlnNode); - - pwtlnNode->dwFlags &= ~WTLN_FLAG_DELEGATED_OBJECT_SIGNALING_IN_PROGRESS; - pwtlnNode = fSharedObject ? SharedIDToTypePointer(WaitingThreadsListNode, pwtlnNode->ptrNext.shrid) - : pwtlnNode->ptrNext.ptr; - } - } - /*++ Method: CPalSynchronizationManager::RegisterProcessForMonitoring @@ -3095,7 +2343,7 @@ namespace CorUnix VALIDATEOBJECT(psdSynchData); - InternalEnterCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_enter(&s_csMonitoredProcessesLock); fMonitoredProcessesLock = true; @@ -3117,7 +2365,7 @@ namespace CorUnix } else { - pmpln = InternalNew(); + pmpln = new(std::nothrow) MonitoredProcessesListNode(); if (NULL == pmpln) { ERROR("No memory to allocate MonitoredProcessesListNode structure\n"); @@ -3144,7 +2392,7 @@ namespace CorUnix } // Unlock - InternalLeaveCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_leave(&s_csMonitoredProcessesLock); fMonitoredProcessesLock = false; if (fWakeUpWorker) @@ -3164,8 +2412,7 @@ namespace CorUnix RPFM_exit: if (fMonitoredProcessesLock) { - InternalLeaveCriticalSection(pthrCurrent, - &s_csMonitoredProcessesLock); + minipal_mutex_leave(&s_csMonitoredProcessesLock); } return palErr; @@ -3190,7 +2437,7 @@ namespace CorUnix VALIDATEOBJECT(psdSynchData); - InternalEnterCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_enter(&s_csMonitoredProcessesLock); pmpln = m_pmplnMonitoredProcesses; while (pmpln) @@ -3221,7 +2468,7 @@ namespace CorUnix m_lMonitoredProcessesCount--; pmpln->pProcessObject->ReleaseReference(pthrCurrent); pmpln->psdSynchData->Release(pthrCurrent); - InternalDelete(pmpln); + delete pmpln; } } else @@ -3229,7 +2476,7 @@ namespace CorUnix palErr = ERROR_NOT_FOUND; } - InternalLeaveCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_leave(&s_csMonitoredProcessesLock); return palErr; } @@ -3268,7 +2515,6 @@ namespace CorUnix LONG lInitialNodeCount; LONG lRemovingCount = 0; bool fLocalSynchLock = false; - bool fSharedSynchLock = false; bool fMonitoredProcessesLock = false; // Note: we first need to grab the monitored processes lock to walk @@ -3289,7 +2535,7 @@ namespace CorUnix // lock is needed in order to support object promotion. // Grab the monitored processes lock - InternalEnterCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_enter(&s_csMonitoredProcessesLock); fMonitoredProcessesLock = true; lInitialNodeCount = m_lMonitoredProcessesCount; @@ -3334,7 +2580,7 @@ namespace CorUnix } // Release the monitored processes lock - InternalLeaveCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_leave(&s_csMonitoredProcessesLock); fMonitoredProcessesLock = false; if (lRemovingCount > 0) @@ -3344,44 +2590,9 @@ namespace CorUnix fLocalSynchLock = true; // Acquire the monitored processes lock - InternalEnterCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_enter(&s_csMonitoredProcessesLock); fMonitoredProcessesLock = true; - if (!fSharedSynchLock) - { - bool fSharedSynchLockIsNeeded = false; - - // See if the shared lock is needed - pNode = m_pmplnExitedNodes; - while (pNode) - { - if (SharedObject == pNode->psdSynchData->GetObjectDomain()) - { - fSharedSynchLockIsNeeded = true; - break; - } - - pNode = pNode->pNext; - } - - if (fSharedSynchLockIsNeeded) - { - // Release the monitored processes lock - InternalLeaveCriticalSection(pthrCurrent, - &s_csMonitoredProcessesLock); - fMonitoredProcessesLock = false; - - // Acquire the shared synch lock - AcquireSharedSynchLock(pthrCurrent); - fSharedSynchLock = true; - - // Acquire again the monitored processes lock - InternalEnterCriticalSection(pthrCurrent, - &s_csMonitoredProcessesLock); - fMonitoredProcessesLock = true; - } - } - // Start from the beginning of the exited processes list pNode = m_pmplnExitedNodes; @@ -3430,7 +2641,7 @@ namespace CorUnix pNode->psdSynchData->Release(pthrCurrent); // Delete the node - InternalDelete(pNode); + delete pNode; // Go to the next pNode = pNext; @@ -3439,12 +2650,7 @@ namespace CorUnix if (fMonitoredProcessesLock) { - InternalLeaveCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); - } - - if (fSharedSynchLock) - { - ReleaseSharedSynchLock(pthrCurrent); + minipal_mutex_leave(&s_csMonitoredProcessesLock); } if (fLocalSynchLock) @@ -3470,7 +2676,7 @@ namespace CorUnix MonitoredProcessesListNode * pNode; // Grab the monitored processes lock - InternalEnterCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_enter(&s_csMonitoredProcessesLock); while (m_pmplnMonitoredProcesses) { @@ -3478,11 +2684,11 @@ namespace CorUnix m_pmplnMonitoredProcesses = pNode->pNext; pNode->pProcessObject->ReleaseReference(pthrCurrent); pNode->psdSynchData->Release(pthrCurrent); - InternalDelete(pNode); + delete pNode; } // Release the monitored processes lock - InternalLeaveCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); + minipal_mutex_leave(&s_csMonitoredProcessesLock); } /*++ @@ -3757,278 +2963,6 @@ namespace CorUnix ReleaseLocalSynchLock(pthrCurrent); } - /*++ - Method: - CPalSynchronizationManager::PromoteObjectSynchData - - Promotes an object's synchdata from local to shared - --*/ - PAL_ERROR CPalSynchronizationManager::PromoteObjectSynchData( - CPalThread *pthrCurrent, - VOID *pvLocalSynchData, - VOID **ppvSharedSynchData) - { - PAL_ERROR palError = NO_ERROR; - CSynchData *psdLocal = reinterpret_cast(pvLocalSynchData); - CSynchData *psdShared = NULL; - SharedID shridSynchData = NULL; - SharedID *rgshridWTLNodes = NULL; - CObjectType *pot = NULL; - ULONG ulcWaitingThreads; - - _ASSERTE(NULL != pthrCurrent); - _ASSERTE(NULL != pvLocalSynchData); - _ASSERTE(NULL != ppvSharedSynchData); - _ASSERTE(ProcessLocalObject == psdLocal->GetObjectDomain()); - -#if _DEBUG - - // - // TODO: Verify that the proper locks are held - // -#endif - - // - // Allocate shared memory CSynchData and map to local memory - // - - shridSynchData = m_cacheSHRSynchData.Get(pthrCurrent); - if (NULL == shridSynchData) - { - ERROR("Unable to allocate shared memory\n"); - palError = ERROR_NOT_ENOUGH_MEMORY; - goto POSD_exit; - } - - psdShared = SharedIDToTypePointer(CSynchData, shridSynchData); - _ASSERTE(NULL != psdShared); - - // - // Allocate shared memory WaitingThreadListNodes if there are - // any threads currently waiting on this object - // - - ulcWaitingThreads = psdLocal->GetWaitingThreadCount(); - if (0 < ulcWaitingThreads) - { - int i; - - rgshridWTLNodes = InternalNewArray(ulcWaitingThreads); - if (NULL == rgshridWTLNodes) - { - palError = ERROR_OUTOFMEMORY; - goto POSD_exit; - } - - i = m_cacheSHRWTListNodes.Get( - pthrCurrent, - ulcWaitingThreads, - rgshridWTLNodes - ); - - if (static_cast(i) != ulcWaitingThreads) - { - for (i -= 1; i >= 0; i -= 1) - { - m_cacheSHRWTListNodes.Add(pthrCurrent, rgshridWTLNodes[i]); - } - - palError = ERROR_OUTOFMEMORY; - goto POSD_exit; - } - } - - // - // If the synch data is for a process object we need to grab - // the monitored process list lock here - // - - pot = psdLocal->GetObjectType(); - _ASSERTE(NULL != pot); - - if (otiProcess == pot->GetId()) - { - InternalEnterCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); - } - - // - // Copy pertinent CSynchData info to the shared memory version (and - // initialize other members) - // - - psdShared->SetSharedThis(shridSynchData); - psdShared->SetObjectDomain(SharedObject); - psdShared->SetObjectType(psdLocal->GetObjectType()); - psdShared->SetSignalCount(psdLocal->GetSignalCount()); - -#ifdef SYNCH_STATISTICS - psdShared->SetStatContentionCount(psdLocal->GetStatContentionCount()); - psdShared->SetStatWaitCount(psdLocal->GetStatWaitCount()); -#endif - - // - // Rebuild the waiting thread list, and update the wait domain - // for the waiting threads - // - - psdShared->SetWTLHeadShrPtr(NULL); - psdShared->SetWTLTailShrPtr(NULL); - - if (0 < ulcWaitingThreads) - { - WaitingThreadsListNode *pwtlnOld; - WaitingThreadsListNode *pwtlnNew; - int i = 0; - - for (pwtlnOld = psdLocal->GetWTLHeadPtr(); - pwtlnOld != NULL; - pwtlnOld = pwtlnOld->ptrNext.ptr, i += 1) - { - pwtlnNew = SharedIDToTypePointer( - WaitingThreadsListNode, - rgshridWTLNodes[i] - ); - - _ASSERTE(NULL != pwtlnNew); - - pwtlnNew->shridSHRThis = rgshridWTLNodes[i]; - pwtlnNew->ptrOwnerObjSynchData.shrid = shridSynchData; - - pwtlnNew->dwThreadId = pwtlnOld->dwThreadId; - pwtlnNew->dwProcessId = pwtlnOld->dwProcessId; - pwtlnNew->dwObjIndex = pwtlnOld->dwObjIndex; - pwtlnNew->dwFlags = pwtlnOld->dwFlags | WTLN_FLAG_OWNER_OBJECT_IS_SHARED; - pwtlnNew->shridWaitingState = pwtlnOld->shridWaitingState; - pwtlnNew->ptwiWaitInfo = pwtlnOld->ptwiWaitInfo; - - psdShared->SharedWaiterEnqueue(rgshridWTLNodes[i], false); - psdShared->AddRef(); - - _ASSERTE(pwtlnOld = pwtlnOld->ptwiWaitInfo->rgpWTLNodes[pwtlnOld->dwObjIndex]); - pwtlnNew->ptwiWaitInfo->rgpWTLNodes[pwtlnNew->dwObjIndex] = pwtlnNew; - - pwtlnNew->ptwiWaitInfo->lSharedObjCount += 1; - if (pwtlnNew->ptwiWaitInfo->lSharedObjCount - == pwtlnNew->ptwiWaitInfo->lObjCount) - { - pwtlnNew->ptwiWaitInfo->wdWaitDomain = SharedWait; - } - else - { - _ASSERTE(pwtlnNew->ptwiWaitInfo->lSharedObjCount - < pwtlnNew->ptwiWaitInfo->lObjCount); - - pwtlnNew->ptwiWaitInfo->wdWaitDomain = MixedWait; - } - } - - _ASSERTE(psdShared->GetWaitingThreadCount() == ulcWaitingThreads); - } - - // - // If the object tracks ownership and has a current owner update - // the OwnedObjectsListNode to point to the shared memory synch - // data - // - - if (CObjectType::OwnershipTracked == pot->GetOwnershipSemantics()) - { - OwnedObjectsListNode *pooln; - - pooln = psdLocal->GetOwnershipListNode(); - if (NULL != pooln) - { - pooln->pPalObjSynchData = psdShared; - psdShared->SetOwnershipListNode(pooln); - psdShared->AddRef(); - - // - // Copy over other ownership info. - // - - psdShared->SetOwner(psdLocal->GetOwnerThread()); - psdShared->SetOwnershipCount(psdLocal->GetOwnershipCount()); - _ASSERTE(!psdShared->IsAbandoned()); - } - else - { - _ASSERTE(0 == psdLocal->GetOwnershipCount()); - _ASSERTE(0 == psdShared->GetOwnershipCount()); - psdShared->SetAbandoned(psdLocal->IsAbandoned()); - } - } - - // - // If the synch data is for a process object update the monitored - // process list nodes to point to the shared memory object data, - // and release the monitored process list lock - // - - if (otiProcess == pot->GetId()) - { - MonitoredProcessesListNode *pmpn; - - pmpn = m_pmplnMonitoredProcesses; - while (NULL != pmpn) - { - if (psdLocal == pmpn->psdSynchData) - { - pmpn->psdSynchData = psdShared; - psdShared->AddRef(); - } - - pmpn = pmpn->pNext; - } - - pmpn = m_pmplnExitedNodes; - while (NULL != pmpn) - { - if (psdLocal == pmpn->psdSynchData) - { - pmpn->psdSynchData = psdShared; - psdShared->AddRef(); - } - - pmpn = pmpn->pNext; - } - - InternalLeaveCriticalSection(pthrCurrent, &s_csMonitoredProcessesLock); - } - - *ppvSharedSynchData = reinterpret_cast(shridSynchData); - - // - // Free the local memory items to caches - // - - if (0 < ulcWaitingThreads) - { - WaitingThreadsListNode *pwtln; - - pwtln = psdLocal->GetWTLHeadPtr(); - while (NULL != pwtln) - { - WaitingThreadsListNode *pwtlnTemp; - - pwtlnTemp = pwtln; - pwtln = pwtln->ptrNext.ptr; - m_cacheWTListNodes.Add(pthrCurrent, pwtlnTemp); - } - } - - m_cacheSynchData.Add(pthrCurrent, psdLocal); - - POSD_exit: - - if (NULL != rgshridWTLNodes) - { - InternalDeleteArray(rgshridWTLNodes); - } - - return palError; - } - - ///////////////////////////// // // // _ThreadNativeWaitData // @@ -4056,7 +2990,6 @@ namespace CorUnix m_tsThreadState(TS_IDLE), m_shridWaitAwakened(NULL), m_lLocalSynchLockCount(0), - m_lSharedSynchLockCount(0), m_ownedNamedMutexListHead(nullptr) { InitializeListHead(&m_leOwnedObjsList); @@ -4447,7 +3380,7 @@ namespace CorUnix pdsln->pthrTarget->ReleaseThreadReference(); // Delete the node - InternalDelete(pdsln); + delete pdsln; lIdx += 1; } @@ -4645,8 +3578,8 @@ namespace CorUnix #endif if (0 == iRet) { - ptsAbsTmo->tv_sec += dwTimeout / tccSecondsToMillieSeconds; - ptsAbsTmo->tv_nsec += (dwTimeout % tccSecondsToMillieSeconds) * tccMillieSecondsToNanoSeconds; + ptsAbsTmo->tv_sec += dwTimeout / tccSecondsToMilliSeconds; + ptsAbsTmo->tv_nsec += (dwTimeout % tccSecondsToMilliSeconds) * tccMilliSecondsToNanoSeconds; while (ptsAbsTmo->tv_nsec >= tccSecondsToNanoSeconds) { ptsAbsTmo->tv_sec += 1; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.hpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.hpp index ce325f75e..7d86ab6fb 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.hpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/synchmanager.hpp @@ -21,7 +21,6 @@ Module Name: #include "pal/synchobjects.hpp" #include "pal/synchcache.hpp" -#include "pal/cs.hpp" #include "pal/corunix.hpp" #include "pal/thread.hpp" #include "pal/procobj.hpp" @@ -48,9 +47,7 @@ Module Name: namespace CorUnix { - const DWORD WTLN_FLAG_OWNER_OBJECT_IS_SHARED = 1<<0; const DWORD WTLN_FLAG_WAIT_ALL = 1<<1; - const DWORD WTLN_FLAG_DELEGATED_OBJECT_SIGNALING_IN_PROGRESS = 1<<2; #ifdef SYNCH_OBJECT_VALIDATION const DWORD HeadSignature = 0x48454144; @@ -69,8 +66,7 @@ namespace CorUnix enum WaitCompletionState { WaitIsNotSatisfied, - WaitIsSatisfied, - WaitMayBeSatisfied + WaitIsSatisfied }; typedef union _SynchDataGenrPtr @@ -92,11 +88,9 @@ namespace CorUnix #endif WTLNodeGenrPtr ptrNext; WTLNodeGenrPtr ptrPrev; - SharedID shridSHRThis; // Data DWORD dwThreadId; - DWORD dwProcessId; DWORD dwObjIndex; DWORD dwFlags; @@ -149,8 +143,6 @@ namespace CorUnix WTLNodeGenrPtr m_ptrWTLHead; WTLNodeGenrPtr m_ptrWTLTail; ULONG m_ulcWaitingThreads; - SharedID m_shridThis; - ObjectDomain m_odObjectDomain; PalObjectTypeId m_otiObjectTypeId; LONG m_lRefCount; LONG m_lSignalCount; @@ -171,12 +163,12 @@ namespace CorUnix public: CSynchData() - : m_ulcWaitingThreads(0), m_shridThis(NULL), m_lRefCount(1), + : m_ulcWaitingThreads(0), m_lRefCount(1), m_lSignalCount(0), m_lOwnershipCount(0), m_dwOwnerPid(0), m_dwOwnerTid(0), m_pOwnerThread(NULL), m_poolnOwnedObjectListNode(NULL), m_fAbandoned(false) { - // m_ptrWTLHead, m_ptrWTLTail, m_odObjectDomain + // m_ptrWTLHead, m_ptrWTLTail // and m_otiObjectTypeId are initialized by // CPalSynchronizationManager::AllocateObjectSynchData #ifdef SYNCH_STATISTICS @@ -206,17 +198,6 @@ namespace CorUnix CPalThread * pthrTarget); void WaiterEnqueue(WaitingThreadsListNode * pwtlnNewNode, bool fPrioritize); - void SharedWaiterEnqueue(SharedID shridNewNode, bool fPrioritize); - - // Object Domain accessor methods - ObjectDomain GetObjectDomain(void) - { - return m_odObjectDomain; - } - void SetObjectDomain(ObjectDomain odObjectDomain) - { - m_odObjectDomain = odObjectDomain; - } // Object Type accessor methods CObjectType * GetObjectType(void) @@ -236,25 +217,12 @@ namespace CorUnix m_otiObjectTypeId = oti; } - // Object shared 'this' pointer accessor methods - SharedID GetSharedThis (void) - { - return m_shridThis; - } - void SetSharedThis (SharedID shridThis) - { - m_shridThis = shridThis; - } - void Signal( CPalThread * pthrCurrent, - LONG lSignalCount, - bool fWorkerThread); + LONG lSignalCount); bool ReleaseFirstWaiter( - CPalThread * pthrCurrent, - bool * pfDelegated, - bool fWorkerThread); + CPalThread * pthrCurrent); LONG ReleaseAllLocalWaiters( CPalThread * pthrCurrent); @@ -413,18 +381,14 @@ namespace CorUnix protected: CPalThread * m_pthrOwner; ControllerType m_ctCtrlrType; - ObjectDomain m_odObjectDomain; CObjectType * m_potObjectType; CSynchData * m_psdSynchData; - WaitDomain m_wdWaitDomain; PAL_ERROR Init( CPalThread * pthrCurrent, ControllerType ctCtrlrType, - ObjectDomain odObjectDomain, CObjectType *potObjectType, - CSynchData * psdSynchData, - WaitDomain wdWaitDomain); + CSynchData * psdSynchData); void Release(void); @@ -496,7 +460,6 @@ namespace CorUnix class CPalSynchronizationManager : public IPalSynchronizationManager { friend class CPalSynchMgrController; - template friend T *CorUnix::InternalNew(Ts... args); public: // types @@ -523,10 +486,7 @@ namespace CorUnix enum SynchWorkerCmd { SynchWorkerCmdNop, - SynchWorkerCmdRemoteSignal, - SynchWorkerCmdDelegatedObjectSignaling, SynchWorkerCmdShutdown, - SynchWorkerCmdTerminationRequest, SynchWorkerCmdLast }; @@ -562,8 +522,8 @@ namespace CorUnix // static members static CPalSynchronizationManager * s_pObjSynchMgr; static Volatile s_lInitStatus; - static CRITICAL_SECTION s_csSynchProcessLock; - static CRITICAL_SECTION s_csMonitoredProcessesLock; + static minipal_mutex s_csSynchProcessLock; + static minipal_mutex s_csMonitoredProcessesLock; // members DWORD m_dwWorkerThreadTid; @@ -629,7 +589,7 @@ namespace CorUnix if (1 == ++pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount) { - InternalEnterCriticalSection(pthrCurrent, &s_csSynchProcessLock); + minipal_mutex_enter(&s_csSynchProcessLock); } } static void ReleaseLocalSynchLock(CPalThread * pthrCurrent) @@ -637,7 +597,7 @@ namespace CorUnix _ASSERTE(0 < pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount); if (0 == --pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount) { - InternalLeaveCriticalSection(pthrCurrent, &s_csSynchProcessLock); + minipal_mutex_leave(&s_csSynchProcessLock); #if SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING pthrCurrent->synchronizationInfo.RunDeferredThreadConditionSignalings(); @@ -652,7 +612,7 @@ namespace CorUnix if (0 < lRet) { pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount = 0; - InternalLeaveCriticalSection(pthrCurrent, &s_csSynchProcessLock); + minipal_mutex_leave(&s_csSynchProcessLock); #if SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING pthrCurrent->synchronizationInfo.RunDeferredThreadConditionSignalings(); @@ -666,51 +626,6 @@ namespace CorUnix return pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount; } - static void AcquireSharedSynchLock(CPalThread * pthrCurrent) - { - _ASSERTE(0 <= pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount); - _ASSERT_MSG(0 < pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount, - "The local synch lock should be acquired before grabbing the " - "shared one.\n"); - if (1 == ++pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount) - { - SHMLock(); - } - } - static void ReleaseSharedSynchLock(CPalThread * pthrCurrent) - { - _ASSERTE(0 < pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount); - if (0 == --pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount) - { - _ASSERT_MSG(0 < pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount, - "Final release of the shared synch lock while not holding the " - "local one. Local synch lock should always be acquired first and " - "released last.\n"); - SHMRelease(); - } - } - static LONG ResetSharedSynchLock(CPalThread * pthrCurrent) - { - LONG lRet = pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount; - - _ASSERTE(0 <= lRet); - _ASSERTE(0 == lRet || - 0 < pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount); - if (0 < lRet) - { - pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount = 0; - SHMRelease(); - } - return lRet; - } - static LONG GetSharedSynchLockCount(CPalThread * pthrCurrent) - { - _ASSERTE(0 <= pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount); - _ASSERTE(0 == pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount || - 0 < pthrCurrent->synchronizationInfo.m_lLocalSynchLockCount); - return pthrCurrent->synchronizationInfo.m_lSharedSynchLockCount; - } - CSynchWaitController * CacheGetWaitCtrlr(CPalThread * pthrCurrent) { return m_cacheWaitCtrlrs.Get(pthrCurrent); @@ -842,31 +757,22 @@ namespace CorUnix virtual PAL_ERROR AllocateObjectSynchData( CObjectType *potObjectType, - ObjectDomain odObjectDomain, VOID **ppvSynchData); virtual void FreeObjectSynchData( CObjectType *potObjectType, - ObjectDomain odObjectDomain, VOID *pvSynchData); - virtual PAL_ERROR PromoteObjectSynchData( - CPalThread *pthrCurrent, - VOID *pvLocalSynchData, - VOID **ppvSharedSynchData); - virtual PAL_ERROR CreateSynchStateController( CPalThread *pthrCurrent, CObjectType *potObjectType, VOID *pvSynchData, - ObjectDomain odObjectDomain, ISynchStateController **ppStateController); virtual PAL_ERROR CreateSynchWaitController( CPalThread *pthrCurrent, CObjectType *potObjectType, VOID *pvSynchData, - ObjectDomain odObjectDomain, ISynchWaitController **ppWaitController); virtual PAL_ERROR QueueUserAPC( @@ -875,8 +781,6 @@ namespace CorUnix PAPCFUNC pfnAPC, ULONG_PTR uptrData); - virtual PAL_ERROR SendTerminationRequestToWorkerThread(); - virtual bool AreAPCsPending(CPalThread * pthrTarget); virtual PAL_ERROR DispatchPendingAPCs(CPalThread * pthrCurrent); @@ -902,19 +806,6 @@ namespace CorUnix CPalThread * pthrCurrent, CPalThread * pthrTarget); - static PAL_ERROR WakeUpRemoteThread( - SharedID shridWLNode); - - static PAL_ERROR DelegateSignalingToRemoteProcess( - CPalThread * pthrCurrent, - DWORD dwTargetProcessId, - SharedID shridSynchData); - - static PAL_ERROR SendMsgToRemoteWorker( - DWORD dwProcessId, - BYTE * pMsg, - int iMsgSize); - static ThreadWaitInfo * GetThreadWaitInfo( CPalThread * pthrCurrent); @@ -928,13 +819,6 @@ namespace CorUnix WaitingThreadsListNode * pwtlnNode, CSynchData * psdTgtObjectSynchData); - static void MarkWaitForDelegatedObjectSignalingInProgress( - CPalThread * pthrCurrent, - WaitingThreadsListNode * pwtlnNode); - - static void UnmarkTWListForDelegatedObjectSignalingInProgress( - CSynchData * pTgtObjectSynchData); - static PAL_ERROR ThreadNativeWait( ThreadNativeWaitData * ptnwdNativeWaitData, DWORD dwTimeout, @@ -987,8 +871,7 @@ namespace CorUnix // void UnRegisterWait( CPalThread * pthrCurrent, - ThreadWaitInfo * ptwiWaitInfo, - bool fHaveSharedLock); + ThreadWaitInfo * ptwiWaitInfo); PAL_ERROR RegisterProcessForMonitoring( CPalThread * pthrCurrent, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/wait.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/wait.cpp index 5ae53759f..495d86b1c 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/wait.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchmgr/wait.cpp @@ -26,8 +26,8 @@ Revision History: #include "pal/event.hpp" #include "pal/mutex.hpp" #include "pal/semaphore.hpp" -#include "pal/malloc.hpp" #include "pal/dbgmsg.h" +#include SET_DEFAULT_DEBUG_CHANNEL(SYNC); @@ -390,8 +390,8 @@ DWORD CorUnix::InternalWaitForMultipleObjectsEx( wtWaitType = fWAll ? MultipleObjectsWaitAll : MultipleObjectsWaitOne; if (nCount > MAXIMUM_STACK_WAITOBJ_ARRAY_SIZE) { - ppIPalObjs = InternalNewArray(nCount); - ppISyncWaitCtrlrs = InternalNewArray(nCount); + ppIPalObjs = new(std::nothrow) IPalObject*[nCount]; + ppISyncWaitCtrlrs = new(std::nothrow) ISynchWaitController*[nCount]; if ((NULL == ppIPalObjs) || (NULL == ppISyncWaitCtrlrs)) { ERROR("Out of memory allocating internal structures\n"); @@ -707,8 +707,8 @@ DWORD CorUnix::InternalWaitForMultipleObjectsEx( WFMOExIntExit: if (nCount > MAXIMUM_STACK_WAITOBJ_ARRAY_SIZE) { - InternalDeleteArray(ppIPalObjs); - InternalDeleteArray(ppISyncWaitCtrlrs); + delete[] ppIPalObjs; + delete[] ppISyncWaitCtrlrs; } return dwRet; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/event.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/event.cpp index 36205c255..619a55f28 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/event.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/event.cpp @@ -32,18 +32,11 @@ SET_DEFAULT_DEBUG_CHANNEL(SYNC); CObjectType CorUnix::otManualResetEvent( otiManualResetEvent, NULL, // No cleanup routine - NULL, // No initialization routine 0, // No immutable data NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine 0, // No process local data NULL, // No process local data cleanup routine - 0, // No shared data - EVENT_ALL_ACCESS, // Currently ignored (no Win32 security) - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::WaitableObject, CObjectType::ObjectCanBeUnsignaled, CObjectType::ThreadReleaseHasNoSideEffects, @@ -53,18 +46,11 @@ CObjectType CorUnix::otManualResetEvent( CObjectType CorUnix::otAutoResetEvent( otiAutoResetEvent, NULL, // No cleanup routine - NULL, // No initialization routine 0, // No immutable data NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine 0, // No process local data NULL, // No process local data cleanup routine - 0, // No shared data - EVENT_ALL_ACCESS, // Currently ignored (no Win32 security) - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::WaitableObject, CObjectType::ObjectCanBeUnsignaled, CObjectType::ThreadReleaseAltersSignalCount, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/mutex.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/mutex.cpp index e3d63fe23..f23254612 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/mutex.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/mutex.cpp @@ -33,8 +33,7 @@ SET_DEFAULT_DEBUG_CHANNEL(SYNC); // some headers have code with asserts, so do t #include #include #include - -#include "pal/sharedmemory.inl" +#include "minipal/time.h" using namespace CorUnix; @@ -43,18 +42,11 @@ using namespace CorUnix; CObjectType CorUnix::otMutex( otiMutex, NULL, // No cleanup routine - NULL, // No initialization routine 0, // No immutable data NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine 0, // No process local data NULL, // No process local data cleanup routine - 0, // No shared data - 0, // Should be MUTEX_ALL_ACCESS; currently ignored (no Win32 security) - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::WaitableObject, CObjectType::ObjectCanBeUnsignaled, CObjectType::ThreadReleaseAltersSignalCount, @@ -66,18 +58,11 @@ static CAllowedObjectTypes aotMutex(otiMutex); CObjectType CorUnix::otNamedMutex( otiNamedMutex, &SharedMemoryProcessDataHeader::PalObject_Close, // Cleanup routine - NULL, // No initialization routine sizeof(SharedMemoryProcessDataHeader *), // Immutable data NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine 0, // No process local data NULL, // No process local data cleanup routine - 0, // No shared data - 0, // Should be MUTEX_ALL_ACCESS; currently ignored (no Win32 security) - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, // PAL's naming infrastructure is not used - CObjectType::LocalDuplicationOnly, CObjectType::UnwaitableObject, // PAL's waiting infrastructure is not used CObjectType::SignalingNotApplicable, // PAL's signaling infrastructure is not used CObjectType::ThreadReleaseNotApplicable, // PAL's signaling infrastructure is not used @@ -103,7 +88,7 @@ CreateMutexW( IN BOOL bInitialOwner, IN LPCWSTR lpName) { - return PAL_CreateMutexW(bInitialOwner, lpName, nullptr, 0); + return PAL_CreateMutexW(bInitialOwner, lpName, false /* bCurrentUserOnly */, nullptr, 0); } /*++ @@ -127,6 +112,7 @@ PALAPI PAL_CreateMutexW( IN BOOL bInitialOwner, IN LPCWSTR lpName, + IN BOOL bCurrentUserOnly, IN LPSTR lpSystemCallErrors, IN DWORD dwSystemCallErrorsBufferSize) { @@ -185,6 +171,7 @@ PAL_CreateMutexW( nullptr, bInitialOwner, lpName == nullptr ? nullptr : utf8Name, + bCurrentUserOnly, &hMutex ); } @@ -252,6 +239,7 @@ CorUnix::InternalCreateMutex( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName, + BOOL bCurrentUserOnly, HANDLE *phMutex ) { @@ -331,7 +319,8 @@ CorUnix::InternalCreateMutex( SharedMemoryProcessDataHeader *processDataHeader; try { - processDataHeader = NamedMutexProcessData::CreateOrOpen(errors, lpName, !!bInitialOwner, &createdNamedMutex); + processDataHeader = + NamedMutexProcessData::CreateOrOpen(errors, lpName, !!bCurrentUserOnly, !!bInitialOwner, &createdNamedMutex); } catch (SharedMemoryException ex) { @@ -557,7 +546,7 @@ OpenMutexA ( goto OpenMutexAExit; } - palError = InternalOpenMutex(nullptr, pthr, lpName, &hMutex); + palError = InternalOpenMutex(nullptr, pthr, lpName, false /* bCurrentUserOnly */, &hMutex); OpenMutexAExit: if (NO_ERROR != palError) @@ -585,7 +574,7 @@ OpenMutexW( IN BOOL bInheritHandle, IN LPCWSTR lpName) { - return PAL_OpenMutexW(lpName, nullptr, 0); + return PAL_OpenMutexW(lpName, false /* bCurrentUserOnly */, nullptr, 0); } /*++ @@ -607,6 +596,7 @@ HANDLE PALAPI PAL_OpenMutexW( IN LPCWSTR lpName, + IN BOOL bCurrentUserOnly, IN LPSTR lpSystemCallErrors, IN DWORD dwSystemCallErrorsBufferSize) { @@ -626,10 +616,11 @@ PAL_OpenMutexW( /* validate parameters */ if (lpName == nullptr || + lpName[0] == W('\0') || (int)dwSystemCallErrorsBufferSize < 0 || (lpSystemCallErrors == nullptr) != (dwSystemCallErrorsBufferSize == 0)) { - ERROR("name is NULL or other parameters are invalid\n"); + ERROR("One or more parameters are invalid\n"); palError = ERROR_INVALID_PARAMETER; goto OpenMutexWExit; } @@ -657,7 +648,7 @@ PAL_OpenMutexW( } SharedMemorySystemCallErrors errors(lpSystemCallErrors, (int)dwSystemCallErrorsBufferSize); - palError = InternalOpenMutex(&errors, pthr, lpName == nullptr ? nullptr : utf8Name, &hMutex); + palError = InternalOpenMutex(&errors, pthr, lpName == nullptr ? nullptr : utf8Name, bCurrentUserOnly, &hMutex); } OpenMutexWExit: @@ -689,6 +680,7 @@ CorUnix::InternalOpenMutex( SharedMemorySystemCallErrors *errors, CPalThread *pthr, LPCSTR lpName, + BOOL bCurrentUserOnly, HANDLE *phMutex ) { @@ -725,7 +717,7 @@ CorUnix::InternalOpenMutex( SharedMemoryProcessDataHeader *processDataHeader; try { - processDataHeader = NamedMutexProcessData::Open(errors, lpName); + processDataHeader = NamedMutexProcessData::Open(errors, lpName, bCurrentUserOnly); } catch (SharedMemoryException ex) { @@ -1088,20 +1080,29 @@ const DWORD NamedMutexProcessData::PollLoopMaximumSleepMilliseconds = 100; SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( SharedMemorySystemCallErrors *errors, LPCSTR name, + bool isUserScope, bool acquireLockIfCreated, bool *createdRef) { - return CreateOrOpen(errors, name, true /* createIfNotExist */, acquireLockIfCreated, createdRef); + return CreateOrOpen(errors, name, isUserScope, true /* createIfNotExist */, acquireLockIfCreated, createdRef); } -SharedMemoryProcessDataHeader *NamedMutexProcessData::Open(SharedMemorySystemCallErrors *errors, LPCSTR name) +SharedMemoryProcessDataHeader *NamedMutexProcessData::Open(SharedMemorySystemCallErrors *errors, LPCSTR name, bool isUserScope) { - return CreateOrOpen(errors, name, false /* createIfNotExist */, false /* acquireLockIfCreated */, nullptr /* createdRef */); + return + CreateOrOpen( + errors, + name, + isUserScope, + false /* createIfNotExist */, + false /* acquireLockIfCreated */, + nullptr /* createdRef */); } SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( SharedMemorySystemCallErrors *errors, LPCSTR name, + bool isUserScope, bool createIfNotExist, bool acquireLockIfCreated, bool *createdRef) @@ -1167,7 +1168,8 @@ SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( if (m_acquiredCreationDeletionFileLock) { - SharedMemoryManager::ReleaseCreationDeletionFileLock(); + _ASSERTE(m_processDataHeader != nullptr); + SharedMemoryManager::ReleaseCreationDeletionFileLock(m_processDataHeader->GetId()); } if (!m_cancel && m_processDataHeader != nullptr) @@ -1192,6 +1194,7 @@ SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( SharedMemoryProcessDataHeader::CreateOrOpen( errors, name, + isUserScope, SharedMemorySharedDataHeader(SharedMemoryType::Mutex, SyncSystemVersion), sizeof(NamedMutexSharedData), createIfNotExist, @@ -1200,6 +1203,12 @@ SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( { *createdRef = created; } + if (processDataHeader == nullptr) + { + _ASSERTE(!created); + _ASSERTE(!createIfNotExist); + return nullptr; + } if (created) { // If the shared memory file was created, the creation/deletion file lock would have been acquired so that we can @@ -1207,11 +1216,6 @@ SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( _ASSERTE(SharedMemoryManager::IsCreationDeletionFileLockAcquired()); autoCleanup.m_acquiredCreationDeletionFileLock = true; } - if (processDataHeader == nullptr) - { - _ASSERTE(!createIfNotExist); - return nullptr; - } autoCleanup.m_processDataHeader = processDataHeader; if (created) @@ -1224,27 +1228,29 @@ SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen( { #if !NAMED_MUTEX_USE_PTHREAD_MUTEX // Create the lock files directory - SharedMemoryHelpers::BuildSharedFilesPath(lockFilePath, SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME); + const SharedMemoryId *id = processDataHeader->GetId(); + SharedMemoryHelpers::VerifyStringOperation( + lockFilePath.Set(*gSharedFilesPath) && + id->AppendRuntimeTempDirectoryName(lockFilePath) && + lockFilePath.Append('/') && lockFilePath.Append(SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME)); if (created) { - SharedMemoryHelpers::EnsureDirectoryExists(errors, lockFilePath, true /* isGlobalLockAcquired */); + SharedMemoryHelpers::EnsureDirectoryExists(errors, lockFilePath, id, true /* isGlobalLockAcquired */); } // Create the session directory - SharedMemoryId *id = processDataHeader->GetId(); - SharedMemoryHelpers::VerifyStringOperation(lockFilePath.Append('/')); - SharedMemoryHelpers::VerifyStringOperation(id->AppendSessionDirectoryName(lockFilePath)); + SharedMemoryHelpers::VerifyStringOperation(lockFilePath.Append('/') && id->AppendSessionDirectoryName(lockFilePath)); if (created) { - SharedMemoryHelpers::EnsureDirectoryExists(errors, lockFilePath, true /* isGlobalLockAcquired */); + SharedMemoryHelpers::EnsureDirectoryExists(errors, lockFilePath, id, true /* isGlobalLockAcquired */); autoCleanup.m_lockFilePath = &lockFilePath; autoCleanup.m_sessionDirectoryPathCharCount = lockFilePath.GetCount(); } // Create or open the lock file - SharedMemoryHelpers::VerifyStringOperation(lockFilePath.Append('/')); - SharedMemoryHelpers::VerifyStringOperation(lockFilePath.Append(id->GetName(), id->GetNameCharCount())); - int lockFileDescriptor = SharedMemoryHelpers::CreateOrOpenFile(errors, lockFilePath, created); + SharedMemoryHelpers::VerifyStringOperation( + lockFilePath.Append('/') && lockFilePath.Append(id->GetName(), id->GetNameCharCount())); + int lockFileDescriptor = SharedMemoryHelpers::CreateOrOpenFile(errors, lockFilePath, id, created); if (lockFileDescriptor == -1) { _ASSERTE(!created); @@ -1408,11 +1414,13 @@ void NamedMutexProcessData::Close(bool isAbruptShutdown, bool releaseSharedData) { // Delete the lock file, and the session directory if it's not empty PathCharString path; - SharedMemoryHelpers::BuildSharedFilesPath(path, SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME); - SharedMemoryId *id = m_processDataHeader->GetId(); - SharedMemoryHelpers::VerifyStringOperation(path.Append('/')); - SharedMemoryHelpers::VerifyStringOperation(id->AppendSessionDirectoryName(path)); - SharedMemoryHelpers::VerifyStringOperation(path.Append('/')); + const SharedMemoryId *id = m_processDataHeader->GetId(); + SharedMemoryHelpers::VerifyStringOperation( + path.Set(*gSharedFilesPath) && + id->AppendRuntimeTempDirectoryName(path) && + path.Append('/') && path.Append(SHARED_MEMORY_LOCK_FILES_DIRECTORY_NAME) && + path.Append('/') && id->AppendSessionDirectoryName(path) && + path.Append('/')); SIZE_T sessionDirectoryPathCharCount = path.GetCount(); SharedMemoryHelpers::VerifyStringOperation(path.Append(id->GetName(), id->GetNameCharCount())); unlink(path); @@ -1490,7 +1498,7 @@ MutexTryAcquireLockResult NamedMutexProcessData::TryAcquireLock(SharedMemorySyst DWORD startTime = 0; if (timeoutMilliseconds != static_cast(-1) && timeoutMilliseconds != 0) { - startTime = GetTickCount(); + startTime = (DWORD)minipal_lowres_ticks(); } // Acquire the process lock. A file lock can only be acquired once per file descriptor, so to synchronize the threads of @@ -1619,7 +1627,7 @@ MutexTryAcquireLockResult NamedMutexProcessData::TryAcquireLock(SharedMemorySyst // Poll for the file lock do { - DWORD elapsedMilliseconds = GetTickCount() - startTime; + DWORD elapsedMilliseconds = (DWORD)minipal_lowres_ticks() - startTime; if (elapsedMilliseconds >= timeoutMilliseconds) { return MutexTryAcquireLockResult::TimedOut; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/semaphore.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/semaphore.cpp index e42c07240..3ea6fd487 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/semaphore.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/synchobj/semaphore.cpp @@ -32,18 +32,11 @@ SET_DEFAULT_DEBUG_CHANNEL(SYNC); CObjectType CorUnix::otSemaphore( otiSemaphore, NULL, // No cleanup routine - NULL, // No initialization routine sizeof(SemaphoreImmutableData), NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine 0, // No process local data NULL, // No process local data cleanup routine - 0, // No shared data - 0, // Should be SEMAPHORE_ALL_ACCESS; currently ignored (no Win32 security) - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::WaitableObject, CObjectType::ObjectCanBeUnsignaled, CObjectType::ThreadReleaseAltersSignalCount, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/context.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/context.cpp index 5154ee3c8..cfd5000d5 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/context.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/context.cpp @@ -29,6 +29,9 @@ SET_DEFAULT_DEBUG_CHANNEL(THREAD); // some headers have code with asserts, so do #endif #include #include +#if defined(HOST_APPLE) && !defined(HOST_OSX) +#include +#endif extern PGET_GCMARKER_EXCEPTION_CODE g_getGcMarkerExceptionCode; @@ -59,13 +62,22 @@ typedef int __ptrace_request; #endif // !HAVE_MACH_EXCEPTIONS #ifdef HOST_AMD64 +#ifdef __HAIKU__ #define ASSIGN_CONTROL_REGS \ - ASSIGN_REG(Rbp) \ - ASSIGN_REG(Rip) \ - ASSIGN_REG(SegCs) \ - ASSIGN_REG(EFlags) \ - ASSIGN_REG(Rsp) \ + ASSIGN_REG(Rbp) \ + ASSIGN_REG(Rip) \ + ASSIGN_REG(EFlags) \ + ASSIGN_REG(Rsp) \ + +#else // __HAIKU__ +#define ASSIGN_CONTROL_REGS \ + ASSIGN_REG(Rbp) \ + ASSIGN_REG(Rip) \ + ASSIGN_REG(SegCs) \ + ASSIGN_REG(EFlags) \ + ASSIGN_REG(Rsp) \ +#endif // __HAIKU__ #define ASSIGN_INTEGER_REGS \ ASSIGN_REG(Rdi) \ ASSIGN_REG(Rsi) \ @@ -168,7 +180,6 @@ typedef int __ptrace_request; #define ASSIGN_INTEGER_REGS \ ASSIGN_REG(R0) \ - ASSIGN_REG(Tp) \ ASSIGN_REG(A0) \ ASSIGN_REG(A1) \ ASSIGN_REG(A2) \ @@ -305,6 +316,11 @@ typedef int __ptrace_request; ASSIGN_REG(R29) \ ASSIGN_REG(R30) +#elif defined(HOST_WASM) +#define ASSIGN_CONTROL_REGS \ + ASSERT("WASM does not have registers"); +#define ASSIGN_INTEGER_REGS \ + ASSERT("WASM does not have registers"); #else #error "Don't know how to assign registers on this architecture" #endif @@ -380,6 +396,59 @@ bool Xstate_IsAvx512Supported() return Xstate_Avx512Supported == 1; #endif } + +bool Xstate_IsApxSupported() +{ +#if defined(HAVE_MACH_EXCEPTIONS) + // TODO-xarch-apx: I assume OSX will never support APX + return false; +#else + static int Xstate_ApxSupported = -1; + + if (Xstate_ApxSupported == -1) + { + int cpuidInfo[4]; + + const int CPUID_EAX = 0; + const int CPUID_EBX = 1; + const int CPUID_ECX = 2; + const int CPUID_EDX = 3; + +#ifdef _DEBUG + // We should only be calling this function if we know the extended feature exists + __cpuid(cpuidInfo, 0x00000000); + _ASSERTE(static_cast(cpuidInfo[CPUID_EAX]) >= 0x0D); +#endif // _DEBUG + + __cpuidex(cpuidInfo, 0x0000000D, 0x00000000); + + if ((cpuidInfo[CPUID_EAX] & XSTATE_MASK_APX) == XSTATE_MASK_APX) + { + // Knight's Landing and Knight's Mill shipped without all 5 of the "baseline" + // AVX-512 ISAs that are required by x86-64-v4. Specifically they do not include + // BW, DQ, or VL. RyuJIT currently requires all 5 ISAs to be present so we will + // only enable Avx512 context save/restore when all exist. This requires us to + // query which ISAs are actually supported to ensure they're all present. + + __cpuidex(cpuidInfo, 0x00000007, 0x00000001); + + const int requiredApxFlags = (1 << 21); + + if ((cpuidInfo[CPUID_EDX] & requiredApxFlags) == requiredApxFlags) + { + Xstate_ApxSupported = 1; + } + } + + if (Xstate_ApxSupported == -1) + { + Xstate_ApxSupported = 0; + } + } + + return Xstate_ApxSupported == 1; +#endif +} #endif // XSTATE_SUPPORTED || defined(HOST_AMD64) && defined(HAVE_MACH_EXCEPTIONS) #if !HAVE_MACH_EXCEPTIONS @@ -660,7 +729,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) #endif // (HAVE_GREGSET_T || HAVE___GREGSET_T) && !HOST_S390X && !HOST_LOONGARCH64 && !HOST_RISCV64 && !HOST_POWERPC64 #endif // !HAVE_FPREGS_WITH_CW -#if defined(HOST_ARM64) && !defined(TARGET_OSX) && !defined(TARGET_FREEBSD) +#if defined(HOST_ARM64) && !defined(__APPLE__) && !defined(TARGET_FREEBSD) sve_context* sve = nullptr; fpsimd_context* fp = nullptr; if (((lpContext->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) || @@ -668,7 +737,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) { GetNativeSigSimdContext(native, &fp, &sve); } -#endif // HOST_ARM64 && !TARGET_OSX && !TARGET_FREEBSD +#endif // HOST_ARM64 && !__APPLE__ && !TARGET_FREEBSD if ((lpContext->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) { @@ -698,7 +767,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) FPREG_Xmm(native, i) = lpContext->FltSave.XmmRegisters[i]; } #elif defined(HOST_ARM64) -#ifdef TARGET_OSX +#ifdef __APPLE__ _STRUCT_ARM_NEON_STATE64* fp = GetNativeSigSimdContext(native); fp->__fpsr = lpContext->Fpsr; fp->__fpcr = lpContext->Fpcr; @@ -717,7 +786,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) *(NEON128*) &fp->fp_q[i] = lpContext->V[i]; } } -#else // TARGET_OSX +#else // __APPLE__ if (fp) { fp->fpsr = lpContext->Fpsr; @@ -727,7 +796,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) *(NEON128*) &fp->vregs[i] = lpContext->V[i]; } } -#endif // TARGET_OSX +#endif // __APPLE__ #elif defined(HOST_ARM) VfpSigFrame* fp = GetNativeSigSimdContext(native); if (fp) @@ -809,6 +878,18 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) dest = FPREG_Xstate_Hi16Zmm(native, &size); _ASSERT(size == (sizeof(M512) * 16)); memcpy_s(dest, sizeof(M512) * 16, &lpContext->Zmm16, sizeof(M512) * 16); + +#ifndef TARGET_OSX + // TODO-xarch-apx: I suppose OSX will not support APX. + if (FPREG_HasApxRegisters(native)) + { + _ASSERT((lpContext->XStateFeaturesMask & XSTATE_MASK_APX) == XSTATE_MASK_APX); + + dest = FPREG_Xstate_Egpr(native, &size); + _ASSERT(size == (sizeof(DWORD64) * 16)); + memcpy_s(dest, sizeof(DWORD64) * 16, &lpContext->R16, sizeof(DWORD64) * 16); + } +#endif // !TARGET_OSX } } #elif defined(HOST_ARM64) @@ -843,7 +924,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native) } -#if defined(HOST_64BIT) && defined(HOST_ARM64) && !defined(TARGET_FREEBSD) && !defined(TARGET_OSX) +#if defined(HOST_64BIT) && defined(HOST_ARM64) && !defined(TARGET_FREEBSD) && !defined(__APPLE__) /*++ Function : _GetNativeSigSimdContext @@ -933,7 +1014,7 @@ void _GetNativeSigSimdContext(uint8_t *data, uint32_t size, fpsimd_context **fp_ *sve_ptr = sve; } } -#endif // HOST_64BIT && HOST_ARM64 && !TARGET_FREEBSD && !TARGET_OSX +#endif // HOST_64BIT && HOST_ARM64 && !TARGET_FREEBSD && !__APPLE__ /*++ Function : @@ -1000,7 +1081,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex #endif // (HAVE_GREGSET_T || HAVE___GREGSET_T) && !HOST_S390X && !HOST_LOONGARCH64 && !HOST_RISCV64 && !HOST_POWERPC64 && !HOST_POWERPC64 #endif // !HAVE_FPREGS_WITH_CW -#if defined(HOST_ARM64) && !defined(TARGET_OSX) && !defined(TARGET_FREEBSD) +#if defined(HOST_ARM64) && !defined(__APPLE__) && !defined(TARGET_FREEBSD) const fpsimd_context* fp = nullptr; const sve_context* sve = nullptr; if (((lpContext->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) || @@ -1008,7 +1089,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex { GetConstNativeSigSimdContext(native, &fp, &sve); } -#endif // HOST_ARM64 && !TARGET_OSX && !TARGET_FREEBSD +#endif // HOST_ARM64 && !__APPLE__ && !TARGET_FREEBSD if ((contextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) { @@ -1037,7 +1118,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex lpContext->FltSave.XmmRegisters[i] = FPREG_Xmm(native, i); } #elif defined(HOST_ARM64) -#ifdef TARGET_OSX +#ifdef __APPLE__ const _STRUCT_ARM_NEON_STATE64* fp = GetConstNativeSigSimdContext(native); lpContext->Fpsr = fp->__fpsr; lpContext->Fpcr = fp->__fpcr; @@ -1056,7 +1137,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex lpContext->V[i] = *(NEON128*) &fp->fp_q[i]; } } -#else // TARGET_OSX +#else // __APPLE__ if (fp) { lpContext->Fpsr = fp->fpsr; @@ -1066,7 +1147,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex lpContext->V[i] = *(NEON128*) &fp->vregs[i]; } } -#endif // TARGET_OSX +#endif // __APPLE__ #elif defined(HOST_ARM) const VfpSigFrame* fp = GetConstNativeSigSimdContext(native); if (fp) @@ -1102,6 +1183,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex lpContext->Fcsr = fpr->fcsr; lpContext->Fcc = fpr->fcc; memcpy(lpContext->F, fpr->regs, sizeof(fpr->regs)); + lpContext->ContextFlags |= CONTEXT_LSX; } else if (LASX_CTX_MAGIC == info->magic) { @@ -1109,6 +1191,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex lpContext->Fcsr = fpr->fcsr; lpContext->Fcc = fpr->fcc; memcpy(lpContext->F, fpr->regs, sizeof(fpr->regs)); + lpContext->ContextFlags |= CONTEXT_LASX; } else { @@ -1157,6 +1240,16 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex lpContext->XStateFeaturesMask |= XSTATE_MASK_AVX512; } +#if !defined(TARGET_OSX) + if (FPREG_HasApxRegisters(native)) + { + src = FPREG_Xstate_Egpr(native, &size); + _ASSERT(size == (sizeof(DWORD64) * 16)); + memcpy_s(&lpContext->R16, sizeof(DWORD64) * 16, src, sizeof(DWORD64) * 16); + + lpContext->XStateFeaturesMask |= XSTATE_MASK_APX; + } +#endif // TARGET_OSX } #elif defined(HOST_ARM64) if (sve && sve->head.size >= SVE_SIG_CONTEXT_SIZE(sve_vq_from_vl(sve->vl))) @@ -1700,6 +1793,12 @@ CONTEXT_GetThreadContextFromThreadState( // AMD64's FLOATING_POINT includes the xmm registers. memcpy(&lpContext->Xmm0, &pState->__fpu_xmm0, 16 * 16); + + if (threadStateFlavor == x86_FLOAT_STATE64) + { + // There was just a floating point state, so make sure the CONTEXT_XSTATE is not set + lpContext->ContextFlags &= ~(CONTEXT_XSTATE & CONTEXT_AREA_MASK); + } } break; } @@ -2091,6 +2190,10 @@ DBG_FlushInstructionCache( #endif syscall(__NR_riscv_flush_icache, (char *)lpBaseAddress, (char *)((INT_PTR)lpBaseAddress + dwSize), 0 /* all harts */); +#elif defined(HOST_WASM) + // do nothing, no instruction cache to flush +#elif defined(HOST_APPLE) && !defined(HOST_OSX) + sys_icache_invalidate((void *)lpBaseAddress, dwSize); #else __builtin___clear_cache((char *)lpBaseAddress, (char *)((INT_PTR)lpBaseAddress + dwSize)); #endif @@ -2105,12 +2208,18 @@ CONTEXT& CONTEXT::operator=(const CONTEXT& ctx) { if ((ctx.XStateFeaturesMask & XSTATE_MASK_AVX512) == XSTATE_MASK_AVX512) { - copySize = sizeof(CONTEXT); + copySize = offsetof(CONTEXT, R16); } else { copySize = offsetof(CONTEXT, KMask0); } + + if ((ctx.XStateFeaturesMask & XSTATE_MASK_APX) == XSTATE_MASK_APX) + { + // Copy APX EGPRs separately. + memcpy(&(this->R16), &(ctx.R16), sizeof(DWORD64) * 16); + } } else { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/process.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/process.cpp index ec518417e..b2ecc36ae 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/process.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/process.cpp @@ -25,7 +25,6 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d #include "pal/palinternal.h" #include "pal/process.h" #include "pal/init.h" -#include "pal/critsect.h" #include "pal/debug.h" #include "pal/utils.h" #include "pal/environ.h" @@ -64,30 +63,19 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d #include #ifdef __linux__ -#include // __NR_membarrier -// Ensure __NR_membarrier is defined for portable builds. -# if !defined(__NR_membarrier) -# if defined(__amd64__) -# define __NR_membarrier 324 -# elif defined(__i386__) -# define __NR_membarrier 375 -# elif defined(__arm__) -# define __NR_membarrier 389 -# elif defined(__aarch64__) -# define __NR_membarrier 283 -# elif defined(__loongarch64) -# define __NR_membarrier 283 -# else -# error Unknown architecture -# endif -# endif +#include +#include +#define membarrier(...) syscall(__NR_membarrier, __VA_ARGS__) +#elif HAVE_SYS_MEMBARRIER_H +#include +#ifdef TARGET_BROWSER +#define membarrier(cmd, flags, cpu_id) 0 // browser/wasm is currently single threaded +#endif #endif #ifdef __APPLE__ -#include #include #include -#include #include #include extern "C" @@ -105,6 +93,9 @@ extern "C" } \ } while (false) +// On macOS 26, sem_open fails if debugger and debugee are signed with different team ids. +// Use fifos instead of semaphores to avoid this issue, https://github.com/dotnet/runtime/issues/116545 +#define ENABLE_RUNTIME_EVENTS_OVER_PIPES #endif // __APPLE__ #ifdef __NetBSD__ @@ -119,6 +110,11 @@ extern "C" #include #endif +#ifdef __HAIKU__ +#include +#include +#endif + extern char *g_szCoreCLRPath; extern bool g_running_in_exe; @@ -127,45 +123,17 @@ using namespace CorUnix; CObjectType CorUnix::otProcess( otiProcess, NULL, // No cleanup routine - NULL, // No initialization routine 0, // No immutable data NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine sizeof(CProcProcessLocalData), NULL, // No process local data cleanup routine - 0, // No shared data - PROCESS_ALL_ACCESS, - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::CrossProcessDuplicationAllowed, CObjectType::WaitableObject, CObjectType::SingleTransitionObject, CObjectType::ThreadReleaseHasNoSideEffects, CObjectType::NoOwner ); -// -// Helper membarrier function -// -#ifdef __NR_membarrier -# define membarrier(...) syscall(__NR_membarrier, __VA_ARGS__) -#else -# define membarrier(...) -ENOSYS -#endif - -enum membarrier_cmd -{ - MEMBARRIER_CMD_QUERY = 0, - MEMBARRIER_CMD_GLOBAL = (1 << 0), - MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), - MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), - MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), - MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), - MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), - MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6) -}; - // // Tracks if the OS supports FlushProcessWriteBuffers using membarrier // @@ -192,7 +160,7 @@ IPalObject* CorUnix::g_pobjProcess; // Critical section that protects process data (e.g., the // list of active threads)/ // -CRITICAL_SECTION g_csProcess; +minipal_mutex g_csProcess; // // List and count of active threads @@ -229,7 +197,7 @@ PathCharString* gSharedFilesPath = nullptr; #if defined(__NetBSD__) #define CLR_SEM_MAX_NAMELEN 15 #elif defined(__APPLE__) -#define CLR_SEM_MAX_NAMELEN PSEMNAMLEN +#define CLR_SEM_MAX_NAMELEN 31 #elif defined(NAME_MAX) #define CLR_SEM_MAX_NAMELEN (NAME_MAX - 4) #else @@ -547,6 +515,9 @@ CorUnix::InternalCreateProcess( LPPROCESS_INFORMATION lpProcessInformation ) { +#ifdef TARGET_TVOS + return ERROR_NOT_SUPPORTED; +#else PAL_ERROR palError = NO_ERROR; IPalObject *pobjProcess = NULL; IPalObject *pobjProcessRegistered = NULL; @@ -1083,6 +1054,7 @@ CorUnix::InternalCreateProcess( } return palError; +#endif // !TARGET_TVOS } @@ -1397,7 +1369,7 @@ PALIMPORT VOID PALAPI PAL_SetCreateDumpCallback( - IN PCREATEDUMP_CALLBACK callback) + IN PCREATEDUMP_CALLBACK callback) { _ASSERTE(g_createdumpCallback == nullptr); g_createdumpCallback = callback; @@ -1432,21 +1404,217 @@ static uint64_t HashSemaphoreName(uint64_t a, uint64_t b) static const char *const TwoWayNamedPipePrefix = "clr-debug-pipe"; static const char* IpcNameFormat = "%s-%d-%llu-%s"; -/*++ - PAL_NotifyRuntimeStarted +#ifdef ENABLE_RUNTIME_EVENTS_OVER_PIPES +static const char* RuntimeStartupPipeName = "st"; +static const char* RuntimeContinuePipeName = "co"; - Signals the debugger waiting for runtime startup notification to continue and - waits until the debugger signals us to continue. +#define PIPE_OPEN_RETRY_DELAY_NS 500000000 // 500 ms -Parameters: - None +typedef enum +{ + RuntimeEventsOverPipes_Disabled = 0, + RuntimeEventsOverPipes_Succeeded = 1, + RuntimeEventsOverPipes_Failed = 2, +} RuntimeEventsOverPipes; -Return value: - TRUE - successfully launched by debugger, FALSE - not launched or some failure in the handshake ---*/ +typedef enum +{ + RuntimeEvent_Unknown = 0, + RuntimeEvent_Started = 1, + RuntimeEvent_Continue = 2, +} RuntimeEvent; + +static +int +OpenPipe(const char* name, int mode) +{ + int fd = -1; + int flags = mode | O_NONBLOCK; + +#if defined(FD_CLOEXEC) + flags |= O_CLOEXEC; +#endif + + while (fd == -1) + { + fd = open(name, flags); + if (fd == -1) + { + if (mode == O_WRONLY && errno == ENXIO) + { + PAL_nanosleep(PIPE_OPEN_RETRY_DELAY_NS); + continue; + } + else if (errno == EINTR) + { + continue; + } + else + { + break; + } + } + } + + if (fd != -1) + { + flags = fcntl(fd, F_GETFL); + if (flags != -1) + { + flags &= ~O_NONBLOCK; + if (fcntl(fd, F_SETFL, flags) == -1) + { + close(fd); + fd = -1; + } + } + else + { + close(fd); + fd = -1; + } + } + + return fd; +} + +static +void +ClosePipe(int fd) +{ + if (fd != -1) + { + while (close(fd) < 0 && errno == EINTR); + } +} + +static +RuntimeEventsOverPipes +NotifyRuntimeUsingPipes() +{ + RuntimeEventsOverPipes result = RuntimeEventsOverPipes_Disabled; + char startupPipeName[MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH]; + char continuePipeName[MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH]; + int startupPipeFd = -1; + int continuePipeFd = -1; + size_t offset = 0; + + LPCSTR applicationGroupId = PAL_GetApplicationGroupId(); + + PAL_GetTransportPipeName(continuePipeName, gPID, applicationGroupId, RuntimeContinuePipeName); + TRACE("NotifyRuntimeUsingPipes: opening continue '%s' pipe\n", continuePipeName); + + continuePipeFd = OpenPipe(continuePipeName, O_RDONLY); + if (continuePipeFd == -1) + { + if (errno == ENOENT || errno == EACCES) + { + TRACE("NotifyRuntimeUsingPipes: pipe %s not found/accessible, runtime events over pipes disabled\n", continuePipeName); + } + else + { + TRACE("NotifyRuntimeUsingPipes: open(%s) failed: %d (%s)\n", continuePipeName, errno, strerror(errno)); + result = RuntimeEventsOverPipes_Failed; + } + + goto exit; + } + + PAL_GetTransportPipeName(startupPipeName, gPID, applicationGroupId, RuntimeStartupPipeName); + TRACE("NotifyRuntimeUsingPipes: opening startup '%s' pipe\n", startupPipeName); + + startupPipeFd = OpenPipe(startupPipeName, O_WRONLY); + if (startupPipeFd == -1) + { + if (errno == ENOENT || errno == EACCES) + { + TRACE("NotifyRuntimeUsingPipes: pipe %s not found/accessible, runtime events over pipes disabled\n", startupPipeName); + } + else + { + TRACE("NotifyRuntimeUsingPipes: open(%s) failed: %d (%s)\n", startupPipeName, errno, strerror(errno)); + result = RuntimeEventsOverPipes_Failed; + } + + goto exit; + } + + TRACE("NotifyRuntimeUsingPipes: sending started event\n"); + + { + unsigned char event = (unsigned char)RuntimeEvent_Started; + unsigned char *buffer = &event; + int bytesToWrite = sizeof(event); + int bytesWritten = 0; + + do + { + bytesWritten = write(startupPipeFd, buffer + offset, bytesToWrite - offset); + if (bytesWritten > 0) + { + offset += bytesWritten; + } + } + while ((bytesWritten > 0 && offset < bytesToWrite) || (bytesWritten == -1 && errno == EINTR)); + + if (offset != bytesToWrite) + { + TRACE("NotifyRuntimeUsingPipes: write(%s) failed: %d (%s)\n", startupPipeName, errno, strerror(errno)); + goto exit; + } + } + + TRACE("NotifyRuntimeUsingPipes: waiting on continue event\n"); + + { + unsigned char event = (unsigned char)RuntimeEvent_Unknown; + unsigned char *buffer = &event; + int bytesToRead = sizeof(event); + int bytesRead = 0; + + offset = 0; + do + { + bytesRead = read(continuePipeFd, buffer + offset, bytesToRead - offset); + if (bytesRead > 0) + { + offset += bytesRead; + } + } + while ((bytesRead > 0 && offset < bytesToRead) || (bytesRead == -1 && errno == EINTR)); + + if (offset == bytesToRead && event == (unsigned char)RuntimeEvent_Continue) + { + TRACE("NotifyRuntimeUsingPipes: received continue event\n"); + } + else + { + TRACE("NotifyRuntimeUsingPipes: received invalid event\n"); + goto exit; + } + } + + result = RuntimeEventsOverPipes_Succeeded; + +exit: + + if (startupPipeFd != -1) + { + ClosePipe(startupPipeFd); + } + + if (continuePipeFd != -1) + { + ClosePipe(continuePipeFd); + } + + return result; +} +#endif // ENABLE_RUNTIME_EVENTS_OVER_PIPES + +static BOOL -PALAPI -PAL_NotifyRuntimeStarted() +NotifyRuntimeUsingSemaphores() { char startupSemName[CLR_SEM_MAX_NAMELEN]; char continueSemName[CLR_SEM_MAX_NAMELEN]; @@ -1467,13 +1635,13 @@ PAL_NotifyRuntimeStarted() CreateSemaphoreName(startupSemName, RuntimeStartupSemaphoreName, unambiguousProcessDescriptor, applicationGroupId); CreateSemaphoreName(continueSemName, RuntimeContinueSemaphoreName, unambiguousProcessDescriptor, applicationGroupId); - TRACE("PAL_NotifyRuntimeStarted opening continue '%s' startup '%s'\n", continueSemName, startupSemName); + TRACE("NotifyRuntimeUsingSemaphores: opening continue '%s' startup '%s'\n", continueSemName, startupSemName); // Open the debugger startup semaphore. If it doesn't exists, then we do nothing and return startupSem = sem_open(startupSemName, 0); if (startupSem == SEM_FAILED) { - TRACE("sem_open(%s) failed: %d (%s)\n", startupSemName, errno, strerror(errno)); + TRACE("NotifyRuntimeUsingSemaphores: sem_open(%s) failed: %d (%s)\n", startupSemName, errno, strerror(errno)); goto exit; } @@ -1496,7 +1664,7 @@ PAL_NotifyRuntimeStarted() { if (EINTR == errno) { - TRACE("sem_wait() failed with EINTR; re-waiting"); + TRACE("NotifyRuntimeUsingSemaphores: sem_wait() failed with EINTR; re-waiting"); continue; } ASSERT("sem_wait(continueSem) failed: errno is %d (%s)\n", errno, strerror(errno)); @@ -1518,6 +1686,45 @@ PAL_NotifyRuntimeStarted() return launched; } +/*++ + PAL_NotifyRuntimeStarted + + Signals the debugger waiting for runtime startup notification to continue and + waits until the debugger signals us to continue. + +Parameters: + None + +Return value: + TRUE - successfully launched by debugger, FALSE - not launched or some failure in the handshake +--*/ +BOOL +PALAPI +PAL_NotifyRuntimeStarted() +{ +#ifdef ENABLE_RUNTIME_EVENTS_OVER_PIPES + // Test pipes as runtime event transport. + RuntimeEventsOverPipes result = NotifyRuntimeUsingPipes(); + switch (result) + { + case RuntimeEventsOverPipes_Disabled: + TRACE("PAL_NotifyRuntimeStarted: pipe handshake disabled, try semaphores\n"); + return NotifyRuntimeUsingSemaphores(); + case RuntimeEventsOverPipes_Failed: + TRACE("PAL_NotifyRuntimeStarted: pipe handshake failed\n"); + return FALSE; + case RuntimeEventsOverPipes_Succeeded: + TRACE("PAL_NotifyRuntimeStarted: pipe handshake succeeded\n"); + return TRUE; + default: + // Unexpected result. + return FALSE; + } +#else + return NotifyRuntimeUsingSemaphores(); +#endif // ENABLE_RUNTIME_EVENTS_OVER_PIPES +} + LPCSTR PALAPI PAL_GetApplicationGroupId() @@ -1680,6 +1887,23 @@ GetProcessIdDisambiguationKey(DWORD processId, UINT64 *disambiguationKey) return TRUE; +#elif defined(__HAIKU__) + + // On Haiku, we return the process start time expressed in microseconds since boot time. + + team_info info; + + if (get_team_info(processId, &info) == B_OK) + { + *disambiguationKey = info.start_time; + return TRUE; + } + else + { + WARN("Failed to get start time of a process."); + return FALSE; + } + #elif HAVE_PROCFS_STAT // Here we read /proc//stat file to get the start time for the process. @@ -2197,6 +2421,9 @@ PROCCreateCrashDump( INT cbErrorMessageBuffer, bool serialize) { +#if defined(TARGET_IOS) || defined(TARGET_TVOS) + return FALSE; +#else _ASSERTE(argv.size() > 0); _ASSERTE(errorMessageBuffer == nullptr || cbErrorMessageBuffer > 0); @@ -2206,8 +2433,11 @@ PROCCreateCrashDump( size_t previousThreadId = InterlockedCompareExchange(&g_crashingThreadId, currentThreadId, 0); if (previousThreadId != 0) { - // Should never reenter or recurse - _ASSERTE(previousThreadId != currentThreadId); + // Return error if reenter this code + if (previousThreadId == currentThreadId) + { + return false; + } // The first thread generates the crash info and any other threads are blocked while (true) @@ -2217,8 +2447,8 @@ PROCCreateCrashDump( } } - int pipe_descs[2]; - if (pipe(pipe_descs) == -1) + int pipe_descs[4]; + if (pipe(pipe_descs) == -1 || pipe(pipe_descs + 2) == -1) { if (errorMessageBuffer != nullptr) { @@ -2226,9 +2456,13 @@ PROCCreateCrashDump( } return false; } - // [0] is read end, [1] is write end - int parent_pipe = pipe_descs[0]; - int child_pipe = pipe_descs[1]; + + // from parent (write) to child (read), used to signal prctl(PR_SET_PTRACER, childpid) is done + int child_read_pipe = pipe_descs[0]; + int parent_write_pipe = pipe_descs[1]; + // from child (write) to parent (read), used to capture createdump's stderr + int parent_read_pipe = pipe_descs[2]; + int child_write_pipe = pipe_descs[3]; // Fork the core dump child process. pid_t childpid = fork(); @@ -2240,19 +2474,36 @@ PROCCreateCrashDump( { sprintf_s(errorMessageBuffer, cbErrorMessageBuffer, "Problem launching createdump: fork() FAILED %s (%d)\n", strerror(errno), errno); } - close(pipe_descs[0]); - close(pipe_descs[1]); + for (int i = 0; i < 4; i++) + { + close(pipe_descs[i]); + } return false; } else if (childpid == 0) { - // Close the read end of the pipe, the child doesn't need it - close(parent_pipe); + int callbackResult = 0; + + close(parent_read_pipe); + close(parent_write_pipe); + + // Wait for prctl(PR_SET_PTRACER, childpid) in parent + char buffer; + int bytesRead; + while((bytesRead = read(child_read_pipe, &buffer, 1)) < 0 && errno == EINTR); + close(child_read_pipe); + + if (bytesRead != 1) + { + fprintf(stderr, "Problem reading from createdump child_read_pipe: %s (%d)\n", strerror(errno), errno); + close(child_write_pipe); + exit(-1); + } // Only dup the child's stderr if there is error buffer if (errorMessageBuffer != nullptr) { - dup2(child_pipe, STDERR_FILENO); + dup2(child_write_pipe, STDERR_FILENO); } if (g_createdumpCallback != nullptr) { @@ -2260,7 +2511,12 @@ PROCCreateCrashDump( SEHCleanupSignals(true /* isChildProcess */); // Call the statically linked createdump code - g_createdumpCallback(argv.size(), argv.data()); + callbackResult = g_createdumpCallback(argv.size(), argv.data()); + // Set the shutdown callback to nullptr and exit + // If we don't exit, the child's execution will continue into the diagnostic server behavior + // which causes all sorts of problems. + g_shutdownCallback = nullptr; + exit(callbackResult); } else { @@ -2274,6 +2530,8 @@ PROCCreateCrashDump( } else { + close(child_read_pipe); + close(child_write_pipe); #if HAVE_PRCTL_H && HAVE_PR_SET_PTRACER // Gives the child process permission to use /proc//mem and ptrace if (prctl(PR_SET_PTRACER, childpid, 0, 0, 0) == -1) @@ -2283,7 +2541,21 @@ PROCCreateCrashDump( ERROR("PROCCreateCrashDump: prctl() FAILED %s (%d)\n", strerror(errno), errno); } #endif // HAVE_PRCTL_H && HAVE_PR_SET_PTRACER - close(child_pipe); + // Signal child that prctl(PR_SET_PTRACER, childpid) is done + int bytesWritten; + while((bytesWritten = write(parent_write_pipe, "S", 1)) < 0 && errno == EINTR); + close(parent_write_pipe); + + if (bytesWritten != 1) + { + fprintf(stderr, "Problem writing to createdump parent_write_pipe: %s (%d)\n", strerror(errno), errno); + close(parent_read_pipe); + if (errorMessageBuffer != nullptr) + { + errorMessageBuffer[0] = 0; + } + return false; + } // Read createdump's stderr messages (if any) if (errorMessageBuffer != nullptr) @@ -2291,7 +2563,7 @@ PROCCreateCrashDump( // Read createdump's stderr int bytesRead = 0; int count = 0; - while ((count = read(parent_pipe, errorMessageBuffer + bytesRead, cbErrorMessageBuffer - bytesRead)) > 0) + while ((count = read(parent_read_pipe, errorMessageBuffer + bytesRead, cbErrorMessageBuffer - bytesRead)) > 0) { bytesRead += count; } @@ -2301,7 +2573,7 @@ PROCCreateCrashDump( fputs(errorMessageBuffer, stderr); } } - close(parent_pipe); + close(parent_read_pipe); // Parent waits until the child process is done int wstatus = 0; @@ -2321,6 +2593,7 @@ PROCCreateCrashDump( } } return true; +#endif // !TARGET_IOS && !TARGET_TVOS } /*++ @@ -2462,6 +2735,16 @@ PAL_GenerateCoreDump( (no return value) --*/ +#ifdef HOST_ANDROID +#include +VOID +PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, bool serialize) +{ + // TODO: Dump all managed threads callstacks into logcat and/or file? + // TODO: Dump stress log into logcat and/or file when enabled? + minipal_log_write_fatal("Aborting process.\n"); +} +#else VOID PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, bool serialize) { @@ -2530,6 +2813,7 @@ PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, bool serialize) free(signalAddressArg); } } +#endif /*++ Function: @@ -2577,21 +2861,32 @@ InitializeFlushProcessWriteBuffers() _ASSERTE(s_helperPage == 0); _ASSERTE(s_flushUsingMemBarrier == 0); - // Starting with Linux kernel 4.14, process memory barriers can be generated - // using MEMBARRIER_CMD_PRIVATE_EXPEDITED. - int mask = membarrier(MEMBARRIER_CMD_QUERY, 0); - if (mask >= 0 && - mask & MEMBARRIER_CMD_PRIVATE_EXPEDITED) +#if defined(__linux__) || HAVE_SYS_MEMBARRIER_H + +#ifdef TARGET_ANDROID + // Avoid calling membarrier on older Android versions where membarrier + // may be barred by seccomp causing the process to be killed. + int apiLevel = android_get_device_api_level(); + if (apiLevel >= __ANDROID_API_Q__) +#endif { - // Register intent to use the private expedited command. - if (membarrier(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, 0) == 0) + // Starting with Linux kernel 4.14, process memory barriers can be generated + // using MEMBARRIER_CMD_PRIVATE_EXPEDITED. + int mask = membarrier(MEMBARRIER_CMD_QUERY, 0, 0); + if (mask >= 0 && + mask & MEMBARRIER_CMD_PRIVATE_EXPEDITED) { - s_flushUsingMemBarrier = TRUE; - return TRUE; + // Register intent to use the private expedited command. + if (membarrier(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, 0, 0) == 0) + { + s_flushUsingMemBarrier = TRUE; + return TRUE; + } } } +#endif -#ifdef TARGET_OSX +#if defined(TARGET_APPLE) || defined(TARGET_WASM) return TRUE; #else s_helperPage = static_cast(mmap(0, GetVirtualPageSize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0)); @@ -2621,7 +2916,7 @@ InitializeFlushProcessWriteBuffers() } return status == 0; -#endif // TARGET_OSX +#endif // TARGET_APPLE || TARGET_WASM } #define FATAL_ASSERT(e, msg) \ @@ -2645,12 +2940,16 @@ VOID PALAPI FlushProcessWriteBuffers() { +#ifndef TARGET_WASM +#if defined(__linux__) || HAVE_SYS_MEMBARRIER_H if (s_flushUsingMemBarrier) { - int status = membarrier(MEMBARRIER_CMD_PRIVATE_EXPEDITED, 0); + int status = membarrier(MEMBARRIER_CMD_PRIVATE_EXPEDITED, 0, 0); FATAL_ASSERT(status == 0, "Failed to flush using membarrier"); } - else if (s_helperPage != 0) + else +#endif + if (s_helperPage != 0) { int status = pthread_mutex_lock(&flushProcessWriteBuffersMutex); FATAL_ASSERT(status == 0, "Failed to lock the flushProcessWriteBuffersMutex lock"); @@ -2671,7 +2970,7 @@ FlushProcessWriteBuffers() status = pthread_mutex_unlock(&flushProcessWriteBuffersMutex); FATAL_ASSERT(status == 0, "Failed to unlock the flushProcessWriteBuffersMutex lock"); } -#ifdef TARGET_OSX +#ifdef TARGET_APPLE else { mach_msg_type_number_t cThreads; @@ -2700,7 +2999,8 @@ FlushProcessWriteBuffers() machret = vm_deallocate(mach_task_self(), (vm_address_t)pThreads, cThreads * sizeof(thread_act_t)); CHECK_MACH("vm_deallocate()", machret); } -#endif // TARGET_OSX +#endif // TARGET_APPLE +#endif // !TARGET_WASM } /*++ @@ -2777,14 +3077,14 @@ CorUnix::InitializeProcessData( pGThreadList = NULL; g_dwThreadCount = 0; - InternalInitializeCriticalSection(&g_csProcess); + minipal_mutex_init(&g_csProcess); fLockInitialized = TRUE; if (NO_ERROR != palError) { if (fLockInitialized) { - InternalDeleteCriticalSection(&g_csProcess); + minipal_mutex_destroy(&g_csProcess); } } @@ -2830,7 +3130,7 @@ CorUnix::InitializeProcessCommandLine( ERROR("Invalid full path\n"); palError = ERROR_INTERNAL_ERROR; goto exit; - } + } lpwstr[0] = '\0'; size_t n = PAL_wcslen(lpwstrFullPath) + 1; @@ -3001,7 +3301,7 @@ PROCCleanupInitialProcess(VOID) { CPalThread *pThread = InternalGetCurrentThread(); - InternalEnterCriticalSection(pThread, &g_csProcess); + minipal_mutex_enter(&g_csProcess); /* Free the application directory */ free(g_lpwstrAppDir); @@ -3009,7 +3309,7 @@ PROCCleanupInitialProcess(VOID) /* Free the stored command line */ free(g_lpwstrCmdLine); - InternalLeaveCriticalSection(pThread, &g_csProcess); + minipal_mutex_leave(&g_csProcess); // // Object manager shutdown will handle freeing the underlying @@ -3037,7 +3337,7 @@ CorUnix::PROCAddThread( { /* protect the access of the thread list with critical section for mutithreading access */ - InternalEnterCriticalSection(pCurrentThread, &g_csProcess); + minipal_mutex_enter(&g_csProcess); pTargetThread->SetNext(pGThreadList); pGThreadList = pTargetThread; @@ -3046,7 +3346,7 @@ CorUnix::PROCAddThread( TRACE("Thread 0x%p (id %#x) added to the process thread list\n", pTargetThread, pTargetThread->GetThreadId()); - InternalLeaveCriticalSection(pCurrentThread, &g_csProcess); + minipal_mutex_leave(&g_csProcess); } @@ -3072,7 +3372,7 @@ CorUnix::PROCRemoveThread( /* protect the access of the thread list with critical section for mutithreading access */ - InternalEnterCriticalSection(pCurrentThread, &g_csProcess); + minipal_mutex_enter(&g_csProcess); curThread = pGThreadList; @@ -3113,7 +3413,7 @@ CorUnix::PROCRemoveThread( WARN("Thread %p not removed (it wasn't found in the list)\n", pTargetThread); EXIT: - InternalLeaveCriticalSection(pCurrentThread, &g_csProcess); + minipal_mutex_leave(&g_csProcess); } @@ -3158,7 +3458,7 @@ PROCProcessLock( CPalThread * pThread = (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : NULL); - InternalEnterCriticalSection(pThread, &g_csProcess); + minipal_mutex_enter(&g_csProcess); } @@ -3182,7 +3482,7 @@ PROCProcessUnlock( CPalThread * pThread = (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : NULL); - InternalLeaveCriticalSection(pThread, &g_csProcess); + minipal_mutex_leave(&g_csProcess); } #if USE_SYSV_SEMAPHORES @@ -3630,10 +3930,16 @@ getFileName( wcEnd = *lpEnd; *lpEnd = 0x0000; - /* Convert to ASCII */ + /* Convert to UTF-8 */ int size = 0; - int length = (PAL_wcslen(lpCommandLine)+1) * sizeof(WCHAR); - lpFileName = lpFileNamePS.OpenStringBuffer(length); + int length = WideCharToMultiByte(CP_ACP, 0, lpCommandLine, -1, NULL, 0, NULL, NULL); + if (length == 0) + { + ERROR("Failed to calculate the required buffer length.\n"); + return FALSE; + }; + + lpFileName = lpFileNamePS.OpenStringBuffer(length - 1); if (NULL == lpFileName) { ERROR("Not Enough Memory!\n"); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/thread.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/thread.cpp index abfde0de7..ec6920f92 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/thread.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/src/thread/thread.cpp @@ -17,7 +17,6 @@ SET_DEFAULT_DEBUG_CHANNEL(THREAD); // some headers have code with asserts, so do #include "pal/thread.hpp" #include "pal/mutex.hpp" #include "pal/handlemgr.hpp" -#include "pal/cs.hpp" #include "pal/seh.hpp" #include "pal/signal.hpp" @@ -29,6 +28,8 @@ SET_DEFAULT_DEBUG_CHANNEL(THREAD); // some headers have code with asserts, so do #include "pal/utils.h" #include "pal/virtual.h" +#include + #if defined(__NetBSD__) && !HAVE_PTHREAD_GETCPUCLOCKID #include #include @@ -41,6 +42,10 @@ SET_DEFAULT_DEBUG_CHANNEL(THREAD); // some headers have code with asserts, so do #include #endif +#if defined(TARGET_BROWSER) +#include +#endif + #include #include #if HAVE_PTHREAD_NP_H @@ -75,14 +80,6 @@ typedef cpuset_t cpu_set_t; using namespace CorUnix; -#ifdef __APPLE__ -#define MAX_THREAD_NAME_SIZE 63 -#elif defined(__FreeBSD__) -#define MAX_THREAD_NAME_SIZE MAXCOMLEN -#else -#define MAX_THREAD_NAME_SIZE 15 -#endif - /* ------------------- Definitions ------------------------------*/ // Activation function that gets called when an activation is injected into a thread. @@ -94,34 +91,17 @@ void ThreadCleanupRoutine( CPalThread *pThread, IPalObject *pObjectToCleanup, - bool fShutdown, - bool fCleanupSharedState - ); - -PAL_ERROR -ThreadInitializationRoutine( - CPalThread *pThread, - CObjectType *pObjectType, - void *pImmutableData, - void *pSharedData, - void *pProcessLocalData + bool fShutdown ); CObjectType CorUnix::otThread( otiThread, ThreadCleanupRoutine, - ThreadInitializationRoutine, 0, // sizeof(CThreadImmutableData), NULL, // No immutable data copy routine NULL, // No immutable data cleanup routine sizeof(CThreadProcessLocalData), NULL, // No process local data cleanup routine - 0, // sizeof(CThreadSharedData), - 0, // THREAD_ALL_ACCESS, - CObjectType::SecuritySupported, - CObjectType::SecurityInfoNotPersisted, - CObjectType::UnnamedObject, - CObjectType::LocalDuplicationOnly, CObjectType::WaitableObject, CObjectType::SingleTransitionObject, CObjectType::ThreadReleaseHasNoSideEffects, @@ -157,7 +137,7 @@ static void InternalEndCurrentThreadWrapper(void *arg) will lock its own critical section */ LOADCallDllMain(DLL_THREAD_DETACH, NULL); -#if !HAVE_MACH_EXCEPTIONS +#if !HAVE_MACH_EXCEPTIONS && HAVE_SIGALTSTACK pThread->FreeSignalAlternateStack(); #endif // !HAVE_MACH_EXCEPTIONS @@ -209,7 +189,7 @@ VOID TLSCleanup() --*/ CPalThread* AllocTHREAD() { - return InternalNew(); + return new(std::nothrow) CPalThread(); } /*++ @@ -222,19 +202,7 @@ CPalThread* AllocTHREAD() --*/ static void FreeTHREAD(CPalThread *pThread) { - // - // Run the destructors for this object - // - - pThread->~CPalThread(); - -#ifdef _DEBUG - // Fill value so we can find code re-using threads after they're dead. We - // check against pThread->dwGuard when getting the current thread's data. - memset((void*)pThread, 0xcc, sizeof(*pThread)); -#endif - - free(pThread); + delete pThread; } @@ -829,10 +797,6 @@ CorUnix::InternalEndCurrentThread( PAL_ERROR palError = NO_ERROR; ISynchStateController *pSynchStateController = NULL; -#ifdef PAL_PERF - PERFDisableThreadProfile(UserCreatedThread != pThread->GetThreadType()); -#endif - // // Abandon any objects owned by this thread // @@ -1370,10 +1334,9 @@ CorUnix::GetThreadTimesInternal( CPalThread *pThread; CPalThread *pTargetThread; IPalObject *pobjThread = NULL; + clockid_t cid; #ifdef __sun int fd; -#else // __sun - clockid_t cid; #endif // __sun pThread = InternalGetCurrentThread(); @@ -1394,6 +1357,7 @@ CorUnix::GetThreadTimesInternal( pTargetThread->Lock(pThread); +#if HAVE_PTHREAD_GETCPUCLOCKID || HAVE_CLOCK_THREAD_CPUTIME #if HAVE_PTHREAD_GETCPUCLOCKID if (pthread_getcpuclockid(pTargetThread->GetPThreadSelf(), &cid) != 0) { @@ -1402,6 +1366,9 @@ CorUnix::GetThreadTimesInternal( pTargetThread->Unlock(pThread); goto SetTimesToZero; } +#else // HAVE_PTHREAD_GETCPUCLOCKID + cid = CLOCK_THREAD_CPUTIME_ID; +#endif // HAVE_PTHREAD_GETCPUCLOCKID struct timespec ts; if (clock_gettime(cid, &ts) != 0) @@ -1435,9 +1402,9 @@ CorUnix::GetThreadTimesInternal( close(fd); ts = status.pr_utime; -#else // HAVE_PTHREAD_GETCPUCLOCKID +#else // HAVE_PTHREAD_GETCPUCLOCKID || HAVE_CLOCK_THREAD_CPUTIME #error "Don't know how to obtain user cpu time on this platform." -#endif // HAVE_PTHREAD_GETCPUCLOCKID +#endif // HAVE_PTHREAD_GETCPUCLOCKID || HAVE_CLOCK_THREAD_CPUTIME pTargetThread->Unlock(pThread); @@ -1474,138 +1441,54 @@ SetThreadDescription( IN HANDLE hThread, IN PCWSTR lpThreadDescription) { - CPalThread *pThread; - PAL_ERROR palError; - PERF_ENTRY(SetThreadDescription); ENTRY("SetThreadDescription(hThread=%p,lpThreadDescription=%p)\n", hThread, lpThreadDescription); - pThread = InternalGetCurrentThread(); - - palError = InternalSetThreadDescription( - pThread, - hThread, - lpThreadDescription - ); + CPalThread *pThread = InternalGetCurrentThread(); - if (NO_ERROR != palError) - { - pThread->SetLastError(palError); - } - - LOGEXIT("SetThreadDescription"); - PERF_EXIT(SetThreadDescription); - - return HRESULT_FROM_WIN32(palError); -} - -PAL_ERROR -CorUnix::InternalSetThreadDescription( - CPalThread *pThread, - HANDLE hTargetThread, - PCWSTR lpThreadDescription -) -{ - PAL_ERROR palError = NO_ERROR; CPalThread *pTargetThread = NULL; IPalObject *pobjThread = NULL; - int error = 0; - int maxNameSize = 0; int nameSize; char *nameBuf = NULL; -// The exact API of pthread_setname_np varies very wildly depending on OS. -// For now, only Linux, macOS and FreeBSD are implemented. -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) - - palError = InternalGetThreadDataFromHandle( - pThread, - hTargetThread, - &pTargetThread, - &pobjThread - ); - - if (NO_ERROR != palError) - { - goto InternalSetThreadDescriptionExit; - } - - pTargetThread->Lock(pThread); - - // Ignore requests to set the main thread name because - // it causes the value returned by Process.ProcessName to change. - if ((pid_t)pTargetThread->GetThreadId() == getpid()) - { - goto InternalSetThreadDescriptionExit; - } - - /* translate the wide char lpThreadDescription string to multibyte string */ - nameSize = WideCharToMultiByte(CP_ACP, 0, lpThreadDescription, -1, NULL, 0, NULL, NULL); - - if (0 == nameSize) - { - palError = ERROR_INTERNAL_ERROR; - goto InternalSetThreadDescriptionExit; - } - - nameBuf = (char *)malloc(nameSize); - if (nameBuf == NULL) - { - palError = ERROR_OUTOFMEMORY; - goto InternalSetThreadDescriptionExit; - } - - if (WideCharToMultiByte(CP_ACP, 0, lpThreadDescription, -1, nameBuf, nameSize, NULL, - NULL) != nameSize) - { - palError = ERROR_INTERNAL_ERROR; - goto InternalSetThreadDescriptionExit; - } - - // Null terminate early. - // pthread_setname_np only accepts up to 16 chars on Linux, - // 64 chars on macOS and 20 chars on FreeBSD. - if (nameSize > MAX_THREAD_NAME_SIZE) - { - nameBuf[MAX_THREAD_NAME_SIZE] = '\0'; - } - - #if defined(__linux__) || defined(__FreeBSD__) - error = pthread_setname_np(pTargetThread->GetPThreadSelf(), nameBuf); - #endif - - #if defined(__APPLE__) - // on macOS, pthread_setname_np only works for the calling thread. - if (PlatformGetCurrentThreadId() == pTargetThread->GetThreadId()) - { - error = pthread_setname_np(nameBuf); - } - #endif - - if (error != 0) - { - palError = ERROR_INTERNAL_ERROR; - } - -InternalSetThreadDescriptionExit: - - if (NULL != pTargetThread) + PAL_ERROR palError = InternalGetThreadDataFromHandle(pThread, hThread, &pTargetThread, &pobjThread); + if (palError == NO_ERROR) { - pTargetThread->Unlock(pThread); - } + // Ignore requests to set the main thread name because + // it causes the value returned by Process.ProcessName to change. + if ((pid_t)pTargetThread->GetThreadId() != getpid()) + { + nameSize = WideCharToMultiByte(CP_ACP, 0, lpThreadDescription, -1, NULL, 0, NULL, NULL); + if (nameSize > 0) + { + nameBuf = (char *)malloc(nameSize); + if (nameBuf == NULL || WideCharToMultiByte(CP_ACP, 0, lpThreadDescription, -1, nameBuf, nameSize, NULL, NULL) != nameSize) + { + pThread->SetLastError(ERROR_INSUFFICIENT_BUFFER); + } + else + { + int setNameResult = minipal_set_thread_name(pTargetThread->GetPThreadSelf(), nameBuf); + (void)setNameResult; // used + _ASSERTE(setNameResult == 0); + } - if (NULL != pobjThread) - { - pobjThread->ReleaseReference(pThread); - } + free(nameBuf); + } + else + { + pThread->SetLastError(ERROR_INVALID_PARAMETER); + } + } - if (NULL != nameBuf) { - free(nameBuf); + if (pobjThread != NULL) + pobjThread->ReleaseReference(pThread); } -#endif //defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) + LOGEXIT("SetThreadDescription"); + PERF_EXIT(SetThreadDescription); - return palError; + return HRESULT_FROM_WIN32(palError); } void * @@ -1667,7 +1550,7 @@ CPalThread::ThreadEntry( } #endif // HAVE_SCHED_GETAFFINITY && HAVE_SCHED_SETAFFINITY -#if !HAVE_MACH_EXCEPTIONS +#if !HAVE_MACH_EXCEPTIONS && HAVE_SIGALTSTACK if (!pThread->EnsureSignalAlternateStack()) { ASSERT("Cannot allocate alternate stack for SIGSEGV!\n"); @@ -1732,11 +1615,6 @@ CPalThread::ThreadEntry( LOADCallDllMain(DLL_THREAD_ATTACH, NULL); } -#ifdef PAL_PERF - PERFAllocThreadInfo(); - PERFEnableThreadProfile(UserCreatedThread != pThread->GetThreadType()); -#endif - /* call the startup routine */ pfnStartRoutine = pThread->GetStartAddress(); pvPar = pThread->GetStartParameter(); @@ -2164,7 +2042,7 @@ CPalThread::RunPreCreateInitializers( // First, perform initialization of CPalThread private members // - InternalInitializeCriticalSection(&m_csLock); + minipal_mutex_init(&m_mtxLock); m_fLockInitialized = TRUE; iError = pthread_mutex_init(&m_startMutex, NULL); @@ -2223,7 +2101,7 @@ CPalThread::~CPalThread() if (m_fLockInitialized) { - InternalDeleteCriticalSection(&m_csLock); + minipal_mutex_destroy(&m_mtxLock); } if (m_fStartItemsInitialized) @@ -2390,7 +2268,7 @@ CPalThread::WaitForStartStatus( return m_fStartStatus; } -#if !HAVE_MACH_EXCEPTIONS +#if !HAVE_MACH_EXCEPTIONS && HAVE_SIGALTSTACK /*++ Function : EnsureSignalAlternateStack @@ -2406,6 +2284,10 @@ Return : BOOL CPalThread::EnsureSignalAlternateStack() { +#ifdef TARGET_WASM + // WebAssembly does not support alternate signal stacks. + return TRUE; +#else // !TARGET_WASM int st = 0; if (g_registered_signal_handlers) @@ -2459,6 +2341,7 @@ CPalThread::EnsureSignalAlternateStack() } return (st == 0); +#endif // !TARGET_WASM } /*++ @@ -2476,6 +2359,7 @@ Return : void CPalThread::FreeSignalAlternateStack() { +#ifndef TARGET_WASM // WebAssembly does not support alternate signal stacks. void *altstack = m_alternateStack; m_alternateStack = nullptr; @@ -2499,6 +2383,7 @@ CPalThread::FreeSignalAlternateStack() } } } +#endif // !TARGET_WASM } #endif // !HAVE_MACH_EXCEPTIONS @@ -2507,8 +2392,7 @@ void ThreadCleanupRoutine( CPalThread *pThread, IPalObject *pObjectToCleanup, - bool fShutdown, - bool fCleanupSharedState + bool fShutdown ) { CThreadProcessLocalData *pThreadData = NULL; @@ -2551,24 +2435,12 @@ ThreadCleanupRoutine( } -PAL_ERROR -ThreadInitializationRoutine( - CPalThread *pThread, - CObjectType *pObjectType, - void *pImmutableData, - void *pSharedData, - void *pProcessLocalData - ) -{ - return NO_ERROR; -} - // Get base address of the current thread's stack void * CPalThread::GetStackBase() { void* stackBase; -#ifdef TARGET_OSX +#ifdef TARGET_APPLE // This is a Mac specific method stackBase = pthread_get_stackaddr_np(pthread_self()); #else @@ -2582,6 +2454,7 @@ CPalThread::GetStackBase() status = pthread_attr_init(&attr); _ASSERT_MSG(status == 0, "pthread_attr_init call failed"); +#ifndef TARGET_BROWSER #if HAVE_PTHREAD_ATTR_GET_NP status = pthread_attr_get_np(thread, &attr); #elif HAVE_PTHREAD_GETATTR_NP @@ -2598,7 +2471,10 @@ CPalThread::GetStackBase() _ASSERT_MSG(status == 0, "pthread_attr_destroy call failed"); stackBase = (void*)((size_t)stackAddr + stackSize); -#endif +#else // TARGET_BROWSER + stackBase = (void*)emscripten_stack_get_base(); +#endif // TARGET_BROWSER +#endif // !TARGET_APPLE return stackBase; } @@ -2608,7 +2484,7 @@ void * CPalThread::GetStackLimit() { void* stackLimit; -#ifdef TARGET_OSX +#ifdef TARGET_APPLE // This is a Mac specific method stackLimit = ((BYTE *)pthread_get_stackaddr_np(pthread_self()) - pthread_get_stacksize_np(pthread_self())); @@ -2622,6 +2498,7 @@ CPalThread::GetStackLimit() status = pthread_attr_init(&attr); _ASSERT_MSG(status == 0, "pthread_attr_init call failed"); +#ifndef TARGET_BROWSER #if HAVE_PTHREAD_ATTR_GET_NP status = pthread_attr_get_np(thread, &attr); #elif HAVE_PTHREAD_GETATTR_NP @@ -2636,7 +2513,10 @@ CPalThread::GetStackLimit() status = pthread_attr_destroy(&attr); _ASSERT_MSG(status == 0, "pthread_attr_destroy call failed"); -#endif +#else // TARGET_BROWSER + stackLimit = (void*)emscripten_stack_get_end(); +#endif // TARGET_BROWSER +#endif // !TARGET_APPLE return stackLimit; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/CMakeLists.txt index 5c65aa5c5..a63387917 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/CMakeLists.txt @@ -48,19 +48,6 @@ add_executable_clr(paltests #composite/object_management/semaphore/nonshared/semaphore.cpp #composite/object_management/semaphore/shared/main.cpp #composite/object_management/semaphore/shared/semaphore.cpp - #composite/synchronization/criticalsection/criticalsection.cpp - #composite/synchronization/criticalsection/mainWrapper.cpp - #composite/synchronization/nativecriticalsection/mtx_critsect.cpp - #composite/synchronization/nativecriticalsection/pal_composite_native_cs.cpp - #composite/synchronization/nativecriticalsection/resultbuffer.cpp - #composite/synchronization/nativecs_interlocked/interlocked.cpp - #composite/synchronization/nativecs_interlocked/mtx_critsect.cpp - #composite/synchronization/nativecs_interlocked/pal_composite_native_cs.cpp - #composite/synchronization/nativecs_interlocked/resultbuffer.cpp - #composite/threading/threadsuspension/mainWrapper.cpp - #composite/threading/threadsuspension/threadsuspension.cpp - #composite/threading/threadsuspension_switchthread/mainWrapper.cpp - #composite/threading/threadsuspension_switchthread/threadsuspension.cpp #composite/wfmo/main.cpp #composite/wfmo/mutex.cpp c_runtime/atof/test1/test1.cpp @@ -261,31 +248,11 @@ add_executable_clr(paltests filemapping_memmgt/VirtualProtect/test6/VirtualProtect.cpp filemapping_memmgt/VirtualProtect/test7/VirtualProtect.cpp filemapping_memmgt/VirtualQuery/test1/VirtualQuery.cpp - file_io/CopyFileA/test1/CopyFileA.cpp - file_io/CopyFileA/test2/test2.cpp - file_io/CopyFileA/test3/test3.cpp - file_io/CopyFileA/test4/test4.cpp - file_io/CopyFileW/test1/CopyFileW.cpp - file_io/CopyFileW/test2/test2.cpp - file_io/CopyFileW/test3/test3.cpp file_io/CreateFileA/test1/CreateFileA.cpp file_io/CreateFileW/test1/CreateFileW.cpp file_io/errorpathnotfound/test1/test1.cpp - file_io/errorpathnotfound/test2/test2.cpp file_io/FILECanonicalizePath/FILECanonicalizePath.cpp - file_io/FindClose/test1/FindClose.cpp - file_io/FindFirstFileA/test1/FindFirstFileA.cpp - file_io/FindFirstFileW/test1/FindFirstFileW.cpp - file_io/FindNextFileA/test1/FindNextFileA.cpp - file_io/FindNextFileA/test2/findnextfilea.cpp - file_io/FindNextFileW/test1/FindNextFileW.cpp - file_io/FindNextFileW/test2/findnextfilew.cpp file_io/FlushFileBuffers/test1/FlushFileBuffers.cpp - file_io/GetConsoleOutputCP/test1/GetConsoleOutputCP.cpp - file_io/GetFileAttributesA/test1/GetFileAttributesA.cpp - file_io/GetFileAttributesExW/test1/test1.cpp - file_io/GetFileAttributesExW/test2/test2.cpp - file_io/GetFileAttributesW/test1/GetFileAttributesW.cpp file_io/GetFileSize/test1/GetFileSize.cpp file_io/GetFileSizeEx/test1/GetFileSizeEx.cpp file_io/GetFullPathNameA/test1/GetFullPathNameA.cpp @@ -300,12 +267,6 @@ add_executable_clr(paltests file_io/GetStdHandle/test2/GetStdHandle.cpp file_io/GetSystemTime/test1/test.cpp file_io/GetSystemTimeAsFileTime/test1/GetSystemTimeAsFileTime.cpp - file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp - file_io/GetTempFileNameA/test2/GetTempFileNameA.cpp - file_io/GetTempFileNameA/test3/gettempfilenamea.cpp - file_io/GetTempFileNameW/test1/GetTempFileNameW.cpp - file_io/GetTempFileNameW/test2/GetTempFileNameW.cpp - file_io/GetTempFileNameW/test3/gettempfilenamew.cpp file_io/gettemppatha/test1/gettemppatha.cpp file_io/GetTempPathW/test1/GetTempPathW.cpp file_io/ReadFile/test1/ReadFile.cpp @@ -340,7 +301,6 @@ add_executable_clr(paltests loader/LoadLibraryW/test5/loadlibraryw.cpp #locale_info/CompareStringA/test1/test1.cpp #locale_info/CompareStringW/test1/test1.cpp - locale_info/GetACP/test1/test1.cpp #locale_info/GetLocaleInfoW/test1/test1.cpp #locale_info/GetLocaleInfoW/test2/test2.cpp locale_info/MultiByteToWideChar/test1/test1.cpp @@ -379,7 +339,6 @@ add_executable_clr(paltests miscellaneous/GetEnvironmentVariableW/test6/test6.cpp miscellaneous/GetLastError/test1/test.cpp miscellaneous/GetSystemInfo/test1/test.cpp - miscellaneous/GetTickCount/test1/test.cpp miscellaneous/InterlockedCompareExchange/test1/test.cpp miscellaneous/InterlockedCompareExchange/test2/test.cpp miscellaneous/InterlockedCompareExchange64/test1/test.cpp @@ -402,8 +361,6 @@ add_executable_clr(paltests #miscellaneous/IsBadWritePtr/test1/test.cpp #miscellaneous/IsBadWritePtr/test2/test2.cpp #miscellaneous/IsBadWritePtr/test3/test3.cpp - miscellaneous/queryperformancecounter/test1/test1.cpp - miscellaneous/queryperformancefrequency/test1/test1.cpp miscellaneous/SetEnvironmentVariableA/test1/test1.cpp miscellaneous/SetEnvironmentVariableA/test2/test2.cpp miscellaneous/SetEnvironmentVariableA/test3/test3.cpp @@ -413,7 +370,6 @@ add_executable_clr(paltests miscellaneous/SetEnvironmentVariableW/test3/test3.cpp miscellaneous/SetEnvironmentVariableW/test4/test4.cpp miscellaneous/SetLastError/test1/test.cpp -# pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.cpp pal_specific/PAL_Initialize_Terminate/test1/PAL_Initialize_Terminate.cpp pal_specific/PAL_Initialize_Terminate/test2/pal_initialize_twice.cpp # pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.cpp @@ -435,13 +391,6 @@ add_executable_clr(paltests threading/CreateThread/test1/test1.cpp threading/CreateThread/test2/test2.cpp threading/CreateThread/test3/test3.cpp - threading/CriticalSectionFunctions/test1/InitializeCriticalSection.cpp - threading/CriticalSectionFunctions/test2/test2.cpp - threading/CriticalSectionFunctions/test4/test4.cpp - threading/CriticalSectionFunctions/test5/test5.cpp - threading/CriticalSectionFunctions/test6/test6.cpp - threading/CriticalSectionFunctions/test7/test7.cpp - threading/CriticalSectionFunctions/test8/test8.cpp threading/DuplicateHandle/test1/test1.cpp threading/DuplicateHandle/test10/test10.cpp threading/DuplicateHandle/test11/childprocess.cpp @@ -534,3 +483,7 @@ target_link_libraries(paltests install (TARGETS paltests DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL) add_dependencies(paltests_install paltests) install (PROGRAMS runpaltests.sh runpaltestshelix.sh DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL) + +if(CLR_CMAKE_HOST_BROWSER) + install(FILES wasm/index.html paltestlist.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR} COMPONENT paltests EXCLUDE_FROM_ALL) +endif(CLR_CMAKE_HOST_BROWSER) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/DisabledTests.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/DisabledTests.txt index 0f7094c4a..83b9bcc84 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/DisabledTests.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/DisabledTests.txt @@ -15,21 +15,6 @@ The above testcases were disabled in the palsuite, because they depend heavily o WaitForDebugEvent,DebugActiveProcess and ContinueDebugEvent, where these api's have been removed from the PAL. - -file_io/gettempfilenamea/test2 : -======================================= -This test takes longer than 60 seconds to run. The test creates -about 65000 files and then deletes them. The test that takes longer -than 60 seconds will be flagged as an error and so in such a case -the test will have to be run manually. - -file_io/gettempfilenamew/test2 : -======================================= -This test takes longer than 60 seconds to run. The test creates -about 65000 files and then deletes them. The test that takes longer -than 60 seconds will be flagged as an error and so in such a case -the test will have to be run manually. - locale_info/getcpinfo/test2: ======================================= This test will be useful in future versions for testing various diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/README.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/README.txt index 84a297538..a8bfb707f 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/README.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/README.txt @@ -9,14 +9,9 @@ 2. RUNNING THE SUITES 3. ENVIRONMENT VARIABLES AND AUTOMATED TESTING SPECIFICS -3.1 PAL_DISABLE_MESSAGEBOX -3.2 Other Notes 4. ADDITIONAL NOTES ON TESTING/SPECIFIC TEST CASE ISSUES File_IO: getfilesize/test1, setfilepointer/test(5,6,7) - File_IO: gettempfilename(a,w)/test2 - File_IO: setfileattributesa/test(1,4), setfileattributesw/test(1,4) - Miscellaneous: messageboxw/test(1,2) Pal_specific:: pal_get_stdin/test1, pal_get_stdout/test1, pal_get_stderr/test1 Threading: setconsolectrlhandler/test(3,4) @@ -45,7 +40,6 @@ The results are logged to %ROTOR_DIR%\tests\pvtResults.log. See notes in section 4 on the following test cases if running automated tests: - Miscellaneous: messageboxw/test(1,2) Threading: setconsolectrlhandler/test(3,4) @@ -59,20 +53,6 @@ ample disk space. On systems with less than 6Gb free disk space expect these test cases to fail. -File_IO: gettempfilename(a,w)/test2 - -These test cases take longer than 60 seconds to run. Currently, the Test -Harness will timeout any test case that exceeds 60 seconds. - - -Miscellaneous: messageboxw/test(1,2) - -Setting PAL_MESSAGEBOX_DISABLE=1 for these test cases prevents message box pop -ups that occur during the tests' execution on Windows. For automated testing -where user interaction is not desired/possible, setting this environment -variable will prevent a pause in the automated test run. - - ic: pal_get_stdin/test1, pal_get_stdout/test1, pal_get_stderr/test1 These test cases should be manually inspected to ensure the information being returned diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.cpp deleted file mode 100644 index 9244c5f0a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/__iscsym/test1/__iscsym.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: __iscsym.c -** -** Purpose: Positive test the __iscsym API. -** Call __iscsym to letter, digit and underscore -** -** -**============================================================*/ -#include - -PALTEST(c_runtime___iscsym_test1_paltest_iscsym_test1, "c_runtime/__iscsym/test1/paltest_iscsym_test1") -{ - int err; - int index; - char non_letter_set[]= - {'~','`','!','@','#','$','%','^','&','*','(',')',')', - '-','+','=','|','\\',';',':','"','\'','<','>', - ',','.','?','/','\0'}; - char errBuffer[200]; - - /*Initialize the PAL environment*/ - err = PAL_Initialize(argc, argv); - if(0 != err) - { - return FAIL; - } - - /*To check if the parameter passed in is a character*/ - for(index = 'a'; index <= 'z'; index++) - { - err = __iscsym(index); - if(0 == err) - { - Fail("\n__iscsym failed to recognize a " - "lower-case letter:%c!\n", index); - } - } - - /*To check if the parameter passed in is a character*/ - for(index = 'A'; index <= 'Z'; index++) - { - err = __iscsym(index); - if(0 == err) - { - Fail("\n__iscsym failed to recognize an " - "upper-case letter: %c!\n", index); - } - } - - /*To check if the parameter passed in is a digit*/ - for(index = '0'; index <= '9'; index++) - { - err = __iscsym(index); - if(0 == err) - { - Fail("\n__iscsym failed to recognize a digit %c!\n", - index); - } - } - - /*To check if the parameter passed in is a underscore*/ - err = __iscsym('_'); - if(0 == err) - { - Fail("\n__iscsym failed to recognize an underscore!\n"); - } - - memset(errBuffer, 0, 200); - - for(index = 0; non_letter_set[index]; index++) - { - err = __iscsym(non_letter_set[index]); - if(0 != err) - { - strncat(errBuffer, &non_letter_set[index], 1); - strcat(errBuffer, ", "); - } - } - - if(strlen(errBuffer) > 0) - { - Fail("\n__iscsym failed to identify the characters '%s' " - "as not letters, digits " - "or underscores\n", errBuffer); - } - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_finite/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_finite/test1/test1.cpp deleted file mode 100644 index e21c9551b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_finite/test1/test1.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Checks that _finite correctly classifies all types -** of floating point numbers (NaN, -Infinity, Infinity, -** finite nonzero, unnormalized, 0, and -0) -** -**==========================================================================*/ - -#include - -/* -The IEEE double precision floating point standard looks like this: - - S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 0 1 11 12 63 - -S is the sign bit. The E bits are the exponent, and the 52 F bits are -the fraction. These represent a value, V. - -If E=2047 and F is nonzero, then V=NaN ("Not a number") -If E=2047 and F is zero and S is 1, then V=-Infinity -If E=2047 and F is zero and S is 0, then V=Infinity -If 0 - -/* -The IEEE single precision floating point standard looks like this: - - S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF - 0 1 8 9 31 - -S is the sign bit. The E bits are the exponent, and the 23 F bits are -the fraction. These represent a value, V. - -If E=255 and F is nonzero, then V=NaN ("Not a number") -If E=255 and F is zero and S is 1, then V=-Infinity -If E=255 and F is zero and S is 0, then V=Infinity -If 0 - -PALTEST(c_runtime__gcvt_test1_paltest_gcvt_test1, "c_runtime/_gcvt/test1/paltest_gcvt_test1") -{ - int err; - double dValue = -3.1415926535; - char buffer[1024]; - char *pChar7 = "-3.141593"; - - /*Initialize the PAL environment*/ - err = PAL_Initialize(argc, argv); - if(0 != err) - { - return FAIL; - } - - - /* zero the buffer */ - memset(buffer, 0, 1024); - - - /* - - Testing - ======= - - To convert a floating-point value to - a string to save 7 significant digits - */ - _gcvt(dValue, 7, buffer); - if(strcmp(pChar7, buffer)) - { - Fail("\nFailed to call _gcvt to convert a floating-point value " - "to a string with 7 sigficants digits stored\n"); - } - - - /* - Clean up and exit - */ - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.cpp deleted file mode 100644 index af4176978..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_gcvt/test2/test2.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Call the _gcvt function on a number of cases. Check that it -** handles negatives, exponents and hex digits properly. Also check that -** the 'digit' specification works. (And that it doesn't truncate negative -** signs or decimals) -** -** -**===================================================================*/ - -#include - -struct testCase -{ - double Value; - int Digits; - char WinCorrectResult[128]; - char BsdCorrectResult[128]; /* for the odd case where bsd sprintf - varies from windows sprintf */ -}; - -PALTEST(c_runtime__gcvt_test2_paltest_gcvt_test2, "c_runtime/_gcvt/test2/paltest_gcvt_test2") -{ - char result[128]; - int i=0; - - struct testCase testCases[] = - { - {1234567, 7, "1234567"}, - {1234.123, 7, "1234.123"}, - {1234.1234, 7, "1234.123"}, - {12.325678e+2, 7, "1232.568"}, - {-12.3233333, 8, "-12.323333"}, - {-12.32, 8, "-12.32"}, - {-12.32e+2, 8, "-1232.", "-1232" }, - {0x21DDFABC, 8, "5.6819577e+008", "5.6819577e+08" }, - {123456789012345.0, 15, "123456789012345" }, - {12340000.0, 8, "12340000"}, - {12340000000000000.0, 15, "1.234e+016", "1.234e+16" }, - {12340000000000000.0, 17, "12340000000000000" }, - - }; - - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Loop through each case. Call _gcvt on each test case and check the - result. - */ - - for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) - { - _gcvt(testCases[i].Value, testCases[i].Digits, result); - - if (strcmp(testCases[i].WinCorrectResult, result) != 0 && - - ( testCases[i].BsdCorrectResult && - strcmp(testCases[i].BsdCorrectResult, result) != 0 ) ) - { - Fail("ERROR: _gcvt attempted to convert %f with %d digits " - "signifigant, which resulted in " - "the string '%s' instead of the correct(Win) string '%s' or the" - "correct(bsd) string '%s'.\n", - testCases[i].Value, - testCases[i].Digits, - result, - testCases[i].WinCorrectResult, - testCases[i].BsdCorrectResult); - } - - memset(result, '\0', 128); - } - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_isnan/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_isnan/test1/test1.cpp deleted file mode 100644 index 98a96cc24..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_isnan/test1/test1.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: -** Test _isnan with a number of trivial values, to ensure they indicated that -** they are numbers. Then try with Positive/Negative Infinite, which should -** also be numbers. Finally set the least and most significant bits of -** the fraction to positive and negative, at which point it should return -** the true value. -** -**==========================================================================*/ - -#include - -#define TO_DOUBLE(x) (*((double*)((void*)&x))) -#define TO_I64(x) (*((INT64*)((void*)&x))) - -/* - * NaN: any double with maximum exponent (0x7ff) and non-zero fraction - */ -PALTEST(c_runtime__isnan_test1_paltest_isnan_test1, "c_runtime/_isnan/test1/paltest_isnan_test1") -{ - /* - * Initialize the PAL and return FAIL if this fails - */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - /* - * Try some trivial values - */ - if (_isnan(0.0)) - { - Fail("_isnan() incorrectly identified %f as NaN!\n", 0.0); - } - - if (_isnan(1.23456)) - { - Fail("_isnan() incorrectly identified %f as NaN!\n", 1.234567); - } - - if (_isnan(42.0)) - { - Fail("_isnan() incorrectly identified %f as NaN!\n", 42.0); - } - - UINT64 lneginf = UI64(0xfff0000000000000); - UINT64 lposinf = UI64(0x7ff0000000000000); - - double neginf = TO_DOUBLE(lneginf); - double posinf = TO_DOUBLE(lposinf); - - /* - * Try positive and negative infinity - */ - if (_isnan(neginf)) - { - Fail("_isnan() incorrectly identified negative infinity as NaN!\n"); - } - - if (_isnan(posinf)) - { - Fail("_isnan() incorrectly identified infinity as NaN!\n"); - } - - /* - * Try setting the least significant bit of the fraction, - * positive and negative - */ - UINT64 lsnan = UI64(0xfff0000000000001); - double snan = TO_DOUBLE(lsnan); - - if (!_isnan(snan)) - { - Fail("_isnan() failed to identify %I64x as NaN!\n", lsnan); - } - - UINT64 lqnan = UI64(0x7ff0000000000001); - double qnan = TO_DOUBLE(lqnan); - - if (!_isnan(qnan)) - { - Fail("_isnan() failed to identify %I64x as NaN!\n", lqnan); - } - - /* - * Try setting the most significant bit of the fraction, - * positive and negative - */ - lsnan = UI64(0xfff8000000000000); - snan = TO_DOUBLE(lsnan); - - if (!_isnan(snan)) - { - Fail ("_isnan() failed to identify %I64x as NaN!\n", lsnan); - } - - lqnan = UI64(0x7ff8000000000000); - qnan = TO_DOUBLE(lqnan); - - if (!_isnan(qnan)) - { - Fail ("_isnan() failed to identify %I64x as NaN!\n", lqnan); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_isnanf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_isnanf/test1/test1.cpp deleted file mode 100644 index b46b23834..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_isnanf/test1/test1.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: -** Test _isnanf with a number of trivial values, to ensure they indicated that -** they are numbers. Then try with Positive/Negative Infinite, which should -** also be numbers. Finally set the least and most significant bits of -** the fraction to positive and negative, at which point it should return -** the true value. -** -**==========================================================================*/ - -#include - -#define TO_FLOAT(x) (*((float*)((void*)&x))) -#define TO_I32(x) (*((INT32*)((void*)&x))) - -/* - * NaN: any float with maximum exponent (0x7f8) and non-zero fraction - */ -PALTEST(c_runtime__isnanf_test1_paltest_isnanf_test1, "c_runtime/_isnanf/test1/paltest_isnanf_test1") -{ - /* - * Initialize the PAL and return FAIL if this fails - */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - /* - * Try some trivial values - */ - if (_isnanf(0.0f)) - { - Fail("_isnanf() incorrectly identified %f as NaN!\n", 0.0f); - } - - if (_isnanf(1.234567f)) - { - Fail("_isnanf() incorrectly identified %f as NaN!\n", 1.234567f); - } - - if (_isnanf(42.0f)) - { - Fail("_isnanf() incorrectly identified %f as NaN!\n", 42.0f); - } - - UINT32 lneginf = 0xff800000u; - UINT32 lposinf = 0x7f800000u; - - float neginf = TO_FLOAT(lneginf); - float posinf = TO_FLOAT(lposinf); - - /* - * Try positive and negative infinity - */ - if (_isnanf(neginf)) - { - Fail("_isnanf() incorrectly identified negative infinity as NaN!\n"); - } - - if (_isnanf(posinf)) - { - Fail("_isnanf() incorrectly identified infinity as NaN!\n"); - } - - /* - * Try setting the least significant bit of the fraction, - * positive and negative - */ - UINT32 lsnan = 0xff800001u; - float snan = TO_FLOAT(lsnan); - - if (!_isnanf(snan)) - { - Fail("_isnanf() failed to identify %I32x as NaN!\n", lsnan); - } - - UINT32 lqnan = 0x7f800001u; - float qnan = TO_FLOAT(lqnan); - - if (!_isnanf(qnan)) - { - Fail("_isnanf() failed to identify %I32x as NaN!\n", lqnan); - } - - /* - * Try setting the most significant bit of the fraction, - * positive and negative - */ - lsnan = 0xffc00000u; - snan = TO_FLOAT(lsnan); - - if (!_isnanf(snan)) - { - Fail ("_isnanf() failed to identify %I32x as NaN!\n", lsnan); - } - - lqnan = 0x7fc00000u; - qnan = TO_FLOAT(lqnan); - - if (!_isnanf(qnan)) - { - Fail ("_isnanf() failed to identify %I32x as NaN!\n", lqnan); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_itow/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_itow/test1/test1.cpp deleted file mode 100644 index 15e6aa201..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_itow/test1/test1.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests the PAL implementation of the _itow_s function. -** Test a number of ints with different radix on each, -** to ensure that the string returned is correct. -** -** -**===================================================================*/ - -#define UNICODE - -#include - -struct testCase -{ - char16_t *CorrectResult; - int value; - int radix; -}; - -PALTEST(c_runtime__itow_test1_paltest_itow_test1, "c_runtime/_itow/test1/paltest_itow_test1") -{ - - char16_t result[20]; - char16_t *pResult = NULL; - char *PrintResult = NULL; /* Use with convertC so we can */ - char *PrintCorrectResult = NULL; /* print out the results */ - int i = 0; - - WCHAR case1[] = {'5','0','\0'}; - WCHAR case2[] = {'5','5','5','\0'}; - WCHAR case3[] = {'1','0','1','0','\0'}; - WCHAR case4[] = {'2','2','\0'}; - WCHAR case5[] = {'a','\0'}; - WCHAR case6[] = {'c','g','\0'}; - - /* Correct Result, Value to Convert, Radix to use */ - struct testCase testCases[] = - { - {case1, 50, 10}, - {case2,555,10}, - {case3,10,2}, - {case4,10,4}, - {case5,10,16}, - {case6,400,32} - }; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Loop through each case. Convert the ints to strings. Check - to ensure they were converted properly. - */ - - for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) - { - errno_t err = _itow_s(testCases[i].value, result, sizeof(result) / sizeof(result[0]), testCases[i].radix); - - if(err != 0) - { - Fail("ERROR: _itow_s didn't return success, error code %d.\n", err); - } - - if (0 != wcscmp(testCases[i].CorrectResult, result)) - { - PrintResult = convertC(pResult); - PrintCorrectResult = convertC(testCases[i].CorrectResult); - Fail("ERROR: _itow_s was called on %i, returning the string %s " - "when it should have returned the string %s.\n" - , testCases[i].value, PrintResult, PrintCorrectResult); - } - - } - - PAL_Terminate(); - return PASS; -} - - - - - - - - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.cpp deleted file mode 100644 index c8b1c16b0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_stricmp/test1/test1.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Do a lower case compare. Check two strings, only different -** because they have different capitalization, and they should return 0. Try -** two strings which will return less than 0 (one is smaller than the other). -** Also try the opposite, to get a return value greater than 0. -** -** -**==========================================================================*/ - -#include - -/* - * Note: The _stricmp is dependent on the LC_CTYPE category of the locale, - * and this is ignored by these tests. - */ -PALTEST(c_runtime__stricmp_test1_paltest_stricmp_test1, "c_runtime/_stricmp/test1/paltest_stricmp_test1") -{ - char *str1 = "foo"; - char *str2 = "fOo"; - char *str3 = "foo_bar"; - char *str4 = "foobar"; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - if (_stricmp(str1, str2) != 0) - { - Fail ("ERROR: _stricmp returning incorrect value:\n" - "_stricmp(\"%s\", \"%s\") != 0\n", str1, str2); - } - - if (_stricmp(str2, str3) >= 0) - { - Fail ("ERROR: _stricmp returning incorrect value:\n" - "_stricmp(\"%s\", \"%s\") >= 0\n", str2, str3); - } - - if (_stricmp(str3, str4) >= 0) - { - Fail ("ERROR: _stricmp returning incorrect value:\n" - "_stricmp(\"%s\", \"%s\") >= 0\n", str3, str4); - } - - if (_stricmp(str4, str1) <= 0) - { - Fail ("ERROR: _stricmp returning incorrect value:\n" - "_stricmp(\"%s\", \"%s\") <= 0\n", str4, str1); - } - - if (_stricmp(str3, str2) <= 0) - { - Fail ("ERROR: _stricmp returning incorrect value:\n" - "_stricmp(\"%s\", \"%s\") <= 0\n", str2, str3); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.cpp deleted file mode 100644 index 4954abfb9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/_strnicmp/test1/test1.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Test #1 for the _strnicmp function -** -** -**==========================================================================*/ - -#include - - -PALTEST(c_runtime__strnicmp_test1_paltest_strnicmp_test1, "c_runtime/_strnicmp/test1/paltest_strnicmp_test1") -{ - char str1[] = "foo"; - char str2[] = "foox"; - char str3[] = "fOo"; - char str4[] = "ABCDE"; - char str5[] = "ABCD["; - char str6[] = "abcde"; - char str7[] = "abcd^"; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - if (_strnicmp(str1, str2, strlen(str2)) >= 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned >= 0\n", - str1, str2, strlen(str2)); - } - - if (_strnicmp(str2, str1, strlen(str2)) <= 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned <= 0\n", - str2, str1, strlen(str2)); - } - - if (_strnicmp(str1, str2, strlen(str1)) != 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned != 0\n", - str1, str2, strlen(str1)); - } - - if (_strnicmp(str1, str3, strlen(str1)) != 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned != 0\n", - str1, str3, strlen(str3)); - } - - if (_strnicmp(str3, str1, strlen(str1)) != 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned != 0\n", - str3, str1, strlen(str1)); - } - - /* new testing */ - - /* str4 should be greater than str5 */ - if (_strnicmp(str4, str5, strlen(str4)) <= 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned >= 0\n", - str4, str5, strlen(str4)); - } - - /* str6 should be greater than str7 */ - if (_strnicmp(str6, str7, strlen(str6)) <= 0) - { - Fail ("ERROR: _strnicmp(\"%s\", \"%s\", %d) returned <= 0\n", - str6, str7, strlen(str6)); - } - - - PAL_Terminate(); - - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/abs/test1/abs.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/abs/test1/abs.cpp deleted file mode 100644 index 9ad83d64e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/abs/test1/abs.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: abs.c (test 1) -** -** Purpose: Tests the PAL implementation of the abs function. -** -** -**===================================================================*/ - -#include - -struct TESTS -{ - int nTest; - int nResult; -}; - -PALTEST(c_runtime_abs_test1_paltest_abs_test1, "c_runtime/abs/test1/paltest_abs_test1") -{ - int i = 0; - int nRc = 0; - struct TESTS testCase[] = - { - {0, 0}, - {1, 1}, - {-1, 1} - }; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - for (i = 0; i < (sizeof(testCase)/sizeof(struct TESTS)); i++) - { - nRc = abs(testCase[i].nTest); - if (nRc != testCase[i].nResult) - { - Fail("abs: ERROR -> abs(%d) returned %d " - "when it was expected to return %d \n", - testCase[i].nTest, - nRc, - testCase[i].nResult); - } - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acos/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acos/test1/test1.cpp deleted file mode 100644 index 5de46458e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acos/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that acos return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * acos_test1_validate - * - * test validation function - */ -void __cdecl acos_test1_validate(double value, double expected, double variance) -{ - double result = acos(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("acos(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * acos_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl acos_test1_validate_isnan(double value) -{ - double result = acos(value); - - if (!_isnan(result)) - { - Fail("acos(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_acos_test1_paltest_acos_test1, "c_runtime/acos/test1/paltest_acos_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { -1, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { -0.91173391478696510, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { -0.66820151019031295, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 0, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 0.12775121753523991, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 0.15594369476537447, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 0.42812514788535792, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 0.54030230586813972, 1, PAL_EPSILON * 10 }, - { 0.70710678118654752, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrt(2) - { 0.76024459707563015, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 0.76923890136397213, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 0.80410982822879171, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 0.90716712923909839, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 0.94976571538163866, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 1, 0, PAL_EPSILON }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - acos_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - acos_test1_validate_isnan(PAL_NEGINF); - acos_test1_validate_isnan(PAL_NAN); - acos_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acosf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acosf/test1/test1.cpp deleted file mode 100644 index 909d43cab..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acosf/test1/test1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that acosf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * acosf_test1_validate - * - * test validation function - */ -void __cdecl acosf_test1_validate(float value, float expected, float variance) -{ - float result = acosf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("acosf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * acosf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl acosf_test1_validate_isnan(float value) -{ - float result = acosf(value); - - if (!_isnanf(result)) - { - Fail("acosf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_acosf_test1_paltest_acosf_test1, "c_runtime/acosf/test1/paltest_acosf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { -1, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { -0.911733915f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { -0.668201510f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 0, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 0.127751218f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 0.155943695f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 0.428125148f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 0.540302306f, 1, PAL_EPSILON * 10 }, - { 0.707106781f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrtf(2) - { 0.760244597f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 0.769238901f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 0.804109828f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 0.907167129f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) - { 0.949765715f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 1, 0, PAL_EPSILON }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - acosf_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - acosf_test1_validate_isnan(PAL_NEGINF); - acosf_test1_validate_isnan(PAL_NAN); - acosf_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acosh/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acosh/test1/test1.cpp deleted file mode 100644 index 3d9368fcd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acosh/test1/test1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that acosh return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * acosh_test1_validate - * - * test validation function - */ -void __cdecl acosh_test1_validate(double value, double expected, double variance) -{ - double result = acosh(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("acosh(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * acosh_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl acosh_test1_validate_isnan(double value) -{ - double result = acosh(value); - - if (!_isnan(result)) - { - Fail("acosh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_acosh_test1_paltest_acosh_test1, "c_runtime/acosh/test1/paltest_acosh_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 1, 0, PAL_EPSILON }, - { 1.0510897883672876, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 1.0957974645564909, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 1.2095794864199787, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 1.25, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 1.2605918365213561, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 1.3246090892520058, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 1.5430806348152438, 1, PAL_EPSILON * 10 }, - { 1.7071001431069344, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 2.1781835566085709, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 2.2341880974508023, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 2.5091784786580568, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 5.05, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 7.6101251386622884, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 11.591953275521521, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - acosh_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - acosh_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acoshf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acoshf/test1/test1.cpp deleted file mode 100644 index 78bab37db..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/acoshf/test1/test1.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that acoshf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * acoshf_test1_validate - * - * test validation function - */ -void __cdecl acoshf_test1_validate(float value, float expected, float variance) -{ - float result = acoshf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("acoshf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * acoshf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl acoshf_test1_validate_isnan(float value) -{ - float result = acoshf(value); - - if (!_isnanf(result)) - { - Fail("acoshf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_acoshf_test1_paltest_acoshf_test1, "c_runtime/acoshf/test1/paltest_acoshf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 1, 0, PAL_EPSILON }, - { 1.05108979f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 1.09579746f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) - { 1.20957949f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 1.25f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 1.26059184f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 1.32460909f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 1.54308063f, 1, PAL_EPSILON * 10 }, - { 1.70710014f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 2.17818356f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 2.23418810f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 2.50917848f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 5.05f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 7.61012514f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 11.5919533f, 3.14159265f, PAL_EPSILON * 100 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - acoshf_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - acoshf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asin/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asin/test1/test1.cpp deleted file mode 100644 index b72599ad3..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asin/test1/test1.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that asin return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * asin_test1_validate - * - * test validation function - */ -void __cdecl asin_test1_validate(double value, double expected, double variance) -{ - double result = asin(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("asin(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * asin_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl asin_test1_validate_isnan(double value) -{ - double result = asin(value); - - if (!_isnan(result)) - { - Fail("asin(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * asin_test1_validate - * - * test validation function for values returning +INF - */ -void __cdecl asin_test1_validate_isinf_positive(double value) -{ - double result = asin(value); - - if (result != PAL_POSINF) - { - Fail("asin(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_POSINF); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_asin_test1_paltest_asin_test1, "c_runtime/asin/test1/paltest_asin_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.31296179620778659, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 0.41078129050290870, 0.42331082513074800, PAL_EPSILON }, // expected: pi - e - { 0.42077048331375735, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 0.59448076852482208, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 0.63896127631363480, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 0.64963693908006244, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 0.70710678118654752, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrt(2) - { 0.74398033695749319, 0.83900756059574755, PAL_EPSILON }, // expected: pi - ln(10) - { 0.84147098480789651, 1, PAL_EPSILON * 10 }, - { 0.90371945743584630, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 0.98776594599273553, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 0.99180624439366372, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 1, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - asin_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - asin_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - asin_test1_validate_isnan(PAL_NEGINF); - asin_test1_validate_isnan(PAL_NAN); - asin_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinf/test1/test1.cpp deleted file mode 100644 index abf35c261..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinf/test1/test1.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that asinf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * asinf_test1_validate - * - * test validation function - */ -void __cdecl asinf_test1_validate(float value, float expected, float variance) -{ - float result = asinf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("asinf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * asinf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl asinf_test1_validate_isnan(float value) -{ - float result = asinf(value); - - if (!_isnanf(result)) - { - Fail("asinf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * asinf_test1_validate - * - * test validation function for values returning +INF - */ -void __cdecl asinf_test1_validate_isinf_positive(float value) -{ - float result = asinf(value); - - if (result != PAL_POSINF) - { - Fail("asinf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_POSINF); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_asinf_test1_paltest_asinf_test1, "c_runtime/asinf/test1/paltest_asinf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.312961796f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 0.410781291f, 0.423310825f, PAL_EPSILON }, // expected: pi - e - { 0.420770483f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) - { 0.594480769f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 0.638961276f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 0.649636939f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 0.707106781f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrtf(2) - { 0.743980337f, 0.839007561f, PAL_EPSILON }, // expected: pi - ln(10) - { 0.841470985f, 1, PAL_EPSILON * 10 }, - { 0.903719457f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 0.987765946f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 0.991806244f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 1, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - asinf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - asinf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - asinf_test1_validate_isnan(PAL_NEGINF); - asinf_test1_validate_isnan(PAL_NAN); - asinf_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinh/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinh/test1/test1.cpp deleted file mode 100644 index a0ed7953d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinh/test1/test1.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that asinh return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * asinh_test1_validate - * - * test validation function - */ -void __cdecl asinh_test1_validate(double value, double expected, double variance) -{ - double result = asinh(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("asinh(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * asinh_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl asinh_test1_validate_isnan(double value) -{ - double result = asinh(value); - - if (!_isnan(result)) - { - Fail("asinh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * asinh_test1_validate - * - * test validation function for values returning +INF - */ -void __cdecl asinh_test1_validate_isinf_positive(double value) -{ - double result = asinh(value); - - if (result != PAL_POSINF) - { - Fail("asinh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_POSINF); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_asinh_test1_paltest_asinh_test1, "c_runtime/asinh/test1/paltest_asinh_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.32371243907207108, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 0.44807597941469025, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 0.68050167815224332, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 0.75, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 0.76752314512611633, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 0.86867096148600961, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 1.1752011936438015, 1, PAL_EPSILON * 10 }, - { 1.3835428792038633, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 1.9350668221743567, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 1.9978980091062796, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 2.3012989023072949, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 4.95, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 7.5441371028169758, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 11.548739357257748, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - asinh_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - asinh_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - asinh_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinhf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinhf/test1/test1.cpp deleted file mode 100644 index eb2af42b9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/asinhf/test1/test1.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that asinhf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * asinhf_test1_validate - * - * test validation function - */ -void __cdecl asinhf_test1_validate(float value, float expected, float variance) -{ - float result = asinhf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("asinhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * asinhf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl asinhf_test1_validate_isnan(float value) -{ - float result = asinhf(value); - - if (!_isnanf(result)) - { - Fail("asinhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * asinhf_test1_validate - * - * test validation function for values returning +INF - */ -void __cdecl asinhf_test1_validate_isinf_positive(float value) -{ - float result = asinhf(value); - - if (result != PAL_POSINF) - { - Fail("asinhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_POSINF); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_asinhf_test1_paltest_asinhf_test1, "c_runtime/asinhf/test1/paltest_asinhf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.323712439f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 0.448075979f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) - { 0.680501678f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 0.75, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 0.767523145f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 0.868670961f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 1.17520119f, 1, PAL_EPSILON * 10 }, - { 1.38354288f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 1.93506682f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 1.99789801f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 2.30129890f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 4.95f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 7.54413710f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 11.5487394f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - asinhf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - asinhf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - asinhf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan/test1/test1.cpp deleted file mode 100644 index 0e65933bc..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan/test1/test1.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that atan return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * atan_test1_validate - * - * test validation function - */ -void __cdecl atan_test1_validate(double value, double expected, double variance) -{ - double result = atan(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("atan(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * atan_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl atan_test1_validate_isnan(double value) -{ - double result = atan(value); - - if (!_isnan(result)) - { - Fail("atan(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_atan_test1_paltest_atan_test1, "c_runtime/atan/test1/paltest_atan_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.32951473309607836, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 0.45054953406980750, 0.42331082513074800, PAL_EPSILON }, // expected: pi - e - { 0.46382906716062964, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 0.73930295048660405, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 0.83064087786078395, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 0.85451043200960189, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 1, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 1.1134071468135374, 0.83900756059574755, PAL_EPSILON }, // expected: pi - ln(10) - { 1.5574077246549022, 1, PAL_EPSILON * 10 }, - { 2.1108768356626451, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 6.3341191670421916, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 7.7635756709721848, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { PAL_POSINF, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - atan_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - atan_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - atan_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan2/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan2/test1/test1.cpp deleted file mode 100644 index 629848799..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan2/test1/test1.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that atan2 returns correct values for a subset of values. -** Tests with positive and negative values of x and y to ensure -** atan2 is returning results from the correct quadrant. -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -struct test -{ - double y; /* second component of the value to test the function with */ - double x; /* first component of the value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * atan2_test1_validate - * - * test validation function - */ -void __cdecl atan2_test1_validate(double y, double x, double expected, double variance) -{ - double result = atan2(y, x); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("atan2(%g, %g) returned %20.17g when it should have returned %20.17g", - y, x, result, expected); - } -} - -/** - * atan2_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl atan2_test1_validate_isnan(double y, double x) -{ - double result = atan2(y, x); - - if (!_isnan(result)) - { - Fail("atan2(%g, %g) returned %20.17g when it should have returned %20.17g", - y, x, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_atan2_test1_paltest_atan2_test1, "c_runtime/atan2/test1/paltest_atan2_test1") -{ - struct test tests[] = - { - /* y x expected variance */ - { 0, PAL_POSINF, 0, PAL_EPSILON }, - { 0, 0, 0, PAL_EPSILON }, - { 0.31296179620778659, 0.94976571538163866, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 0.42077048331375735, 0.90716712923909839, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 0.59448076852482208, 0.80410982822879171, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 0.63896127631363480, 0.76923890136397213, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 0.64963693908006244, 0.76024459707563015, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 0.70710678118654752, 0.70710678118654752, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrt(2) - { 1, 1, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { PAL_POSINF, PAL_POSINF, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 0.84147098480789651, 0.54030230586813972, 1, PAL_EPSILON * 10 }, - { 0.90371945743584630, 0.42812514788535792, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 0.98776594599273553, 0.15594369476537447, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 0.99180624439366372, 0.12775121753523991, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 1, 0, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { PAL_POSINF, 0, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { PAL_POSINF, 1, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 0.74398033695749319, -0.66820151019031295, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 0.41078129050290870, -0.91173391478696510, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 0, -1, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { 1, PAL_POSINF, 0, PAL_EPSILON }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - const double pi = 3.1415926535897932; - - atan2_test1_validate( tests[i].y, tests[i].x, tests[i].expected, tests[i].variance); - atan2_test1_validate(-tests[i].y, tests[i].x, -tests[i].expected, tests[i].variance); - atan2_test1_validate( tests[i].y, -tests[i].x, pi - tests[i].expected, tests[i].variance); - atan2_test1_validate(-tests[i].y, -tests[i].x, tests[i].expected - pi, tests[i].variance); - } - - atan2_test1_validate_isnan(PAL_NEGINF, PAL_NAN); - atan2_test1_validate_isnan(PAL_NAN, PAL_NEGINF); - atan2_test1_validate_isnan(PAL_NAN, PAL_POSINF); - atan2_test1_validate_isnan(PAL_POSINF, PAL_NAN); - - atan2_test1_validate_isnan(PAL_NAN, -1); - atan2_test1_validate_isnan(PAL_NAN, -0.0); - atan2_test1_validate_isnan(PAL_NAN, 0); - atan2_test1_validate_isnan(PAL_NAN, 1); - - atan2_test1_validate_isnan(-1, PAL_NAN); - atan2_test1_validate_isnan(-0.0, PAL_NAN); - atan2_test1_validate_isnan( 0, PAL_NAN); - atan2_test1_validate_isnan( 1, PAL_NAN); - - atan2_test1_validate_isnan(PAL_NAN, PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan2f/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan2f/test1/test1.cpp deleted file mode 100644 index f5915b3a0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atan2f/test1/test1.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that atan2f returns correct values for a subset of values. -** Tests with positive and negative values of x and y to ensure -** atan2f is returning results from the correct quadrant. -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -struct test -{ - float y; /* second component of the value to test the function with */ - float x; /* first component of the value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * atan2f_test1_validate - * - * test validation function - */ -void __cdecl atan2f_test1_validate(float y, float x, float expected, float variance) -{ - float result = atan2f(y, x); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("atan2f(%g, %g) returned %10.9g when it should have returned %10.9g", - y, x, result, expected); - } -} - -/** - * atan2f_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl atan2f_test1_validate_isnan(float y, float x) -{ - float result = atan2f(y, x); - - if (!_isnanf(result)) - { - Fail("atan2f(%g, %g) returned %10.9g when it should have returned %10.9g", - y, x, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_atan2f_test1_paltest_atan2f_test1, "c_runtime/atan2f/test1/paltest_atan2f_test1") -{ - struct test tests[] = - { - /* y x expected variance */ - { 0, PAL_POSINF, 0, PAL_EPSILON }, - { 0, 0, 0, PAL_EPSILON }, - { 0.312961796f, 0.949765715f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 0.420770483f, 0.907167129f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) - { 0.594480769f, 0.804109828f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 0.638961276f, 0.769238901f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 0.649636939f, 0.760244597f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 0.707106781f, 0.707106781f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4, value: 1 / sqrtf(2) - { 1, 1, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { PAL_POSINF, PAL_POSINF, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 0.841470985f, 0.540302306f, 1, PAL_EPSILON * 10 }, - { 0.903719457f, 0.428125148f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 0.987765946f, 0.155943695f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 0.991806244f, 0.127751218f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 1, 0, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { PAL_POSINF, 0, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { PAL_POSINF, 1, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 0.743980337f, -0.668201510f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 0.410781291f, -0.911733915f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 0, -1, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { 1, PAL_POSINF, 0, PAL_EPSILON }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - const float pi = 3.14159265f; - - atan2f_test1_validate( tests[i].y, tests[i].x, tests[i].expected, tests[i].variance); - atan2f_test1_validate(-tests[i].y, tests[i].x, -tests[i].expected, tests[i].variance); - atan2f_test1_validate( tests[i].y, -tests[i].x, pi - tests[i].expected, tests[i].variance); - atan2f_test1_validate(-tests[i].y, -tests[i].x, tests[i].expected - pi, tests[i].variance); - } - - atan2f_test1_validate_isnan(PAL_NEGINF, PAL_NAN); - atan2f_test1_validate_isnan(PAL_NAN, PAL_NEGINF); - atan2f_test1_validate_isnan(PAL_NAN, PAL_POSINF); - atan2f_test1_validate_isnan(PAL_POSINF, PAL_NAN); - - atan2f_test1_validate_isnan(PAL_NAN, -1); - atan2f_test1_validate_isnan(PAL_NAN, -0.0f); - atan2f_test1_validate_isnan(PAL_NAN, 0); - atan2f_test1_validate_isnan(PAL_NAN, 1); - - atan2f_test1_validate_isnan(-1, PAL_NAN); - atan2f_test1_validate_isnan(-0.0f, PAL_NAN); - atan2f_test1_validate_isnan( 0, PAL_NAN); - atan2f_test1_validate_isnan( 1, PAL_NAN); - - atan2f_test1_validate_isnan(PAL_NAN, PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanf/test1/test1.cpp deleted file mode 100644 index 518775f1f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanf/test1/test1.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that atanf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * atanf_test1_validate - * - * test validation function - */ -void __cdecl atanf_test1_validate(float value, float expected, float variance) -{ - float result = atanf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("atanf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * atanf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl atanf_test1_validate_isnan(float value) -{ - float result = atanf(value); - - if (!_isnanf(result)) - { - Fail("atanf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_atanf_test1_paltest_atanf_test1, "c_runtime/atanf/test1/paltest_atanf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.329514733f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 0.450549534f, 0.423310825f, PAL_EPSILON }, // expected: pi - e - { 0.463829067f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e) - { 0.739302950f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 0.830640878f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 0.854510432f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 1, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 1.11340715f, 0.839007561f, PAL_EPSILON }, // expected: pi - ln(10) - { 1.55740772f, 1, PAL_EPSILON * 10 }, - { 2.11087684f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 6.33411917f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 7.76357567f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { PAL_POSINF, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - atanf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - atanf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - atanf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanh/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanh/test1/test1.cpp deleted file mode 100644 index 24a042826..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanh/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that atanh return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * atanh_test1_validate - * - * test validation function - */ -void __cdecl atanh_test1_validate(double value, double expected, double variance) -{ - double result = atanh(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("atanh(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * atanh_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl atanh_test1_validate_isnan(double value) -{ - double result = atanh(value); - - if (!_isnan(result)) - { - Fail("atanh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_atanh_test1_paltest_atanh_test1, "c_runtime/atanh/test1/paltest_atanh_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.30797791269089433, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 0.40890401183401433, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 0.56259360033158334, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 0.6, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 0.60885936501391381, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 0.65579420263267244, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 0.76159415595576489, 1, PAL_EPSILON * 10 }, - { 0.81046380599898809, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 0.88838556158566054, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 0.89423894585503855, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 0.91715233566727435, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 0.98019801980198020, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 0.99132891580059984, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 0.99627207622074994, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { 1, PAL_POSINF, PAL_EPSILON * 10 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - atanh_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - atanh_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - atanh_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanhf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanhf/test1/test1.cpp deleted file mode 100644 index d8d184f90..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/atanhf/test1/test1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that atanhf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * atanhf_test1_validate - * - * test validation function - */ -void __cdecl atanhf_test1_validate(float value, float expected, float variance) -{ - float result = atanhf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("atanhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * atanhf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl atanhf_test1_validate_isnan(float value) -{ - float result = atanhf(value); - - if (!_isnanf(result)) - { - Fail("atanhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_atanhf_test1_paltest_atanhf_test1, "c_runtime/atanhf/test1/paltest_atanhf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.307977913f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 0.408904012f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) - { 0.562593600f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 0.6f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 0.608859365f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 0.655794203f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 0.761594156f, 1, PAL_EPSILON * 10 }, - { 0.810463806f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 0.888385562f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 0.894238946f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 0.917152336f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 0.980198020f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 0.991328916f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 0.996272076f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { 1, PAL_POSINF, PAL_EPSILON * 10 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - atanhf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - atanhf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - atanhf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/bsearch/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/bsearch/test1/test1.cpp deleted file mode 100644 index eacb660de..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/bsearch/test1/test1.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Calls bsearch to find a character in a sorted buffer, and -** verifies that the correct position is returned. -** -** -**==========================================================================*/ - -#include - -int __cdecl charcmp_bsearch_test1(const void *pa, const void *pb) -{ - return memcmp(pa, pb, 1); -} - -PALTEST(c_runtime_bsearch_test1_paltest_bsearch_test1, "c_runtime/bsearch/test1/paltest_bsearch_test1") -{ - - const char array[] = "abcdefghij"; - char * found=NULL; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - found = (char *)bsearch(&"d", array, sizeof(array) - 1, (sizeof(char)) - , charcmp_bsearch_test1); - if (found != array + 3) - { - Fail ("bsearch was unable to find a specified character in a " - "sorted list.\n"); - } - PAL_Terminate(); - return PASS; -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/bsearch/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/bsearch/test2/test2.cpp deleted file mode 100644 index a916e6136..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/bsearch/test2/test2.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Calls bsearch to find a character in a sorted buffer, -** that does not exist. -** -** -**==========================================================================*/ - -#include - -int __cdecl charcmp_bsearch_test2(const void *pa, const void *pb) -{ - return *(const char *)pa - *(const char *)pb; -} - -PALTEST(c_runtime_bsearch_test2_paltest_bsearch_test2, "c_runtime/bsearch/test2/paltest_bsearch_test2") -{ - - const char array[] = "abcefghij"; - const char missing[] = "0dz"; - char * found=NULL; - const char * candidate = missing; - - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - while (*candidate) { - found = (char *)bsearch(candidate, array, sizeof(array) - 1, - (sizeof(char)), charcmp_bsearch_test2); - if (found != NULL) - { - Fail ("ERROR: bsearch was able to find a specified character '%c' " - "in a sorted list '%s' as '%c' " - "even though the character is not in the list.\n", - *candidate, array, *found); - } - - candidate++; - } - - PAL_Terminate(); - return PASS; -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cbrt/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cbrt/test1/test1.cpp deleted file mode 100644 index 4cc57c27e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cbrt/test1/test1.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Call the cbrt function on a positive value, a positive value -** with a decimal and on the maximum possible double value. -** -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * cbrt_test1_validate - * - * test validation function - */ -void __cdecl cbrt_test1_validate(double value, double expected, double variance) -{ - double result = cbrt(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("cbrt(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * cbrt_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl cbrt_test1_validate_isnan(double value) -{ - double result = cbrt(value); - - if (!_isnan(result)) - { - Fail("cbrt(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -PALTEST(c_runtime_cbrt_test1_paltest_cbrt_test1, "c_runtime/cbrt/test1/paltest_cbrt_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.31830988618379067, 0.68278406325529568, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.75728863133090766, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.86025401382809963, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.88499704450051772, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.89089871814033930, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.92263507432201421, PAL_EPSILON }, // value: pi / 4 - { 1, 1, PAL_EPSILON * 10 }, - { 1.1283791670955126, 1.0410821966965807, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 1.1224620483093730, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 1.1299472763373901, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 1.1624473515096265, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 1.3205004784536852, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 1.3956124250860895, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 1.4645918875615233, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - cbrt_test1_validate(-0.0, -0.0, PAL_EPSILON); - cbrt_test1_validate( 0.0, 0.0, PAL_EPSILON); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - cbrt_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - cbrt_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - cbrt_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cbrtf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cbrtf/test1/test1.cpp deleted file mode 100644 index 8879a11ed..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cbrtf/test1/test1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Call the cbrtf function on a positive value, a positive value -** with a decimal and on the maximum possible float value. -** -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * cbrtf_test1_validate - * - * test validation function - */ -void __cdecl cbrtf_test1_validate(float value, float expected, float variance) -{ - float result = cbrtf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("cbrtf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * cbrtf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl cbrtf_test1_validate_isnan(float value) -{ - float result = cbrtf(value); - - if (!_isnanf(result)) - { - Fail("cbrtf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -PALTEST(c_runtime_cbrtf_test1_paltest_cbrtf_test1, "c_runtime/cbrtf/test1/paltest_cbrtf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.318309886f, 0.682784063f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.757288631f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.860254014f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.884997045f, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.890898718f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.922635074f, PAL_EPSILON }, // value: pi / 4 - { 1, 1, PAL_EPSILON * 10 }, - { 1.12837917f, 1.04108220f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 1.12246205f, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 1.12994728f, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 1.16244735f, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 1.32050048f, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 1.39561243f, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 1.46459189f, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - cbrtf_test1_validate(-0.0f, -0.0f, PAL_EPSILON); - cbrtf_test1_validate( 0.0f, 0.0f, PAL_EPSILON); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - cbrtf_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - cbrtf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - cbrtf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ceil/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ceil/test1/test1.cpp deleted file mode 100644 index 3f1d71e62..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ceil/test1/test1.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests ceil with simple positive and negative values. Also tests -** extreme cases like extremely small values and positive and -** negative infinity. Makes sure that calling ceil on NaN returns -** NaN -** -**==========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * ceil_test1_validate - * - * test validation function - */ -void __cdecl ceil_test1_validate(double value, double expected, double variance) -{ - double result = ceil(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("ceil(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * ceil_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl ceil_test1_validate_isnan(double value) -{ - double result = ceil(value); - - if (!_isnan(result)) - { - Fail("ceil(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_ceil_test1_paltest_ceil_test1, "c_runtime/ceil/test1/paltest_ceil_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.31830988618379067, 1, PAL_EPSILON * 10 }, // value: 1 / pi - { 0.43429448190325183, 1, PAL_EPSILON * 10 }, // value: log10(e) - { 0.63661977236758134, 1, PAL_EPSILON * 10 }, // value: 2 / pi - { 0.69314718055994531, 1, PAL_EPSILON * 10 }, // value: ln(2) - { 0.70710678118654752, 1, PAL_EPSILON * 10 }, // value: 1 / sqrt(2) - { 0.78539816339744831, 1, PAL_EPSILON * 10 }, // value: pi / 4 - { 1.1283791670955126, 2, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 2, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 2, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 2, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 3, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 3, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 4, PAL_EPSILON * 10 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - ceil_test1_validate( 0, 0, PAL_EPSILON); - ceil_test1_validate(-0.0, 0, PAL_EPSILON); - - ceil_test1_validate( 1, 1, PAL_EPSILON * 10); - ceil_test1_validate(-1.0, -1, PAL_EPSILON * 10); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - ceil_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - ceil_test1_validate(-tests[i].value, 1 - tests[i].expected, tests[i].variance); - } - - ceil_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ceilf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ceilf/test1/test1.cpp deleted file mode 100644 index cf237ea8e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ceilf/test1/test1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests ceilf with simple positive and negative values. Also tests -** extreme cases like extremely small values and positive and -** negative infinity. Makes sure that calling ceilf on NaN returns -** NaN -** -**==========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * ceilf_test1_validate - * - * test validation function - */ -void __cdecl ceilf_test1_validate(float value, float expected, float variance) -{ - float result = ceilf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("ceilf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * ceilf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl ceilf_test1_validate_isnan(float value) -{ - float result = ceilf(value); - - if (!_isnanf(result)) - { - Fail("ceilf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_ceilf_test1_paltest_ceilf_test1, "c_runtime/ceilf/test1/paltest_ceilf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.318309886f, 1, PAL_EPSILON * 10 }, // value: 1 / pi - { 0.434294482f, 1, PAL_EPSILON * 10 }, // value: log10f(e) - { 0.636619772f, 1, PAL_EPSILON * 10 }, // value: 2 / pi - { 0.693147181f, 1, PAL_EPSILON * 10 }, // value: ln(2) - { 0.707106781f, 1, PAL_EPSILON * 10 }, // value: 1 / sqrtf(2) - { 0.785398163f, 1, PAL_EPSILON * 10 }, // value: pi / 4 - { 1.12837917f, 2, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 2, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 2, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 2, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 3, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 3, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 4, PAL_EPSILON * 10 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - ceilf_test1_validate( 0, 0, PAL_EPSILON); - ceilf_test1_validate(-0.0f, 0, PAL_EPSILON); - - ceilf_test1_validate( 1, 1, PAL_EPSILON * 10); - ceilf_test1_validate(-1.0f, -1, PAL_EPSILON * 10); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - ceilf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - ceilf_test1_validate(-tests[i].value, 1 - tests[i].expected, tests[i].variance); - } - - ceilf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cos/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cos/test1/test1.cpp deleted file mode 100644 index d57489573..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cos/test1/test1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that cos return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * cos_test1_validate - * - * test validation function - */ -void __cdecl cos_test1_validate(double value, double expected, double variance) -{ - double result = cos(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("cos(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * cos_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl cos_test1_validate_isnan(double value) -{ - double result = cos(value); - - if (!_isnan(result)) - { - Fail("cos(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_cos_test1_paltest_cos_test1, "c_runtime/cos/test1/paltest_cos_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 1, PAL_EPSILON * 10 }, - { 0.31830988618379067, 0.94976571538163866, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.90716712923909839, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.80410982822879171, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.76923890136397213, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.76024459707563015, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.70710678118654752, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrt(2) - { 1, 0.54030230586813972, PAL_EPSILON }, - { 1.1283791670955126, 0.42812514788535792, PAL_EPSILON }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 0.15594369476537447, PAL_EPSILON }, // value: sqrt(2) - { 1.4426950408889634, 0.12775121753523991, PAL_EPSILON }, // value: log2(e) - { 1.5707963267948966, 0, PAL_EPSILON }, // value: pi / 2 - { 2.3025850929940457, -0.66820151019031295, PAL_EPSILON }, // value: ln(10) - { 2.7182818284590452, -0.91173391478696510, PAL_EPSILON }, // value: e - { 3.1415926535897932, -1, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - cos_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - cos_test1_validate(-tests[i].value, tests[i].expected, tests[i].variance); - } - - cos_test1_validate_isnan(PAL_NEGINF); - cos_test1_validate_isnan(PAL_NAN); - cos_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cosf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cosf/test1/test1.cpp deleted file mode 100644 index ed3a4512b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cosf/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that cosf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * cosf_test1_validate - * - * test validation function - */ -void __cdecl cosf_test1_validate(float value, float expected, float variance) -{ - float result = cosf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("cosf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * cosf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl cosf_test1_validate_isnan(float value) -{ - float result = cosf(value); - - if (!_isnanf(result)) - { - Fail("cosf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_cosf_test1_paltest_cosf_test1, "c_runtime/cosf/test1/paltest_cosf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 1, PAL_EPSILON * 10 }, - { 0.318309886f, 0.949765715f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.907167129f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.804109828f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.769238901f, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.760244597f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.707106781f, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrtf(2) - { 1, 0.540302306f, PAL_EPSILON }, - { 1.12837917f, 0.428125148f, PAL_EPSILON }, // value: 2 / sqrtf(pi) - { 1.41421356f, 0.155943695f, PAL_EPSILON }, // value: sqrtf(2) - { 1.44269504f, 0.127751218f, PAL_EPSILON }, // value: logf2(e) - { 1.57079633f, 0, PAL_EPSILON }, // value: pi / 2 - { 2.30258509f, -0.668201510f, PAL_EPSILON }, // value: ln(10) - { 2.71828183f, -0.911733918f, PAL_EPSILON }, // value: e - { 3.14159265f, -1, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - cosf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - cosf_test1_validate(-tests[i].value, tests[i].expected, tests[i].variance); - } - - cosf_test1_validate_isnan(PAL_NEGINF); - cosf_test1_validate_isnan(PAL_NAN); - cosf_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cosh/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cosh/test1/test1.cpp deleted file mode 100644 index 78518b78e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/cosh/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that cosh return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * cosh_test1_validate - * - * test validation function - */ -void __cdecl cosh_test1_validate(double value, double expected, double variance) -{ - double result = cosh(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("cosh(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * cosh_test1_validate - * - * test validation function for values returning PAL_NAN - */ -void __cdecl cosh_test1_validate_isnan(double value) -{ - double result = cosh(value); - - if (!_isnan(result)) - { - Fail("cosh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_cosh_test1_paltest_cosh_test1, "c_runtime/cosh/test1/paltest_cosh_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 1, PAL_EPSILON * 10 }, - { 0.31830988618379067, 1.0510897883672876, PAL_EPSILON * 10 }, // value: 1 / pi - { 0.43429448190325183, 1.0957974645564909, PAL_EPSILON * 10 }, // value: log10(e) - { 0.63661977236758134, 1.2095794864199787, PAL_EPSILON * 10 }, // value: 2 / pi - { 0.69314718055994531, 1.25, PAL_EPSILON * 10 }, // value: ln(2) - { 0.70710678118654752, 1.2605918365213561, PAL_EPSILON * 10 }, // value: 1 / sqrt(2) - { 0.78539816339744831, 1.3246090892520058, PAL_EPSILON * 10 }, // value: pi / 4 - { 1, 1.5430806348152438, PAL_EPSILON * 10 }, - { 1.1283791670955126, 1.7071001431069344, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 2.1781835566085709, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 2.2341880974508023, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 2.5091784786580568, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 5.05, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 7.6101251386622884, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 11.591953275521521, PAL_EPSILON * 100 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - cosh_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - cosh_test1_validate(-tests[i].value, tests[i].expected, tests[i].variance); - } - - cosh_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/coshf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/coshf/test1/test1.cpp deleted file mode 100644 index 27ba18c08..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/coshf/test1/test1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that coshf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * coshf_test1_validate - * - * test validation function - */ -void __cdecl coshf_test1_validate(float value, float expected, float variance) -{ - float result = coshf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("coshf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * coshf_test1_validate - * - * test validation function for values returning PAL_NAN - */ -void __cdecl coshf_test1_validate_isnan(float value) -{ - float result = coshf(value); - - if (!_isnanf(result)) - { - Fail("coshf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_coshf_test1_paltest_coshf_test1, "c_runtime/coshf/test1/paltest_coshf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 1, PAL_EPSILON * 10 }, - { 0.318309886f, 1.05108979f, PAL_EPSILON * 10 }, // value: 1 / pi - { 0.434294482f, 1.09579746f, PAL_EPSILON * 10 }, // value: log10f(e) - { 0.636619772f, 1.20957949f, PAL_EPSILON * 10 }, // value: 2 / pi - { 0.693147181f, 1.25f, PAL_EPSILON * 10 }, // value: ln(2) - { 0.707106781f, 1.26059184f, PAL_EPSILON * 10 }, // value: 1 / sqrtf(2) - { 0.785398163f, 1.32460909f, PAL_EPSILON * 10 }, // value: pi / 4 - { 1, 1.54308063f, PAL_EPSILON * 10 }, - { 1.12837917f, 1.70710014f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 2.17818356f, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 2.23418810f, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 2.50917848f, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 5.05f, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 7.61012514f, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 11.5919533f, PAL_EPSILON * 100 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - coshf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - coshf_test1_validate(-tests[i].value, tests[i].expected, tests[i].variance); - } - - coshf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/errno/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/errno/test1/test1.cpp deleted file mode 100644 index 7daab481e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/errno/test1/test1.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Test that errno begins as 0, and sets to ERANGE when that -** error is forced with wcstoul. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_errno_test1_paltest_errno_test1, "c_runtime/errno/test1/paltest_errno_test1") -{ - WCHAR overstr[] = {'4','2','9','4','9','6','7','2','9','6',0}; - WCHAR *end; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* - The only value that must be supported is - ERANGE, in the event that wcstoul() fails due to overflow. - */ - - wcstoul(overstr, &end, 10); - - if (errno != ERANGE) - { - Fail("ERROR: wcstoul did not set errno to ERANGE. Instead " - "the value of errno is %d\n", errno); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/errno/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/errno/test2/test2.cpp deleted file mode 100644 index 7a0e27007..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/errno/test2/test2.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test2.c -** -** Purpose: Test that errno is 'per-thread' as noted in the documentation. -** -** -**==========================================================================*/ - -#include - -/* - This thread function just checks that errno is initially 0 and then sets - it to a new value before returning. -*/ -DWORD PALAPI ThreadFunc_errno_test2( LPVOID lpParam ) -{ - - if(errno != 0) - { - *((DWORD*)lpParam) = 1; - } - - errno = 20; - - return 0; -} - - -PALTEST(c_runtime_errno_test2_paltest_errno_test2, "c_runtime/errno/test2/paltest_errno_test2") -{ - DWORD dwThreadId, dwThrdParam = 0; - HANDLE hThread; - - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Set errno to a value within this thread */ - - errno = 50; - - hThread = CreateThread(NULL, 0, ThreadFunc_errno_test2, &dwThrdParam, 0, &dwThreadId); - - if (hThread == NULL) - { - Fail("ERROR: CreateThread failed to create a thread. " - "GetLastError() returned %d.\n",GetLastError()); - } - - WaitForSingleObject(hThread, INFINITE); - - /* This checks the result of calling the thread */ - if(dwThrdParam) - { - Fail("ERROR: errno was not set to 0 in the new thread. Each " - "thread should have its own value for errno.\n"); - } - - /* Check to make sure errno is still set to 50 */ - if(errno != 50) - { - Fail("ERROR: errno should be 50 in the main thread, even though " - "it was set to 20 in another thread. Currently it is %d.\n", - errno); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exit/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exit/test1/test1.cpp deleted file mode 100644 index 2bb42e356..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exit/test1/test1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Calls exit, and verifies that it actually stops program execution. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_exit_test1_paltest_exit_test1, "c_runtime/exit/test1/paltest_exit_test1") -{ - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /*should return 0*/ - exit(0); - - Fail ("Exit didn't actually stop execution.\n"); - - return FAIL; -} - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exit/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exit/test2/test2.cpp deleted file mode 100644 index 6125b3c38..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exit/test2/test2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test2.c -** -** Purpose: Calls exit on fail, and verifies that it actually -** stops program execution and return 1. - -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_exit_test2_paltest_exit_test2, "c_runtime/exit/test2/paltest_exit_test2") -{ - /* - * Initialize the PAL and return FAIL if this fails - */ - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /*should return 1*/ - exit(1); - -} - - - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exp/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exp/test1/test1.cpp deleted file mode 100644 index b3c8bb930..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/exp/test1/test1.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests exp with a normal set of values. -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * exp_test1_validate - * - * test validation function - */ -void __cdecl exp_test1_validate(double value, double expected, double variance) -{ - double result = exp(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("exp(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * exp_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl exp_test1_validate_isnan(double value) -{ - double result = exp(value); - - if (!_isnan(result)) - { - Fail("exp(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_exp_test1_paltest_exp_test1, "c_runtime/exp/test1/paltest_exp_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { PAL_NEGINF, 0, PAL_EPSILON }, - { -3.1415926535897932, 0.043213918263772250, PAL_EPSILON / 10 }, // value: -(pi) - { -2.7182818284590452, 0.065988035845312537, PAL_EPSILON / 10 }, // value: -(e) - { -2.3025850929940457, 0.1, PAL_EPSILON }, // value: -(ln(10)) - { -1.5707963267948966, 0.20787957635076191, PAL_EPSILON }, // value: -(pi / 2) - { -1.4426950408889634, 0.23629008834452270, PAL_EPSILON }, // value: -(log2(e)) - { -1.4142135623730950, 0.24311673443421421, PAL_EPSILON }, // value: -(sqrt(2)) - { -1.1283791670955126, 0.32355726390307110, PAL_EPSILON }, // value: -(2 / sqrt(pi)) - { -1, 0.36787944117144232, PAL_EPSILON }, // value: -(1) - { -0.78539816339744831, 0.45593812776599624, PAL_EPSILON }, // value: -(pi / 4) - { -0.70710678118654752, 0.49306869139523979, PAL_EPSILON }, // value: -(1 / sqrt(2)) - { -0.69314718055994531, 0.5, PAL_EPSILON }, // value: -(ln(2)) - { -0.63661977236758134, 0.52907780826773535, PAL_EPSILON }, // value: -(2 / pi) - { -0.43429448190325183, 0.64772148514180065, PAL_EPSILON }, // value: -(log10(e)) - { -0.31830988618379067, 0.72737734929521647, PAL_EPSILON }, // value: -(1 / pi) - { 0, 1, PAL_EPSILON * 10 }, - { 0.31830988618379067, 1.3748022274393586, PAL_EPSILON * 10 }, // value: 1 / pi - { 0.43429448190325183, 1.5438734439711811, PAL_EPSILON * 10 }, // value: log10(e) - { 0.63661977236758134, 1.8900811645722220, PAL_EPSILON * 10 }, // value: 2 / pi - { 0.69314718055994531, 2, PAL_EPSILON * 10 }, // value: ln(2) - { 0.70710678118654752, 2.0281149816474725, PAL_EPSILON * 10 }, // value: 1 / sqrt(2) - { 0.78539816339744831, 2.1932800507380155, PAL_EPSILON * 10 }, // value: pi / 4 - { 1, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 1.1283791670955126, 3.0906430223107976, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 4.1132503787829275, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 4.2320861065570819, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 4.8104773809653517, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 10, PAL_EPSILON * 100 }, // value: ln(10) - { 2.7182818284590452, 15.154262241479264, PAL_EPSILON * 100 }, // value: e - { 3.1415926535897932, 23.140692632779269, PAL_EPSILON * 100 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - exp_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - exp_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/expf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/expf/test1/test1.cpp deleted file mode 100644 index 72d417ff1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/expf/test1/test1.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests expf with a normal set of values. -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * expf_test1_validate - * - * test validation function - */ -void __cdecl expf_test1_validate(float value, float expected, float variance) -{ - float result = expf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("expf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * expf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl expf_test1_validate_isnan(float value) -{ - float result = expf(value); - - if (!_isnanf(result)) - { - Fail("expf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_expf_test1_paltest_expf_test1, "c_runtime/expf/test1/paltest_expf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { PAL_NEGINF, 0, PAL_EPSILON }, - { -3.14159265f, 0.0432139183f, PAL_EPSILON / 10 }, // value: -(pi) - { -2.71828183f, 0.0659880358f, PAL_EPSILON / 10 }, // value: -(e) - { -2.30258509f, 0.1f, PAL_EPSILON }, // value: -(ln(10)) - { -1.57079633f, 0.207879576f, PAL_EPSILON }, // value: -(pi / 2) - { -1.44269504f, 0.236290088f, PAL_EPSILON }, // value: -(logf2(e)) - { -1.41421356f, 0.243116734f, PAL_EPSILON }, // value: -(sqrtf(2)) - { -1.12837917f, 0.323557264f, PAL_EPSILON }, // value: -(2 / sqrtf(pi)) - { -1, 0.367879441f, PAL_EPSILON }, // value: -(1) - { -0.785398163f, 0.455938128f, PAL_EPSILON }, // value: -(pi / 4) - { -0.707106781f, 0.493068691f, PAL_EPSILON }, // value: -(1 / sqrtf(2)) - { -0.693147181f, 0.5f, PAL_EPSILON }, // value: -(ln(2)) - { -0.636619772f, 0.529077808f, PAL_EPSILON }, // value: -(2 / pi) - { -0.434294482f, 0.647721485f, PAL_EPSILON }, // value: -(log10f(e)) - { -0.318309886f, 0.727377349f, PAL_EPSILON }, // value: -(1 / pi) - { 0, 1, PAL_EPSILON * 10 }, - { 0.318309886f, 1.37480223f, PAL_EPSILON * 10 }, // value: 1 / pi - { 0.434294482f, 1.54387344f, PAL_EPSILON * 10 }, // value: log10f(e) - { 0.636619772f, 1.89008116f, PAL_EPSILON * 10 }, // value: 2 / pi - { 0.693147181f, 2, PAL_EPSILON * 10 }, // value: ln(2) - { 0.707106781f, 2.02811498f, PAL_EPSILON * 10 }, // value: 1 / sqrtf(2) - { 0.785398163f, 2.19328005f, PAL_EPSILON * 10 }, // value: pi / 4 - { 1, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 1.12837917f, 3.09064302f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 4.11325038f, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 4.23208611f, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 4.81047738f, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 10, PAL_EPSILON * 100 }, // value: ln(10) - { 2.71828183f, 15.1542622f, PAL_EPSILON * 100 }, // value: e - { 3.14159265f, 23.1406926f, PAL_EPSILON * 100 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - expf_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - expf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fabs/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fabs/test1/test1.cpp deleted file mode 100644 index f3997dea0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fabs/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that fabs return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * fabs_test1_validate - * - * test validation function - */ -void __cdecl fabs_test1_validate(double value, double expected, double variance) -{ - double result = fabs(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("fabs(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * fabs_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl fabs_test1_validate_isnan(double value) -{ - double result = fabs(value); - - if (!_isnan(result)) - { - Fail("fabs(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_fabs_test1_paltest_fabs_test1, "c_runtime/fabs/test1/paltest_fabs_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { PAL_NEGINF, PAL_POSINF, 0 }, - { -3.1415926535897932, 3.1415926535897932, PAL_EPSILON * 10 }, // value: -(pi) expected: pi - { -2.7182818284590452, 2.7182818284590452, PAL_EPSILON * 10 }, // value: -(e) expected: e - { -2.3025850929940457, 2.3025850929940457, PAL_EPSILON * 10 }, // value: -(ln(10)) expected: ln(10) - { -1.5707963267948966, 1.5707963267948966, PAL_EPSILON * 10 }, // value: -(pi / 2) expected: pi / 2 - { -1.4426950408889634, 1.4426950408889634, PAL_EPSILON * 10 }, // value: -(log2(e)) expected: log2(e) - { -1.4142135623730950, 1.4142135623730950, PAL_EPSILON * 10 }, // value: -(sqrt(2)) expected: sqrt(2) - { -1.1283791670955126, 1.1283791670955126, PAL_EPSILON * 10 }, // value: -(2 / sqrt(pi)) expected: 2 / sqrt(pi) - { -1, 1, PAL_EPSILON * 10 }, - { -0.78539816339744831, 0.78539816339744831, PAL_EPSILON }, // value: -(pi / 4) expected: pi / 4 - { -0.70710678118654752, 0.70710678118654752, PAL_EPSILON }, // value: -(1 / sqrt(2)) expected: 1 / sqrt(2) - { -0.69314718055994531, 0.69314718055994531, PAL_EPSILON }, // value: -(ln(2)) expected: ln(2) - { -0.63661977236758134, 0.63661977236758134, PAL_EPSILON }, // value: -(2 / pi) expected: 2 / pi - { -0.43429448190325183, 0.43429448190325183, PAL_EPSILON }, // value: -(log10(e)) expected: log10(e) - { -0.31830988618379067, 0.31830988618379067, PAL_EPSILON }, // value: -(1 / pi) expected: 1 / pi - { -0.0, 0, PAL_EPSILON }, - }; - - - // PAL initialization - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - fabs_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - fabs_test1_validate(-tests[i].value, tests[i].expected, tests[i].variance); - } - - fabs_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fabsf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fabsf/test1/test1.cpp deleted file mode 100644 index 68481ca97..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fabsf/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that fabsf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * fabsf_test1_validate - * - * test validation function - */ -void __cdecl fabsf_test1_validate(float value, float expected, float variance) -{ - float result = fabsf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("fabsf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * fabsf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl fabsf_test1_validate_isnan(float value) -{ - float result = fabsf(value); - - if (!_isnan(result)) - { - Fail("fabsf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_fabsf_test1_paltest_fabsf_test1, "c_runtime/fabsf/test1/paltest_fabsf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { PAL_NEGINF, PAL_POSINF, 0 }, - { -3.14159265f, 3.14159265f, PAL_EPSILON * 10 }, // value: -(pi) expected: pi - { -2.71828183f, 2.71828183f, PAL_EPSILON * 10 }, // value: -(e) expected: e - { -2.30258509f, 2.30258509f, PAL_EPSILON * 10 }, // value: -(ln(10)) expected: ln(10) - { -1.57079633f, 1.57079633f, PAL_EPSILON * 10 }, // value: -(pi / 2) expected: pi / 2 - { -1.44269504f, 1.44269504f, PAL_EPSILON * 10 }, // value: -(log2(e)) expected: log2(e) - { -1.41421356f, 1.41421356f, PAL_EPSILON * 10 }, // value: -(sqrt(2)) expected: sqrt(2) - { -1.12837917f, 1.12837917f, PAL_EPSILON * 10 }, // value: -(2 / sqrt(pi)) expected: 2 / sqrt(pi) - { -1, 1, PAL_EPSILON * 10 }, - { -0.785398163f, 0.785398163f, PAL_EPSILON }, // value: -(pi / 4) expected: pi / 4 - { -0.707106781f, 0.707106781f, PAL_EPSILON }, // value: -(1 / sqrt(2)) expected: 1 / sqrt(2) - { -0.693147181f, 0.693147181f, PAL_EPSILON }, // value: -(ln(2)) expected: ln(2) - { -0.636619772f, 0.636619772f, PAL_EPSILON }, // value: -(2 / pi) expected: 2 / pi - { -0.434294482f, 0.434294482f, PAL_EPSILON }, // value: -(log10(e)) expected: log10(e) - { -0.318309886f, 0.318309886f, PAL_EPSILON }, // value: -(1 / pi) expected: 1 / pi - { -0.0f, 0, PAL_EPSILON }, - }; - - - // PAL initialization - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - fabsf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - fabsf_test1_validate(-tests[i].value, tests[i].expected, tests[i].variance); - } - - fabsf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test1/test1.cpp deleted file mode 100644 index 5863d51d0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test1/test1.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests the PAL implementation of the ferror function. -** -** Depends: -** fopen -** fread -** fclose -** -** -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_ferror_test1_paltest_ferror_test1, "c_runtime/ferror/test1/paltest_ferror_test1") -{ - const char filename[] = "testfile"; - char buffer[128]; - FILE * fp = NULL; - int result; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* Open a file in READ mode */ - - if((fp = fopen(filename, "r")) == NULL) - { - Fail("Unable to open a file for reading. Is the file " - "in the directory? It should be."); - } - - /* Read 10 characters from the file. The file has 15 - characters in it. - */ - - if((result = fread(buffer,1,10,fp)) == 0) - { - Fail("ERROR: Zero characters read from the file. It should have " - "read 10 character in from a 15 character file."); - } - - if(ferror(fp) != 0) - { - Fail("ERROR: ferror returned a value not equal to 0. The read " - "operation shouldn't have caused an error, and ferror should " - "return 0 still."); - } - - /* - Close the open file and end the test. - */ - - if(fclose(fp) != 0) - { - Fail("ERROR: fclose failed when trying to close a file pointer. " - "This test depends on fclose working properly."); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test1/testfile b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test1/testfile deleted file mode 100644 index 273c1a9ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test1/testfile +++ /dev/null @@ -1 +0,0 @@ -This is a test. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test2/test2.cpp deleted file mode 100644 index 3ac444b0e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test2/test2.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Open a read-only file and attempt to write some data to it. -** Check to ensure that an ferror occurs. -** -** Depends: -** fopen -** fwrite -** fclose -** -** -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_ferror_test2_paltest_ferror_test2, "c_runtime/ferror/test2/paltest_ferror_test2") -{ - const char filename[] = "testfile"; - FILE * fp = NULL; - int result; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Open a file in READONLY mode */ - - if((fp = fopen(filename, "r")) == NULL) - { - Fail("Unable to open a file for reading."); - } - - /* Attempt to write 14 characters to the file. */ - - if((result = fwrite("This is a test",1,14,fp)) != 0) - { - Fail("ERROR: %d characters written. 0 characters should " - "have been written, since this file is read-only.", result); - } - - if(ferror(fp) == 0) - { - Fail("ERROR: ferror should have generated an error when " - "write was called on a read-only file. But, it " - "retured 0, indicating no error.\n"); - } - - /* Close the file. */ - - if(fclose(fp) != 0) - { - Fail("ERROR: fclose failed when trying to close a file pointer. " - "This test depends on fclose working properly."); - } - - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test2/testfile b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test2/testfile deleted file mode 100644 index 0135842a0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ferror/test2/testfile +++ /dev/null @@ -1 +0,0 @@ -This is a test file. This needs to be kept in CVS. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fflush/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fflush/test1/test1.cpp deleted file mode 100644 index 716a151b5..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fflush/test1/test1.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests to see that fflush is working properly. Flushes a couple -** buffers and checks the return value. Can't figure out a way to test -** and ensure it is really dropping the buffers, since the system -** does this automatically most of the time ... -** -** -**==========================================================================*/ - -/* This function is really tough to test. Right now it just tests - a bunch of return values. No solid way to ensure that it is really - flushing a buffer or not -- might have to be a manual test someday. -*/ - -#include - - -PALTEST(c_runtime_fflush_test1_paltest_fflush_test1, "c_runtime/fflush/test1/paltest_fflush_test1") -{ - - int TheReturn; - FILE* TheFile; - FILE* AnotherFile = NULL; - - PAL_Initialize(argc,argv); - - TheFile = fopen("theFile","w+"); - - if(TheFile == NULL) - { - Fail("ERROR: fopen failed. Test depends on this function."); - } - - TheReturn = fwrite("foo",3,3,TheFile); - - if(TheReturn != 3) - { - Fail("ERROR: fwrite failed. Test depends on this function."); - } - - /* Test to see that FlushFileBuffers returns a success value */ - TheReturn = fflush(TheFile); - - if(TheReturn != 0) - { - Fail("ERROR: The fflush function returned non-zero, which " - "indicates failure, when trying to flush a buffer."); - } - - /* Test to see that FlushFileBuffers returns a success value */ - TheReturn = fflush(NULL); - - if(TheReturn != 0) - { - Fail("ERROR: The fflush function returned non-zero, which " - "indicates failure, when trying to flush all buffers."); - } - - /* Test to see that FlushFileBuffers returns a success value */ - TheReturn = fflush(AnotherFile); - - if(TheReturn != 0) - { - Fail("ERROR: The fflush function returned non-zero, which " - "indicates failure, when trying to flush a stream not " - "associated with a file."); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test1/test1.cpp deleted file mode 100644 index e16c9e2ad..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test1/test1.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Writes a simple file and calls fgets() to get a string shorter -** than the first line of the file. Verifies that the correct -** string is returned. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_fgets_test1_paltest_fgets_test1, "c_runtime/fgets/test1/paltest_fgets_test1") -{ - const char outBuf1[] = "This is a test.\n"; - const char outBuf2[] = "This is too."; - char inBuf[sizeof(outBuf1) + sizeof(outBuf2)]; - const char filename[] = "testfile.tmp"; - const int offset = 5; /* value chosen arbitrarily */ - int actualLen; - int expectedLen; - FILE * fp; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /*write the file that we will use to test */ - fp = fopen(filename, "w"); - if (fp == NULL) - { - Fail("Unable to open file for write.\n"); - } - - fwrite(outBuf1, sizeof(outBuf1[0]), sizeof(outBuf1), fp); - fwrite(outBuf2, sizeof(outBuf2[0]), sizeof(outBuf2), fp); - - if (fclose(fp) != 0) - { - Fail("Error closing a file opened for write.\n"); - } - - - /*now read back the entire first string*/ - fp = fopen(filename, "r"); - if (fp == NULL) - { - Fail("Unable to open file for read.\n"); - } - - /*note: +1 because strlen() returns the length of a string _not_ - including the NULL, while fgets() returns a string of specified - maximum length _including_ the NULL.*/ - if (fgets(inBuf, strlen(outBuf1) - offset + 1, fp) != inBuf) - { - Fail("Error reading from file using fgets.\n"); - } - - - expectedLen = strlen(outBuf1) - offset; - actualLen = strlen(inBuf); - - if (actualLen < expectedLen) - { - Fail("fgets() was asked to read a one-line string and given the " - "length of the string as a parameter. The string it has " - "read is too short.\n"); - } - if (actualLen > expectedLen) - { - Fail("fgets() was asked to read a one-line string and given the " - "length of the string as a parameter. The string it has " - "read is too long.\n"); - } - if (memcmp(inBuf, outBuf1, actualLen) != 0) - { - /*We didn't read back exactly outBuf1*/ - Fail("fgets() was asked to read a one-line string, and given the " - "length of the string as an parameter. It has returned a " - "string of the correct length, but the contents are not " - "correct.\n"); - } - - if (fclose(fp) != 0) - { - Fail("Error closing file after using fgets().\n"); - } - - - PAL_Terminate(); - return PASS; - -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test2/test2.cpp deleted file mode 100644 index 7f21d0758..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test2/test2.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test2.c -** -** Purpose: Calls fgets to read a full line from a file. A maximum length -** parameter greater than the length of the line is passed. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_fgets_test2_paltest_fgets_test2, "c_runtime/fgets/test2/paltest_fgets_test2") -{ - const char outBuf1[] = "This is a test.\n"; - const char outBuf2[] = "This is too."; - - char inBuf[sizeof(outBuf1) + sizeof(outBuf2)]; - const char filename[] = "testfile.tmp"; - const int offset = 5; /*value chosen arbitrarily*/ - int expectedLen; - int actualLen; - - FILE * fp; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /*write the file that we will use to test */ - fp = fopen(filename, "w"); - if (fp == NULL) - { - Fail("Unable to open file for write.\n"); - } - - fwrite(outBuf1, sizeof(outBuf1[0]), sizeof(outBuf1), fp); - fwrite(outBuf2, sizeof(outBuf2[0]), sizeof(outBuf2), fp); - - if (fclose(fp) != 0) - { - Fail("error closing stream opened for write.\n"); - } - - /*Read until the first linebreak*/ - fp = fopen(filename, "r"); - if (fp == NULL) - { - Fail("Unable to open file for read.\n"); - } - - - if (fgets(inBuf, sizeof(outBuf1) + offset , fp) != inBuf) - { - Fail("Error reading from file using fgets.\n"); - } - - /*note: -1 because strlen returns the length of a string _not_ - including the NULL, while fgets returns a string of specified - maximum length _including_ the NULL.*/ - expectedLen = strlen(outBuf1); - actualLen = strlen(inBuf); - if (actualLen > expectedLen) - { - Fail("fgets() was asked to read the first line of a file, but did " - "not stop at the end of the line.\n"); - } - else if (actualLen < expectedLen) - { - Fail("fgets() was asked to read the first line of a file, but did " - "not read the entire line.\n"); - } - else if (memcmp(inBuf, outBuf1, actualLen) != 0) - { - /*We didn't read back exactly outBuf1*/ - Fail("fgets() was asked to read the first line of a file. It " - "has read back a string of the correct length, but the" - " contents are not correct.\n"); - } - - if (fclose(fp) != 0) - { - Fail("Error closing file after using fgets().\n"); - } - - PAL_Terminate(); - return PASS; - -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test3/test3.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test3/test3.cpp deleted file mode 100644 index f46b179de..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fgets/test3/test3.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test3.c -** -** Purpose: Tries to read from an empty file using fgets(), to verify -** handling of EOF condition. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_fgets_test3_paltest_fgets_test3, "c_runtime/fgets/test3/paltest_fgets_test3") -{ - char inBuf[10]; - const char filename[] = "testfile.tmp"; - - FILE * fp; - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /*write the empty file that we will use to test */ - fp = fopen(filename, "w"); - if (fp == NULL) - { - Fail("Unable to open file for write.\n"); - } - - /*Don't write anything*/ - - if (fclose(fp) != 0) - { - Fail("Error closing stream opened for write.\n"); - } - - - /*Open the file and try to read.*/ - fp = fopen(filename, "r"); - if (fp == NULL) - { - Fail("Unable to open file for read.\n"); - } - - - if (fgets(inBuf, sizeof(inBuf) , fp) != NULL) - { - /*NULL could also mean an error condition, but since the PAL - doesn't supply feof or ferror, we can't distinguish between - the two.*/ - Fail("fgets doesn't handle EOF properly. When asked to read from " - "an empty file, it didn't return NULL as it should have.\n"); - } - - if (fclose(fp) != 0) - { - Fail("Error closing an empty file after trying to use fgets().\n"); - } - PAL_Terminate(); - return PASS; - -} - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/floor/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/floor/test1/test1.cpp deleted file mode 100644 index 549a2d83a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/floor/test1/test1.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests floor with simple positive and negative values. Also tests -** extreme cases like extremely small values and positive and -** negative infinity. Makes sure that calling floor on NaN returns -** NaN -** -**==========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * floor_test1_validate - * - * test validation function - */ -void __cdecl floor_test1_validate(double value, double expected, double variance) -{ - double result = floor(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("floor(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * floor_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl floor_test1_validate_isnan(double value) -{ - double result = floor(value); - - if (!_isnan(result)) - { - Fail("floor(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_floor_test1_paltest_floor_test1, "c_runtime/floor/test1/paltest_floor_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.31830988618379067, 0, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0, PAL_EPSILON }, // value: pi / 4 - { 1.1283791670955126, 1, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 1, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 1, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 1, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 2, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 2, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 3, PAL_EPSILON * 10 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - floor_test1_validate( 0, 0, PAL_EPSILON); - floor_test1_validate(-0.0, 0, PAL_EPSILON); - - floor_test1_validate( 1, 1, PAL_EPSILON * 10); - floor_test1_validate(-1.0, -1, PAL_EPSILON * 10); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - floor_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - floor_test1_validate(-tests[i].value, -(tests[i].expected + 1), tests[i].variance); - } - - floor_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/floorf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/floorf/test1/test1.cpp deleted file mode 100644 index b80320c7d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/floorf/test1/test1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests floorf with simple positive and negative values. Also tests -** extreme cases like extremely small values and positive and -** negative infinity. Makes sure that calling floorf on NaN returns -** NaN -** -**==========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * floorf_test1_validate - * - * test validation function - */ -void __cdecl floorf_test1_validate(float value, float expected, float variance) -{ - float result = floorf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("floorf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * floorf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl floorf_test1_validate_isnan(float value) -{ - float result = floorf(value); - - if (!_isnanf(result)) - { - Fail("floorf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_floorf_test1_paltest_floorf_test1, "c_runtime/floorf/test1/paltest_floorf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.318309886f, 0, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0, PAL_EPSILON }, // value: pi / 4 - { 1.12837917f, 1, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 1, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 1, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 1, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 2, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 2, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 3, PAL_EPSILON * 10 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - floorf_test1_validate( 0, 0, PAL_EPSILON); - floorf_test1_validate(-0.0f, 0, PAL_EPSILON); - - floorf_test1_validate( 1, 1, PAL_EPSILON * 10); - floorf_test1_validate(-1.0f, -1, PAL_EPSILON * 10); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - floorf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - floorf_test1_validate(-tests[i].value, -(tests[i].expected + 1), tests[i].variance); - } - - floorf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fma/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fma/test1/test1.cpp deleted file mode 100644 index a82adc4b6..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fma/test1/test1.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that fma returns correct values for a subset of values. -** Tests with positive and negative values of x, y, and z to ensure -** fmaf is returning correct results. -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double x; /* first component of the value to test the function with */ - double y; /* second component of the value to test the function with */ - double z; /* third component of the value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * fma_test1_validate - * - * test validation function - */ -void __cdecl fma_test1_validate(double x, double y, double z, double expected, double variance) -{ - double result = fma(x, y, z); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("fma(%g, %g, %g) returned %20.17g when it should have returned %20.17g", - x, y, z, result, expected); - } -} - -/** - * fma_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl fma_test1_validate_isnan(double x, double y, double z) -{ - double result = fma(x, y, z); - - if (!_isnan(result)) - { - Fail("fma(%g, %g, %g) returned %20.17g when it should have returned %20.17g", - x, y, z, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_fma_test1_paltest_fma_test1, "c_runtime/fma/test1/paltest_fma_test1") -{ - struct test tests[] = - { - /* x y z expected variance */ - { PAL_NEGINF, PAL_NEGINF, PAL_NEGINF, PAL_NEGINF, 0 }, - { -1e308, 2, 1e308, -1e308, 0 }, - { 1e308, 2, -1e308, 1e308, 0 }, - { PAL_POSINF, PAL_POSINF, PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - fma_test1_validate(tests[i].x, tests[i].y, tests[i].z, tests[i].expected, tests[i].variance); - } - - // Returns NaN if x or y is infinite, the other is zero, and z is NaN - fma_test1_validate_isnan(PAL_NEGINF, 0, PAL_NAN); - fma_test1_validate_isnan(PAL_POSINF, 0, PAL_NAN); - fma_test1_validate_isnan(0, PAL_NEGINF, PAL_NAN); - fma_test1_validate_isnan(0, PAL_POSINF, PAL_NAN); - - // Returns NaN if x or y is infinite, the other is zero, and z is not-NaN - fma_test1_validate_isnan(PAL_POSINF, 0, PAL_NEGINF); - fma_test1_validate_isnan(PAL_NEGINF, 0, PAL_NEGINF); - fma_test1_validate_isnan(0, PAL_POSINF, PAL_NEGINF); - fma_test1_validate_isnan(0, PAL_NEGINF, PAL_NEGINF); - - fma_test1_validate_isnan(PAL_POSINF, 0, 0); - fma_test1_validate_isnan(PAL_NEGINF, 0, 0); - fma_test1_validate_isnan(0, PAL_POSINF, 0); - fma_test1_validate_isnan(0, PAL_NEGINF, 0); - - fma_test1_validate_isnan(PAL_POSINF, 0, PAL_POSINF); - fma_test1_validate_isnan(PAL_NEGINF, 0, PAL_POSINF); - fma_test1_validate_isnan(0, PAL_POSINF, PAL_POSINF); - fma_test1_validate_isnan(0, PAL_NEGINF, PAL_POSINF); - - // Returns NaN if (x * y) is infinite, and z is an infinite of the opposite sign - fma_test1_validate_isnan(PAL_POSINF, PAL_POSINF, PAL_NEGINF); - fma_test1_validate_isnan(PAL_NEGINF, PAL_NEGINF, PAL_NEGINF); - fma_test1_validate_isnan(PAL_POSINF, PAL_NEGINF, PAL_POSINF); - fma_test1_validate_isnan(PAL_NEGINF, PAL_POSINF, PAL_POSINF); - - fma_test1_validate_isnan(PAL_POSINF, 1, PAL_NEGINF); - fma_test1_validate_isnan(PAL_NEGINF, 1, PAL_POSINF); - fma_test1_validate_isnan(1, PAL_POSINF, PAL_NEGINF); - fma_test1_validate_isnan(1, PAL_NEGINF, PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmaf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmaf/test1/test1.cpp deleted file mode 100644 index 10015a585..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmaf/test1/test1.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that fmaf returns correct values for a subset of values. -** Tests with positive and negative values of x, y, and z to ensure -** fmaf is returning correct results. -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float x; /* first component of the value to test the function with */ - float y; /* second component of the value to test the function with */ - float z; /* third component of the value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * fmaf_test1_validate - * - * test validation function - */ -void __cdecl fmaf_test1_validate(float x, float y, float z, float expected, float variance) -{ - float result = fmaf(x, y, z); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("fmaf(%g, %g, %g) returned %10.9g when it should have returned %10.9g", - x, y, z, result, expected); - } -} - -/** - * fmaf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl fmaf_test1_validate_isnan(float x, float y, float z) -{ - float result = fmaf(x, y, z); - - if (!_isnanf(result)) - { - Fail("fmaf(%g, %g, %g) returned %10.9g when it should have returned %10.9g", - x, y, z, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_fmaf_test1_paltest_fmaf_test1, "c_runtime/fmaf/test1/paltest_fmaf_test1") -{ - struct test tests[] = - { - /* x y z expected variance */ - { PAL_NEGINF, PAL_NEGINF, PAL_NEGINF, PAL_NEGINF, 0 }, - { -1e38, 2, 1e38, -1e38, 0 }, - { 1e38, 2, -1e38, 1e38, 0 }, - { PAL_POSINF, PAL_POSINF, PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - fmaf_test1_validate(tests[i].x, tests[i].y, tests[i].z, tests[i].expected, tests[i].variance); - } - - // Returns NaN if x or y is infinite, the other is zero, and z is NaN - fmaf_test1_validate_isnan(PAL_NEGINF, 0, PAL_NAN); - fmaf_test1_validate_isnan(PAL_POSINF, 0, PAL_NAN); - fmaf_test1_validate_isnan(0, PAL_NEGINF, PAL_NAN); - fmaf_test1_validate_isnan(0, PAL_POSINF, PAL_NAN); - - // Returns NaN if x or y is infinite, the other is zero, and z is not-NaN - fmaf_test1_validate_isnan(PAL_POSINF, 0, PAL_NEGINF); - fmaf_test1_validate_isnan(PAL_NEGINF, 0, PAL_NEGINF); - fmaf_test1_validate_isnan(0, PAL_POSINF, PAL_NEGINF); - fmaf_test1_validate_isnan(0, PAL_NEGINF, PAL_NEGINF); - - fmaf_test1_validate_isnan(PAL_POSINF, 0, 0); - fmaf_test1_validate_isnan(PAL_NEGINF, 0, 0); - fmaf_test1_validate_isnan(0, PAL_POSINF, 0); - fmaf_test1_validate_isnan(0, PAL_NEGINF, 0); - - fmaf_test1_validate_isnan(PAL_POSINF, 0, PAL_POSINF); - fmaf_test1_validate_isnan(PAL_NEGINF, 0, PAL_POSINF); - fmaf_test1_validate_isnan(0, PAL_POSINF, PAL_POSINF); - fmaf_test1_validate_isnan(0, PAL_NEGINF, PAL_POSINF); - - // Returns NaN if (x * y) is infinite, and z is an infinite of the opposite sign - fmaf_test1_validate_isnan(PAL_POSINF, PAL_POSINF, PAL_NEGINF); - fmaf_test1_validate_isnan(PAL_NEGINF, PAL_NEGINF, PAL_NEGINF); - fmaf_test1_validate_isnan(PAL_POSINF, PAL_NEGINF, PAL_POSINF); - fmaf_test1_validate_isnan(PAL_NEGINF, PAL_POSINF, PAL_POSINF); - - fmaf_test1_validate_isnan(PAL_POSINF, 1, PAL_NEGINF); - fmaf_test1_validate_isnan(PAL_NEGINF, 1, PAL_POSINF); - fmaf_test1_validate_isnan(1, PAL_POSINF, PAL_NEGINF); - fmaf_test1_validate_isnan(1, PAL_NEGINF, PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmod/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmod/test1/test1.cpp deleted file mode 100644 index d02b09d0e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmod/test1/test1.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that fmod return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double numerator; /* second component of the value to test the function with */ - double denominator; /* first component of the value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * fmod_test1_validate - * - * test validation function - */ -void __cdecl fmod_test1_validate(double numerator, double denominator, double expected, double variance) -{ - double result = fmod(numerator, denominator); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("fmod(%g, %g) returned %20.17g when it should have returned %20.17g", - numerator, denominator, result, expected); - } -} - -/** - * fmod_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl fmod_test1_validate_isnan(double numerator, double denominator) -{ - double result = fmod(numerator, denominator); - - if (!_isnan(result)) - { - Fail("fmod(%g, %g) returned %20.17g when it should have returned %20.17g", - numerator, denominator, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_fmod_test1_paltest_fmod_test1, "c_runtime/fmod/test1/paltest_fmod_test1") -{ - struct test tests[] = - { - /* numerator denominator expected variance */ - { 0, PAL_POSINF, 0, PAL_EPSILON }, - { 0.31296179620778659, 0.94976571538163866, 0.31296179620778658, PAL_EPSILON }, - { 0.42077048331375735, 0.90716712923909839, 0.42077048331375733, PAL_EPSILON }, - { 0.59448076852482208, 0.80410982822879171, 0.59448076852482212, PAL_EPSILON }, - { 0.63896127631363480, 0.76923890136397213, 0.63896127631363475, PAL_EPSILON }, - { 0.64963693908006244, 0.76024459707563015, 0.64963693908006248, PAL_EPSILON }, - { 0.70710678118654752, 0.70710678118654752, 0, PAL_EPSILON }, - { 1, 1, 0, PAL_EPSILON }, - { 0.84147098480789651, 0.54030230586813972, 0.30116867893975674, PAL_EPSILON }, - { 0.90371945743584630, 0.42812514788535792, 0.047469161665130377, PAL_EPSILON / 10 }, - { 0.98776594599273553, 0.15594369476537447, 0.052103777400488605, PAL_EPSILON / 10 }, - { 0.99180624439366372, 0.12775121753523991, 0.097547721646984359, PAL_EPSILON / 10 }, - { 0.74398033695749319, -0.66820151019031295, 0.075778826767180285, PAL_EPSILON / 10 }, - { 0.41078129050290870, -0.91173391478696510, 0.41078129050290868, PAL_EPSILON }, - { 0, -1, 0, PAL_EPSILON }, - { 1, PAL_POSINF, 1, PAL_EPSILON * 10 }, - }; - - - // PAL initialization - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - fmod_test1_validate( tests[i].numerator, tests[i].denominator, tests[i].expected, tests[i].variance); - fmod_test1_validate(-tests[i].numerator, tests[i].denominator, -tests[i].expected, tests[i].variance); - fmod_test1_validate( tests[i].numerator, -tests[i].denominator, tests[i].expected, tests[i].variance); - fmod_test1_validate(-tests[i].numerator, -tests[i].denominator, -tests[i].expected, tests[i].variance); - } - - fmod_test1_validate_isnan( 0, 0); - fmod_test1_validate_isnan(-0.0, 0); - fmod_test1_validate_isnan( 0, -0.0); - fmod_test1_validate_isnan(-0.0, -0.0); - - fmod_test1_validate_isnan( 1, 0); - fmod_test1_validate_isnan(-1.0, 0); - fmod_test1_validate_isnan( 1, -0.0); - fmod_test1_validate_isnan(-1.0, -0.0); - - fmod_test1_validate_isnan(PAL_POSINF, PAL_POSINF); - fmod_test1_validate_isnan(PAL_NEGINF, PAL_POSINF); - fmod_test1_validate_isnan(PAL_POSINF, PAL_NEGINF); - fmod_test1_validate_isnan(PAL_NEGINF, PAL_NEGINF); - - fmod_test1_validate_isnan(PAL_POSINF, 0); - fmod_test1_validate_isnan(PAL_NEGINF, 0); - fmod_test1_validate_isnan(PAL_POSINF, -0.0); - fmod_test1_validate_isnan(PAL_NEGINF, -0.0); - - fmod_test1_validate_isnan(PAL_POSINF, 1); - fmod_test1_validate_isnan(PAL_NEGINF, 1); - fmod_test1_validate_isnan(PAL_POSINF, -1.0); - fmod_test1_validate_isnan(PAL_NEGINF, -1.0); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmodf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmodf/test1/test1.cpp deleted file mode 100644 index b73f7824f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fmodf/test1/test1.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that fmodf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabsf -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - float numerator; /* second component of the value to test the function with */ - float denominator; /* first component of the value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * fmodf_test1_validate - * - * test validation function - */ -void __cdecl fmodf_test1_validate(float numerator, float denominator, float expected, float variance) -{ - float result = fmodf(numerator, denominator); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("fmodf(%g, %g) returned %10.9g when it should have returned %10.9g", - numerator, denominator, result, expected); - } -} - -/** - * fmodf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl fmodf_test1_validate_isnan(float numerator, float denominator) -{ - float result = fmodf(numerator, denominator); - - if (!_isnan(result)) - { - Fail("fmodf(%g, %g) returned %10.9g when it should have returned %10.9g", - numerator, denominator, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_fmodf_test1_paltest_fmodf_test1, "c_runtime/fmodf/test1/paltest_fmodf_test1") -{ - struct test tests[] = - { - /* numerator denominator expected variance */ - { 0, PAL_POSINF, 0, PAL_EPSILON }, - { 0.312961796f, 0.949765715f, 0.312961796f, PAL_EPSILON }, - { 0.420770483f, 0.907167129f, 0.420770483f, PAL_EPSILON }, - { 0.594480769f, 0.804109828f, 0.594480769f, PAL_EPSILON }, - { 0.638961276f, 0.769238901f, 0.638961276f, PAL_EPSILON }, - { 0.649636939f, 0.760244597f, 0.649636939f, PAL_EPSILON }, - { 0.707106781f, 0.707106781f, 0, PAL_EPSILON }, - { 1, 1, 0, PAL_EPSILON }, - { 0.841470985f, 0.540302306f, 0.301168679f, PAL_EPSILON }, - { 0.903719457f, 0.428125148f, 0.0474691617f, PAL_EPSILON / 10 }, - { 0.987765946f, 0.155943695f, 0.0521037774f, PAL_EPSILON / 10 }, - { 0.991806244f, 0.127751218f, 0.0975477216f, PAL_EPSILON / 10 }, - { 0.743980337f, -0.668201510f, 0.0757788268f, PAL_EPSILON / 10 }, - { 0.410781291f, -0.911733915f, 0.410781291f, PAL_EPSILON }, - { 0, -1, 0, PAL_EPSILON }, - { 1, PAL_POSINF, 1, PAL_EPSILON * 10 }, - }; - - - // PAL initialization - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - fmodf_test1_validate( tests[i].numerator, tests[i].denominator, tests[i].expected, tests[i].variance); - fmodf_test1_validate(-tests[i].numerator, tests[i].denominator, -tests[i].expected, tests[i].variance); - fmodf_test1_validate( tests[i].numerator, -tests[i].denominator, tests[i].expected, tests[i].variance); - fmodf_test1_validate(-tests[i].numerator, -tests[i].denominator, -tests[i].expected, tests[i].variance); - } - - fmodf_test1_validate_isnan( 0, 0); - fmodf_test1_validate_isnan(-0.0f, 0); - fmodf_test1_validate_isnan( 0, -0.0f); - fmodf_test1_validate_isnan(-0.0f, -0.0f); - - fmodf_test1_validate_isnan( 1, 0); - fmodf_test1_validate_isnan(-1, 0); - fmodf_test1_validate_isnan( 1, -0.0f); - fmodf_test1_validate_isnan(-1, -0.0f); - - fmodf_test1_validate_isnan(PAL_POSINF, PAL_POSINF); - fmodf_test1_validate_isnan(PAL_NEGINF, PAL_POSINF); - fmodf_test1_validate_isnan(PAL_POSINF, PAL_NEGINF); - fmodf_test1_validate_isnan(PAL_NEGINF, PAL_NEGINF); - - fmodf_test1_validate_isnan(PAL_POSINF, 0); - fmodf_test1_validate_isnan(PAL_NEGINF, 0); - fmodf_test1_validate_isnan(PAL_POSINF, -0.0f); - fmodf_test1_validate_isnan(PAL_NEGINF, -0.0f); - - fmodf_test1_validate_isnan(PAL_POSINF, 1); - fmodf_test1_validate_isnan(PAL_NEGINF, 1); - fmodf_test1_validate_isnan(PAL_POSINF, -1); - fmodf_test1_validate_isnan(PAL_NEGINF, -1); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test1/test1.cpp deleted file mode 100644 index abbc328d5..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test1/test1.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** This test simply attempts to open a number of files -** with different modes. It checks to ensure a valid -** file pointer is returned. It doesn't do any checking -** to ensure the mode is really what it claims. And checks -** for a NULL pointer when attempts to open a directory. -** - -** -**===================================================================*/ - -#include - -struct testCase -{ - int CorrectResult; - char mode[20]; -}; - -PALTEST(c_runtime_fopen_test1_paltest_fopen_test1, "c_runtime/fopen/test1/paltest_fopen_test1") -{ - - FILE *fp; - char name[128]; - int i; - - struct testCase testCases[] = - { - {0, "r"}, {1, "w"}, {1, "a"}, - {0, "r+"}, {1, "w+"}, {1, "a+"}, - {1, "wt"}, {1, "wb"}, {1, "wS"}, - {1, "w+c"}, {1, "w+n"}, {1, "wR"}, - {1, "wT"}, {0, "tw"} - }; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - - for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) - { - strcpy(name,"testfiles"); - strcat(name,testCases[i].mode); - - fp = fopen(name,testCases[i].mode); - - if ((fp == 0 && testCases[i].CorrectResult != 0) || - (testCases[i].CorrectResult == 0 && fp != 0) ) - { - Fail("ERROR: fopen returned incorrectly " - "opening a file in %s mode. Perhaps it opened a " - "read only file which didn't exist and returned a correct " - "pointer?",testCases[i].mode); - } - - memset(name, '\0', 128); - - } - - /* When attempt to open a directory fopen should returned NULL */ - if ( fopen(".", "r") != NULL) - { - Fail("ERROR: fopen returned non-NULL when trying to open a directory" - " the returned value was %d\n", fp); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test2/test2.cpp deleted file mode 100644 index b588c41fd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test2/test2.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** Test to ensure that you can write to a 'w' mode file. -** And that you can't read from a 'w' mode file. -** -** Depends: -** fprintf -** fseek -** fgets -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fopen_test2_paltest_fopen_test2, "c_runtime/fopen/test2/paltest_fopen_test2") -{ - - FILE *fp; - char buffer[128]; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - if( (fp = fopen( "testfile", "w" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'w' mode.\n" ); - } - - /* Test that you can write */ - if(fprintf(fp,"%s","some text") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'w' mode " - "but fprintf failed. Either fopen or fprintf have problems."); - } - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Test that you can't read */ - if(fgets(buffer,10,fp) != NULL) - { - Fail("ERROR: Tried to READ from a file with only 'w' mode set. " - "This should fail, but fgets didn't return NULL. Either " - "fgets or fopen is broken."); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test3/test3.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test3/test3.cpp deleted file mode 100644 index 3be80f161..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test3/test3.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test3.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** Test to ensure that you can write to a 'w+' mode file. -** And that you can read from a 'w+' mode file. -** -** Depends: -** fprintf -** fseek -** fgets -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fopen_test3_paltest_fopen_test3, "c_runtime/fopen/test3/paltest_fopen_test3") -{ - - FILE *fp; - char buffer[128]; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* Open a file with 'w+' mode */ - if( (fp = fopen( "testfile", "w+" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'w+' mode.\n" ); - } - - /* Write some text to the file */ - if(fprintf(fp,"%s","some text") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'w+' mode " - "but fprintf failed. Either fopen or fprintf have problems."); - } - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Attempt to read from the 'w+' only file, should pass */ - if(fgets(buffer,10,fp) == NULL) - { - Fail("ERROR: Tried to READ from a file with 'w+' mode set. " - "This should succeed, but fgets returned NULL. Either fgets " - "or fopen is broken."); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test4/test4.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test4/test4.cpp deleted file mode 100644 index 24f8bfa11..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test4/test4.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test4.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** Test to ensure that you can't write to a 'r' mode file. -** And that you can read from a 'r' mode file. -** -** Depends: -** fprintf -** fclose -** fgets -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fopen_test4_paltest_fopen_test4, "c_runtime/fopen/test4/paltest_fopen_test4") -{ - - FILE *fp; - char buffer[128]; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* Open a file with 'w' mode */ - if( (fp = fopen( "testfile", "w" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'w' mode.\n" ); - } - - /* Write some text to the file */ - if(fprintf(fp,"%s","some text") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'w' mode " - "but fprintf failed. Either fopen or fprintf have problems."); - } - - if(fclose(fp)) - { - Fail("ERROR: Attempted to close a file, but fclose failed. " - "This test depends upon it."); - } - - /* Open a file with 'r' mode */ - if( (fp = fopen( "testfile", "r" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'r' mode.\n" ); - } - - /* Attempt to read from the 'r' only file, should pass */ - if(fgets(buffer,10,fp) == NULL) - { - Fail("ERROR: Tried to READ from a file with 'r' mode set. " - "This should succeed, but fgets returned NULL. Either fgets " - "or fopen is broken."); - } - - /* Write some text to the file */ - if(fprintf(fp,"%s","some text") > 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'r' mode " - "but fprintf succeeded It should have failed. " - "Either fopen or fprintf have problems."); - } - - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test5/test5.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test5/test5.cpp deleted file mode 100644 index 04205aca8..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test5/test5.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test5.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** Test to ensure that you can write to a 'r+' mode file. -** And that you can read from a 'r+' mode file. -** -** Depends: -** fprintf -** fclose -** fgets -** fseek -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fopen_test5_paltest_fopen_test5, "c_runtime/fopen/test5/paltest_fopen_test5") -{ - - FILE *fp; - char buffer[128]; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* Open a file with 'w' mode */ - if( (fp = fopen( "testfile", "w" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'w' mode.\n" ); - } - - if(fclose(fp)) - { - Fail("ERROR: Attempted to close a file, but fclose failed. " - "This test depends upon it."); - } - - if( (fp = fopen( "testfile", "r+" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'r+' mode.\n" ); - } - - /* Write some text to the file */ - if(fprintf(fp,"%s","some text") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'r+' mode " - "but fprintf failed. Either fopen or fprintf have problems."); - } - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Attempt to read from the 'r+' only file, should pass */ - if(fgets(buffer,10,fp) == NULL) - { - Fail("ERROR: Tried to READ from a file with 'r+' mode set. " - "This should succeed, but fgets returned NULL. Either fgets " - "or fopen is broken."); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test6/test6.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test6/test6.cpp deleted file mode 100644 index 13f00cc93..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test6/test6.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test6.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** Test to ensure that you can write to an 'a' mode file. -** And that you can't read from a 'a' mode file. Also ensure -** that you can use fseek and still write to the end of a file. -** -** Depends: -** fprintf -** fgets -** fseek -** fclose -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fopen_test6_paltest_fopen_test6, "c_runtime/fopen/test6/paltest_fopen_test6") -{ - - FILE *fp; - char buffer[128]; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* Open a file with 'a+' mode */ - if( (fp = fopen( "testfile", "a" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'a' mode.\n" ); - } - - /* Write some text to the file */ - if(fprintf(fp,"%s","some text") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode " - "but fprintf failed. Either fopen or fprintf have problems."); - } - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Attempt to read from the 'a' only file, should fail */ - if(fgets(buffer,10,fp) != NULL) - { - Fail("ERROR: Tried to READ from a file with 'a' mode set. " - "This should fail, but fgets returned success. Either fgets " - "or fopen is broken."); - } - - - /* Attempt to write to a file after using 'a' and fseek */ - fp = fopen("testfile2", "a"); - if(fp == NULL) - { - Fail("ERROR: The file failed to be created with 'a' mode.\n"); - } - - /* write text to the file initially */ - if(fprintf(fp,"%s","abcd") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode " - "but fprintf failed. Either fopen or fprintf have problems.\n"); - } - - /* set the pointer to the front of the file */ - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it.\n"); - } - - /* using 'a' should still write to the end of the file, not the front */ - if(fputs("efgh",fp) < 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'a' mode " - "but fputs failed.\n"); - } - - /* set the pointer to the front of the file */ - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it.\n"); - } - - /* a file with 'a' mode can only write, so close the file before reading */ - if(fclose(fp)) - { - Fail("ERROR: fclose failed when it should have succeeded.\n"); - } - - /* open the file again to read */ - fp = fopen("testfile2","r"); - if(fp == NULL) - { - Fail("ERROR: fopen failed to open the file using 'r' mode"); - } - - /* Attempt to read from the 'a' only file, should succeed */ - if(fgets(buffer,10,fp) == NULL) - { - Fail("ERROR: Tried to READ from a file with 'a' mode set. " - "This should pass, but fgets returned failure. Either fgets " - "or fopen is broken.\n"); - } - - /* Compare what was read and what should have been in the file */ - if(memcmp(buffer,"abcdefgh",8)) - { - Fail("ERROR: The string read should have equaled 'abcdefgh' " - "but instead it is %s\n", buffer); - } - - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test7/test7.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test7/test7.cpp deleted file mode 100644 index 0cf274d8c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fopen/test7/test7.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test7.c -** -** Purpose: Tests the PAL implementation of the fopen function. -** Test to ensure that you can write to an 'a+' mode file. -** And that you can read from a 'a+' mode file. Also ensure -** that you can use fseek and still write to the end of a file. -** -** Depends: -** fprintf -** fgets -** fseek -** fclose -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fopen_test7_paltest_fopen_test7, "c_runtime/fopen/test7/paltest_fopen_test7") -{ - - FILE *fp; - char buffer[128]; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* Open a file with 'a+' mode */ - if( (fp = fopen( "testfile", "a+" )) == NULL ) - { - Fail( "ERROR: The file failed to open with 'a+' mode.\n" ); - } - - /* Write some text to the file */ - if(fprintf(fp,"%s","some text") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode " - "but fprintf failed. Either fopen or fprintf have problems.\n"); - } - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it.\n"); - } - - /* Attempt to read from the 'a+' only file, should succeed */ - if(fgets(buffer,10,fp) == NULL) - { - Fail("ERROR: Tried to READ from a file with 'a+' mode set. " - "This should pass, but fgets returned failure. Either fgets " - "or fopen is broken.\n"); - } - - - /* Attempt to write to a file after using 'a+' and fseek */ - fp = fopen("testfile2", "a+"); - if(fp == NULL) - { - Fail("ERROR: The file failed to be created with 'a+' mode.\n"); - } - - /* write text to the file initially */ - if(fprintf(fp,"%s","abcd") <= 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode " - "but fprintf failed. Either fopen or fprintf have problems.\n"); - } - - /* set the pointer to the front of the file */ - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it.\n"); - } - - /* using 'a+' should still write to the end of the file, not the front */ - if(fputs("efgh",fp) < 0) - { - Fail("ERROR: Attempted to WRITE to a file opened with 'a+' mode " - "but fputs failed.\n"); - } - - /* set the pointer to the front of the file */ - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it.\n"); - } - - /* Attempt to read from the 'a+' only file, should succeed */ - if(fgets(buffer,10,fp) == NULL) - { - Fail("ERROR: Tried to READ from a file with 'a+' mode set. " - "This should pass, but fgets returned failure. Either fgets " - "or fopen is broken.\n"); - } - - /* Compare what was read and what should have been in the file */ - if(memcmp(buffer,"abcdefgh",8)) - { - Fail("ERROR: The string read should have equaled 'abcdefgh' " - "but instead it is %s\n", buffer); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fputs/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fputs/test1/test1.cpp deleted file mode 100644 index c746daff9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fputs/test1/test1.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Call fputs twice and write two strings to a file. Then -** call fread on the file and check that the data which was written is what -** we expect it to be. -** - -** -**===================================================================*/ - - -#include - - -PALTEST(c_runtime_fputs_test1_paltest_fputs_test1, "c_runtime/fputs/test1/paltest_fputs_test1") -{ - - FILE* TheFile; - char* StringOne = "FooBar"; - char* StringTwo = "BarFoo"; - char* CompleteString = "FooBarBarFoo"; - char ReadBuffer[64]; - int ret; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Open the file that we'll be working with */ - - TheFile = fopen("TestFile", "w+"); - - if(TheFile == NULL) - { - Fail("ERROR: fopen failed to open the file 'TestFile' in read/write " - "mode.\n"); - } - - /* Call fputs twice to write two strings to the file stream */ - - if(fputs(StringOne, TheFile) < 0) - { - Fail("ERROR: fputs returned a negative value when attempting to " - "put the string '%s' to the file.\n",StringOne); - } - - if(fputs(StringTwo, TheFile) < 0) - { - Fail("ERROR: fputs returned a negative value when attempting to " - "put the string '%s' to the file.\n",StringTwo); - } - - /* Flush the buffers */ - if(fflush(TheFile) != 0) - { - Fail("ERROR: fflush failed to properly flush the buffers.\n"); - } - - /* Now read from the file to ensure the data was written correctly. - Note: We read more than what was written to make sure nothing extra - was written. - */ - - if(fseek(TheFile, 0, SEEK_SET) != 0) - { - Fail("ERROR: fseek failed to set the file pointer back to the start " - "of the file.\n"); - } - - - if((ret = fread(ReadBuffer, 1, 20, TheFile)) != 12) - { - Fail("ERROR: fread should have returned that it read in 12 characters " - "from the file, but instead it returned %d.\n", ret); - } - - ReadBuffer[ret] = '\0'; - - if(strcmp(ReadBuffer, CompleteString) != 0) - { - Fail("ERROR: The data read back from the file is not exactly the same " - "as the data that was written by fputs. The file contains '%s' " - "instead of '%s'.\n",ReadBuffer, CompleteString); - } - - if(fclose(TheFile) != 0) - { - Fail("ERROR: fclose failed to close the file stream.\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fputs/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fputs/test2/test2.cpp deleted file mode 100644 index aa8d36a51..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fputs/test2/test2.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Check to see that fputs fails and returns EOF when called on -** a closed file stream and a read-only file stream. -** - -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_fputs_test2_paltest_fputs_test2, "c_runtime/fputs/test2/paltest_fputs_test2") -{ - - FILE* TheFile; - char* StringOne = "FooBar"; - int ret; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Create a file with read/write access */ - - TheFile = fopen("TestFile", "w+"); - - if(TheFile == NULL) - { - Fail("ERROR: fopen failed to open the file 'TestFile' in read/write " - "mode.\n"); - } - - /* Then close that file we just opened */ - - if(fclose(TheFile) != 0) - { - Fail("ERROR: fclose failed to close the file.\n"); - } - - /* Check that calling fputs on this closed file stream fails. */ - - if((ret = fputs(StringOne, TheFile)) >= 0) - { - Fail("ERROR: fputs should have failed to write to a closed " - "file stream, but it didn't return a negative value.\n"); - } - - if(ret != EOF) - { - Fail("ERROR: fputs should have returned EOF on an error, but instead " - "returned %d.\n",ret); - } - - /* Open a file as Readonly */ - - TheFile = fopen("TestFile", "r"); - - if(TheFile == NULL) - { - Fail("ERROR: fopen failed to open the file 'TestFile' in read/write " - "mode.\n"); - } - - /* Check that fputs fails when trying to write to a read-only stream */ - - if((ret = fputs(StringOne, TheFile)) >= 0) - { - Fail("ERROR: fputs should have failed to write to a read-only " - "file stream, but it didn't return a negative value.\n"); - } - - if(ret != EOF) - { - Fail("ERROR: fputs should have returned EOF when writing to a " - "read-only filestream, but instead " - "returned %d.\n",ret); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test1/test1.cpp deleted file mode 100644 index 3cfe9fa44..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test1/test1.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests the PAL implementation of the fread function. -** Open a file in READ mode, and then try to read all -** the characters, more than all the characters, -** 0 characters and 0 sized characters and check that -** the return values are correct. -** -** Depends: -** fopen -** fseek -** fclose -** -** -**===================================================================*/ - -/* Note: testfile should exist in the directory with 15 characters - in it ... something got lost if it isn't here. -*/ - -/* Note: Under win32, fread() crashes when passed NULL. The test to ensure that - it returns 0 has been removed to reflect this. -*/ - -#include - -PALTEST(c_runtime_fread_test1_paltest_fread_test1, "c_runtime/fread/test1/paltest_fread_test1") -{ - const char filename[] = "testfile"; - char buffer[128]; - FILE * fp = NULL; - int result; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Open a file in READ mode */ - - if((fp = fopen(filename, "r")) == NULL) - { - Fail("Unable to open a file for reading. Is the file " - "in the directory? It should be."); - } - - /* Read 15 characters from the file. The file has exactly this many - in it. - */ - if((result = fread(buffer,1,15,fp)) == 0) - { - Fail("ERROR: Zero characters read from the file. It should have " - "15 characters in it."); - } - - if(result != 15) - { - Fail("ERROR: The fread function should have returned that it read " - "in 15 characters from the file. But it indicates having " - "read %i characters.",result); - } - - /* Go back to the start of the file */ - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Attempt to read 17 characters, the return should still be 15 */ - - if((result = fread(buffer,1,17,fp)) == 0) - { - Fail("ERROR: Zero characters read from the file. It should have " - "15 characters in it. Though, it attempted to read 17."); - } - - if(result != 15) - { - Fail("ERROR: The fread function should have returned that it read " - "in 15 characters from the file. " - "But it indicates having read %i characters.",result); - } - - /* Back to the start of the file */ - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Read 0 characters and ensure the function returns 0 */ - - if((result = fread(buffer,1,0,fp)) != 0) - { - Fail("ERROR: The return value should be 0, as we attempted to " - "read 0 characters."); - } - - /* Read characters of 0 size and ensure the return value is 0 */ - - if((result = fread(buffer,0,5,fp)) != 0) - { - Fail("ERROR: The return value should be 0, as we attempted to " - "read 0 sized data."); - } - - /* Close the file */ - - if(fclose(fp)) - { - Fail("ERROR: fclose failed. Test depends on it."); - } - - /* Read 5 characters of 1 size from a closed file pointer - and ensure the return value is 0 - */ - - if((result = fread(buffer,1,5,fp)) != 0) - { - Fail("ERROR: The return value should be 0, as we attempted to " - "read data from a closed file pointer."); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test1/testfile b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test1/testfile deleted file mode 100644 index 273c1a9ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test1/testfile +++ /dev/null @@ -1 +0,0 @@ -This is a test. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test2/test2.cpp deleted file mode 100644 index de372204e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test2/test2.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Tests the PAL implementation of the fread function. -** Open a file in READ mode, and then try to read all -** the characters, more than all the characters, -** 0 characters and 0 sized characters and check that -** the strings read in are correct. -** -** Depends: -** fopen -** fseek -** fclose -** strcmp -** memset -** -** -**===================================================================*/ - -/* Note: testfile should exist in the directory with 15 characters - in it ... something got lost if it isn't here. -*/ - -/* Note: The behaviour in win32 is to crash if a NULL pointer is passed to - fread, so the test to check that it returns 0 has been removed. -*/ - -#include - -PALTEST(c_runtime_fread_test2_paltest_fread_test2, "c_runtime/fread/test2/paltest_fread_test2") -{ - const char filename[] = "testfile"; - char buffer[128]; - FILE * fp = NULL; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Open a file in READ mode */ - - if((fp = fopen(filename, "r")) == NULL) - { - Fail("Unable to open a file for reading. Is the file " - "in the directory? It should be."); - } - - /* Read 15 characters from the file. The file has exactly this many - in it. Then check to see that the data read in is correct. - Note: The 'testfile' should have "This is a test." written in it. - */ - memset(buffer,'\0',128); - fread(buffer,1,15,fp); - - if(strcmp(buffer,"This is a test.") != 0) - { - Fail("ERROR: The data read in should have been " - "'This is a test.' but, the buffer contains '%s'.", - buffer); - } - - /* Go back to the start of the file */ - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Attempt to read 17 characters. The same 15 characters should - be in the buffer. - */ - - memset(buffer,'\0',128); - fread(buffer,1,17,fp); - - if(strcmp(buffer,"This is a test.") != 0) - { - Fail("ERROR: The data read in should have been " - "'This is a test.' but, the buffer contains '%s'.", - buffer); - } - - /* Back to the start of the file */ - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Read 0 characters and ensure the buffer is empty */ - - memset(buffer,'\0',128); - fread(buffer,1,0,fp); - - if(strcmp(buffer,"\0") != 0) - { - Fail("ERROR: The data read in should have been " - "NULL but, the buffer contains '%s'.", - buffer); - } - - /* Read characters of 0 size and ensure the buffer is empty */ - - memset(buffer,'\0',128); - fread(buffer,0,5,fp); - - if(strcmp(buffer,"\0") != 0) - { - Fail("ERROR: The data read in should have been " - "NULL but, the buffer contains '%s'.", - buffer); - } - - /* Close the file */ - - if(fclose(fp)) - { - Fail("ERROR: fclose failed. Test depends on it."); - } - - /* Read 5 characters of 1 size from a closed file pointer - and ensure the buffer is empty - */ - memset(buffer,'\0',128); - fread(buffer,1,5,fp); - if(strcmp(buffer,"\0") != 0) - { - Fail("ERROR: The data read in should have been " - "NULL but, the buffer contains '%s'.", - buffer); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test2/testfile b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test2/testfile deleted file mode 100644 index 273c1a9ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test2/testfile +++ /dev/null @@ -1 +0,0 @@ -This is a test. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test3/test3.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test3/test3.cpp deleted file mode 100644 index 75ae9c6ad..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test3/test3.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test3.c -** -** Purpose: Tests the PAL implementation of the fread function. -** Open a file in READ mode, then try to read from the file with -** different 'size' params. Check to ensure the return values and -** the text in the buffer is correct. -** -** Depends: -** fopen -** fseek -** strcmp -** memset -** -** -**===================================================================*/ - -/* Note: testfile should exist in the directory with 15 characters - in it ... something got lost if it isn't here. -*/ - -#include - -PALTEST(c_runtime_fread_test3_paltest_fread_test3, "c_runtime/fread/test3/paltest_fread_test3") -{ - const char filename[] = "testfile"; - char buffer[128]; - FILE * fp = NULL; - int result; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Open a file in READ mode */ - - if((fp = fopen(filename, "r")) == NULL) - { - Fail("Unable to open a file for reading. Is the file " - "in the directory? It should be."); - } - - memset(buffer,'x',128); - - /* Put the null one character past the end of the text that was read - in, to ensure that it wasn't reading in 0 - */ - - buffer[16] = '\0'; - - /* Attempt to read in 5 bytes at a time. This should return 3 and - contain the full string in the buffer. - */ - - if((result = fread(buffer,5,3,fp)) != 3) - { - Fail("ERROR: Attempted to read in data of size 5. The file has " - "15 bytes in it so 3 items should have been read. But the value " - "returned was %d.",result); - } - - if(strcmp(buffer, "This is a test.x") != 0) - { - Fail("ERROR: The buffer should have contained the text " - "'This is a test.x' but instead contained '%s'.",buffer); - } - - memset(buffer,'x',128); - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - buffer[16] = '\0'; - - /* Attempt to read in 6 bytes at a time. The return should be 2. The - full string should still be in the buffer. - */ - - if((result = fread(buffer,6,3,fp)) != 2) - { - Fail("ERROR: Attempted to read in data of size 6. The file has " - "15 bytes in it, so 2 items should have been read. But the " - "value returned was %d.",result); - } - - if(strcmp(buffer, "This is a test.x") != 0) - { - Fail("ERROR: The buffer should have contained the text " - "'This is a test.x' but instead contained '%s'.",buffer); - } - - memset(buffer,'x',128); - - buffer[7] = '\0'; - - if(fseek(fp, 0, SEEK_SET)) - { - Fail("ERROR: fseek failed, and this test depends on it."); - } - - /* Attempt to read in 6 bytes at a time but only one item max. - The return should be 1. The first 6 characters should be in the - buffer. - */ - - if((result = fread(buffer,6,1,fp)) != 1) - { - Fail("ERROR: Attempted to read in data of size 6 with a max count " - "of 1. Thus, one item should have been read, but the " - "value returned was %d.",result); - } - - if(strcmp(buffer, "This ix") != 0) - { - Fail("ERROR: The buffer should have contained the text " - "'This ix.' but instead contained '%s'.",buffer); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test3/testfile b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test3/testfile deleted file mode 100644 index 273c1a9ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fread/test3/testfile +++ /dev/null @@ -1 +0,0 @@ -This is a test. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/free/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/free/test1/test1.cpp deleted file mode 100644 index dc8d13158..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/free/test1/test1.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Repeatedly allocates and frees a chunk of memory, to verify -** that free is really returning memory to the heap -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_free_test1_paltest_free_test1, "c_runtime/free/test1/paltest_free_test1") -{ - - char *testA; - - long i; - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* check that free really returns memory to the heap. */ - for(i=1; i<1000000; i++) - { - testA = (char *)malloc(1000*sizeof(char)); - if (testA==NULL) - { - Fail("Either free is failing to return memory to the heap, or" - " the system is running out of memory for some other " - "reason.\n"); - } - free(testA); - } - - free(NULL); /*should do nothing*/ - PAL_Terminate(); - return PASS; -} - - - - - - - - - - - - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fseek/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fseek/test1/test1.cpp deleted file mode 100644 index 7fdfc2fef..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fseek/test1/test1.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Call fseek to move a file pointer to the start of a file, -** a position offset from the start, a position offset from the -** current position, and a position offset from the end of the -** file. Check that the file pointer is at the correct position -** after each seek. -** -** -**==========================================================================*/ - -#include - -const char filename[] = "testfile.txt"; - -static BOOL Cleanup(HANDLE hFile) -{ - BOOL result= TRUE; - - if (fclose((PAL_FILE*)hFile)) - { - Trace("fseek: ERROR -> Unable to close file \"%s\".\n", - filename); - result= FALSE; - } - if (!DeleteFileA(filename)) - { - result= FALSE; - Trace("fseek: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - filename, - GetLastError()); - } - return result; -} - -PALTEST(c_runtime_fseek_test1_paltest_fseek_test1, "c_runtime/fseek/test1/paltest_fseek_test1") -{ - char outBuf[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - char inBuf[20]; - FILE * fp; - int size = ( sizeof(outBuf)/sizeof(char) ) - 1; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /*create the file*/ - fp = fopen(filename, "w"); - if (fp == NULL) - { - Fail("Unable to open a file for write.\n"); - } - if(fprintf(fp, outBuf) != size) - { - Trace("Unable to write to %s.\n", filename); - Cleanup(fp); - Fail(""); - } - - if (fclose(fp) != 0) - { - Trace("Unable to close newly written file.\n"); - if (!DeleteFileA(filename)) - { - Trace("fseek: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - filename, - GetLastError()); - } - Fail(""); - } - - fp = fopen(filename, "r"); - if (fp == NULL) - { - if (!DeleteFileA(filename)) - { - Trace("_putw: ERROR -> Unable to delete file \"%s\". ", - "GetLastError returned %u.\n", - filename, - GetLastError()); - } - Fail("Unable to open a file for read.\n"); - } - - /*seek to the start*/ - if (fseek(fp, 0, SEEK_SET) != 0) - { - Cleanup(fp); - Fail("fseek failed when seeking the start of a file.\n"); - } - if (fgets(inBuf, 11, fp) != inBuf) - { - Cleanup(fp); - Fail("Unable to read from file after using fseek to move to the start.\n"); - } - if (strncmp(inBuf, outBuf, 10) != 0) - { - Cleanup(fp); - Fail("fseek was asked to seek the start of a file," - "but didn't get there.\n"); - } - - /*Seek with an offset from the start*/ - - if (fseek(fp, 10, SEEK_SET) != 0) - { - Cleanup(fp); - Fail("fseek failed when called with SEEK_SET and a positive offset.\n"); - } - - if (fgets(inBuf, 6, fp) != inBuf) - { - Cleanup(fp); - Fail("fgets failed after feek was called with SEEK_SET" - "and a positive offset.\n"); - } - - - if (strncmp(inBuf, "ABCDE", 5) != 0) - { - Cleanup(fp); - Fail("fseek did not move to the correct position when passed SEEK_SET" - " and a positive offset.\n"); - } - - /*now move backwards and read the same string*/ - if (fseek(fp, -5, SEEK_CUR) != 0) - { - Cleanup(fp); - Fail("fseek failed when passed SEEK_CUR and a negative offset.\n"); - } - - if (fgets(inBuf, 6, fp) != inBuf) - { - Cleanup(fp); - Fail("fgets failed after fseek was called with SEEK_CUR and a " - "negative offset.\n"); - } - - if (strncmp(inBuf, "ABCDE", 5) != 0) - { - Cleanup(fp); - Fail("fseek did not move to the correct position when called with" - " SEEK_CUR and a negative offset.\n"); - } - - /*Try seeking relative to the end of the file.*/ - if (fseek(fp, -10, SEEK_END) != 0) - { - Cleanup(fp); - Fail("fseek failed when called with SEEK_END and a negative" - " offset.\n"); - } - if (fgets(inBuf, 2, fp) != inBuf) - { - Cleanup(fp); - Fail("fgets failed after fseek was called with SEEK_END and a " - "negative offset\n"); - } - - if (strncmp(inBuf, "Q", 1) != 0) - { - Cleanup(fp); - Fail("fseek did not move to the correct position when called with " - "SEEK_END and a negative offset.\n"); - } - - - /*close the file*/ - if(!Cleanup(fp)) - { - Fail(""); - } - - PAL_Terminate(); - return PASS; -} - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ftell/test1/ftell.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ftell/test1/ftell.cpp deleted file mode 100644 index 1c60fab20..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ftell/test1/ftell.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: ftell.c (test 1) -** -** Purpose: Tests the PAL implementation of the ftell function. -** -** -**===================================================================*/ - -#include - -FILE* pFile; -struct TESTS -{ - long lDist; - int nFrom; - long lPosition; -}; - - -/************************************************* -** -** Validate -** -** Purpose: -** Tests whether the move was successful. If -** it passes, it returns TRUE. If it fails -** it outputs some error messages and returns -** FALSE. -** -*************************************************/ -BOOL Validate(long lExpected) -{ - long lPos = -2; - - if (((lPos = ftell(pFile)) == -1) || (lPos != lExpected)) - { - Trace("ftell: ERROR -> ftell returned %ld when expecting %ld.\n", - lPos, - lExpected); - if (fclose(pFile) != 0) - { - Trace("ftell: ERROR -> fclose failed to close the file.\n"); - } - return FALSE; - } - return TRUE; -} - - -/************************************************* -** -** MovePointer -** -** Purpose: -** Accepts the distance to move and the -** distance and calls fseek to move the file -** pointer. If the fseek fails, error messages -** are displayed and FALSE is returned. TRUE -** is returned on a successful fseek. -** -*************************************************/ -BOOL MovePointer(long lDist, int nFrom) -{ - /* move the file pointer*/ - if (fseek(pFile, lDist, nFrom) != 0) - { - Trace("ftell: ERROR -> fseek failed to move the file pointer " - "%l characters.\n", - lDist); - if (fclose(pFile) != 0) - { - Trace("ftell: ERROR -> fclose failed to close the file.\n"); - } - return FALSE; - } - return TRUE; -} - - - -PALTEST(c_runtime_ftell_test1_paltest_ftell_test1, "c_runtime/ftell/test1/paltest_ftell_test1") -{ - const char szFileName[] = {"testfile.txt"}; - long lPos = -1; - int i; - char szTempBuffer[256]; - struct TESTS testCase[] = - { - {0, SEEK_SET, 0}, - {10, SEEK_CUR, 10}, - {-5, SEEK_CUR, 5}, - {-2, SEEK_END, 50} - }; - - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - memset(szTempBuffer, 0, 256); - - - /* open the test file */ - pFile = fopen(szFileName, "r"); - if (pFile == NULL) - { - Fail("ftell: ERROR -> fopen failed to open the file \"%s\".\n"); - } - - /* loop through the test cases */ - for (i = 0; i < (sizeof(testCase)/sizeof(struct TESTS)); i++) - { - if (MovePointer(testCase[i].lDist, testCase[i].nFrom) != TRUE) - { - Fail(""); - } - else if (Validate(testCase[i].lPosition) != TRUE) - { - Fail(""); - } - } - - if (fclose(pFile) != 0) - { - Fail("ftell: ERROR -> fclose failed to close the file.\n"); - } - - /* lets just see if we can find out where we are in a closed stream... */ - if ((lPos = ftell(pFile)) != -1) - { - Fail("ftell: ERROR -> ftell returned a valid position (%ld) on a " - "closed file handle\n", - lPos); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt deleted file mode 100644 index dd0fe15fe..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ftell/test1/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -The quick brown fox jumped over the lazy dog's back. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fwrite/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fwrite/test1/test1.cpp deleted file mode 100644 index 5b74faa8e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/fwrite/test1/test1.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Write a short string to a file and check that it was written -** properly. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_fwrite_test1_paltest_fwrite_test1, "c_runtime/fwrite/test1/paltest_fwrite_test1") -{ - const char filename[] = "testfile.tmp"; - const char outBuffer[] = "This is a test."; - char inBuffer[sizeof(outBuffer) + 10]; - int itemsExpected; - int itemsWritten; - FILE * fp = NULL; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - if((fp = fopen(filename, "w")) == NULL) - { - Fail("Unable to open a file for write.\n"); - } - - itemsExpected = sizeof(outBuffer); - itemsWritten = fwrite(outBuffer, - sizeof(outBuffer[0]), - sizeof(outBuffer), - fp); - - if (itemsWritten == 0) - { - if(fclose(fp) != 0) - { - Fail("fwrite: Error occurred during the closing of a file.\n"); - } - - Fail("fwrite() couldn't write to a stream at all\n"); - } - else if (itemsWritten != itemsExpected) - { - if(fclose(fp) != 0) - { - Fail("fwrite: Error occurred during the closing of a file.\n"); - } - - Fail("fwrite() produced errors writing to a stream.\n"); - } - - if(fclose(fp) != 0) - { - Fail("fwrite: Error occurred during the closing of a file.\n"); - } - - /* open the file to verify what was written to the file */ - if ((fp = fopen(filename, "r")) == NULL) - { - Fail("Couldn't open newly written file for read.\n"); - } - - if (fgets(inBuffer, sizeof(inBuffer), fp) == NULL) - { - if(fclose(fp) != 0) - { - Fail("fwrite: Error occurred during the closing of a file.\n"); - } - - Fail("We wrote something to a file using fwrite() and got errors" - " when we tried to read it back using fgets(). Either " - "fwrite() or fgets() is broken.\n"); - } - - if (strcmp(inBuffer, outBuffer) != 0) - { - if(fclose(fp) != 0) - { - Fail("fwrite: Error occurred during the closing of a file.\n"); - } - - Fail("fwrite() (or fgets()) is broken. The string read back from" - " the file does not match the string written.\n"); - } - - if(fclose(fp) != 0) - { - Fail("fwrite: Error occurred during the closing of a file.\n"); - } - - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ilogb/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ilogb/test1/test1.cpp deleted file mode 100644 index 9fbd270d5..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ilogb/test1/test1.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that ilogb returns correct values. -** -**===================================================================*/ - -#include - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - int expected; /* expected result */ -}; - -/** - * ilogb_test1_validate - * - * test validation function - */ -void __cdecl ilogb_test1_validate(double value, int expected) -{ - int result = ilogb(value); - - if (result != expected) - { - Fail("ilogb(%g) returned %d when it should have returned %d", - value, result, expected); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_ilogb_test1_paltest_ilogb_test1, "c_runtime/ilogb/test1/paltest_ilogb_test1") -{ - struct test tests[] = - { - /* value expected */ - { PAL_NEGINF, 2147483647 }, - { 0, -2147483648 }, - { PAL_POSINF, 2147483647 }, - { 0.11331473229676087, -4 }, // expected: -(pi) - { 0.15195522325791297, -3 }, // expected: -(e) - { 0.20269956628651730, -3 }, // expected: -(ln(10)) - { 0.33662253682241906, -2 }, // expected: -(pi / 2) - { 0.36787944117144232, -2 }, // expected: -(log2(e)) - { 0.37521422724648177, -2 }, // expected: -(sqrt(2)) - { 0.45742934732229695, -2 }, // expected: -(2 / sqrt(pi)) - { 0.5, -1 }, // expected: -(1) - { 0.58019181037172444, -1 }, // expected: -(pi / 4) - { 0.61254732653606592, -1 }, // expected: -(1 / sqrt(2)) - { 0.61850313780157598, -1 }, // expected: -(ln(2)) - { 0.64321824193300488, -1 }, // expected: -(2 / pi) - { 0.74005557395545179, -1 }, // expected: -(log10(e)) - { 0.80200887896145195, -1 }, // expected: -(1 / pi) - { 1, 0 }, - { 1.2468689889006383, 0 }, // expected: 1 / pi - { 1.3512498725672678, 0 }, // expected: log10(e) - { 1.5546822754821001, 0 }, // expected: 2 / pi - { 1.6168066722416747, 0 }, // expected: ln(2) - { 1.6325269194381528, 0 }, // expected: 1 / sqrt(2) - { 1.7235679341273495, 0 }, // expected: pi / 4 - { 2, 1 }, - { 2.1861299583286618, 1 }, // expected: 2 / sqrt(pi) - { 2.6651441426902252, 1 }, // expected: sqrt(2) - { 2.7182818284590452, 1 }, // expected: log2(e) value: e - { 2.9706864235520193, 1 }, // expected: pi / 2 - { 4.9334096679145963, 2 }, // expected: ln(10) - { 6.5808859910179210, 2 }, // expected: e - { 8.8249778270762876, 3 }, // expected: pi - { PAL_NAN, 2147483647 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - ilogb_test1_validate(tests[i].value, tests[i].expected); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ilogbf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ilogbf/test1/test1.cpp deleted file mode 100644 index c5022056c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/ilogbf/test1/test1.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that ilogbf returns correct values. -** -**===================================================================*/ - -#include - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - int expected; /* expected result */ -}; - -/** - * ilogbf_test1_validate - * - * test validation function - */ -void __cdecl ilogbf_test1_validate(float value, int expected) -{ - int result = ilogbf(value); - - if (result != expected) - { - Fail("ilogbf(%g) returned %d when it should have returned %d", - value, result, expected); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_ilogbf_test1_paltest_ilogbf_test1, "c_runtime/ilogbf/test1/paltest_ilogbf_test1") -{ - struct test tests[] = - { - /* value expected */ - { PAL_NEGINF, 2147483647 }, - { 0, -2147483648 }, - { PAL_POSINF, 2147483647 }, - { 0.113314732f, -4 }, // expected: -(pi) - { 0.151955223f, -3 }, // expected: -(e) - { 0.202699566f, -3 }, // expected: -(ln(10)) - { 0.336622537f, -2 }, // expected: -(pi / 2) - { 0.367879441f, -2 }, // expected: -(log2(e)) - { 0.375214227f, -2 }, // expected: -(sqrt(2)) - { 0.457429347f, -2 }, // expected: -(2 / sqrt(pi)) - { 0.5f, -1 }, // expected: -(1) - { 0.580191810f, -1 }, // expected: -(pi / 4) - { 0.612547327f, -1 }, // expected: -(1 / sqrt(2)) - { 0.618503138f, -1 }, // expected: -(ln(2)) - { 0.643218242f, -1 }, // expected: -(2 / pi) - { 0.740055574f, -1 }, // expected: -(log10(e)) - { 0.802008879f, -1 }, // expected: -(1 / pi) - { 1, 0 }, - { 1.24686899f, 0 }, // expected: 1 / pi - { 1.35124987f, 0 }, // expected: log10(e) - { 1.55468228f, 0 }, // expected: 2 / pi - { 1.61680667f, 0 }, // expected: ln(2) - { 1.63252692f, 0 }, // expected: 1 / sqrt(2) - { 1.72356793f, 0 }, // expected: pi / 4 - { 2, 1 }, - { 2.18612996f, 1 }, // expected: 2 / sqrt(pi) - { 2.66514414f, 1 }, // expected: sqrt(2) - { 2.71828183f, 1 }, // expected: log2(e) value: e - { 2.97068642f, 1 }, // expected: pi / 2 - { 4.93340967f, 2 }, // expected: ln(10) - { 6.58088599f, 2 }, // expected: e - { 8.82497783f, 3 }, // expected: pi - { PAL_NAN, 2147483647 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - ilogbf_test1_validate(tests[i].value, tests[i].expected); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log/test1/test1.cpp deleted file mode 100644 index a780558a0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log/test1/test1.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests log with a normal set of values. -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * log_test1_validate - * - * test validation function - */ -void __cdecl log_test1_validate(double value, double expected, double variance) -{ - double result = log(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("log(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * log_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl log_test1_validate_isnan(double value) -{ - double result = log(value); - - if (!_isnan(result)) - { - Fail("log(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_log_test1_paltest_log_test1, "c_runtime/log/test1/paltest_log_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, PAL_NEGINF, 0 }, - { 0.043213918263772250, -3.1415926535897932, PAL_EPSILON * 10 }, // expected: -(pi) - { 0.065988035845312537, -2.7182818284590452, PAL_EPSILON * 10 }, // expected: -(e) - { 0.1, -2.3025850929940457, PAL_EPSILON * 10 }, // expected: -(ln(10)) - { 0.20787957635076191, -1.5707963267948966, PAL_EPSILON * 10 }, // expected: -(pi / 2) - { 0.23629008834452270, -1.4426950408889634, PAL_EPSILON * 10 }, // expected: -(log2(e)) - { 0.24311673443421421, -1.4142135623730950, PAL_EPSILON * 10 }, // expected: -(sqrt(2)) - { 0.32355726390307110, -1.1283791670955126, PAL_EPSILON * 10 }, // expected: -(2 / sqrt(pi)) - { 0.36787944117144232, -1, PAL_EPSILON * 10 }, // expected: -(1) - { 0.45593812776599624, -0.78539816339744831, PAL_EPSILON }, // expected: -(pi / 4) - { 0.49306869139523979, -0.70710678118654752, PAL_EPSILON }, // expected: -(1 / sqrt(2)) - { 0.5, -0.69314718055994531, PAL_EPSILON }, // expected: -(ln(2)) - { 0.52907780826773535, -0.63661977236758134, PAL_EPSILON }, // expected: -(2 / pi) - { 0.64772148514180065, -0.43429448190325183, PAL_EPSILON }, // expected: -(log10(e)) - { 0.72737734929521647, -0.31830988618379067, PAL_EPSILON }, // expected: -(1 / pi) - { 1, 0, PAL_EPSILON }, - { 1.3748022274393586, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 1.5438734439711811, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 1.8900811645722220, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 2, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 2.0281149816474725, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 2.1932800507380155, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 2.7182818284590452, 1, PAL_EPSILON * 10 }, // value: e - { 3.0906430223107976, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 4.1132503787829275, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 4.2320861065570819, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 4.8104773809653517, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 10, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 15.154262241479264, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 23.140692632779269, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - log_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - log_test1_validate_isnan(PAL_NEGINF); - log_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log10/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log10/test1/test1.cpp deleted file mode 100644 index 26d13508c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log10/test1/test1.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that log10 returns correct values. -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** _isnan -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * log10_test1_validate - * - * test validation function - */ -void __cdecl log10_test1_validate(double value, double expected, double variance) -{ - double result = log10(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("log10(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * log10_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl log10_test1_validate_isnan(double value) -{ - double result = log10(value); - - if (!_isnan(result)) - { - Fail("log10(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_log10_test1_paltest_log10_test1, "c_runtime/log10/test1/paltest_log10_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, PAL_NEGINF, 0 }, - { 0.00072178415907472774, -3.1415926535897932, PAL_EPSILON * 10 }, // expected: -(pi) - { 0.0019130141022243176, -2.7182818284590452, PAL_EPSILON * 10 }, // expected: -(e) - { 0.0049821282964407206, -2.3025850929940457, PAL_EPSILON * 10 }, // expected: -(ln(10)) - { 0.026866041001136132, -1.5707963267948966, PAL_EPSILON * 10 }, // expected: -(pi / 2) - { 0.036083192820787210, -1.4426950408889634, PAL_EPSILON * 10 }, // expected: -(log2(e)) - { 0.038528884700322026, -1.4142135623730950, PAL_EPSILON * 10 }, // expected: -(sqrt(2)) - { 0.074408205860642723, -1.1283791670955126, PAL_EPSILON * 10 }, // expected: -(2 / sqrt(pi)) - { 0.1, -1, PAL_EPSILON * 10 }, // expected: -(1) - { 0.16390863613957665, -0.78539816339744831, PAL_EPSILON }, // expected: -(pi / 4) - { 0.19628775993505562, -0.70710678118654752, PAL_EPSILON }, // expected: -(1 / sqrt(2)) - { 0.20269956628651730, -0.69314718055994531, PAL_EPSILON }, // expected: -(ln(2)) - { 0.23087676451600055, -0.63661977236758134, PAL_EPSILON }, // expected: -(2 / pi) - { 0.36787944117144232, -0.43429448190325183, PAL_EPSILON }, // expected: -(log10(e)) - { 0.48049637305186868, -0.31830988618379067, PAL_EPSILON }, // expected: -(1 / pi) - { 1, 0, PAL_EPSILON }, - { 2.0811811619898573, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 2.7182818284590452, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) value: e - { 4.3313150290214525, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 4.9334096679145963, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 5.0945611704512962, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 6.1009598002416937, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 10, 1, PAL_EPSILON * 10 }, - { 13.439377934644400, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 25.954553519470081, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 27.713733786437790, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) - { 37.221710484165167, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 200.71743249053009, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 522.73529967043665, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 1385.4557313670111, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - log10_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - log10_test1_validate_isnan(PAL_NEGINF); - log10_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log10f/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log10f/test1/test1.cpp deleted file mode 100644 index a503ebaab..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log10f/test1/test1.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that log10f returns correct values. -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** _isnanf -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * log10f_test1_validate - * - * test validation function - */ -void __cdecl log10f_test1_validate(float value, float expected, float variance) -{ - float result = log10f(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("log10f(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * log10f_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl log10f_test1_validate_isnan(float value) -{ - float result = log10f(value); - - if (!_isnanf(result)) - { - Fail("log10f(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_log10f_test1_paltest_log10f_test1, "c_runtime/log10f/test1/paltest_log10f_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, PAL_NEGINF, 0 }, - { 0.000721784159f, -3.14159265f, PAL_EPSILON * 10 }, // expected: -(pi) - { 0.00191301410f, -2.71828183f, PAL_EPSILON * 10 }, // expected: -(e) - { 0.00498212830f, -2.30258509f, PAL_EPSILON * 10 }, // expected: -(ln(10)) - { 0.0268660410f, -1.57079633f, PAL_EPSILON * 10 }, // expected: -(pi / 2) - { 0.0360831928f, -1.44269504f, PAL_EPSILON * 10 }, // expected: -(logf2(e)) - { 0.0385288847f, -1.41421356f, PAL_EPSILON * 10 }, // expected: -(sqrtf(2)) - { 0.0744082059f, -1.12837917f, PAL_EPSILON * 10 }, // expected: -(2 / sqrtf(pi)) - { 0.1f, -1, PAL_EPSILON * 10 }, // expected: -(1) - { 0.163908636f, -0.785398163f, PAL_EPSILON }, // expected: -(pi / 4) - { 0.196287760f, -0.707106781f, PAL_EPSILON }, // expected: -(1 / sqrtf(2)) - { 0.202699566f, -0.693147181f, PAL_EPSILON }, // expected: -(ln(2)) - { 0.230876765f, -0.636619772f, PAL_EPSILON }, // expected: -(2 / pi) - { 0.367879441f, -0.434294482f, PAL_EPSILON }, // expected: -(log10f(e)) - { 0.480496373f, -0.318309886f, PAL_EPSILON }, // expected: -(1 / pi) - { 1, 0, PAL_EPSILON }, - { 2.08118116f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 2.71828183f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) value: e - { 4.33131503f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 4.93340967f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 5.09456117f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 6.10095980f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 10, 1, PAL_EPSILON * 10 }, - { 13.4393779f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 25.9545535f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 27.7137338f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 37.2217105f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 200.717432f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 522.735300f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 1385.45573f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - log10f_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - log10f_test1_validate_isnan(PAL_NEGINF); - log10f_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log2/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log2/test1/test1.cpp deleted file mode 100644 index 8ca12f4dd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log2/test1/test1.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that log2 returns correct values. -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * log2_test1_validate - * - * test validation function - */ -void __cdecl log2_test1_validate(double value, double expected, double variance) -{ - double result = log2(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("log2(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * log2_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl log2_test1_validate_isnan(double value) -{ - double result = log2(value); - - if (!_isnan(result)) - { - Fail("log2(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_log2_test1_paltest_log2_test1, "c_runtime/log2/test1/paltest_log2_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, PAL_NEGINF, 0 }, - { 0.11331473229676087, -3.1415926535897932, PAL_EPSILON * 10 }, // expected: -(pi) - { 0.15195522325791297, -2.7182818284590452, PAL_EPSILON * 10 }, // expected: -(e) - { 0.20269956628651730, -2.3025850929940457, PAL_EPSILON * 10 }, // expected: -(ln(10)) - { 0.33662253682241906, -1.5707963267948966, PAL_EPSILON * 10 }, // expected: -(pi / 2) - { 0.36787944117144232, -1.4426950408889634, PAL_EPSILON * 10 }, // expected: -(log2(e)) - { 0.37521422724648177, -1.4142135623730950, PAL_EPSILON * 10 }, // expected: -(sqrt(2)) - { 0.45742934732229695, -1.1283791670955126, PAL_EPSILON * 10 }, // expected: -(2 / sqrt(pi)) - { 0.5, -1, PAL_EPSILON * 10 }, // expected: -(1) - { 0.58019181037172444, -0.78539816339744831, PAL_EPSILON }, // expected: -(pi / 4) - { 0.61254732653606592, -0.70710678118654752, PAL_EPSILON }, // expected: -(1 / sqrt(2)) - { 0.61850313780157598, -0.69314718055994531, PAL_EPSILON }, // expected: -(ln(2)) - { 0.64321824193300488, -0.63661977236758134, PAL_EPSILON }, // expected: -(2 / pi) - { 0.74005557395545179, -0.43429448190325183, PAL_EPSILON }, // expected: -(log10(e)) - { 0.80200887896145195, -0.31830988618379067, PAL_EPSILON }, // expected: -(1 / pi) - { 1, 0, PAL_EPSILON }, - { 1.2468689889006383, 0.31830988618379067, PAL_EPSILON }, // expected: 1 / pi - { 1.3512498725672678, 0.43429448190325183, PAL_EPSILON }, // expected: log10(e) - { 1.5546822754821001, 0.63661977236758134, PAL_EPSILON }, // expected: 2 / pi - { 1.6168066722416747, 0.69314718055994531, PAL_EPSILON }, // expected: ln(2) - { 1.6325269194381528, 0.70710678118654752, PAL_EPSILON }, // expected: 1 / sqrt(2) - { 1.7235679341273495, 0.78539816339744831, PAL_EPSILON }, // expected: pi / 4 - { 2, 1, PAL_EPSILON * 10 }, - { 2.1861299583286618, 1.1283791670955126, PAL_EPSILON * 10 }, // expected: 2 / sqrt(pi) - { 2.6651441426902252, 1.4142135623730950, PAL_EPSILON * 10 }, // expected: sqrt(2) - { 2.7182818284590452, 1.4426950408889634, PAL_EPSILON * 10 }, // expected: log2(e) value: e - { 2.9706864235520193, 1.5707963267948966, PAL_EPSILON * 10 }, // expected: pi / 2 - { 4.9334096679145963, 2.3025850929940457, PAL_EPSILON * 10 }, // expected: ln(10) - { 6.5808859910179210, 2.7182818284590452, PAL_EPSILON * 10 }, // expected: e - { 8.8249778270762876, 3.1415926535897932, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - log2_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - log2_test1_validate_isnan(PAL_NEGINF); - log2_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log2f/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log2f/test1/test1.cpp deleted file mode 100644 index 29de3c76d..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/log2f/test1/test1.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that log2f returns correct values. -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * log2f_test1_validate - * - * test validation function - */ -void __cdecl log2f_test1_validate(float value, float expected, float variance) -{ - float result = log2f(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("log2f(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * log2f_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl log2f_test1_validate_isnan(float value) -{ - float result = log2f(value); - - if (!_isnanf(result)) - { - Fail("log2f(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_log2f_test1_paltest_log2f_test1, "c_runtime/log2f/test1/paltest_log2f_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, PAL_NEGINF, 0 }, - { 0.113314732f, -3.14159265f, PAL_EPSILON * 10 }, // expected: -(pi) - { 0.151955223f, -2.71828183f, PAL_EPSILON * 10 }, // expected: -(e) - { 0.202699566f, -2.30258509f, PAL_EPSILON * 10 }, // expected: -(ln(10)) - { 0.336622537f, -1.57079633f, PAL_EPSILON * 10 }, // expected: -(pi / 2) - { 0.367879441f, -1.44269504f, PAL_EPSILON * 10 }, // expected: -(logf2(e)) - { 0.375214227f, -1.41421356f, PAL_EPSILON * 10 }, // expected: -(sqrtf(2)) - { 0.457429347f, -1.12837917f, PAL_EPSILON * 10 }, // expected: -(2 / sqrtf(pi)) - { 0.5f, -1, PAL_EPSILON * 10 }, // expected: -(1) - { 0.580191810f, -0.785398163f, PAL_EPSILON }, // expected: -(pi / 4) - { 0.612547327f, -0.707106781f, PAL_EPSILON }, // expected: -(1 / sqrtf(2)) - { 0.618503138f, -0.693147181f, PAL_EPSILON }, // expected: -(ln(2)) - { 0.643218242f, -0.636619772f, PAL_EPSILON }, // expected: -(2 / pi) - { 0.740055574f, -0.434294482f, PAL_EPSILON }, // expected: -(log10f(e)) - { 0.802008879f, -0.318309886f, PAL_EPSILON }, // expected: -(1 / pi) - { 1, 0, PAL_EPSILON }, - { 1.24686899f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 1.35124987f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) value: e - { 1.55468228f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 1.61680667f, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 1.63252692f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 1.72356793f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 2, 1, PAL_EPSILON * 10 }, - { 2.18612996f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 2.66514414f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 2.71828183f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 2.97068642f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 4.93340967f, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 6.58088599f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 8.82497783f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - log2f_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - log2f_test1_validate_isnan(PAL_NEGINF); - log2f_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/logf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/logf/test1/test1.cpp deleted file mode 100644 index 7980ae1b2..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/logf/test1/test1.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests logf with a normal set of values. -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * logf_test1_validate - * - * test validation function - */ -void __cdecl logf_test1_validate(float value, float expected, float variance) -{ - float result = logf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("logf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * logf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl logf_test1_validate_isnan(float value) -{ - float result = logf(value); - - if (!_isnanf(result)) - { - Fail("logf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_logf_test1_paltest_logf_test1, "c_runtime/logf/test1/paltest_logf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, PAL_NEGINF, 0 }, - { 0.0432139183f, -3.14159265f, PAL_EPSILON * 10 }, // expected: -(pi) - { 0.0659880358f, -2.71828183f, PAL_EPSILON * 10 }, // expected: -(e) - { 0.1f, -2.30258509f, PAL_EPSILON * 10 }, // expected: -(ln(10)) - { 0.207879576f, -1.57079633f, PAL_EPSILON * 10 }, // expected: -(pi / 2) - { 0.236290088f, -1.44269504f, PAL_EPSILON * 10 }, // expected: -(logf2(e)) - { 0.243116734f, -1.41421356f, PAL_EPSILON * 10 }, // expected: -(sqrtf(2)) - { 0.323557264f, -1.12837917f, PAL_EPSILON * 10 }, // expected: -(2 / sqrtf(pi)) - { 0.367879441f, -1, PAL_EPSILON * 10 }, // expected: -(1) - { 0.455938128f, -0.785398163f, PAL_EPSILON }, // expected: -(pi / 4) - { 0.493068691f, -0.707106781f, PAL_EPSILON }, // expected: -(1 / sqrtf(2)) - { 0.5f, -0.693147181f, PAL_EPSILON }, // expected: -(ln(2)) - { 0.529077808f, -0.636619772f, PAL_EPSILON }, // expected: -(2 / pi) - { 0.647721485f, -0.434294482f, PAL_EPSILON }, // expected: -(log10f(e)) - { 0.727377349f, -0.318309886f, PAL_EPSILON }, // expected: -(1 / pi) - { 1, 0, PAL_EPSILON }, - { 1.37480223f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi - { 1.54387344f, 0.434294482f, PAL_EPSILON }, // expected: log10f(e) - { 1.89008116f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi - { 2, 0.693147181f, PAL_EPSILON }, // expected: ln(2) - { 2.02811498f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2) - { 2.19328005f, 0.785398163f, PAL_EPSILON }, // expected: pi / 4 - { 2.71828183f, 1, PAL_EPSILON * 10 }, // value: e - { 3.09064302f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi) - { 4.11325038f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2) - { 4.23208611f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e) - { 4.81047738f, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2 - { 10, 2.30258509f, PAL_EPSILON * 10 }, // expected: ln(10) - { 15.1542622f, 2.71828183f, PAL_EPSILON * 10 }, // expected: e - { 23.1406926f, 3.14159265f, PAL_EPSILON * 10 }, // expected: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - logf_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - } - - logf_test1_validate_isnan(PAL_NEGINF); - logf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/malloc/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/malloc/test1/test1.cpp deleted file mode 100644 index 067791fe8..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/malloc/test1/test1.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Test that malloc returns usable memory -** -** -**==========================================================================*/ - -#include - - -PALTEST(c_runtime_malloc_test1_paltest_malloc_test1, "c_runtime/malloc/test1/paltest_malloc_test1") -{ - - char *testA; - int i; - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* check that malloc really gives us addressable memory */ - testA = (char *)malloc(20 * sizeof(char)); - if (testA == NULL) - { - Fail("Call to malloc failed.\n"); - } - for (i = 0; i < 20; i++) - { - testA[i] = 'a'; - } - for (i = 0; i < 20; i++) - { - if (testA[i] != 'a') - { - Fail("The memory doesn't seem to be properly allocated.\n"); - } - } - free(testA); - - PAL_Terminate(); - - return PASS; -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/malloc/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/malloc/test2/test2.cpp deleted file mode 100644 index 9f94f1050..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/malloc/test2/test2.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test2.c -** -** Purpose: Test that malloc(0) returns non-zero value -** -**==========================================================================*/ - -#include - - -PALTEST(c_runtime_malloc_test2_paltest_malloc_test2, "c_runtime/malloc/test2/paltest_malloc_test2") -{ - - char *testA; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* check that malloc(0) returns non-zero value */ - testA = (char *)malloc(0); - if (testA == NULL) - { - Fail("Call to malloc(0) failed.\n"); - } - - free(testA); - - PAL_Terminate(); - - return PASS; -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/modf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/modf/test1/test1.cpp deleted file mode 100644 index 726e524d0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/modf/test1/test1.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c (modf) -** -** Purpose: Test to ensure that modf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ - double expected_intpart; /* expected result */ - double variance_intpart; /* maximum delta between the expected and actual result */ -}; - -/** - * modf_test1_validate - * - * test validation function - */ -void __cdecl modf_test1_validate(double value, double expected, double variance, double expected_intpart, double variance_intpart) -{ - double result_intpart; - double result = modf(value, &result_intpart); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - double delta_intpart = fabs(result_intpart - expected_intpart); - - if ((delta > variance) || (delta_intpart > variance_intpart)) - { - Fail("modf(%g) returned %20.17g with an intpart of %20.17g when it should have returned %20.17g with an intpart of %20.17g", - value, result, result_intpart, expected, expected_intpart); - } -} - -/** - * modf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl modf_test1_validate_isnan(double value) -{ - double result_intpart; - double result = modf(value, &result_intpart); - - if (!_isnan(result) || !_isnan(result_intpart)) - { - Fail("modf(%g) returned %20.17g with an intpart of %20.17g when it should have returned %20.17g with an intpart of %20.17g", - value, result, result_intpart, PAL_NAN, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_modf_test1_paltest_modf_test1, "c_runtime/modf/test1/paltest_modf_test1") -{ - struct test tests[] = - { - /* value expected variance expected_intpart variance_intpart */ - { 0, 0, PAL_EPSILON, 0, PAL_EPSILON }, - { 0.31830988618379067, 0.31830988618379067, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.43429448190325183, PAL_EPSILON, 0, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.63661977236758134, PAL_EPSILON, 0, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.69314718055994531, PAL_EPSILON, 0, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.70710678118654752, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.78539816339744831, PAL_EPSILON, 0, PAL_EPSILON }, // value: pi / 4 - { 1, 0, PAL_EPSILON, 1, PAL_EPSILON * 10 }, - { 1.1283791670955126, 0.1283791670955126, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 0.4142135623730950, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 0.4426950408889634, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 0.5707963267948966, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 0.3025850929940457, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 0.7182818284590452, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 0.1415926535897932, PAL_EPSILON, 3, PAL_EPSILON * 10 }, // value: pi - { PAL_POSINF, 0, PAL_EPSILON, PAL_POSINF, 0 } - - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - modf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance, tests[i].expected_intpart, tests[i].variance_intpart); - modf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance, -tests[i].expected_intpart, tests[i].variance_intpart); - } - - modf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/modff/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/modff/test1/test1.cpp deleted file mode 100644 index 898566b27..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/modff/test1/test1.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c (modf) -** -** Purpose: Test to ensure that modf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ - float expected_intpart; /* expected result */ - float variance_intpart; /* maximum delta between the expected and actual result */ -}; - -/** - * modff_test1_validate - * - * test validation function - */ -void __cdecl modff_test1_validate(float value, float expected, float variance, float expected_intpart, float variance_intpart) -{ - float result_intpart; - float result = modff(value, &result_intpart); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - float delta_intpart = fabsf(result_intpart - expected_intpart); - - if ((delta > variance) || (delta_intpart > variance_intpart)) - { - Fail("modff(%g) returned %10.9g with an intpart of %10.9g when it should have returned %10.9g with an intpart of %10.9g", - value, result, result_intpart, expected, expected_intpart); - } -} - -/** - * modff_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl modff_test1_validate_isnan(float value) -{ - float result_intpart; - float result = modff(value, &result_intpart); - - if (!_isnan(result) || !_isnan(result_intpart)) - { - Fail("modff(%g) returned %10.9g with an intpart of %10.9g when it should have returned %10.9g with an intpart of %10.9g", - value, result, result_intpart, PAL_NAN, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_modff_test1_paltest_modff_test1, "c_runtime/modff/test1/paltest_modff_test1") -{ - struct test tests[] = - { - /* value expected variance expected_intpart variance_intpart */ - { 0, 0, PAL_EPSILON, 0, PAL_EPSILON }, - { 0.318309886f, 0.318309886f, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.434294482f, PAL_EPSILON, 0, PAL_EPSILON }, // value: log10(e) - { 0.636619772f, 0.636619772f, PAL_EPSILON, 0, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.693147181f, PAL_EPSILON, 0, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.707106781f, PAL_EPSILON, 0, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.785398163f, 0.785398163f, PAL_EPSILON, 0, PAL_EPSILON }, // value: pi / 4 - { 1, 0, PAL_EPSILON, 1, PAL_EPSILON * 10 }, - { 1.12837917f, 0.128379167f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.41421356f, 0.414213562f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.44269504f, 0.442695041f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: log2(e) - { 1.57079633f, 0.570796327f, PAL_EPSILON, 1, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 0.302585093f, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 0.718281828f, PAL_EPSILON, 2, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 0.141592654f, PAL_EPSILON, 3, PAL_EPSILON * 10 }, // value: pi - { PAL_POSINF, 0, PAL_EPSILON, PAL_POSINF, 0 } - - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - modff_test1_validate( tests[i].value, tests[i].expected, tests[i].variance, tests[i].expected_intpart, tests[i].variance_intpart); - modff_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance, -tests[i].expected_intpart, tests[i].variance_intpart); - } - - modff_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp deleted file mode 100644 index 22f482868..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that atan2 returns correct values for a subset of values. -** Tests with positive and negative values of x and y to ensure -** atan2 is returning results from the correct quadrant. -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double x; /* first component of the value to test the function with */ - double y; /* second component of the value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * pow_test1_validate - * - * test validation function - */ -void __cdecl pow_test1_validate(double x, double y, double expected, double variance) -{ - double result = pow(x, y); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("pow(%g, %g) returned %20.17g when it should have returned %20.17g", - x, y, result, expected); - } -} - -/** - * pow_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl pow_test1_validate_isnan(double x, double y) -{ - double result = pow(x, y); - - if (!_isnan(result)) - { - Fail("pow(%g, %g) returned %20.17g when it should have returned %20.17g", - x, y, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_pow_test1_paltest_pow_test1, "c_runtime/pow/test1/paltest_pow_test1") -{ - struct test tests[] = - { - /* x y expected variance */ - { PAL_NEGINF, PAL_NEGINF, 0, PAL_EPSILON }, - { PAL_NEGINF, PAL_POSINF, PAL_POSINF, 0 }, - - { -10, PAL_NEGINF, 0, PAL_EPSILON }, - { -10, -1, -0.1, PAL_EPSILON }, - { -10, 0, 1, PAL_EPSILON * 10 }, - { -10, 1, -10, PAL_EPSILON * 100 }, - { -10, PAL_POSINF, PAL_POSINF, 0 }, - - { -2.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON }, // x: -(e) - { -2.7182818284590452, -1, -0.36787944117144232, PAL_EPSILON }, // x: -(e) - { -2.7182818284590452, 0, 1, PAL_EPSILON * 10 }, // x: -(e) - { -2.7182818284590452, 1, -2.7182818284590452, PAL_EPSILON * 10 }, // x: -(e) expected: e - { -2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e) - - { -1.0, PAL_NEGINF, 1.0, PAL_EPSILON * 10 }, - { -1.0, PAL_POSINF, 1.0, PAL_EPSILON * 10 }, - - { -0.0, PAL_NEGINF, PAL_POSINF, 0 }, - { -0.0, -1, PAL_NEGINF, 0 }, - { -0.0, -0.0, 1, PAL_EPSILON * 10 }, - { -0.0, 0, 1, PAL_EPSILON * 10 }, - { -0.0, 1, -0.0, PAL_EPSILON }, - { -0.0, PAL_POSINF, 0, PAL_EPSILON }, - - { PAL_NAN, -0.0, 1.0, PAL_EPSILON * 10 }, - { PAL_NAN, 0, 1.0, PAL_EPSILON * 10 }, - - { 0.0, PAL_NEGINF, PAL_POSINF, 0 }, - { 0.0, -1, PAL_POSINF, 0 }, - { 0, -0.0, 1, PAL_EPSILON * 10 }, - { 0, 0, 1, PAL_EPSILON * 10 }, - { 0.0, 1, 0, PAL_EPSILON }, - { 0.0, PAL_POSINF, 0, PAL_EPSILON }, - - { 1, PAL_NEGINF, 1, PAL_EPSILON * 10 }, - { 1, PAL_POSINF, 1, PAL_EPSILON * 10 }, - - { 2.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON }, - { 2.7182818284590452, -3.1415926535897932, 0.043213918263772250, PAL_EPSILON / 10 }, // x: e y: -(pi) - { 2.7182818284590452, -2.7182818284590452, 0.065988035845312537, PAL_EPSILON / 10 }, // x: e y: -(e) - { 2.7182818284590452, -2.3025850929940457, 0.1, PAL_EPSILON }, // x: e y: -(ln(10)) - { 2.7182818284590452, -1.5707963267948966, 0.20787957635076191, PAL_EPSILON }, // x: e y: -(pi / 2) - { 2.7182818284590452, -1.4426950408889634, 0.23629008834452270, PAL_EPSILON }, // x: e y: -(log2(e)) - { 2.7182818284590452, -1.4142135623730950, 0.24311673443421421, PAL_EPSILON }, // x: e y: -(sqrt(2)) - { 2.7182818284590452, -1.1283791670955126, 0.32355726390307110, PAL_EPSILON }, // x: e y: -(2 / sqrt(pi)) - { 2.7182818284590452, -1, 0.36787944117144232, PAL_EPSILON }, // x: e y: -(1) - { 2.7182818284590452, -0.78539816339744831, 0.45593812776599624, PAL_EPSILON }, // x: e y: -(pi / 4) - { 2.7182818284590452, -0.70710678118654752, 0.49306869139523979, PAL_EPSILON }, // x: e y: -(1 / sqrt(2)) - { 2.7182818284590452, -0.69314718055994531, 0.5, PAL_EPSILON }, // x: e y: -(ln(2)) - { 2.7182818284590452, -0.63661977236758134, 0.52907780826773535, PAL_EPSILON }, // x: e y: -(2 / pi) - { 2.7182818284590452, -0.43429448190325183, 0.64772148514180065, PAL_EPSILON }, // x: e y: -(log10(e)) - { 2.7182818284590452, -0.31830988618379067, 0.72737734929521647, PAL_EPSILON }, // x: e y: -(1 / pi) - { 2.7182818284590452, 0, 1, PAL_EPSILON * 10 }, // x: e - { 2.7182818284590452, 0.31830988618379067, 1.3748022274393586, PAL_EPSILON * 10 }, // x: e y: 1 / pi - { 2.7182818284590452, 0.43429448190325183, 1.5438734439711811, PAL_EPSILON * 10 }, // x: e y: log10(e) - { 2.7182818284590452, 0.63661977236758134, 1.8900811645722220, PAL_EPSILON * 10 }, // x: e y: 2 / pi - { 2.7182818284590452, 0.69314718055994531, 2, PAL_EPSILON * 10 }, // x: e y: ln(2) - { 2.7182818284590452, 0.70710678118654752, 2.0281149816474725, PAL_EPSILON * 10 }, // x: e y: 1 / sqrt(2) - { 2.7182818284590452, 0.78539816339744831, 2.1932800507380155, PAL_EPSILON * 10 }, // x: e y: pi / 4 - { 2.7182818284590452, 1, 2.7182818284590452, PAL_EPSILON * 10 }, // x: e expected: e - { 2.7182818284590452, 1.1283791670955126, 3.0906430223107976, PAL_EPSILON * 10 }, // x: e y: 2 / sqrt(pi) - { 2.7182818284590452, 1.4142135623730950, 4.1132503787829275, PAL_EPSILON * 10 }, // x: e y: sqrt(2) - { 2.7182818284590452, 1.4426950408889634, 4.2320861065570819, PAL_EPSILON * 10 }, // x: e y: log2(e) - { 2.7182818284590452, 1.5707963267948966, 4.8104773809653517, PAL_EPSILON * 10 }, // x: e y: pi / 2 - { 2.7182818284590452, 2.3025850929940457, 10, PAL_EPSILON * 100 }, // x: e y: ln(10) - { 2.7182818284590452, 2.7182818284590452, 15.154262241479264, PAL_EPSILON * 100 }, // x: e y: e - { 2.7182818284590452, 3.1415926535897932, 23.140692632779269, PAL_EPSILON * 100 }, // x: e y: pi - { 2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: e - - { 10, PAL_NEGINF, 0, 0 }, - { 10, -3.1415926535897932, 0.00072178415907472774, PAL_EPSILON / 1000 }, // y: -(pi) - { 10, -2.7182818284590452, 0.0019130141022243176, PAL_EPSILON / 100 }, // y: -(e) - { 10, -2.3025850929940457, 0.0049821282964407206, PAL_EPSILON / 100 }, // y: -(ln(10)) - { 10, -1.5707963267948966, 0.026866041001136132, PAL_EPSILON / 10 }, // y: -(pi / 2) - { 10, -1.4426950408889634, 0.036083192820787210, PAL_EPSILON / 10 }, // y: -(log2(e)) - { 10, -1.4142135623730950, 0.038528884700322026, PAL_EPSILON / 10 }, // y: -(sqrt(2)) - { 10, -1.1283791670955126, 0.074408205860642723, PAL_EPSILON / 10 }, // y: -(2 / sqrt(pi)) - { 10, -1, 0.1, PAL_EPSILON }, // y: -(1) - { 10, -0.78539816339744831, 0.16390863613957665, PAL_EPSILON }, // y: -(pi / 4) - { 10, -0.70710678118654752, 0.19628775993505562, PAL_EPSILON }, // y: -(1 / sqrt(2)) - { 10, -0.69314718055994531, 0.20269956628651730, PAL_EPSILON }, // y: -(ln(2)) - { 10, -0.63661977236758134, 0.23087676451600055, PAL_EPSILON }, // y: -(2 / pi) - { 10, -0.43429448190325183, 0.36787944117144232, PAL_EPSILON }, // y: -(log10(e)) - { 10, -0.31830988618379067, 0.48049637305186868, PAL_EPSILON }, // y: -(1 / pi) - { 10, 0, 1, PAL_EPSILON * 10 }, - { 10, 0.31830988618379067, 2.0811811619898573, PAL_EPSILON * 10 }, // y: 1 / pi - { 10, 0.43429448190325183, 2.7182818284590452, PAL_EPSILON * 10 }, // y: log10(e) expected: e - { 10, 0.63661977236758134, 4.3313150290214525, PAL_EPSILON * 10 }, // y: 2 / pi - { 10, 0.69314718055994531, 4.9334096679145963, PAL_EPSILON * 10 }, // y: ln(2) - { 10, 0.70710678118654752, 5.0945611704512962, PAL_EPSILON * 10 }, // y: 1 / sqrt(2) - { 10, 0.78539816339744831, 6.1009598002416937, PAL_EPSILON * 10 }, // y: pi / 4 - { 10, 1, 10, PAL_EPSILON * 100 }, - { 10, 1.1283791670955126, 13.439377934644400, PAL_EPSILON * 100 }, // y: 2 / sqrt(pi) - { 10, 1.4142135623730950, 25.954553519470081, PAL_EPSILON * 100 }, // y: sqrt(2) - { 10, 1.4426950408889634, 27.713733786437790, PAL_EPSILON * 100 }, // y: log2(e) - { 10, 1.5707963267948966, 37.221710484165167, PAL_EPSILON * 100 }, // y: pi / 2 - { 10, 2.3025850929940457, 200.71743249053009, PAL_EPSILON * 1000 }, // y: ln(10) - { 10, 2.7182818284590452, 522.73529967043665, PAL_EPSILON * 1000 }, // y: e - { 10, 3.1415926535897932, 1385.4557313670111, PAL_EPSILON * 10000 }, // y: pi - { 10, PAL_POSINF, PAL_POSINF, 0 }, - - { PAL_POSINF, PAL_NEGINF, 0, PAL_EPSILON }, - { PAL_POSINF, PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - pow_test1_validate(tests[i].x, tests[i].y, tests[i].expected, tests[i].variance); - } - - pow_test1_validate_isnan(-10, -1.5707963267948966); // y: -(pi / 2) - pow_test1_validate_isnan(-10, -0.78539816339744828); // y: -(pi / 4) - pow_test1_validate_isnan(-10, 0.78539816339744828); // y: pi / 4 - pow_test1_validate_isnan(-10, 1.5707963267948966); // y: pi / 2 - - pow_test1_validate_isnan(-2.7182818284590452, -1.5707963267948966); // x: -(e) y: -(pi / 2) - pow_test1_validate_isnan(-2.7182818284590452, -0.78539816339744828); // x: -(e) y: -(pi / 4) - pow_test1_validate_isnan(-2.7182818284590452, 0.78539816339744828); // x: -(e) y: pi / 4 - pow_test1_validate_isnan(-2.7182818284590452, 1.5707963267948966); // x: -(e) y: pi / 2 - - pow_test1_validate_isnan(PAL_NEGINF, PAL_NAN); - pow_test1_validate_isnan(PAL_NAN, PAL_NEGINF); - - pow_test1_validate_isnan(PAL_POSINF, PAL_NAN); - pow_test1_validate_isnan(PAL_NAN, PAL_POSINF); - - pow_test1_validate_isnan(PAL_NAN, PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/powf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/powf/test1/test1.cpp deleted file mode 100644 index 5e704f2d5..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/powf/test1/test1.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that atan2f returns correct values for a subset of values. -** Tests with positive and negative values of x and y to ensure -** atan2f is returning results from the correct quadrant. -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float x; /* first component of the value to test the function with */ - float y; /* second component of the value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * powf_test1_validate - * - * test validation function - */ -void __cdecl powf_test1_validate(float x, float y, float expected, float variance) -{ - float result = powf(x, y); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("powf(%g, %g) returned %10.9g when it should have returned %10.9g", - x, y, result, expected); - } -} - -/** - * powf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl powf_test1_validate_isnan(float x, float y) -{ - float result = powf(x, y); - - if (!_isnanf(result)) - { - Fail("powf(%g, %g) returned %10.9g when it should have returned %10.9g", - x, y, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_powf_test1_paltest_powf_test1, "c_runtime/powf/test1/paltest_powf_test1") -{ - struct test tests[] = - { - /* x y expected variance */ - { PAL_NEGINF, PAL_NEGINF, 0, PAL_EPSILON }, - { PAL_NEGINF, PAL_POSINF, PAL_POSINF, 0 }, - - { -10, PAL_NEGINF, 0, PAL_EPSILON }, - { -10, -1, -0.1f, PAL_EPSILON }, - { -10, 0, 1, PAL_EPSILON * 10 }, - { -10, 1, -10, PAL_EPSILON * 100 }, - { -10, PAL_POSINF, PAL_POSINF, 0 }, - - { -2.71828183f, PAL_NEGINF, 0, PAL_EPSILON }, // x: -(e) - { -2.71828183f, -1, -0.367879441f, PAL_EPSILON }, // x: -(e) - { -2.71828183f, 0, 1, PAL_EPSILON * 10 }, // x: -(e) - { -2.71828183f, 1, -2.71828183f, PAL_EPSILON * 10 }, // x: -(e) expected: e - { -2.71828183f, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e) - - { -1.0, PAL_NEGINF, 1.0, PAL_EPSILON * 10 }, - { -1.0, PAL_POSINF, 1.0, PAL_EPSILON * 10 }, - - { -0.0, PAL_NEGINF, PAL_POSINF, 0 }, - { -0.0, -1, PAL_NEGINF, 0 }, - { -0.0f, -0.0f, 1, PAL_EPSILON * 10 }, - { -0.0f, 0, 1, PAL_EPSILON * 10 }, - { -0.0, 1, -0.0, PAL_EPSILON }, - { -0.0, PAL_POSINF, 0, PAL_EPSILON }, - - { PAL_NAN, -0.0, 1.0, PAL_EPSILON * 10 }, - { PAL_NAN, 0, 1.0, PAL_EPSILON * 10 }, - - { 0.0, PAL_NEGINF, PAL_POSINF, 0 }, - { 0.0, -1, PAL_POSINF, 0 }, - { 0, -0.0f, 1, PAL_EPSILON * 10 }, - { 0, 0, 1, PAL_EPSILON * 10 }, - { 0.0, 1, 0, PAL_EPSILON }, - { 0.0, PAL_POSINF, 0, PAL_EPSILON }, - - { 1, PAL_NEGINF, 1, PAL_EPSILON * 10 }, - { 1, PAL_POSINF, 1, PAL_EPSILON * 10 }, - - { 2.71828183f, PAL_NEGINF, 0, PAL_EPSILON }, - { 2.71828183f, -3.14159265f, 0.0432139183f, PAL_EPSILON / 10 }, // x: e y: -(pi) - { 2.71828183f, -2.71828183f, 0.0659880358f, PAL_EPSILON / 10 }, // x: e y: -(e) - { 2.71828183f, -2.30258509f, 0.1f, PAL_EPSILON }, // x: e y: -(ln(10)) - { 2.71828183f, -1.57079633f, 0.207879576f, PAL_EPSILON }, // x: e y: -(pi / 2) - { 2.71828183f, -1.44269504f, 0.236290088f, PAL_EPSILON }, // x: e y: -(logf2(e)) - { 2.71828183f, -1.41421356f, 0.243116734f, PAL_EPSILON }, // x: e y: -(sqrtf(2)) - { 2.71828183f, -1.12837917f, 0.323557264f, PAL_EPSILON }, // x: e y: -(2 / sqrtf(pi)) - { 2.71828183f, -1, 0.367879441f, PAL_EPSILON }, // x: e y: -(1) - { 2.71828183f, -0.785398163f, 0.455938128f, PAL_EPSILON }, // x: e y: -(pi / 4) - { 2.71828183f, -0.707106781f, 0.493068691f, PAL_EPSILON }, // x: e y: -(1 / sqrtf(2)) - { 2.71828183f, -0.693147181f, 0.5f, PAL_EPSILON }, // x: e y: -(ln(2)) - { 2.71828183f, -0.636619772f, 0.529077808f, PAL_EPSILON }, // x: e y: -(2 / pi) - { 2.71828183f, -0.434294482f, 0.647721485f, PAL_EPSILON }, // x: e y: -(log10f(e)) - { 2.71828183f, -0.318309886f, 0.727377349f, PAL_EPSILON }, // x: e y: -(1 / pi) - { 2.71828183f, 0, 1, PAL_EPSILON * 10 }, // x: e - { 2.71828183f, 0.318309886f, 1.37480223f, PAL_EPSILON * 10 }, // x: e y: 1 / pi - { 2.71828183f, 0.434294482f, 1.54387344f, PAL_EPSILON * 10 }, // x: e y: log10f(e) - { 2.71828183f, 0.636619772f, 1.89008116f, PAL_EPSILON * 10 }, // x: e y: 2 / pi - { 2.71828183f, 0.693147181f, 2, PAL_EPSILON * 10 }, // x: e y: ln(2) - { 2.71828183f, 0.707106781f, 2.02811498f, PAL_EPSILON * 10 }, // x: e y: 1 / sqrtf(2) - { 2.71828183f, 0.785398163f, 2.19328005f, PAL_EPSILON * 10 }, // x: e y: pi / 4 - { 2.71828183f, 1, 2.71828183f, PAL_EPSILON * 10 }, // x: e expected: e - { 2.71828183f, 1.12837917f, 3.09064302f, PAL_EPSILON * 10 }, // x: e y: 2 / sqrtf(pi) - { 2.71828183f, 1.41421356f, 4.11325038f, PAL_EPSILON * 10 }, // x: e y: sqrtf(2) - { 2.71828183f, 1.44269504f, 4.23208611f, PAL_EPSILON * 10 }, // x: e y: logf2(e) - { 2.71828183f, 1.57079633f, 4.81047738f, PAL_EPSILON * 10 }, // x: e y: pi / 2 - { 2.71828183f, 2.30258509f, 10, PAL_EPSILON * 100 }, // x: e y: ln(10) - { 2.71828183f, 2.71828183f, 15.1542622f, PAL_EPSILON * 100 }, // x: e y: e - { 2.71828183f, 3.14159265f, 23.1406926f, PAL_EPSILON * 100 }, // x: e y: pi - { 2.71828183f, PAL_POSINF, PAL_POSINF, 0 }, // x: e - - { 10, PAL_NEGINF, 0, 0 }, - { 10, -3.14159265f, 0.000721784159f, PAL_EPSILON / 1000 }, // y: -(pi) - { 10, -2.71828183f, 0.00191301410f, PAL_EPSILON / 100 }, // y: -(e) - { 10, -2.30258509f, 0.00498212830f, PAL_EPSILON / 100 }, // y: -(ln(10)) - { 10, -1.57079633f, 0.0268660410f, PAL_EPSILON / 10 }, // y: -(pi / 2) - { 10, -1.44269504f, 0.0360831928f, PAL_EPSILON / 10 }, // y: -(logf2(e)) - { 10, -1.41421356f, 0.0385288847f, PAL_EPSILON / 10 }, // y: -(sqrtf(2)) - { 10, -1.12837917f, 0.0744082059f, PAL_EPSILON / 10 }, // y: -(2 / sqrtf(pi)) - { 10, -1, 0.1f, PAL_EPSILON }, // y: -(1) - { 10, -0.785398163f, 0.163908636f, PAL_EPSILON }, // y: -(pi / 4) - { 10, -0.707106781f, 0.196287760f, PAL_EPSILON }, // y: -(1 / sqrtf(2)) - { 10, -0.693147181f, 0.202699566f, PAL_EPSILON }, // y: -(ln(2)) - { 10, -0.636619772f, 0.230876765f, PAL_EPSILON }, // y: -(2 / pi) - { 10, -0.434294482f, 0.367879441f, PAL_EPSILON }, // y: -(log10f(e)) - { 10, -0.318309886f, 0.480496373f, PAL_EPSILON }, // y: -(1 / pi) - { 10, 0, 1, PAL_EPSILON * 10 }, - { 10, 0.318309886f, 2.08118116f, PAL_EPSILON * 10 }, // y: 1 / pi - { 10, 0.434294482f, 2.71828183f, PAL_EPSILON * 10 }, // y: log10f(e) expected: e - { 10, 0.636619772f, 4.33131503f, PAL_EPSILON * 10 }, // y: 2 / pi - { 10, 0.693147181f, 4.93340967f, PAL_EPSILON * 10 }, // y: ln(2) - { 10, 0.707106781f, 5.09456117f, PAL_EPSILON * 10 }, // y: 1 / sqrtf(2) - { 10, 0.785398163f, 6.10095980f, PAL_EPSILON * 10 }, // y: pi / 4 - { 10, 1, 10, PAL_EPSILON * 100 }, - { 10, 1.12837917f, 13.4393779f, PAL_EPSILON * 100 }, // y: 2 / sqrtf(pi) - { 10, 1.41421356f, 25.9545535f, PAL_EPSILON * 100 }, // y: sqrtf(2) - { 10, 1.44269504f, 27.7137338f, PAL_EPSILON * 100 }, // y: logf2(e) - { 10, 1.57079633f, 37.2217105f, PAL_EPSILON * 100 }, // y: pi / 2 - { 10, 2.30258509f, 200.717432f, PAL_EPSILON * 1000 }, // y: ln(10) - { 10, 2.71828183f, 522.735300f, PAL_EPSILON * 1000 }, // y: e - { 10, 3.14159265f, 1385.45573f, PAL_EPSILON * 10000 }, // y: pi - { 10, PAL_POSINF, PAL_POSINF, 0 }, - - { PAL_POSINF, PAL_NEGINF, 0, PAL_EPSILON }, - { PAL_POSINF, PAL_POSINF, PAL_POSINF, 0 }, - }; - - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - powf_test1_validate(tests[i].x, tests[i].y, tests[i].expected, tests[i].variance); - } - - powf_test1_validate_isnan(-10, -1.57079633f); // y: -(pi / 2) - powf_test1_validate_isnan(-10, -0.785398163f); // y: -(pi / 4) - powf_test1_validate_isnan(-10, 0.785398163f); // y: pi / 4 - powf_test1_validate_isnan(-10, 1.57079633f); // y: pi / 2 - - powf_test1_validate_isnan(-2.71828183f, -1.57079633f); // x: -(e) y: -(pi / 2) - powf_test1_validate_isnan(-2.71828183f, -0.785398163f); // x: -(e) y: -(pi / 4) - powf_test1_validate_isnan(-2.71828183f, 0.785398163f); // x: -(e) y: pi / 4 - powf_test1_validate_isnan(-2.71828183f, 1.57079633f); // x: -(e) y: pi / 2 - - powf_test1_validate_isnan(PAL_NEGINF, PAL_NAN); - powf_test1_validate_isnan(PAL_NAN, PAL_NEGINF); - - powf_test1_validate_isnan(PAL_POSINF, PAL_NAN); - powf_test1_validate_isnan(PAL_NAN, PAL_POSINF); - - powf_test1_validate_isnan(PAL_NAN, PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/qsort/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/qsort/test1/test1.cpp deleted file mode 100644 index 57b288a80..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/qsort/test1/test1.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Calls qsort to sort a buffer, and verifies that it has done -** the job correctly. -** -** -**==========================================================================*/ - -#include - -int __cdecl charcmp_qsort_test1(const void *pa, const void *pb) -{ - return memcmp(pa, pb, 1); -} - -PALTEST(c_runtime_qsort_test1_paltest_qsort_test1, "c_runtime/qsort/test1/paltest_qsort_test1") -{ - char before[] = "cgaiehdbjf"; - const char after[] = "abcdefghij"; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - qsort(before, sizeof(before) - 1, sizeof(char), charcmp_qsort_test1); - - if (memcmp(before, after, sizeof(before)) != 0) - { - Fail("qsort did not correctly sort an array of characters.\n"); - } - - PAL_Terminate(); - return PASS; - -} - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/qsort/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/qsort/test2/test2.cpp deleted file mode 100644 index 20d76c567..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/qsort/test2/test2.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test2.c -** -** Purpose: Calls qsort to sort a buffer, and verifies that it has done -** the job correctly. -** -** -**==========================================================================*/ - -#include - -int __cdecl twocharcmp_qsort_test2(const void *pa, const void *pb) -{ - return memcmp(pa, pb, 2); -} - -PALTEST(c_runtime_qsort_test2_paltest_qsort_test2, "c_runtime/qsort/test2/paltest_qsort_test2") -{ - char before[] = "ccggaaiieehhddbbjjff"; - const char after[] = "aabbccddeeffgghhiijj"; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - qsort(before, (sizeof(before) - 1) / 2, 2 * sizeof(char), twocharcmp_qsort_test2); - - if (memcmp(before, after, sizeof(before)) != 0) - { - Fail("qsort did not correctly sort an array of 2-character " - "buffers.\n"); - } - - PAL_Terminate(); - return PASS; - -} - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.cpp deleted file mode 100644 index cd752c39f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/rand_srand/test1/test1.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that srand provide random -** number to rand. Also make sure that rand result from a -** srand with seed 1 and no call to srand are the same. -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** srand() -** - -** -**===========================================================================*/ - -#include - - -PALTEST(c_runtime_rand_srand_test1_paltest_rand_srand_test1, "c_runtime/rand_srand/test1/paltest_rand_srand_test1") -{ - int RandNumber[10]; - int TempRandNumber; - int i; - int SRAND_SEED; - int SRAND_REINIT = 1; - - /* - * Initialize the PAL and return FAILURE if this fails - */ - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - SRAND_SEED = time(NULL); - - /* does not initialize srand and call rand. */ - for (i=0; i<10; i++) - { - /* keep the value in an array */ - RandNumber[i]=rand(); - if (RandNumber[i] < 0 || RandNumber[i] > RAND_MAX) - { - Fail("1) ERROR: random generated an invalid value: %d", RandNumber[i]); - } - } - - - /* initialize random generator */ - srand(SRAND_SEED); - - - /* choose 10 numbers with a different seed. - the numbers should be different than - those the previously generated one */ - for(i = 0; i < 10; i++) - { - TempRandNumber=rand(); - if (TempRandNumber < 0 || TempRandNumber > RAND_MAX) - { - Fail("2) ERROR: random generated an invalid value: %d", TempRandNumber); - } - } - - - - /* renitialize the srand with 1 */ - srand(SRAND_REINIT); - - - - /* choose 10 numbers with seed 1, - the number should be the same as those we kept in the array. */ - for( i = 0; i < 10;i++ ) - { - /* pick the random number*/ - TempRandNumber=rand(); - /* test if it is the same number generated in the first sequences*/ - if(RandNumber[i]!=TempRandNumber) - { - Fail ("ERROR: rand should return the same value when srand " - "is initialized with 1 or not initialized at all"); - } - if (TempRandNumber < 0 || TempRandNumber > RAND_MAX) - { - Fail("3) ERROR: random generated an invalid value: %d", TempRandNumber); - } - } - - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/realloc/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/realloc/test1/test1.cpp deleted file mode 100644 index edd075da2..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/realloc/test1/test1.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Uses realloc to allocate and realloate memory, checking -** that memory contents are copied when the memory is reallocated. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_realloc_test1_paltest_realloc_test1, "c_runtime/realloc/test1/paltest_realloc_test1") -{ - char *testA; - const int len1 = 10; - const char str1[] = "aaaaaaaaaa"; - - const int len2 = 20; - const char str2[] = "bbbbbbbbbbbbbbbbbbbb"; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* this should work like malloc */ - testA = (char *)realloc(NULL, len1*sizeof(char)); - memcpy(testA, str1, len1); - if (testA == NULL) - { - Fail("We ran out of memory (unlikely), or realloc is broken.\n"); - } - - if (memcmp(testA, str1, len1) != 0) - { - Fail("realloc doesn't properly allocate new memory.\n"); - } - - testA = (char *)realloc(testA, len2*sizeof(char)); - if (memcmp(testA, str1, len1) != 0) - { - Fail("realloc doesn't move the contents of the original memory " - "block to the newly allocated block.\n"); - } - - memcpy(testA, str2, len2); - if (memcmp(testA, str2, len2) != 0) - { - Fail("Couldn't write to memory allocated by realloc.\n"); - } - - /* free the buffer */ - testA = (char*)realloc(testA, 0); - if (testA != NULL) - { - Fail("Realloc didn't return NULL when called with a length " - "of zero.\n"); - } - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sin/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sin/test1/test1.cpp deleted file mode 100644 index bcfeb4baa..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sin/test1/test1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that sin return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * sin_test1_validate - * - * test validation function - */ -void __cdecl sin_test1_validate(double value, double expected, double variance) -{ - double result = sin(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("sin(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * sin_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sin_test1_validate_isnan(double value) -{ - double result = sin(value); - - if (!_isnan(result)) - { - Fail("sin(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_sin_test1_paltest_sin_test1, "c_runtime/sin/test1/paltest_sin_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.31830988618379067, 0.31296179620778659, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.42077048331375735, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.59448076852482208, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.63896127631363480, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.64963693908006244, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.70710678118654752, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrt(2) - { 1, 0.84147098480789651, PAL_EPSILON }, - { 1.1283791670955126, 0.90371945743584630, PAL_EPSILON }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 0.98776594599273553, PAL_EPSILON }, // value: sqrt(2) - { 1.4426950408889634, 0.99180624439366372, PAL_EPSILON }, // value: log2(e) - { 1.5707963267948966, 1, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 0.74398033695749319, PAL_EPSILON }, // value: ln(10) - { 2.7182818284590452, 0.41078129050290870, PAL_EPSILON }, // value: e - { 3.1415926535897932, 0, PAL_EPSILON }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sin_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - sin_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - sin_test1_validate_isnan(PAL_NEGINF); - sin_test1_validate_isnan(PAL_NAN); - sin_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sincos/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sincos/test1/test1.cpp deleted file mode 100644 index e2734652a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sincos/test1/test1.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that sincos return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected_sin; /* expected sin result */ - double expected_cos; /* expected cos result */ - double variance_sin; /* maximum delta between the expected and actual sin result */ - double variance_cos; /* maximum delta between the expected and actual cos result */ -}; - -/** - * sincos_test1_validate - * - * test validation function - */ -void __cdecl sincos_test1_validate(double value, double expected_sin, double expected_cos, double variance_sin, double variance_cos) -{ - double result_sin, result_cos; - sincos(value, &result_sin, &result_cos); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta_sin = fabs(result_sin - expected_sin); - double delta_cos = fabs(result_cos - expected_cos); - - if ((delta_sin > variance_sin) || (delta_cos > variance_cos)) - { - Fail("sincos(%g) returned (%20.17g, %20.17g) when it should have returned (%20.17g, %20.17g)", - value, result_sin, result_cos, expected_sin, expected_cos); - } -} - -/** - * sincos_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sincos_test1_validate_isnan(double value) -{ - double result_sin, result_cos; - sincos(value, &result_sin, &result_cos); - - if (!_isnan(result_sin) || !_isnan(result_cos)) - { - Fail("sincos(%g) returned (%20.17g, %20.17g) when it should have returned (%20.17g, %20.17g)", - value, result_sin, result_cos, PAL_NAN, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_sincos_test1_paltest_sincos_test1, "c_runtime/sincos/test1/paltest_sincos_test1") -{ - struct test tests[] = - { - /* value expected_sin expected_cos variance_sin variance_cos */ - { 0, 0, 1, PAL_EPSILON, PAL_EPSILON * 10 }, - { 0.31830988618379067, 0.31296179620778659, 0.94976571538163866, PAL_EPSILON, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.42077048331375735, 0.90716712923909839, PAL_EPSILON, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.59448076852482208, 0.80410982822879171, PAL_EPSILON, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.63896127631363480, 0.76923890136397213, PAL_EPSILON, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.64963693908006244, 0.76024459707563015, PAL_EPSILON, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.70710678118654752, 0.70710678118654752, PAL_EPSILON, PAL_EPSILON }, // value: pi / 4, expected_sin: 1 / sqrtf(2), expected_cos: 1 - { 1, 0.84147098480789651, 0.54030230586813972, PAL_EPSILON, PAL_EPSILON }, - { 1.1283791670955126, 0.90371945743584630, 0.42812514788535792, PAL_EPSILON, PAL_EPSILON }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 0.98776594599273553, 0.15594369476537447, PAL_EPSILON, PAL_EPSILON }, // value: sqrt(2) - { 1.4426950408889634, 0.99180624439366372, 0.12775121753523991, PAL_EPSILON, PAL_EPSILON }, // value: log2(e) - { 1.5707963267948966, 1, 0, PAL_EPSILON * 10, PAL_EPSILON }, // value: pi / 2 - { 2.3025850929940457, 0.74398033695749319, -0.66820151019031295, PAL_EPSILON, PAL_EPSILON }, // value: ln(10) - { 2.7182818284590452, 0.41078129050290870, -0.91173391478696510, PAL_EPSILON, PAL_EPSILON }, // value: e - { 3.1415926535897932, 0, -1, PAL_EPSILON, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sincos_test1_validate( tests[i].value, tests[i].expected_sin, tests[i].expected_cos, tests[i].variance_sin, tests[i].variance_cos); - sincos_test1_validate(-tests[i].value, -tests[i].expected_sin, tests[i].expected_cos, tests[i].variance_sin, tests[i].variance_cos); - } - - sincos_test1_validate_isnan(PAL_NEGINF); - sincos_test1_validate_isnan(PAL_NAN); - sincos_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sincosf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sincosf/test1/test1.cpp deleted file mode 100644 index 7332309e3..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sincosf/test1/test1.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that sincosf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected_sin; /* expected sin result */ - float expected_cos; /* expected cos result */ - float variance_sin; /* maximum delta between the expected and actual sin result */ - float variance_cos; /* maximum delta between the expected and actual cos result */ -}; - -/** - * sincosf_test1_validate - * - * test validation function - */ -void __cdecl sincosf_test1_validate(float value, float expected_sin, float expected_cos, float variance_sin, float variance_cos) -{ - float result_sin, result_cos; - sincosf(value, &result_sin, &result_cos); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta_sin = fabsf(result_sin - expected_sin); - float delta_cos = fabsf(result_cos - expected_cos); - - if ((delta_sin > variance_sin) || (delta_cos > variance_cos)) - { - Fail("sincosf(%g) returned (%10.9g, %10.9g) when it should have returned (%10.9g, %10.9g)", - value, result_sin, result_cos, expected_sin, expected_cos); - } -} - -/** - * sincosf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sincosf_test1_validate_isnan(float value) -{ - float result_sin, result_cos; - sincosf(value, &result_sin, &result_cos); - - if (!_isnanf(result_sin) || !_isnanf(result_cos)) - { - Fail("sincosf(%g) returned (%10.9g, %10.9g) when it should have returned (%10.9g, %10.9g)", - value, result_sin, result_cos, PAL_NAN, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_sincosf_test1_paltest_sincosf_test1, "c_runtime/sincosf/test1/paltest_sincosf_test1") -{ - struct test tests[] = - { - /* value expected_sin expected_cos variance_sin variance_cos */ - { 0, 0, 1, PAL_EPSILON, PAL_EPSILON * 10 }, - { 0.318309886f, 0.312961796f, 0.949765715f, PAL_EPSILON, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.420770483f, 0.907167129f, PAL_EPSILON, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.594480769f, 0.804109828f, PAL_EPSILON, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.638961276f, 0.769238901f, PAL_EPSILON, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.649636939f, 0.760244597f, PAL_EPSILON, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.707106781f, 0.707106781f, PAL_EPSILON, PAL_EPSILON }, // value: pi / 4, expected_sin: 1 / sqrtf(2), expected_cos: 1 - { 1, 0.841470985f, 0.540302306f, PAL_EPSILON, PAL_EPSILON }, - { 1.12837917f, 0.903719457f, 0.428125148f, PAL_EPSILON, PAL_EPSILON }, // value: 2 / sqrtf(pi) - { 1.41421356f, 0.987765946f, 0.155943695f, PAL_EPSILON, PAL_EPSILON }, // value: sqrtf(2) - { 1.44269504f, 0.991806244f, 0.127751218f, PAL_EPSILON, PAL_EPSILON }, // value: logf2(e) - { 1.57079633f, 1, 0, PAL_EPSILON * 10, PAL_EPSILON }, // value: pi / 2 - { 2.30258509f, 0.743980337f, -0.668201510f, PAL_EPSILON, PAL_EPSILON }, // value: ln(10) - { 2.71828183f, 0.410781291f, -0.911733918f, PAL_EPSILON, PAL_EPSILON }, // value: e - { 3.14159265f, 0, -1, PAL_EPSILON, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sincosf_test1_validate( tests[i].value, tests[i].expected_sin, tests[i].expected_cos, tests[i].variance_sin, tests[i].variance_cos); - sincosf_test1_validate(-tests[i].value, -tests[i].expected_sin, tests[i].expected_cos, tests[i].variance_sin, tests[i].variance_cos); - } - - sincosf_test1_validate_isnan(PAL_NEGINF); - sincosf_test1_validate_isnan(PAL_NAN); - sincosf_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinf/test1/test1.cpp deleted file mode 100644 index 1481843fe..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinf/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that sinf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * sinf_test1_validate - * - * test validation function - */ -void __cdecl sinf_test1_validate(float value, float expected, float variance) -{ - float result = sinf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("sinf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * sinf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sinf_test1_validate_isnan(float value) -{ - float result = sinf(value); - - if (!_isnanf(result)) - { - Fail("sinf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_sinf_test1_paltest_sinf_test1, "c_runtime/sinf/test1/paltest_sinf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.318309886f, 0.312961796f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.420770483f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.594480769f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.638961276f, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.649636939f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.707106781f, PAL_EPSILON }, // value: pi / 4, expected: 1 / sqrtf(2) - { 1, 0.841470985f, PAL_EPSILON }, - { 1.12837917f, 0.903719457f, PAL_EPSILON }, // value: 2 / sqrtf(pi) - { 1.41421356f, 0.987765946f, PAL_EPSILON }, // value: sqrtf(2) - { 1.44269504f, 0.991806244f, PAL_EPSILON }, // value: logf2(e) - { 1.57079633f, 1, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 0.743980337f, PAL_EPSILON }, // value: ln(10) - { 2.71828183f, 0.410781291f, PAL_EPSILON }, // value: e - { 3.14159265f, 0, PAL_EPSILON }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sinf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - sinf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - sinf_test1_validate_isnan(PAL_NEGINF); - sinf_test1_validate_isnan(PAL_NAN); - sinf_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinh/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinh/test1/test1.cpp deleted file mode 100644 index 2879bf16a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinh/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that sinh return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * sinh_test1_validate - * - * test validation function - */ -void __cdecl sinh_test1_validate(double value, double expected, double variance) -{ - double result = sinh(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("sinh(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * sinh_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sinh_test1_validate_isnan(double value) -{ - double result = sinh(value); - - if (!_isnan(result)) - { - Fail("sinh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_sinh_test1_paltest_sinh_test1, "c_runtime/sinh/test1/paltest_sinh_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.31830988618379067, 0.32371243907207108, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.44807597941469025, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.68050167815224332, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.75, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.76752314512611633, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.86867096148600961, PAL_EPSILON }, // value: pi / 4 - { 1, 1.1752011936438015, PAL_EPSILON * 10 }, - { 1.1283791670955126, 1.3835428792038633, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 1.9350668221743567, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 1.9978980091062796, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 2.3012989023072949, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 4.95, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 7.5441371028169758, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 11.548739357257748, PAL_EPSILON * 100 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sinh_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - sinh_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - sinh_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinhf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinhf/test1/test1.cpp deleted file mode 100644 index a67ab96a4..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sinhf/test1/test1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that sinhf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * sinhf_test1_validate - * - * test validation function - */ -void __cdecl sinhf_test1_validate(float value, float expected, float variance) -{ - float result = sinhf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("sinhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * sinhf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sinhf_test1_validate_isnan(float value) -{ - float result = sinhf(value); - - if (!_isnanf(result)) - { - Fail("sinhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_sinhf_test1_paltest_sinhf_test1, "c_runtime/sinhf/test1/paltest_sinhf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.318309886f, 0.323712439f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.448075979f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.680501678f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.75, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.767523145f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.868670961f, PAL_EPSILON }, // value: pi / 4 - { 1, 1.17520119f, PAL_EPSILON * 10 }, - { 1.12837917f, 1.38354288f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 1.93506682f, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 1.99789801f, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 2.30129890f, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 4.95f, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 7.54413710f, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 11.5487394f, PAL_EPSILON * 100 }, // value: pi - { PAL_POSINF, PAL_POSINF, 0 }, - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sinhf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - sinhf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - sinhf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sqrt/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sqrt/test1/test1.cpp deleted file mode 100644 index f61e51111..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sqrt/test1/test1.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Call the sqrt function on a positive value, a positive value -** with a decimal and on the maximum possible double value. -** -** -**===================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * sqrt_test1_validate - * - * test validation function - */ -void __cdecl sqrt_test1_validate(double value, double expected, double variance) -{ - double result = sqrt(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("sqrt(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * sqrt_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sqrt_test1_validate_isnan(double value) -{ - double result = sqrt(value); - - if (!_isnan(result)) - { - Fail("sqrt(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -PALTEST(c_runtime_sqrt_test1_paltest_sqrt_test1, "c_runtime/sqrt/test1/paltest_sqrt_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.31830988618379067, 0.56418958354775629, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.65901022898226081, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.79788456080286536, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.83255461115769776, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.84089641525371454, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.88622692545275801, PAL_EPSILON }, // value: pi / 4 - { 1, 1, PAL_EPSILON * 10 }, - { 1.1283791670955126, 1.0622519320271969, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 1.1892071150027211, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 1.2011224087864498, PAL_EPSILON * 10 }, // value: log2(e) - { 1.5707963267948966, 1.2533141373155003, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.3025850929940457, 1.5174271293851464, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, 1.6487212707001281, PAL_EPSILON * 10 }, // value: e - { 3.1415926535897932, 1.7724538509055160, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - sqrt_test1_validate(-0.0, -0.0, PAL_EPSILON); - sqrt_test1_validate( 0.0, 0.0, PAL_EPSILON); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sqrt_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - sqrt_test1_validate_isnan(-tests[i].value); - } - - sqrt_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sqrtf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sqrtf/test1/test1.cpp deleted file mode 100644 index 821ae4275..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/sqrtf/test1/test1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Call the sqrtf function on a positive value, a positive value -** with a decimal and on the maximum possible float value. -** -** -**===================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * sqrtf_test1_validate - * - * test validation function - */ -void __cdecl sqrtf_test1_validate(float value, float expected, float variance) -{ - float result = sqrtf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("sqrtf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * sqrtf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl sqrtf_test1_validate_isnan(float value) -{ - float result = sqrtf(value); - - if (!_isnanf(result)) - { - Fail("sqrtf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -PALTEST(c_runtime_sqrtf_test1_paltest_sqrtf_test1, "c_runtime/sqrtf/test1/paltest_sqrtf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0.318309886f, 0.564189584f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.659010229f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.797884561f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.832554611f, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.840896415f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.886226925f, PAL_EPSILON }, // value: pi / 4 - { 1, 1, PAL_EPSILON * 10 }, - { 1.12837917f, 1.06225193f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 1.18920712f, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 1.20112241f, PAL_EPSILON * 10 }, // value: logf2(e) - { 1.57079633f, 1.25331414f, PAL_EPSILON * 10 }, // value: pi / 2 - { 2.30258509f, 1.51742713f, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, 1.64872127f, PAL_EPSILON * 10 }, // value: e - { 3.14159265f, 1.77245385F, PAL_EPSILON * 10 }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - sqrtf_test1_validate(-0.0f, -0.0f, PAL_EPSILON); - sqrtf_test1_validate( 0.0f, 0.0f, PAL_EPSILON); - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - sqrtf_test1_validate(tests[i].value, tests[i].expected, tests[i].variance); - sqrtf_test1_validate_isnan(-tests[i].value); - } - - sqrtf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strchr/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strchr/test1/test1.cpp index 44d0b6053..0c706b8b5 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strchr/test1/test1.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strchr/test1/test1.cpp @@ -62,7 +62,7 @@ PALTEST(c_runtime_strchr_test1_paltest_strchr_test1, "c_runtime/strchr/test1/pal result = strchr(testCases[i].string,testCases[i].character); if (result==NULL) { - if (testCases[i].result != (int) NULL) + if (testCases[i].result != 0) { Fail("Expected strchr() to return \"%s\" instead of NULL!\n", testCases[i].string + testCases[i].result); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtod/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtod/test1/test1.cpp deleted file mode 100644 index d5b6d0a66..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtod/test1/test1.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests the PAL implementation of the strtod function. -** Convert a number of strings to doubles. Ensure they -** convert correctly. -** -** -**===================================================================*/ - -#include - - -struct testCase -{ - double CorrectResult; /* The returned double value */ - char ResultString[20]; /* The remainder string */ - char string[20]; /* The test string */ -}; - - -PALTEST(c_runtime_strtod_test1_paltest_strtod_test1, "c_runtime/strtod/test1/paltest_strtod_test1") -{ - - char * endptr; - double result; - int i; - - struct testCase testCases[] = - { - {1234,"","1234"}, - {-1234,"","-1234"}, - {1234.44,"","1234.44"}, - {1234e-5,"","1234e-5"}, - {1234e+5,"","1234e+5"}, - {12345E5,"","12345e5"}, - {1234.657e-8,"","1234.657e-8"}, - {1234567e-8,"foo","1234567e-8foo"}, - {999,"foo","999 foo"}, - {7,"foo"," 7foo"}, - {0,"a7","a7"}, - {-777777,"z zz","-777777z zz"} - }; - - /* - * Initialize the PAL - */ - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Loop through the structure to test each case */ - for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) - { - result = strtod(testCases[i].string,&endptr); - - /* need to check the result and the endptr result */ - if ((testCases[i].CorrectResult != result) && - (strcmp(testCases[i].ResultString,endptr)!=0)) - { - Fail("ERROR: strtod returned %f instead of %f and " - "\"%s\" instead of \"%s\" for the test of \"%s\"\n", - result, - testCases[i].CorrectResult, - endptr, - testCases[i].ResultString, - testCases[i].string); - } - - } - - PAL_Terminate(); - return PASS; -} - - - - - - - - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtod/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtod/test2/test2.cpp deleted file mode 100644 index 038bbe07a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtod/test2/test2.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Tests strtod with overflows -** -** -**===================================================================*/ - -#include - -PALTEST(c_runtime_strtod_test2_paltest_strtod_test2, "c_runtime/strtod/test2/paltest_strtod_test2") -{ - /* Representation of positive infinty for a IEEE 64-bit double */ - INT64 PosInifity = (INT64)(0x7ff00000) << 32; - double HugeVal = *(double*) &PosInifity; - char *PosStr = "1E+10000"; - char *NegStr = "-1E+10000"; - double result; - - - if (PAL_Initialize(argc,argv)) - { - return FAIL; - } - - result = strtod(PosStr, NULL); - - if (result != HugeVal) - { - Fail("ERROR: wcstod interpreted \"%s\" as %g instead of %g\n", - PosStr, result, HugeVal); - } - - result = strtod(NegStr, NULL); - - if (result != -HugeVal) - { - Fail("ERROR: wcstod interpreted \"%s\" as %g instead of %g\n", - NegStr, result, -HugeVal); - } - - PAL_Terminate(); - - return PASS; -} - - - - - - - - - - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp deleted file mode 100644 index 6eca5728a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: -** Search for a number of tokens within strings. Check that the return values -** are what is expect, and also that the strings match up with our expected -** results. -** -** -**==========================================================================*/ - -#include - - -PALTEST(c_runtime_strtok_test1_paltest_strtok_test1, "c_runtime/strtok/test1/paltest_strtok_test1") -{ - char str[] = "foo bar baz"; - char *result1= "foo \0ar baz"; - char *result2= "foo \0a\0 baz"; - int len = strlen(str) + 1; - char *ptr; - - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - ptr = strtok(str, "bz"); - if (ptr != str) - { - Fail("Expected strtok() to return %p, got %p!\n", str, ptr); - } - if (memcmp(str, result1, len) != 0) - { - Fail("strtok altered the string in an unexpected way!\n"); - } - - ptr = strtok(NULL, "r "); - if (ptr != str + 5) - { - Fail("Expected strtok() to return %p, got %p!\n", str+5, ptr); - } - if (memcmp(str, result2, len) != 0) - { - Fail("strtok altered the string in an unexpected way!\n"); - } - - - ptr = strtok(NULL, "X"); - if (ptr != str + 7) - { - Fail("Expected strtok() to return %p, got %p!\n", str + 7, ptr); - } - if (memcmp(str, result2, len) != 0) - { - Fail("strtok altered the string in an unexpected way!\n"); - } - - ptr = strtok(NULL, "X"); - if (ptr != NULL) - { - Fail("Expected strtok() to return %p, got %p!\n", NULL, ptr); - } - if (memcmp(str, result2, len) != 0) - { - Fail("strtok altered the string in an unexpected way!\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtoul/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtoul/test1/test1.cpp deleted file mode 100644 index c18b550d1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/strtoul/test1/test1.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: -** Tests stroul with different bases and overflows, as well as valid input. -** Makes sure that the end pointer is correct. -** -** -**==========================================================================*/ - -#include - -char teststr1[] = "12345"; -char teststr2[] = "Z"; -char teststr3[] = "4294967295"; -char teststr4[] = "4294967296"; - -typedef struct -{ - char *str; - char *end; - int base; - ULONG result; -} TestCase; - -PALTEST(c_runtime_strtoul_test1_paltest_strtoul_test1, "c_runtime/strtoul/test1/paltest_strtoul_test1") -{ - TestCase TestCases[] = - { - { teststr1, teststr1 + 3, 4, 27}, - { teststr1, teststr1 + 5, 10, 12345}, - { teststr2, teststr2, 10, 0}, - { teststr3, teststr3+10, 10, 4294967295ul}, - { teststr4, teststr4+10, 10, 4294967295ul} - }; - - int NumCases = sizeof(TestCases) / sizeof(TestCases[0]); - - char *end; - ULONG l; - int i; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - for (i=0; i - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * tan_test1_validate - * - * test validation function - */ -void __cdecl tan_test1_validate(double value, double expected, double variance) -{ - double result = tan(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("tan(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * tan_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl tan_test1_validate_isnan(double value) -{ - double result = tan(value); - - if (!_isnan(result)) - { - Fail("tan(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_tan_test1_paltest_tan_test1, "c_runtime/tan/test1/paltest_tan_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.31830988618379067, 0.32951473309607836, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.46382906716062964, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.73930295048660405, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.83064087786078395, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.85451043200960189, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 1, PAL_EPSILON * 10 }, // value: pi / 4 - { 1, 1.5574077246549022, PAL_EPSILON * 10 }, - { 1.1283791670955126, 2.1108768356626451, PAL_EPSILON * 10 }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 6.3341191670421916, PAL_EPSILON * 10 }, // value: sqrt(2) - { 1.4426950408889634, 7.7635756709721848, PAL_EPSILON * 10 }, // value: log2(e) - // SEE BELOW -- { 1.5707963267948966, PAL_POSINF, 0 }, // value: pi / 2 - { 2.3025850929940457, -1.1134071468135374, PAL_EPSILON * 10 }, // value: ln(10) - { 2.7182818284590452, -0.45054953406980750, PAL_EPSILON }, // value: e - { 3.1415926535897932, 0, PAL_EPSILON }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - tan_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - tan_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - // -- SPECIAL CASE -- - // Normally, tan(pi / 2) would return PAL_POSINF (atan2(PAL_POSINF) does return (pi / 2)). - // However, it seems instead (on all supported systems), we get a different number entirely. - tan_test1_validate( 1.5707963267948966, 16331239353195370.0, 0); - tan_test1_validate(-1.5707963267948966, -16331239353195370.0, 0); - - tan_test1_validate_isnan(PAL_NEGINF); - tan_test1_validate_isnan(PAL_NAN); - tan_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanf/test1/test1.cpp deleted file mode 100644 index 2f7358cc2..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanf/test1/test1.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that tanf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * tanf_test1_validate - * - * test validation function - */ -void __cdecl tanf_test1_validate(float value, float expected, float variance) -{ - float result = tanf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("tanf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * tanf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl tanf_test1_validate_isnan(float value) -{ - float result = tanf(value); - - if (!_isnanf(result)) - { - Fail("tanf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_tanf_test1_paltest_tanf_test1, "c_runtime/tanf/test1/paltest_tanf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.318309886f, 0.329514733f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.463829067f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.739302950f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.830640878f, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.854510432f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 1, PAL_EPSILON * 10 }, // value: pi / 4 - { 1, 1.55740772f, PAL_EPSILON * 10 }, - { 1.12837917f, 2.11087684f, PAL_EPSILON * 10 }, // value: 2 / sqrtf(pi) - { 1.41421356f, 6.33411917f, PAL_EPSILON * 10 }, // value: sqrtf(2) - { 1.44269504f, 7.76357567f, PAL_EPSILON * 10 }, // value: logf2(e) - // SEE BELOW -- { 1.57079633f, PAL_POSINF, 0 }, // value: pi / 2 - { 2.30258509f, -1.11340715f, PAL_EPSILON * 10 }, // value: ln(10) - { 2.71828183f, -0.450549534f, PAL_EPSILON }, // value: e - { 3.14159265f, 0, PAL_EPSILON }, // value: pi - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - tanf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - tanf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - // -- SPECIAL CASE -- - // Normally, tanf(pi / 2) would return PAL_POSINF (atan2f(PAL_POSINF) does return (pi / 2)). - // However, it seems instead (on all supported systems), we get a different number entirely. - tanf_test1_validate( 1.57079633f, -22877332.0, PAL_EPSILON * 100000000); - tanf_test1_validate(-1.57079633f, 22877332.0, PAL_EPSILON * 100000000); - - tanf_test1_validate_isnan(PAL_NEGINF); - tanf_test1_validate_isnan(PAL_NAN); - tanf_test1_validate_isnan(PAL_POSINF); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanh/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanh/test1/test1.cpp deleted file mode 100644 index a2df38858..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanh/test1/test1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that tanh return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary64 (double) has a machine epsilon of 2^-52 (approx. 2.22e-16). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-50 (approx. 8.88e-16) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (15-17 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxxxxxxxxxx will use -// PAL_EPSILON for the variance, while an expected result in the format of 0.0xxxxxxxxxxxxxxxxx -// will use PAL_EPSILON / 10 and and expected result in the format of x.xxxxxxxxxxxxxxxx will -// use PAL_EPSILON * 10. -#define PAL_EPSILON 8.8817841970012523e-16 - -#define PAL_NAN sqrt(-1.0) -#define PAL_POSINF -log(0.0) -#define PAL_NEGINF log(0.0) - -/** - * Helper test structure - */ -struct test -{ - double value; /* value to test the function with */ - double expected; /* expected result */ - double variance; /* maximum delta between the expected and actual result */ -}; - -/** - * tanh_test1_validate - * - * test validation function - */ -void __cdecl tanh_test1_validate(double value, double expected, double variance) -{ - double result = tanh(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - double delta = fabs(result - expected); - - if (delta > variance) - { - Fail("tanh(%g) returned %20.17g when it should have returned %20.17g", - value, result, expected); - } -} - -/** - * tanh_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl tanh_test1_validate_isnan(double value) -{ - double result = tanh(value); - - if (!_isnan(result)) - { - Fail("tanh(%g) returned %20.17g when it should have returned %20.17g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_tanh_test1_paltest_tanh_test1, "c_runtime/tanh/test1/paltest_tanh_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.31830988618379067, 0.30797791269089433, PAL_EPSILON }, // value: 1 / pi - { 0.43429448190325183, 0.40890401183401433, PAL_EPSILON }, // value: log10(e) - { 0.63661977236758134, 0.56259360033158334, PAL_EPSILON }, // value: 2 / pi - { 0.69314718055994531, 0.6, PAL_EPSILON }, // value: ln(2) - { 0.70710678118654752, 0.60885936501391381, PAL_EPSILON }, // value: 1 / sqrt(2) - { 0.78539816339744831, 0.65579420263267244, PAL_EPSILON }, // value: pi / 4 - { 1, 0.76159415595576489, PAL_EPSILON }, - { 1.1283791670955126, 0.81046380599898809, PAL_EPSILON }, // value: 2 / sqrt(pi) - { 1.4142135623730950, 0.88838556158566054, PAL_EPSILON }, // value: sqrt(2) - { 1.4426950408889634, 0.89423894585503855, PAL_EPSILON }, // value: log2(e) - { 1.5707963267948966, 0.91715233566727435, PAL_EPSILON }, // value: pi / 2 - { 2.3025850929940457, 0.98019801980198020, PAL_EPSILON }, // value: ln(10) - { 2.7182818284590452, 0.99132891580059984, PAL_EPSILON }, // value: e - { 3.1415926535897932, 0.99627207622074994, PAL_EPSILON }, // value: pi - { PAL_POSINF, 1, PAL_EPSILON * 10 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - tanh_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - tanh_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - tanh_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanhf/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanhf/test1/test1.cpp deleted file mode 100644 index 646e743fa..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/tanhf/test1/test1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: test1.c -** -** Purpose: Test to ensure that tanhf return the correct values -** -** Dependencies: PAL_Initialize -** PAL_Terminate -** Fail -** fabs -** -**===========================================================================*/ - -#include - -// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this -// is slightly too accurate when writing tests meant to run against libm implementations -// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get. -// -// The tests themselves will take PAL_EPSILON and adjust it according to the expected result -// so that the delta used for comparison will compare the most significant digits and ignore -// any digits that are outside the double precision range (6-9 digits). - -// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON -// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use -// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10. -#define PAL_EPSILON 4.76837158e-07 - -#define PAL_NAN sqrtf(-1.0f) -#define PAL_POSINF -logf(0.0f) -#define PAL_NEGINF logf(0.0f) - -/** - * Helper test structure - */ -struct test -{ - float value; /* value to test the function with */ - float expected; /* expected result */ - float variance; /* maximum delta between the expected and actual result */ -}; - -/** - * tanhf_test1_validate - * - * test validation function - */ -void __cdecl tanhf_test1_validate(float value, float expected, float variance) -{ - float result = tanhf(value); - - /* - * The test is valid when the difference between result - * and expected is less than or equal to variance - */ - float delta = fabsf(result - expected); - - if (delta > variance) - { - Fail("tanhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, expected); - } -} - -/** - * tanhf_test1_validate - * - * test validation function for values returning NaN - */ -void __cdecl tanhf_test1_validate_isnan(float value) -{ - float result = tanhf(value); - - if (!_isnanf(result)) - { - Fail("tanhf(%g) returned %10.9g when it should have returned %10.9g", - value, result, PAL_NAN); - } -} - -/** - * main - * - * executable entry point - */ -PALTEST(c_runtime_tanhf_test1_paltest_tanhf_test1, "c_runtime/tanhf/test1/paltest_tanhf_test1") -{ - struct test tests[] = - { - /* value expected variance */ - { 0, 0, PAL_EPSILON }, - { 0.318309886f, 0.307977913f, PAL_EPSILON }, // value: 1 / pi - { 0.434294482f, 0.408904012f, PAL_EPSILON }, // value: log10f(e) - { 0.636619772f, 0.562593600f, PAL_EPSILON }, // value: 2 / pi - { 0.693147181f, 0.6f, PAL_EPSILON }, // value: ln(2) - { 0.707106781f, 0.608859365f, PAL_EPSILON }, // value: 1 / sqrtf(2) - { 0.785398163f, 0.655794203f, PAL_EPSILON }, // value: pi / 4 - { 1, 0.761594156f, PAL_EPSILON }, - { 1.12837917f, 0.810463806f, PAL_EPSILON }, // value: 2 / sqrtf(pi) - { 1.41421356f, 0.888385562f, PAL_EPSILON }, // value: sqrtf(2) - { 1.44269504f, 0.894238946f, PAL_EPSILON }, // value: logf2(e) - { 1.57079633f, 0.917152336f, PAL_EPSILON }, // value: pi / 2 - { 2.30258509f, 0.980198020f, PAL_EPSILON }, // value: ln(10) - { 2.71828183f, 0.991328916f, PAL_EPSILON }, // value: e - { 3.14159265f, 0.996272076f, PAL_EPSILON }, // value: pi - { PAL_POSINF, 1, PAL_EPSILON * 10 } - }; - - /* PAL initialization */ - if (PAL_Initialize(argc, argv) != 0) - { - return FAIL; - } - - for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++) - { - tanhf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance); - tanhf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance); - } - - tanhf_test1_validate_isnan(PAL_NAN); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/time/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/time/test1/test1.cpp deleted file mode 100644 index 72d905be0..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/c_runtime/time/test1/test1.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Calls the time function and verifies that the time returned -** is at least a positive value. -** -** -**==========================================================================*/ - -#include - -PALTEST(c_runtime_time_test1_paltest_time_test1, "c_runtime/time/test1/paltest_time_test1") -{ - time_t t = 0; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - time(&t); - /*I was going to test that the time returned didn't exceed some - reasonable value, but decided not to, for fear of creating my own - little Y2K-style disaster.*/ - - if (t <= 0) - { - Fail("time() function doesn't return a time.\n"); - } - t = 0; - t = time(NULL); - if (t <= 0) - { - Fail("time() function doesn't return a time.\n"); - } - PAL_Terminate(); - return PASS; -} - - - - - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.cpp index f8bcb0727..6d05884b5 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.cpp @@ -12,13 +12,13 @@ #include "palsuite.h" +#include "minipal/time.h" const char* szTextFile = "text.txt"; HANDLE hToken[NUM_TOKENS]; -CRITICAL_SECTION CriticalSection; -WCHAR* convert(const char * aString) +WCHAR* convert(const char * aString) { WCHAR* wideBuffer = nullptr; @@ -36,7 +36,7 @@ WCHAR* convert(const char * aString) return wideBuffer; } -char* convertC(const WCHAR * wString) +char* convertC(const WCHAR * wString) { int size; char * MultiBuffer = NULL; @@ -51,17 +51,6 @@ char* convertC(const WCHAR * wString) return MultiBuffer; } -UINT64 GetHighPrecisionTimeStamp(LARGE_INTEGER performanceFrequency) -{ - LARGE_INTEGER ts; - if (!QueryPerformanceCounter(&ts)) - { - Fail("ERROR: Unable to query performance counter!\n"); - } - - return ts.QuadPart / (performanceFrequency.QuadPart / 1000); -} - static const char* rgchPathDelim = "/"; @@ -78,8 +67,8 @@ mkAbsoluteFilename( LPSTR dirName, sizeFN = strlen( fileName ); sizeAPN = (sizeDN + 1 + sizeFN + 1); - /* ensure ((dirName + DELIM + fileName + \0) =< _MAX_PATH ) */ - if( sizeAPN > _MAX_PATH ) + /* ensure ((dirName + DELIM + fileName + \0) =< MAX_PATH ) */ + if( sizeAPN > MAX_PATH ) { return ( 0 ); } @@ -115,17 +104,17 @@ BOOL Cleanup(HANDLE *hArray, DWORD dwIndex) while (--dwIndex > 0) { - bCHRet = CleanupHelper(&hArray[0], dwIndex); + bCHRet = CleanupHelper(&hArray[0], dwIndex); } - + bCRet = CloseHandle(hArray[0]); if (!bCRet) { Trace("PALSUITE ERROR: Unable to execute CloseHandle(%p) during " "clean up.\nGetLastError returned '%u'.\n", hArray[dwIndex], - GetLastError()); + GetLastError()); } - + return (bCRet&&bCHRet); } @@ -138,11 +127,11 @@ BOOL Cleanup(HANDLE *hArray, DWORD dwIndex) * Returns: The number of wide characters in the resulting string. * 0 is returned on Error. */ -int -mkAbsoluteFilenameW ( - LPWSTR dirName, - DWORD dwDirLength, - LPCWSTR fileName, +int +mkAbsoluteFilenameW ( + LPWSTR dirName, + DWORD dwDirLength, + LPCWSTR fileName, DWORD dwFileLength, LPWSTR absPathName ) { @@ -154,19 +143,19 @@ mkAbsoluteFilenameW ( sizeFN = wcslen( fileName ); sizeAPN = (sizeDN + 1 + sizeFN + 1); - /* insure ((dirName + DELIM + fileName + \0) =< _MAX_PATH ) */ - if ( sizeAPN > _MAX_PATH ) + /* ensure ((dirName + DELIM + fileName + \0) =< MAX_PATH ) */ + if ( sizeAPN > MAX_PATH ) { return ( 0 ); } - + wcsncpy(absPathName, dirName, dwDirLength +1); wcsncpy(absPathName, szPathDelimW, 2); wcsncpy(absPathName, fileName, dwFileLength +1); return (sizeAPN); -} +} /* * Take two wide strings representing file and directory names @@ -177,11 +166,11 @@ mkAbsoluteFilenameW ( * Returns: The number of wide characters in the resulting string. * 0 is returned on Error. */ -int -mkAbsoluteFilenameA ( - LPSTR dirName, - DWORD dwDirLength, - LPCSTR fileName, +int +mkAbsoluteFilenameA ( + LPSTR dirName, + DWORD dwDirLength, + LPCSTR fileName, DWORD dwFileLength, LPSTR absPathName ) { @@ -190,24 +179,24 @@ mkAbsoluteFilenameA ( DWORD sizeDN; DWORD sizeFN; DWORD sizeAPN; - + sizeDN = strlen( dirName ); sizeFN = strlen( fileName ); sizeAPN = (sizeDN + 1 + sizeFN + 1); - - /* insure ((dirName + DELIM + fileName + \0) =< _MAX_PATH ) */ - if ( sizeAPN > _MAX_PATH ) + + /* ensure ((dirName + DELIM + fileName + \0) =< MAX_PATH ) */ + if ( sizeAPN > MAX_PATH ) { return ( 0 ); } - + strncpy(absPathName, dirName, dwDirLength +1); strcat(absPathName, szPathDelimA); strcat(absPathName, fileName); - + return (sizeAPN); - -} + +} BOOL DeleteFileW( @@ -215,7 +204,7 @@ DeleteFileW( { _ASSERTE(lpFileName != NULL); - CHAR mbFileName[ _MAX_PATH ]; + CHAR mbFileName[ MAX_PATH ]; if (WideCharToMultiByte( CP_ACP, 0, lpFileName, -1, mbFileName, sizeof(mbFileName), NULL, NULL ) != 0 ) { @@ -223,4 +212,4 @@ DeleteFileW( } return FALSE; -} \ No newline at end of file +} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.h index 9494daed7..8e7336ca8 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.h +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/common/palsuite.h @@ -25,6 +25,7 @@ typedef unsigned short char16_t; #include #include #include +#include #include #define PALTEST(testfunc, testname) \ @@ -81,71 +82,6 @@ struct PALTest } }; -#ifdef PAL_PERF - -int __cdecl Test_Main(int argc, char **argv); -int PAL_InitializeResult = 0; -static const char PALTEST_LOOP_ENV[]="PALTEST_LOOP_COUNT"; - -int __cdecl main(int argc, char **argv) -{ - int lastMainResult=0; - - int loopCount=1; // default: run the test's main once - int loopIndex=0; - char *szPerfLoopEnv = NULL; - - // Run PAL_Initialize once, save off the result. Any failures here - // will be detected later by calls to PAL_Initialize in the test's main. - PAL_InitializeResult = PAL_Initialize(argc, argv); - - // Check the environment to see if we need to run the test's main - // multiple times. Ideally, we want to do this before PAL_Initialize so - // that the overhead of checking the environment is not included in the - // time between PAL_Initialize and PAL_Terminate. However, getenv in PAL - // can be run only after PAL_Initialize. - szPerfLoopEnv = getenv(PALTEST_LOOP_ENV); - if (szPerfLoopEnv != NULL) - { - loopCount = atoi(szPerfLoopEnv); - if (loopCount <= 0) loopCount = 1; - } - - // call the test's actual main in a loop - for(loopIndex=0; loopIndex -#include "resultbuffer.h" - -//Global Variables -DWORD dwThreadId; -long long GLOBAL_COUNTER ; -HANDLE g_hEvent; - -/* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; -unsigned int THREAD_COUNT = 0; -unsigned int REPEAT_COUNT = 0; -unsigned int SLEEP_LENGTH = 0; -unsigned int RELATION_ID = 0; - - -CRITICAL_SECTION CriticalSectionM; /* Critical Section Object (used as mutex) */ - - -/* Capture statistics for each worker thread */ -struct statistics{ - unsigned int processId; - unsigned int operationsFailed; - unsigned int operationsPassed; - unsigned int operationsTotal; - DWORD operationTime; //Milliseconds - unsigned int relationId; -}; - - -/*Capture Statistics at a Process level*/ -struct processStatistics{ - unsigned int processId; - DWORD operationTime; //Milliseconds - unsigned int relationId; -}; - - -ResultBuffer *resultBuffer; - -//function declarations -int GetParameters( int , char **); -void setup (void); -void cleanup(void); -void incrementCounter(void); -DWORD PALAPI enterandleavecs( LPVOID ); - - -/* -*Setup for the test case -*/ - -VOID -setup(VOID) -{ - -g_hEvent = CreateEvent(NULL,TRUE,FALSE, NULL); -if(g_hEvent == NULL) -{ - Fail("Create Event Failed\n" - "GetLastError returned %d\n", GetLastError()); -} - -GLOBAL_COUNTER=0; -/* -* Create mutual exclusion mechanisms -*/ -InitializeCriticalSection ( &CriticalSectionM ); - -} - - -/* -* Cleanup for the test case -*/ -VOID -cleanup(VOID) -{ - /* - * Clean up Critical Section object - */ - DeleteCriticalSection(&CriticalSectionM); - PAL_Terminate(); -} - - -/*function that increments a counter*/ -VOID -incrementCounter(VOID) -{ - - if (INT_MAX==GLOBAL_COUNTER) - GLOBAL_COUNTER=0; - - GLOBAL_COUNTER++; - -} - -/* - * Enter and Leave Critical Section - */ -DWORD -PALAPI -enterandleavecs( LPVOID lpParam ) -{ - - struct statistics stats; - int loopcount = REPEAT_COUNT; - int i; - DWORD dwStart =0; - - int Id=(int)lpParam; - - //initialize structure to hold thread level statistics - stats.relationId = RELATION_ID; - stats.processId = USE_PROCESS_COUNT; - stats.operationsFailed = 0; - stats.operationsPassed = 0; - stats.operationsTotal = 0; - stats.operationTime = 0; - - //Wait for main thread to signal event - if (WAIT_OBJECT_0 != WaitForSingleObject(g_hEvent,INFINITE)) - { - Fail ("readfile: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - //Collect operation start time - dwStart = GetTickCount(); - - //Operation starts loopcount times - for(i = 0; i < loopcount; i++) - { - - EnterCriticalSection(&CriticalSectionM); - /* - *Do Some Thing once you enter critical section - */ - incrementCounter(); - LeaveCriticalSection(&CriticalSectionM); - - stats.operationsPassed++; - stats.operationsTotal++; - } - //collect operation end time - stats.operationTime = GetTickCount() - dwStart; - - /*Trace("\n\n\n\nOperation Time %d\n", stats.operationTime); - Trace("Operation Passed %d\n", stats.operationsPassed); - Trace("Operation Total %d\n", stats.operationsTotal); - Trace("Operation Failed %d\n", stats.operationsFailed); */ - - if(resultBuffer->LogResult(Id, (char *)&stats)) - { - Fail("Error while writing to shared memory, Thread Id is[%d] and Process id is [%d]\n", Id, USE_PROCESS_COUNT); - } - - - return 0; -} - - -PALTEST(composite_synchronization_criticalsection_paltest_synchronization_criticalsection, "composite/synchronization/criticalsection/paltest_synchronization_criticalsection") -{ - -/* -* Parameter to the threads that will be created -*/ -DWORD dwThrdParam = 0; -HANDLE hThread[64]; -unsigned int i = 0; -DWORD dwStart; - -/* Variables to capture the file name and the file pointer*/ -char fileName[MAX_PATH_FNAME]; -char processFileName[MAX_PATH_FNAME]; -FILE *hFile,*hProcessFile; -struct processStatistics processStats; - -struct statistics* buffer; -int statisticsSize = 0; - -/* -* PAL Initialize -*/ -if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - -if(GetParameters(argc, argv)) - { - Fail("Error in obtaining the parameters\n"); - } - - -/*setup file for process result collection */ -_snprintf(processFileName, MAX_PATH_FNAME, "%d_process_criticalsection_%d_.txt", USE_PROCESS_COUNT, RELATION_ID); -hProcessFile = fopen(processFileName, "w+"); -if(hProcessFile == NULL) - { - Fail("Error in opening file to write process results for process [%d]\n", USE_PROCESS_COUNT); - } - -//Initialize Process Stats Variables -processStats.operationTime = 0; -processStats.processId = USE_PROCESS_COUNT; -processStats.relationId = RELATION_ID; //Will change later - -//Start Process Time Capture -dwStart = GetTickCount(); - -//setup file for thread result collection -statisticsSize = sizeof(struct statistics); -_snprintf(fileName, MAX_PATH_FNAME, "%d_thread_criticalsection_%d_.txt", USE_PROCESS_COUNT, RELATION_ID); -hFile = fopen(fileName, "w+"); -if(hFile == NULL) -{ - Fail("Error in opening file for write for process [%d]\n", USE_PROCESS_COUNT); -} - -// For each thread we will log operations failed (int), passed (int), total (int) -// and number of ticks (DWORD) for the operations -resultBuffer = new ResultBuffer( THREAD_COUNT, statisticsSize); - -/* -* Call the Setup Routine -*/ -setup(); - -//Create Thread Count Worker Threads - -while (i< THREAD_COUNT) -{ - dwThrdParam = i; - - hThread[i] = CreateThread( - NULL, - 0, - enterandleavecs, - (LPVOID)dwThrdParam, - 0, - &dwThreadId); - - if ( NULL == hThread[i] ) - { - Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - i++; -} - -/* -* Set Event to signal all threads to start using the CS -*/ - -if (0==SetEvent(g_hEvent)) -{ - Fail ( "SetEvent returned Zero. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); -} - -/* - * Wait for worker threads to complete - * - */ -if ( WAIT_OBJECT_0 != WaitForMultipleObjects (THREAD_COUNT,hThread,TRUE, INFINITE)) -{ - Fail ( "WaitForMultipleObject Failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); -} - - -//Get the end time of the process -processStats.operationTime = GetTickCount() - dwStart; - -//Write Process Result Contents to File -if(hProcessFile!= NULL) - { - fprintf(hProcessFile, "%d,%lu,%d\n", processStats.processId, processStats.operationTime, processStats.relationId ); - } - -if (0!=fclose(hProcessFile)) -{ - Fail("Unable to write process results to file" - "GetLastError returned %d\n", GetLastError()); -} - - -/*Write Threads Results to a file*/ -if(hFile!= NULL) -{ - for( i = 0; i < THREAD_COUNT; i++ ) - { - buffer = (struct statistics *)resultBuffer->getResultBuffer(i); - fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); - //Trace("Iteration %d over\n", i); - } -} - -if (0!=fclose(hFile)) -{ - Fail("Unable to write thread results to file" - "GetLastError returned %d\n", GetLastError()); -} - - /* Logging for the test case over, clean up the handles */ - //Trace("Contents of the buffer are [%s]\n", resultBuffer->getResultBuffer()); - - -//Call Cleanup for Test Case -cleanup(); - -//Trace("Value of GLOBAL COUNTER %d \n", GLOBAL_COUNTER); -return (PASS); - -} - - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - printf("PAL -Composite Critical Section Test\n"); - printf("Usage:\n"); - printf("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - printf("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); - printf("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - printf("\t[RELATION_ID [Greater than or Equal to 1]\n"); - return -1; - } - -// Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - printf("\nPROCESS_COUNT to greater than or equal to 1\n"); - return -1; - } - - THREAD_COUNT = atoi(argv[2]); - if( THREAD_COUNT < 1 || THREAD_COUNT > 64) - { - printf("\nTHREAD_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - printf("\nREPEAT_COUNT to greater than or equal to 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - printf("\nMain Process:Invalid RELATION_ID number, Pass greater than 1\n"); - return -1; - } - - return 0; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/criticalsection/mainWrapper.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/criticalsection/mainWrapper.cpp deleted file mode 100644 index 529dddb30..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/criticalsection/mainWrapper.cpp +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/* -Source Code: mainWrapper.c - -mainWrapper.c creates Composite Test Case Processes and waits for all processes to get over - -Algorithm -o Create PROCESS_COUNT processes. - -Author: RameshG -*/ - -#include -#include "resulttime.h" - -/* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //default -unsigned int THREAD_COUNT = 0; //default -unsigned int REPEAT_COUNT = 0; //default -unsigned int SLEEP_LENGTH = 0; //default -unsigned int RELATION_ID = 1001; - - -//Structure to capture application wide statistics -struct applicationStatistics{ - DWORD operationTime; - unsigned int relationId; - unsigned int processCount; - unsigned int threadCount; - unsigned int repeatCount; - char* buildNumber; - -}; - - -//Get parameters from the commandline -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - printf("Main Wrapper PAL -Composite Critical Section Test\n"); - printf("Usage:\n"); - printf("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - printf("\t[THREAD_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); - printf("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - printf("\t[RELATION_ID [Greater than or Equal to 1]\n"); - - return -1; - } - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - printf("\nPROCESS_COUNT to greater than or equal to 1\n"); - return -1; - } - - THREAD_COUNT = atoi(argv[2]); - if( THREAD_COUNT < 1 || THREAD_COUNT > 64) - { - printf("\nTHREAD_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - printf("\nREPEAT_COUNT to greater than or equal to 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - printf("\nMain Process:Invalid RELATION_ID number, Pass greater than 1\n"); - return -1; - } - - - - - return 0; -} - -//Main entry point for the application -PALTEST(composite_synchronization_criticalsection_paltest_synchronization_criticalsection, "composite/synchronization/criticalsection/paltest_synchronization_criticalsection") -{ - unsigned int i = 0; - HANDLE hProcess[MAXIMUM_WAIT_OBJECTS]; //Array to hold Process handles - DWORD processReturnCode = 0; - int testReturnCode = PASS; - STARTUPINFO si[MAXIMUM_WAIT_OBJECTS]; - PROCESS_INFORMATION pi[MAXIMUM_WAIT_OBJECTS]; - FILE *hFile; //handle to application results file - char fileName[MAX_PATH]; //file name of the application results file - struct applicationStatistics appStats; - DWORD dwStart=0; //to store the tick count - char lpCommandLine[MAX_PATH] = ""; - int returnCode = 0; - - if(0 != (PAL_Initialize(argc, argv))) - { - return ( FAIL ); - } - - - - - if(GetParameters(argc, argv)) - { - Fail("Error in obtaining the parameters\n"); - } - - //Initialize Application Statistics Structure - appStats.operationTime=0; - appStats.relationId = RELATION_ID; - appStats.processCount = USE_PROCESS_COUNT; - appStats.threadCount = THREAD_COUNT; - appStats.repeatCount = REPEAT_COUNT; - appStats.buildNumber = getBuildNumber(); - - -_snprintf(fileName, MAX_PATH, "main_criticalsection_%d_.txt", RELATION_ID); - -hFile = fopen(fileName, "w+"); - -if(hFile == NULL) - { - Fail("Error in opening file to write application results for Critical Section Test, and error code is %d\n", GetLastError()); - } - -//Start Process Time Capture -dwStart = GetTickCount(); - -for( i = 0; i < USE_PROCESS_COUNT; i++ ) - { - - ZeroMemory( lpCommandLine, MAX_PATH ); - if ( _snprintf( lpCommandLine, MAX_PATH-1, "criticalsection %d %d %d %d", i, THREAD_COUNT, REPEAT_COUNT, RELATION_ID) < 0 ) - { - Trace ("Error: Insufficient commandline string length for iteration [%d]\n", i); - } - - /* Zero the data structure space */ - ZeroMemory ( &pi[i], sizeof(pi[i]) ); - ZeroMemory ( &si[i], sizeof(si[i]) ); - - /* Set the process flags and standard io handles */ - si[i].cb = sizeof(si[i]); - - //Printing the Command Line - //Trace("Command Line \t %s \n", lpCommandLine); - - //Create Process - if(!CreateProcess( NULL, /* lpApplicationName*/ - lpCommandLine, /* lpCommandLine */ - NULL, /* lpProcessAttributes */ - NULL, /* lpThreadAttributes */ - TRUE, /* bInheritHandles */ - 0, /* dwCreationFlags, */ - NULL, /* lpEnvironment */ - NULL, /* pCurrentDirectory */ - &si[i], /* lpStartupInfo */ - &pi[i] /* lpProcessInformation */ - )) - { - Fail("Process Not created for [%d] and failed with error code %d\n", i, GetLastError()); - } - else - { - hProcess[i] = pi[i].hProcess; - //Trace("Process created for [%d]\n", i); - } - - } - - returnCode = WaitForMultipleObjects( USE_PROCESS_COUNT, hProcess, TRUE, INFINITE); - if( WAIT_OBJECT_0 != returnCode ) - { - Trace("Wait for Object(s) @ Main thread for %d processes returned %d, and GetLastError value is %d\n", USE_PROCESS_COUNT, returnCode, GetLastError()); - testReturnCode = FAIL; - } - - for( i = 0; i < USE_PROCESS_COUNT; i++ ) - { - /* check the exit code from the process */ - if( ! GetExitCodeProcess( pi[i].hProcess, &processReturnCode ) ) - { - Trace( "GetExitCodeProcess call failed for iteration %d with error code %u\n", - i, GetLastError() ); - - testReturnCode = FAIL; - } - - if(processReturnCode == FAIL) - { - Trace( "Process [%d] failed and returned FAIL\n", i); - testReturnCode = FAIL; - } - - if(!CloseHandle(pi[i].hThread)) - { - Trace("Error:%d: CloseHandle failed for Process [%d] hThread\n", GetLastError(), i); - testReturnCode = FAIL; - } - - if(!CloseHandle(pi[i].hProcess) ) - { - Trace("Error:%d: CloseHandle failed for Process [%d] hProcess\n", GetLastError(), i); - testReturnCode = FAIL; - } - } - -//Get the end time of the process -appStats.operationTime = GetTickCount() - dwStart; - -if( testReturnCode == PASS) - { - Trace("Test Passed\n"); - - } - else - { - Fail("Test Failed\n"); - - } - -//Write Process Result Contents to File -if(hFile!= NULL) - { - fprintf(hFile, "%lu,%d,%d,%d,%d,%s\n", appStats.operationTime, appStats.relationId,appStats.processCount, appStats.threadCount, appStats.repeatCount, appStats.buildNumber); - } - -if (0!=fclose(hFile)) -{ - Trace("Error:%d: fclose failed for file %s\n", GetLastError(), fileName); -} - - PAL_Terminate(); - -if( testReturnCode == PASS) -{ - return PASS; -} -else -{ - return FAIL; -} - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/criticalsection/readme.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/criticalsection/readme.txt deleted file mode 100644 index 974497cfa..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/criticalsection/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -To compile: - -1) create a dat file (say criticalsection.dat) with contents: -PAL,Composite,palsuite\composite\synchronization\criticalsection,criticalsection=mainWrapper.c,criticalsection.c,,, - -2) perl rrunmod.pl -r criticalsection.dat - - -To execute: -mainwrapper [PROCESS_COUNT] [WORKER_THREAD_MULTIPLIER_COUNT] [REPEAT_COUNT] - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/mtx_critsect.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/mtx_critsect.cpp deleted file mode 100644 index 6f5a032a6..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/mtx_critsect.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -//#include -#include -#include "mtx_critsect.h" - -CsWaiterReturnState MTXWaitOnCS(LPCRITICAL_SECTION lpCriticalSection); -void MTXDoActualWait(LPCRITICAL_SECTION lpCriticalSection); -void MTXWakeUpWaiter(LPCRITICAL_SECTION lpCriticalSection); - -/*extern "C" { - LONG InterlockedCompareExchange( - LONG volatile *Destination, - LONG Exchange, - LONG Comperand); -} -*/ -int MTXInitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - int retcode = 0; - - lpCriticalSection->DebugInfo = NULL; - lpCriticalSection->LockCount = 0; - lpCriticalSection->RecursionCount = 0; - lpCriticalSection->SpinCount = 0; - lpCriticalSection->OwningThread = NULL; - - lpCriticalSection->LockSemaphore = (HANDLE)&lpCriticalSection->NativeData; - - if (0!= pthread_mutex_init(&lpCriticalSection->NativeData.Mutex, NULL)) - { - printf("Error Initializing Critical Section\n"); - retcode = -1; - } - - - lpCriticalSection->InitCount = CS_INITIALIZED; - return retcode; -} - -int MTXDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - int retcode = 0; - - if (lpCriticalSection->InitCount == CS_INITIALIZED) - { - - if (0!=pthread_mutex_destroy(&lpCriticalSection->NativeData.Mutex)) - { - printf("Error Deleting Critical Section\n"); - retcode = -1; - } - } - - lpCriticalSection->InitCount = CS_NOT_INIZIALIZED; - return retcode; -} - -int MTXEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - - DWORD thread_id; - int retcode = 0; - - thread_id = (DWORD)THREADSilentGetCurrentThreadId(); - - /* check if the current thread already owns the criticalSection */ - if (lpCriticalSection->OwningThread == (HANDLE)thread_id) - { - lpCriticalSection->RecursionCount++; - //Check if this is a failure condition - return 0; - } - - if (0!= pthread_mutex_lock(&lpCriticalSection->NativeData.Mutex)) - { - //Error Condition - printf("Error Entering Critical Section\n"); - retcode = -1; - } - else - { - lpCriticalSection->OwningThread = (HANDLE)thread_id; - lpCriticalSection->RecursionCount = 1; - } - - return retcode; -} - -int MTXLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - int retcode = 0; - - if (--lpCriticalSection->RecursionCount > 0) - //*****check this ***** - return 0; - - lpCriticalSection->OwningThread = 0; - - if (0!= pthread_mutex_unlock(&lpCriticalSection->NativeData.Mutex)) - { - //Error Condition - printf("Error Leaving Critical Section\n"); - retcode = -1; - } - - return retcode; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/mtx_critsect.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/mtx_critsect.h deleted file mode 100644 index 90c36cc61..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/mtx_critsect.h +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include - -typedef void VOID; -typedef unsigned long DWORD; -typedef long LONG; -typedef unsigned long ULONG; -typedef void* HANDLE; -typedef unsigned long ULONG_PTR; - -#define FALSE 0 -#define TRUE 1 - -#define CSBIT_CS_IS_LOCKED 1 -#define CSBIT_NEW_WAITER 2 - -typedef enum CsInitState { CS_NOT_INIZIALIZED, CS_INITIALIZED, CS_FULLY_INITIALIZED } CsInitState; -typedef enum _CsWaiterReturnState { CS_WAITER_WOKEN_UP, CS_WAITER_DIDNT_WAIT } CsWaiterReturnState; - -typedef struct _CRITICAL_SECTION_DEBUG_INFO { - LONG volatile ContentionCount; - LONG volatile InternalContentionCount; - ULONG volatile AcquireCount; - ULONG volatile EnterCount; -} CRITICAL_SECTION_DEBUG_INFO, *PCRITICAL_SECTION_DEBUG_INFO; - -typedef struct _CRITICAL_SECTION_NATIVE_DATA { - pthread_mutex_t Mutex; -} CRITICAL_SECTION_NATIVE_DATA, *PCRITICAL_SECTION_NATIVE_DATA; - -typedef struct _CRITICAL_SECTION { - - CsInitState InitCount; - PCRITICAL_SECTION_DEBUG_INFO DebugInfo; - LONG LockCount; - LONG RecursionCount; - HANDLE OwningThread; - HANDLE LockSemaphore; - ULONG_PTR SpinCount; - CRITICAL_SECTION_NATIVE_DATA NativeData; - -} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION; - -int MTXInitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); -int MTXDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection); -int MTXEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); -int MTXLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/pal_composite_native_cs.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/pal_composite_native_cs.cpp deleted file mode 100644 index 5cee88142..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/pal_composite_native_cs.cpp +++ /dev/null @@ -1,466 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include -#include -#include -#include -#include -//#include -#include "mtx_critsect.cpp" -//#include "mtx_critsect.h" -#include "resultbuffer.h" - - - -#define LONGLONG long long -#define ULONGLONG unsigned LONGLONG -/*Defining Global Variables*/ - -int THREAD_COUNT=0; -int REPEAT_COUNT=0; -int GLOBAL_COUNTER=0; -int USE_PROCESS_COUNT = 0; -int RELATION_ID =0; -int g_counter = 0; -int MAX_PATH = 256; -LONGLONG calibrationValue = 0; - -pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t g_cv = PTHREAD_COND_INITIALIZER; -pthread_cond_t g_cv2 = PTHREAD_COND_INITIALIZER; -CRITICAL_SECTION g_cs; - -/* Capture statistics for each worker thread */ -struct statistics{ - unsigned int processId; - unsigned int operationsFailed; - unsigned int operationsPassed; - unsigned int operationsTotal; - DWORD operationTime; - unsigned int relationId; -}; - - -struct applicationStatistics{ - DWORD operationTime; - unsigned int relationId; - unsigned int processCount; - unsigned int threadCount; - unsigned int repeatCount; - char* buildNumber; - -}; - -ResultBuffer *resultBuffer; - - -void* waitforworkerthreads(void*); -void starttests(int); -int setuptest(void); -int cleanuptest(void); -int GetParameters( int , char **); -void incrementCounter(void); -ULONGLONG GetTicks(void); -ULONGLONG getPerfCalibrationValue(void); - - - -PALTEST(composite_synchronization_nativecriticalsection_paltest_synchronization_nativecriticalsection, "composite/synchronization/nativecriticalsection/paltest_synchronization_nativecriticalsection") - { - //Variable Declaration - pthread_t pthreads[640]; - int threadID[640]; - int i=0; - int j=0; - int rtn=0; - ULONGLONG startTicks = 0; - - /* Variables to capture the file name and the file pointer*/ - char fileName[MAX_PATH]; - FILE *hFile; - struct statistics* buffer; - int statisticsSize = 0; - - /*Variable to Captutre Information at the Application Level*/ - struct applicationStatistics appStats; - char mainFileName[MAX_PATH]; - FILE *hMainFile; - - //Get perfCalibrationValue - - calibrationValue = getPerfCalibrationValue(); - printf("Calibration Value for this Platform %llu \n", calibrationValue); - - - //Get Parameters - if(GetParameters(argc, argv)) - { - printf("Error in obtaining the parameters\n"); - exit(-1); - } - - //Assign Values to Application Statistics Members - appStats.relationId=RELATION_ID; - appStats.operationTime=0; - appStats.buildNumber = "999.99"; - appStats.processCount = USE_PROCESS_COUNT; - appStats.threadCount = THREAD_COUNT; - appStats.repeatCount = REPEAT_COUNT; - - printf("RELATION ID : %d\n", appStats.relationId); - printf("Process Count : %d\n", appStats.processCount); - printf("Thread Count : %d\n", appStats.threadCount); - printf("Repeat Count : %d\n", appStats.repeatCount); - - - //Open file for Application Statistics Collection - snprintf(mainFileName, MAX_PATH, "main_nativecriticalsection_%d_.txt",appStats.relationId); - hMainFile = fopen(mainFileName, "w+"); - - if(hMainFile == NULL) - { - printf("Error in opening main file for write\n"); - } - - - for (i=0;igetResultBuffer(i); - fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); - //printf("Iteration %d over\n", i); - } - } - fclose(hFile); - - - - //Call Test Case Cleanup Routine - if (0!=cleanuptest()) - { - //Error Condition - printf("Error Cleaning up Test Case"); - exit(-1); - } - - - if(hMainFile!= NULL) - { - printf("Writing to Main File \n"); - fprintf(hMainFile, "%lu,%d,%d,%d,%d,%s\n", appStats.operationTime, appStats.relationId, appStats.processCount, appStats.threadCount, appStats.repeatCount, appStats.buildNumber); - - } - fclose(hMainFile); - return 0; - } - -void * waitforworkerthreads(void * threadId) -{ - - int *threadParam = (int*) threadId; - -// printf("Thread ID : %d \n", *threadParam); - - //Acquire Lock - if (0!=pthread_mutex_lock(&g_mutex)) - { - //Error Condition - printf("Error Acquiring Mutex Lock in Wait for Worker Thread\n"); - exit(-1); - } - - //Increment Global Counter - GLOBAL_COUNTER++; - - - //If global counter is equal to thread count then signal main thread - if (GLOBAL_COUNTER == THREAD_COUNT) - { - if (0!=pthread_cond_signal(&g_cv2)) - { - //Error Condition - printf("Error in setting conditional variable\n"); - exit(-1); - } - } - - //Wait for main thread to signal - if (0!=pthread_cond_wait(&g_cv,&g_mutex)) - { - //Error Condition - printf("Error waiting on conditional variable in Worker Thread\n"); - exit(-1); - } - - //Release the mutex lock - if (0!=pthread_mutex_unlock(&g_mutex)) - { - //Error Condition - printf("Error Releasing Mutex Lock in Worker Thread\n"); - exit(-1); - } - - //Start the test - starttests(*threadParam); - -} - -void starttests(int threadID) -{ - /*All threads beign executing tests cases*/ - int i = 0; - int Id = threadID; - struct statistics stats; - ULONGLONG startTime = 0; - ULONGLONG endTime = 0; - - - stats.relationId = RELATION_ID; - stats.processId = USE_PROCESS_COUNT; - stats.operationsFailed = 0; - stats.operationsPassed = 0; - stats.operationsTotal = 0; - stats.operationTime = 0; - - //Enter and Leave Critical Section in a loop REPEAT_COUNT Times - - startTime = GetTicks(); - - for (i=0;iLogResult(Id, (char *)&stats)) - { - printf("Error while writing to shared memory, Thread Id is[??] and Process id is [%d]\n", USE_PROCESS_COUNT); - } - -} - -int setuptest(void) -{ - - //Initialize Critical Section - if (0!=MTXInitializeCriticalSection( &g_cs)) - { - return -1; - } - return 0; -} - -int cleanuptest(void) -{ - - //Delete Critical Section - if (0!=MTXDeleteCriticalSection(&g_cs)) - { - return -1; - } - return 0; -} - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - printf("PAL -Composite Native Critical Section Test\n"); - printf("Usage:\n"); - printf("\t[PROCESS_ID ( greater than 1] \n"); - printf("\t[THREAD_COUNT ( greater than 1] \n"); - printf("\t[REPEAT_COUNT ( greater than 1]\n"); - printf("\t[RELATION_ID [greater than or Equal to 1]\n"); - return -1; - } - - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - printf("\nInvalid THREAD_COUNT number, Pass greater than 1\n"); - return -1; - } - - THREAD_COUNT = atoi(argv[2]); - if( THREAD_COUNT < 1) - { - printf("\nInvalid THREAD_COUNT number, Pass greater than 1\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - printf("\nInvalid REPEAT_COUNT number, Pass greater than 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - printf("\nInvalid RELATION_ID number, Pass greater than 1\n"); - return -1; - } - - - return 0; -} - -void incrementCounter(void) -{ - g_counter ++; -} - - -//Implementation borrowed from pertrace.c -ULONGLONG GetTicks(void) -{ -#ifdef i386 - unsigned long a, d; - asm volatile("rdtsc":"=a" (a), "=d" (d)); - return ((ULONGLONG)((unsigned int)(d)) << 32) | (unsigned int)(a); -#else - // #error Don''t know how to get ticks on this platform - return (ULONGLONG)gethrtime(); -#endif // i386 -} - - -/**/ -ULONGLONG getPerfCalibrationValue(void) -{ - ULONGLONG startTicks; - ULONGLONG endTicks; - - startTicks = GetTicks(); - sleep(1); - endTicks = GetTicks(); - - return ((endTicks-startTicks)/1000); //Return number of Ticks in One Milliseconds - -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/readme.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/readme.txt deleted file mode 100644 index 8d83bf794..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/readme.txt +++ /dev/null @@ -1,19 +0,0 @@ -To compile: - -For FReeBSD Platform use the following to compile: -gcc -pthread -lm -lgcc -lstdc++ -xc++ -Di386 pal_composite_native_cs.c - -For Solaris Platform use the following to compile: -gcc -lpthread -lm -lgcc -lstdc++ -xc++ -D__sparc__ pal_composite_native_cs.c - -For HPUX Platform use the following to compile: -gcc -lpthread -mlp64 -lm -lgcc -lstdc++ -xc++ -D_HPUX_ -D__ia64__ pal_composite_native_cs.c - -To execute: -./a.out [PROCESS_COUNT] [THREAD_COUNT] [REPEAT_COUNT] - - - ./a.out 1 32 1000000 4102406 - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/resultbuffer.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/resultbuffer.cpp deleted file mode 100644 index 9988a49f9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/resultbuffer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -//#include "stdafx.h" -#include "resultbuffer.h" - -ResultBuffer:: ResultBuffer(int ThreadCount, int ThreadLogSize) - { - // Declare an internal status variable - int Status=0; - - // Update the maximum thread count - MaxThreadCount = ThreadCount; - - // Allocate the memory buffer based on the passed in thread and process counts - // and the specified size of the thread specific buffer - buffer = NULL; - buffer = (char*)malloc(ThreadCount*ThreadLogSize); - // Check to see if the buffer memory was allocated - if (buffer == NULL) - Status = -1; - // Initialize the buffer to 0 to prevent bogus data - memset(buffer,0,ThreadCount*ThreadLogSize); - - // The ThreadOffset is equal to the total number of bytes that will be stored per thread - ThreadOffset = ThreadLogSize; - - } - - - int ResultBuffer::LogResult(int Thread, char* Data) - { - // Declare an internal status flad - int status = 0; - - // Declare an object to store the offset address into the buffer - int Offset; - - // Check to make sure the Thread index is not out of range - if(Thread > MaxThreadCount) - { - printf("Thread index is out of range, Value of Thread[%d], Value of MaxThreadCount[%d]\n", Thread, MaxThreadCount); - status = -1; - return(status); - } - - // Calculate the offset into the shared buffer based on the process and thread indices - Offset = (Thread)*ThreadOffset; - - // Write the passed in data to the reserved buffer - memcpy(buffer+Offset,Data,ThreadOffset); - - return(status); - } - - - char* ResultBuffer::getResultBuffer(int threadId) - { - - return (buffer + threadId*ThreadOffset); - - } - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/resultbuffer.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/resultbuffer.h deleted file mode 100644 index c3d9a27fd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecriticalsection/resultbuffer.h +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include -#include -//#include -#ifndef _RESULT_BUFFER_H_ -#define _RESULT_BUFFER_H_ - -//#include - -struct ResultData -{ - int value; - int size; -// ResultData* NextResult; -}; - - class ResultBuffer -{ - // Declare a pointer to a memory buffer to store the logged results - char* buffer; - // Declare an object to store the maximum Thread count - int MaxThreadCount; - // Declare and internal data object to store the calculated offset between adjacent threads data sets - int ThreadOffset; - - // Declare a linked list object to store the parameter values -public: - - // Declare a constructor for the single process case - ResultBuffer(int ThreadCount, int ThreadLogSize); - // Declare a method to log data for the single process instance - int LogResult(int Thread, char* Data); - - char* getResultBuffer(int threadId); -}; - -#include "resultbuffer.cpp" -#endif // _RESULT_BUFFER_H_ - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/interlocked.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/interlocked.cpp deleted file mode 100644 index a87b6c4a2..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/interlocked.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -typedef long LONG; - -extern "C" { -LONG InterlockedCompareExchange( - LONG volatile *Destination, - LONG Exchange, - LONG Comperand) -{ -#ifdef i386 - LONG result; - - __asm__ __volatile__( - "lock; cmpxchgl %2,(%1)" - : "=a" (result) - : "r" (Destination), "r" (Exchange), "0" (Comperand) - : "memory" - ); - - return result; -#endif -} -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/mtx_critsect.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/mtx_critsect.cpp deleted file mode 100644 index cd62a7840..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/mtx_critsect.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include - -#include -#include "mtx_critsect.h" - -CsWaiterReturnState MTXWaitOnCS(LPCRITICAL_SECTION lpCriticalSection); -void MTXDoActualWait(LPCRITICAL_SECTION lpCriticalSection); -void MTXWakeUpWaiter(LPCRITICAL_SECTION lpCriticalSection); - -/*extern "C" { - LONG InterlockedCompareExchange( - LONG volatile *Destination, - LONG Exchange, - LONG Comperand); -} -*/ -int MTXInitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - int retcode = 0; - - lpCriticalSection->DebugInfo = NULL; - lpCriticalSection->LockCount = 0; - lpCriticalSection->RecursionCount = 0; - lpCriticalSection->SpinCount = 0; - lpCriticalSection->OwningThread = NULL; - - lpCriticalSection->LockSemaphore = (HANDLE)&lpCriticalSection->NativeData; - - if (0!= pthread_mutex_init(&lpCriticalSection->NativeData.Mutex, NULL)) - { - printf("Error Initializing Critical Section\n"); - retcode = -1; - } - - - lpCriticalSection->InitCount = CS_INITIALIZED; - return retcode; -} - -int MTXDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - int retcode = 0; - - if (lpCriticalSection->InitCount == CS_INITIALIZED) - { - - if (0!=pthread_mutex_destroy(&lpCriticalSection->NativeData.Mutex)) - { - printf("Error Deleting Critical Section\n"); - retcode = -1; - } - } - - lpCriticalSection->InitCount = CS_NOT_INIZIALIZED; - return retcode; -} - -int MTXEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - - DWORD thread_id; - int retcode = 0; - - thread_id = (DWORD)THREADSilentGetCurrentThreadId(); - - /* check if the current thread already owns the criticalSection */ - if (lpCriticalSection->OwningThread == (HANDLE)thread_id) - { - lpCriticalSection->RecursionCount++; - //Check if this is a failure condition - return 0; - } - - if (0!= pthread_mutex_lock(&lpCriticalSection->NativeData.Mutex)) - { - //Error Condition - printf("Error Entering Critical Section\n"); - retcode = -1; - } - else - { - lpCriticalSection->OwningThread = (HANDLE)thread_id; - lpCriticalSection->RecursionCount = 1; - } - - return retcode; -} - -int MTXLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection) -{ - int retcode = 0; - - if (--lpCriticalSection->RecursionCount > 0) - //*****check this ***** - return 0; - - lpCriticalSection->OwningThread = 0; - - if (0!= pthread_mutex_unlock(&lpCriticalSection->NativeData.Mutex)) - { - //Error Condition - printf("Error Leaving Critical Section\n"); - retcode = -1; - } - - return retcode; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/mtx_critsect.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/mtx_critsect.h deleted file mode 100644 index 16e9eb9cb..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/mtx_critsect.h +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include - -typedef void VOID; -typedef void* HANDLE; -typedef unsigned long ULONG_PTR; - -#ifdef HPUX - typedef unsigned int DWORD; - typedef int LONG; - typedef unsigned int ULONG; -#else - typedef unsigned long DWORD; - typedef long LONG; - typedef unsigned long ULONG; -#endif - - - - -#define FALSE 0 -#define TRUE 1 - -#define CSBIT_CS_IS_LOCKED 1 -#define CSBIT_NEW_WAITER 2 - -typedef enum CsInitState { CS_NOT_INIZIALIZED, CS_INITIALIZED, CS_FULLY_INITIALIZED } CsInitState; -typedef enum _CsWaiterReturnState { CS_WAITER_WOKEN_UP, CS_WAITER_DIDNT_WAIT } CsWaiterReturnState; - -typedef struct _CRITICAL_SECTION_DEBUG_INFO { - LONG volatile ContentionCount; - LONG volatile InternalContentionCount; - ULONG volatile AcquireCount; - ULONG volatile EnterCount; -} CRITICAL_SECTION_DEBUG_INFO, *PCRITICAL_SECTION_DEBUG_INFO; - -typedef struct _CRITICAL_SECTION_NATIVE_DATA { - pthread_mutex_t Mutex; -} CRITICAL_SECTION_NATIVE_DATA, *PCRITICAL_SECTION_NATIVE_DATA; - -typedef struct _CRITICAL_SECTION { - - CsInitState InitCount; - PCRITICAL_SECTION_DEBUG_INFO DebugInfo; - LONG LockCount; - LONG RecursionCount; - HANDLE OwningThread; - HANDLE LockSemaphore; - ULONG_PTR SpinCount; - CRITICAL_SECTION_NATIVE_DATA NativeData; - -} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION; - -int MTXInitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); -int MTXDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection); -int MTXEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); -int MTXLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - -extern "C" { - LONG InterlockedCompareExchange( - LONG volatile *Destination, - LONG Exchange, - LONG Comperand); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/pal_composite_native_cs.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/pal_composite_native_cs.cpp deleted file mode 100644 index d98669c2b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/pal_composite_native_cs.cpp +++ /dev/null @@ -1,470 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include -#include -#include -#include -#include -//#include -//#include "mtx_critsect.cpp" -#include "mtx_critsect.h" -#include "resultbuffer.h" - - - -#define LONGLONG long long -#define ULONGLONG unsigned LONGLONG -/*Defining Global Variables*/ - -int THREAD_COUNT=0; -int REPEAT_COUNT=0; -int GLOBAL_COUNTER=0; -int USE_PROCESS_COUNT = 0; -int RELATION_ID =0; -int g_counter = 0; -int MAX_PATH = 256; -LONGLONG calibrationValue = 0; - -pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t g_cv = PTHREAD_COND_INITIALIZER; -pthread_cond_t g_cv2 = PTHREAD_COND_INITIALIZER; -CRITICAL_SECTION g_cs; - -/* Capture statistics for each worker thread */ -struct statistics{ - unsigned int processId; - unsigned int operationsFailed; - unsigned int operationsPassed; - unsigned int operationsTotal; - DWORD operationTime; - unsigned int relationId; -}; - - -struct applicationStatistics{ - DWORD operationTime; - unsigned int relationId; - unsigned int processCount; - unsigned int threadCount; - unsigned int repeatCount; - char* buildNumber; - -}; - -ResultBuffer *resultBuffer; - - -void* waitforworkerthreads(void*); -void starttests(int); -int setuptest(void); -int cleanuptest(void); -int GetParameters( int , char **); -void incrementCounter(void); -ULONGLONG GetTicks(void); -ULONGLONG getPerfCalibrationValue(void); - - - -PALTEST(composite_synchronization_nativecs_interlocked_paltest_synchronization_nativecs_interlocked, "composite/synchronization/nativecs_interlocked/paltest_synchronization_nativecs_interlocked") - { - //Variable Declaration - pthread_t pthreads[640]; - int threadID[640]; - int i=0; - int j=0; - int rtn=0; - ULONGLONG startTicks = 0; - - /* Variables to capture the file name and the file pointer*/ - char fileName[MAX_PATH]; - FILE *hFile; - struct statistics* buffer; - int statisticsSize = 0; - - /*Variable to Captutre Information at the Application Level*/ - struct applicationStatistics appStats; - char mainFileName[MAX_PATH]; - FILE *hMainFile; - - //Get perfCalibrationValue - - calibrationValue = getPerfCalibrationValue(); - printf("Calibration Value for this Platform %llu \n", calibrationValue); - - - //Get Parameters - if(GetParameters(argc, argv)) - { - printf("Error in obtaining the parameters\n"); - exit(-1); - } - - //Assign Values to Application Statistics Members - appStats.relationId=RELATION_ID; - appStats.operationTime=0; - appStats.buildNumber = "999.99"; - appStats.processCount = USE_PROCESS_COUNT; - appStats.threadCount = THREAD_COUNT; - appStats.repeatCount = REPEAT_COUNT; - - printf("RELATION ID : %d\n", appStats.relationId); - printf("Process Count : %d\n", appStats.processCount); - printf("Thread Count : %d\n", appStats.threadCount); - printf("Repeat Count : %d\n", appStats.repeatCount); - - - //Open file for Application Statistics Collection - snprintf(mainFileName, MAX_PATH, "main_nativecriticalsection_%d_.txt",appStats.relationId); - hMainFile = fopen(mainFileName, "w+"); - - if(hMainFile == NULL) - { - printf("Error in opening main file for write\n"); - } - - - for (i=0;igetResultBuffer(i); - fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); - //printf("Iteration %d over\n", i); - } - } - fclose(hFile); - - - - //Call Test Case Cleanup Routine - if (0!=cleanuptest()) - { - //Error Condition - printf("Error Cleaning up Test Case"); - exit(-1); - } - - - if(hMainFile!= NULL) - { - printf("Writing to Main File \n"); - fprintf(hMainFile, "%lu,%d,%d,%d,%d,%s\n", appStats.operationTime, appStats.relationId, appStats.processCount, appStats.threadCount, appStats.repeatCount, appStats.buildNumber); - - } - fclose(hMainFile); - return 0; - } - -void * waitforworkerthreads(void * threadId) -{ - - int *threadParam = (int*) threadId; - -// printf("Thread ID : %d \n", *threadParam); - - //Acquire Lock - if (0!=pthread_mutex_lock(&g_mutex)) - { - //Error Condition - printf("Error Acquiring Mutex Lock in Wait for Worker Thread\n"); - exit(-1); - } - - //Increment Global Counter - GLOBAL_COUNTER++; - - - //If global counter is equal to thread count then signal main thread - if (GLOBAL_COUNTER == THREAD_COUNT) - { - if (0!=pthread_cond_signal(&g_cv2)) - { - //Error Condition - printf("Error in setting conditional variable\n"); - exit(-1); - } - } - - //Wait for main thread to signal - if (0!=pthread_cond_wait(&g_cv,&g_mutex)) - { - //Error Condition - printf("Error waiting on conditional variable in Worker Thread\n"); - exit(-1); - } - - //Release the mutex lock - if (0!=pthread_mutex_unlock(&g_mutex)) - { - //Error Condition - printf("Error Releasing Mutex Lock in Worker Thread\n"); - exit(-1); - } - - //Start the test - starttests(*threadParam); - -} - -void starttests(int threadID) -{ - /*All threads beign executing tests cases*/ - int i = 0; - int Id = threadID; - struct statistics stats; - ULONGLONG startTime = 0; - ULONGLONG endTime = 0; - - LONG volatile Destination; - LONG Exchange; - LONG Comperand; - LONG result; - - stats.relationId = RELATION_ID; - stats.processId = USE_PROCESS_COUNT; - stats.operationsFailed = 0; - stats.operationsPassed = 0; - stats.operationsTotal = 0; - stats.operationTime = 0; - - //Enter and Leave Critical Section in a loop REPEAT_COUNT Times - - - startTime = GetTicks(); - - for (i=0;iLogResult(Id, (char *)&stats)) - { - printf("Error while writing to shared memory, Thread Id is[??] and Process id is [%d]\n", USE_PROCESS_COUNT); - } - -} - -int setuptest(void) -{ - - //Initialize Critical Section - /* - if (0!=MTXInitializeCriticalSection( &g_cs)) - { - return -1; - } - */ - return 0; -} - -int cleanuptest(void) -{ - - //Delete Critical Section - /* - if (0!=MTXDeleteCriticalSection(&g_cs)) - { - return -1; - } - */ - return 0; -} - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - printf("PAL -Composite Native Critical Section Test\n"); - printf("Usage:\n"); - printf("\t[PROCESS_ID ( greater than 1] \n"); - printf("\t[THREAD_COUNT ( greater than 1] \n"); - printf("\t[REPEAT_COUNT ( greater than 1]\n"); - printf("\t[RELATION_ID [greater than or Equal to 1]\n"); - return -1; - } - - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - printf("\nInvalid THREAD_COUNT number, Pass greater than 1\n"); - return -1; - } - - THREAD_COUNT = atoi(argv[2]); - if( THREAD_COUNT < 1) - { - printf("\nInvalid THREAD_COUNT number, Pass greater than 1\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - printf("\nInvalid REPEAT_COUNT number, Pass greater than 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - printf("\nInvalid RELATION_ID number, Pass greater than 1\n"); - return -1; - } - - - return 0; -} - -void incrementCounter(void) -{ - g_counter ++; -} - - -//Implementation borrowed from pertrace.c -ULONGLONG GetTicks(void) -{ -#ifdef i386 - unsigned long a, d; - asm volatile("rdtsc":"=a" (a), "=d" (d)); - return ((ULONGLONG)((unsigned int)(d)) << 32) | (unsigned int)(a); -#else - // #error Don''t know how to get ticks on this platform - return (ULONGLONG)gethrtime(); -#endif // i386 -} - - -/**/ -ULONGLONG getPerfCalibrationValue(void) -{ - ULONGLONG startTicks; - ULONGLONG endTicks; - - startTicks = GetTicks(); - sleep(1); - endTicks = GetTicks(); - - return ((endTicks-startTicks)/1000); //Return number of Ticks in One Milliseconds - -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/resultbuffer.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/resultbuffer.cpp deleted file mode 100644 index 9988a49f9..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/resultbuffer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -//#include "stdafx.h" -#include "resultbuffer.h" - -ResultBuffer:: ResultBuffer(int ThreadCount, int ThreadLogSize) - { - // Declare an internal status variable - int Status=0; - - // Update the maximum thread count - MaxThreadCount = ThreadCount; - - // Allocate the memory buffer based on the passed in thread and process counts - // and the specified size of the thread specific buffer - buffer = NULL; - buffer = (char*)malloc(ThreadCount*ThreadLogSize); - // Check to see if the buffer memory was allocated - if (buffer == NULL) - Status = -1; - // Initialize the buffer to 0 to prevent bogus data - memset(buffer,0,ThreadCount*ThreadLogSize); - - // The ThreadOffset is equal to the total number of bytes that will be stored per thread - ThreadOffset = ThreadLogSize; - - } - - - int ResultBuffer::LogResult(int Thread, char* Data) - { - // Declare an internal status flad - int status = 0; - - // Declare an object to store the offset address into the buffer - int Offset; - - // Check to make sure the Thread index is not out of range - if(Thread > MaxThreadCount) - { - printf("Thread index is out of range, Value of Thread[%d], Value of MaxThreadCount[%d]\n", Thread, MaxThreadCount); - status = -1; - return(status); - } - - // Calculate the offset into the shared buffer based on the process and thread indices - Offset = (Thread)*ThreadOffset; - - // Write the passed in data to the reserved buffer - memcpy(buffer+Offset,Data,ThreadOffset); - - return(status); - } - - - char* ResultBuffer::getResultBuffer(int threadId) - { - - return (buffer + threadId*ThreadOffset); - - } - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/resultbuffer.h b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/resultbuffer.h deleted file mode 100644 index c3d9a27fd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/synchronization/nativecs_interlocked/resultbuffer.h +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include -#include -//#include -#ifndef _RESULT_BUFFER_H_ -#define _RESULT_BUFFER_H_ - -//#include - -struct ResultData -{ - int value; - int size; -// ResultData* NextResult; -}; - - class ResultBuffer -{ - // Declare a pointer to a memory buffer to store the logged results - char* buffer; - // Declare an object to store the maximum Thread count - int MaxThreadCount; - // Declare and internal data object to store the calculated offset between adjacent threads data sets - int ThreadOffset; - - // Declare a linked list object to store the parameter values -public: - - // Declare a constructor for the single process case - ResultBuffer(int ThreadCount, int ThreadLogSize); - // Declare a method to log data for the single process instance - int LogResult(int Thread, char* Data); - - char* getResultBuffer(int threadId); -}; - -#include "resultbuffer.cpp" -#endif // _RESULT_BUFFER_H_ - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/mainWrapper.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/mainWrapper.cpp deleted file mode 100644 index 24cb27d10..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/mainWrapper.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/* -Source Code: mainWrapper.c - -mainWrapper.c creates Composite Test Case Processes and waits for all processes to get over - -Algorithm -o Create PROCESS_COUNT processes. - -Author: RameshG -*/ - -#include -#include "resulttime.h" - -/* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //default -unsigned int WORKER_THREAD_MULTIPLIER_COUNT = 0; //default -unsigned int REPEAT_COUNT = 0; //default -unsigned int SLEEP_LENGTH = 0; //default -unsigned int RELATION_ID = 0;//default -unsigned int THREAD_COUNT = 1; //There is only one suspender and resume thread for this test case - -char *testCaseName; - - -struct applicationStatistics{ - DWORD operationTime; - unsigned int relationId; - unsigned int processCount; - unsigned int threadCount; - unsigned int repeatCount; - char* buildNumber; - -}; - - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - printf("PAL -Composite Thread Suspension Test\n"); - printf("Usage:\n"); - printf("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - printf("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to %d \n", MAXIMUM_WAIT_OBJECTS); - printf("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - printf("\t[RELATION_ID [greater than or Equal to 1]\n"); - return -1; - } - - // Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - printf("\nPROCESS_COUNT to greater than or equal to 1\n"); - return -1; - } - - WORKER_THREAD_MULTIPLIER_COUNT = atoi(argv[2]); - if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) - { - printf("\nWORKER_THREAD_MULTIPLIER_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - printf("\nREPEAT_COUNT to greater than or equal to 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - printf("\nRELATION_ID to be greater than or equal to 1\n"); - return -1; - } - - - - return 0; -} - -PALTEST(composite_threading_threadsuspension_paltest_threading_threadsuspension, "composite/threading/threadsuspension/paltest_threading_threadsuspension") -{ - unsigned int i = 0; - HANDLE hProcess[MAXIMUM_WAIT_OBJECTS]; - DWORD processReturnCode = 0; - int testReturnCode = PASS; - STARTUPINFO si[MAXIMUM_WAIT_OBJECTS]; - PROCESS_INFORMATION pi[MAXIMUM_WAIT_OBJECTS]; - - FILE *hFile; - char fileName[MAX_PATH]; - struct applicationStatistics appStats; - - DWORD dwStart=0; - - char lpCommandLine[MAX_PATH] = ""; - - char build[] ="0000.00"; - int returnCode = 0; - - if(0 != (PAL_Initialize(argc, argv))) - { - return ( FAIL ); - } - - //Initialize Application Statistics Structure - appStats.relationId=RELATION_ID; - appStats.operationTime=0; - appStats.buildNumber = getBuildNumber(); - //appStats.buildNumber = build; - appStats.processCount = 0; - appStats.threadCount = 0; - appStats.repeatCount = 0; - - - - - -//Start Process Time Capture -dwStart = GetTickCount(); - - if(GetParameters(argc, argv)) - { - Fail("Error in obtaining the parameters\n"); - } - -//Assign Correct Values to the Application Stats Structure - appStats.relationId=RELATION_ID; - appStats.processCount = USE_PROCESS_COUNT; - appStats.threadCount = THREAD_COUNT ; - appStats.repeatCount = REPEAT_COUNT; - - Trace("Relation ID: %d \n", RELATION_ID); - Trace("USE_PROCESS_COUNT: %d \n", USE_PROCESS_COUNT); - Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); - Trace("REPEAT_COUNT: %d \n", REPEAT_COUNT); - - -_snprintf(fileName, MAX_PATH, "main_threadsuspension_%d_.txt",appStats.relationId); - - hFile = fopen(fileName, "w+"); -if(hFile == NULL) - { - Fail("Error in opening file to write application results for Thread Suspension Test with error code %d \n", GetLastError() ); - } - - - - for( i = 0; i < USE_PROCESS_COUNT; i++ ) - { - - ZeroMemory( lpCommandLine, MAX_PATH ); - if ( _snprintf( lpCommandLine, MAX_PATH-1, "threadsuspension %d %d %d %d", i, WORKER_THREAD_MULTIPLIER_COUNT, REPEAT_COUNT, RELATION_ID) < 0 ) - { - Trace ("Error: Insufficient commandline string length for iteration [%d]\n", i); - } - - /* Zero the data structure space */ - ZeroMemory ( &pi[i], sizeof(pi[i]) ); - ZeroMemory ( &si[i], sizeof(si[i]) ); - - /* Set the process flags and standard io handles */ - si[i].cb = sizeof(si[i]); - - //Printing the Command Line - //Trace("Command Line \t %s \n", lpCommandLine); - - //Create Process - if(!CreateProcess( NULL, /* lpApplicationName*/ - lpCommandLine, /* lpCommandLine */ - NULL, /* lpProcessAttributes */ - NULL, /* lpThreadAttributes */ - TRUE, /* bInheritHandles */ - 0, /* dwCreationFlags, */ - NULL, /* lpEnvironment */ - NULL, /* pCurrentDirectory */ - &si[i], /* lpStartupInfo */ - &pi[i] /* lpProcessInformation */ - )) - { - Fail("Process Not created for [%d] and GetLastError value is %d\n", i, GetLastError()); - - } - else - { - hProcess[i] = pi[i].hProcess; - //Trace("Process created for [%d]\n", i); - } - - } - - returnCode = WaitForMultipleObjects( USE_PROCESS_COUNT, hProcess, TRUE, INFINITE); - if( WAIT_OBJECT_0 != returnCode ) - { - Trace("Wait for Object(s) @ Main thread for %d processes returned %d, and GetLastError value is %d\n", USE_PROCESS_COUNT, returnCode, GetLastError()); - testReturnCode = FAIL; - } - - for( i = 0; i < USE_PROCESS_COUNT; i++ ) - { - /* check the exit code from the process */ - if( ! GetExitCodeProcess( pi[i].hProcess, &processReturnCode ) ) - { - Trace( "GetExitCodeProcess call failed for iteration %d with error code %u\n", - i, GetLastError() ); - - testReturnCode = FAIL; - } - - if(processReturnCode == FAIL) - { - Trace( "Process [%d] failed and returned FAIL\n", i); - testReturnCode = FAIL; - } - - if(!CloseHandle(pi[i].hThread)) - { - Trace("Error:%d: CloseHandle failed for Process [%d] hThread\n", GetLastError(), i); - testReturnCode = FAIL; - } - - if(!CloseHandle(pi[i].hProcess) ) - { - Trace("Error:%d: CloseHandle failed for Process [%d] hProcess\n", GetLastError(), i); - testReturnCode = FAIL; - } - } - -//Get the end time of the process -appStats.operationTime = GetTickCount() - dwStart; - -if( testReturnCode == PASS) - { - Trace("Test Passed\n"); - } - else - { - Trace("Test Failed\n"); - } - -//Write Process Result Contents to File -if(hFile!= NULL) - { - fprintf(hFile, "%lu,%d,%d,%d,%d,%s\n", appStats.operationTime, appStats.relationId, appStats.processCount, appStats.threadCount, appStats.repeatCount, appStats.buildNumber); - } - -if (0!=fclose(hFile)) -{ - Trace("Error:%d: fclose failed for file %s\n", GetLastError(), fileName); -} - PAL_Terminate(); - - -if( testReturnCode == PASS) - { - return PASS; - } - else - { - return FAIL; - - } - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/readme.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/readme.txt deleted file mode 100644 index d722f1d12..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -To compile: - -1) create a dat file (say threadsuspension.dat) with contents: -PAL,Composite,palsuite\composite\threading\threadsuspension,wfmo=mainWrapper.c threadsuspension.c,,, - -2) perl rrunmod.pl -r threadsuspension.dat - - -To execute: -mainWrapper [PROCESS_COUNT] [THREAD_COUNT] [REPEAT_COUNT] - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp deleted file mode 100644 index 9e0492d72..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp +++ /dev/null @@ -1,906 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: \composite\threading\threadsuspension\threadsuspension.c -** -** Purpose: To verify Thread Suspension Reegneering effort for this milestone - - PsedoCode: - - Preparation: - Create PROCESS_COUNT processes. - Test: - Create Worker Thread - Start Reading and writing to a File - - Create Worker Thread - In an infinite loop do the following - Enter Critical Section - Increment Counter - Leave Critical Section - - Create Worker Thread - Allocate Memory and Free Memory - - Create Worker Thread - In a tight loop add numbers - - In a loop repeated REPEAT_COUNT times - - Create Thread - - Suspend all worker threads - Resume all worker threads - - At the end of the loop call PAL_Shutdown - - Parameters: - PROCESS_COUNT: Number of processes - WORKER_THREAD_MULTIPLIER_COUNT: Number of instances of worker threads in each process - REPEAT_COUNT: The number of times to execute the loop. - - Statistics Captured: - Total elapsed time - MTBF - - - Scenario: -** - One thread suspends all remaining threads which are in the middle of doing some work and resume all threads - Thread 1: Reading and Writing File - Thread 2: Enter and Leave Critical Section - Thread 3: Allocating chunks of memory - Thread 4: Perform Unsafe Operation (printf, malloc) - Thread 5: Suspends Thread 1 to Thread 4 and resumes them - -** -** -** -** Dependencies: -** -** - -** -**=========================================================*/ - -#include -#include "resultbuffer.h" - -#define BUFSIZE 4096 -#define NUMBER_OF_WORKER_THREAD_TYPES 4 -#define THREAD_MAX 64 - -#define TEST_FAIL 1 -#define TEST_PASS 0 - - -DWORD GLOBAL_COUNTER ; -DWORD UNIQUE_FILE_NUMBER=0; -HANDLE g_hEvent; - -bool failFlag = false; //To Track failure at the Operation Level - -// 2 dimensional array to hold thread handles for each worker thread -HANDLE hThread[NUMBER_OF_WORKER_THREAD_TYPES][THREAD_MAX]; - -/*unsigned int g_readfileoperation; -unsigned int g_enterleavecsoperation; -unsigned int g_allocatefreeoperation; -unsigned int g_doworintightloop; -*/ - -int TYPES_OF_WORKER_THREAD = NUMBER_OF_WORKER_THREAD_TYPES; - -int testStatus=TEST_PASS; //Indicates test failure - - -struct statistics{ - unsigned int processId; - unsigned int operationsFailed; - unsigned int operationsPassed; - unsigned int operationsTotal; - DWORD operationTime; - unsigned int relationId; -}; - -struct processStatistics{ - unsigned int processId; - DWORD operationTime; - unsigned int relationId; -}; - -/* Results Buffer */ -ResultBuffer *resultBuffer; - - -/* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //Identifies the Process number. There could potentially -unsigned int WORKER_THREAD_MULTIPLIER_COUNT = 0; //In this test case this represents the number of worker thread instances -unsigned int REPEAT_COUNT = 0; //Number of Suspend Resume operation of worker threads -unsigned int RELATION_ID = 0; - - - -CRITICAL_SECTION CriticalSectionM; /* Critical Section Object (used as mutex) */ -CRITICAL_SECTION g_csUniqueFileName; - -void PALAPI setup(void); -void PALAPI cleanup(void); -void PALAPI incrementCounter(void); -DWORD PALAPI readfile( LPVOID); -DWORD PALAPI enterandleave_cs( LPVOID); -DWORD PALAPI allocateandfree_memory( LPVOID); -DWORD PALAPI doworkintightloop_cs( LPVOID); -DWORD PALAPI suspendandresumethreads( LPVOID); -int GetParameters(int, char * *); - - -//Main Entry for the Thread Suspension Test Case -PALTEST(composite_threading_threadsuspension_paltest_threading_threadsuspension, "composite/threading/threadsuspension/paltest_threading_threadsuspension") -{ - -/* -* Parameter to the threads that will be created -*/ - - -DWORD dwThrdParam = 0; -DWORD dwStart; - -/* Variables to capture the file name and the file pointer*/ -char fileName[MAX_PATH]; -char processFileName[MAX_PATH]; - -FILE *hFile, *hProcessFile; -struct statistics* buffer; -struct processStatistics *processBuffer; - -struct processStatistics processStats; - -struct statistics* tmpBuf = NULL; -int statisticsSize = 0; - -DWORD dwThreadId=0; -HANDLE hMainThread; -unsigned int i = 0; -int j = 0; - - -/* -* PAL Initialize -*/ - -if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - -//Get Parameters -if(GetParameters(argc, argv)) - { - Fail("Error in obtaining the parameters\n"); - } - - -//Setup for Process Result Collection -statisticsSize = sizeof(struct statistics); -_snprintf(processFileName, MAX_PATH, "%d_process_threadsuspension_%d_.txt", USE_PROCESS_COUNT, RELATION_ID); -hProcessFile = fopen(processFileName, "w+"); - -if(hProcessFile == NULL) - { - Fail("Error in opening file to write process results for process [%d]\n", USE_PROCESS_COUNT); - } - -//Initialize Process Stats Variables -processStats.operationTime = 0; -processStats.processId = USE_PROCESS_COUNT; -processStats.relationId = RELATION_ID; - -//Start Process Time Capture -dwStart = GetTickCount(); - -//Setup for Thread Result Collection -statisticsSize = sizeof(struct statistics); -_snprintf(fileName, MAX_PATH, "%d_thread_threadsuspension_%d_.txt", USE_PROCESS_COUNT,RELATION_ID); -hFile = fopen(fileName, "w+"); - -if(hFile == NULL) - { - Fail("Error in opening file to write thread results for process [%d]\n", USE_PROCESS_COUNT); - } - -// For each thread we will log relationid (int), processid (int), operations failed (int), passed (int), total (int) -// and number of ticks (DWORD) for the operations -resultBuffer = new ResultBuffer( 1, statisticsSize); - -/* -* Call the Setup Routine -*/ -setup(); - -Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); - -//Create WORKER_THREAD_MULTIPLIER_COUNT Instances of each type of worker thread -for (i=0;igetResultBuffer(i); - fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); - } - } - -if (0!=fclose(hFile)) -{ - Fail("Unable to write thread results to file" - "GetLastError returned %d\n", GetLastError()); -} - -cleanup(); - -if (failFlag == TRUE) -{ - return FAIL; -} -else -{ - return PASS; -} -} - - -/* -* Setup for the test case -*/ - -VOID -setup(VOID) -{ - /*Delete All Temporary Files Created by the previous execution of the test case*/ - HANDLE hSearch; - BOOL fFinished = FALSE; - WIN32_FIND_DATA FileData; - - //Start searching for .tmp files in the current directory. - hSearch = FindFirstFile("*.tmp*", &FileData); - if (hSearch == INVALID_HANDLE_VALUE) - { - //No Files That Matched Criteria - fFinished = TRUE; - } - - //Delete all files that match the pattern - while (!fFinished) - { - if (!DeleteFile(FileData.cFileName)) - { - Trace("Setup: Could not delete temporary file %s\n",FileData.cFileName ); - Fail ("GetLastError returned %d\n", GetLastError()); - } - if (!FindNextFile(hSearch, &FileData)) - { - if (GetLastError() == ERROR_NO_MORE_FILES) - { - fFinished = TRUE; - } - else - { - Fail("Unable to Delete Temporary Files, GetLastError is %d \n", GetLastError()); - } - } - } - - // Close the search handle, only if HANDLE is Valid - if (hSearch != INVALID_HANDLE_VALUE) - { - if (!FindClose(hSearch)) - { - Trace("Setup: Could not close search handle \n"); - Fail ("GetLastError returned %d\n", GetLastError()); - } - } - - g_hEvent = CreateEvent(NULL,TRUE,FALSE, NULL); - if(g_hEvent == NULL) - { - Fail("Create Event Failed\n" - "GetLastError returned %d\n", GetLastError()); - } - - InitializeCriticalSection ( &g_csUniqueFileName); -} - -/* -* Cleanup for the test case -*/ - -VOID -cleanup(VOID) -{ - //DeleteCriticalSection(&g_csUniqueFileName); - PAL_Terminate(); -} - - -VOID -incrementCounter(VOID) -{ - - if (INT_MAX == GLOBAL_COUNTER) - { - GLOBAL_COUNTER = 0; - } - - GLOBAL_COUNTER++; -} - -/* - * Worker Thread - * Read File: Read from a file and write to a temporary file and then delete the temp file - */ -DWORD -PALAPI -readfile( LPVOID lpParam ) -{ - - // Declaring Local Variables - HANDLE hFile,hTempfile; - char buffer[BUFSIZE]; - DWORD dwBytesRead, dwBytesWritten, dwBufSize=BUFSIZE; - DWORD dwWaitResult=0; - char filename[MAX_PATH]; - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("readfile: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - - /*Start Operation*/ - - // Open the existing file. - while(TRUE) - { - - hFile = CreateFile("samplefile.dat", // file name - GENERIC_READ, // open for reading - FILE_SHARE_READ, // Share the file for read - NULL, // default security - OPEN_EXISTING, // existing file only - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template - - if (hFile == INVALID_HANDLE_VALUE) - { - Trace("Could not open file \n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - //Generate Unique File Name to Write - //Enter CS - EnterCriticalSection(&g_csUniqueFileName); - - //Increment Number and assign to local variable - UNIQUE_FILE_NUMBER++; - _snprintf(filename, MAX_PATH, "%d_%d_tempfile.tmp", USE_PROCESS_COUNT,UNIQUE_FILE_NUMBER); - //filename = itoa(UNIQUE_FILE_NUMBER); - //Leave CS - LeaveCriticalSection(&g_csUniqueFileName); - - - // Create a temporary file with name generate above - hTempfile = CreateFile(filename, // file name - GENERIC_WRITE, // open for read/write - 0, // do not share - NULL, // default security - CREATE_ALWAYS, // overwrite existing file - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template - - - if (hTempfile == INVALID_HANDLE_VALUE) - { - Trace("Could not create temporary file\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - // Read 4K blocks to the buffer. - // Change all characters in the buffer to upper case. - // Write the buffer to the temporary file. - - do - { - if (ReadFile(hFile, buffer, 4096, - &dwBytesRead, NULL)) - { - - WriteFile(hTempfile, buffer, dwBytesRead, - &dwBytesWritten, NULL); - } - } while (dwBytesRead == BUFSIZE); - - - - // Close both files. - if (0==CloseHandle(hFile)) - { - Trace("Could not handle hFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - if (0==CloseHandle(hTempfile)) - { - Trace("Could not handle hTempFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - //Delete the file that was created - if (!DeleteFile(filename)) - { - Trace("Could not delete temporary file %s\n", filename); - Fail ( "GetLastError returned %d\n", GetLastError()); - - } - - //g_readfileoperation++; - } - -/*End Operation*/ - - return 0; -} - - -/* Worker Thread - * Enter and Leave Nested Critical Sections - */ -DWORD -PALAPI -enterandleave_cs( LPVOID lpParam ) -{ - - //Declare Local Variables - - CRITICAL_SECTION lcs; - CRITICAL_SECTION lcsNested; - - DWORD dwWaitResult; - - //Initialize Critical Section Structures - InitializeCriticalSection ( &lcs); - InitializeCriticalSection ( &lcsNested); - - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("enterandleave_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - //Trace("Critical Section Started\n"); - - while(TRUE) - { - EnterCriticalSection(&lcs); - - EnterCriticalSection(&lcsNested); - - incrementCounter(); - - LeaveCriticalSection(&lcsNested); - - LeaveCriticalSection(&lcs); - //g_enterleavecsoperation++; - } - - //Delete Critical Section Structures - - DeleteCriticalSection(&lcs); - DeleteCriticalSection(&lcsNested); - - - return 0; -} - - -/* - * Allocate and Free Memory - */ -DWORD -PALAPI -allocateandfree_memory( LPVOID lpParam ) -{ - - - int i; - char *textArrPtr[64]; - DWORD dwWaitResult; - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("allocateandfree_memory: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - - while(TRUE) - { - - //do allocate and free operation - - for (i=0;i<64;i++) - { - textArrPtr[i] = (char*) malloc(BUFSIZE); - if (textArrPtr[i] == NULL) - { - Fail("Insufficient Memory Available, GetLastError is %d \n", GetLastError()); - testStatus = TEST_FAIL; - } - } - - for (i=0;i<64;i++) - { - free(textArrPtr[i]); - } - //g_allocatefreeoperation++; - } - - - - - return 0; -} - -/* - * Do work in a tight loop - */ -DWORD -PALAPI -doworkintightloop_cs( LPVOID lpParam ) -{ - - unsigned int i; - DWORD dwWaitResult; - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("doworkintightloop_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - i= 0; - while (TRUE) - { - - if (INT_MAX == i) - i =0; - i++; - //g_doworintightloop++; - } - - return 0; -} - - -/* - * Main Test Case worker thread which will suspend and resume all other worker threads - */ -DWORD -PALAPI -suspendandresumethreads( LPVOID lpParam ) -{ - - unsigned int loopcount = REPEAT_COUNT; - int Id=(int)lpParam; - unsigned int i,j,k; - DWORD dwStart; - DWORD dwWaitResult=0; - DWORD dwLastError = 0; - struct statistics stats; - struct statistics* buffer; - - - - //Initialize the Statistics Structure - stats.relationId = RELATION_ID; - stats.processId = USE_PROCESS_COUNT; - stats.operationsFailed = 0; - stats.operationsPassed = 0; - stats.operationsTotal = 0; - stats.operationTime = 0; - - - - //Wait for event to signal to start test - WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("suspendandresumethreads: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - - //Capture Start Import - dwStart = GetTickCount(); - - for(i = 0; i < loopcount; i++) - { - - failFlag = false; - - //Suspend Worker Threads - for (k=0;kLogResult(Id, (char *)&stats)) - { - Fail("Error while writing to shared memory, Thread Id is[%d] and Process id is [%d]\n", Id, USE_PROCESS_COUNT); - } - - buffer = (struct statistics *)resultBuffer->getResultBuffer(Id); - //Trace("\n%d,%d,%d,%lu\n", buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime ); - - - return 0; -} - - - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - Trace("PAL -Composite Thread Suspension Test\n"); - Trace("Usage:\n"); - Trace("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - Trace("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); - Trace("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - Trace("\t[RELATION_ID [greater than or Equal to 1]\n"); - return -1; - } - -// Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - Trace("\nPROCESS_COUNT to greater than or equal to 1\n"); - return -1; - } - - WORKER_THREAD_MULTIPLIER_COUNT = atoi(argv[2]); - if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) - { - Trace("\nWORKER_THREAD_MULTIPLIER_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - Trace("\nREPEAT_COUNT to greater than or equal to 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - Trace("\nRELATION_ID to be greater than or equal to 1\n"); - return -1; - } - return 0; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/mainWrapper.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/mainWrapper.cpp deleted file mode 100644 index f934bd421..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/mainWrapper.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/* -Source Code: mainWrapper.c - -mainWrapper.c creates Composite Test Case Processes and waits for all processes to get over - -Algorithm -o Create PROCESS_COUNT processes. - -Author: RameshG -*/ - -#include -#include "resulttime.h" - -/* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //default -unsigned int WORKER_THREAD_MULTIPLIER_COUNT = 0; //default -unsigned int REPEAT_COUNT = 0; //default -unsigned int SLEEP_LENGTH = 0; //default -unsigned int RELATION_ID = 0;//default -unsigned int THREAD_COUNT = 1; //There is only one suspender and resume thread for this test case - -char *testCaseName; - - -struct applicationStatistics{ - DWORD operationTime; - unsigned int relationId; - unsigned int processCount; - unsigned int threadCount; - unsigned int repeatCount; - char* buildNumber; - -}; - - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - printf("PAL -Composite Thread Suspension Test\n"); - printf("Usage:\n"); - printf("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - printf("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to %d \n", MAXIMUM_WAIT_OBJECTS); - printf("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - printf("\t[RELATION_ID [greater than or Equal to 1]\n"); - return -1; - } - - // Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - printf("\nPROCESS_COUNT to greater than or equal to 1\n"); - return -1; - } - - WORKER_THREAD_MULTIPLIER_COUNT = atoi(argv[2]); - if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) - { - printf("\nWORKER_THREAD_MULTIPLIER_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - printf("\nREPEAT_COUNT to greater than or equal to 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - printf("\nRELATION_ID to be greater than or equal to 1\n"); - return -1; - } - - - - return 0; -} - -PALTEST(composite_threading_threadsuspension_switchthread_paltest_threading_threadsuspension_switchthread, "composite/threading/threadsuspension_switchthread/paltest_threading_threadsuspension_switchthread") -{ - unsigned int i = 0; - HANDLE hProcess[MAXIMUM_WAIT_OBJECTS]; - DWORD processReturnCode = 0; - int testReturnCode = PASS; - STARTUPINFO si[MAXIMUM_WAIT_OBJECTS]; - PROCESS_INFORMATION pi[MAXIMUM_WAIT_OBJECTS]; - - FILE *hFile; - char fileName[MAX_PATH]; - struct applicationStatistics appStats; - - DWORD dwStart=0; - - char lpCommandLine[MAX_PATH] = ""; - - char build[] ="0000.00"; - int returnCode = 0; - - if(0 != (PAL_Initialize(argc, argv))) - { - return ( FAIL ); - } - - //Initialize Application Statistics Structure - appStats.relationId=RELATION_ID; - appStats.operationTime=0; - appStats.buildNumber = getBuildNumber(); - //appStats.buildNumber = build; - appStats.processCount = 0; - appStats.threadCount = 0; - appStats.repeatCount = 0; - - - - - -//Start Process Time Capture -dwStart = GetTickCount(); - - if(GetParameters(argc, argv)) - { - Fail("Error in obtaining the parameters\n"); - } - -//Assign Correct Values to the Application Stats Structure - appStats.relationId=RELATION_ID; - appStats.processCount = USE_PROCESS_COUNT; - appStats.threadCount = THREAD_COUNT ; - appStats.repeatCount = REPEAT_COUNT; - - Trace("Relation ID: %d \n", RELATION_ID); - Trace("USE_PROCESS_COUNT: %d \n", USE_PROCESS_COUNT); - Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); - Trace("REPEAT_COUNT: %d \n", REPEAT_COUNT); - - -_snprintf(fileName, MAX_PATH, "main_threadsuspension_%d_.txt",appStats.relationId); - - hFile = fopen(fileName, "w+"); -if(hFile == NULL) - { - Fail("Error in opening file to write application results for Thread Suspension Test with error code %d \n", GetLastError() ); - } - - - - for( i = 0; i < USE_PROCESS_COUNT; i++ ) - { - - ZeroMemory( lpCommandLine, MAX_PATH ); - if ( _snprintf( lpCommandLine, MAX_PATH-1, "threadsuspension %d %d %d %d", i, WORKER_THREAD_MULTIPLIER_COUNT, REPEAT_COUNT, RELATION_ID) < 0 ) - { - Trace ("Error: Insufficient commandline string length for iteration [%d]\n", i); - } - - /* Zero the data structure space */ - ZeroMemory ( &pi[i], sizeof(pi[i]) ); - ZeroMemory ( &si[i], sizeof(si[i]) ); - - /* Set the process flags and standard io handles */ - si[i].cb = sizeof(si[i]); - - //Printing the Command Line - //Trace("Command Line \t %s \n", lpCommandLine); - - //Create Process - if(!CreateProcess( NULL, /* lpApplicationName*/ - lpCommandLine, /* lpCommandLine */ - NULL, /* lpProcessAttributes */ - NULL, /* lpThreadAttributes */ - TRUE, /* bInheritHandles */ - 0, /* dwCreationFlags, */ - NULL, /* lpEnvironment */ - NULL, /* pCurrentDirectory */ - &si[i], /* lpStartupInfo */ - &pi[i] /* lpProcessInformation */ - )) - { - Fail("Process Not created for [%d] and GetLastError value is %d\n", i, GetLastError()); - - } - else - { - hProcess[i] = pi[i].hProcess; - //Trace("Process created for [%d]\n", i); - } - - } - - returnCode = WaitForMultipleObjects( USE_PROCESS_COUNT, hProcess, TRUE, INFINITE); - if( WAIT_OBJECT_0 != returnCode ) - { - Trace("Wait for Object(s) @ Main thread for %d processes returned %d, and GetLastError value is %d\n", USE_PROCESS_COUNT, returnCode, GetLastError()); - testReturnCode = FAIL; - } - - for( i = 0; i < USE_PROCESS_COUNT; i++ ) - { - /* check the exit code from the process */ - if( ! GetExitCodeProcess( pi[i].hProcess, &processReturnCode ) ) - { - Trace( "GetExitCodeProcess call failed for iteration %d with error code %u\n", - i, GetLastError() ); - - testReturnCode = FAIL; - } - - if(processReturnCode == FAIL) - { - Trace( "Process [%d] failed and returned FAIL\n", i); - testReturnCode = FAIL; - } - - if(!CloseHandle(pi[i].hThread)) - { - Trace("Error:%d: CloseHandle failed for Process [%d] hThread\n", GetLastError(), i); - testReturnCode = FAIL; - } - - if(!CloseHandle(pi[i].hProcess) ) - { - Trace("Error:%d: CloseHandle failed for Process [%d] hProcess\n", GetLastError(), i); - testReturnCode = FAIL; - } - } - -//Get the end time of the process -appStats.operationTime = GetTickCount() - dwStart; - -if( testReturnCode == PASS) - { - Trace("Test Passed\n"); - } - else - { - Trace("Test Failed\n"); - } - -//Write Process Result Contents to File -if(hFile!= NULL) - { - fprintf(hFile, "%lu,%d,%d,%d,%d,%s\n", appStats.operationTime, appStats.relationId, appStats.processCount, appStats.threadCount, appStats.repeatCount, appStats.buildNumber); - } - -if (0!=fclose(hFile)) -{ - Trace("Error:%d: fclose failed for file %s\n", GetLastError(), fileName); -} - PAL_Terminate(); - - -if( testReturnCode == PASS) - { - return PASS; - } - else - { - return FAIL; - - } - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/readme.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/readme.txt deleted file mode 100644 index d722f1d12..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -To compile: - -1) create a dat file (say threadsuspension.dat) with contents: -PAL,Composite,palsuite\composite\threading\threadsuspension,wfmo=mainWrapper.c threadsuspension.c,,, - -2) perl rrunmod.pl -r threadsuspension.dat - - -To execute: -mainWrapper [PROCESS_COUNT] [THREAD_COUNT] [REPEAT_COUNT] - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp deleted file mode 100644 index d1f11d304..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp +++ /dev/null @@ -1,913 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: \composite\threading\threadsuspension\threadsuspension.c -** -** Purpose: To verify Thread Suspension Reegneering effort for this milestone - - PsedoCode: - - Preparation: - Create PROCESS_COUNT processes. - Test: - Create Worker Thread - Start Reading and writing to a File - - Create Worker Thread - In an infinite loop do the following - Enter Critical Section - Increment Counter - Leave Critical Section - - Create Worker Thread - Allocate Memory and Free Memory - - Create Worker Thread - In a tight loop add numbers - - In a loop repeated REPEAT_COUNT times - - Create Thread - - Suspend all worker threads - Resume all worker threads - - At the end of the loop call PAL_Shutdown - - Parameters: - PROCESS_COUNT: Number of processes - WORKER_THREAD_MULTIPLIER_COUNT: Number of instances of worker threads in each process - REPEAT_COUNT: The number of times to execute the loop. - - Statistics Captured: - Total elapsed time - MTBF - - - Scenario: -** - One thread suspends all remaining threads which are in the middle of doing some work and resume all threads - Thread 1: Reading and Writing File - Thread 2: Enter and Leave Critical Section - Thread 3: Allocating chunks of memory - Thread 4: Perform Unsafe Operation (printf, malloc) - Thread 5: Suspends Thread 1 to Thread 4 and resumes them - -** -** -** -** Dependencies: -** -** - -** -**=========================================================*/ - -#include -#include "resultbuffer.h" - -#define BUFSIZE 4096 -#define NUMBER_OF_WORKER_THREAD_TYPES 4 -#define THREAD_MAX 64 - -#define TEST_FAIL 1 -#define TEST_PASS 0 - - -DWORD GLOBAL_COUNTER ; -DWORD UNIQUE_FILE_NUMBER=0; -HANDLE g_hEvent; - -bool failFlag = false; //To Track failure at the Operation Level - -// 2 dimensional array to hold thread handles for each worker thread -HANDLE hThread[NUMBER_OF_WORKER_THREAD_TYPES][THREAD_MAX]; - -/*unsigned int g_readfileoperation; -unsigned int g_enterleavecsoperation; -unsigned int g_allocatefreeoperation; -unsigned int g_doworintightloop; -*/ - -int TYPES_OF_WORKER_THREAD = NUMBER_OF_WORKER_THREAD_TYPES; - -int testStatus=TEST_PASS; //Indicates test failure - - -struct statistics{ - unsigned int processId; - unsigned int operationsFailed; - unsigned int operationsPassed; - unsigned int operationsTotal; - DWORD operationTime; - unsigned int relationId; -}; - -struct processStatistics{ - unsigned int processId; - DWORD operationTime; - unsigned int relationId; -}; - -/* Results Buffer */ -ResultBuffer *resultBuffer; - - -/* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //Identifies the Process number. There could potentially -unsigned int WORKER_THREAD_MULTIPLIER_COUNT = 0; //In this test case this represents the number of worker thread instances -unsigned int REPEAT_COUNT = 0; //Number of Suspend Resume operation of worker threads -unsigned int RELATION_ID = 0; - - - -CRITICAL_SECTION CriticalSectionM; /* Critical Section Object (used as mutex) */ -CRITICAL_SECTION g_csUniqueFileName; - -void PALAPI setup(void); -void PALAPI cleanup(void); -void PALAPI incrementCounter(void); -DWORD PALAPI readfile( LPVOID); -DWORD PALAPI enterandleave_cs( LPVOID); -DWORD PALAPI allocateandfree_memory( LPVOID); -DWORD PALAPI doworkintightloop_cs( LPVOID); -DWORD PALAPI suspendandresumethreads( LPVOID); -int GetParameters(int, char * *); - - -//Main Entry for the Thread Suspension Test Case -PALTEST(composite_threading_threadsuspension_switchthread_paltest_threading_threadsuspension_switchthread, "composite/threading/threadsuspension_switchthread/paltest_threading_threadsuspension_switchthread") -{ - -/* -* Parameter to the threads that will be created -*/ - - -DWORD dwThrdParam = 0; -DWORD dwStart; - -/* Variables to capture the file name and the file pointer*/ -char fileName[MAX_PATH]; -char processFileName[MAX_PATH]; - -FILE *hFile, *hProcessFile; -struct statistics* buffer; -struct processStatistics *processBuffer; - -struct processStatistics processStats; - -struct statistics* tmpBuf = NULL; -int statisticsSize = 0; - -DWORD dwThreadId=0; -HANDLE hMainThread; -unsigned int i = 0; -int j = 0; - - -/* -* PAL Initialize -*/ - -if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - -//Get Parameters -if(GetParameters(argc, argv)) - { - Fail("Error in obtaining the parameters\n"); - } - - -//Setup for Process Result Collection -statisticsSize = sizeof(struct statistics); -_snprintf(processFileName, MAX_PATH, "%d_process_threadsuspension_%d_.txt", USE_PROCESS_COUNT, RELATION_ID); -hProcessFile = fopen(processFileName, "w+"); - -if(hProcessFile == NULL) - { - Fail("Error in opening file to write process results for process [%d]\n", USE_PROCESS_COUNT); - } - -//Initialize Process Stats Variables -processStats.operationTime = 0; -processStats.processId = USE_PROCESS_COUNT; -processStats.relationId = RELATION_ID; - -//Start Process Time Capture -dwStart = GetTickCount(); - -//Setup for Thread Result Collection -statisticsSize = sizeof(struct statistics); -_snprintf(fileName, MAX_PATH, "%d_thread_threadsuspension_%d_.txt", USE_PROCESS_COUNT,RELATION_ID); -hFile = fopen(fileName, "w+"); - -if(hFile == NULL) - { - Fail("Error in opening file to write thread results for process [%d]\n", USE_PROCESS_COUNT); - } - -// For each thread we will log relationid (int), processid (int), operations failed (int), passed (int), total (int) -// and number of ticks (DWORD) for the operations -resultBuffer = new ResultBuffer( 1, statisticsSize); - -/* -* Call the Setup Routine -*/ -setup(); - -Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); - -//Create WORKER_THREAD_MULTIPLIER_COUNT Instances of each type of worker thread -for (i=0;igetResultBuffer(i); - fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); - } - } - -if (0!=fclose(hFile)) -{ - Fail("Unable to write thread results to file" - "GetLastError returned %d\n", GetLastError()); -} - -cleanup(); - -if (failFlag == TRUE) -{ - return FAIL; -} -else -{ - return PASS; -} -} - - -/* -* Setup for the test case -*/ - -VOID -setup(VOID) -{ - /*Delete All Temporary Files Created by the previous execution of the test case*/ - HANDLE hSearch; - BOOL fFinished = FALSE; - WIN32_FIND_DATA FileData; - - //Start searching for .tmp files in the current directory. - hSearch = FindFirstFile("*.tmp*", &FileData); - if (hSearch == INVALID_HANDLE_VALUE) - { - //No Files That Matched Criteria - fFinished = TRUE; - } - - //Delete all files that match the pattern - while (!fFinished) - { - if (!DeleteFile(FileData.cFileName)) - { - Trace("Setup: Could not delete temporary file %s\n",FileData.cFileName ); - Fail ("GetLastError returned %d\n", GetLastError()); - } - if (!FindNextFile(hSearch, &FileData)) - { - if (GetLastError() == ERROR_NO_MORE_FILES) - { - fFinished = TRUE; - } - else - { - Fail("Unable to Delete Temporary Files, GetLastError is %d \n", GetLastError()); - } - } - } - - // Close the search handle, only if HANDLE is Valid - if (hSearch != INVALID_HANDLE_VALUE) - { - if (!FindClose(hSearch)) - { - Trace("Setup: Could not close search handle \n"); - Fail ("GetLastError returned %d\n", GetLastError()); - } - } - - g_hEvent = CreateEvent(NULL,TRUE,FALSE, NULL); - if(g_hEvent == NULL) - { - Fail("Create Event Failed\n" - "GetLastError returned %d\n", GetLastError()); - } - - InitializeCriticalSection ( &g_csUniqueFileName); -} - -/* -* Cleanup for the test case -*/ - -VOID -cleanup(VOID) -{ - //DeleteCriticalSection(&g_csUniqueFileName); - PAL_Terminate(); -} - - -VOID -incrementCounter(VOID) -{ - - if (INT_MAX == GLOBAL_COUNTER) - { - GLOBAL_COUNTER = 0; - } - - GLOBAL_COUNTER++; -} - -/* - * Worker Thread - * Read File: Read from a file and write to a temporary file and then delete the temp file - */ -DWORD -PALAPI -readfile( LPVOID lpParam ) -{ - - // Declaring Local Variables - HANDLE hFile,hTempfile; - char buffer[BUFSIZE]; - DWORD dwBytesRead, dwBytesWritten, dwBufSize=BUFSIZE; - DWORD dwWaitResult=0; - char filename[MAX_PATH]; - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("readfile: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - - /*Start Operation*/ - - // Open the existing file. - while(TRUE) - { - - hFile = CreateFile("samplefile.dat", // file name - GENERIC_READ, // open for reading - FILE_SHARE_READ, // Share the file for read - NULL, // default security - OPEN_EXISTING, // existing file only - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template - - if (hFile == INVALID_HANDLE_VALUE) - { - Trace("Could not open file \n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - //Generate Unique File Name to Write - //Enter CS - EnterCriticalSection(&g_csUniqueFileName); - - //Increment Number and assign to local variable - UNIQUE_FILE_NUMBER++; - _snprintf(filename, MAX_PATH, "%d_%d_tempfile.tmp", USE_PROCESS_COUNT,UNIQUE_FILE_NUMBER); - //filename = itoa(UNIQUE_FILE_NUMBER); - //Leave CS - LeaveCriticalSection(&g_csUniqueFileName); - - - // Create a temporary file with name generate above - hTempfile = CreateFile(filename, // file name - GENERIC_WRITE, // open for read/write - 0, // do not share - NULL, // default security - CREATE_ALWAYS, // overwrite existing file - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template - - - if (hTempfile == INVALID_HANDLE_VALUE) - { - Trace("Could not create temporary file\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - // Read 4K blocks to the buffer. - // Change all characters in the buffer to upper case. - // Write the buffer to the temporary file. - - do - { - if (ReadFile(hFile, buffer, 4096, - &dwBytesRead, NULL)) - { - - WriteFile(hTempfile, buffer, dwBytesRead, - &dwBytesWritten, NULL); - } - } while (dwBytesRead == BUFSIZE); - - - - // Close both files. - if (0==CloseHandle(hFile)) - { - Trace("Could not handle hFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - if (0==CloseHandle(hTempfile)) - { - Trace("Could not handle hTempFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } - - //Delete the file that was created - if (!DeleteFile(filename)) - { - Trace("Could not delete temporary file %s\n", filename); - Fail ( "GetLastError returned %d\n", GetLastError()); - - } - - SwitchToThread(); - //g_readfileoperation++; - } - -/*End Operation*/ - - return 0; -} - - -/* Worker Thread - * Enter and Leave Nested Critical Sections - */ -DWORD -PALAPI -enterandleave_cs( LPVOID lpParam ) -{ - - //Declare Local Variables - - CRITICAL_SECTION lcs; - CRITICAL_SECTION lcsNested; - - DWORD dwWaitResult; - - //Initialize Critical Section Structures - InitializeCriticalSection ( &lcs); - InitializeCriticalSection ( &lcsNested); - - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("enterandleave_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - //Trace("Critical Section Started\n"); - - while(TRUE) - { - EnterCriticalSection(&lcs); - - EnterCriticalSection(&lcsNested); - - incrementCounter(); - - LeaveCriticalSection(&lcsNested); - - LeaveCriticalSection(&lcs); - - SwitchToThread(); - //g_enterleavecsoperation++; - } - - //Delete Critical Section Structures - - DeleteCriticalSection(&lcs); - DeleteCriticalSection(&lcsNested); - - - return 0; -} - - -/* - * Allocate and Free Memory - */ -DWORD -PALAPI -allocateandfree_memory( LPVOID lpParam ) -{ - - - int i; - char *textArrPtr[64]; - DWORD dwWaitResult; - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("allocateandfree_memory: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - - while(TRUE) - { - - //do allocate and free operation - - for (i=0;i<64;i++) - { - textArrPtr[i] = (char*) malloc(BUFSIZE); - if (textArrPtr[i] == NULL) - { - Fail("Insufficient Memory Available, GetLastError is %d \n", GetLastError()); - testStatus = TEST_FAIL; - } - } - - for (i=0;i<64;i++) - { - free(textArrPtr[i]); - } - - SwitchToThread(); - //g_allocatefreeoperation++; - } - - - - - return 0; -} - -/* - * Do work in a tight loop - */ -DWORD -PALAPI -doworkintightloop_cs( LPVOID lpParam ) -{ - - unsigned int i; - DWORD dwWaitResult; - - //Wait for event to signal to start test - dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("doworkintightloop_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - i= 0; - while (TRUE) - { - - if (INT_MAX == i) - i =0; - i++; - //g_doworintightloop++; - - SwitchToThread(); - } - - return 0; -} - - -/* - * Main Test Case worker thread which will suspend and resume all other worker threads - */ -DWORD -PALAPI -suspendandresumethreads( LPVOID lpParam ) -{ - - unsigned int loopcount = REPEAT_COUNT; - int Id=(int)lpParam; - unsigned int i,j,k; - DWORD dwStart; - DWORD dwWaitResult=0; - DWORD dwLastError = 0; - struct statistics stats; - struct statistics* buffer; - - - - //Initialize the Statistics Structure - stats.relationId = RELATION_ID; - stats.processId = USE_PROCESS_COUNT; - stats.operationsFailed = 0; - stats.operationsPassed = 0; - stats.operationsTotal = 0; - stats.operationTime = 0; - - - - //Wait for event to signal to start test - WaitForSingleObject(g_hEvent,INFINITE); - if (WAIT_OBJECT_0 != dwWaitResult) - { - Fail ("suspendandresumethreads: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - - //Capture Start Import - dwStart = GetTickCount(); - - for(i = 0; i < loopcount; i++) - { - - failFlag = false; - - //Suspend Worker Threads - for (k=0;kLogResult(Id, (char *)&stats)) - { - Fail("Error while writing to shared memory, Thread Id is[%d] and Process id is [%d]\n", Id, USE_PROCESS_COUNT); - } - - buffer = (struct statistics *)resultBuffer->getResultBuffer(Id); - //Trace("\n%d,%d,%d,%lu\n", buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime ); - - - return 0; -} - - - -int GetParameters( int argc, char **argv) -{ - - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) - || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) - { - Trace("PAL -Composite Thread Suspension Test\n"); - Trace("Usage:\n"); - Trace("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - Trace("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); - Trace("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - Trace("\t[RELATION_ID [greater than or Equal to 1]\n"); - return -1; - } - -// Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - - USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) - { - Trace("\nPROCESS_COUNT to greater than or equal to 1\n"); - return -1; - } - - WORKER_THREAD_MULTIPLIER_COUNT = atoi(argv[2]); - if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) - { - Trace("\nWORKER_THREAD_MULTIPLIER_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); - return -1; - } - - REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) - { - Trace("\nREPEAT_COUNT to greater than or equal to 1\n"); - return -1; - } - - RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) - { - Trace("\nRELATION_ID to be greater than or equal to 1\n"); - return -1; - } - return 0; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/main.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/main.cpp index 0e0684e5f..e12cb5d59 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/main.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/main.cpp @@ -127,7 +127,7 @@ PALTEST(composite_wfmo_paltest_composite_wfmo, "composite/wfmo/paltest_composite } /* Register the start time */ - dwStartTime = GetTickCount(); + dwStartTime = (DWORD)minipal_lowres_ticks(); testStats.relationId = 0; testStats.relationId = RELATION_ID; testStats.processCount = PROCESS_COUNT; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/mutex.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/mutex.cpp index 82f59880c..ed5de0faf 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/mutex.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/composite/wfmo/mutex.cpp @@ -146,7 +146,7 @@ PALTEST(composite_wfmo_paltest_composite_wfmo, "composite/wfmo/paltest_composite } /* Register the start time */ - dwStartTime = GetTickCount(); + dwStartTime = (DWORD)minipal_lowres_ticks(); processStats.relationId = RELATION_ID; processStats.processId = USE_PROCESS_COUNT; @@ -306,7 +306,7 @@ void PALAPI Run_Thread_composite_wfmo (LPVOID lpParam) } /* Register the start time */ - dwStartTime = GetTickCount(); + dwStartTime = (DWORD)minipal_lowres_ticks(); /* Run the tests repeat count times */ for( i = 0; i < REPEAT_COUNT; i++ ) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt index 1e653ecab..cda9df41a 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt @@ -1,3 +1,5 @@ +if(NOT CLR_CMAKE_HOST_BROWSER) + if(CLR_CMAKE_HOST_UNIX) add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS) endif(CLR_CMAKE_HOST_UNIX) @@ -5,16 +7,14 @@ endif(CLR_CMAKE_HOST_UNIX) # Set the RPATH of paltest_pal_sxs_test1 so that it can find dependencies without needing to set LD_LIBRARY # For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling. if(CORECLR_SET_RPATH) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) if(CLR_CMAKE_HOST_OSX) set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) set(CMAKE_INSTALL_NAME_DIR "@rpath") - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_INSTALL_RPATH "@loader_path") - endif(CLR_CMAKE_HOST_OSX) - if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_HAIKU) - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + else() set(CMAKE_INSTALL_RPATH "\$ORIGIN") - endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_HAIKU) + endif(CLR_CMAKE_HOST_OSX) endif(CORECLR_SET_RPATH) # Test DLL1 @@ -97,3 +97,5 @@ install (TARGETS paltest_pal_sxs_test1 DESTINATION paltests/exception_handling/p install (TARGETS paltest_pal_sxs_test1_dll1 DESTINATION paltests/exception_handling/pal_sxs/test1 COMPONENT paltests EXCLUDE_FROM_ALL) install (TARGETS paltest_pal_sxs_test1_dll2 DESTINATION paltests/exception_handling/pal_sxs/test1 COMPONENT paltests EXCLUDE_FROM_ALL) add_dependencies(paltests_install paltest_pal_sxs_test1 paltest_pal_sxs_test1_dll1 paltest_pal_sxs_test1_dll2) + +endif(NOT CLR_CMAKE_HOST_BROWSER) \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp index 5654d4119..c538f5223 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp @@ -15,10 +15,13 @@ #include #include #include -#include #include #include +#ifndef __HAIKU__ +#include +#endif + enum { PASS = 0, @@ -59,7 +62,7 @@ void sigsegv_handler(int code, siginfo_t *siginfo, void *context) { printf("ERROR: sigprocmask failed; error is %d\n", errno); _exit(FAIL); - } + } printf("Signal chaining PASSED\n"); _exit(PASS); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp deleted file mode 100644 index 486c4dcbd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: CopyFileA.c -** -** Purpose: Tests the PAL implementation of the CopyFileA function -** -** -**===================================================================*/ - -/* - 1. copy an existing file to existing with overwrite true - 2. copy an existing file to existing with overwrite false - 3. copy an existing file to non-existent with overwrite true - 4. copy an existing file to non-existent with overwrite false - 5. copy non-existent file to existing with overwrite true - 6. copy non-existent file to existing with overwrite false - 7. copy non-existent file to non-existent with overwrite true - 8. copy non-existent file to non-existent with overwrite false -*/ - -#include - -struct TESTS{ - char* lpSource; - char* lpDestination; - BOOL bFailIfExists; - int nResult; - }; - - -PALTEST(file_io_CopyFileA_test1_paltest_copyfilea_test1, "file_io/CopyFileA/test1/paltest_copyfilea_test1") -{ - char szSrcExisting[] = {"src_existing.tmp"}; - char szSrcNonExistent[] = {"src_non-existent.tmp"}; - char szDstExisting[] = {"dst_existing.tmp"}; - char szDstNonExistent[] = {"dst_non-existent.tmp"}; - BOOL bRc = TRUE; - BOOL bSuccess = TRUE; - FILE* tempFile = NULL; - int i; - struct TESTS testCase[] = - { - {szSrcExisting, szDstExisting, FALSE, 1}, - {szSrcExisting, szDstExisting, TRUE, 0}, - {szSrcExisting, szDstNonExistent, FALSE, 1}, - {szSrcExisting, szDstNonExistent, TRUE, 1}, - {szSrcNonExistent, szDstExisting, FALSE, 0}, - {szSrcNonExistent, szDstExisting, TRUE, 0}, - {szSrcNonExistent, szDstNonExistent, FALSE, 0}, - {szSrcNonExistent, szDstNonExistent, TRUE, 0} - }; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* create the src_existing file */ - tempFile = fopen(szSrcExisting, "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "CopyFileA test file: src_existing.tmp\n"); - fclose(tempFile); - } - else - { - Fail("CopyFileA: ERROR-> Couldn't create \"src_existing.tmp\" with " - "error %ld\n", - GetLastError()); - } - - /* create the dst_existing file */ - tempFile = fopen(szDstExisting, "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "CopyFileA test file: dst_existing.tmp\n"); - fclose(tempFile); - } - else - { - Fail("CopyFileA: ERROR-> Couldn't create \"dst_existing.tmp\" with " - "error %ld\n", - GetLastError()); - } - - - - for (i = 0; i < (sizeof(testCase) / sizeof(struct TESTS)); i++) - { - bRc = CopyFileA(testCase[i].lpSource, - testCase[i].lpDestination, - testCase[i].bFailIfExists); - if (!bRc) - { - if (testCase[i].nResult == 1) - { - Trace("CopyFileA: FAILED: %s -> %s with bFailIfExists = %d " - "with error %ld\n", - testCase[i].lpSource, - testCase[i].lpDestination, - testCase[i].bFailIfExists, - GetLastError()); - bSuccess = FALSE; - } - } - else - { - if (testCase[i].nResult == 0) - { - Trace("CopyFileA: FAILED: %s -> %s with bFailIfExists = %d\n", - testCase[i].lpSource, - testCase[i].lpDestination, - testCase[i].bFailIfExists); - bSuccess = FALSE; - } - else - { - /* verify the file was moved */ - if (GetFileAttributesA(testCase[i].lpDestination) == -1) - { - Trace("CopyFileA: GetFileAttributes of destination file " - "failed with error code %ld. \n", - GetLastError()); - bSuccess = FALSE; - } - else if (GetFileAttributesA(testCase[i].lpSource) == -1) - { - Trace("CopyFileA: GetFileAttributes of source file " - "failed with error code %ld. \n", - GetLastError()); - bSuccess = FALSE; - } - else - { - /* verify attributes of destination file to source file*/ - if(GetFileAttributes(testCase[i].lpSource) != - GetFileAttributes(testCase[i].lpDestination)) - { - Trace("CopyFileA : The file attributes of the " - "destination file do not match the file " - "attributes of the source file.\n"); - bSuccess = FALSE; - } - } - } - } - /* delete file file but don't worry if it fails */ - remove(szDstNonExistent); - } - - int exitCode = bSuccess ? PASS : FAIL; - PAL_TerminateEx(exitCode); - return exitCode; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test2/test2.cpp deleted file mode 100644 index cfc5237a3..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test2/test2.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Tests the PAL implementation of the CopyFileA function -** to see if a file can be copied to itself -** -** -**===================================================================*/ - - -#include - -PALTEST(file_io_CopyFileA_test2_paltest_copyfilea_test2, "file_io/CopyFileA/test2/paltest_copyfilea_test2") -{ - - BOOL bRc = TRUE; - char* szSrcExisting = "src_existing.tmp"; - FILE* tempFile = NULL; - DWORD temp; - int retCode; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* create the src_existing file */ - tempFile = fopen(szSrcExisting, "w"); - if (tempFile != NULL) - { - retCode = fputs("CopyFileA test file: src_existing.tmp ", tempFile); - if(retCode < 0) - { - Fail("CopyFileA: ERROR-> Couldn't write to %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - retCode = fclose(tempFile); - if(retCode != 0) - { - Fail("CopyFileA: ERROR-> Couldn't close file: %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - - } - else - { - Fail("CopyFileA: ERROR-> Couldn't create %s with " - "error %ld\n",szSrcExisting,GetLastError()); - } - - /* Get file attributes of source */ - temp = GetFileAttributes(szSrcExisting); - if (temp == -1) - { - Fail("CopyFileA: GetFileAttributes of source file " - "failed with error code %ld. \n", - GetLastError()); - } - - /* make sure a file can't copy to itself - first testing with IfFileExists flag set to true */ - bRc = CopyFileA(szSrcExisting,szSrcExisting,TRUE); - if(bRc) - { - Fail("ERROR: Cannot copy a file to itself, %u",GetLastError()); - } - - /* try to get file attributes of destination */ - if (GetFileAttributesA(szSrcExisting) == -1) - { - Fail("CopyFileA: GetFileAttributes of destination file " - "failed with error code %ld. \n", - GetLastError()); - } - else - { - /* verify attributes of destination file to source file*/ - - if(temp != GetFileAttributes(szSrcExisting)) - { - Fail("CopyFileA : The file attributes of the " - "destination file do not match the file " - "attributes of the source file.\n"); - } - } - - /* testing with IfFileExists flags set to false - should fail in Windows and pass in UNIX */ - bRc = CopyFileA(szSrcExisting,szSrcExisting,FALSE); - if(bRc && (GetLastError() != ERROR_ALREADY_EXISTS)) - { - Fail("ERROR: Cannot copy a file to itself, %u",GetLastError()); - } - - if (GetFileAttributesA(szSrcExisting) == -1) - { - Fail("CopyFileA: GetFileAttributes of destination file " - "failed with error code %ld. \n", - GetLastError()); - } - else - { - /* verify attributes of destination file to source file*/ - - if(temp != GetFileAttributes(szSrcExisting)) - { - Fail("CopyFileA : The file attributes of the " - "destination file do not match the file " - "attributes of the source file.\n"); - } - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test3/test3.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test3/test3.cpp deleted file mode 100644 index 33d3c541c..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test3/test3.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test3.c -** -** Purpose: Tests the PAL implementation of the CopyFileA function -** to see if a file can be copied to itself -** -** -**===================================================================*/ - -#include - -PALTEST(file_io_CopyFileA_test3_paltest_copyfilea_test3, "file_io/CopyFileA/test3/paltest_copyfilea_test3") -{ - - BOOL bRc = TRUE; - char* szSrcExisting = "src_existing.tmp"; - char* szDest = "src_dest.tmp"; - FILE* tempFile = NULL; - int retCode; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* create the src_existing file */ - tempFile = fopen(szSrcExisting, "w"); - if (tempFile != NULL) - { - retCode = fputs("CopyFileA test file: src_existing.tmp ", tempFile); - if(retCode < 0) - { - retCode = fclose(tempFile); - if(retCode != 0) - { - Trace("CopyFileA: ERROR-> Couldn't close file: %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - - Fail("CopyFileA: ERROR-> Couldn't write to %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - retCode = fclose(tempFile); - if(retCode != 0) - { - Fail("CopyFileA: ERROR-> Couldn't close file: %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - - } - else - { - Fail("CopyFileA: ERROR-> Couldn't create %s with " - "error %ld\n",szSrcExisting,GetLastError()); - } - - /* set the file attributes of the source file to readonly */ - bRc = SetFileAttributesA(szSrcExisting, FILE_ATTRIBUTE_READONLY); - if(!bRc) - { - Fail("CopyFileA: ERROR-> Couldn't set file attributes for " - "file %s with error %u\n", szSrcExisting, GetLastError()); - } - - // Check the file attributes to make sure SetFileAttributes() above actually succeeded - DWORD fileAttributes = GetFileAttributesA(szSrcExisting); - if (fileAttributes == INVALID_FILE_ATTRIBUTES) - { - Fail("CopyFileA: Failed to get file attributes for source file, %u\n", GetLastError()); - } - if ((fileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - { - Fail("CopyFileA: SetFileAttributes(read-only) on source file returned success but did not make it read-only.\n"); - } - - /* copy the file */ - bRc = CopyFileA(szSrcExisting,szDest,TRUE); - if(!bRc) - { - Fail("CopyFileA: Cannot copy a file with error, %u",GetLastError()); - } - - - /* try to get file attributes of destination file */ - fileAttributes = GetFileAttributesA(szDest); - if (fileAttributes == INVALID_FILE_ATTRIBUTES) - { - Fail("CopyFileA: GetFileAttributes of destination file " - "failed with error code %ld. \n", - GetLastError()); - } - - /* verify attributes of destination file to source file*/ - if((fileAttributes & FILE_ATTRIBUTE_READONLY) != FILE_ATTRIBUTE_READONLY) - { - Fail("CopyFileA : The file attributes of the " - "destination file do not match the file " - "attributes of the source file.\n"); - } - - /* set the attributes of the destination file to normal again */ - bRc = SetFileAttributesA(szDest, FILE_ATTRIBUTE_NORMAL); - if(!bRc) - { - Fail("CopyFileA: ERROR-> Couldn't set file attributes for " - "file %s with error %u\n", szDest, GetLastError()); - } - - /* delete the newly copied file */ - int st = remove(szDest); - if(st != 0) - { - Fail("CopyFileA: remove failed to delete the" - "file correctly with error,%u.\n",errno); - } - - /* set the attributes of the source file to normal again */ - bRc = SetFileAttributesA(szSrcExisting, FILE_ATTRIBUTE_NORMAL); - if(!bRc) - { - Fail("CopyFileA: ERROR-> Couldn't set file attributes for " - "file %s with error %u\n", szSrcExisting, GetLastError()); - } - - /* delete the original file */ - st = remove(szSrcExisting); - if(st != 0) - { - Fail("CopyFileA: remove failed to delete the" - "file correctly with error,%u.\n",errno); - } - - PAL_Terminate(); - return PASS; - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test4/test4.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test4/test4.cpp deleted file mode 100644 index 9eaecf270..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileA/test4/test4.cpp +++ /dev/null @@ -1,179 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test4.c -** -** Purpose: Tests the PAL implementation of the CopyFileA function -** to see if a file can through different users belonging to -** different groups. -** - -=====================================================================*/ - -/* USECASE - Copy a file from a different user, belonging to a different group to - the current user, who is a member of the current group. Then check - to see that the current user has the basic access rights to the copied - file. - - Thie original file used is the passwd file in the etc directory of a - BSD machine. This file should exist on all machines. -*/ - -#include - -PALTEST(file_io_CopyFileA_test4_paltest_copyfilea_test4, "file_io/CopyFileA/test4/paltest_copyfilea_test4") -{ - -#if WIN32 - return PASS; - -#else - - BOOL bRc = TRUE; - char* szSrcExisting = "/etc/passwd"; - char* szDest = "temp.tmp"; - char* szStringTest = "Marry had a little lamb"; - char szStringRead[30]; /* large enough for string szStringTest */ - - HANDLE hFile = NULL; - DWORD dwBytesWritten=0; - DWORD dwBytesRead=0; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* copy the file */ - bRc = CopyFileA(szSrcExisting,szDest,TRUE); - if(!bRc) - { - Fail("CopyFileA: Cannot copy a file with error, %u",GetLastError()); - } - - /* try to get file attributes of destination file */ - if (GetFileAttributesA(szDest) == -1) - { - Fail("CopyFileA: GetFileAttributes of destination file " - "failed with error code %u. \n", - GetLastError()); - } - - /* set the attributes of the destination file to normal again */ - bRc = SetFileAttributesA(szDest, FILE_ATTRIBUTE_NORMAL); - if(!bRc) - { - Fail("CopyFileA: ERROR-> Couldn't set file attributes for " - "file %s with error %u\n", szDest, GetLastError()); - } - - /* open the file for write purposes */ - hFile = CreateFile(szDest, - GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("CopyFileA: ERROR -> Unable to create file \"%s\".\n", - szDest); - } - - /* Attempt to write to the file */ - bRc = WriteFile(hFile, szStringTest, strlen(szStringTest), &dwBytesWritten, NULL); - if (!bRc) - { - Trace("CopyFileA: ERROR -> Unable to write to copied file with error " - "%u.\n", GetLastError()); - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileA: ERROR -> Unable to close file \"%s\" with " - "error %u.\n",szDest, GetLastError()); - } - Fail(""); - - } - - /* Close the file handle */ - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileA: ERROR -> Unable to close file \"%s\" with error %u " - ".\n",szDest,GetLastError()); - } - - - /* open the file for read purposes */ - hFile = CreateFile(szDest, - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("CopyFileA: ERROR -> Unable to create file \"%s\".\n", - szDest); - } - - /* Attempt to read from the file */ - bRc = ReadFile(hFile, szStringRead, strlen(szStringTest), &dwBytesRead, NULL); - if (!bRc) - { - Trace("CopyFileA: ERROR -> Unable to read from copied file with " - "error %u.\n",GetLastError()); - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileA: ERROR -> Unable to close file \"%s\" with " - "error %u.\n",szDest, GetLastError()); - } - Fail(""); - - } - - if(strncmp(szStringTest,szStringRead, strlen(szStringTest)) != 0) - { - Trace("CopyFileA: ERROR -> The string which was written '%s' does not " - "match the string '%s' which was read from the copied file.\n", - szStringTest,szStringRead); - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileA: ERROR -> Unable to close file \"%s\" with " - "error %u.\n",szDest, GetLastError()); - } - Fail(""); - } - - /* Close the file handle */ - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileA: ERROR -> Unable to close file \"%s\" with error %u " - ".\n",szDest,GetLastError()); - } - - /* Remove the temporary file */ - int st = remove(szDest); - if(st != 0) - { - Fail("CopyFileA: Could not remove copied file with error %u\n", - errno); - } - - PAL_Terminate(); - return PASS; - -#endif - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp deleted file mode 100644 index 27dc32921..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: CopyFileW.c -** -** Purpose: Tests the PAL implementation of the CopyFileW function -** -** -**===================================================================*/ - -/* -1. copy an existing file to non-existent with overwrite true -2. copy an existing file to non-existent with overwrite false -3. copy an existing file to existing with overwrite true -4. copy an existing file to existing with overwrite false -5. copy non-existent file to non-existent with overwrite true -6. copy non-existent file to non-existent with overwrite false -7. copy non-existent file to existing with overwrite true -8. copy non-existent file to existing with overwrite false -*/ - -#include - -PALTEST(file_io_CopyFileW_test1_paltest_copyfilew_test1, "file_io/CopyFileW/test1/paltest_copyfilew_test1") -{ - LPSTR lpSource[2] = {"src_existing.tmp", "src_non-existent.tmp"}; - LPSTR lpDestination[2] = {"dst_existing.tmp", "dst_non-existent.tmp"}; - WCHAR* wcSource; - WCHAR* wcDest; - BOOL bFailIfExists[3] = {FALSE, TRUE}; - BOOL bRc = TRUE; - BOOL bSuccess = TRUE; - char results[20]; - FILE* resultsFile = NULL; - FILE* tempFile = NULL; - int nCounter = 0; - int i, j, k; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* load the expected results */ - resultsFile = fopen("expectedresults.txt", "r"); - memset (results, 0, 20); - fgets(results, 20, resultsFile); - fclose(resultsFile); - - nCounter = 0; - - /* create the src_existing file */ - tempFile = fopen(lpSource[0], "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "CopyFileW test file: src_existing.tmp\n"); - fclose(tempFile); - } - else - { - Fail("CopyFileW: ERROR-> Couldn't create \"src_existing.tmp\"\n"); - } - - /* create the dst_existing file */ - tempFile = fopen(lpDestination[0], "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "CopyFileW test file: dst_existing.tmp\n"); - fclose(tempFile); - } - else - { - Fail("CopyFileW: ERROR-> Couldn't create \"dst_existing.tmp\"\n"); - } - - - /* lpSource loop */ - for (i = 0; i < 2; i++) - { - /* lpDestination loop */ - for (j = 0; j < 2; j++) - { - /* bFailIfExists loop */ - for (k = 0; k < 2; k++) - { - wcSource = convert(lpSource[i]); - wcDest = convert(lpDestination[j]); - bRc = CopyFileW(wcSource, - wcDest, - bFailIfExists[k]); - free(wcSource); - free(wcDest); - if (!bRc) - { - if (results[nCounter] == '1') - { - Trace("CopyFileW: FAILED: test[%d][%d][%d]\n", i, j, k); - bSuccess = FALSE; - } - } - else - { - if (results[nCounter] == '0') - { - Trace("CopyFileW: FAILED: test[%d][%d][%d]\n", i, j, k); - bSuccess = FALSE; - } - else - { - /* verify the file was moved */ - if (GetFileAttributesA(lpDestination[j]) == -1) - { - Trace("CopyFileW: GetFileAttributes of destination" - "file failed on test[%d][%d][%d] with error " - "code %ld. \n",i,j,k,GetLastError()); - bSuccess = FALSE; - } - else if (GetFileAttributesA(lpSource[i]) == -1) - { - Trace("CopyFileW: GetFileAttributes of source file " - "file failed on test[%d][%d][%d] with error " - "code %ld. \n",i,j,k,GetLastError()); - bSuccess = FALSE; - } - else - { - /* verify attributes of destination file to - source file*/ - if(GetFileAttributes(lpSource[i]) != - GetFileAttributes(lpDestination[j])) - { - Trace("CopyFileW : The file attributes of the " - "destination file do not match the file " - "attributes of the source file on test " - "[%d][%d][%d].\n",i,j,k); - bSuccess = FALSE; - } - } - } - - } - nCounter++; - /* delete file file but don't worry if it fails */ - DeleteFileA(lpDestination[1]); - } - } - } - - int exitCode = bSuccess ? PASS : FAIL; - PAL_TerminateEx(exitCode); - return exitCode; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/ExpectedResults.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/ExpectedResults.txt deleted file mode 100644 index 535a89fe5..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/ExpectedResults.txt +++ /dev/null @@ -1 +0,0 @@ -10110000 \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test2/test2.cpp deleted file mode 100644 index 96877d95f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test2/test2.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test2.c -** -** Purpose: Tests the PAL implementation of the CopyFileW function -** Attempt to copy a file to itself -** -** -**===================================================================*/ - -#include - -PALTEST(file_io_CopyFileW_test2_paltest_copyfilew_test2, "file_io/CopyFileW/test2/paltest_copyfilew_test2") -{ - LPSTR szSrcExisting = "src_existing.tmp"; - WCHAR* wcSource; - BOOL bRc = TRUE; - FILE* tempFile = NULL; - DWORD temp; - int retCode; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* create the src_existing file */ - tempFile = fopen(szSrcExisting, "w"); - if (tempFile != NULL) - { - retCode = fputs("CopyFileA test file: src_existing.tmp ", tempFile); - if(retCode < 0) - { - Fail("CopyFileW: ERROR-> Couldn't write to %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - retCode = fclose(tempFile); - if(retCode != 0) - { - Fail("CopyFileW: ERROR-> Couldn't close file: %s with error " - "%u.\n", szSrcExisting, GetLastError()); - } - } - else - { - Fail("CopyFileW: ERROR-> Couldn't create %s.\n", szSrcExisting); - } - - /* convert source string to wide character */ - wcSource = convert(szSrcExisting); - - /* Get file attributes of source */ - temp = GetFileAttributes(szSrcExisting); - if (temp == -1) - { - free(wcSource); - Fail("CopyFileW: GetFileAttributes of source file " - "failed with error code %ld. \n", - GetLastError()); - } - - /* make sure a file can't copy to itself - first testing with IfFileExists flag set to true */ - bRc = CopyFileW(wcSource,wcSource,TRUE); - if(bRc) - { - free(wcSource); - Fail("ERROR: Cannot copy a file to itself, %u",GetLastError()); - } - - /* try to get file attributes of destination */ - if (GetFileAttributesA(szSrcExisting) == -1) - { - free(wcSource); - Fail("CopyFileW: GetFileAttributes of destination file " - "failed with error code %ld. \n", - GetLastError()); - } - else - { - /* verify attributes of destination file to source file*/ - if(temp != GetFileAttributes(szSrcExisting)) - { - free(wcSource); - Fail("CopyFileW : The file attributes of the " - "destination file do not match the file " - "attributes of the source file.\n"); - } - } - - /* testing with IfFileExists flags set to false - should fail in Windows and pass in UNIX */ - bRc = CopyFileW(wcSource,wcSource,FALSE); - free(wcSource); - if(bRc && (GetLastError() != ERROR_ALREADY_EXISTS)) - { - Fail("ERROR: Cannot copy a file to itself, %u",GetLastError()); - } - - if (GetFileAttributesA(szSrcExisting) == -1) - { - Fail("CopyFileW: GetFileAttributes of destination file " - "failed with error code %ld. \n", - GetLastError()); - } - else - { - /* verify attributes of destination file to source file*/ - - if(temp != GetFileAttributes(szSrcExisting)) - { - Fail("CopyFileW : The file attributes of the " - "destination file do not match the file " - "attributes of the source file.\n"); - } - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test3/test3.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test3/test3.cpp deleted file mode 100644 index 733e7a95a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/CopyFileW/test3/test3.cpp +++ /dev/null @@ -1,195 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test4.c -** -** Purpose: Tests the PAL implementation of the CopyFileW function -** to see if a file can through different users belonging to -** different groups. -** - -=====================================================================*/ - -/* USECASE - Copy a file from a different user, belonging to a different group to - the current user, who is a member of the current group. Then check - to see that the current user has the basic access rights to the copied - file. - - Thie original file used is the passwd file in the etc directory of a - BSD machine. This file should exist on all machines. -*/ - -#include - -PALTEST(file_io_CopyFileW_test3_paltest_copyfilew_test3, "file_io/CopyFileW/test3/paltest_copyfilew_test3") -{ - -#if WIN32 - return PASS; - -#else - - BOOL bRc = TRUE; - WCHAR szSrcExisting[] = {'/','e','t','c','/','p','a','s','s','w','d','\0'}; - WCHAR szDest[] = {'t','e','m','p','.','t','m','p','\0'}; - WCHAR szStringTest[] = {'M','a','r','r','y',' ','h','a','d',' ','a',' ', - 'l','i','t','t','l','e',' ','l','a','m','b','\0'}; - WCHAR szStringRead[30]; /* large enough for string szStringTest */ - - HANDLE hFile = NULL; - DWORD dwBytesWritten=0; - DWORD dwBytesRead=0; - int size=0; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* copy the file */ - bRc = CopyFileW(szSrcExisting,szDest,TRUE); - if(!bRc) - { - Fail("CopyFileW: Cannot copy a file with error, %u",GetLastError()); - } - - /* try to get file attributes of destination file */ - if (GetFileAttributesW(szDest) == -1) - { - Fail("CopyFileW: GetFileAttributes of destination file " - "failed with error code %u. \n", - GetLastError()); - } - - /* set the attributes of the destination file to normal again */ - bRc = SetFileAttributesW(szDest, FILE_ATTRIBUTE_NORMAL); - if(!bRc) - { - Fail("CopyFileW: ERROR-> Couldn't set file attributes for " - "file %S with error %u\n", szDest, GetLastError()); - } - - /* open the file for write purposes */ - hFile = CreateFileW((WCHAR *)szDest, - GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("CopyFileW: ERROR -> Unable to create file \"%S\".\n", - szDest); - } - - /* To account for the size of a WCHAR is twice that of a char */ - size = wcslen(szStringTest); - size = size*sizeof(WCHAR); - - /* Attempt to write to the file */ - bRc = WriteFile(hFile, - szStringTest, - size, - &dwBytesWritten, - NULL); - - if (!bRc) - { - Trace("CopyFileW: ERROR -> Unable to write to copied file with error " - "%u.\n", GetLastError()); - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileW: ERROR -> Unable to close file \"%S\" with " - "error %u.\n",szDest, GetLastError()); - } - Fail(""); - - } - - /* Close the file handle */ - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileW: ERROR -> Unable to close file \"%S\" with error %u " - ".\n",szDest,GetLastError()); - } - - - /* open the file for read purposes */ - hFile = CreateFileW((WCHAR *)szDest, - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("CopyFileW: ERROR -> Unable to create file \"%S\".\n", - szDest); - } - - /* Attempt to read from the file */ - bRc = ReadFile(hFile, - szStringRead, - size, - &dwBytesRead, - NULL); - - if (!bRc) - { - Trace("CopyFileW: ERROR -> Unable to read from copied file with " - "error %u.\n",GetLastError()); - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileW: ERROR -> Unable to close file \"%S\" with " - "error %u.\n",szDest, GetLastError()); - } - Fail(""); - - } - - if(wcsncmp(szStringTest,szStringRead, wcslen(szStringTest)) != 0) - { - Trace("CopyFileW: ERROR -> The string which was written '%S' does not " - "match the string '%S' which was read from the copied file.\n", - szStringTest,szStringRead); - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileW: ERROR -> Unable to close file \"%S\" with " - "error %u.\n",szDest, GetLastError()); - } - Fail(""); - } - - /* Close the file handle */ - bRc = CloseHandle(hFile); - if (!bRc) - { - Fail("CopyFileW: ERROR -> Unable to close file \"%S\" with error %u " - ".\n",szDest,GetLastError()); - } - - /* Remove the temporary file */ - bRc = DeleteFileW(szDest); - if(!bRc) - { - Fail("CopyFileW: Could not remove copied file with error %u.\n", - GetLastError()); - } - - PAL_Terminate(); - return PASS; - -#endif - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindClose/test1/FindClose.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindClose/test1/FindClose.cpp deleted file mode 100644 index 7226b1d7a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindClose/test1/FindClose.cpp +++ /dev/null @@ -1,274 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: FindClose.c -** -** Purpose: Tests the PAL implementation of the FindClose function. -** -** -**===================================================================*/ - - -#include - - - -const WCHAR szFindName_FindClose_test1[] = {'t','e', 's', 't', '0', '1', '.', 't', 'x', 't', '\0'}; -const WCHAR szFindName_02_FindClose_test1[] = {'t','e', 's', 't', '0', '2', '.', 't', 'x', 't', '\0'}; -const WCHAR szFindName_03_FindClose_test1[] = {'t','e', 's', 't', '0', '3', '.', 't', 'x', 't', '\0'}; -const WCHAR szFindNameWldCard_01_FindClose_test1[] = {'t','e', 's', 't', '0', '?', '.', 't', 'x', 't', '\0'}; -const WCHAR szFindNameWldCard_02_FindClose_test1[] = {'*', '.', 't', 'x', 't', '\0'}; -const WCHAR szDirName_FindClose_test1[] = {'t','e', 's', 't', '_', 'd', 'i', 'r', '\0'}; -const WCHAR szDirName_02_FindClose_test1[] = {'t','e', 's', 't', '_', 'd', 'i', 'r', '0', '2', '\0'}; -const WCHAR szDirNameWldCard_FindClose_test1[] = {'t','e', 's', 't', '_', '*', '\0'}; - - - -BOOL createTestFile_FindClose_test1(const WCHAR* szName) -{ - FILE *pFile = NULL; - char* pTemp = NULL; - - pTemp = convertC((WCHAR*)szName); - pFile = fopen(pTemp, "w"); - if (pFile == NULL) - { - Trace("FindClose: ERROR -> Unable to create file \"%s\".\n", pTemp); - free(pTemp); - return FALSE; - } - else - { - fprintf(pFile, "FindClose test file, \"%s\".\n", pTemp); - free(pTemp); - fclose(pFile); - } - return TRUE; -} - - -void removeAll() -{ - RemoveDirectoryW(szDirName_FindClose_test1); - RemoveDirectoryW(szDirName_02_FindClose_test1); - - DeleteFileW(szFindName_FindClose_test1); - DeleteFileW(szFindName_02_FindClose_test1); - DeleteFileW(szFindName_03_FindClose_test1); -} - - -PALTEST(file_io_FindClose_test1_paltest_findclose_test1, "file_io/FindClose/test1/paltest_findclose_test1") -{ - WIN32_FIND_DATAW findFileData; - WIN32_FIND_DATAW findFileData_02; - HANDLE hFind = NULL; - BOOL bRc = FALSE; - char* pTemp = NULL; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* do some clean up just to be sure */ - removeAll(); - - /* FindClose a null handle */ - if(FindClose(NULL)!=0) - { - Fail("FindClose: ERROR -> Closing a NULL handle succeeded.\n"); - } - - /* find a file that exists */ - if(createTestFile_FindClose_test1(szFindName_FindClose_test1) == FALSE) - { - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - if(createTestFile_FindClose_test1(szFindName_02_FindClose_test1) == FALSE) - { - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - if(createTestFile_FindClose_test1(szFindName_03_FindClose_test1) == FALSE) - { - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - - // close a FindFirstFileW handle - hFind = FindFirstFileW(szFindName_FindClose_test1, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - pTemp = convertC((WCHAR*)szFindName_FindClose_test1); - Trace("FindClose: ERROR -> Unable to find \"%s\"\n", pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - else - { - bRc = FindClose(hFind); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to close a valid" - " FindFirstFileW handle.\n"); - } - } - hFind = FindFirstFileW(szFindName_FindClose_test1, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - pTemp = convertC((WCHAR*)szFindName_FindClose_test1); - Trace("FindClose: ERROR -> Unable to find \"%s\"\n", pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - else - { - bRc = FindNextFileW(hFind, &findFileData); - if (bRc != FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Found a file that doesn't exist.\n"); - } - else - { - bRc = FindClose(hFind); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to close a valid " - "FindNextFileW handle.\n"); - } - } - } - - /* find a directory that exists */ - bRc = CreateDirectoryW(szDirName_FindClose_test1, NULL); - if (bRc == FALSE) - { - pTemp = convertC((WCHAR*)szDirName_FindClose_test1); - Trace("FindClose: ERROR -> Failed to create the directory \"%s\"\n", - pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - - bRc = CreateDirectoryW(szDirName_02_FindClose_test1, NULL); - if (bRc == FALSE) - { - pTemp = convertC((WCHAR*)szDirName_02_FindClose_test1); - Trace("FindClose: ERROR -> Failed to create the directory \"%s\"\n", - pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - - hFind = FindFirstFileW(szDirName_FindClose_test1, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - pTemp = convertC((WCHAR*)szDirName_FindClose_test1); - Trace("FindClose: ERROR. FindFirstFileW was unable to find \"%s\"\n", - pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - else - { - bRc = FindClose(hFind); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to close a valid" - " FindFirstFileW handle of a directory.\n"); - } - } - - /* find a file using wild cards */ - hFind = FindFirstFileW(szFindNameWldCard_01_FindClose_test1, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - pTemp = convertC((WCHAR*)szFindNameWldCard_01_FindClose_test1); - Trace("FindClose: ERROR -> FindFirstFileW was unable to find \"%s\"\n", - pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - else - { - bRc = FindNextFileW(hFind, &findFileData_02); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to find another file.\n"); - } - else - { - bRc = FindClose(hFind); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to close a valid" - " FindNextFileW handle.\n"); - } - } - } - - /* find a directory using wild cards */ - hFind = FindFirstFileW(szDirNameWldCard_FindClose_test1, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - pTemp = convertC((WCHAR*)szDirNameWldCard_FindClose_test1); - Trace("FindClose: ERROR -> Unable to find \"%s\"\n", - pTemp); - free(pTemp); - removeAll(); - PAL_TerminateEx(FAIL); - return FAIL; - } - else - { - bRc = FindNextFileW(hFind, &findFileData_02); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to find another directory.\n"); - } - else - { - bRc = FindClose(hFind); - if (bRc == FALSE) - { - removeAll(); - Fail("FindClose: ERROR -> Unable to close a valid" - " FindNextFileW handle of a directory.\n"); - } - } - } - - - removeAll(); - PAL_Terminate(); - - return PASS; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindFirstFileA/test1/FindFirstFileA.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindFirstFileA/test1/FindFirstFileA.cpp deleted file mode 100644 index 9a4d90616..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindFirstFileA/test1/FindFirstFileA.cpp +++ /dev/null @@ -1,207 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: FindFirstFileA.c -** -** Purpose: Tests the PAL implementation of the FindFirstFileA function. -** -** -**===================================================================*/ - - -#include - - -#define szNoFileName "333asdf.x77t" -#define szFindName "test01.txt" -#define szFindNameWldCard_01 "test0?.txt" -#define szFindNameWldCard_02 "*.txt" -#define szDirName "test_dir" -#define szDirNameSlash "test_dir\\" -#define szDirNameWldCard_01 "?est_dir" -#define szDirNameWldCard_02 "test_*" -/* Longer than MAX_LONGPATH characters */ -char szLongFindName[MAX_LONGPATH+1]; - -BOOL CleanUp_FindFirstFileA_test1() -{ - DWORD dwAtt; - BOOL result = TRUE; - - dwAtt = GetFileAttributesA(szFindName); - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - if(!SetFileAttributesA (szFindName, FILE_ATTRIBUTE_NORMAL)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", szFindName, FILE_ATTRIBUTE_NORMAL); - } - if(!DeleteFileA (szFindName)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szFindName, dwAtt); - } - } - - dwAtt = GetFileAttributesA(szDirName); - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - LPWSTR szDirNameW = convert(szDirName); - if(!RemoveDirectoryW (szDirNameW)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szDirName, dwAtt); - } - free(szDirNameW); - } - - return result; -} - -PALTEST(file_io_FindFirstFileA_test1_paltest_findfirstfilea_test1, "file_io/FindFirstFileA/test1/paltest_findfirstfilea_test1") -{ - WIN32_FIND_DATA findFileData; - HANDLE hFind = NULL; - FILE *pFile = NULL; - BOOL bRc = FALSE; - WCHAR* szwTemp = NULL; - - memset(szLongFindName, 'a', MAX_LONGPATH+1); - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - - if(!CleanUp_FindFirstFileA_test1()) - { - Fail("FindFirstFileW: ERROR : Initial Clean Up failed\n"); - } - - // - // find a file with a NULL pointer - // - hFind = FindFirstFileA(NULL, &findFileData); - if (hFind != INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Found invalid NULL file"); - } - - - // - // find a file that doesn't exist - // - hFind = FindFirstFileA(szNoFileName, &findFileData); - if (hFind != INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Found invalid NULL file"); - } - - - // - // find a file that exists - // - pFile = fopen(szFindName, "w"); - if (pFile == NULL) - { - Fail("FindFirstFileA: ERROR -> Unable to create a test file\n"); - } - else - { - fclose(pFile); - } - hFind = FindFirstFileA(szFindName, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szFindName); - } - else - { - // validate we found the correct file - if (strcmp(szFindName, findFileData.cFileName) != 0) - { - Fail ("FindFirstFileA: ERROR -> Found the wrong file\n"); - } - } - - - // - // find a directory that exists - // - szwTemp = convert((LPSTR)szDirName); - bRc = CreateDirectoryW(szwTemp, NULL); - free(szwTemp); - if (bRc == FALSE) - { - Fail("FindFirstFileA: ERROR -> Failed to create the directory " - "\"%s\"\n", - szDirName); - } - - hFind = FindFirstFileA(szDirName, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR. Unable to find \"%s\"\n", szDirName); - } - else - { - // validate we found the correct directory - if (strcmp(szDirName, findFileData.cFileName) != 0) - { - Fail ("FindFirstFileA: ERROR -> Found the wrong directory\n"); - } - } - - - // - // find a directory using a trailing '\' on the directory name: should fail - // - hFind = FindFirstFileA(szDirNameSlash, &findFileData); - if (hFind != INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Able to find \"%s\": trailing " - "slash should have failed.\n", - szDirNameSlash); - } - - // find a file using wild cards - hFind = FindFirstFileA(szFindNameWldCard_01, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", - szFindNameWldCard_01); - } - - hFind = FindFirstFileA(szFindNameWldCard_02, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szFindNameWldCard_02); - } - - - // - // find a directory using wild cards - // - hFind = FindFirstFileA(szDirNameWldCard_01, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szDirNameWldCard_01); - } - - hFind = FindFirstFileA(szDirNameWldCard_02, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szDirNameWldCard_02); - } - - if(!CleanUp_FindFirstFileA_test1()) - { - Fail("FindFirstFileW: ERROR : Final Clean Up failed\n"); - } - - PAL_Terminate(); - - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindFirstFileW/test1/FindFirstFileW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindFirstFileW/test1/FindFirstFileW.cpp deleted file mode 100644 index 362cea7f6..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindFirstFileW/test1/FindFirstFileW.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: FindFirstFileW.c -** -** Purpose: Tests the PAL implementation of the FindFirstFileW function. -** -** -**===================================================================*/ - - -#include - - -#define szNoFileName "333asdf.x77t" -#define szFindName "test01.txt" -#define szFindNameWldCard_01 "test0?.txt" -#define szFindNameWldCard_02 "*.txt" -#define szDirName "test_dir" -#define szDirNameSlash "test_dir\\" -#define szDirNameWldCard_01 "?est_dir" -#define szDirNameWldCard_02 "test_*" - - -BOOL CleanUp_FindFirstFileW_test1() -{ - DWORD dwAtt; - BOOL result = TRUE; - - dwAtt = GetFileAttributesA(szFindName); - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - if(!SetFileAttributesA (szFindName, FILE_ATTRIBUTE_NORMAL)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", szFindName, FILE_ATTRIBUTE_NORMAL); - } - if(!DeleteFileA (szFindName)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szFindName, dwAtt); - } - } - - dwAtt = GetFileAttributesA(szDirName); - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - LPWSTR szDirNameW = convert(szDirName); - if(!RemoveDirectoryW (szDirNameW)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szDirName, dwAtt); - } - free(szDirNameW); - } - - return result; -} - -PALTEST(file_io_FindFirstFileW_test1_paltest_findfirstfilew_test1, "file_io/FindFirstFileW/test1/paltest_findfirstfilew_test1") -{ - WIN32_FIND_DATAW findFileData; - HANDLE hFind = NULL; - FILE *pFile = NULL; - BOOL bRc = FALSE; - WCHAR* pTemp = NULL; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - if(!CleanUp_FindFirstFileW_test1()) - { - Fail("FindFirstFileW: ERROR : Initial Clean Up failed\n"); - } - - // - // find a file that doesn't exist - // - pTemp = convert((LPSTR)szNoFileName); - hFind = FindFirstFileW(pTemp, &findFileData); - free(pTemp); - if (hFind != INVALID_HANDLE_VALUE) - { - Fail ("FindFirstFileW: ERROR -> Found invalid NULL file\n"); - } - - - // - // find a file that exists - // - pFile = fopen(szFindName, "w"); - if (pFile == NULL) - { - Fail("FindFirstFileW: ERROR -> Unable to create a test file\n"); - } - else - { - fclose(pFile); - } - pTemp = convert((LPSTR)szFindName); - hFind = FindFirstFileW(pTemp, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - free(pTemp); - Fail ("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", szFindName); - } - else - { - // validate we found the correct file - if (wcscmp(pTemp, findFileData.cFileName) != 0) - { - free(pTemp); - Fail ("FindFirstFileW: ERROR -> Found the wrong file\n"); - } - } - free(pTemp); - - // - // find a directory that exists - // - pTemp = convert((LPSTR)szDirName); - bRc = CreateDirectoryW(pTemp, NULL); - if (bRc == FALSE) - { - Fail("FindFirstFileW: ERROR[%u] -> Failed to create the directory \"%s\"\n", - GetLastError(), szDirName); - } - - hFind = FindFirstFileW(pTemp, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - free(pTemp); - Fail("FindFirstFileW: ERROR. Unable to find \"%s\"\n", szDirName); - } - else - { - // validate we found the correct directory - if (wcscmp(pTemp, findFileData.cFileName) != 0) - { - free(pTemp); - Fail("FindFirstFileW: ERROR -> Found the wrong directory\n"); - } - } - free(pTemp); - - // - // find a directory using a trailing '\' on the directory name: should fail - // - pTemp = convert((LPSTR)szDirNameSlash); - hFind = FindFirstFileW(pTemp, &findFileData); - free(pTemp); - if (hFind != INVALID_HANDLE_VALUE) - { - Fail("FindFirstFileW: ERROR -> Able to find \"%s\": trailing " - "slash should have failed.\n", - szDirNameSlash); - } - - // find a file using wild cards - pTemp = convert((LPSTR)szFindNameWldCard_01); - hFind = FindFirstFileW(pTemp, &findFileData); - free(pTemp); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", - szFindNameWldCard_01); - } - - pTemp = convert((LPSTR)szFindNameWldCard_02); - hFind = FindFirstFileW(pTemp, &findFileData); - free(pTemp); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", - szFindNameWldCard_02); - } - - - // - // find a directory using wild cards - // - - pTemp = convert((LPSTR)szDirNameWldCard_01); - hFind = FindFirstFileW(pTemp, &findFileData); - free(pTemp); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", - szDirNameWldCard_01); - } - - pTemp = convert((LPSTR)szDirNameWldCard_02); - hFind = FindFirstFileW(pTemp, &findFileData); - free(pTemp); - if (hFind == INVALID_HANDLE_VALUE) - { - Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", - szDirNameWldCard_02); - } - - if(!CleanUp_FindFirstFileW_test1()) - { - Fail("FindFirstFileW: ERROR : Final Clean Up failed\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileA/test1/FindNextFileA.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileA/test1/FindNextFileA.cpp deleted file mode 100644 index ab5c184d1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileA/test1/FindNextFileA.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: FindNextFileA.c -** -** Purpose: Tests the PAL implementation of the FindNextFileA function. -** -** -**===================================================================*/ - -#include - - -#define szFindName "test01.txt" -#define szFindName_02 "test02.txt" -#define szFindNameWldCard_01 "test0?.txt" -#define szFindNameWldCard_02 "*.txt" -#define szDirName "test_dir" -#define szDirName_02 "test_dir_02" -#define szDirNameWldCard "test_*" - - - -void removeAll_FindNextFileA_test1() -{ - WCHAR* wTempPtr = NULL; - - wTempPtr = convert((LPSTR)szDirName); - RemoveDirectoryW(wTempPtr); - free (wTempPtr); - wTempPtr = convert((LPSTR)szDirName_02); - RemoveDirectoryW(wTempPtr); - free (wTempPtr); - remove(szFindName); - remove(szFindName_02); -} - - - -BOOL createTestFile_FindNextFileA_test1(const char* szName) -{ - FILE *pFile = NULL; - - pFile = fopen(szName, "w"); - if (pFile == NULL) - { - Trace("FindNextFile: ERROR -> Unable to create file \"%s\".\n", - szName); - removeAll_FindNextFileA_test1(); - return FALSE; - } - else - { - fprintf(pFile, "FindNextFile test file, \"%s\".\n", szFindName); - fclose(pFile); - } - return TRUE; -} - - - -PALTEST(file_io_FindNextFileA_test1_paltest_findnextfilea_test1, "file_io/FindNextFileA/test1/paltest_findnextfilea_test1") -{ - WIN32_FIND_DATA findFileData; - WIN32_FIND_DATA findFileData_02; - HANDLE hFind = NULL; - BOOL bRc = FALSE; - DWORD dwBytesWritten; - WCHAR* wTempPtr = NULL; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - removeAll_FindNextFileA_test1(); - - - // - // find a file with a NULL pointer - // - hFind = FindFirstFileA(NULL, &findFileData); - if (hFind != INVALID_HANDLE_VALUE) - { - Fail("FindNextFile: ERROR -> Found invalid NULL file"); - } - - bRc = FindNextFile(hFind, &findFileData); - if (bRc == TRUE) - { - Fail("FindNextFile: ERROR -> Found a file based on an invalid handle"); - } - - - // - // find a file that exists - // - if(createTestFile_FindNextFileA_test1(szFindName) == FALSE) - { - PAL_TerminateEx(FAIL); - return FAIL; - } - if(createTestFile_FindNextFileA_test1(szFindName_02) == FALSE) - { - PAL_TerminateEx(FAIL); - return FAIL; - } - - hFind = FindFirstFileA(szFindName, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Unable to find \"%s\"\n", szFindName); - } - else - { - bRc = FindNextFile(hFind, &findFileData); - if (bRc != FALSE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Found a file that doesn't exist.\n"); - } - } - - - // - // find a directory that exists - // - wTempPtr = convert((LPSTR)szDirName); - bRc = CreateDirectoryW(wTempPtr, NULL); - free (wTempPtr); - if (bRc == FALSE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Failed to create the directory \"%s\"\n", - szDirName); - } - wTempPtr = convert((LPSTR)szDirName_02); - bRc = CreateDirectoryW(wTempPtr, NULL); - free (wTempPtr); - if (bRc == FALSE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Failed to create the directory \"%s\"\n", - szDirName_02); - } - - hFind = FindFirstFileA(szDirName, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR. FindFirstFileA was unable to find \"%s\"\n", - szDirName); - } - else - { - bRc = FindNextFile(hFind, &findFileData); - if (bRc != FALSE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Found a directory that doesn't exist.\n"); - } - } - - - // - // find a file using wild cards - // - hFind = FindFirstFileA(szFindNameWldCard_01, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> FindFirstFileA was unable to find \"%s\"\n", - szFindNameWldCard_01); - } - else - { - bRc = FindNextFile(hFind, &findFileData_02); - if (bRc == FALSE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Unable to find another file.\n"); - } - else - { - // validate we found the correct file - if (strcmp(findFileData_02.cFileName, findFileData.cFileName) == 0) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Found the same file \"%s\".\n", - findFileData.cFileName); - } - } - } - - - // - // find a directory using wild cards - // - hFind = FindFirstFileA(szDirNameWldCard, &findFileData); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Unable to find \"%s\"\n", - szDirNameWldCard); - } - else - { - bRc = FindNextFile(hFind, &findFileData_02); - if (bRc == FALSE) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Unable to find another directory.\n"); - } - else - { - // validate we found the correct directory - if (strcmp(findFileData_02.cFileName, findFileData.cFileName) == 0) - { - removeAll_FindNextFileA_test1(); - Fail("FindNextFile: ERROR -> Found the same directory \"%s\".\n", - findFileData.cFileName); - } - } - } - - // - // attempt to write to the hFind handle (which should fail) - // - bRc = WriteFile(hFind, "this is a test", 10, &dwBytesWritten, NULL); - removeAll_FindNextFileA_test1(); - if (bRc == TRUE) - { - Fail("FindNextFile: ERROR -> Able to write to a FindNextFile handle.\n"); - } - - PAL_Terminate(); - - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileA/test2/findnextfilea.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileA/test2/findnextfilea.cpp deleted file mode 100644 index 3ef068ac1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileA/test2/findnextfilea.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: findnextfilea.c -** -** Purpose: Tests the PAL implementation of the FindNextFileA function. -** Tests '*' and '*.*' to ensure that '.' and '..' are -** returned in the expected order -** -** -**===================================================================*/ - -#include - - -const char* szDot = "."; -const char* szDotDot = ".."; -const char* szStar = "*"; -const char* szStarDotStar = "*.*"; - - -static void DoTest(const char* szDir, - const char* szResult1, - const char* szResult2) -{ - HANDLE hFind; - WIN32_FIND_DATA findFileData; - - /* - ** find the first - */ - if ((hFind = FindFirstFileA(szDir, &findFileData)) == INVALID_HANDLE_VALUE) - { - Fail("FindNextFileA: ERROR -> FindFirstFileA(\"%s\") failed. " - "GetLastError returned %u.\n", - szStar, - GetLastError()); - } - - /* did we find the expected */ - if (strcmp(szResult1, findFileData.cFileName) != 0) - { - if (!FindClose(hFind)) - { - Trace("FindNextFileA: ERROR -> Failed to close the find handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("FindNextFileA: ERROR -> FindFirstFile(\"%s\") didn't find" - " the expected \"%s\" but found \"%s\" instead.\n", - szDir, - szResult1, - findFileData.cFileName); - } - - /* we found the first expected, let's see if we find the next expected*/ - if (!FindNextFileA(hFind, &findFileData)) - { - Trace("FindNextFileA: ERROR -> FindNextFileA should have found \"%s\"" - " but failed. GetLastError returned %u.\n", - szResult2, - GetLastError()); - if (!FindClose(hFind)) - { - Trace("FindNextFileA: ERROR -> Failed to close the find handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* we found something, but was it '.' */ - if (strcmp(szResult2, findFileData.cFileName) != 0) - { - if (!FindClose(hFind)) - { - Trace("FindNextFileA: ERROR -> Failed to close the find handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("FindNextFileA: ERROR -> FindNextFileA based on \"%s\" didn't find" - " the expected \"%s\" but found \"%s\" instead.\n", - szDir, - szResult2, - findFileData.cFileName); - } -} - -PALTEST(file_io_FindNextFileA_test2_paltest_findnextfilea_test2, "file_io/FindNextFileA/test2/paltest_findnextfilea_test2") -{ - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - DoTest(szStar, szDot, szDotDot); - DoTest(szStarDotStar, szDot, szDotDot); - - - PAL_Terminate(); - - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileW/test1/FindNextFileW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileW/test1/FindNextFileW.cpp deleted file mode 100644 index bdcc73f60..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileW/test1/FindNextFileW.cpp +++ /dev/null @@ -1,246 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: FindNextFileW.c -** -** Purpose: Tests the PAL implementation of the FindNextFileW function. -** -** -**===================================================================*/ - -#include - - -#define szFindName "test01.txt" -#define szFindName_02 "test02.txt" -#define szFindNameWldCard_01 "test0?.txt" -#define szFindNameWldCard_02 "*.txt" -#define szDirName "test_dir" -#define szDirName_02 "test_dir_02" -#define szDirNameWldCard "test_*" - -void removeAll_FindNextFileW_test1() -{ - WCHAR* wTempPtr = NULL; - - wTempPtr = convert((LPSTR)szDirName); - RemoveDirectoryW(wTempPtr); - free(wTempPtr); - - wTempPtr = convert((LPSTR)szDirName_02); - RemoveDirectoryW(wTempPtr); - free(wTempPtr); - - wTempPtr = convert((LPSTR)szFindName); - DeleteFileW(wTempPtr); - free(wTempPtr); - - wTempPtr = convert((LPSTR)szFindName_02); - DeleteFileW(wTempPtr); - free(wTempPtr); -} - - - -BOOL createTestFile_FindNextFileW_test1(const char* szName) -{ - FILE *pFile = NULL; - - pFile = fopen(szName, "w"); - if (pFile == NULL) - { - Trace("FindNextFileW: ERROR -> Unable to create file \"%s\".\n", szName); - removeAll_FindNextFileW_test1(); - return FALSE; - } - else - { - fprintf(pFile, "FindNextFileW test file, \"%s\".\n", szFindName); - fclose(pFile); - } - - return TRUE; -} - - - -PALTEST(file_io_FindNextFileW_test1_paltest_findnextfilew_test1, "file_io/FindNextFileW/test1/paltest_findnextfilew_test1") -{ - WIN32_FIND_DATAW findFileData; - WIN32_FIND_DATAW findFileData_02; - HANDLE hFind = NULL; - BOOL bRc = FALSE; - DWORD dwBytesWritten; - WCHAR* wTempPtr = NULL; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - removeAll_FindNextFileW_test1(); - - - // - // find a file that exists - // - if(createTestFile_FindNextFileW_test1(szFindName) == FALSE) - { - PAL_TerminateEx(FAIL); - return FAIL; - } - if(createTestFile_FindNextFileW_test1(szFindName_02) == FALSE) - { - PAL_TerminateEx(FAIL); - return FAIL; - } - - wTempPtr = convert((LPSTR)szFindName); - hFind = FindFirstFileW(wTempPtr, &findFileData); - free(wTempPtr); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Unable to find \"%s\"\n", szFindName); - } - else - { - bRc = FindNextFileW(hFind, &findFileData); - if (bRc != FALSE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Found a file that doesn't exist.\n"); - } - } - - - // - // find a directory that exists - // - wTempPtr = convert((LPSTR)szDirName); - bRc = CreateDirectoryW(wTempPtr, NULL); - free (wTempPtr); - if (bRc == FALSE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Failed to create the directory \"%s\"\n", - szDirName); - } - wTempPtr = convert((LPSTR)szDirName_02); - bRc = CreateDirectoryW(wTempPtr, NULL); - free (wTempPtr); - if (bRc == FALSE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Failed to create the directory " - "\"%s\"\n", - szDirName_02); - } - - wTempPtr = convert((LPSTR)szDirName); - hFind = FindFirstFileW(wTempPtr, &findFileData); - free (wTempPtr); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR. FindFirstFileW was unable " - "to find \"%s\"\n", - szDirName); - } - else - { - bRc = FindNextFileW(hFind, &findFileData); - if (bRc != FALSE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Found a directory that " - "doesn't exist.\n"); - } - } - - - // - // find a file using wild cards - // - wTempPtr = convert((LPSTR)szFindNameWldCard_01); - hFind = FindFirstFileW(wTempPtr, &findFileData); - free(wTempPtr); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> FindFirstFileW was unable to " - "find \"%s\"\n", - szFindNameWldCard_01); - } - else - { - bRc = FindNextFileW(hFind, &findFileData_02); - if (bRc == FALSE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Unable to find another file.\n"); - } - else - { - // validate we found the correct file - if (wcscmp(findFileData_02.cFileName, findFileData.cFileName) == 0) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Found the same file \"%S\".\n", - findFileData.cFileName); - } - } - } - - - // - // find a directory using wild cards - // - wTempPtr = convert((LPSTR)szDirNameWldCard); - hFind = FindFirstFileW(wTempPtr, &findFileData); - free(wTempPtr); - if (hFind == INVALID_HANDLE_VALUE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Unable to find \"%s\"\n", - szDirNameWldCard); - } - else - { - bRc = FindNextFileW(hFind, &findFileData_02); - if (bRc == FALSE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Unable to find another directory.\n"); - } - else - { - // validate we found the correct directory - if (wcscmp(findFileData_02.cFileName, findFileData.cFileName) == 0) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Found the same directory " - "\"%S\".\n", - findFileData.cFileName); - } - } - } - - // - // attempt to write to the hFind handle (which should fail) - // - bRc = WriteFile(hFind, "this is a test", 10, &dwBytesWritten, NULL); - if (bRc == TRUE) - { - removeAll_FindNextFileW_test1(); - Fail("FindNextFileW: ERROR -> Able to write to a FindNextFileW " - "handle.\n"); - } - - removeAll_FindNextFileW_test1(); - PAL_Terminate(); - - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileW/test2/findnextfilew.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileW/test2/findnextfilew.cpp deleted file mode 100644 index 58d01da7e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/FindNextFileW/test2/findnextfilew.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: FindNextFileW.c -** -** Purpose: Tests the PAL implementation of the FindNextFileW function. -** Tests '*' and '*.*' to ensure that '.' and '..' are -** returned in the expected order -** -** -**===================================================================*/ - -#include - - -const WCHAR szwDot[] = {'.','\0'}; -const WCHAR szwDotDot[] = {'.','.','\0'}; -const WCHAR szwStar[] = {'*','\0'}; -const WCHAR szwStarDotStar[] = {'*','.','*','\0'}; - - -static void DoTest(const WCHAR* szwDir, - const WCHAR* szwResult1, - const WCHAR* szwResult2) -{ - HANDLE hFind; - WIN32_FIND_DATAW findFileData; - - /* - ** find the first - */ - if ((hFind = FindFirstFileW(szwDir, &findFileData)) == INVALID_HANDLE_VALUE) - { - Fail("FindNextFileW: ERROR -> FindFirstFileW(\"%S\") failed. " - "GetLastError returned %u.\n", - szwStar, - GetLastError()); - } - - /* did we find the expected */ - if (wcscmp(szwResult1, findFileData.cFileName) != 0) - { - if (!FindClose(hFind)) - { - Trace("FindNextFileW: ERROR -> Failed to close the find handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("FindNextFileW: ERROR -> FindFirstFile(\"%S\") didn't find" - " the expected \"%S\" but found \"%S\" instead.\n", - szwDir, - szwResult1, - findFileData.cFileName); - } - - /* we found the first expected, let's see if we find the next expected*/ - if (!FindNextFileW(hFind, &findFileData)) - { - Trace("FindNextFileW: ERROR -> FindNextFileW should have found \"%S\"" - " but failed. GetLastError returned %u.\n", - szwResult2, - GetLastError()); - if (!FindClose(hFind)) - { - Trace("FindNextFileW: ERROR -> Failed to close the find handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* we found something, but was it '.' */ - if (wcscmp(szwResult2, findFileData.cFileName) != 0) - { - if (!FindClose(hFind)) - { - Trace("FindNextFileW: ERROR -> Failed to close the find handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("FindNextFileW: ERROR -> FindNextFileW based on \"%S\" didn't find" - " the expected \"%S\" but found \"%S\" instead.\n", - szwDir, - szwResult2, - findFileData.cFileName); - } -} - -PALTEST(file_io_FindNextFileW_test2_paltest_findnextfilew_test2, "file_io/FindNextFileW/test2/paltest_findnextfilew_test2") -{ - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - DoTest(szwStar, szwDot, szwDotDot); - DoTest(szwStarDotStar, szwDot, szwDotDot); - - - PAL_Terminate(); - - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetConsoleOutputCP/test1/GetConsoleOutputCP.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetConsoleOutputCP/test1/GetConsoleOutputCP.cpp deleted file mode 100644 index 7c391e3f1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetConsoleOutputCP/test1/GetConsoleOutputCP.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetConsoleOutputCP.c (test 1) -** -** Purpose: Tests the PAL implementation of the GetConsoleOutputCP function. -** -** -**===================================================================*/ - -#include - - -PALTEST(file_io_GetConsoleOutputCP_test1_paltest_getconsoleoutputcp_test1, "file_io/GetConsoleOutputCP/test1/paltest_getconsoleoutputcp_test1") -{ - UINT uiCP = 0; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - uiCP = GetConsoleOutputCP(); - if ((uiCP != CP_ACP) && (uiCP != GetACP()) && (uiCP != 437)) /*437 for MSDOS*/ - { - Fail("GetConsoleOutputCP: ERROR -> The invalid code page %d was returned.\n", - uiCP); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_file deleted file mode 100644 index 0d1ac31cf..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_file +++ /dev/null @@ -1 +0,0 @@ -Hidden file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_ro_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_ro_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_ro_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_ro_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_ro_file deleted file mode 100644 index 8f78fcb43..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/.hidden_ro_file +++ /dev/null @@ -1 +0,0 @@ -.hidden_ro_file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/GetFileAttributesA.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/GetFileAttributesA.cpp deleted file mode 100644 index 309be929e..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/GetFileAttributesA.cpp +++ /dev/null @@ -1,341 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: GetFileAttributesA.c -** -** Purpose: Tests the PAL implementation of the GetFileAttributesA function by -** checking the attributes of: -** - a normal directory and file -** - a read only directory and file -** - a read write directory and file -** - a hidden directory and file -** - a read only hidden directory and file -** - a directory and a file with no attributes -** - an invalid file name -** -** -**===========================================================================*/ -#include - -const int TYPE_DIR = 0; -const int TYPE_FILE = 1; -/* Structure defining a test case */ -typedef struct -{ - char *name; /* name of the file/directory */ - DWORD expectedAttribs; /* expected attributes */ - HANDLE hFile; /* Handle to the file */ - int isFile; /* is file (1) or dir (0) */ -}TestCaseFile; - -typedef struct -{ - char *name; /* name of the file/directory */ - DWORD expectedAttribs; /* expected attributes */ - HANDLE hFile; /* Handle to the file */ - int isFile; /* is file (1) or dir (0) */ -}TestCaseDir; - -DWORD desiredAccessFile_GetFileAttributesA_test1 = GENERIC_READ | GENERIC_WRITE; -DWORD shareModeFile_GetFileAttributesA_test1 = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE; -LPSECURITY_ATTRIBUTES lpAttrFile_GetFileAttributesA_test1 = NULL; -DWORD dwCreationDispFile_GetFileAttributesA_test1 = CREATE_NEW; -DWORD dwFlagsAttribFile_GetFileAttributesA_test1 = FILE_ATTRIBUTE_NORMAL; -HANDLE hTemplateFile_GetFileAttributesA_test1 = NULL; - -int numFileTests_A = 6; -TestCaseFile gfaTestsFile_A[6]; /* GetFileAttributes tests list */ - -int numDirTests_A = 6; -TestCaseDir gfaTestsDir_A[6]; /* GetFileAttributes tests list */ - -BOOL CleanUpFiles_GetFileAttributesA_test1() -{ - DWORD dwAtt; - int i; - BOOL result = TRUE; - for (i = 0; i < numFileTests_A -1 ; i++ ) - { - dwAtt = GetFileAttributesA(gfaTestsFile_A[i].name); - - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - //Trace("Files iteration %d\n", i); - if(!SetFileAttributesA (gfaTestsFile_A[i].name, FILE_ATTRIBUTE_NORMAL)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile_A[i].name, FILE_ATTRIBUTE_NORMAL); - } - - if(!DeleteFileA (gfaTestsFile_A[i].name)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsFile_A[i].name, dwAtt); - } - - } - } -// Trace("Value of result is %d\n", result); - return result; -} -BOOL SetUpFiles_GetFileAttributesA_test1() -{ - int i = 0; - BOOL result = TRUE; - for (i = 0; i < numFileTests_A -1; i++ ) - { - gfaTestsFile_A[i].hFile = CreateFile(gfaTestsFile_A[i].name, - desiredAccessFile_GetFileAttributesA_test1, - shareModeFile_GetFileAttributesA_test1, - lpAttrFile_GetFileAttributesA_test1, - dwCreationDispFile_GetFileAttributesA_test1, - dwFlagsAttribFile_GetFileAttributesA_test1, - hTemplateFile_GetFileAttributesA_test1); - - if( gfaTestsFile_A[i].hFile == NULL ) - { - Fail("Error while creating files for iteration %d\n", i); - } - - if(!SetFileAttributesA (gfaTestsFile_A[i].name, gfaTestsFile_A[i].expectedAttribs)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile_A[i].name, gfaTestsFile_A[i].expectedAttribs); - } - } - - return result; -} - -BOOL CleanUpDirs_GetFileAttributesA_test1() -{ - DWORD dwAtt; - int i; - BOOL result = TRUE; - for (i = 0; i < numDirTests_A -1 ; i++ ) - { - dwAtt = GetFileAttributesA(gfaTestsDir_A[i].name); - - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - - if(!SetFileAttributesA (gfaTestsDir_A[i].name, FILE_ATTRIBUTE_DIRECTORY)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir_A[i].name, (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY)); - } - - LPWSTR nameW = convert(gfaTestsDir_A[i].name); - if(!RemoveDirectoryW (nameW)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsDir_A[i].name, dwAtt); - } - - free(nameW); - } - } - - return result; -} - -BOOL SetUpDirs_GetFileAttributesA_test1() -{ - int i = 0; - BOOL result = TRUE; - DWORD ret = 0; - for (i = 0; i < numDirTests_A - 1 ; i++ ) - { - result = CreateDirectoryA(gfaTestsDir_A[i].name, - NULL); - - if(!result ) - { - result = FALSE; - Fail("Error while creating directory for iteration %d\n", i); - } - - if(!SetFileAttributesA (gfaTestsDir_A[i].name, gfaTestsDir_A[i].expectedAttribs)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir_A[i].name, gfaTestsDir_A[i].expectedAttribs); - } - - ret = GetFileAttributesA (gfaTestsDir_A[i].name); - if(ret != gfaTestsDir_A[i].expectedAttribs) - { - result = FALSE; - Trace("ERROR: Error setting attributes [%s][%d]\n", gfaTestsDir_A[i].name, gfaTestsDir_A[i].expectedAttribs); - } - //Trace("Setup Dir setting attr [%d], returned [%d]\n", gfaTestsDir_A[i].expectedAttribs, ret); - - } - //Trace("Setup dirs returning %d\n", result); - return result; -} -PALTEST(file_io_GetFileAttributesA_test1_paltest_getfileattributesa_test1, "file_io/GetFileAttributesA/test1/paltest_getfileattributesa_test1") -{ - int i; - BOOL bFailed = FALSE; - DWORD result; - - char * NormalDirectoryName = "normal_test_directory"; - char * ReadOnlyDirectoryName = "ro_test_directory"; - char * ReadWriteDirectoryName = "rw_directory"; - char * HiddenDirectoryName = ".hidden_directory"; - char * HiddenReadOnlyDirectoryName = ".hidden_ro_directory"; - char * NoDirectoryName = "no_directory"; - - char * NormalFileName = "normal_test_file"; - char * ReadOnlyFileName = "ro_test_file"; - char * ReadWriteFileName = "rw_file"; - char * HiddenFileName = ".hidden_file"; - char * HiddenReadOnlyFileName = ".hidden_ro_file"; - char * NotReallyAFileName = "not_really_a_file"; - - /* Tests on directory */ - gfaTestsDir_A[0].name = NormalDirectoryName; - gfaTestsDir_A[0].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; - gfaTestsDir_A[0].isFile = TYPE_DIR; - - gfaTestsDir_A[1].name = ReadOnlyDirectoryName; - gfaTestsDir_A[1].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | - FILE_ATTRIBUTE_READONLY; - gfaTestsDir_A[1].isFile = TYPE_DIR; - - gfaTestsDir_A[2].name = ReadWriteDirectoryName; - gfaTestsDir_A[2].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; - gfaTestsDir_A[2].isFile = TYPE_DIR; - - gfaTestsDir_A[3].name = HiddenDirectoryName; - gfaTestsDir_A[3].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; //| - //FILE_ATTRIBUTE_HIDDEN; - gfaTestsDir_A[3].isFile = TYPE_DIR; - - gfaTestsDir_A[4].name = HiddenReadOnlyDirectoryName; - gfaTestsDir_A[4].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | - FILE_ATTRIBUTE_READONLY; //| - //FILE_ATTRIBUTE_HIDDEN; - gfaTestsDir_A[4].isFile = TYPE_DIR; - - gfaTestsDir_A[5].name = NoDirectoryName; - gfaTestsDir_A[5].expectedAttribs = INVALID_FILE_ATTRIBUTES; - gfaTestsDir_A[5].isFile = TYPE_DIR; - - /* Tests on file */ - gfaTestsFile_A[0].name = NormalFileName; - gfaTestsFile_A[0].expectedAttribs = FILE_ATTRIBUTE_NORMAL; - gfaTestsFile_A[0].isFile = TYPE_FILE; - - - gfaTestsFile_A[1].name = ReadOnlyFileName; - gfaTestsFile_A[1].expectedAttribs = FILE_ATTRIBUTE_READONLY; - gfaTestsFile_A[1].isFile = TYPE_FILE; - - gfaTestsFile_A[2].name = ReadWriteFileName; - gfaTestsFile_A[2].expectedAttribs = FILE_ATTRIBUTE_NORMAL; - gfaTestsFile_A[2].isFile = TYPE_FILE; - - gfaTestsFile_A[3].name = HiddenFileName; - gfaTestsFile_A[3].expectedAttribs = FILE_ATTRIBUTE_NORMAL; //FILE_ATTRIBUTE_HIDDEN; - gfaTestsFile_A[3].isFile = TYPE_FILE; - - gfaTestsFile_A[4].name = HiddenReadOnlyFileName; - gfaTestsFile_A[4].expectedAttribs = FILE_ATTRIBUTE_READONLY; //| - //FILE_ATTRIBUTE_HIDDEN; - gfaTestsFile_A[4].isFile = TYPE_FILE; - - - gfaTestsFile_A[5].name = NotReallyAFileName; - gfaTestsFile_A[5].expectedAttribs = INVALID_FILE_ATTRIBUTES; - gfaTestsFile_A[5].isFile = TYPE_FILE; - - /* Initialize PAL environment */ - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - if(!CleanUpFiles_GetFileAttributesA_test1()) - { - Fail("GetFileAttributesA: Pre-Clean Up Files Failed\n"); - } - - if(0 == SetUpFiles_GetFileAttributesA_test1()) - { - Fail("GetFileAttributesA: SetUp Files Failed\n"); - } - - if(!CleanUpDirs_GetFileAttributesA_test1()) - { - Fail("GetFileAttributesA: Pre-Clean Up Directories Failed\n"); - } - - if(!SetUpDirs_GetFileAttributesA_test1()) - { - Fail("GetFileAttributesA: SetUp Directories Failed\n"); - } - - /* - * Go through all the test cases above, - * call GetFileAttributesA on the name and - * make sure the return value is the one expected - */ - for( i = 0; i < numFileTests_A; i++ ) - { - result = GetFileAttributesA(gfaTestsFile_A[i].name); - - if( result != gfaTestsFile_A[i].expectedAttribs ) - { - bFailed = TRUE; - - Trace("ERROR: GetFileAttributesA Test#%u on %s " - "returned %u instead of %u. \n", - i, - gfaTestsFile_A[i].name, - result, - gfaTestsFile_A[i].expectedAttribs); - - } - } - - - for( i = 0; i < numDirTests_A; i++ ) - { - result = GetFileAttributesA(gfaTestsDir_A[i].name); - - if( result != gfaTestsDir_A[i].expectedAttribs ) - { - bFailed = TRUE; - - Trace("ERROR: GetFileAttributesA on Directories Test#%u on %s " - "returned %u instead of %u. \n", - i, - gfaTestsDir_A[i].name, - result, - gfaTestsDir_A[i].expectedAttribs); - - } - } - - if(!CleanUpFiles_GetFileAttributesA_test1()) - { - Fail("GetFileAttributesA: Post-Clean Up Files Failed\n"); - } - - if(!CleanUpDirs_GetFileAttributesA_test1()) - { - Fail("GetFileAttributesA: Post-Clean Up Directories Failed\n"); - } - - /* If any errors, just call Fail() */ - if( bFailed ) - { - Fail(""); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/no_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/no_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/no_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/no_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/no_file deleted file mode 100644 index 3d631e810..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/no_file +++ /dev/null @@ -1 +0,0 @@ -No attribs file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/normal_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/normal_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/normal_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/normal_test_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/normal_test_file deleted file mode 100644 index a6e1e627a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/normal_test_file +++ /dev/null @@ -1,6 +0,0 @@ -file_io -CopyFileW -Positive Test for CopyFileW -test the CopyFileW function -DEFAULT -CopyFileW \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/ro_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/ro_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/ro_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/ro_test_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/ro_test_file deleted file mode 100644 index a6e1e627a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/ro_test_file +++ /dev/null @@ -1,6 +0,0 @@ -file_io -CopyFileW -Positive Test for CopyFileW -test the CopyFileW function -DEFAULT -CopyFileW \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/rw_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/rw_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/rw_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/rw_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/rw_file deleted file mode 100644 index 39d66f036..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesA/test1/rw_file +++ /dev/null @@ -1 +0,0 @@ -Read Write file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/.hidden_directory/anchor.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/.hidden_directory/anchor.txt deleted file mode 100644 index 9a277fa04..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/.hidden_directory/anchor.txt +++ /dev/null @@ -1,2 +0,0 @@ -This file is here so this directory gets checked out even with the -P -option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/.hidden_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/.hidden_file deleted file mode 100644 index 0d1ac31cf..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/.hidden_file +++ /dev/null @@ -1 +0,0 @@ -Hidden file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/normal_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/normal_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/normal_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/normal_test_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/normal_test_file deleted file mode 100644 index ab7622ffb..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/normal_test_file +++ /dev/null @@ -1,6 +0,0 @@ -file_io -CopyFileW -Positive Test for CopyFileW -test the CopyFileW function -DEFAULT -CopyFileW \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/ro_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/ro_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/ro_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/ro_test_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/ro_test_file deleted file mode 100644 index ab7622ffb..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/ro_test_file +++ /dev/null @@ -1,6 +0,0 @@ -file_io -CopyFileW -Positive Test for CopyFileW -test the CopyFileW function -DEFAULT -CopyFileW \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp deleted file mode 100644 index c31529979..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests the PAL implementation of the GetFileAttributesExW function. -** Call the function on a normal directory and file and a read-only directory -** and file and a hidden file and directory. -** Ensure that the returned attributes and file sizes are correct. -** -** -**===================================================================*/ - -#define UNICODE -#include - -typedef enum Item -{ - IS_DIR, - IS_FILE -}ItemType; - -/* This function takes a structure and checks that the information - within the structure is correct. The 'Attribs' are the expected - file attributes, 'TheType' is IS_DIR or IS_FILE and the 'Name' is the - name of the file/directory in question. -*/ -void VerifyInfo(WIN32_FILE_ATTRIBUTE_DATA InfoStruct, - DWORD Attribs, ItemType TheType, WCHAR* Name) -{ - HANDLE hFile; - FILETIME CorrectCreation, CorrectAccess, CorrectModify; - WCHAR CopyName[64]; - - wcscpy(CopyName,Name); - free(Name); - - /* Check to see that the file attributes were recorded */ - if(InfoStruct.dwFileAttributes != Attribs) - { - Fail("ERROR: The file attributes on the file/directory were " - "recorded as being %d instead of %d.\n", - InfoStruct.dwFileAttributes, - Attribs); - } - - /* Note: We can't open a handle to a directory in windows. This - block of tests will only be run on files. - */ - if(TheType == IS_FILE) - { - - /* Get a handle to the file */ - hFile = CreateFile(CopyName, - 0, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (hFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open a handle to the file " - "'%S'. GetLastError() returned %d.",CopyName, - GetLastError()); - } - - - if(InfoStruct.nFileSizeLow != GetFileSize(hFile,NULL)) - { - Fail("ERROR: The file size reported by GetFileAttributesEx " - "did not match the file size given by GetFileSize.\n"); - } - - if(CloseHandle(hFile) == 0) - { - Fail("ERROR: Failed to properly close the handle to the " - "file we're testing. GetLastError() returned %d.\n", - GetLastError()); - - } - - } - - -} - -/* Given a file/directory name, the expected attribs and whether or not it - is a file or directory, call GetFileAttributesEx and verify the - results are correct. -*/ - -void RunTest_GetFileAttributesExW_test1(char* Name, DWORD Attribs, ItemType TheType ) -{ - WCHAR* TheName; - WIN32_FILE_ATTRIBUTE_DATA InfoStruct; - DWORD TheResult; - - TheName = convert(Name); - - TheResult = GetFileAttributesEx(TheName, - GetFileExInfoStandard, - &InfoStruct); - if(TheResult == 0) - { - free(TheName); - Fail("ERROR: GetFileAttributesEx returned 0, indicating failure. " - "GetLastError returned %d.\n",GetLastError()); - } - - VerifyInfo(InfoStruct, Attribs, TheType, TheName); - -} - -PALTEST(file_io_GetFileAttributesExW_test1_paltest_getfileattributesexw_test1, "file_io/GetFileAttributesExW/test1/paltest_getfileattributesexw_test1") -{ - DWORD TheResult; - WCHAR* FileName; - WIN32_FILE_ATTRIBUTE_DATA InfoStruct; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Test a Directory */ - RunTest_GetFileAttributesExW_test1("normal_test_directory", FILE_ATTRIBUTE_DIRECTORY, IS_DIR); - - - /* Test a Normal File */ - - RunTest_GetFileAttributesExW_test1("normal_test_file", FILE_ATTRIBUTE_NORMAL, IS_FILE); - - /* Test a Read-Only Directory */ - - RunTest_GetFileAttributesExW_test1("ro_test_directory", - FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_DIRECTORY, IS_DIR); - - /* Test a Read-Only File */ - - RunTest_GetFileAttributesExW_test1("ro_test_file", FILE_ATTRIBUTE_READONLY, IS_FILE); - - /* Test a Hidden File */ - - RunTest_GetFileAttributesExW_test1(".hidden_file", FILE_ATTRIBUTE_HIDDEN, IS_FILE); - - /* Test a Hidden Directory */ - - RunTest_GetFileAttributesExW_test1(".hidden_directory", - FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY, IS_DIR); - - /* Test a Non-Existent File */ - - FileName = convert("nonexistent_test_file"); - - TheResult = GetFileAttributesEx(FileName, - GetFileExInfoStandard, - &InfoStruct); - - if(TheResult != 0) - { - free(FileName); - Fail("ERROR: GetFileAttributesEx returned non-zero, indicating " - "success when it should have failed. It was called on a " - "non-existent file."); - } - - free(FileName); - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test2/test2.cpp deleted file mode 100644 index 31fe68921..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test2/test2.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: getfileattributesexw.c (getfileattributesexw\test2) -** -** Purpose: Tests the PAL implementation of GetFileAttributesExW. -** First get a file's attributes, modify the file, -** re-get its attributes -** and compare the two sets of attributes. -** -** -**===================================================================*/ -#include - -/** - * This is a helper function which takes two FILETIME structures and - * checks that the second time isn't before the first. - */ -static int IsFileTimeOk(FILETIME FirstTime, FILETIME SecondTime) -{ - - ULONG64 TimeOne, TimeTwo; - - TimeOne = ((((ULONG64)FirstTime.dwHighDateTime)<<32) | - ((ULONG64)FirstTime.dwLowDateTime)); - - TimeTwo = ((((ULONG64)SecondTime.dwHighDateTime)<<32) | - ((ULONG64)SecondTime.dwLowDateTime)); - - return(TimeOne <= TimeTwo); -} - -PALTEST(file_io_GetFileAttributesExW_test2_paltest_getfileattributesexw_test2, "file_io/GetFileAttributesExW/test2/paltest_getfileattributesexw_test2") -{ - DWORD res; - char fileName[MAX_PATH] = "test_file"; - WCHAR *wFileName; - WIN32_FILE_ATTRIBUTE_DATA beforeAttribs; - WIN32_FILE_ATTRIBUTE_DATA afterAttribs; - FILE *testFile; - ULONG64 beforeFileSize; - ULONG64 afterFileSize; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Create the file */ - testFile = fopen(fileName, "w+"); - if( NULL == testFile ) - { - Fail("Unexpected error: Unable to open file %S " - "with fopen. \n", - fileName); - } - - if( EOF == fputs( "testing", testFile ) ) - { - Fail("Unexpected error: Unable to write to file %S " - "with fputs. \n", - fileName); - } - - if( 0 != fclose(testFile) ) - { - Fail("Unexpected error: Unable to close file %S " - "with fclose. \n", - fileName); - } - - /* Test the Values returned by GetFileAttributesExW - * before and after manipulating a file shouldn't be the same. - */ - - wFileName = convert(fileName); - - res = GetFileAttributesExW(wFileName, - GetFileExInfoStandard, - &beforeAttribs); - - if(res == 0) - { - Fail("ERROR: unable to get initial file attributes with " - "GetFileAttributesEx that returned 0 with error %d.\n", - GetLastError()); - } - - /* Make sure the time are different */ - Sleep(500); - - testFile = fopen(fileName, "w+"); - if( NULL == testFile ) - { - Fail("Unexpected error: Unable to open file %S " - "with fopen. \n", - fileName); - } - - if( EOF == fputs( "testing GetFileAttributesExW", testFile ) ) - { - Fail("Unexpected error: Unable to write to file %S " - "with fputs. \n", - fileName); - } - - if( 0 != fclose(testFile) ) - { - Fail("Unexpected error: Unable to close file %S " - "with fclose. \n", - fileName); - } - - res = GetFileAttributesExW(wFileName, - GetFileExInfoStandard, - &afterAttribs); - - if(res == 0) - { - Fail("ERROR: unable to get file attributes after operations with " - "GetFileAttributesEx that returned 0 with error %d.\n", - GetLastError()); - } - - /* Check the creation time */ - if(!IsFileTimeOk(beforeAttribs.ftCreationTime, - afterAttribs.ftCreationTime)) - { - Fail("ERROR: Creation time after the fputs operation " - "is earlier than the creation time before the fputs.\n"); - } - - /* Check the last access time */ - if(!IsFileTimeOk(beforeAttribs.ftLastAccessTime, - afterAttribs.ftLastAccessTime)) - { - Fail("ERROR: Last access time after the fputs operation " - "is earlier than the last access time before the fputs.\n"); - } - - /* Check the last write time */ - if(!IsFileTimeOk(beforeAttribs.ftLastWriteTime, - afterAttribs.ftLastWriteTime)) - { - Fail("ERROR: Last write time after the fputs operation " - "is earlier than the last write time before the fputs.\n"); - } - - beforeFileSize = ((ULONG64)beforeAttribs.nFileSizeHigh)<< 32 | - ((ULONG64)beforeAttribs.nFileSizeLow); - - afterFileSize = ((ULONG64)afterAttribs.nFileSizeHigh)<< 32 | - ((ULONG64)afterAttribs.nFileSizeLow); - - /* Check the file size */ - if( afterFileSize <= beforeFileSize ) - { - Fail("ERROR: the file should have had a bigger size " - "after(%d) the operations than before(%d)\n", - afterAttribs.nFileSizeLow, - beforeAttribs.nFileSizeLow); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_file deleted file mode 100644 index 0d1ac31cf..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_file +++ /dev/null @@ -1 +0,0 @@ -Hidden file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_ro_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_ro_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_ro_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_ro_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_ro_file deleted file mode 100644 index 8f78fcb43..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/.hidden_ro_file +++ /dev/null @@ -1 +0,0 @@ -.hidden_ro_file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/GetFileAttributesW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/GetFileAttributesW.cpp deleted file mode 100644 index 7efc9f880..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/GetFileAttributesW.cpp +++ /dev/null @@ -1,346 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================= -** -** Source: GetFileAttributesW.c -** -** Purpose: Tests the PAL implementation of the GetFileAttributesW function by -** checking the attributes of: -** - a normal directory and file -** - a read only directory and file -** - a read write directory and file -** - a hidden directory and file -** - a read only hidden directory and file -** - a directory and a file with no attributes -** - an invalid file name -** -** -**===========================================================================*/ -#include - -const int TYPE_DIR = 0; -const int TYPE_FILE = 1; -/* Structure defining a test case */ -typedef struct -{ - char *name; /* name of the file/directory */ - DWORD expectedAttribs; /* expected attributes */ - HANDLE hFile; /* Handle to the file */ - int isFile; /* is file (1) or dir (0) */ -}TestCaseFile; - -typedef struct -{ - char *name; /* name of the file/directory */ - DWORD expectedAttribs; /* expected attributes */ - HANDLE hFile; /* Handle to the file */ - int isFile; /* is file (1) or dir (0) */ -}TestCaseDir; - -DWORD desiredAccessFile_GetFileAttributesW_test1 = GENERIC_READ | GENERIC_WRITE; -DWORD shareModeFile_GetFileAttributesW_test1 = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE; -LPSECURITY_ATTRIBUTES lpAttrFile_GetFileAttributesW_test1 = NULL; -DWORD dwCreationDispFile_GetFileAttributesW_test1 = CREATE_NEW; -DWORD dwFlagsAttribFile_GetFileAttributesW_test1 = FILE_ATTRIBUTE_NORMAL; -HANDLE hTemplateFile_GetFileAttributesW_test1 = NULL; - -int numFileTests_GetFileAttributesW_test1 = 6; -TestCaseFile gfaTestsFile_GetFileAttributesW_test1[6]; /* GetFileAttributes tests list */ - -int numDirTests_GetFileAttributesW_test1 = 6; -TestCaseDir gfaTestsDir_GetFileAttributesW_test1[6]; /* GetFileAttributes tests list */ - -BOOL CleanUpFiles_GetFileAttributesW_test1() -{ - DWORD dwAtt; - int i; - BOOL result = TRUE; - for (i = 0; i < numFileTests_GetFileAttributesW_test1 - 1 ; i++ ) - { - dwAtt = GetFileAttributesA(gfaTestsFile_GetFileAttributesW_test1[i].name); - - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - //Trace("Files iteration %d\n", i); - if(!SetFileAttributesA (gfaTestsFile_GetFileAttributesW_test1[i].name, FILE_ATTRIBUTE_NORMAL)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile_GetFileAttributesW_test1[i].name, FILE_ATTRIBUTE_NORMAL); - } - - if(!DeleteFileA (gfaTestsFile_GetFileAttributesW_test1[i].name)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsFile_GetFileAttributesW_test1[i].name, dwAtt); - } - - } - } -// Trace("Value of result is %d\n", result); - return result; -} -BOOL SetUpFiles_GetFileAttributesW_test1() -{ - int i = 0; - BOOL result = TRUE; - for (i = 0; i < numFileTests_GetFileAttributesW_test1 - 1 ; i++ ) - { - gfaTestsFile_GetFileAttributesW_test1[i].hFile = CreateFile(gfaTestsFile_GetFileAttributesW_test1[i].name, - desiredAccessFile_GetFileAttributesW_test1, - shareModeFile_GetFileAttributesW_test1, - lpAttrFile_GetFileAttributesW_test1, - dwCreationDispFile_GetFileAttributesW_test1, - dwFlagsAttribFile_GetFileAttributesW_test1, - hTemplateFile_GetFileAttributesW_test1); - - if( gfaTestsFile_GetFileAttributesW_test1[i].hFile == NULL ) - { - Fail("Error while creating files for iteration %d\n", i); - } - - if(!SetFileAttributesA (gfaTestsFile_GetFileAttributesW_test1[i].name, gfaTestsFile_GetFileAttributesW_test1[i].expectedAttribs)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile_GetFileAttributesW_test1[i].name, gfaTestsFile_GetFileAttributesW_test1[i].expectedAttribs); - } - } - - return result; -} - -BOOL CleanUpDirs_GetFileAttributesW_test1() -{ - DWORD dwAtt; - int i; - BOOL result = TRUE; - for (i = 0; i < numDirTests_GetFileAttributesW_test1 - 1; i++ ) - { - dwAtt = GetFileAttributesA(gfaTestsDir_GetFileAttributesW_test1[i].name); - - if( dwAtt != INVALID_FILE_ATTRIBUTES ) - { - - if(!SetFileAttributesA (gfaTestsDir_GetFileAttributesW_test1[i].name, FILE_ATTRIBUTE_DIRECTORY)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir_GetFileAttributesW_test1[i].name, (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY)); - } - - LPWSTR nameW = convert(gfaTestsDir_GetFileAttributesW_test1[i].name); - if(!RemoveDirectoryW (nameW)) - { - result = FALSE; - Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsDir_GetFileAttributesW_test1[i].name, dwAtt); - } - - free(nameW); - } - } - - return result; -} - -BOOL SetUpDirs_GetFileAttributesW_test1() -{ - int i = 0; - BOOL result = TRUE; - DWORD ret = 0; - for (i = 0; i < numDirTests_GetFileAttributesW_test1 - 1; i++ ) - { - result = CreateDirectoryA(gfaTestsDir_GetFileAttributesW_test1[i].name, - NULL); - - if(!result ) - { - result = FALSE; - Fail("Error while creating directory for iteration %d\n", i); - } - - if(!SetFileAttributesA (gfaTestsDir_GetFileAttributesW_test1[i].name, gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs)) - { - result = FALSE; - Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir_GetFileAttributesW_test1[i].name, gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs); - } - - ret = GetFileAttributesA (gfaTestsDir_GetFileAttributesW_test1[i].name); - if(ret != gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs) - { - result = FALSE; - Trace("ERROR: Error setting attributes [%s][%d]\n", gfaTestsDir_GetFileAttributesW_test1[i].name, gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs); - } - // Trace("Setup Dir setting attr [%d], returned [%d]\n", gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs, ret); - - } -// Trace("Setup dirs returning %d\n", result); - return result; -} -PALTEST(file_io_GetFileAttributesW_test1_paltest_getfileattributesw_test1, "file_io/GetFileAttributesW/test1/paltest_getfileattributesw_test1") -{ - int i; - BOOL bFailed = FALSE; - DWORD result; - - char * NormalDirectoryName = "normal_test_directory"; - char * ReadOnlyDirectoryName = "ro_test_directory"; - char * ReadWriteDirectoryName = "rw_directory"; - char * HiddenDirectoryName = ".hidden_directory"; - char * HiddenReadOnlyDirectoryName = ".hidden_ro_directory"; - char * NoDirectoryName = "no_directory"; - - char * NormalFileName = "normal_test_file"; - char * ReadOnlyFileName = "ro_test_file"; - char * ReadWriteFileName = "rw_file"; - char * HiddenFileName = ".hidden_file"; - char * HiddenReadOnlyFileName = ".hidden_ro_file"; - char * NotReallyAFileName = "not_really_a_file"; - - WCHAR *WStr; - /* Tests on directory */ - gfaTestsDir_GetFileAttributesW_test1[0].name = NormalDirectoryName; - gfaTestsDir_GetFileAttributesW_test1[0].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; - gfaTestsDir_GetFileAttributesW_test1[0].isFile = TYPE_DIR; - - gfaTestsDir_GetFileAttributesW_test1[1].name = ReadOnlyDirectoryName; - gfaTestsDir_GetFileAttributesW_test1[1].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | - FILE_ATTRIBUTE_READONLY; - gfaTestsDir_GetFileAttributesW_test1[1].isFile = TYPE_DIR; - - gfaTestsDir_GetFileAttributesW_test1[2].name = ReadWriteDirectoryName; - gfaTestsDir_GetFileAttributesW_test1[2].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; - gfaTestsDir_GetFileAttributesW_test1[2].isFile = TYPE_DIR; - - gfaTestsDir_GetFileAttributesW_test1[3].name = HiddenDirectoryName; - gfaTestsDir_GetFileAttributesW_test1[3].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; //| - //FILE_ATTRIBUTE_HIDDEN; - gfaTestsDir_GetFileAttributesW_test1[3].isFile = TYPE_DIR; - - gfaTestsDir_GetFileAttributesW_test1[4].name = HiddenReadOnlyDirectoryName; - gfaTestsDir_GetFileAttributesW_test1[4].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | - FILE_ATTRIBUTE_READONLY; //| - //FILE_ATTRIBUTE_HIDDEN; - gfaTestsDir_GetFileAttributesW_test1[4].isFile = TYPE_DIR; - - gfaTestsDir_GetFileAttributesW_test1[5].name = NoDirectoryName; - gfaTestsDir_GetFileAttributesW_test1[5].expectedAttribs = INVALID_FILE_ATTRIBUTES; - gfaTestsDir_GetFileAttributesW_test1[5].isFile = TYPE_DIR; - - /* Tests on file */ - gfaTestsFile_GetFileAttributesW_test1[0].name = NormalFileName; - gfaTestsFile_GetFileAttributesW_test1[0].expectedAttribs = FILE_ATTRIBUTE_NORMAL; - gfaTestsFile_GetFileAttributesW_test1[0].isFile = TYPE_FILE; - - - gfaTestsFile_GetFileAttributesW_test1[1].name = ReadOnlyFileName; - gfaTestsFile_GetFileAttributesW_test1[1].expectedAttribs = FILE_ATTRIBUTE_READONLY; - gfaTestsFile_GetFileAttributesW_test1[1].isFile = TYPE_FILE; - - gfaTestsFile_GetFileAttributesW_test1[2].name = ReadWriteFileName; - gfaTestsFile_GetFileAttributesW_test1[2].expectedAttribs = FILE_ATTRIBUTE_NORMAL; - gfaTestsFile_GetFileAttributesW_test1[2].isFile = TYPE_FILE; - - gfaTestsFile_GetFileAttributesW_test1[3].name = HiddenFileName; - gfaTestsFile_GetFileAttributesW_test1[3].expectedAttribs = FILE_ATTRIBUTE_NORMAL; //FILE_ATTRIBUTE_HIDDEN; - gfaTestsFile_GetFileAttributesW_test1[3].isFile = TYPE_FILE; - - gfaTestsFile_GetFileAttributesW_test1[4].name = HiddenReadOnlyFileName; - gfaTestsFile_GetFileAttributesW_test1[4].expectedAttribs = FILE_ATTRIBUTE_READONLY; //| - //FILE_ATTRIBUTE_HIDDEN; - gfaTestsFile_GetFileAttributesW_test1[4].isFile = TYPE_FILE; - - - gfaTestsFile_GetFileAttributesW_test1[5].name = NotReallyAFileName; - gfaTestsFile_GetFileAttributesW_test1[5].expectedAttribs = INVALID_FILE_ATTRIBUTES; - gfaTestsFile_GetFileAttributesW_test1[5].isFile = TYPE_FILE; - - /* Initialize PAL environment */ - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - if(!CleanUpFiles_GetFileAttributesW_test1()) - { - Fail("GetFileAttributesW: Pre-Clean Up Files Failed\n"); - } - - if(0 == SetUpFiles_GetFileAttributesW_test1()) - { - Fail("GetFileAttributesW: SetUp Files Failed\n"); - } - - if(!CleanUpDirs_GetFileAttributesW_test1()) - { - Fail("GetFileAttributesW: Pre-Clean Up Directories Failed\n"); - } - - if(!SetUpDirs_GetFileAttributesW_test1()) - { - Fail("GetFileAttributesW: SetUp Directories Failed\n"); - } - - /* - * Go through all the test cases above, - * call GetFileAttributesW on the name and - * make sure the return value is the one expected - */ - for( i = 0; i < numFileTests_GetFileAttributesW_test1; i++ ) - { - WStr = convert(gfaTestsFile_GetFileAttributesW_test1[i].name); - result = GetFileAttributesW(WStr); - - if( result != gfaTestsFile_GetFileAttributesW_test1[i].expectedAttribs ) - { - bFailed = TRUE; - - Trace("ERROR: GetFileAttributesW Test#%u on %s " - "returned %u instead of %u. \n", - i, - gfaTestsFile_GetFileAttributesW_test1[i].name, - result, - gfaTestsFile_GetFileAttributesW_test1[i].expectedAttribs); - - } - free(WStr); - } - - - for( i = 0; i < numDirTests_GetFileAttributesW_test1; i++ ) - { - WStr = convert(gfaTestsDir_GetFileAttributesW_test1[i].name); - result = GetFileAttributesW(WStr); - - if( result != gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs ) - { - bFailed = TRUE; - - Trace("ERROR: GetFileAttributesW on Directories Test#%u on %s " - "returned %u instead of %u. \n", - i, - gfaTestsDir_GetFileAttributesW_test1[i].name, - result, - gfaTestsDir_GetFileAttributesW_test1[i].expectedAttribs); - - } - free(WStr); - } - - if(!CleanUpFiles_GetFileAttributesW_test1()) - { - Fail("GetFileAttributesW: Post-Clean Up Files Failed\n"); - } - - if(!CleanUpDirs_GetFileAttributesW_test1()) - { - Fail("GetFileAttributesW: Post-Clean Up Directories Failed\n"); - } - - /* If any errors, just call Fail() */ - if( bFailed ) - { - Fail(""); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/no_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/no_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/no_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/no_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/no_file deleted file mode 100644 index 3d631e810..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/no_file +++ /dev/null @@ -1 +0,0 @@ -No attribs file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/normal_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/normal_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/normal_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/normal_test_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/normal_test_file deleted file mode 100644 index a6e1e627a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/normal_test_file +++ /dev/null @@ -1,6 +0,0 @@ -file_io -CopyFileW -Positive Test for CopyFileW -test the CopyFileW function -DEFAULT -CopyFileW \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/ro_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/ro_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/ro_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/ro_test_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/ro_test_file deleted file mode 100644 index a6e1e627a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/ro_test_file +++ /dev/null @@ -1,6 +0,0 @@ -file_io -CopyFileW -Positive Test for CopyFileW -test the CopyFileW function -DEFAULT -CopyFileW \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/rw_file b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/rw_file deleted file mode 100644 index 39d66f036..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/rw_file +++ /dev/null @@ -1 +0,0 @@ -Read Write file \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/rw_test_directory/keepme b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/rw_test_directory/keepme deleted file mode 100644 index 31eade721..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetFileAttributesW/test1/rw_test_directory/keepme +++ /dev/null @@ -1 +0,0 @@ -Make CVS checkout this directory even with -p option. \ No newline at end of file diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp deleted file mode 100644 index 96d45cd90..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetTempFileNameA.c (test 1) -** -** Purpose: Tests the PAL implementation of the GetTempFileNameA function. -** -** Depends on: -** GetFileAttributesA -** DeleteFileA -** -** -**===================================================================*/ - -#include - - - -PALTEST(file_io_GetTempFileNameA_test1_paltest_gettempfilenamea_test1, "file_io/GetTempFileNameA/test1/paltest_gettempfilenamea_test1") -{ - UINT uiError = 0; - const UINT uUnique = 0; - const char* szDot = {"."}; - const char* szValidPrefix = {"cfr"}; - const char* szLongValidPrefix = {"cfrwxyz"}; - char szReturnedName[256]; - char szTempString[256]; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* valid path with null prefix */ - uiError = GetTempFileNameA(szDot, NULL, uUnique, szReturnedName); - if (uiError == 0) - { - Fail("GetTempFileNameA: ERROR -> Call failed with a valid path " - "with the error code: %ld\n", GetLastError()); - } - else - { - /* verify temp file was created */ - if (GetFileAttributesA(szReturnedName) == -1) - { - Fail("GetTempFileNameA: ERROR -> GetFileAttributes failed on the " - "returned temp file \"%s\" with error code: %ld.\n", - szReturnedName, - GetLastError()); - } - if (DeleteFileA(szReturnedName) != TRUE) - { - Fail("GetTempFileNameA: ERROR -> DeleteFileW failed to delete" - "the created temp file with error code: %ld.\n", GetLastError()); - } - } - - - /* valid path with valid prefix */ - uiError = GetTempFileNameA(szDot, szValidPrefix, uUnique, szReturnedName); - if (uiError == 0) - { - Fail("GetTempFileNameA: ERROR -> Call failed with a valid path and " - "prefix with the error code: %ld\n", GetLastError()); - } - else - { - /* verify temp file was created */ - if (GetFileAttributesA(szReturnedName) == -1) - { - Fail("GetTempFileNameA: ERROR -> GetFileAttributes failed on the " - "returned temp file \"%s\" with error code: %ld.\n", - szReturnedName, - GetLastError()); - } - if (DeleteFileA(szReturnedName) != TRUE) - { - Fail("GetTempFileNameA: ERROR -> DeleteFileW failed to delete" - "the created temp \"%s\" file with error code: %ld.\n", - szReturnedName, - GetLastError()); - } - } - - /* valid path with long prefix */ - uiError = GetTempFileNameA(szDot, szLongValidPrefix, uUnique, szReturnedName); - if (uiError == 0) - { - Fail("GetTempFileNameA: ERROR -> Call failed with a valid path and " - "prefix with the error code: %ld\n", GetLastError()); - } - else - { - /* verify temp file was created */ - if (GetFileAttributesA(szReturnedName) == -1) - { - Fail("GetTempFileNameA: ERROR -> GetFileAttributes failed on the " - "returned temp file \"%s\" with error code: %ld.\n", - szReturnedName, - GetLastError()); - } - - /* now verify that it only used the first 3 characters of the prefix */ - sprintf_s(szTempString, ARRAY_SIZE(szTempString), "%s\\%s", szDot, szLongValidPrefix); - if (strncmp(szTempString, szReturnedName, 6) == 0) - { - Fail("GetTempFileNameA: ERROR -> It appears that an improper prefix " - "was used.\n"); - } - - if (DeleteFileA(szReturnedName) != TRUE) - { - Fail("GetTempFileNameA: ERROR -> DeleteFileW failed to delete" - "the created temp file \"%s\" with error code: %ld.\n", - szReturnedName, - GetLastError()); - } - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test2/GetTempFileNameA.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test2/GetTempFileNameA.cpp deleted file mode 100644 index 9edaf4839..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test2/GetTempFileNameA.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetTempFileNameA.c (test 2) -** -** Purpose: Tests the number of files GetTempFileNameA can create. -** -** Depends on: -** GetFileAttributesA -** oodles of free disk space (>4.07GB) -** -** -**===================================================================*/ - -#include - - - -PALTEST(file_io_GetTempFileNameA_test2_paltest_gettempfilenamea_test2, "file_io/GetTempFileNameA/test2/paltest_gettempfilenamea_test2") -{ - UINT uiError = 0; - DWORD dwError = 0; - const UINT uUnique = 0; - const char* szDot = {"."}; - const char* szValidPrefix = {"cfr"}; - char szReturnedName[256]; - DWORD i; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* test the number of temp files that can be created */ - for (i = 0; i < 0x10005; i++) - { - uiError = GetTempFileNameA(szDot, szValidPrefix, uUnique, szReturnedName); - if (uiError == 0) - { - dwError = GetLastError(); - if (dwError == ERROR_FILE_EXISTS) - { - /* file already existes so break out of the loop */ - i--; /* decrement the count because it wasn't successful */ - break; - } - else - { - /* it was something other than the file already existing? */ - Fail("GetTempFileNameA: ERROR -> Call failed with a valid " - "path and prefix with the error code: %ld\n", GetLastError()); - } - } - else - { - /* verify temp file was created */ - if (GetFileAttributesA(szReturnedName) == -1) - { - Fail("GetTempFileNameA: ERROR -> GetFileAttributes failed " - "on the returned temp file \"%s\" with error code: %ld.\n", - szReturnedName, - GetLastError()); - } - } - } - - /* did it create more than 0xffff files */ - if (i > 0xffff) - { - Fail("GetTempFileNameA: ERROR -> Was able to create more than 0xffff" - " temp files.\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test3/gettempfilenamea.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test3/gettempfilenamea.cpp deleted file mode 100644 index fa9112c49..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameA/test3/gettempfilenamea.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetTempFileNameA.c (test 3) -** -** Purpose: Tests the PAL implementation of the GetTempFileNameA function. -** Checks the file attributes and ensures that getting a file name, -** deleting the file and getting another doesn't produce the same -** as the just deleted file. Also checks the file size is 0. -** -** Depends on: -** GetFileAttributesA -** CloseHandle -** DeleteFileA -** CreateFileA -** GetFileSize -** -** -**===================================================================*/ - -#include - - - -PALTEST(file_io_GetTempFileNameA_test3_paltest_gettempfilenamea_test3, "file_io/GetTempFileNameA/test3/paltest_gettempfilenamea_test3") -{ - const UINT uUnique = 0; - UINT uiError; - const char* szDot = {"."}; - char szReturnedName[MAX_LONGPATH]; - char szReturnedName_02[MAX_LONGPATH]; - DWORD dwFileSize = 0; - HANDLE hFile; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* valid path with null prefix */ - uiError = GetTempFileNameA(szDot, NULL, uUnique, szReturnedName); - if (uiError == 0) - { - Fail("GetTempFileNameA: ERROR -> Call failed with a valid path " - "with the error code: %u.\n", - GetLastError()); - } - - /* verify temp file was created */ - if (GetFileAttributesA(szReturnedName) == -1) - { - Fail("GetTempFileNameA: ERROR -> GetFileAttributes failed on the " - "returned temp file \"%s\" with error code: %u.\n", - szReturnedName, - GetLastError()); - } - - /* - ** verify that the file size is 0 bytes - */ - - hFile = CreateFileA(szReturnedName, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hFile == INVALID_HANDLE_VALUE) - { - Trace("GetTempFileNameA: ERROR -> CreateFileA failed to open" - " the created temp file with error code: %u.\n", - GetLastError()); - if (!DeleteFileA(szReturnedName)) - { - Trace("GetTempFileNameA: ERROR -> DeleteFileA failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - Fail(""); - } - - if ((dwFileSize = GetFileSize(hFile, NULL)) != (DWORD)0) - { - Trace("GetTempFileNameA: ERROR -> GetFileSize returned %u whereas" - "it should have returned 0.\n", - dwFileSize); - if (!CloseHandle(hFile)) - { - Trace("GetTempFileNameA: ERROR -> CloseHandle failed. " - "GetLastError returned: %u.\n", - GetLastError()); - } - if (!DeleteFileA(szReturnedName)) - { - Trace("GetTempFileNameA: ERROR -> DeleteFileA failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - Fail(""); - } - - - if (!CloseHandle(hFile)) - { - Fail("GetTempFileNameA: ERROR -> CloseHandle failed. " - "GetLastError returned: %u.\n", - GetLastError()); - } - - if (DeleteFileA(szReturnedName) != TRUE) - { - Fail("GetTempFileNameA: ERROR -> DeleteFileA failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - - /* get another and make sure it's not the same as the last */ - uiError = GetTempFileNameA(szDot, NULL, uUnique, szReturnedName_02); - if (uiError == 0) - { - Fail("GetTempFileNameA: ERROR -> Call failed with a valid path " - "with the error code: %u.\n", - GetLastError()); - } - - /* did we get different names? */ - if (strcmp(szReturnedName, szReturnedName_02) == 0) - { - Trace("GetTempFileNameA: ERROR -> The first call returned \"%s\". " - "The second call returned \"%s\" and the two should not be" - " the same.\n", - szReturnedName, - szReturnedName_02); - if (!DeleteFileA(szReturnedName_02)) - { - Trace("GetTempFileNameA: ERROR -> DeleteFileA failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - Fail(""); - } - - /* clean up */ - if (!DeleteFileA(szReturnedName_02)) - { - Fail("GetTempFileNameA: ERROR -> DeleteFileA failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test1/GetTempFileNameW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test1/GetTempFileNameW.cpp deleted file mode 100644 index 02a01a4fe..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test1/GetTempFileNameW.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetTempFileNameW.c (test 1) -** -** Purpose: Tests the PAL implementation of the GetTempFileNameW function. -** -** -**===================================================================*/ - -#include - - - -PALTEST(file_io_GetTempFileNameW_test1_paltest_gettempfilenamew_test1, "file_io/GetTempFileNameW/test1/paltest_gettempfilenamew_test1") -{ - UINT uiError = 0; - const UINT uUnique = 0; - WCHAR* wPrefix = NULL; - WCHAR* wPath = NULL; - WCHAR wReturnedName[256]; - WCHAR wTempString[256]; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - - // valid path with null ext - wPath = convert("."); - uiError = GetTempFileNameW(wPath, wPrefix, uUnique, wReturnedName); - free (wPath); - if (uiError == 0) - { - Fail("GetTempFileNameW: ERROR -> Call failed with a valid path " - "with the error code: %ld\n", GetLastError()); - } - else - { - // verify temp file was created - if (GetFileAttributesW(wReturnedName) == -1) - { - Fail("GetTempFileNameW: ERROR -> GetFileAttributes failed on the " - "returned temp file with error code: %ld.\n", GetLastError()); - } - if (DeleteFileW(wReturnedName) != TRUE) - { - Fail("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - "the created temp file with error code: %lld.\n", GetLastError()); - } - } - - - // valid path with valid prefix - wPath = convert("."); - wPrefix = convert("cfr"); - uiError = GetTempFileNameW(wPath, wPrefix, uUnique, wReturnedName); - free (wPath); - free (wPrefix); - if (uiError == 0) - { - Fail("GetTempFileNameW: ERROR -> Call failed with a valid path and " - "prefix with the error code: %ld\n", GetLastError()); - } - else - { - // verify temp file was created - if (GetFileAttributesW(wReturnedName) == -1) - { - Fail("GetTempFileNameW: ERROR -> GetFileAttributes failed on the " - "returned temp file with error code: %ld.\n", GetLastError()); - } - if (DeleteFileW(wReturnedName) != TRUE) - { - Fail("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - "the created temp file with error code: %lld.\n", GetLastError()); - } - } - - // valid path with long prefix - wPath = convert("."); - wPrefix = convert("cfrwxyz"); - uiError = GetTempFileNameW(wPath, wPrefix, uUnique, wReturnedName); - if (uiError == 0) - { - free (wPath); - free (wPrefix); - Fail("GetTempFileNameW: ERROR -> Call failed with a valid path and " - "prefix with the error code: %ld\n", GetLastError()); - } - else - { - // verify temp file was created - if (GetFileAttributesW(wReturnedName) == -1) - { - free (wPath); - free (wPrefix); - Fail("GetTempFileNameW: ERROR -> GetFileAttributes failed on the " - "returned temp file with error code: %ld.\n", GetLastError()); - } - - // now verify that it only used the first 3 characters of the prefix - WCHAR* wCurr = wTempString; - memcpy(wCurr, wPath, wcslen(wPath) * sizeof(WCHAR)); - wCurr += wcslen(wPath); - wcscat(wCurr, W("/")); - wCurr += wcslen(W("/")); - wcscat(wCurr, wPrefix); - if (memcmp(wTempString, wReturnedName, wcslen(wTempString)*sizeof(WCHAR)) == 0) - { - free (wPath); - free (wPrefix); - Fail("GetTempFileNameW: ERROR -> It appears that an improper prefix " - "was used.\n"); - } - - if (DeleteFileW(wReturnedName) != TRUE) - { - free (wPath); - free (wPrefix); - Fail("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - "the created temp file with error code: %lld.\n", GetLastError()); - } - } - - free (wPath); - free (wPrefix); - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test2/GetTempFileNameW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test2/GetTempFileNameW.cpp deleted file mode 100644 index d79e4cad6..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test2/GetTempFileNameW.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetTempFileNameW.c (test 2) -** -** Purpose: Tests the PAL implementation of the GetTempFileNameW function. -** -** -**===================================================================*/ - -#include - - - -PALTEST(file_io_GetTempFileNameW_test2_paltest_gettempfilenamew_test2, "file_io/GetTempFileNameW/test2/paltest_gettempfilenamew_test2") -{ - UINT uiError = 0; - DWORD dwError = 0; - const UINT uUnique = 0; - WCHAR* wPrefix = NULL; - WCHAR* wPath = NULL; - WCHAR wReturnedName[256]; - DWORD i; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - - // test the number of temp files that can be created - wPrefix = convert("cfr"); - wPath = convert("."); - for (i = 0; i < 0x10005; i++) - { - uiError = GetTempFileNameW(wPath, wPrefix, uUnique, wReturnedName); - if (uiError == 0) - { - dwError = GetLastError(); - if (dwError == ERROR_FILE_EXISTS) - { - // file already existes so break out of the loop - i--; // decrement the count because it wasn't successful - break; - } - else - { - // it was something other than the file already existing? - free (wPath); - free (wPrefix); - Fail("GetTempFileNameW: ERROR -> Call failed with a valid " - "path and prefix with the error code: %ld\n", GetLastError()); - } - } - else - { - // verify temp file was created - if (GetFileAttributesW(wReturnedName) == -1) - { - free (wPath); - free (wPrefix); - Fail("GetTempFileNameW: ERROR -> GetFileAttributes failed " - "on the returned temp file with error code: %ld.\n", - GetLastError()); - } - } - } - - free (wPath); - free (wPrefix); - - // did it create more than 0xffff files - if (i > 0xffff) - { - Fail("GetTempFileNameW: ERROR -> Was able to create more than 0xffff" - " temp files.\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test3/gettempfilenamew.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test3/gettempfilenamew.cpp deleted file mode 100644 index 312138b08..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/GetTempFileNameW/test3/gettempfilenamew.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: GetTempFileNameW.c (test 3) -** -** Purpose: Tests the PAL implementation of the GetTempFileNameW function. -** Checks the file attributes and ensures that getting a file name, -** deleting the file and getting another doesn't produce the same -** as the just deleted file. Also checks the file size is 0. -** -** Depends on: -** GetFileAttributesW -** DeleteFileW -** CreateFileW -** GetFileSize -** CloseHandle -** -** -**===================================================================*/ - -#include - - - -PALTEST(file_io_GetTempFileNameW_test3_paltest_gettempfilenamew_test3, "file_io/GetTempFileNameW/test3/paltest_gettempfilenamew_test3") -{ - const UINT uUnique = 0; - UINT uiError; - WCHAR szwReturnedName[MAX_LONGPATH]; - WCHAR szwReturnedName_02[MAX_LONGPATH]; - DWORD dwFileSize = 0; - HANDLE hFile; - const WCHAR szwDot[] = {'.','\0'}; - const WCHAR szwPre[] = {'c','\0'}; - - if (0 != PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* valid path with null prefix */ - uiError = GetTempFileNameW(szwDot, szwPre, uUnique, szwReturnedName); - if (uiError == 0) - { - Fail("GetTempFileNameW: ERROR -> Call failed with a valid path " - "with the error code: %u.\n", - GetLastError()); - } - - /* verify temp file was created */ - if (GetFileAttributesW(szwReturnedName) == -1) - { - Fail("GetTempFileNameW: ERROR -> GetFileAttributes failed on the " - "returned temp file \"%S\" with error code: %u.\n", - szwReturnedName, - GetLastError()); - } - - /* - ** verify that the file size is 0 bytes - */ - - hFile = CreateFileW(szwReturnedName, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hFile == INVALID_HANDLE_VALUE) - { - Trace("GetTempFileNameW: ERROR -> CreateFileW failed to open" - " the created temp file with error code: %u.\n", - GetLastError()); - if (!DeleteFileW(szwReturnedName)) - { - Trace("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - Fail(""); - } - - if ((dwFileSize = GetFileSize(hFile, NULL)) != (DWORD)0) - { - Trace("GetTempFileNameW: ERROR -> GetFileSize returned %u whereas" - "it should have returned 0.\n", - dwFileSize); - if (!CloseHandle(hFile)) - { - Trace("GetTempFileNameW: ERROR -> CloseHandle was unable to close the " - "opened file. GetLastError returned %u.\n", - GetLastError()); - } - if (!DeleteFileW(szwReturnedName)) - { - Trace("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - Fail(""); - } - - if (!CloseHandle(hFile)) - { - Fail("GetTempFileNameW: ERROR -> CloseHandle was unable to close the " - "opened file. GetLastError returned %u.\n", - GetLastError()); - } - - - /* delete the file to see if we get the same name next time around */ - if (DeleteFileW(szwReturnedName) != TRUE) - { - Fail("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - - /* get another and make sure it's not the same as the last */ - uiError = GetTempFileNameW(szwDot, szwPre, uUnique, szwReturnedName_02); - if (uiError == 0) - { - Fail("GetTempFileNameW: ERROR -> Call failed with a valid path " - "with the error code: %u.\n", - GetLastError()); - } - - /* did we get different names? */ - if (wcsncmp(szwReturnedName, szwReturnedName_02, wcslen(szwReturnedName)) == 0) - { - Fail("GetTempFileNameW: ERROR -> The first call returned \"%S\". " - "The second call returned \"%S\" and the two should not be" - " the same.\n", - szwReturnedName, - szwReturnedName_02); - if (!DeleteFileW(szwReturnedName_02)) - { - Trace("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - Fail(""); - } - - /* clean up */ - if (!DeleteFileW(szwReturnedName_02)) - { - Fail("GetTempFileNameW: ERROR -> DeleteFileW failed to delete" - " the created temp file with error code: %u.\n", - GetLastError()); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/ReadFile/test4/readfile.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/ReadFile/test4/readfile.cpp index 1704c4c2e..cef8ec291 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/ReadFile/test4/readfile.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/ReadFile/test4/readfile.cpp @@ -80,7 +80,7 @@ PALTEST(file_io_ReadFile_test4_paltest_readfile_test4, "file_io/ReadFile/test4/p /* Set the file pointer to beginning of file. */ - res = SetFilePointer(hFile, (LONG)NULL, NULL, FILE_BEGIN); + res = SetFilePointer(hFile, 0, NULL, FILE_BEGIN); if( (res == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp index 7b61e753e..4b851a463 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp @@ -67,7 +67,7 @@ #define szFileNameExistsWithExt "searchpathw.c" -char fileloc_SearchPathW_test1[_MAX_PATH]; +char fileloc_SearchPathW_test1[MAX_PATH]; void removeFileHelper_SearchPathW_test1(LPSTR pfile, int location) { @@ -105,7 +105,7 @@ PALTEST(file_io_SearchPathW_test1_paltest_searchpathw_test1, "file_io/SearchPath WCHAR* lpFileName = NULL; WCHAR* lpExtension = NULL; DWORD nBufferLength = 0; - WCHAR lpBuffer[_MAX_PATH]; + WCHAR lpBuffer[MAX_PATH]; WCHAR** lpFilePart = NULL; DWORD error = 0; DWORD result = 0; @@ -132,7 +132,7 @@ PALTEST(file_io_SearchPathW_test1_paltest_searchpathw_test1, "file_io/SearchPath Fail("ERROR: GetTempPathA failed to get a path\n"); } - memset(fileloc_SearchPathW_test1, 0, _MAX_PATH); + memset(fileloc_SearchPathW_test1, 0, MAX_PATH); sprintf_s(fileloc_SearchPathW_test1, ARRAY_SIZE(fileloc_SearchPathW_test1), "%s%s", fullPath, szFileNameExistsWithExt); RemoveAll_SearchPathW_test1(); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/WriteFile/test1/WriteFile.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/WriteFile/test1/WriteFile.cpp index 8664c9e0c..be2017c6d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/WriteFile/test1/WriteFile.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/WriteFile/test1/WriteFile.cpp @@ -75,9 +75,8 @@ PALTEST(file_io_WriteFile_test1_paltest_writefile_test1, "file_io/WriteFile/test last_error, szReadOnlyFile); } - if (!SetFileAttributesA(szReadOnlyFile, FILE_ATTRIBUTE_READONLY)) + if ((last_error = chmod(szReadOnlyFile, S_IRUSR | S_IRGRP | S_IROTH)) != 0) { - last_error = GetLastError(); Trace("WriteFile: ERROR[%ld] -> Unable to make the file read-only.\n", last_error); do_cleanup_WriteFile_test1(); Fail("WriteFile: ERROR[%ld] -> Unable to make the file read-only.\n", last_error); @@ -102,9 +101,8 @@ PALTEST(file_io_WriteFile_test1_paltest_writefile_test1, "file_io/WriteFile/test } //To delete file need to make it normal - if(!SetFileAttributesA(szReadOnlyFile,FILE_ATTRIBUTE_NORMAL)) + if ((last_error = chmod(szReadOnlyFile, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) != 0) { - last_error = GetLastError(); Fail("WriteFile: ERROR[%ld] -> Unable to make the file attribute NORMAL.\n", last_error); } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test1/test1.cpp index 1b805708e..d3551a773 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test1/test1.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test1/test1.cpp @@ -17,7 +17,7 @@ ** Functions covered by this test are: -** CopyFileA, CopyFileW, CreateFileA,CreateFileW, +** CreateFileA,CreateFileW, ** DeleteFileA and DeleteFileW. @@ -84,162 +84,6 @@ PALTEST(file_io_errorpathnotfound_test1_paltest_errorpathnotfound_test1, "file_i - /*...................Test CopyFileW.............................*/ - - - - /* test with an invalid path */ - - bRc = CopyFileW(wBadFilePath,wDest,TRUE); - - if(!bRc) - - { - - if(GetLastError()!= ERROR_PATH_NOT_FOUND) - - { - - Trace("CopyFileW: calling GetLastError() after copying a file" - - " with wrong path returned [%u] while it should return [%u]\n" - - ,GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - testPass = FALSE; - - } - - - - /* test with invalid file name */ - - bRc = CopyFileW(wBadFileName,wDest,TRUE); - - if(!bRc) - - { - - if(GetLastError()!= ERROR_FILE_NOT_FOUND) - - { - - Trace("CopyFileW: calling GetLastError() after copying a file" - - " with wrong name returned [%u] while it should return [%u]\n" - - ,GetLastError(), ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - - - } - - else - - { - - Trace("CopyFileW: managed to copy a file with wrong name\n"); - - testPass = FALSE; - - } - - - - - - - - /*..................CopyFileA...................................*/ - - - - /* test with an invalid path */ - - bRc = CopyFileA(sBadFilePath,sDest,TRUE); - - if(! bRc) - - { - - if(GetLastError()!= ERROR_PATH_NOT_FOUND) - - { - - Trace("CopyFileA: calling GetLastError() after copying a file" - - " with wrong path returned [%u] while it should return [%u]\n" - - ,GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("CopyFileA: managed to copy a file with wrong path\n"); - - testPass = FALSE; - - } - - - - /* test with an invalid file name */ - - bRc = CopyFileA(sBadFileName,sDest,TRUE); - - if(! bRc) - - { - - if(GetLastError()!= ERROR_FILE_NOT_FOUND) - - { - - Trace("CopyFileA: calling GetLastError() after copying a file" - - " with wrong name returned [%u] while it should return [%u]\n" - - ,GetLastError(), ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("CopyFileA: managed to copy a file with wrong name\n"); - - testPass = FALSE; - - } - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp deleted file mode 100644 index 927f800c1..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp +++ /dev/null @@ -1,525 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== - -** - -** Source: test2.c - -** - -** Purpose: Test the return value of GetLastError() after calling - -** some file_io functions with an invalid path. - -** - -** Functions covered by this test are: - -** FindFirstFileA, FindFirstFileW, - -** GetFileAttributesA, GetFileAttributesW, - -** -** - -** - - - -** - -**===================================================================*/ - - - -#include - - - -PALTEST(file_io_errorpathnotfound_test2_paltest_errorpathnotfound_test2, "file_io/errorpathnotfound/test2/paltest_errorpathnotfound_test2") - -{ - - - - BOOL testPass = TRUE; - - BOOL bRc = TRUE; - - HANDLE hFile; - - WIN32_FIND_DATA findFileData; - - WIN32_FIND_DATAW wFindFileData; - - DWORD fileAttrib; - - - - const char* sBadFilePath = "bad/badPath.tmp"; - - const char* sBadFileName = "badName.tmp"; - - - - const WCHAR wBadFilePath[] = - - {'w','b','a','d','/','b','a', - - 'd','.','t','m','p','\0'}; - - const WCHAR wBadFileName[] = - - {'w','B','a','d','.','t','m','p','\0'}; - - const WCHAR wDest[] = - - {'w','d','e','s','t','.','t','m','p','\0'}; - - - - - - if (0 != PAL_Initialize(argc,argv)) - - { - - return FAIL; - - } - - - - /*............. Test FindFirstFileA..................................*/ - - - - /* test with an invalid file name */ - - hFile = FindFirstFileA(sBadFileName,&findFileData ); - - - - if (hFile == INVALID_HANDLE_VALUE) - - { - - if(GetLastError() != ERROR_FILE_NOT_FOUND) - - { - - Trace("FindFirstFileA: calling GetLastError() returned [%u] " - - "while it should return [%u] for a bad File Name\n", - - GetLastError(),ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - - - } - - else - - { - - Trace("FindFirstFileA: managed to find a file with an incorrect " - - "filename\n"); - - testPass = FALSE; - - - - if(!FindClose(hFile)) - - { - - Trace("FindFirstFileA: Call to FindClose failed with ErrorCode" - - " [%u]\n", GetLastError()); - - - - } - - - - } - - - - /* test with an invalid path */ - - hFile = FindFirstFileA(sBadFilePath,&findFileData); - - - - if (hFile == INVALID_HANDLE_VALUE) - - { - - if(GetLastError() != ERROR_PATH_NOT_FOUND) - - { - - Trace("FindFirstFileA: calling GetLastError() returned [%u] " - - "while it should return [%u] for a bad file path name\n", - - GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - - - } - - else - - { - - Trace("FindFirstFileA: managed to find a file with an incorrect" - - " filename\n"); - - testPass = FALSE; - - /*this should not happen*/ - - if(!FindClose(hFile)) - - { - - Trace("FindFirstFileA: Call to FindClose Failed with ErrorCode" - - " [%u]\n", GetLastError()); - - - - } - - - - } - - - - - - - - /*............. Test FindFirstFileW..................................*/ - - - - /* test with an invalid file name */ - - hFile = FindFirstFileW(wBadFileName,&wFindFileData ); - - - - if (hFile == INVALID_HANDLE_VALUE) - - { - - if(GetLastError() != ERROR_FILE_NOT_FOUND) - - { - - Trace("FindFirstFileW: calling GetLastError() returned [%u] " - - "while it should return [%u] for a bad File Name\n", - - GetLastError(),ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - - - } - - else - - { - - Trace("FindFirstFileW: managed to find a file with an incorrect " - - "filename\n"); - - testPass = FALSE; - - - - if(!FindClose(hFile)) - - { - - Trace("FindFirstFileW: Call to FindClose failed with ErrorCode" - - " [%u]\n", GetLastError()); - - - - } - - - - } - - - - /* test with an invalid path */ - - hFile = FindFirstFileW(wBadFilePath,&wFindFileData); - - - - if (hFile == INVALID_HANDLE_VALUE) - - { - - if(GetLastError() != ERROR_PATH_NOT_FOUND) - - { - - Trace("FindFirstFileW: calling GetLastError() returned [%u] " - - "while it should return [%u] for a bad file path name\n", - - GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - - - } - - else - - { - - Trace("FindFirstFileW: managed to find a file with an incorrect " - - "filename\n"); - - testPass = FALSE; - - /*this should not happen*/ - - if(!FindClose(hFile)) - - { - - Trace("FindFirstFileW: Call to FindClose Failed with ErrorCode " - - "[%u]\n", GetLastError()); - - - - } - - - - } - - - - - - /*...................Test GetFileAttributesW.............................*/ - - - - /* test with an invalid path */ - - fileAttrib = GetFileAttributesW(wBadFilePath); - - if(fileAttrib == -1) - - { - - if(GetLastError()!= ERROR_PATH_NOT_FOUND) - - { - - Trace("GetFileAttributesW: calling GetLastError() after getting" - - " the attributes of a file with wrong path returned [%u]" - - " while it should return [%u]\n", - - GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetFileAttributesW: managed to get the attrib of a file" - - " with wrong path\n"); - - testPass = FALSE; - - } - - - - /* test with invalid file name */ - - fileAttrib = GetFileAttributesW(wBadFileName); - - if(fileAttrib == -1) - - { - - if(GetLastError()!= ERROR_FILE_NOT_FOUND) - - { - - Trace("GetFileAttributesW: calling GetLastError() after getting" - - " the attributes of a file with wrong name returned [%u] " - - "while it should return [%u]\n" - - ,GetLastError(), ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetFileAttributesW: managed to get the attrib of a file" - - " with wrong name\n"); - - testPass = FALSE; - - } - - - - /*...................Test GetFileAttributesA.............................*/ - - - - /* test with an invalid path */ - - fileAttrib = GetFileAttributesA(sBadFilePath); - - if(fileAttrib == -1) - - { - - if(GetLastError()!= ERROR_PATH_NOT_FOUND) - - { - - Trace("GetFileAttributesA: calling GetLastError() after getting" - - " the attributes of a file with wrong path returned [%u] while" - - " it should return [%u]\n", - - GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetFileAttributesA: managed to get the attrib of a file" - - " with wrong path\n"); - - testPass = FALSE; - - } - - - - /* test with invalid file name */ - - fileAttrib = GetFileAttributesA(sBadFileName); - - if(fileAttrib == -1) - - { - - if(GetLastError()!= ERROR_FILE_NOT_FOUND) - - { - - Trace("GetFileAttributesA: calling GetLastError() after getting " - - "the attributes of a file with wrong name returned [%u] " - - "while it should return [%u]\n" - - ,GetLastError(), ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - - - } - - else - - { - - Trace("GetFileAttributesA: managed to get the attrib of a file with" - - " wrong name\n"); - - testPass = FALSE; - - } - - - if(! testPass) - - { - - Fail(""); - - } - - PAL_Terminate(); - - return PASS; - -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/filemapping_memmgt/MapViewOfFile/test1/MapViewOfFile.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/filemapping_memmgt/MapViewOfFile/test1/MapViewOfFile.cpp index 9790197db..f6b5989ee 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/filemapping_memmgt/MapViewOfFile/test1/MapViewOfFile.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/filemapping_memmgt/MapViewOfFile/test1/MapViewOfFile.cpp @@ -19,11 +19,14 @@ // it is not possible to create file with FILE_FLAG_NO_BUFFERING. // So we explicitly use the /var/tmp that cannot be on tmpfs, since it it persistent over reboots. -#ifndef __ANDROID__ -#define TEMP_DIRECTORY_PATH "/var/tmp/" -#else +#ifdef __ANDROID__ // On Android, "/var/tmp/" doesn't exist; temporary files should go to /data/local/tmp/ #define TEMP_DIRECTORY_PATH "/data/local/tmp/" +#elif defined(__HAIKU__) +// "/var/tmp/" also doesn't exist on Haiku. +#define TEMP_DIRECTORY_PATH "/boot/system/cache/" +#else +#define TEMP_DIRECTORY_PATH "/var/tmp/" #endif PALTEST(filemapping_memmgt_MapViewOfFile_test1_paltest_mapviewoffile_test1, "filemapping_memmgt/MapViewOfFile/test1/paltest_mapviewoffile_test1") @@ -32,7 +35,7 @@ PALTEST(filemapping_memmgt_MapViewOfFile_test1_paltest_mapviewoffile_test1, "fil HANDLE hFile = INVALID_HANDLE_VALUE; LPSTR buf = NULL; CHAR ch[MAPPINGSIZE]; - CHAR lpFilePath[MAX_PATH]; + CHAR* lpFilePath = TEMP_DIRECTORY_PATH"tst"; DWORD dwBytesWritten = 0; DWORD dwInitialSize = 0; DWORD dwFinalSize = 0; @@ -48,8 +51,6 @@ PALTEST(filemapping_memmgt_MapViewOfFile_test1_paltest_mapviewoffile_test1, "fil return FAIL; } - GetTempFileName(TEMP_DIRECTORY_PATH, "tst", 0, lpFilePath); - /* Create a file handle with CreateFile. */ hFile = CreateFile( lpFilePath, diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/issues.targets b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/issues.targets index 67b5df72e..a4381220b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/issues.targets +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/issues.targets @@ -18,10 +18,4 @@ - - - https://github.com/dotnet/runtime/issues/7639 - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/locale_info/GetACP/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/locale_info/GetACP/test1/test1.cpp deleted file mode 100644 index 0f315f2ff..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/locale_info/GetACP/test1/test1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests that GetACP returns the expected default code page. -** -** -**==========================================================================*/ - - -#include - -/* - * NOTE: We only support code page 65001 (UTF-8). - */ - -#define EXPECTED_CP 65001 - -PALTEST(locale_info_GetACP_test1_paltest_getacp_test1, "locale_info/GetACP/test1/paltest_getacp_test1") -{ - int ret; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - ret = GetACP(); - if (ret != EXPECTED_CP) - { - Fail("ERROR: got incorrect result for current ANSI code page!\n" - "Expected %d, got %d\n", EXPECTED_CP, ret); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-inspect.dat b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-inspect.dat index 22f9ebc1f..fc01f1d05 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-inspect.dat +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-inspect.dat @@ -1,11 +1,6 @@ # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. -# Automatable to detect gross errors; also manually inspect for proper behaviour -miscellaneous/messageboxw/test1,1 -# Automatable to detect gross errors; also manually inspect for proper behaviour -# Env var PAL_DISABLE_MESSAGEBOX=1 disables msg boxes for automation on Windows -miscellaneous/messageboxw/test2,1 # Automatable to detect gross errors; also manually inspect for proper behaviour pal_specific/pal_get_stderr/test1,1 pal_specific/pal_get_stdout/test1,1 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-unautomatable.dat b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-unautomatable.dat index 78e1831fb..24575263b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-unautomatable.dat +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/manual-unautomatable.dat @@ -13,9 +13,6 @@ debug_api/outputdebugstringa/test1,1 pal_specific/pal_get_stdin/test1,1 threading/setconsolectrlhandler/test1,1 threading/setconsolectrlhandler/test4,1 -# These tests take several minutes to run and time out when run with the harness -file_io/gettempfilenamea/test2,1 -file_io/gettempfilenamew/test2,1 # getstdhandle fails under Windows if the output is redirected so # it must be run from the command line file_io/getstdhandle/test1,1 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp deleted file mode 100644 index 8b1ee94ba..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: test.c -** -** Purpose: Test for CGroup -** -** -** Steps to run this test on ubuntu: -** 1. sudo apt-get install cgroup-bin -** 2. sudo vi /etc/default/grub -** Add cgroup_enable=memory swapaccount=1 to GRUB_CMDLINE_LINUX_DEFAULT -** 3. sudo update-grub -** 4. reboot -** 5. sudo cgcreate -g cpu,memory:/myGroup -a : -t : -** 6. echo 4M > /sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes -** 7. echo 4M > /sys/fs/cgroup/memory/mygroup/memory.memsw.limit_in_bytes -** 8. cgexe -g memory:/mygroup --sticky -**=========================================================*/ - -#include - -PALTEST(miscellaneous_CGroup_test1_paltest_cgroup_test1, "miscellaneous/CGroup/test1/paltest_cgroup_test1") -{ - - /* - * Initialize the PAL and return FAILURE if this fails - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - size_t mem_limit = PAL_GetRestrictedPhysicalMemoryLimit(); - - FILE* file = fopen("/sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes", "r"); - if(file != NULL) - { - if(mem_limit != 4194304) - Fail("Memory limit obtained from PAL_GetRestrictedPhysicalMemory is not 4MB\n"); - fclose(file); - } - - PAL_Terminate(); - return PASS; -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/GetTickCount/test1/test.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/GetTickCount/test1/test.cpp deleted file mode 100644 index f783ff878..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/GetTickCount/test1/test.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: -** -** Source : test1.c -** -** Purpose: Test for GetTickCount() function -** -** -**=========================================================*/ - -#include - -PALTEST(miscellaneous_GetTickCount_test1_paltest_gettickcount_test1, "miscellaneous/GetTickCount/test1/paltest_gettickcount_test1") -{ - - DWORD FirstCount = 0; - DWORD SecondCount = 0; - - /* - * Initialize the PAL and return FAILURE if this fails - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Grab a FirstCount, then loop for a bit to make the clock increase */ - FirstCount = GetTickCount(); - - /* Make sure some time passes */ - Sleep(60); //Since the get tick count is accurate within 55 milliseconds. - - /* Get a second count */ - SecondCount = GetTickCount(); - - /* Make sure the second one is bigger than the first. - This isn't the best test, but it at least shows that it's returning a - DWORD which is increasing. - */ - - if(FirstCount >= SecondCount) - { - Fail("ERROR: The first time (%d) was greater/equal than the second time " - " (%d). The tick count should have increased.\n", - FirstCount,SecondCount); - } - - PAL_Terminate(); - return PASS; -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/test.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/test.cpp deleted file mode 100644 index 49e01ffdb..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source : test.c -** -** Purpose: Test for GlobalMemoryStatusEx() function -** -** -**=========================================================*/ - -#include - -PALTEST(miscellaneous_GlobalMemoryStatusEx_test1_paltest_globalmemorystatusex_test1, "miscellaneous/GlobalMemoryStatusEx/test1/paltest_globalmemorystatusex_test1") -{ - - MEMORYSTATUSEX memoryStatus; - - /* - * Initialize the PAL and return FAILURE if this fails - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - if (!GlobalMemoryStatusEx(&memoryStatus)) - { - Fail("ERROR: GlobalMemoryStatusEx failed."); - } - - printf("GlobalMemoryStatusEx:\n"); - printf(" ullTotalPhys: %" PRIu64 "\n", memoryStatus.ullTotalPhys); - printf(" ullAvailPhys: %" PRIu64 "\n", memoryStatus.ullAvailPhys); - printf(" ullTotalVirtual: %" PRIu64 "\n", memoryStatus.ullTotalVirtual); - printf(" ullAvailVirtual: %" PRIu64 "\n", memoryStatus.ullAvailVirtual); - printf(" ullTotalPageFile: %" PRIu64 "\n", memoryStatus.ullTotalPageFile); - printf(" ullAvailPageFile: %" PRIu64 "\n", memoryStatus.ullAvailPageFile); - printf(" ullAvailExtendedVirtual: %" PRIu64 "\n", memoryStatus.ullAvailExtendedVirtual); - printf(" dwMemoryLoad: %u\n", memoryStatus.dwMemoryLoad); - - if (memoryStatus.ullTotalPhys == 0 || - memoryStatus.ullAvailPhys == 0 || - memoryStatus.ullTotalVirtual == 0 || - memoryStatus.ullAvailVirtual == 0 - ) - { - Fail("ERROR: GlobalMemoryStatusEx succeeded, but returned zero physical of virtual memory sizes."); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/_i64tow/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/_i64tow/test1/test1.cpp deleted file mode 100644 index 2a44813cd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/_i64tow/test1/test1.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: test1.c -** -** Purpose: Tests _i64tow_s with normal values and different radices, negative -** values, as well as the highest and lowest values. -** -** -**============================================================*/ - -#include - -typedef struct -{ - INT64 value; - int radix; - char *result; -} testCase; - - -PALTEST(miscellaneous__i64tow_test1_paltest_i64tow_test1, "miscellaneous/_i64tow/test1/paltest_i64tow_test1") -{ - WCHAR buffer[256]; - WCHAR *testStr; - WCHAR *ret; - int i; - testCase testCases[] = - { - {42, 10, "42"}, - {42, 2, "101010"}, - {29, 32, "t"}, - {-1, 10, "-1"}, - {-1, 8, "1777777777777777777777"}, - {-1, 32, "fvvvvvvvvvvvv"}, - {I64(0x7FFFFFFFFFFFFFFF), 10, "9223372036854775807"}, - {I64(0x8000000000000000), 10, "-9223372036854775808"}, - {0,2,"0"}, - {0,16,"0"}, - {3,16,"3"}, - {15,16,"f"}, - {16,16,"10"}, - - }; - - - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - for (i=0; i - - -PALTEST(miscellaneous_queryperformancecounter_test1_paltest_queryperformancecounter_test1, "miscellaneous/queryperformancecounter/test1/paltest_queryperformancecounter_test1") -{ - /* Milliseconds of error which are acceptable Function execution time, etc. - FreeBSD has a "standard" resolution of 50ms for waiting operations, so we - must take that into account as well */ - DWORD AcceptableTimeError = 15; - - int i; - int NumIterations = 100; - DWORD AvgTimeDiff; - DWORD TimeDiff[100]; - DWORD TotalTimeDiff = 0; - DWORD SleepInterval = 50; - LARGE_INTEGER StartTime; - LARGE_INTEGER EndTime; - LARGE_INTEGER Freq; - - /* Initialize the PAL. - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Get the frequency of the High-Performance Counter, - * in order to convert counter time to milliseconds. - */ - if (!QueryPerformanceFrequency(&Freq)) - { - Fail("ERROR:%u:Unable to retrieve the frequency of the " - "high-resolution performance counter.\n", - GetLastError()); - } - - /* Perform this set of sleep timings a number of times. - */ - for(i=0; i < NumIterations; i++) - { - - /* Get the current counter value. - */ - if (!QueryPerformanceCounter(&StartTime)) - { - Fail("ERROR:%u:Unable to retrieve the current value of the " - "high-resolution performance counter.\n", - GetLastError()); - } - - /* Sleep a predetermined interval. - */ - Sleep(SleepInterval); - - /* Get the new current counter value. - */ - if (!QueryPerformanceCounter(&EndTime)) - { - Fail("ERROR:%u:Unable to retrieve the current value of the " - "high-resolution performance counter.\n", - GetLastError()); - } - - /* Determine elapsed time, in milliseconds. Compare the elapsed time - * with the sleep interval, and add to counter. - */ - TimeDiff[i] = (DWORD)(((EndTime.QuadPart - StartTime.QuadPart)*1000)/ - (Freq.QuadPart)); - TotalTimeDiff += TimeDiff[i] - SleepInterval; - - } - - /* Verify that the average of the difference between the performance - * counter and the sleep interval is within our acceptable range. - */ - AvgTimeDiff = TotalTimeDiff / NumIterations; - if (AvgTimeDiff > AcceptableTimeError) - { - Fail("ERROR: average diff %u acceptable %u.\n", - AvgTimeDiff, - AcceptableTimeError); - } - - /* Terminate the PAL. - */ - PAL_Terminate(); - return PASS; -} - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/queryperformancefrequency/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/queryperformancefrequency/test1/test1.cpp deleted file mode 100644 index 3e370ddaf..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/miscellaneous/queryperformancefrequency/test1/test1.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: test1.c -** -** Purpose: Test for QueryPerformanceFrequency function -** -** -**=========================================================*/ - -#include - -PALTEST(miscellaneous_queryperformancefrequency_test1_paltest_queryperformancefrequency_test1, "miscellaneous/queryperformancefrequency/test1/paltest_queryperformancefrequency_test1") -{ - - LARGE_INTEGER Freq; - - /* Initialize the PAL. - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Check the return value of the performance - * frequency, a value of zero indicates that - * either the call has failed or the - * high-resolution performance counter is not - * installed. - */ - if (!QueryPerformanceFrequency(&Freq)) - { - - Fail("ERROR:%u:Unable to retrieve the frequency of the " - "high-resolution performance counter.\n", - GetLastError()); - } - - - /* Check the return value the frequency the - * value should be non-zero. - */ - if (Freq.QuadPart == 0) - { - - Fail("ERROR: The frequency has been determined to be 0 " - "the frequency should be non-zero.\n"); - - } - - /* Terminate the PAL. - */ - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.cpp deleted file mode 100644 index b09d3f626..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: pal_getusertempdirectoryw.c -** -** Purpose: Positive test the PAL_GetUserTempDirectoryW API. -** Call PAL_GetUserTempDirectoryW to retrieve the user -** temp directory. -** -** -**============================================================*/ -#define UNICODE -#include - -#define DIRECTORYLENGTH 1024 - -PALTEST(pal_specific_PAL_GetUserTempDirectoryW_test1_paltest_pal_getusertempdirectoryw_test1, "pal_specific/PAL_GetUserTempDirectoryW/test1/paltest_pal_getusertempdirectoryw_test1") -{ - int err; - DWORD dwFileAttribute; - DWORD cch = DIRECTORYLENGTH; - WCHAR wDirectoryName[DIRECTORYLENGTH]; - - //Initialize the PAL environment - err = PAL_Initialize(argc, argv); - if(0 != err) - { - ExitProcess(FAIL); - } - - //retrieve the user temp directory - err = PAL_GetUserTempDirectory(ddtInstallationDependentDirectory, wDirectoryName, &cch); - - if(0 == err || 0 == strlen(convertC(wDirectoryName))) - { - Fail("Failed to call PAL_GetUserTempDirectoryW API!\n"); - } - - - //retrieve the attributes of a file or directory - dwFileAttribute = GetFileAttributesW(wDirectoryName); - - - //check if the retrieved attribute indicates a directory - if( FILE_ATTRIBUTE_DIRECTORY != (FILE_ATTRIBUTE_DIRECTORY & dwFileAttribute)) - { - Fail("PAL_GetUserTempDirectoryW API returned a non-directory name!\n"); - } - - printf ("PAL_GetUserTempDirectoryW returns %S\n", wDirectoryName); - - PAL_Terminate(); - return PASS; - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_errno/test1/PAL_errno.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_errno/test1/PAL_errno.cpp deleted file mode 100644 index 29f2da53b..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_errno/test1/PAL_errno.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: pal_errno.c -** -** Purpose: Positive test the PAL_errno API. -** call PAL_errno to retrieve the pointer to -** the per-thread errno value. -** -** -**============================================================*/ -#include - -PALTEST(pal_specific_PAL_errno_test1_paltest_pal_errno_test1, "pal_specific/PAL_errno/test1/paltest_pal_errno_test1") -{ - int err; - FILE *pFile = NULL; - - /*Initialize the PAL environment*/ - err = PAL_Initialize(argc, argv); - if( 0 != err) - { - return FAIL; - } - - /*Try to open a not-exist file to read to generate an error*/ - pFile = fopen( "no_exist_file_name", "r" ); - - if( NULL != pFile ) - { - Trace("\nFailed to call fopen to open a not exist for reading, " - "an error is expected, but no error occurred\n"); - - if( EOF == fclose( pFile ) ) - { - Trace("\nFailed to call fclose to close a file stream\n"); - } - Fail( "Test failed! fopen() Should not have worked!" ); - } - - /*retrieve the per-thread error value pointer*/ - if( 2 != errno ) - { - Fail("\nFailed to call PAL_errno API, this value is not correct." - " The correct value is ENOENT[2] ( No such file or directory.).\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/PAL_get_stderr.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/PAL_get_stderr.cpp deleted file mode 100644 index 237750515..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/PAL_get_stderr.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: pal_get_stderr.c -** -** Purpose: Positive test the PAL_get_stderr API. -** Call PAL_get_stderr to retrieve the PAL standard error -** output stream pointer. -** This test case should be run manually and automatically. -** - -** -**============================================================*/ -#include - -PALTEST(pal_specific_PAL_get_stderr_test1_paltest_pal_get_stderr_test1, "pal_specific/PAL_get_stderr/test1/paltest_pal_get_stderr_test1") -{ - int err; - FILE *pPAL_stderr = NULL; - const char *pMsg = "\nThis is a PAL_get_stderr test message, " - "not an error message!\n"; - - /*Initialize the PAL environment*/ - err = PAL_Initialize(argc, argv); - if(0 != err) - { - return FAIL; - } - - /*retrieve the PAL standard error output stream pointer*/ - pPAL_stderr = PAL_get_stderr(); - - if(NULL == pPAL_stderr) - { - Fail("\nFailed to call PAL_get_stderr API, error code = %u\n", - GetLastError()); - } - - /*output a test message through PAL standard error stream*/ - err = fputs(pMsg, pPAL_stderr); - if(EOF == err) - { - Fail("\nFailed to call fputs to output message to PAL stdandard " - "error stream, error code=%u\n", GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/PAL_get_stdin.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/PAL_get_stdin.cpp deleted file mode 100644 index 91d8a3a9a..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/PAL_get_stdin.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: pal_get_stdin.c -** -** Purpose: Positive test the PAL_get_stdout API. -** Call PAL_get_stdin to retrieve the PAL standard input -** stream pointer. -** This test case should be run manually. -** - -** -**============================================================*/ -#include - -PALTEST(pal_specific_PAL_get_stdin_test1_paltest_pal_get_stdin_test1, "pal_specific/PAL_get_stdin/test1/paltest_pal_get_stdin_test1") -{ - int err; - FILE *pPAL_stdin = NULL; - char Buffer[256]; - - /*Initialize the PAL environment*/ - err = PAL_Initialize(argc, argv); - if(0 != err) - { - return FAIL; - } - - /*retrieve the PAL standard input stream pointer*/ - pPAL_stdin = PAL_get_stdin(); - if(NULL == pPAL_stdin) - { - Fail("\nFailed to call PAL_get_stdin API to retrieve the " - "PAL standard input stream pointer, " - "error code = %u\n", GetLastError()); - } - - /*zero the buffer*/ - memset(Buffer, 0, 256); - - printf("\nPlease input some words: (less than 255 characters)\n"); - - /*further test the input stream*/ - /*read message from the PAL standard input stream*/ - if(NULL == fgets(Buffer, 255, pPAL_stdin)) - { - Fail( "Failed to call fgets to get a string from PAL standard " - "input stream, error code=%u\n", GetLastError()); - } - else - { - if(1 == strlen(Buffer) && Buffer[0] == '\n') - { - printf("\nEmpty input!\n"); - } - else - { - printf("\nYour input words are:\n%s\n", Buffer); - } - } - - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.cpp deleted file mode 100644 index d891e9ac4..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================= -** -** Source: pal_get_stdout.c -** -** Purpose: Positive test the PAL_get_stdout API. -** Call PAL_get_stdout to retrieve the PAL standard output -** stream pointer. -** This test case should be run manually and automatically. -** - -** -**============================================================*/ -#include - -PALTEST(pal_specific_PAL_get_stdout_test1_paltest_pal_get_stdout_test1, "pal_specific/PAL_get_stdout/test1/paltest_pal_get_stdout_test1") -{ - int err; - FILE *pPAL_stdout = NULL; - const char *pMsg = "\nThis is a PAL_get_stdout test output message, " - "not an error message!\n"; - - /*Initialize the PAL environment*/ - err = PAL_Initialize(argc, argv); - if(0 != err) - { - return FAIL; - } - - /*retrieve the PAL output stream pointer*/ - pPAL_stdout = PAL_get_stdout(); - if(NULL == pPAL_stdout) - { - Fail("\nFailed to call PAL_get_stdout API to retrieve the " - "standard PAL output stream pointer, error code=%u\n", - GetLastError()); - } - - /*output a test message through PAL standard output stream*/ - err = fputs(pMsg, pPAL_stdout); - if(EOF == err) - { - Fail("\nFailed to call fputs to output message to PAL stdandard " - "output stream, error code=%u\n", GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist.txt index b5125fa62..b55a93735 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist.txt @@ -152,26 +152,8 @@ filemapping_memmgt/VirtualProtect/test4/paltest_virtualprotect_test4 filemapping_memmgt/VirtualProtect/test6/paltest_virtualprotect_test6 filemapping_memmgt/VirtualProtect/test7/paltest_virtualprotect_test7 filemapping_memmgt/VirtualQuery/test1/paltest_virtualquery_test1 -file_io/CopyFileA/test1/paltest_copyfilea_test1 -file_io/CopyFileA/test2/paltest_copyfilea_test2 -file_io/CopyFileA/test3/paltest_copyfilea_test3 -file_io/CopyFileA/test4/paltest_copyfilea_test4 -file_io/CopyFileW/test2/paltest_copyfilew_test2 -file_io/CopyFileW/test3/paltest_copyfilew_test3 -file_io/errorpathnotfound/test2/paltest_errorpathnotfound_test2 file_io/FILECanonicalizePath/paltest_filecanonicalizepath_test1 -file_io/FindClose/test1/paltest_findclose_test1 -file_io/FindFirstFileA/test1/paltest_findfirstfilea_test1 -file_io/FindFirstFileW/test1/paltest_findfirstfilew_test1 -file_io/FindNextFileA/test1/paltest_findnextfilea_test1 -file_io/FindNextFileA/test2/paltest_findnextfilea_test2 -file_io/FindNextFileW/test1/paltest_findnextfilew_test1 -file_io/FindNextFileW/test2/paltest_findnextfilew_test2 file_io/FlushFileBuffers/test1/paltest_flushfilebuffers_test1 -file_io/GetConsoleOutputCP/test1/paltest_getconsoleoutputcp_test1 -file_io/GetFileAttributesA/test1/paltest_getfileattributesa_test1 -file_io/GetFileAttributesExW/test2/paltest_getfileattributesexw_test2 -file_io/GetFileAttributesW/test1/paltest_getfileattributesw_test1 file_io/GetFileSize/test1/paltest_getfilesize_test1 file_io/GetFileSizeEx/test1/paltest_getfilesizeex_test1 file_io/GetFullPathNameA/test1/paltest_getfullpathnamea_test1 @@ -183,10 +165,6 @@ file_io/GetFullPathNameW/test4/paltest_getfullpathnamew_test4 file_io/GetStdHandle/test2/paltest_getstdhandle_test2 file_io/GetSystemTime/test1/paltest_getsystemtime_test1 file_io/GetSystemTimeAsFileTime/test1/paltest_getsystemtimeasfiletime_test1 -file_io/GetTempFileNameA/test1/paltest_gettempfilenamea_test1 -file_io/GetTempFileNameA/test2/paltest_gettempfilenamea_test2 -file_io/GetTempFileNameA/test3/paltest_gettempfilenamea_test3 -file_io/GetTempFileNameW/test3/paltest_gettempfilenamew_test3 file_io/gettemppatha/test1/paltest_gettemppatha_test1 file_io/GetTempPathW/test1/paltest_gettemppathw_test1 file_io/ReadFile/test2/paltest_readfile_test2 @@ -210,7 +188,6 @@ loader/LoadLibraryA/test5/paltest_loadlibrarya_test5 loader/LoadLibraryW/test2/paltest_loadlibraryw_test2 loader/LoadLibraryW/test3/paltest_loadlibraryw_test3 loader/LoadLibraryW/test5/paltest_loadlibraryw_test5 -locale_info/GetACP/test1/paltest_getacp_test1 locale_info/MultiByteToWideChar/test1/paltest_multibytetowidechar_test1 locale_info/MultiByteToWideChar/test2/paltest_multibytetowidechar_test2 locale_info/MultiByteToWideChar/test3/paltest_multibytetowidechar_test3 @@ -243,7 +220,6 @@ miscellaneous/GetEnvironmentVariableW/test5/paltest_getenvironmentvariablew_test miscellaneous/GetEnvironmentVariableW/test6/paltest_getenvironmentvariablew_test6 miscellaneous/GetLastError/test1/paltest_getlasterror_test1 miscellaneous/GetSystemInfo/test1/paltest_getsysteminfo_test1 -miscellaneous/GetTickCount/test1/paltest_gettickcount_test1 miscellaneous/InterlockedCompareExchange/test1/paltest_interlockedcompareexchange_test1 miscellaneous/InterlockedCompareExchange/test2/paltest_interlockedcompareexchange_test2 miscellaneous/InterlockedCompareExchange64/test1/paltest_interlockedcompareexchange64_test1 @@ -260,8 +236,6 @@ miscellaneous/InterlockedIncrement/test1/paltest_interlockedincrement_test1 miscellaneous/InterlockedIncrement/test2/paltest_interlockedincrement_test2 miscellaneous/InterlockedIncrement64/test1/paltest_interlockedincrement64_test1 miscellaneous/InterlockedIncrement64/test2/paltest_interlockedincrement64_test2 -miscellaneous/queryperformancecounter/test1/paltest_queryperformancecounter_test1 -miscellaneous/queryperformancefrequency/test1/paltest_queryperformancefrequency_test1 miscellaneous/SetEnvironmentVariableA/test1/paltest_setenvironmentvariablea_test1 miscellaneous/SetEnvironmentVariableA/test2/paltest_setenvironmentvariablea_test2 miscellaneous/SetEnvironmentVariableA/test3/paltest_setenvironmentvariablea_test3 @@ -283,11 +257,6 @@ threading/CreateSemaphoreW_ReleaseSemaphore/test1/paltest_createsemaphorew_relea threading/CreateSemaphoreW_ReleaseSemaphore/test2/paltest_createsemaphorew_releasesemaphore_test2 threading/CreateThread/test1/paltest_createthread_test1 threading/CreateThread/test3/paltest_createthread_test3 -threading/CriticalSectionFunctions/test1/paltest_criticalsectionfunctions_test1 -threading/CriticalSectionFunctions/test2/paltest_criticalsectionfunctions_test2 -threading/CriticalSectionFunctions/test4/paltest_criticalsectionfunctions_test4 -threading/CriticalSectionFunctions/test7/paltest_criticalsectionfunctions_test7 -threading/CriticalSectionFunctions/test8/paltest_criticalsectionfunctions_test8 threading/DuplicateHandle/test10/paltest_duplicatehandle_test10 threading/DuplicateHandle/test2/paltest_duplicatehandle_test2 threading/DuplicateHandle/test4/paltest_duplicatehandle_test4 @@ -334,4 +303,3 @@ threading/WaitForSingleObject/WFSOMutexTest/paltest_waitforsingleobject_wfsomute threading/WaitForSingleObject/WFSOSemaphoreTest/paltest_waitforsingleobject_wfsosemaphoretest threading/WaitForSingleObject/WFSOThreadTest/paltest_waitforsingleobject_wfsothreadtest threading/YieldProcessor/test1/paltest_yieldprocessor_test1 -eventprovider/eventprovidertest diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index a8e4cd0e7..d861a469b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -1,16 +1,7 @@ This is a list of failing PAL tests that need to be reviewed because. They should either be fixed or deleted if they are no longer applicable. -c_runtime/ferror/test1/paltest_ferror_test1 -c_runtime/ferror/test2/paltest_ferror_test2 -c_runtime/fputs/test2/paltest_fputs_test2 -c_runtime/fread/test1/paltest_fread_test1 -c_runtime/fread/test2/paltest_fread_test2 -c_runtime/fread/test3/paltest_fread_test3 -c_runtime/ftell/test1/paltest_ftell_test1 c_runtime/iswprint/test1/paltest_iswprint_test1 -c_runtime/vprintf/test1/paltest_vprintf_test1 -c_runtime/_getw/test1/paltest_getw_test1 debug_api/DebugBreak/test1/paltest_debugbreak_test1 debug_api/OutputDebugStringA/test1/paltest_outputdebugstringa_test1 debug_api/WriteProcessMemory/test1/paltest_writeprocessmemory_test1 @@ -30,8 +21,6 @@ exception_handling/PAL_EXCEPT_FILTER_EX/test1/paltest_pal_except_filter_ex_test1 exception_handling/PAL_EXCEPT_FILTER_EX/test2/paltest_pal_except_filter_ex_test2 exception_handling/PAL_EXCEPT_FILTER_EX/test3/paltest_pal_except_filter_ex_test3 exception_handling/pal_finally/test1/paltest_pal_finally_test1 -exception_handling/PAL_GetBottommostRegistration/test1/paltest_pal_getbottommostregistration_test1 -exception_handling/PAL_GetBottommostRegistration/test2/paltest_pal_getbottommostregistration_test2 exception_handling/PAL_TRY_EXCEPT/test1/paltest_pal_try_except_test1 exception_handling/PAL_TRY_EXCEPT/test2/paltest_pal_try_except_test2 exception_handling/PAL_TRY_EXCEPT_EX/test1/paltest_pal_try_except_ex_test1 @@ -48,19 +37,12 @@ filemapping_memmgt/GetModuleFileNameA/test1/paltest_getmodulefilenamea_test1 filemapping_memmgt/GetModuleFileNameW/test1/paltest_getmodulefilenamew_test1 filemapping_memmgt/GetProcAddress/test1/paltest_getprocaddress_test1 filemapping_memmgt/GetProcAddress/test2/paltest_getprocaddress_test2 -filemapping_memmgt/ReadProcessMemory/ReadProcessMemory_neg1/paltest_readprocessmemory_readprocessmemory_neg1 -filemapping_memmgt/ReadProcessMemory/test1/paltest_readprocessmemory_test1 -filemapping_memmgt/ReadProcessMemory/test2/paltest_readprocessmemory_test2 -file_io/CopyFileW/test1/paltest_copyfilew_test1 file_io/CreateFileA/test1/paltest_createfilea_test1 file_io/CreateFileW/test1/paltest_createfilew_test1 file_io/errorpathnotfound/test1/paltest_errorpathnotfound_test1 -file_io/GetFileAttributesExW/test1/paltest_getfileattributesexw_test1 file_io/GetFullPathNameA/test2/paltest_getfullpathnamea_test2 file_io/GetFullPathNameW/test2/paltest_getfullpathnamew_test2 file_io/GetStdHandle/test1/paltest_getstdhandle_test1 -file_io/GetTempFileNameW/test1/paltest_gettempfilenamew_test1 -file_io/GetTempFileNameW/test2/paltest_gettempfilenamew_test2 file_io/gettemppatha/test1/paltest_gettemppatha_test1 file_io/GetTempPathW/test1/paltest_gettemppathw_test1 file_io/ReadFile/test1/paltest_readfile_test1 @@ -74,8 +56,6 @@ locale_info/CompareStringA/test1/paltest_comparestringa_test1 locale_info/CompareStringW/test1/paltest_comparestringw_test1 locale_info/GetLocaleInfoW/test1/paltest_getlocaleinfow_test1 locale_info/GetLocaleInfoW/test2/paltest_getlocaleinfow_test2 -locale_info/GetStringTypeExW/test1/paltest_getstringtypeexw_test1 -locale_info/GetStringTypeExW/test2/paltest_getstringtypeexw_test2 locale_info/WideCharToMultiByte/test4/paltest_widechartomultibyte_test4 miscellaneous/FormatMessageW/test4/paltest_formatmessagew_test4 miscellaneous/FormatMessageW/test5/paltest_formatmessagew_test5 @@ -86,11 +66,6 @@ miscellaneous/IsBadReadPtr/test1/paltest_isbadreadptr_test1 miscellaneous/IsBadWritePtr/test1/paltest_isbadwriteptr_test1 miscellaneous/IsBadWritePtr/test2/paltest_isbadwriteptr_test2 miscellaneous/IsBadWritePtr/test3/paltest_isbadwriteptr_test3 -miscellaneous/wsprintfW/test2/paltest_wsprintfw_test2 -miscellaneous/wsprintfW/test7/paltest_wsprintfw_test7 -pal_specific/PAL_GetUserTempDirectoryW/test1/paltest_pal_getusertempdirectoryw_test1 -pal_specific/PAL_get_stderr/test1/paltest_pal_get_stderr_test1 -pal_specific/PAL_get_stdin/test1/paltest_pal_get_stdin_test1 pal_specific/PAL_get_stdout/test1/paltest_pal_get_stdout_test1 pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/paltest_pal_registerlibraryw_unregisterlibraryw_test1 samples/test2/paltest_samples_test2 @@ -98,8 +73,6 @@ threading/CreateEventW/test3/paltest_createeventw_test3 threading/CreateMutexW_ReleaseMutex/test2/paltest_createmutexw_releasemutex_test2 threading/CreateSemaphoreW_ReleaseSemaphore/test3/paltest_createsemaphorew_releasesemaphore_test3 threading/CreateThread/test2/paltest_createthread_test2 -threading/CriticalSectionFunctions/test5/paltest_criticalsectionfunctions_test5 -threading/CriticalSectionFunctions/test6/paltest_criticalsectionfunctions_test6 threading/DuplicateHandle/test1/paltest_duplicatehandle_test1 threading/DuplicateHandle/test11/paltest_duplicatehandle_test11 threading/DuplicateHandle/test12/paltest_duplicatehandle_test12 @@ -116,14 +89,10 @@ threading/OpenEventW/test4/paltest_openeventw_test4 threading/OpenEventW/test5/paltest_openeventw_test5 threading/OpenProcess/test1/paltest_openprocess_test1 threading/QueueUserAPC/test1/paltest_queueuserapc_test1 -threading/setthreadcontext/test1/paltest_setthreadcontext_test1 threading/Sleep/test1/paltest_sleep_test1 threading/SleepEx/test1/paltest_sleepex_test1 threading/SleepEx/test2/paltest_sleepex_test2 -threading/SuspendThread/test2/paltest_suspendthread_test2 -threading/SuspendThread/test3/paltest_suspendthread_test3 threading/TerminateProcess/test1/paltest_terminateprocess_test1 -threading/TLS/test6_optimizedtls/paltest_tls_test6_optimizedtls threading/WaitForMultipleObjectsEx/test5/paltest_waitformultipleobjectsex_test5 threading/WaitForMultipleObjectsEx/test6/paltest_waitformultipleobjectsex_test6 threading/WaitForSingleObject/WFSOProcessTest/paltest_waitforsingleobject_wfsoprocesstest diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltests.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltests.cpp index 4ec0a3982..07e8ff6ec 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltests.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/paltests.cpp @@ -54,7 +54,7 @@ int __cdecl main(int argc, char *argv[]) { return PrintTests(argc, argv); } - + PALTest *testCur = PALTest::s_tests; for (;testCur != 0; testCur = testCur->_next) { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/runpaltests.sh b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/runpaltests.sh old mode 100644 new mode 100755 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/childProcess.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/childProcess.cpp index dc059cf7e..dd0e35f53 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/childProcess.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/childProcess.cpp @@ -5,7 +5,7 @@ ** ** Source: CreateProcessW/test1/childprocess.c ** -** Purpose: Test to ensure CreateProcessW starts a new process. This test +** Purpose: Test to ensure CreateProcessW starts a new process. This test ** launches a child process, and examines a file written by the child. ** This code is the child code. ** @@ -17,7 +17,7 @@ ** fopen ** fclose ** fprintf -** +** ** **=========================================================*/ @@ -25,7 +25,7 @@ #define UNICODE #include -const WCHAR szCommonFileW[] = +const WCHAR szCommonFileW[] = {'c','h','i','l','d','d','a','t','a','.','t','m','p','\0'}; @@ -39,19 +39,19 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1_child, "thre DWORD dwFileLength; DWORD dwDirLength; DWORD dwSize; - + char *szAbsPathNameA; WCHAR szDirNameW[_MAX_DIR]; - WCHAR szAbsPathNameW[_MAX_PATH]; + WCHAR szAbsPathNameW[MAX_PATH]; if(0 != (PAL_Initialize(argc, argv))) { return ( FAIL ); } - dwDirLength = GetTempPath(_MAX_PATH, szDirNameW); + dwDirLength = GetTempPath(MAX_PATH, szDirNameW); - if (0 == dwDirLength) + if (0 == dwDirLength) { Fail ("GetTempPath call failed. Could not get " "temp directory\n. Exiting.\n"); @@ -59,7 +59,7 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1_child, "thre dwFileLength = wcslen( szCommonFileW ); - dwSize = mkAbsoluteFilenameW( szDirNameW, dwDirLength, szCommonFileW, + dwSize = mkAbsoluteFilenameW( szDirNameW, dwDirLength, szCommonFileW, dwFileLength, szAbsPathNameW ); if (0 == dwSize) @@ -67,23 +67,23 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1_child, "thre Fail ("Palsuite Code: mkAbsoluteFilename() call failed. Could " "not build absolute path name to file\n. Exiting.\n"); } - + /* set the string length for the open call */ - szAbsPathNameA = (char*)malloc(dwSize +1); + szAbsPathNameA = (char*)malloc(dwSize +1); if (NULL == szAbsPathNameA) { Fail ("Unable to malloc (%d) bytes. Exiting\n", (dwSize +1) ); } - WideCharToMultiByte (CP_ACP, 0, szAbsPathNameW, -1, szAbsPathNameA, - (dwSize + 1), NULL, NULL); + WideCharToMultiByte (CP_ACP, 0, szAbsPathNameW, -1, szAbsPathNameA, + (dwSize + 1), NULL, NULL); - if ( NULL == ( fp = fopen ( szAbsPathNameA , "w+" ) ) ) + if ( NULL == ( fp = fopen ( szAbsPathNameA , "w+" ) ) ) { - /* + /* * A return value of NULL indicates an error condition or an - * EOF condition + * EOF condition */ Fail ("%s unable to open %s for writing. Exiting.\n", argv[0] , szAbsPathNameA ); @@ -96,14 +96,14 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1_child, "thre Fail("%s unable to write to %s. Exiting.\n", argv[0] , szAbsPathNameA ); } - - if (0 != (fclose ( fp ))) + + if (0 != (fclose ( fp ))) { Fail ("%s unable to close file %s. Pid may not be " "written to file. Exiting.\n", argv[0], szAbsPathNameA ); } PAL_Terminate(); - return ( PASS ); - + return ( PASS ); + } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/parentProcess.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/parentProcess.cpp index 293b2c167..00e6f2c30 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/parentProcess.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test1/parentProcess.cpp @@ -5,9 +5,9 @@ ** ** Source: CreateProcessW/test1/parentprocess.c ** -** Purpose: Test to ensure CreateProcessW starts a new process. This test +** Purpose: Test to ensure CreateProcessW starts a new process. This test ** launches a child process, and examines a file written by the child. -** This process (the parent process) reads the file created by the child and +** This process (the parent process) reads the file created by the child and ** compares the value the child wrote to the file. (a const char *) ** ** Dependencies: GetTempPath @@ -19,7 +19,7 @@ ** fopen ** fclose ** Fail -** +** ** **=========================================================*/ @@ -27,7 +27,7 @@ #define UNICODE #include -const WCHAR szCommonFileW[] = +const WCHAR szCommonFileW[] = {'c','h','i','l','d','d','a','t','a','.','t','m','p','\0'}; const WCHAR szChildFileW[] = u"threading/CreateProcessW/test1/paltest_createprocessw_test1_child"; @@ -46,14 +46,14 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1, "threading/ DWORD dwFileLength; DWORD dwDirLength; DWORD dwSize; - + size_t cslen; - + char szReadStringA[256]; - char szAbsPathNameA[_MAX_PATH]; - WCHAR szDirNameW[_MAX_DIR]; - WCHAR absPathBuf[_MAX_PATH]; + char szAbsPathNameA[MAX_PATH]; + WCHAR szDirNameW[_MAX_DIR]; + WCHAR absPathBuf[MAX_PATH]; WCHAR *szAbsPathNameW; @@ -61,16 +61,16 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1, "threading/ { return ( FAIL ); } - + ZeroMemory ( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory ( &pi, sizeof(pi) ); - + szAbsPathNameW=&absPathBuf[0]; - dwDirLength = GetTempPath(_MAX_PATH, szDirNameW); + dwDirLength = GetTempPath(MAX_PATH, szDirNameW); - if (0 == dwDirLength) + if (0 == dwDirLength) { Fail ("GetTempPath call failed. Could not get " "temp directory\n. Exiting.\n"); @@ -85,32 +85,32 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1, "threading/ wcscat(szAbsPathNameW, u" "); wcscat(szAbsPathNameW, szChildFileW); - - if ( !CreateProcessW ( NULL, + + if ( !CreateProcessW ( NULL, szAbsPathNameW, - NULL, - NULL, - FALSE, + NULL, + NULL, + FALSE, CREATE_NEW_CONSOLE, - NULL, - NULL, - &si, - &pi ) + NULL, + NULL, + &si, + &pi ) ) { - Fail ( "CreateProcess call failed. GetLastError returned %d\n", + Fail ( "CreateProcess call failed. GetLastError returned %d\n", GetLastError() ); } - + WaitForSingleObject ( pi.hProcess, INFINITE ); - + szAbsPathNameW=&absPathBuf[0]; dwFileLength = wcslen( szCommonFileW ); - dwSize = mkAbsoluteFilenameW( szDirNameW, dwDirLength, szCommonFileW, + dwSize = mkAbsoluteFilenameW( szDirNameW, dwDirLength, szCommonFileW, dwFileLength, szAbsPathNameW ); - + /* set the string length for the open call*/ if (0 == dwSize) @@ -118,13 +118,13 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1, "threading/ Fail ("Palsuite Code: mkAbsoluteFilename() call failed. Could " "not build absolute path name to file\n. Exiting.\n"); } - - WideCharToMultiByte (CP_ACP, 0, szAbsPathNameW, -1, szAbsPathNameA, + + WideCharToMultiByte (CP_ACP, 0, szAbsPathNameW, -1, szAbsPathNameA, (dwSize + 1), NULL, NULL); if ( NULL == ( fp = fopen ( szAbsPathNameA , "r" ) ) ) { - Fail ("%s\nunable to open %s\nfor reading. Exiting.\n", argv[0], + Fail ("%s\nunable to open %s\nfor reading. Exiting.\n", argv[0], szAbsPathNameA ); } @@ -132,12 +132,12 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1, "threading/ if ( NULL == fgets( szReadStringA, (cslen + 1), fp )) { - /* + /* * A return value of NULL indicates an error condition or an - * EOF condition + * EOF condition */ Fail ("%s\nunable to read file\n%s\nszReadStringA is %s\n" - "Exiting.\n", argv[0], szAbsPathNameA, + "Exiting.\n", argv[0], szAbsPathNameA, szReadStringA ); } @@ -151,8 +151,8 @@ PALTEST(threading_CreateProcessW_test1_paltest_createprocessw_test1, "threading/ { Trace ("string comparison passed.\n"); } - - if (0 != (fclose ( fp ))) + + if (0 != (fclose ( fp ))) { Trace ("%s unable to close file %s. This may cause a file pointer " "leak. Continuing.\n", argv[0], szAbsPathNameA ); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test2/parentprocess.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test2/parentprocess.cpp index 19bfc74ba..7c580a9ea 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test2/parentprocess.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateProcessW/test2/parentprocess.cpp @@ -55,7 +55,7 @@ PALTEST(threading_CreateProcessW_test2_paltest_createprocessw_test2, "threading/ char szStdOutBuf[BUF_LEN]; char szStdErrBuf[BUF_LEN]; - WCHAR szFullPathNameW[_MAX_PATH]; + WCHAR szFullPathNameW[MAX_PATH]; /******************************************* diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateSemaphoreW_ReleaseSemaphore/test3/createsemaphore.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateSemaphoreW_ReleaseSemaphore/test3/createsemaphore.cpp index aa05b89d0..3e3cec387 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateSemaphoreW_ReleaseSemaphore/test3/createsemaphore.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CreateSemaphoreW_ReleaseSemaphore/test3/createsemaphore.cpp @@ -6,7 +6,7 @@ ** Source: createsemaphorew_releasesemaphore/test3/createsemaphore.c ** ** Purpose: Test attributes of CreateSemaphoreExW and ReleaseSemaphore. -** Insure for CreateSemaphore that lInitialCount and lMaximumCount +** Ensure for CreateSemaphore that lInitialCount and lMaximumCount ** constraints are respected. Validate that CreateSemaphore rejects ** conditions where initial count and / or maximum count are negative ** and conditions where the initial count is greater than the maximum diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test1/InitializeCriticalSection.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test1/InitializeCriticalSection.cpp deleted file mode 100644 index 750e42d06..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test1/InitializeCriticalSection.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: criticalsectionfunctions/test1/initializecriticalsection.c -** -** Purpose: Test Semaphore operation using classic IPC problem: -** "Producer-Consumer Problem". -** -** Dependencies: CreateThread -** InitializeCriticalSection -** EnterCriticalSection -** LeaveCriticalSection -** DeleteCriticalSection -** WaitForSingleObject -** Sleep -** - -** -**=========================================================*/ - -#include - -#define PRODUCTION_TOTAL 26 - -#define _BUF_SIZE 10 - -DWORD dwThreadId_CriticalSectionFunctions_test1; /* consumer thread identifier */ - -HANDLE hThread_CriticalSectionFunctions_test1; /* handle to consumer thread */ - -CRITICAL_SECTION CriticalSectionM_CriticalSectionFunctions_test1; /* Critical Section Object (used as mutex) */ - -typedef struct Buffer -{ - short readIndex; - short writeIndex; - CHAR message[_BUF_SIZE]; - -} BufferStructure; - -CHAR producerItems_CriticalSectionFunctions_test1[PRODUCTION_TOTAL + 1]; - -CHAR consumerItems_CriticalSectionFunctions_test1[PRODUCTION_TOTAL + 1]; - -/* - * Read next message from the Buffer into provided pointer. - * Returns: 0 on failure, 1 on success. - */ -int -readBuf_CriticalSectionFunctions_test1(BufferStructure *Buffer, char *c) -{ - if( Buffer -> writeIndex == Buffer -> readIndex ) - { - return 0; - } - *c = Buffer -> message[Buffer -> readIndex++]; - Buffer -> readIndex %= _BUF_SIZE; - return 1; -} - -/* - * Write message generated by the producer to Buffer. - * Returns: 0 on failure, 1 on success. - */ -int -writeBuf_CriticalSectionFunctions_test1(BufferStructure *Buffer, CHAR c) -{ - if( ( ((Buffer -> writeIndex) + 1) % _BUF_SIZE) == - (Buffer -> readIndex) ) - { - return 0; - } - Buffer -> message[Buffer -> writeIndex++] = c; - Buffer -> writeIndex %= _BUF_SIZE; - return 1; -} - -/* - * Sleep 500 milleseconds. - */ -VOID -consumerSleep_CriticalSectionFunctions_test1(VOID) -{ - Sleep(500); -} - -/* - * Sleep between 10 milleseconds. - */ -VOID -producerSleep_CriticalSectionFunctions_test1(VOID) -{ - Sleep(10); -} - -/* - * Produce a message and write the message to Buffer. - */ -VOID -producer_CriticalSectionFunctions_test1(BufferStructure *Buffer) -{ - - int n = 0; - char c; - - while (n < PRODUCTION_TOTAL) - { - c = 'A' + n ; /* Produce Item */ - - EnterCriticalSection(&CriticalSectionM_CriticalSectionFunctions_test1); - - if (writeBuf_CriticalSectionFunctions_test1(Buffer, c)) - { - printf("Producer produces %c.\n", c); - producerItems_CriticalSectionFunctions_test1[n++] = c; - } - - LeaveCriticalSection(&CriticalSectionM_CriticalSectionFunctions_test1); - - producerSleep_CriticalSectionFunctions_test1(); - } - - return; -} - -/* - * Read and "Consume" the messages in Buffer. - */ -DWORD -PALAPI -consumer_CriticalSectionFunctions_test1( LPVOID lpParam ) -{ - int n = 0; - char c; - - consumerSleep_CriticalSectionFunctions_test1(); - - while (n < PRODUCTION_TOTAL) - { - - EnterCriticalSection(&CriticalSectionM_CriticalSectionFunctions_test1); - - if (readBuf_CriticalSectionFunctions_test1((BufferStructure*)lpParam, &c)) - { - printf("\tConsumer consumes %c.\n", c); - consumerItems_CriticalSectionFunctions_test1[n++] = c; - } - - LeaveCriticalSection(&CriticalSectionM_CriticalSectionFunctions_test1); - - consumerSleep_CriticalSectionFunctions_test1(); - } - - return 0; -} - -PALTEST(threading_CriticalSectionFunctions_test1_paltest_criticalsectionfunctions_test1, "threading/CriticalSectionFunctions/test1/paltest_criticalsectionfunctions_test1") -{ - - BufferStructure Buffer, *pBuffer; - - pBuffer = &Buffer; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* - * Create mutual exclusion mechanisms - */ - - InitializeCriticalSection ( &CriticalSectionM_CriticalSectionFunctions_test1 ); - - /* - * Initialize Buffer - */ - pBuffer->writeIndex = pBuffer->readIndex = 0; - - - - /* - * Create Consumer - */ - hThread_CriticalSectionFunctions_test1 = CreateThread( - NULL, - 0, - consumer_CriticalSectionFunctions_test1, - &Buffer, - 0, - &dwThreadId_CriticalSectionFunctions_test1); - - if ( NULL == hThread_CriticalSectionFunctions_test1 ) - { - Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); - } - - /* - * Start producing - */ - producer_CriticalSectionFunctions_test1(pBuffer); - - /* - * Wait for consumer to complete - */ - WaitForSingleObject (hThread_CriticalSectionFunctions_test1, INFINITE); - - /* - * Compare items produced vs. items consumed - */ - if ( 0 != strncmp (producerItems_CriticalSectionFunctions_test1, consumerItems_CriticalSectionFunctions_test1, PRODUCTION_TOTAL) ) - { - Fail("The producerItems_CriticalSectionFunctions_test1 string %s\n and the consumerItems_CriticalSectionFunctions_test1 string " - "%s\ndo not match. This could be a problem with the strncmp()" - " function\n FailingTest\nGetLastError() returned %d\n", - producerItems_CriticalSectionFunctions_test1, consumerItems_CriticalSectionFunctions_test1, GetLastError()); - } - - /* - * Clean up Critical Section object - */ - DeleteCriticalSection(&CriticalSectionM_CriticalSectionFunctions_test1); - - Trace("producerItems_CriticalSectionFunctions_test1 and consumerItems_CriticalSectionFunctions_test1 arrays match. All %d\nitems " - "were produced and consumed in order.\nTest passed.\n", - PRODUCTION_TOTAL); - - PAL_Terminate(); - return (PASS); - -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test2/test2.cpp deleted file mode 100644 index 4bb75dfcf..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test2/test2.cpp +++ /dev/null @@ -1,223 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: CriticalSectionFunctions/test2/test2.c -** -** Purpose: Test that we are able to nest critical section calls. -** The initial thread makes a call to EnterCriticalSection once, -** blocking on a CRITICAL_SECTION object and creates a new thread. -** The newly created thread blocks on the same CRITICAL_SECTION object. -** The first thread now makes a call to LeaveCriticalSection. -** Test to see that the new thread doesn't get unblocked. -** -** Dependencies: CreateThread -** InitializeCriticalSection -** EnterCriticalSection -** LeaveCriticalSection -** DeleteCriticalSection -** WaitForSingleObject -** - -** -**=========================================================*/ - -#include - -volatile BOOL t0_tflag = FAIL; /* thread 0 timeout flag */ -volatile BOOL t1_aflag = FAIL; /* thread 1 access flag */ -volatile BOOL t1_cflag = FAIL; /* thread 1 critical section flag */ -volatile BOOL bTestResult = FAIL; - -DWORD PALAPI Thread_CriticalSectionFunctions_test2(LPVOID lpParam) -{ - t1_aflag = PASS; - EnterCriticalSection(&CriticalSection); - t1_cflag = PASS; - LeaveCriticalSection(&CriticalSection); - return 0; -} - -PALTEST(threading_CriticalSectionFunctions_test2_paltest_criticalsectionfunctions_test2, "threading/CriticalSectionFunctions/test2/paltest_criticalsectionfunctions_test2") -{ - HANDLE hThread; - DWORD dwThreadId; - DWORD dwRet; - - if(0 != (PAL_Initialize(argc, argv))) - { - return (bTestResult); - } - - /* - * Create critical section object and enter it - */ - InitializeCriticalSection ( &CriticalSection ); - EnterCriticalSection(&CriticalSection); - - /* - * Create a suspended thread - */ - hThread = CreateThread(NULL, - 0, - &Thread_CriticalSectionFunctions_test2, - (LPVOID) NULL, - CREATE_SUSPENDED, - &dwThreadId); - - if (hThread == NULL) - { - Trace("PALSUITE ERROR: CreateThread call failed. GetLastError " - "returned %d.\n", GetLastError()); - LeaveCriticalSection(&CriticalSection); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - EnterCriticalSection(&CriticalSection); - /* - * Set priority of the thread to greater than that of the currently - * running thread so it is guaranteed to run. - */ - dwRet = (DWORD) SetThreadPriority(hThread, THREAD_PRIORITY_ABOVE_NORMAL); - - if (0 == dwRet) - { - Trace("PALSUITE ERROR: SetThreadPriority (%p, %d) call failed.\n" - "GetLastError returned %d.\n", hThread, - THREAD_PRIORITY_NORMAL, GetLastError()); - LeaveCriticalSection(&CriticalSection); - CloseHandle(hThread); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - dwRet = ResumeThread(hThread); - - if (-1 == dwRet) - { - Trace("PALSUITE ERROR: ResumeThread(%p) call failed.\nGetLastError " - "returned %d.\n", hThread, GetLastError()); - LeaveCriticalSection(&CriticalSection); - CloseHandle(hThread); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - /* - * Sleep until we know the thread has been invoked. This sleep in - * combination with the higher priority of the other thread should - * guarantee both threads block on the critical section. - */ - while (t1_aflag == FAIL) - { - Sleep(1); - } - - LeaveCriticalSection(&CriticalSection); - - switch ((WaitForSingleObject( - hThread, - 10000))) /* Wait 10 seconds */ - { - case WAIT_OBJECT_0: - /* Object (thread) is signaled */ - LeaveCriticalSection(&CriticalSection); - CloseHandle(hThread); - DeleteCriticalSection(&CriticalSection); - Fail("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_TIMEOUT ('%d'), instead it returned " - "WAIT_OBJECT_0 ('%d').\nA nested LeaveCriticalSection(%p) " - "call released both threads that were waiting on it!\n", - hThread, 10000, WAIT_TIMEOUT, WAIT_OBJECT_0, &CriticalSection); - break; - case WAIT_ABANDONED: - /* - * Object was mutex object whose owning - * thread has terminated. Shouldn't occur. - */ - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_TIMEOUT ('%d'), instead it returned " - "WAIT_ABANDONED ('%d').\nGetLastError returned '%d'\n", - hThread, 10000, WAIT_TIMEOUT, WAIT_ABANDONED, GetLastError()); - LeaveCriticalSection(&CriticalSection); - CloseHandle(hThread); - DeleteCriticalSection(&CriticalSection); - Fail(""); - break; - case WAIT_FAILED: /* WaitForSingleObject function failed */ - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_TIMEOUT ('%d'), instead it returned " - "WAIT_FAILED ('%d').\nGetLastError returned '%d'\n", - hThread, 10000, WAIT_TIMEOUT, WAIT_FAILED, GetLastError()); - LeaveCriticalSection(&CriticalSection); - CloseHandle(hThread); - DeleteCriticalSection(&CriticalSection); - Fail(""); - break; - case WAIT_TIMEOUT: - /* - * We expect this thread to timeout waiting for the - * critical section object to become available. - */ - t0_tflag = PASS; - break; - } - - LeaveCriticalSection(&CriticalSection); - - if (WAIT_OBJECT_0 != WaitForSingleObject (hThread, 10000)) - { - if (0 == CloseHandle(hThread)) - { - Trace("PALSUITE ERROR: CloseHandle(%p) call failed.\n" - "WaitForSingleObject(%p,%d) should have returned " - "WAIT_OBJECT_0 ('%d').\nBoth calls failed. " - "Deleted CRITICAL_SECTION object which likely means\n" - "thread %p is now in an undefined state. GetLastError " - "returned '%d'.\n", hThread, hThread, 10000, WAIT_OBJECT_0, - hThread, GetLastError()); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - else - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned WAIT_OBJECT_0 ('%d').\n GetLastError returned " - "'%d'.\n", hThread, hThread, 10000, WAIT_OBJECT_0, - hThread, GetLastError()); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - } - - if (0 == CloseHandle(hThread)) - { - Trace("PALSUITE ERROR: CloseHandle(%p) call failed.\n" - "Deleted CRITICAL_SECTION object which likely means\n" - "thread %p is now in an undefined state. GetLastError " - "returned '%d'.\n", hThread, hThread, GetLastError()); - DeleteCriticalSection(&CriticalSection); - Fail(""); - - } - DeleteCriticalSection(&CriticalSection); - /* - * Ensure both thread 0 experienced a wait timeout and thread 1 - * accessed the critical section or fail the test, otherwise pass it. - */ - if ((t0_tflag == FAIL) || (t1_cflag == FAIL)) - { - Trace("PALSUITE ERROR: Thread 0 returned %d when %d was expected.\n" - "Thread 1 returned %d when %d was expected.\n", t0_tflag, - PASS, t1_cflag, PASS); - bTestResult=FAIL; - } - else - { - bTestResult=PASS; - } - - PAL_TerminateEx(bTestResult); - return (bTestResult); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test4/test4.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test4/test4.cpp deleted file mode 100644 index 14a737abd..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test4/test4.cpp +++ /dev/null @@ -1,240 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*============================================================ -** -** Source: criticalsectionfunctions/test4/test4.c -** -** Purpose: Test to see if threads blocked on a CRITICAL_SECTION object will -** be released in an orderly manner. This case looks at the following -** scenario. If one thread owns a CRITICAL_SECTION object and two threads -** block in EnterCriticalSection, trying to hold the already owned -** CRITICAL_SECTION object, when the first thread releases the CRITICAL_SECTION -** object, will one and only one of the waiters get unblocked? -** -** Dependencies: CreateThread -** InitializeCriticalSection -** EnterCriticalSection -** LeaveCriticalSection -** DeleteCriticalSection -** Sleep -** WaitForSingleObject -** - -** -**=========================================================*/ - -#include - -#define NUM_BLOCKING_THREADS 2 - -BOOL bTestResult_CriticalSectionFunctions_test4; -CRITICAL_SECTION CriticalSection_CriticalSectionFunctions_test4; -HANDLE hThread_CriticalSectionFunctions_test4[NUM_BLOCKING_THREADS]; -HANDLE hEvent_CriticalSectionFunctions_test4; -DWORD dwThreadId_CriticalSectionFunctions_test4[NUM_BLOCKING_THREADS]; -volatile int flags_CriticalSectionFunctions_test4[NUM_BLOCKING_THREADS] = {0,0}; - -DWORD PALAPI ThreadTest1_CriticalSectionFunctions_test4(LPVOID lpParam) -{ - - EnterCriticalSection ( &CriticalSection_CriticalSectionFunctions_test4 ); - - flags_CriticalSectionFunctions_test4[0] = 1; - - return 0; - -} - -DWORD PALAPI ThreadTest2_CriticalSectionFunctions_test4(LPVOID lpParam) -{ - - EnterCriticalSection ( &CriticalSection_CriticalSectionFunctions_test4 ); - - flags_CriticalSectionFunctions_test4[1] = 1; - - return 0; - -} - -PALTEST(threading_CriticalSectionFunctions_test4_paltest_criticalsectionfunctions_test4, "threading/CriticalSectionFunctions/test4/paltest_criticalsectionfunctions_test4") -{ - - DWORD dwRet; - DWORD dwRet1; - bTestResult_CriticalSectionFunctions_test4 = FAIL; - - if ((PAL_Initialize(argc,argv)) != 0) - { - return(bTestResult_CriticalSectionFunctions_test4); - } - - /* - * Create Critical Section Object - */ - InitializeCriticalSection ( &CriticalSection_CriticalSectionFunctions_test4 ); - - EnterCriticalSection ( &CriticalSection_CriticalSectionFunctions_test4 ); - - hThread_CriticalSectionFunctions_test4[0] = CreateThread(NULL, - 0, - &ThreadTest1_CriticalSectionFunctions_test4, - (LPVOID) 0, - CREATE_SUSPENDED, - &dwThreadId_CriticalSectionFunctions_test4[0]); - if (hThread_CriticalSectionFunctions_test4[0] == NULL) - { - Trace("PALSUITE ERROR: CreateThread(%p, %d, %p, %p, %d, %p) call " - "failed.\nGetLastError returned %d.\n", NULL, 0, &ThreadTest1_CriticalSectionFunctions_test4, - (LPVOID) 0, CREATE_SUSPENDED, &dwThreadId_CriticalSectionFunctions_test4[0], GetLastError()); - LeaveCriticalSection(&CriticalSection_CriticalSectionFunctions_test4); - DeleteCriticalSection ( &CriticalSection_CriticalSectionFunctions_test4 ); - Fail(""); - } - - hThread_CriticalSectionFunctions_test4[1] = CreateThread(NULL, - 0, - &ThreadTest2_CriticalSectionFunctions_test4, - (LPVOID) 0, - CREATE_SUSPENDED, - &dwThreadId_CriticalSectionFunctions_test4[1]); - if (hThread_CriticalSectionFunctions_test4[1] == NULL) - { - Trace("PALSUITE ERROR: CreateThread(%p, %d, %p, %p, %d, %p) call " - "failed.\nGetLastError returned %d.\n", NULL, 0, &ThreadTest2_CriticalSectionFunctions_test4, - (LPVOID) 0, CREATE_SUSPENDED, &dwThreadId_CriticalSectionFunctions_test4[1], GetLastError()); - LeaveCriticalSection(&CriticalSection_CriticalSectionFunctions_test4); - - dwRet = ResumeThread(hThread_CriticalSectionFunctions_test4[0]); - if (-1 == dwRet) - { - Trace("PALSUITE ERROR: ResumeThread(%p) call failed.\n" - "GetLastError returned '%d'.\n", hThread_CriticalSectionFunctions_test4[0], - GetLastError()); - } - - dwRet = WaitForSingleObject(hThread_CriticalSectionFunctions_test4[0], 10000); - if (WAIT_OBJECT_0 == dwRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p, %d) call " - "failed. '%d' was returned instead of the expected '%d'.\n" - "GetLastError returned '%d'.\n", hThread_CriticalSectionFunctions_test4[0], 10000, dwRet, - WAIT_OBJECT_0, GetLastError()); - } - - if (0 == CloseHandle(hThread_CriticalSectionFunctions_test4[0])) - { - Trace("PALSUITE NOTIFICATION: CloseHandle(%p) call failed.\n" - "GetLastError returned %d. Not failing tests.\n", - hThread_CriticalSectionFunctions_test4[0], GetLastError()); - } - - DeleteCriticalSection(&CriticalSection_CriticalSectionFunctions_test4); - Fail(""); - } - - /* - * Set other thread priorities to be higher than ours & Sleep to ensure - * we give up the processor. - */ - dwRet = (DWORD) SetThreadPriority(hThread_CriticalSectionFunctions_test4[0], - THREAD_PRIORITY_ABOVE_NORMAL); - if (0 == dwRet) - { - Trace("PALSUITE ERROR: SetThreadPriority(%p, %d) call failed.\n" - "GetLastError returned %d", hThread_CriticalSectionFunctions_test4[0], - THREAD_PRIORITY_ABOVE_NORMAL, GetLastError()); - } - - dwRet = (DWORD) SetThreadPriority(hThread_CriticalSectionFunctions_test4[1], - THREAD_PRIORITY_ABOVE_NORMAL); - if (0 == dwRet) - { - Trace("PALSUITE ERROR: SetThreadPriority(%p, %d) call failed.\n" - "GetLastError returned %d", hThread_CriticalSectionFunctions_test4[1], - THREAD_PRIORITY_ABOVE_NORMAL, GetLastError()); - } - - dwRet = ResumeThread(hThread_CriticalSectionFunctions_test4[0]); - if (-1 == dwRet) - { - Trace("PALSUITE ERROR: ResumeThread(%p, %d) call failed.\n" - "GetLastError returned %d", hThread_CriticalSectionFunctions_test4[0], - GetLastError() ); - } - - dwRet = ResumeThread(hThread_CriticalSectionFunctions_test4[1]); - if (-1 == dwRet) - { - Trace("PALSUITE ERROR: ResumeThread(%p, %d) call failed.\n" - "GetLastError returned %d", hThread_CriticalSectionFunctions_test4[0], - GetLastError()); - } - - Sleep (0); - - LeaveCriticalSection (&CriticalSection_CriticalSectionFunctions_test4); - - dwRet = WaitForSingleObject(hThread_CriticalSectionFunctions_test4[0], 10000); - dwRet1 = WaitForSingleObject(hThread_CriticalSectionFunctions_test4[1], 10000); - - if ((WAIT_OBJECT_0 == dwRet) || - (WAIT_OBJECT_0 == dwRet1)) - { - if ((1 == flags_CriticalSectionFunctions_test4[0] && 0 == flags_CriticalSectionFunctions_test4[1]) || - (0 == flags_CriticalSectionFunctions_test4[0] && 1 == flags_CriticalSectionFunctions_test4[1])) - { - bTestResult_CriticalSectionFunctions_test4 = PASS; - } - else - { - bTestResult_CriticalSectionFunctions_test4 = FAIL; - Trace ("PALSUITE ERROR: flags[%d] = {%d,%d}. These values are" - "inconsistent.\nCriticalSection test failed.\n", - NUM_BLOCKING_THREADS, flags_CriticalSectionFunctions_test4[0], flags_CriticalSectionFunctions_test4[1]); - } - - /* Fail the test if both threads returned WAIT_OBJECT_0 */ - if ((WAIT_OBJECT_0 == dwRet) && (WAIT_OBJECT_0 == dwRet1)) - { - bTestResult_CriticalSectionFunctions_test4 = FAIL; - Trace ("PALSUITE ERROR: WaitForSingleObject(%p, %d) and " - "WaitForSingleObject(%p, %d)\nboth returned dwRet = '%d'\n" - "One should have returned WAIT_TIMEOUT ('%d').\n", - hThread_CriticalSectionFunctions_test4[0], 10000, hThread_CriticalSectionFunctions_test4[1], 10000, dwRet, WAIT_TIMEOUT); - } - } - else - { - bTestResult_CriticalSectionFunctions_test4 = FAIL; - Trace ("PALSUITE ERROR: WaitForSingleObject(%p, %d) and " - "WaitForSingleObject(%p, %d)\nReturned dwRet = '%d' and\n" - "dwRet1 = '%d' respectively.\n", hThread_CriticalSectionFunctions_test4[0], 10000, hThread_CriticalSectionFunctions_test4[1], - 10000, dwRet, dwRet1); - } - - if (WAIT_OBJECT_0 == dwRet) - { - if (0 == CloseHandle(hThread_CriticalSectionFunctions_test4[0])) - { - Trace("PALSUITE NOTIFICATION: CloseHandle(%p) call failed.\n" - "GetLastError returned %d. Not failing tests.\n", - hThread_CriticalSectionFunctions_test4[0], GetLastError()); - } - } - if (WAIT_OBJECT_0 == dwRet1) - { - if (0 == CloseHandle(hThread_CriticalSectionFunctions_test4[1])) - { - Trace("PALSUITE NOTIFICATION: CloseHandle(%p) call failed.\n" - "GetLastError returned %d. Not failing tests.\n", - hThread_CriticalSectionFunctions_test4[1], GetLastError()); - } - } - - /* Leaking the CS on purpose, since there is still a thread - waiting on it */ - - PAL_TerminateEx(bTestResult_CriticalSectionFunctions_test4); - return (bTestResult_CriticalSectionFunctions_test4); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test5/test5.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test5/test5.cpp deleted file mode 100644 index 4556c082f..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test5/test5.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: CriticalSectionFunctions/test5/test5.c -** -** Purpose: Attempt to delete a critical section owned by another -** thread. -** -** -**===================================================================*/ -#include - -DWORD PALAPI Thread_CriticalSectionFunctions_test5(LPVOID lpParam) -{ - DWORD dwTRet; - - EnterCriticalSection(&CriticalSection); - - /* signal thread 0 */ - if (0 == SetEvent(hToken[0])) - { - Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) during " - "clean up.\nGetLastError returned '%u'.\n", hToken[0], - GetLastError()); - LeaveCriticalSection(&CriticalSection); - Cleanup (&hToken[0], NUM_TOKENS); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - /* wait to be signaled */ - dwTRet = WaitForSingleObject(hToken[1], 10000); - if (WAIT_OBJECT_0 != dwTRet) - - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_OBJECT_0 ('%d'), instead it returned " - "('%d').\nGetLastError returned '%u'.\n", - hToken[1], 10000, WAIT_OBJECT_0, dwTRet, GetLastError()); - LeaveCriticalSection(&CriticalSection); - Cleanup (&hToken[0], NUM_TOKENS); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - LeaveCriticalSection(&CriticalSection); - return 0; -} - -PALTEST(threading_CriticalSectionFunctions_test5_paltest_criticalsectionfunctions_test5, "threading/CriticalSectionFunctions/test5/paltest_criticalsectionfunctions_test5") -{ - DWORD dwThreadId; - DWORD dwMRet; - - if ((PAL_Initialize(argc,argv)) != 0) - { - return(FAIL); - } - - /* thread 0 event */ - hToken[0] = CreateEvent(NULL, TRUE, FALSE, NULL); - if (NULL == hToken[0]) - { - Fail("PALSUITE ERROR: CreateEvent call #0 failed. GetLastError " - "returned %u.\n", GetLastError()); - } - - /* thread 1 event */ - hToken[1] = CreateEvent(NULL, TRUE, FALSE, NULL); - if (NULL == hToken[1]) - { - Trace("PALSUITE ERROR: CreateEvent call #1 failed. GetLastError " - "returned %u.\n", GetLastError()); - Cleanup(&hToken[0], (NUM_TOKENS - 2)); - Fail(""); - } - - InitializeCriticalSection(&CriticalSection); - - hToken[2] = CreateThread(NULL, - 0, - &Thread_CriticalSectionFunctions_test5, - (LPVOID) NULL, - 0, - &dwThreadId); - if (hToken[2] == NULL) - { - Trace("PALSUITE ERROR: CreateThread call #0 failed. GetLastError " - "returned %u.\n", GetLastError()); - Cleanup(&hToken[0], (NUM_TOKENS - 1)); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - /* wait for thread 0 to be signaled */ - dwMRet = WaitForSingleObject(hToken[0], 10000); - if (WAIT_OBJECT_0 != dwMRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_OBJECT_0 ('%d'), instead it returned " - "('%d').\nGetLastError returned '%u'.\n", hToken[0], 10000, - WAIT_OBJECT_0, dwMRet, GetLastError()); - Cleanup(&hToken[0], NUM_TOKENS); - Fail(""); - } - - /* - * Attempt to do delete CriticalSection object owned by other thread - */ - DeleteCriticalSection(&CriticalSection); - - /* signal thread 1 */ - if (0 == SetEvent(hToken[1])) - { - Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) call.\n" - "GetLastError returned '%u'.\n", hToken[1], - GetLastError()); - Cleanup(&hToken[0], NUM_TOKENS); - Fail(""); - } - - dwMRet = WaitForSingleObject(hToken[2], 10000); - if (WAIT_OBJECT_0 != dwMRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p, %d) call " - "returned an unexpected value '%d'.\nGetLastError returned " - "%u.\n", hToken[2], 10000, dwMRet, GetLastError()); - Cleanup(&hToken[0], NUM_TOKENS); - Fail(""); - } - - if (!Cleanup(&hToken[0], NUM_TOKENS)) - { - Fail(""); - } - - PAL_Terminate(); - - return (PASS); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test6/test6.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test6/test6.cpp deleted file mode 100644 index 672637159..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test6/test6.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: CriticalSectionFunctions/test6/test6.c -** -** Purpose: Attempt to leave a critical section which is owned by -** another thread. -** -** -**===================================================================*/ -#include - - -DWORD PALAPI Thread_CriticalSectionFunctions_test6(LPVOID lpParam) -{ - DWORD dwTRet; - - EnterCriticalSection(&CriticalSection); - - /* signal thread 0 */ - if (0 == SetEvent(hToken[0])) - { - Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) during " - "clean up.\nGetLastError returned '%u'.\n", hToken[0], - GetLastError()); - LeaveCriticalSection(&CriticalSection); - Cleanup (&hToken[0], NUM_TOKENS); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - /* wait to be signaled */ - dwTRet = WaitForSingleObject(hToken[1], 10000); - if (WAIT_OBJECT_0 != dwTRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_OBJECT_0 ('%d'), instead it returned " - "('%d').\nGetLastError returned '%u'.\n", - hToken[1], 10000, WAIT_OBJECT_0, dwTRet, GetLastError()); - LeaveCriticalSection(&CriticalSection); - Cleanup (&hToken[0], NUM_TOKENS); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - LeaveCriticalSection(&CriticalSection); - - return 0; -} - -PALTEST(threading_CriticalSectionFunctions_test6_paltest_criticalsectionfunctions_test6, "threading/CriticalSectionFunctions/test6/paltest_criticalsectionfunctions_test6") -{ - DWORD dwThreadId; - DWORD dwMRet; - - if ((PAL_Initialize(argc,argv)) != 0) - { - return(FAIL); - } - - /* thread 0 event */ - hToken[0] = CreateEvent(NULL, TRUE, FALSE, NULL); - - if (hToken[0] == NULL) - { - Fail("PALSUITE ERROR: CreateEvent call #0 failed. GetLastError " - "returned %u.\n", GetLastError()); - } - - /* thread 1 event */ - hToken[1] = CreateEvent(NULL, TRUE, FALSE, NULL); - - if (hToken[1] == NULL) - { - Trace("PALSUITE ERROR: CreateEvent call #1 failed. GetLastError " - "returned %u.\n", GetLastError()); - Cleanup(&hToken[0], (NUM_TOKENS - 2)); - Fail(""); - } - - InitializeCriticalSection(&CriticalSection); - - hToken[2] = CreateThread(NULL, - 0, - &Thread_CriticalSectionFunctions_test6, - (LPVOID) NULL, - 0, - &dwThreadId); - - if (hToken[2] == NULL) - { - Trace("PALSUITE ERROR: CreateThread call #0 failed. GetLastError " - "returned %u.\n", GetLastError()); - Cleanup(&hToken[0], (NUM_TOKENS - 1)); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - /* wait for thread 0 to be signaled */ - dwMRet = WaitForSingleObject(hToken[0], 10000); - if (WAIT_OBJECT_0 != dwMRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_OBJECT_0 ('%d'), instead it returned " - "('%d').\nGetLastError returned '%u'.\n", hToken[0], 10000, - WAIT_OBJECT_0, dwMRet, GetLastError()); - Cleanup(&hToken[0], NUM_TOKENS); - Fail(""); - } - - /* - * Attempt to leave critical section which is owned by the other thread. - */ - LeaveCriticalSection(&CriticalSection); - - /* signal thread 1 */ - if (0 == SetEvent(hToken[1])) - { - Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) call.\n" - "GetLastError returned '%u'.\n", hToken[1], - GetLastError()); - Cleanup(&hToken[0], NUM_TOKENS); - Fail(""); - } - - dwMRet = WaitForSingleObject(hToken[2], 10000); - if (WAIT_OBJECT_0 != dwMRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p, %d) call " - "returned an unexpected value '%d'.\nGetLastError returned " - "%u.\n", hToken[2], 10000, dwMRet, GetLastError()); - Cleanup(&hToken[0], NUM_TOKENS); - Fail(""); - } - - if (!Cleanup(&hToken[0], NUM_TOKENS)) - { - Fail(""); - } - - PAL_Terminate(); - - return(PASS); -} diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test7/test7.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test7/test7.cpp deleted file mode 100644 index e4ad81364..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test7/test7.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: CriticalSectionFunctions/test7/test7.c -** -** Purpose: Attempt to delete a critical section owned by the current -** thread. -** -** -**===================================================================*/ -#include - -DWORD PALAPI Thread_CriticalSectionFunctions_test7(LPVOID lpParam) -{ - DWORD dwTRet; - - EnterCriticalSection(&CriticalSection); - - /* signal thread 0 */ - if (0 == SetEvent(hToken[0])) - { - Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) during " - "clean up.\nGetLastError returned '%u'.\n", hToken[0], - GetLastError()); - LeaveCriticalSection(&CriticalSection); - Cleanup (&hToken[0], NUM_TOKENS); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - /* wait to be signaled */ - dwTRet = WaitForSingleObject(hToken[1], 10000); - if (WAIT_OBJECT_0 != dwTRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_OBJECT_0 ('%d'), instead it returned " - "('%d').\nGetLastError returned '%u'.\n", - hToken[0], 10000, WAIT_OBJECT_0, dwTRet, GetLastError()); - LeaveCriticalSection(&CriticalSection); - Cleanup (&hToken[0], NUM_TOKENS); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - DeleteCriticalSection(&CriticalSection); - - return 0; -} - -PALTEST(threading_CriticalSectionFunctions_test7_paltest_criticalsectionfunctions_test7, "threading/CriticalSectionFunctions/test7/paltest_criticalsectionfunctions_test7") -{ - DWORD dwThreadId; - DWORD dwMRet; - - if ((PAL_Initialize(argc,argv)) != 0) - { - return(FAIL); - } - - /* thread 0 event */ - hToken[0] = CreateEvent(NULL, TRUE, FALSE, NULL); - - if (hToken[0] == NULL) - { - Fail("PALSUITE ERROR: CreateEvent call #0 failed. GetLastError " - "returned %u.\n", GetLastError()); - } - - /* thread 1 event */ - hToken[1] = CreateEvent(NULL, TRUE, FALSE, NULL); - - if (hToken[1] == NULL) - { - Trace("PALSUITE ERROR: CreateEvent call #1 failed. GetLastError " - "returned %u.\n", GetLastError()); - Cleanup (&hToken[0], (NUM_TOKENS - 2)); - Fail(""); - } - - InitializeCriticalSection(&CriticalSection); - - hToken[2] = CreateThread(NULL, - 0, - &Thread_CriticalSectionFunctions_test7, - (LPVOID) NULL, - 0, - &dwThreadId); - - if (hToken[2] == NULL) - { - Trace("PALSUITE ERROR: CreateThread call #0 failed. GetLastError " - "returned %u.\n", GetLastError()); - Cleanup (&hToken[0], (NUM_TOKENS - 1)); - DeleteCriticalSection(&CriticalSection); - Fail(""); - } - - /* wait for thread 0 to be signaled */ - dwMRet = WaitForSingleObject(hToken[0], 10000); - if (WAIT_OBJECT_0 != dwMRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have " - "returned\nWAIT_OBJECT_0 ('%d'), instead it returned " - "('%d').\nGetLastError returned '%u'.\n", hToken[0], 10000, - WAIT_OBJECT_0, dwMRet, GetLastError()); - Cleanup (&hToken[0], NUM_TOKENS); - Fail(""); - } - - /* signal thread 1 */ - if (0 == SetEvent(hToken[1])) - { - Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) call.\n" - "GetLastError returned '%u'.\n", hToken[1], - GetLastError()); - Cleanup (&hToken[0], NUM_TOKENS); - Fail(""); - } - - dwMRet = WaitForSingleObject(hToken[2], 10000); - if (WAIT_OBJECT_0 != dwMRet) - { - Trace("PALSUITE ERROR: WaitForSingleObject(%p, %d) call " - "returned an unexpected value '%d'.\nGetLastError returned " - "%u.\n", hToken[2], 10000, dwMRet, GetLastError()); - Cleanup (&hToken[0], NUM_TOKENS); - Fail(""); - } - - if (!Cleanup(&hToken[0], NUM_TOKENS)) - { - Fail(""); - } - - PAL_Terminate(); - - return (PASS); -} - - - diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test8/test8.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test8/test8.cpp deleted file mode 100644 index 8081b6910..000000000 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test8/test8.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -/*===================================================================== -** -** Source: CriticalSectionFunctions/test8/test8.c -** -** Pyrpose: Ensure critical section functionality is working by -** having multiple threads racing on a CS under different -** scenarios -** -** -**===================================================================*/ -#include -#include - -#define MAX_THREAD_COUNT 128 -#define DEFAULT_THREAD_COUNT 10 -#define DEFAULT_LOOP_COUNT 1000 - -#ifndef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) -#endif - -int g_iThreadCount = DEFAULT_THREAD_COUNT; -int g_iLoopCount = DEFAULT_LOOP_COUNT; -volatile LONG g_lCriticalCount = 0; -HANDLE g_hEvStart = NULL; - -CRITICAL_SECTION g_cs; -DWORD PALAPI Thread_CriticalSectionFunctions_test8(LPVOID lpParam) -{ - int i, j, iLpCnt; - DWORD dwRet = 0; - DWORD dwTid = GetCurrentThreadId(); - LONG lRet; - BOOL bSleepInside; - BOOL bSleepOutside; - - Trace("[tid=%u] Thread starting\n", dwTid); - - dwRet = WaitForSingleObject(g_hEvStart, INFINITE); - if (WAIT_OBJECT_0 != dwRet) - { - Fail("WaitForSingleObject returned unexpected %u [GetLastError()=%u]\n", - dwRet, GetLastError()); - } - - for (j=0;j<8;j++) - { - bSleepInside = 2 & j; - bSleepOutside = 4 & j; - - iLpCnt = g_iLoopCount; - if (bSleepInside || bSleepOutside) - { - iLpCnt /= 10; - } - - for (i=0;i= iVal) - { - g_iThreadCount = iVal; - } - } - break; - default: - break; - } - } - } - - Trace ("Iterations:\t%d\n", g_iLoopCount); - Trace ("Threads:\t%d\n", g_iThreadCount); - - g_hEvStart = CreateEvent(NULL, TRUE, FALSE, NULL); - - if (g_hEvStart == NULL) - { - Fail("CreateEvent call failed. GetLastError " - "returned %u.\n", GetLastError()); - } - - InitializeCriticalSection(&g_cs); - - for (i=0;i iThreadCount) - { - Fail("Failed to create minimum number if threads, i.e. 2\n"); - } - - if (!SetEvent(g_hEvStart)) - { - Fail("SetEvent failed [GetLastError()=%u]\n", GetLastError()); - } - - for (i=0; i -const char *const SessionPrefix = "Local\\"; -const char *const GlobalPrefix = "Global\\"; - -const char *const NamePrefix = "paltest_namedmutex_test1_"; -const char *const TempNamePrefix = "paltest_namedmutex_test1_temp_"; -const char *const InvalidNamePrefix0 = "paltest\\namedmutex_"; -const char *const InvalidNamePrefix1 = "paltest/namedmutex_"; -const char *const ParentEventNamePrefix0 = "paltest_namedmutex_test1_pe0_"; -const char *const ParentEventNamePrefix1 = "paltest_namedmutex_test1_pe1_"; -const char *const ChildEventNamePrefix0 = "paltest_namedmutex_test1_ce0_"; -const char *const ChildEventNamePrefix1 = "paltest_namedmutex_test1_ce1_"; -const char *const ChildRunningEventNamePrefix = "paltest_namedmutex_test1_cr_"; - -const char *const GlobalShmFilePathPrefix = "/tmp/.dotnet/shm/global/"; +const char CurrentSessionOnlyPrefix[] = "Local\\"; +const char AllSessionsPrefix[] = "Global\\"; + +const char NamePrefix[] = "paltest_namedmutex_test1_"; +const char TempNamePrefix[] = "paltest_namedmutex_test1_temp_"; +const char HeaderMismatchTestsNamePrefix[] = "paltest_namedmutex_test1_headermismatchtests_"; +const char InvalidNamePrefix0[] = "paltest\\namedmutex_"; +const char InvalidNamePrefix1[] = "paltest/namedmutex_"; +const char ParentEventNamePrefix0[] = "paltest_namedmutex_test1_pe0_"; +const char ParentEventNamePrefix1[] = "paltest_namedmutex_test1_pe1_"; +const char ChildEventNamePrefix0[] = "paltest_namedmutex_test1_ce0_"; +const char ChildEventNamePrefix1[] = "paltest_namedmutex_test1_ce1_"; +const char ChildRunningEventNamePrefix[] = "paltest_namedmutex_test1_cr_"; #define MaxPathSize 200 const DWORD PollLoopSleepMilliseconds = 100; @@ -28,6 +27,8 @@ const DWORD FailTimeoutMilliseconds = 30000; DWORD g_expectedTimeoutMilliseconds = 500; bool g_isParent = true; +bool g_currentUserOnly = true; +bool g_currentSessionOnly = true; bool g_isStress = false; #define MaxProcessPathSize 4096 char g_processPath[MaxProcessPathSize], g_processCommandLinePath[MaxProcessPathSize]; @@ -41,13 +42,15 @@ extern int (*test_sscanf)(const char *str, const char *format, ...); extern int(*test_close)(int fd); extern int (*test_unlink)(const char *pathname); extern unsigned int test_getpid(); +extern unsigned int test_getsid(); +extern unsigned int test_geteuid(); extern int test_kill(unsigned int pid); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Test helpers extern bool TestFileExists(const char *path); -extern bool WriteHeaderInfo(const char *path, char sharedMemoryType, char version, int *fdRef); +extern bool WriteHeaderInfo(const char *path, bool currentUserOnly, char sharedMemoryType, char version, int *fdRef); #define TestAssert(expression) \ do \ @@ -56,56 +59,76 @@ extern bool WriteHeaderInfo(const char *path, char sharedMemoryType, char versio { \ if (!g_isParent) \ { \ - Trace("'paltest_namedmutex_test1' child process failed at line %u. Expression: " #expression "\n", __LINE__); \ + Trace( \ + "'paltest_namedmutex_test1' child process failed at line %u. CurrentUserOnly: %d, CurrentSessionOnly: %d. Expression: " #expression "\n", \ + __LINE__, \ + (int)g_currentUserOnly, \ + (int)g_currentSessionOnly); \ } \ else \ { \ - Trace("'paltest_namedmutex_test1' failed at line %u. Expression: " #expression "\n", __LINE__); \ + Trace( \ + "'paltest_namedmutex_test1' failed at line %u. CurrentUserOnly: %d, CurrentSessionOnly: %d. Expression: " #expression "\n", \ + __LINE__, \ + (int)g_currentUserOnly, \ + (int)g_currentSessionOnly); \ } \ fflush(stdout); \ return false; \ } \ } while(false) -char *BuildName(const char *testName, char *buffer, const char *prefix0, const char *prefix1 = nullptr) +char *BuildName(const char *testName, char *buffer, const char *namePrefix = nullptr) { size_t nameLength = 0; - const char *prefixes[] = {prefix0, prefix1}; - for (int i = 0; i < 2; ++i) + if (!g_currentSessionOnly) { - const char *prefix = prefixes[i]; - if (prefix == nullptr) - { - break; - } - test_strcpy(&buffer[nameLength], prefix); - nameLength += test_strlen(prefix); + test_strcpy(&buffer[nameLength], AllSessionsPrefix); + nameLength += STRING_LENGTH(AllSessionsPrefix); + } + + if (namePrefix != nullptr) + { + nameLength += test_snprintf(&buffer[nameLength], MaxPathSize - nameLength, "%s", namePrefix); } if (g_isStress) { // Append the test name so that tests can run in parallel - nameLength += test_snprintf(&buffer[nameLength], MaxPathSize - nameLength, "%s", testName); - buffer[nameLength++] = '_'; + nameLength += test_snprintf(&buffer[nameLength], MaxPathSize - nameLength, "%s_", testName); } nameLength += test_snprintf(&buffer[nameLength], MaxPathSize - nameLength, "%u", g_parentPid); return buffer; } -char *BuildGlobalShmFilePath(const char *testName, char *buffer, const char *namePrefix) +char *BuildShmFilePath(const char *testName, char *buffer, const char *namePrefix) { size_t pathLength = 0; - test_strcpy(&buffer[pathLength], GlobalShmFilePathPrefix); - pathLength += test_strlen(GlobalShmFilePathPrefix); - test_strcpy(&buffer[pathLength], namePrefix); - pathLength += test_strlen(namePrefix); + if (g_currentUserOnly) + { + pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "/tmp/.dotnet-uid%u/shm/", test_geteuid()); + } + else + { + pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "%s", "/tmp/.dotnet/shm/"); + } + + if (g_currentSessionOnly) + { + pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "session%u/", test_getsid()); + } + else + { + pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "%s", "global/"); + } + + pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "%s", namePrefix); if (g_isStress) { // Append the test name so that tests can run in parallel - pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "%s", testName); - buffer[pathLength++] = '_'; + pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "%s_", testName); } pathLength += test_snprintf(&buffer[pathLength], MaxPathSize - pathLength, "%u", g_parentPid); @@ -175,37 +198,33 @@ void TestCreateMutex(AutoCloseMutexHandle &m, const char *name, bool initiallyOw { m.Close(); LPWSTR nameW = convert(name); - m = CreateMutex(nullptr, initiallyOwned, nameW); + m = PAL_CreateMutexW(initiallyOwned, nameW, g_currentUserOnly, nullptr, 0); free(nameW); } HANDLE TestOpenMutex(const char *name) { - return OpenMutexA(SYNCHRONIZE, false, name); + LPWSTR nameW = convert(name); + HANDLE h = PAL_OpenMutexW(nameW, g_currentUserOnly, nullptr, 0); + free(nameW); + return h; } bool StartProcess(const char *funcName) { - // Command line format: [stress] - - size_t processCommandLinePathLength = 0; - g_processCommandLinePath[processCommandLinePathLength++] = '\"'; - test_strcpy(&g_processCommandLinePath[processCommandLinePathLength], g_processPath); - processCommandLinePathLength += test_strlen(g_processPath); - g_processCommandLinePath[processCommandLinePathLength++] = '\"'; - g_processCommandLinePath[processCommandLinePathLength++] = ' '; - const char* testname = "threading/NamedMutex/test1/paltest_namedmutex_test1"; - processCommandLinePathLength += test_snprintf(&g_processCommandLinePath[processCommandLinePathLength], MaxProcessPathSize - processCommandLinePathLength, "%s ", testname); - processCommandLinePathLength += test_snprintf(&g_processCommandLinePath[processCommandLinePathLength], MaxProcessPathSize - processCommandLinePathLength, "%u", g_parentPid); - g_processCommandLinePath[processCommandLinePathLength++] = ' '; - test_strcpy(&g_processCommandLinePath[processCommandLinePathLength], funcName); - processCommandLinePathLength += test_strlen(funcName); - - if (g_isStress) - { - test_strcpy(&g_processCommandLinePath[processCommandLinePathLength], " stress"); - processCommandLinePathLength += STRING_LENGTH("stress"); - } + // Command line format: + // <0|1> /* currentUserOnly */ <0|1> /* currentSessionOnly */ [stress] + test_snprintf( + g_processCommandLinePath, + MaxProcessPathSize, + "\"%s\" %s %u %s %u %u%s", + g_processPath, + "threading/NamedMutex/test1/paltest_namedmutex_test1", + g_parentPid, + funcName, + g_currentUserOnly ? 1 : 0, + g_currentSessionOnly ? 1 : 0, + g_isStress ? " stress" : ""); STARTUPINFO si; memset(&si, 0, sizeof(si)); @@ -247,8 +266,8 @@ bool StartThread(LPTHREAD_START_ROUTINE func, void *arg = nullptr, HANDLE *threa bool WaitForMutexToBeCreated(const char *testName, AutoCloseMutexHandle &m, const char *eventNamePrefix) { char eventName[MaxPathSize]; - BuildName(testName, eventName, GlobalPrefix, eventNamePrefix); - DWORD startTime = GetTickCount(); + BuildName(testName, eventName, eventNamePrefix); + DWORD startTime = (DWORD)minipal_lowres_ticks(); while (true) { m = TestOpenMutex(eventName); @@ -256,7 +275,7 @@ bool WaitForMutexToBeCreated(const char *testName, AutoCloseMutexHandle &m, cons { return true; } - if (GetTickCount() - startTime >= FailTimeoutMilliseconds) + if ((DWORD)minipal_lowres_ticks() - startTime >= FailTimeoutMilliseconds) { return false; } @@ -276,7 +295,7 @@ bool WaitForMutexToBeCreated(const char *testName, AutoCloseMutexHandle &m, cons bool AcquireChildRunningEvent(const char *testName, AutoCloseMutexHandle &childRunningEvent) { char name[MaxPathSize]; - TestCreateMutex(childRunningEvent, BuildName(testName, name, GlobalPrefix, ChildRunningEventNamePrefix)); + TestCreateMutex(childRunningEvent, BuildName(testName, name, ChildRunningEventNamePrefix)); TestAssert(WaitForSingleObject(childRunningEvent, FailTimeoutMilliseconds) == WAIT_OBJECT_0); return true; } @@ -289,7 +308,7 @@ bool InitializeParent(const char *testName, AutoCloseMutexHandle parentEvents[2] { TestCreateMutex( parentEvents[i], - BuildName(testName, name, GlobalPrefix, i == 0 ? ParentEventNamePrefix0 : ParentEventNamePrefix1), + BuildName(testName, name, i == 0 ? ParentEventNamePrefix0 : ParentEventNamePrefix1), true); TestAssert(parentEvents[i] != nullptr); TestAssert(GetLastError() != ERROR_ALREADY_EXISTS); @@ -332,7 +351,7 @@ bool InitializeChild( { TestCreateMutex( childEvents[i], - BuildName(testName, name, GlobalPrefix, i == 0 ? ChildEventNamePrefix0 : ChildEventNamePrefix1), + BuildName(testName, name, i == 0 ? ChildEventNamePrefix0 : ChildEventNamePrefix1), true); TestAssert(childEvents[i] != nullptr); TestAssert(GetLastError() != ERROR_ALREADY_EXISTS); @@ -400,17 +419,24 @@ bool NameTests() TestAssert(m != nullptr); // Normal name - TestCreateMutex(m, BuildName(testName, name, NamePrefix)); + BuildName(testName, name, NamePrefix); + TestCreateMutex(m, name); TestAssert(m != nullptr); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, NamePrefix))) != nullptr); - TestCreateMutex(m, BuildName(testName, name, SessionPrefix, NamePrefix)); - TestAssert(m != nullptr); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, SessionPrefix, NamePrefix))) != nullptr); - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); - TestAssert(m != nullptr); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix))) != nullptr); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(name)) != nullptr); + if (g_currentSessionOnly) + { + // When creating or opening a mutex scoped to the current session, the prefix ("Local\") is optional + char nameWithExplicitPrefix[MaxPathSize]; + test_strcpy(nameWithExplicitPrefix, CurrentSessionOnlyPrefix); + BuildName(testName, &nameWithExplicitPrefix[STRING_LENGTH(CurrentSessionOnlyPrefix)], NamePrefix); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(nameWithExplicitPrefix)) != nullptr); + TestCreateMutex(m, nameWithExplicitPrefix); + TestAssert(m != nullptr); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(name)) != nullptr); + } - // Name too long. The maximum allowed length depends on the file system, so we're not checking for that. + // Name too long. The maximum allowed path length depends on the file system, so we're not checking for that. + if(g_currentSessionOnly) { char name[257]; memset(name, 'a', STRING_LENGTH(name)); @@ -420,36 +446,49 @@ bool NameTests() TestAssert(GetLastError() == ERROR_FILENAME_EXCED_RANGE); TestAssert(AutoCloseMutexHandle(TestOpenMutex(name)) == nullptr); TestAssert(GetLastError() == ERROR_FILENAME_EXCED_RANGE); + + name[STRING_LENGTH(name) - 1] = '\0'; + TestCreateMutex(m, name); + TestAssert(m != nullptr); + } + else + { + char name[STRING_LENGTH(AllSessionsPrefix) + 257]; + test_strcpy(name, AllSessionsPrefix); + memset(&name[STRING_LENGTH(AllSessionsPrefix)], 'a', STRING_LENGTH(name) - STRING_LENGTH(AllSessionsPrefix)); + name[STRING_LENGTH(name)] = '\0'; + TestCreateMutex(m, name); + TestAssert(m == nullptr); + TestAssert(GetLastError() == ERROR_FILENAME_EXCED_RANGE); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(name)) == nullptr); + TestAssert(GetLastError() == ERROR_FILENAME_EXCED_RANGE); + + name[STRING_LENGTH(name) - 1] = '\0'; + TestCreateMutex(m, name); + TestAssert(m != nullptr); } // Invalid characters in name - TestCreateMutex(m, BuildName(testName, name, InvalidNamePrefix0)); - TestAssert(m == nullptr); - TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, InvalidNamePrefix0))) == nullptr); - TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestCreateMutex(m, BuildName(testName, name, InvalidNamePrefix1)); - TestAssert(m == nullptr); - TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, InvalidNamePrefix1))) == nullptr); - TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestCreateMutex(m, BuildName(testName, name, SessionPrefix, InvalidNamePrefix0)); + BuildName(testName, name, InvalidNamePrefix0); + TestCreateMutex(m, name); TestAssert(m == nullptr); TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, SessionPrefix, InvalidNamePrefix0))) == nullptr); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(name)) == nullptr); TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, InvalidNamePrefix1)); + BuildName(testName, name, InvalidNamePrefix1); + TestCreateMutex(m, name); TestAssert(m == nullptr); TestAssert(GetLastError() == ERROR_INVALID_NAME); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, GlobalPrefix, InvalidNamePrefix1))) == nullptr); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(name)) == nullptr); TestAssert(GetLastError() == ERROR_INVALID_NAME); // Creating a second reference to the same named mutex yields an error indicating that it was opened, not created { - TestCreateMutex(m, BuildName(testName, name, NamePrefix)); + BuildName(testName, name, NamePrefix); + TestCreateMutex(m, name); TestAssert(m != nullptr); AutoCloseMutexHandle m2; - TestCreateMutex(m2, BuildName(testName, name, NamePrefix)); + TestCreateMutex(m2, name); TestAssert(m2 != nullptr); TestAssert(GetLastError() == ERROR_ALREADY_EXISTS); } @@ -462,28 +501,32 @@ bool HeaderMismatchTests() const char *testName = "HeaderMismatchTests"; AutoCloseMutexHandle m, m2; - char name[MaxPathSize]; + char name[MaxPathSize], path[MaxPathSize]; int fd; // Create and hold onto a mutex during this test to create the shared memory directory - TestCreateMutex(m2, BuildName(testName, name, GlobalPrefix, TempNamePrefix)); + TestCreateMutex(m2, BuildName(testName, name, TempNamePrefix)); TestAssert(m2 != nullptr); + // Init name and path for the remaining tests + BuildName(testName, name, HeaderMismatchTestsNamePrefix); + BuildShmFilePath(testName, path, HeaderMismatchTestsNamePrefix); + // Unknown shared memory type - TestAssert(WriteHeaderInfo(BuildGlobalShmFilePath(testName, name, NamePrefix), -1, 1, &fd)); - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestAssert(WriteHeaderInfo(path, g_currentUserOnly, -1, 1, &fd)); + TestCreateMutex(m, name); TestAssert(m == nullptr); TestAssert(GetLastError() == ERROR_INVALID_HANDLE); TestAssert(test_close(fd) == 0); - TestAssert(test_unlink(BuildGlobalShmFilePath(testName, name, NamePrefix)) == 0); + TestAssert(test_unlink(path) == 0); // Mismatched version - TestAssert(WriteHeaderInfo(BuildGlobalShmFilePath(testName, name, NamePrefix), 0, -1, &fd)); - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestAssert(WriteHeaderInfo(path, g_currentUserOnly, 0, -1, &fd)); + TestCreateMutex(m, name); TestAssert(m == nullptr); TestAssert(GetLastError() == ERROR_INVALID_HANDLE); TestAssert(test_close(fd) == 0); - TestAssert(test_unlink(BuildGlobalShmFilePath(testName, name, NamePrefix)) == 0); + TestAssert(test_unlink(path) == 0); return true; } @@ -498,7 +541,7 @@ bool MutualExclusionTests_Parent() char name[MaxPathSize]; AutoCloseMutexHandle m; - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); // Recursive locking with various timeouts @@ -539,7 +582,7 @@ DWORD PALAPI MutualExclusionTests_Child(void *arg = nullptr) char name[MaxPathSize]; AutoCloseMutexHandle m; - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); // lock the mutex YieldToParent(parentEvents, childEvents, ei); // parent attempts to lock/release, and fails @@ -611,23 +654,23 @@ bool LifetimeTests_Parent() char name[MaxPathSize]; AutoCloseMutexHandle m; - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); // create first reference to mutex + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); // create first reference to mutex TestAssert(m != nullptr); - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child creates second reference to mutex using CreateMutex m.Close(); // close first reference - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child closes second reference - TestAssert(!TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(!TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); // create first reference to mutex + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); // create first reference to mutex TestAssert(m != nullptr); - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child creates second reference to mutex using OpenMutex m.Close(); // close first reference - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child closes second reference - TestAssert(!TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(!TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(UninitializeParent(testName, parentEvents)); return true; @@ -646,13 +689,13 @@ DWORD PALAPI LifetimeTests_Child(void *arg = nullptr) AutoCloseMutexHandle m; // ... parent creates first reference to mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); // create second reference to mutex using CreateMutex + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); // create second reference to mutex using CreateMutex TestAssert(m != nullptr); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent closes first reference m.Close(); // close second reference TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent verifies, and creates first reference to mutex again - m = TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix)); // create second reference to mutex using OpenMutex + m = TestOpenMutex(BuildName(testName, name, NamePrefix)); // create second reference to mutex using OpenMutex TestAssert(m != nullptr); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent closes first reference m.Close(); // close second reference @@ -673,11 +716,11 @@ bool LifetimeTests() char name[MaxPathSize]; // Shm file should be created and deleted - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); m.Close(); - TestAssert(!TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(!TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); } // Shm file should not be deleted until last reference is released @@ -702,7 +745,7 @@ bool AbandonTests_Parent() TestAssert(InitializeParent(testName, parentEvents, childEvents)); int ei = 0; - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child locks mutex TestAssert(parentEvents[0].Release()); @@ -742,17 +785,17 @@ bool AbandonTests_Parent() // Since the child abandons the mutex, and a child process may not release the file lock on the shared memory file before // indicating completion to the parent, make sure to delete the shared memory file by repeatedly opening/closing the mutex // until the parent process becomes the last process to reference the mutex and closing it deletes the file. - DWORD startTime = GetTickCount(); + DWORD startTime = (DWORD)minipal_lowres_ticks(); while (true) { m.Close(); - if (!TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))) + if (!TestFileExists(BuildShmFilePath(testName, name, NamePrefix))) { break; } - TestAssert(GetTickCount() - startTime < FailTimeoutMilliseconds); - m = TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestAssert((DWORD)minipal_lowres_ticks() - startTime < FailTimeoutMilliseconds); + m = TestOpenMutex(BuildName(testName, name, NamePrefix)); } return true; @@ -771,7 +814,7 @@ DWORD PALAPI AbandonTests_Child_GracefulExit_Close(void *arg = nullptr) AutoCloseMutexHandle m; // ... parent waits for child to lock mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent waits on mutex @@ -800,7 +843,7 @@ DWORD AbandonTests_Child_GracefulExit_NoClose(void *arg = nullptr) AutoCloseMutexHandle m; // ... parent waits for child to lock mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent waits on mutex @@ -829,7 +872,7 @@ DWORD AbandonTests_Child_AbruptExit(void *arg = nullptr) AutoCloseMutexHandle m; // ... parent waits for child to lock mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent waits on mutex @@ -859,7 +902,7 @@ DWORD AbandonTests_Child_FileLocksNotInherited_Parent_AbruptExit(void *arg = nul AutoCloseMutexHandle m; // ... root parent waits for child to lock mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); @@ -893,7 +936,7 @@ DWORD AbandonTests_Child_FileLocksNotInherited_Child_AbruptExit(void *arg = null AutoCloseMutexHandle m; // ... immediate parent expects child to wait on mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, FailTimeoutMilliseconds) == WAIT_ABANDONED_0); // attempt to lock and see abandoned mutex TestAssert(YieldToParent(parentEvents, childEvents, ei)); // root parent waits on mutex @@ -918,7 +961,7 @@ DWORD PALAPI AbandonTests_Child_TryLock(void *arg) AutoCloseMutexHandle m; // ... parent waits for child to lock mutex - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_TIMEOUT); // try to lock the mutex while the parent holds the lock TestAssert(WaitForSingleObject(m, g_expectedTimeoutMilliseconds) == WAIT_TIMEOUT); @@ -960,7 +1003,7 @@ bool LockAndCloseWithoutThreadExitTests_Parent_CloseOnSameThread() char name[MaxPathSize]; AutoCloseMutexHandle m; - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child locks mutex and closes second reference to mutex on lock-owner thread @@ -971,9 +1014,9 @@ bool LockAndCloseWithoutThreadExitTests_Parent_CloseOnSameThread() TestAssert(m.Release()); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child exits - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); m.Close(); - TestAssert(!TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(!TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(UninitializeParent(testName, parentEvents)); return true; @@ -991,10 +1034,10 @@ DWORD PALAPI LockAndCloseWithoutThreadExitTests_Child_CloseOnSameThread(void *ar char name[MaxPathSize]; // ... parent waits for child to lock and close second reference to mutex - AutoCloseMutexHandle m(TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix))); + AutoCloseMutexHandle m(TestOpenMutex(BuildName(testName, name, NamePrefix))); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix))) != nullptr); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, NamePrefix))) != nullptr); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent waits for child to close last reference to mutex m.Close(); // close mutex on lock-owner thread without releasing lock @@ -1016,7 +1059,7 @@ bool LockAndCloseWithoutThreadExitTests_Parent_CloseOnDifferentThread() char name[MaxPathSize]; AutoCloseMutexHandle m; - TestCreateMutex(m, BuildName(testName, name, GlobalPrefix, NamePrefix)); + TestCreateMutex(m, BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child locks mutex and closes second reference to mutex on lock-owner thread @@ -1025,7 +1068,7 @@ bool LockAndCloseWithoutThreadExitTests_Parent_CloseOnDifferentThread() TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child closes last reference to mutex on non-lock-owner thread TestAssert(WaitForSingleObject(m, 0) == WAIT_TIMEOUT); // attempt to lock and fail m.Close(); - m = TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix)); + m = TestOpenMutex(BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); // child has implicit reference to mutex TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child closes new reference to mutex on lock-owner thread @@ -1033,9 +1076,9 @@ bool LockAndCloseWithoutThreadExitTests_Parent_CloseOnDifferentThread() TestAssert(m.Release()); TestAssert(YieldToChild(parentEvents, childEvents, ei)); // child exits - TestAssert(TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); m.Close(); - TestAssert(!TestFileExists(BuildGlobalShmFilePath(testName, name, NamePrefix))); + TestAssert(!TestFileExists(BuildShmFilePath(testName, name, NamePrefix))); TestAssert(UninitializeParent(testName, parentEvents)); return true; @@ -1053,10 +1096,10 @@ DWORD PALAPI LockAndCloseWithoutThreadExitTests_Child_CloseOnDifferentThread(voi char name[MaxPathSize]; // ... parent waits for child to lock and close second reference to mutex - AutoCloseMutexHandle m(TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix))); + AutoCloseMutexHandle m(TestOpenMutex(BuildName(testName, name, NamePrefix))); TestAssert(m != nullptr); TestAssert(WaitForSingleObject(m, 0) == WAIT_OBJECT_0); - TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix))) != nullptr); + TestAssert(AutoCloseMutexHandle(TestOpenMutex(BuildName(testName, name, NamePrefix))) != nullptr); TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent waits for child to close last reference to mutex // Close the mutex on a thread that is not the lock-owner thread, without releasing the lock @@ -1068,7 +1111,7 @@ DWORD PALAPI LockAndCloseWithoutThreadExitTests_Child_CloseOnDifferentThread(voi m.Abandon(); // mutex is already closed, don't close it again TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent verifies while this lock-owner thread is still active - m = TestOpenMutex(BuildName(testName, name, GlobalPrefix, NamePrefix)); + m = TestOpenMutex(BuildName(testName, name, NamePrefix)); TestAssert(m != nullptr); m.Close(); // close mutex on lock-owner thread without releasing lock TestAssert(YieldToParent(parentEvents, childEvents, ei)); // parent verifies while this thread is still active @@ -1110,14 +1153,24 @@ bool (*const TestList[])() = bool RunTests() { + const bool Bools[] = {false, true}; bool allPassed = true; - for (SIZE_T i = 0; i < ARRAY_SIZE(TestList); ++i) + for (int i = 0; i < ARRAY_SIZE(TestList); i++) { - if (!TestList[i]()) + for (int j = 0; j < ARRAY_SIZE(Bools); j++) { - allPassed = false; + g_currentUserOnly = Bools[j]; + for (int k = 0; k < ARRAY_SIZE(Bools); k++) + { + g_currentSessionOnly = Bools[k]; + if (!TestList[i]()) + { + allPassed = false; + } + } } } + return allPassed; } @@ -1129,7 +1182,7 @@ DWORD PALAPI StressTest(void *arg) { // Run the specified test continuously for the stress duration SIZE_T testIndex = reinterpret_cast(arg); - DWORD startTime = GetTickCount(); + DWORD startTime = (DWORD)minipal_lowres_ticks(); do { ++g_stressTestCounts[testIndex]; @@ -1140,7 +1193,7 @@ DWORD PALAPI StressTest(void *arg) } } while ( InterlockedCompareExchange(&g_stressResult, false, false) == true && - GetTickCount() - startTime < g_stressDurationMilliseconds); + (DWORD)minipal_lowres_ticks() - startTime < g_stressDurationMilliseconds); return 0; } @@ -1189,7 +1242,7 @@ bool StressTests(DWORD durationMinutes) PALTEST(threading_NamedMutex_test1_paltest_namedmutex_test1, "threading/NamedMutex/test1/paltest_namedmutex_test1") { - if (argc < 1 || argc > 4) + if (argc < 1 || argc > 6) { return FAIL; } @@ -1228,10 +1281,17 @@ PALTEST(threading_NamedMutex_test1_paltest_namedmutex_test1, "threading/NamedMut return result; } - // Child test process arguments: [stress] + // Child test process arguments: + // <0|1> /* currentUserOnly */ <0|1> /* currentSessionOnly */ [stress] g_isParent = false; + if (argc < 5) + { + ExitProcess(FAIL); + return FAIL; + } + // Get parent process' ID from argument if (test_sscanf(argv[1], "%u", &g_parentPid) != 1) { @@ -1239,7 +1299,19 @@ PALTEST(threading_NamedMutex_test1_paltest_namedmutex_test1, "threading/NamedMut return FAIL; } - if (argc >= 4 && test_strcmp(argv[3], "stress") == 0) + // Get the current-user-only and current-session-only args + if ((argv[3][0] != '0' && argv[3][0] != '1') || + argv[3][1] != '\0' || + (argv[4][0] != '0' && argv[4][0] != '1') || + argv[4][1] != '\0') + { + ExitProcess(FAIL); + return FAIL; + } + g_currentUserOnly = argv[3][0] != '0'; + g_currentSessionOnly = argv[4][0] != '0'; + + if (argc >= 6 && test_strcmp(argv[5], "stress") == 0) { g_isStress = true; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/NamedMutex/test1/nopal.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/NamedMutex/test1/nopal.cpp index 77665fe69..435f53108 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/NamedMutex/test1/nopal.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/NamedMutex/test1/nopal.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,16 @@ unsigned int test_getpid() return getpid(); } +unsigned int test_getsid() +{ + return getsid(0); +} + +unsigned int test_geteuid() +{ + return geteuid(); +} + int test_kill(unsigned int pid) { return kill(pid, SIGKILL); @@ -41,11 +52,24 @@ bool TestFileExists(const char *path) return true; } -bool WriteHeaderInfo(const char *path, char sharedMemoryType, char version, int *fdRef) +bool WriteHeaderInfo(const char *path, bool currentUserOnly, char sharedMemoryType, char version, int *fdRef) { int fd = open(path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd == -1) return false; + + if (currentUserOnly) + { + int chmodResult; + do + { + chmodResult = chmod(path, S_IRUSR | S_IWUSR); + } while (chmodResult != 0 && errno == EINTR); + + if (chmodResult != 0) + return false; + } + *fdRef = fd; if (ftruncate(fd, getpagesize()) != 0) return false; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/OpenProcess/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/OpenProcess/test1/test1.cpp index 38cd61014..9bcdcb129 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/OpenProcess/test1/test1.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/OpenProcess/test1/test1.cpp @@ -44,7 +44,7 @@ PALTEST(threading_OpenProcess_test1_paltest_openprocess_test1, "threading/OpenPr HANDLE hChildProcess; char rgchDirName[_MAX_DIR]; - char absPathBuf[_MAX_PATH]; + char absPathBuf[MAX_PATH]; char* rgchAbsPathName; BOOL ret = FAIL; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/QueryThreadCycleTime/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/QueryThreadCycleTime/test1/test1.cpp index 2244d54e6..7f4f37e3e 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/QueryThreadCycleTime/test1/test1.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/QueryThreadCycleTime/test1/test1.cpp @@ -56,7 +56,7 @@ PALTEST(threading_QueryThreadCycleTime_test1_paltest_querythreadcycletime_test1, LONG64 x; /* Init is in milliseconds, so we will convert later */ - Init = (LONG64)GetTickCount(); + Init = minipal_lowres_ticks(); x = Init + 3; volatile int counter; do { @@ -65,8 +65,8 @@ PALTEST(threading_QueryThreadCycleTime_test1_paltest_querythreadcycletime_test1, // spin to consume CPU time } - } while (x > GetTickCount()); - Expected += (GetTickCount() - Init) * MSEC_TO_NSEC; + } while (x > minipal_lowres_ticks()); + Expected += (minipal_lowres_ticks() - Init) * MSEC_TO_NSEC; /* Get a second count */ if (!QueryThreadCycleTime(cThread, (PULONG64)&SecondCount)) { diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test1/Sleep.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test1/Sleep.cpp index 3cc3d9244..e48d73c3d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test1/Sleep.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test1/Sleep.cpp @@ -5,13 +5,13 @@ ** ** Source: Sleep.c ** -** Purpose: Test to establish whether the Sleep function stops the thread from +** Purpose: Test to establish whether the Sleep function stops the thread from ** executing for the specified times. ** ** Dependencies: GetSystemTime -** Fail +** Fail ** Trace -** +** ** **=========================================================*/ @@ -32,8 +32,8 @@ PALTEST(threading_Sleep_test1_paltest_sleep_test1, "threading/Sleep/test1/paltes /* Milliseconds of error which are acceptable Function execution time, etc. */ DWORD AcceptableTimeError = 150; - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; DWORD MaxDelta; DWORD TimeDelta; DWORD i; @@ -43,19 +43,13 @@ PALTEST(threading_Sleep_test1_paltest_sleep_test1, "threading/Sleep/test1/paltes return ( FAIL ); } - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - return FAIL; - } - for( i = 0; i < sizeof(SleepTimes) / sizeof(DWORD); i++) { - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); Sleep(SleepTimes[i]); - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + NewTimeStamp = minipal_hires_ticks(); - TimeDelta = NewTimeStamp - OldTimeStamp; + TimeDelta = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); /* For longer intervals use a 10 percent tolerance */ if ((SleepTimes[i] * 0.1) > AcceptableTimeError) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test2/sleep.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test2/sleep.cpp index a4e1b465a..f6a06e1b5 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test2/sleep.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/Sleep/test2/sleep.cpp @@ -5,11 +5,9 @@ ** ** Source: Sleep.c ** -** Purpose: Test to establish whether the Sleep function stops the thread from +** Purpose: Test to establish whether the Sleep function stops the thread from ** executing for the specified times. ** -** Dependencies: GetTickCount -** ** **=========================================================*/ @@ -18,7 +16,7 @@ PALTEST(threading_Sleep_test2_paltest_sleep_test2, "threading/Sleep/test2/paltest_sleep_test2") { - /* + /* * times in 10^(-3) seconds */ @@ -33,8 +31,8 @@ PALTEST(threading_Sleep_test2_paltest_sleep_test2, "threading/Sleep/test2/paltes /* Milliseconds of error which are acceptable Function execution time, etc. */ DWORD AcceptableTimeError = 150; - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; DWORD MaxDelta; DWORD TimeDelta; DWORD i; @@ -44,19 +42,13 @@ PALTEST(threading_Sleep_test2_paltest_sleep_test2, "threading/Sleep/test2/paltes return ( FAIL ); } - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - return FAIL; - } - for( i = 0; i < sizeof(SleepTimes) / sizeof(DWORD); i++) { - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); Sleep(SleepTimes[i]); - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + NewTimeStamp = minipal_hires_ticks(); - TimeDelta = NewTimeStamp - OldTimeStamp; + TimeDelta = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); MaxDelta = SleepTimes[i] + AcceptableTimeError; diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test1/test1.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test1/test1.cpp index 61bdf136b..eeeceecbd 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test1/test1.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test1/test1.cpp @@ -39,8 +39,8 @@ PALTEST(threading_SleepEx_test1_paltest_sleepex_test1, "threading/SleepEx/test1/ {2000, TRUE}, }; - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; DWORD MaxDelta; DWORD TimeDelta; DWORD i; @@ -50,21 +50,15 @@ PALTEST(threading_SleepEx_test1_paltest_sleepex_test1, "threading/SleepEx/test1/ return FAIL; } - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - return FAIL; - } - for (i = 0; i AcceptableTimeError) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test2/test2.cpp index b139e2d85..15e11174b 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test2/test2.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/SleepEx/test2/test2.cpp @@ -14,12 +14,12 @@ #include const int ChildThreadSleepTime = 2000; -const int InterruptTime = 1000; +const int InterruptTime = 1000; /* We need to keep in mind that BSD has a timer resolution of 10ms, so - we need to adjust our delta to keep that in mind. Besides we need some - tolerance to account for different scheduling strategies, heavy load + we need to adjust our delta to keep that in mind. Besides we need some + tolerance to account for different scheduling strategies, heavy load scenarios, etc. - + Real-world data also tells us we can expect a big difference between values when run on real iron vs run in a hypervisor. @@ -50,15 +50,15 @@ PALTEST(threading_SleepEx_test2_paltest_sleepex_test2, "threading/SleepEx/test2/ } /* - On some platforms (e.g. FreeBSD 4.9) the first call to some synch objects - (such as conditions) involves some pthread internal initialization that + On some platforms (e.g. FreeBSD 4.9) the first call to some synch objects + (such as conditions) involves some pthread internal initialization that can make the first wait slighty longer, potentially going above the acceptable delta for this test. Let's add a dummy wait to preinitialize internal structures */ Sleep(100); - - /* + + /* * Check that Queueing an APC in the middle of a sleep does interrupt * it, if it's in an alertable state. */ @@ -73,12 +73,12 @@ PALTEST(threading_SleepEx_test2_paltest_sleepex_test2, "threading/SleepEx/test2/ if (dwAvgDelta > AcceptableDelta) { Fail("Expected thread to sleep for %d ms (and get interrupted).\n" - "Average delta: %u ms, acceptable delta: %u\n", + "Average delta: %u ms, acceptable delta: %u\n", InterruptTime, dwAvgDelta, AcceptableDelta); } - /* - * Check that Queueing an APC in the middle of a sleep does NOT interrupt + /* + * Check that Queueing an APC in the middle of a sleep does NOT interrupt * it, if it is not in an alertable state. */ dwAvgDelta = 0; @@ -92,7 +92,7 @@ PALTEST(threading_SleepEx_test2_paltest_sleepex_test2, "threading/SleepEx/test2/ if (dwAvgDelta > AcceptableDelta) { Fail("Expected thread to sleep for %d ms (and not be interrupted).\n" - "Average delta: %u ms, acceptable delta: %u\n", + "Average delta: %u ms, acceptable delta: %u\n", ChildThreadSleepTime, dwAvgDelta, AcceptableDelta); } @@ -108,7 +108,7 @@ void RunTest_SleepEx_test2(BOOL AlertThread) s_preWaitTimestampRecorded = false; hThread = CreateThread( NULL, - 0, + 0, (LPTHREAD_START_ROUTINE)SleeperProc_SleepEx_test2, (LPVOID) AlertThread, 0, @@ -141,7 +141,7 @@ void RunTest_SleepEx_test2(BOOL AlertThread) ret = WaitForSingleObject(hThread, INFINITE); if (ret == WAIT_FAILED) { - Fail("Unable to wait on child thread!\nGetLastError returned %d.", + Fail("Unable to wait on child thread!\nGetLastError returned %d.", GetLastError()); } } @@ -155,25 +155,19 @@ VOID PALAPI APCFunc_SleepEx_test2(ULONG_PTR dwParam) /* Entry Point for child thread. */ DWORD PALAPI SleeperProc_SleepEx_test2(LPVOID lpParameter) { - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; BOOL Alertable; DWORD ret; Alertable = (BOOL)(SIZE_T) lpParameter; - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - return FAIL; - } - - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); s_preWaitTimestampRecorded = true; ret = SleepEx(ChildThreadSleepTime, Alertable); - - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + + NewTimeStamp = minipal_hires_ticks(); if (Alertable && ret != WAIT_IO_COMPLETION) { @@ -186,7 +180,7 @@ DWORD PALAPI SleeperProc_SleepEx_test2(LPVOID lpParameter) } - ThreadSleepDelta = NewTimeStamp - OldTimeStamp; + ThreadSleepDelta = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); return 0; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test2/test2.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test2/test2.cpp index 96124434e..776cd621d 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test2/test2.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test2/test2.cpp @@ -55,7 +55,7 @@ PALTEST(threading_WaitForMultipleObjectsEx_test2_paltest_waitformultipleobjectse RunTest_WFMO_test2(TRUE); // Make sure that the wait returns in time greater than interrupt and less than // wait timeout - if ( + if ( ((ThreadWaitDelta_WFMO_test2 >= ChildThreadWaitTime) && (ThreadWaitDelta_WFMO_test2 - ChildThreadWaitTime) > TOLERANCE) || (( ThreadWaitDelta_WFMO_test2 < InterruptTime) && (InterruptTime - ThreadWaitDelta_WFMO_test2) > TOLERANCE) ) @@ -140,8 +140,8 @@ VOID PALAPI APCFunc_WFMO_test2(ULONG_PTR dwParam) DWORD PALAPI WaiterProc_WFMO_test2(LPVOID lpParameter) { HANDLE Semaphore; - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; BOOL Alertable; DWORD ret; @@ -156,19 +156,13 @@ DWORD PALAPI WaiterProc_WFMO_test2(LPVOID lpParameter) Alertable = (BOOL)(SIZE_T) lpParameter; - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - Fail("Failed to query performance frequency!"); - } - - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); s_preWaitTimestampRecorded = true; ret = WaitForMultipleObjectsEx(1, &Semaphore, FALSE, ChildThreadWaitTime, Alertable); - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + NewTimeStamp = minipal_hires_ticks(); if (Alertable && ret != WAIT_IO_COMPLETION) @@ -182,7 +176,7 @@ DWORD PALAPI WaiterProc_WFMO_test2(LPVOID lpParameter) "Expected return of WAIT_TIMEOUT, got %d.\n", ret); } - ThreadWaitDelta_WFMO_test2 = NewTimeStamp - OldTimeStamp; + ThreadWaitDelta_WFMO_test2 = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); ret = CloseHandle(Semaphore); if (!ret) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.cpp index c98659db8..66ae05bf2 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.cpp @@ -5,7 +5,7 @@ ** ** Source: WFSOExMutex.c ** -** Purpose: Tests a child thread in the middle of a +** Purpose: Tests a child thread in the middle of a ** WaitForSingleObjectEx call will be interrupted by QueueUserAPC ** if the alert flag was set. ** @@ -31,31 +31,31 @@ static volatile bool s_preWaitTimestampRecorded = false; PALTEST(threading_WaitForSingleObject_WFSOExMutexTest_paltest_waitforsingleobject_wfsoexmutextest, "threading/WaitForSingleObject/WFSOExMutexTest/paltest_waitforsingleobject_wfsoexmutextest") { int ret=0; - + if (0 != (PAL_Initialize(argc, argv))) { return FAIL; } /* - On some platforms (e.g. FreeBSD 4.9) the first call to some synch objects - (such as conditions) involves some pthread internal initialization that + On some platforms (e.g. FreeBSD 4.9) the first call to some synch objects + (such as conditions) involves some pthread internal initialization that can make the first wait slighty longer, potentially going above the acceptable delta for this test. Let's add a dummy wait to preinitialize internal structures */ Sleep(100); - + /* - The state of a mutex object is signaled when it is not owned by any thread. - The creating thread can use the bInitialOwner flag to request immediate ownership - of the mutex. Otherwise, a thread must use one of the wait functions to request - ownership. When the mutex's state is signaled, one waiting thread is granted - ownership, the mutex's state changes to nonsignaled, and the wait function returns. - Only one thread can own a mutex at any given time. The owning thread uses the + The state of a mutex object is signaled when it is not owned by any thread. + The creating thread can use the bInitialOwner flag to request immediate ownership + of the mutex. Otherwise, a thread must use one of the wait functions to request + ownership. When the mutex's state is signaled, one waiting thread is granted + ownership, the mutex's state changes to nonsignaled, and the wait function returns. + Only one thread can own a mutex at any given time. The owning thread uses the ReleaseMutex function to release its ownership. */ - + /* Create a mutex that is not in the signalled state */ hMutex_WFSOExMutexTest = CreateMutex(NULL, //No security attributes TRUE, //Iniitally owned @@ -66,7 +66,7 @@ PALTEST(threading_WaitForSingleObject_WFSOExMutexTest_paltest_waitforsingleobjec Fail("Failed to create mutex! GetLastError returned %d.\n", GetLastError()); } - /* + /* * Check that Queueing an APC in the middle of a wait does interrupt * it, if it's in an alertable state. */ @@ -75,25 +75,25 @@ PALTEST(threading_WaitForSingleObject_WFSOExMutexTest_paltest_waitforsingleobjec if ((ThreadWaitDelta_WFSOExMutexTest - InterruptTime) > AcceptableDelta) { Fail("Expected thread to wait for %d ms (and get interrupted).\n" - "Thread waited for %d ms! (Acceptable delta: %d)\n", + "Thread waited for %d ms! (Acceptable delta: %d)\n", InterruptTime, ThreadWaitDelta_WFSOExMutexTest, AcceptableDelta); } - /* - * Check that Queueing an APC in the middle of a wait does NOT interrupt + /* + * Check that Queueing an APC in the middle of a wait does NOT interrupt * it, if it is not in an alertable state. */ RunTest_WFSOExMutexTest(FALSE); if ((ThreadWaitDelta_WFSOExMutexTest - ChildThreadWaitTime) > AcceptableDelta) { Fail("Expected thread to wait for %d ms (and not be interrupted).\n" - "Thread waited for %d ms! (Acceptable delta: %d)\n", + "Thread waited for %d ms! (Acceptable delta: %d)\n", ChildThreadWaitTime, ThreadWaitDelta_WFSOExMutexTest, AcceptableDelta); } - + //Release Mutex ret = ReleaseMutex(hMutex_WFSOExMutexTest); if (0==ret) @@ -109,14 +109,14 @@ PALTEST(threading_WaitForSingleObject_WFSOExMutexTest_paltest_waitforsingleobjec Fail("Unable to close handle to Mutex!\n" "GetLastError returned %d\n", GetLastError()); } - + PAL_Terminate(); return PASS; } void RunTest_WFSOExMutexTest(BOOL AlertThread) { - + HANDLE hThread = 0; DWORD dwThreadId = 0; @@ -124,7 +124,7 @@ void RunTest_WFSOExMutexTest(BOOL AlertThread) s_preWaitTimestampRecorded = false; hThread = CreateThread( NULL, - 0, + 0, (LPTHREAD_START_ROUTINE)WaiterProc_WFSOExMutexTest, (LPVOID) AlertThread, 0, @@ -146,58 +146,52 @@ void RunTest_WFSOExMutexTest(BOOL AlertThread) Sleep(InterruptTime); ret = QueueUserAPC(APCFunc_WFSOExMutexTest, hThread, 0); - + if (ret == 0) { - Fail("QueueUserAPC failed! GetLastError returned %d\n", + Fail("QueueUserAPC failed! GetLastError returned %d\n", GetLastError()); } - + ret = WaitForSingleObject(hThread, INFINITE); - + if (ret == WAIT_FAILED) { - Fail("Unable to wait on child thread!\nGetLastError returned %d.\n", + Fail("Unable to wait on child thread!\nGetLastError returned %d.\n", GetLastError()); } - + if (0==CloseHandle(hThread)) { - Trace("Could not close Thread handle\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } + Trace("Could not close Thread handle\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); + } } /* Function doesn't do anything, just needed to interrupt the wait*/ VOID PALAPI APCFunc_WFSOExMutexTest(ULONG_PTR dwParam) -{ +{ } /* Entry Point for child thread. */ DWORD PALAPI WaiterProc_WFSOExMutexTest(LPVOID lpParameter) { - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; BOOL Alertable; DWORD ret; Alertable = (BOOL)(SIZE_T) lpParameter; - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - Fail("Failed to query performance frequency!"); - } - - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); s_preWaitTimestampRecorded = true; - ret = WaitForSingleObjectEx( hMutex_WFSOExMutexTest, - ChildThreadWaitTime, + ret = WaitForSingleObjectEx( hMutex_WFSOExMutexTest, + ChildThreadWaitTime, Alertable); - - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + + NewTimeStamp = minipal_hires_ticks(); if (Alertable && ret != WAIT_IO_COMPLETION) { @@ -210,8 +204,8 @@ DWORD PALAPI WaiterProc_WFSOExMutexTest(LPVOID lpParameter) "Expected return of WAIT_TIMEOUT, got %d.\n", ret); } - ThreadWaitDelta_WFSOExMutexTest = NewTimeStamp - OldTimeStamp; - + ThreadWaitDelta_WFSOExMutexTest = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); + return 0; } diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExSemaphoreTest/WFSOExSemaphoreTest.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExSemaphoreTest/WFSOExSemaphoreTest.cpp index 3859e4abd..b67776597 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExSemaphoreTest/WFSOExSemaphoreTest.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExSemaphoreTest/WFSOExSemaphoreTest.cpp @@ -133,17 +133,11 @@ VOID PALAPI APCFunc_WFSOExSemaphoreTest(ULONG_PTR dwParam) DWORD PALAPI WaiterProc_WFSOExSemaphoreTest(LPVOID lpParameter) { HANDLE hSemaphore; - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; BOOL Alertable; DWORD ret; - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - Fail("Failed to query performance frequency!"); - } - /* Create a semaphore that is not in the signalled state */ hSemaphore = CreateSemaphoreExW(NULL, 0, 1, NULL, 0, 0); @@ -155,14 +149,14 @@ DWORD PALAPI WaiterProc_WFSOExSemaphoreTest(LPVOID lpParameter) Alertable = (BOOL)(SIZE_T) lpParameter; - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); s_preWaitTimestampRecorded = true; ret = WaitForSingleObjectEx( hSemaphore, ChildThreadWaitTime, Alertable); - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + NewTimeStamp = minipal_hires_ticks(); if (Alertable && ret != WAIT_IO_COMPLETION) @@ -177,7 +171,7 @@ DWORD PALAPI WaiterProc_WFSOExSemaphoreTest(LPVOID lpParameter) } - ThreadWaitDelta_WFSOExSemaphoreTest = NewTimeStamp - OldTimeStamp; + ThreadWaitDelta_WFSOExSemaphoreTest = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); ret = CloseHandle(hSemaphore); if (!ret) diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExThreadTest/WFSOExThreadTest.cpp b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExThreadTest/WFSOExThreadTest.cpp index 078ae5313..eaf0433cc 100644 --- a/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExThreadTest/WFSOExThreadTest.cpp +++ b/Procfiler/src/cpp/3rdparty/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExThreadTest/WFSOExThreadTest.cpp @@ -5,7 +5,7 @@ ** ** Source: WFSOExThreadTest.c ** -** Purpose: Tests a child thread in the middle of a +** Purpose: Tests a child thread in the middle of a ** WaitForSingleObjectEx call will be interrupted by QueueUserAPC ** if the alert flag was set. ** @@ -17,7 +17,7 @@ /*Based on SleepEx/test2 */ const int ChildThreadWaitTime = 4000; -const int InterruptTime = 2000; +const int InterruptTime = 2000; const DWORD AcceptableDelta = 300; void RunTest_WFSOExThreadTest(BOOL AlertThread); @@ -36,15 +36,15 @@ PALTEST(threading_WaitForSingleObject_WFSOExThreadTest_paltest_waitforsingleobje } /* - On some platforms (e.g. FreeBSD 4.9) the first call to some synch objects - (such as conditions) involves some pthread internal initialization that + On some platforms (e.g. FreeBSD 4.9) the first call to some synch objects + (such as conditions) involves some pthread internal initialization that can make the first wait slighty longer, potentially going above the acceptable delta for this test. Let's add a dummy wait to preinitialize internal structures */ Sleep(100); - /* + /* * Check that Queueing an APC in the middle of a wait does interrupt * it, if it's in an alertable state. */ @@ -53,20 +53,20 @@ PALTEST(threading_WaitForSingleObject_WFSOExThreadTest_paltest_waitforsingleobje if (abs(ThreadWaitDelta_WFSOExThreadTest - InterruptTime) > AcceptableDelta) { Fail("Expected thread to wait for %d ms (and get interrupted).\n" - "Thread waited for %d ms! (Acceptable delta: %d)\n", + "Thread waited for %d ms! (Acceptable delta: %d)\n", InterruptTime, ThreadWaitDelta_WFSOExThreadTest, AcceptableDelta); } - /* - * Check that Queueing an APC in the middle of a wait does NOT interrupt + /* + * Check that Queueing an APC in the middle of a wait does NOT interrupt * it, if it is not in an alertable state. */ RunTest_WFSOExThreadTest(FALSE); if (abs(ThreadWaitDelta_WFSOExThreadTest - ChildThreadWaitTime) > AcceptableDelta) { Fail("Expected thread to wait for %d ms (and not be interrupted).\n" - "Thread waited for %d ms! (Acceptable delta: %d)\n", + "Thread waited for %d ms! (Acceptable delta: %d)\n", ChildThreadWaitTime, ThreadWaitDelta_WFSOExThreadTest, AcceptableDelta); } @@ -81,10 +81,10 @@ void RunTest_WFSOExThreadTest(BOOL AlertThread) DWORD dwThreadId = 0; int ret; - //Create thread + //Create thread s_preWaitTimestampRecorded = false; hThread = CreateThread( NULL, - 0, + 0, (LPTHREAD_START_ROUTINE)WaiterProc_WFSOExThreadTest, (LPVOID) AlertThread, 0, @@ -108,48 +108,48 @@ void RunTest_WFSOExThreadTest(BOOL AlertThread) ret = QueueUserAPC(APCFunc_WFSOExThreadTest, hThread, 0); if (ret == 0) { - Fail("QueueUserAPC failed! GetLastError returned %d\n", + Fail("QueueUserAPC failed! GetLastError returned %d\n", GetLastError()); } - + ret = WaitForSingleObject(hThread, INFINITE); if (ret == WAIT_FAILED) { - Fail("Unable to wait on child thread!\nGetLastError returned %d.\n", + Fail("Unable to wait on child thread!\nGetLastError returned %d.\n", GetLastError()); } if (0==CloseHandle(hThread)) { - Trace("Could not close Thread handle\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } + Trace("Could not close Thread handle\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); + } } /* Function doesn't do anything, just needed to interrupt the wait*/ VOID PALAPI APCFunc_WFSOExThreadTest(ULONG_PTR dwParam) -{ +{ } /* Entry Point for child thread. */ DWORD PALAPI WaiterProc_WFSOExThreadTest(LPVOID lpParameter) { HANDLE hWaitThread; - UINT64 OldTimeStamp; - UINT64 NewTimeStamp; + int64_t OldTimeStamp; + int64_t NewTimeStamp; BOOL Alertable; DWORD ret; DWORD dwThreadId = 0; /* -When a thread terminates, the thread object attains a signaled state, +When a thread terminates, the thread object attains a signaled state, satisfying any threads that were waiting on the object. */ /* Create a thread that does not return immediately to maintain a non signaled test*/ - hWaitThread = CreateThread( NULL, - 0, + hWaitThread = CreateThread( NULL, + 0, (LPTHREAD_START_ROUTINE)WorkerThread_WFSOExThreadTest, NULL, 0, @@ -163,20 +163,14 @@ satisfying any threads that were waiting on the object. Alertable = (BOOL)(SIZE_T) lpParameter; - LARGE_INTEGER performanceFrequency; - if (!QueryPerformanceFrequency(&performanceFrequency)) - { - Fail("Failed to query performance frequency!"); - } - - OldTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + OldTimeStamp = minipal_hires_ticks(); s_preWaitTimestampRecorded = true; - ret = WaitForSingleObjectEx( hWaitThread, - ChildThreadWaitTime, + ret = WaitForSingleObjectEx( hWaitThread, + ChildThreadWaitTime, Alertable); - - NewTimeStamp = GetHighPrecisionTimeStamp(performanceFrequency); + + NewTimeStamp = minipal_hires_ticks(); if (Alertable && ret != WAIT_IO_COMPLETION) @@ -190,7 +184,7 @@ satisfying any threads that were waiting on the object. "Expected return of WAIT_TIMEOUT, got %d.\n", ret); } - ThreadWaitDelta_WFSOExThreadTest = NewTimeStamp - OldTimeStamp; + ThreadWaitDelta_WFSOExThreadTest = (NewTimeStamp - OldTimeStamp) / (minipal_hires_tick_frequency() / 1000); ret = CloseHandle(hWaitThread); if (!ret) @@ -205,7 +199,7 @@ satisfying any threads that were waiting on the object. void WorkerThread_WFSOExThreadTest(void) { - + //Make the worker thread sleep to test WFSOEx Functionality Sleep(2*ChildThreadWaitTime); diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/gen-dactable-rva.sh b/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/gen-dactable-rva.sh old mode 100644 new mode 100755 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/preptests.sh b/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/preptests.sh old mode 100644 new mode 100755 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/setup-ubuntuvm.sh b/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/setup-ubuntuvm.sh old mode 100644 new mode 100755 diff --git a/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/smarty.sh b/Procfiler/src/cpp/3rdparty/coreclr/pal/tools/smarty.sh old mode 100644 new mode 100755 diff --git a/Procfiler/src/cpp/offline/CMakeLists.txt b/Procfiler/src/cpp/offline/CMakeLists.txt index 424dd18b1..47f4b64d3 100644 --- a/Procfiler/src/cpp/offline/CMakeLists.txt +++ b/Procfiler/src/cpp/offline/CMakeLists.txt @@ -40,6 +40,12 @@ set(SOURCES corprofiler/shadowstack/serializers/DebugShadowStackSerializer.h corprofiler/shadowstack/utils.cpp corprofiler/shadowstack/EventsWithThreadId.cpp + ../shared/info/sigparser/sigparser.h + ../shared/info/sigparser/sigparser.cpp + ../shared/info/sigparser/sigparserimpl.hpp + corprofiler/objects/ObjectsManager.cpp + corprofiler/objects/ObjectsManager.h + ../shared/util/MetadataCookie.hpp ) include_directories(../3rdparty/coreclr/pal/prebuilt/inc) diff --git a/Procfiler/src/cpp/offline/ClassFactory.cpp b/Procfiler/src/cpp/offline/ClassFactory.cpp index d45c9db6c..276033049 100644 --- a/Procfiler/src/cpp/offline/ClassFactory.cpp +++ b/Procfiler/src/cpp/offline/ClassFactory.cpp @@ -30,7 +30,7 @@ ULONG STDMETHODCALLTYPE ClassFactory::AddRef() ULONG STDMETHODCALLTYPE ClassFactory::Release() { - int count = std::atomic_fetch_sub(&this->refCount, 1) - 1; + const int count = std::atomic_fetch_sub(&this->refCount, 1) - 1; if (count <= 0) { delete this; @@ -47,7 +47,7 @@ HRESULT STDMETHODCALLTYPE ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFI return CLASS_E_NOAGGREGATION; } - auto p = new ProcfilerCorProfilerCallback(new ProcfilerLogger()); + const auto p = new ProcfilerCorProfilerCallback(new ProcfilerLogger()); return p->QueryInterface(riid, ppvObject); } diff --git a/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.cpp b/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.cpp index 8b88d79d2..6a847a940 100644 --- a/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.cpp @@ -1,9 +1,13 @@ #include "ProcfilerCorProfilerCallback.h" #include #include + +#include "clr/profilerstring.hpp" #include "shadowstack/serializers/BinaryShadowStackSerializer.h" #include "shadowstack/serializers/DebugShadowStackSerializer.h" #include "shadowstack/serializers/EventPipeShadowStackSerializer.h" +#include "sigparser/sigparser.h" +#include "sigparser/sigparserimpl.hpp" ProcfilerCorProfilerCallback* ourCallback; @@ -11,19 +15,33 @@ ProcfilerCorProfilerCallback* GetCallbackInstance() { return ourCallback; } -void StaticHandleFunctionEnter2(FunctionID functionId) { - GetCallbackInstance()->HandleFunctionEnter2(functionId); +void StaticHandleFunctionEnter(const FunctionID functionId) { + GetCallbackInstance()->HandleFunctionEnter(functionId); } -void StaticHandleFunctionLeave2(FunctionID functionId) { - GetCallbackInstance()->HandleFunctionLeave2(functionId); +void StaticHandleFunctionLeave(const FunctionID functionId) { + GetCallbackInstance()->HandleFunctionLeave(functionId); } -void StaticHandleFunctionTailCall(FunctionID functionId) { +void StaticHandleFunctionTailCall(const FunctionID functionId) { GetCallbackInstance()->HandleFunctionTailCall(functionId); } -int64_t ProcfilerCorProfilerCallback::GetCurrentTimestamp() { +void StaticHandleFunctionEnter2(FunctionID funcId, UINT_PTR clientData, COR_PRF_FRAME_INFO func, + COR_PRF_FUNCTION_ARGUMENT_INFO* argumentInfo) { + GetCallbackInstance()->HandleFunctionEnter2(funcId, argumentInfo); +} + +void StaticHandleFunctionLeave2(FunctionID funcId, UINT_PTR clientData, COR_PRF_FRAME_INFO func, + COR_PRF_FUNCTION_ARGUMENT_RANGE* retvalRange) { + GetCallbackInstance()->HandleFunctionLeave2(funcId); +} + +void StaticHandleFunctionTailCall2(FunctionID funcId, UINT_PTR clientData, COR_PRF_FRAME_INFO func) { + GetCallbackInstance()->HandleFunctionTailCall2(funcId); +} + +int64_t ProcfilerCorProfilerCallback::GetCurrentTimestamp() const { LARGE_INTEGER value; if (!QueryPerformanceCounter2(&value)) { @@ -34,28 +52,41 @@ int64_t ProcfilerCorProfilerCallback::GetCurrentTimestamp() { return value.QuadPart; } -void ProcfilerCorProfilerCallback::HandleFunctionEnter2(FunctionID funcId) { - auto timestamp = GetCurrentTimestamp(); +void ProcfilerCorProfilerCallback::HandleFunctionEnter(const FunctionID funcId) const { + const auto timestamp = GetCurrentTimestamp(); myShadowStack->AddFunctionEnter(funcId, GetCurrentManagedThreadId(), timestamp); } -void ProcfilerCorProfilerCallback::HandleFunctionLeave2(FunctionID funcId) { - auto timestamp = GetCurrentTimestamp(); +void ProcfilerCorProfilerCallback::HandleFunctionLeave(const FunctionID funcId) const { + const auto timestamp = GetCurrentTimestamp(); myShadowStack->AddFunctionFinished(funcId, GetCurrentManagedThreadId(), timestamp); } -void ProcfilerCorProfilerCallback::HandleFunctionTailCall(FunctionID funcId) { - auto timestamp = GetCurrentTimestamp(); +void ProcfilerCorProfilerCallback::HandleFunctionTailCall(const FunctionID funcId) const { + const auto timestamp = GetCurrentTimestamp(); myShadowStack->AddFunctionFinished(funcId, GetCurrentManagedThreadId(), timestamp); } -ICorProfilerInfo15* ProcfilerCorProfilerCallback::GetProfilerInfo() { +void ProcfilerCorProfilerCallback::HandleFunctionEnter2(FunctionID funcId, + COR_PRF_FUNCTION_ARGUMENT_INFO* argumentInfo) const { + HandleFunctionEnter(funcId); +} + +void ProcfilerCorProfilerCallback::HandleFunctionLeave2(const FunctionID funcId) const { + HandleFunctionLeave(funcId); +} + +void ProcfilerCorProfilerCallback::HandleFunctionTailCall2(const FunctionID funcId) const { + HandleFunctionTailCall(funcId); +} + +ICorProfilerInfo15* ProcfilerCorProfilerCallback::GetProfilerInfo() const { return myProfilerInfo; } HRESULT ProcfilerCorProfilerCallback::Initialize(IUnknown* pICorProfilerInfoUnk) { myLogger->LogInformation("Started initializing CorProfiler callback"); - void** ptr = reinterpret_cast(&this->myProfilerInfo); + const auto ptr = reinterpret_cast(&this->myProfilerInfo); HRESULT result = pICorProfilerInfoUnk->QueryInterface(IID_ICorProfilerInfo15, ptr); if (FAILED(result)) { @@ -65,18 +96,32 @@ HRESULT ProcfilerCorProfilerCallback::Initialize(IUnknown* pICorProfilerInfoUnk) InitializeShadowStack(); + const auto produceObjectBinStacks = IsEnvVarTrue(produceObjectBinStacksEnv); + DWORD eventMask = COR_PRF_MONITOR_ENTERLEAVE | COR_PRF_MONITOR_EXCEPTIONS; + if (produceObjectBinStacks) { + eventMask |= COR_PRF_ENABLE_FUNCTION_ARGS; + } + result = myProfilerInfo->SetEventMask(eventMask); if (FAILED(result)) { myLogger->LogInformation("Failed to set event mask: " + std::to_string(result)); return E_FAIL; } - result = myProfilerInfo->SetEnterLeaveFunctionHooks( - StaticHandleFunctionEnter2, - StaticHandleFunctionLeave2, - StaticHandleFunctionTailCall - ); + if (produceObjectBinStacks) { + result = myProfilerInfo->SetEnterLeaveFunctionHooks2( + StaticHandleFunctionEnter2, + StaticHandleFunctionLeave2, + StaticHandleFunctionTailCall2 + ); + } else { + result = myProfilerInfo->SetEnterLeaveFunctionHooks( + StaticHandleFunctionEnter, + StaticHandleFunctionLeave, + StaticHandleFunctionTailCall + ); + } if (FAILED(result)) { myLogger->LogInformation("Failed to set enter-leave hooks: " + std::to_string(result)); @@ -87,18 +132,29 @@ HRESULT ProcfilerCorProfilerCallback::Initialize(IUnknown* pICorProfilerInfoUnk) return S_OK; } +HRESULT ProcfilerCorProfilerCallback::MovedReferences(ULONG cMovedObjectIDRanges, + ObjectID* oldObjectIDRangeStart, + ObjectID* newObjectIDRangeStart, + ULONG* cObjectIDRangeLength) { + return S_OK; +} + +HRESULT ProcfilerCorProfilerCallback::ObjectAllocated(ObjectID objectId, ClassID classId) { + return S_OK; +} + void ProcfilerCorProfilerCallback::InitializeShadowStack() { - auto onlineSerialization = IsEnvVarTrue(onlineSerializationEnv); + const auto onlineSerialization = IsEnvVarTrue(onlineSerializationEnv); myShadowStack = new ShadowStack(this->myProfilerInfo, myLogger, onlineSerialization); if (onlineSerialization) { myShadowStackSerializer = new ShadowStackSerializerStub(); } else { - if (IsEnvVarDefined(binaryStackSavePath)) { + if (IsEnvVarDefined(binaryStackSavePathEnv)) { myShadowStackSerializer = new BinaryShadowStackSerializer(myProfilerInfo, myLogger); - } else if (IsEnvVarDefined(shadowStackDebugSavePath)) { + } else if (IsEnvVarDefined(shadowStackDebugSavePathEnv)) { myShadowStackSerializer = new DebugShadowStackSerializer(myProfilerInfo, myLogger); - } else if (IsEnvVarDefined(eventPipeSaveShadowStack)) { + } else if (IsEnvVarDefined(eventPipeSaveShadowStackEnv)) { myShadowStackSerializer = new EventPipeShadowStackSerializer(myProfilerInfo, myLogger); } else { myShadowStackSerializer = new ShadowStackSerializerStub(); @@ -108,7 +164,7 @@ void ProcfilerCorProfilerCallback::InitializeShadowStack() { myShadowStackSerializer->Init(); } -HRESULT ProcfilerCorProfilerCallback::ExceptionCatcherEnter(FunctionID functionId, ObjectID objectId) { +HRESULT ProcfilerCorProfilerCallback::ExceptionCatcherEnter(const FunctionID functionId, ObjectID objectId) { myShadowStack->HandleExceptionCatchEnter(functionId, GetCurrentManagedThreadId(), GetCurrentTimestamp()); return S_OK; } @@ -140,10 +196,8 @@ HRESULT ProcfilerCorProfilerCallback::Shutdown() { return S_OK; } -ProcfilerCorProfilerCallback::ProcfilerCorProfilerCallback(ProcfilerLogger* logger) : - myRefCount(0), - myProfilerInfo(nullptr), - myLogger(logger) { +ProcfilerCorProfilerCallback::ProcfilerCorProfilerCallback(ProcfilerLogger* logger) : myRefCount(0), + myProfilerInfo(nullptr), myLogger(logger) { ourCallback = this; myShadowStack = nullptr; myShadowStackSerializer = nullptr; @@ -328,17 +382,6 @@ HRESULT ProcfilerCorProfilerCallback::RuntimeThreadResumed(ThreadID threadId) { return S_OK; } -HRESULT ProcfilerCorProfilerCallback::MovedReferences(ULONG cMovedObjectIDRanges, - ObjectID* oldObjectIDRangeStart, - ObjectID* newObjectIDRangeStart, - ULONG* cObjectIDRangeLength) { - return S_OK; -} - -HRESULT ProcfilerCorProfilerCallback::ObjectAllocated(ObjectID objectId, ClassID classId) { - return S_OK; -} - HRESULT ProcfilerCorProfilerCallback::ObjectsAllocatedByClass(ULONG cClassCount, ClassID* classIds, ULONG* cObjects) { return S_OK; } @@ -582,12 +625,12 @@ ProcfilerCorProfilerCallback::~ProcfilerCorProfilerCallback() { delete myShadowStack; myShadowStack = nullptr; - + delete myShadowStackSerializer; myShadowStackSerializer = nullptr; } -DWORD ProcfilerCorProfilerCallback::GetCurrentManagedThreadId() { +DWORD ProcfilerCorProfilerCallback::GetCurrentManagedThreadId() const { ThreadID threadId; myProfilerInfo->GetCurrentThreadID(&threadId); @@ -625,11 +668,11 @@ ULONG STDMETHODCALLTYPE ProcfilerCorProfilerCallback::AddRef() { } ULONG STDMETHODCALLTYPE ProcfilerCorProfilerCallback::Release() { - int count = std::atomic_fetch_sub(&this->myRefCount, 1) - 1; + const int count = std::atomic_fetch_sub(&this->myRefCount, 1) - 1; if (count <= 0) { delete this; } return count; -} \ No newline at end of file +} diff --git a/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.h b/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.h index 0af970348..8e4a97787 100644 --- a/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.h +++ b/Procfiler/src/cpp/offline/corprofiler/ProcfilerCorProfilerCallback.h @@ -4,30 +4,34 @@ #include "cor.h" #include "corprof.h" #include "./shadowstack/ShadowStack.h" +#include "./objects/ObjectsManager.h" #include "shadowstack/serializers/ShadowStackSerializer.h" #include -class ProcfilerCorProfilerCallback : public ICorProfilerCallback11 { -private: +class ProcfilerCorProfilerCallback final : public ICorProfilerCallback11 { ProcfilerLogger* myLogger; ICorProfilerInfo15* myProfilerInfo; std::atomic myRefCount; ShadowStack* myShadowStack; ShadowStackSerializer* myShadowStackSerializer; - DWORD GetCurrentManagedThreadId(); - int64_t GetCurrentTimestamp(); + DWORD GetCurrentManagedThreadId() const; + int64_t GetCurrentTimestamp() const; void InitializeShadowStack(); public: explicit ProcfilerCorProfilerCallback(ProcfilerLogger* logger); ~ProcfilerCorProfilerCallback(); - ICorProfilerInfo15* GetProfilerInfo(); + ICorProfilerInfo15* GetProfilerInfo() const; - void HandleFunctionEnter2(FunctionID funcId); - void HandleFunctionLeave2(FunctionID funcId); - void HandleFunctionTailCall(FunctionID funcId); + void HandleFunctionEnter(FunctionID funcId) const; + void HandleFunctionLeave(FunctionID funcId) const; + void HandleFunctionTailCall(FunctionID funcId) const; + + void HandleFunctionEnter2(FunctionID funcId, COR_PRF_FUNCTION_ARGUMENT_INFO *argumentInfo) const; + void HandleFunctionLeave2(FunctionID funcId) const; + void HandleFunctionTailCall2(FunctionID funcId) const; HRESULT STDMETHODCALLTYPE Initialize(IUnknown* pICorProfilerInfoUnk) override; HRESULT STDMETHODCALLTYPE Shutdown() override; diff --git a/Procfiler/src/cpp/offline/corprofiler/objects/ObjectsManager.cpp b/Procfiler/src/cpp/offline/corprofiler/objects/ObjectsManager.cpp new file mode 100644 index 000000000..5485e16bd --- /dev/null +++ b/Procfiler/src/cpp/offline/corprofiler/objects/ObjectsManager.cpp @@ -0,0 +1,90 @@ +#include "ObjectsManager.h" + +#include "FunctionInfo.h" +#include "sigparser/sigparserimpl.hpp" +#include +#include +#include + +#include "MetadataCookie.hpp" + +ObjectsManager::ObjectsManager(ICorProfilerInfo15* info) { + myProfilerInfo = info; +} + +ObjectsManager::~ObjectsManager() { + myProfilerInfo = nullptr; +} + +bool ObjectsManager::TryGetThisObjectId(const FunctionID funcId, + const COR_PRF_FUNCTION_ARGUMENT_INFO* args, + UINT64* objectId) { + if (args->ranges->length == 0) { + return false; + } + + mdToken functionToken; + ClassID classId; + ModuleID moduleId; + + auto hr = myProfilerInfo->GetFunctionInfo(funcId, &classId, &moduleId, &functionToken); + if (FAILED(hr)) { + return false; + } + + IUnknown* unknown; + hr = myProfilerInfo->GetModuleMetaData(moduleId, ofRead | ofWrite, IID_IMetaDataImport, &unknown); + if (FAILED(hr)) { + return false; + } + + IMetaDataImport2* mtd = nullptr; + auto ptr = reinterpret_cast(&mtd); + hr = unknown->QueryInterface(IID_IMetaDataImport, ptr); + + MetadataCookie cookie(mtd); + + if (FAILED(hr)) { + return false; + } + + PCCOR_SIGNATURE signature; + ULONG signatureLength; + + if (FAILED(mtd->GetMethodProps(functionToken, 0, 0, 0, 0, 0, &signature, &signatureLength, 0, 0))) { + return false; + } + + SigFormatParserImpl sigParser; + if (!sigParser.Parse(const_cast(signature), signatureLength) || !sigParser.HasThis()) { + return false; + } + + const auto thisId = reinterpret_cast(*reinterpret_cast(args->ranges[0].startAddress)); + + COR_PRF_GC_GENERATION_RANGE generationRange; + if (FAILED(myProfilerInfo->GetObjectGeneration(thisId, &generationRange))) { + return false; + } + + std::lock_guard lock(this->myMutex); + *objectId = myObjectsIds.at(thisId); + + return true; +} + +void ObjectsManager::HandleObjectsMove(ULONG cMovedObjectIDRanges, + ObjectID* oldObjectIDRangeStart, + ObjectID* newObjectIDRangeStart, + ULONG* cObjectIDRangeLength) { +} + +void ObjectsManager::HandleObjectAllocation(const ObjectID& id) { + static std::atomic nextObjectId{0}; + + auto nextId = nextObjectId.fetch_add(1); + + std::lock_guard lock(this->myMutex); + + myObjectsIds.insert({id, nextId}); +} diff --git a/Procfiler/src/cpp/offline/corprofiler/objects/ObjectsManager.h b/Procfiler/src/cpp/offline/corprofiler/objects/ObjectsManager.h new file mode 100644 index 000000000..95794ac2d --- /dev/null +++ b/Procfiler/src/cpp/offline/corprofiler/objects/ObjectsManager.h @@ -0,0 +1,31 @@ +#ifndef PROCFILER_OBJECTSMANAGER_H +#define PROCFILER_OBJECTSMANAGER_H + +#include +#include + +#include "cor.h" +#include "corprof.h" + +class ObjectsManager { + ICorProfilerInfo15* myProfilerInfo; + std::map myObjectsIds; + std::mutex myMutex; + +public: + explicit ObjectsManager(ICorProfilerInfo15* info); + + ~ObjectsManager(); + + bool TryGetThisObjectId(FunctionID funcId, const COR_PRF_FUNCTION_ARGUMENT_INFO* args, UINT64* objectPtr); + + void HandleObjectsMove(ULONG cMovedObjectIDRanges, + ObjectID* oldObjectIDRangeStart, + ObjectID* newObjectIDRangeStart, + ULONG* cObjectIDRangeLength); + + void HandleObjectAllocation(const ObjectID& id); +}; + + +#endif //PROCFILER_OBJECTSMANAGER_H diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.cpp b/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.cpp index 737b3dffb..ebbda3a43 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.cpp @@ -15,18 +15,18 @@ void EventsWithThreadId::AddFunctionEvent(const FunctionEvent& event) { bool EventsWithThreadId::ShouldLog(FunctionID& id, bool* shouldLog) const { if (ShouldLogFuncs->find(id) == ShouldLogFuncs->end()) { return false; - } else { - *shouldLog = ShouldLogFuncs->at(id); - return true; } + + *shouldLog = ShouldLogFuncs->at(id); + return true; } void EventsWithThreadId::PutFunctionShouldLogDecision(FunctionID& id, bool shouldLog) const { ShouldLogFuncs->insert({id, shouldLog}); } -EventsWithThreadIdOnline::EventsWithThreadIdOnline(std::string& directory, ThreadID threadId) { - std::string savePath = directory + "binstack_" + std::to_string(threadId) + ".bin"; +EventsWithThreadIdOnline::EventsWithThreadIdOnline(const std::string& directory, ThreadID threadId) { + const std::string savePath = directory + "binstack_" + std::to_string(threadId) + ".bin"; myFout = new std::ofstream(savePath, std::ios::binary); myFout->write((char*) &threadId, sizeof(long long)); @@ -37,7 +37,7 @@ EventsWithThreadIdOnline::EventsWithThreadIdOnline(std::string& directory, Threa } EventsWithThreadIdOnline::~EventsWithThreadIdOnline() { - auto streamPos = myFout->tellp(); + const auto streamPos = myFout->tellp(); myFout->seekp(myFramesCountPos); myFout->write((char*) &writtenFrames, sizeof(long long)); myFout->seekp(streamPos); diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.h index 63da170d0..6a3f37772 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/EventsWithThreadId.h @@ -39,12 +39,12 @@ struct EventsWithThreadId { void PutFunctionShouldLogDecision(FunctionID& id, bool shouldLog) const; }; -struct EventsWithThreadIdOnline : public EventsWithThreadId { +struct EventsWithThreadIdOnline final : EventsWithThreadId { std::ofstream* myFout{nullptr}; std::ofstream::pos_type myFramesCountPos{}; long long writtenFrames{0}; - explicit EventsWithThreadIdOnline(std::string& directory, ThreadID threadId); + explicit EventsWithThreadIdOnline(const std::string& directory, ThreadID threadId); ~EventsWithThreadIdOnline() override; @@ -52,7 +52,7 @@ struct EventsWithThreadIdOnline : public EventsWithThreadId { }; -struct EventsWithThreadIdOffline : public EventsWithThreadId { +struct EventsWithThreadIdOffline : EventsWithThreadId { std::vector* Events{nullptr}; explicit EventsWithThreadIdOffline(); diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.cpp b/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.cpp index 879d21ec7..c43cc169a 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.cpp @@ -13,9 +13,9 @@ ShadowStack::ShadowStack(ICorProfilerInfo15* profilerInfo, ProcfilerLogger* logg myProfilerInfo = profilerInfo; myOnlineSerialization = onlineSerialization; - if (IsEnvVarTrue(filterMethodsDuringRuntime)) { + if (IsEnvVarTrue(filterMethodsDuringRuntimeEnv)) { std::string value; - if (TryGetEnvVar(filterMethodsRegex, value)) { + if (TryGetEnvVar(filterMethodsRegexEnv, value)) { try { myFilterRegex = new std::regex(value); } @@ -31,7 +31,7 @@ ShadowStack::ShadowStack(ICorProfilerInfo15* profilerInfo, ProcfilerLogger* logg } ShadowStack::~ShadowStack() { - for (auto& pair: *GetAllStacks()) { + for (const auto& pair: *GetAllStacks()) { delete pair.second; } } @@ -49,7 +49,7 @@ void ShadowStack::AddFunctionEnter(FunctionID id, DWORD threadId, int64_t timest } } -bool ShadowStack::ShouldAddFunc(FunctionID& id, DWORD threadId) { +bool ShadowStack::ShouldAddFunc(FunctionID& id, DWORD threadId) const { if (myFilterRegex == nullptr) return true; const auto events = GetOrCreatePerThreadEvents(myLogger, threadId, myOnlineSerialization); @@ -87,10 +87,10 @@ void ShadowStack::HandleExceptionCatchEnter(FunctionID catcherFunctionId, DWORD if (!CanProcessFunctionEvents()) return; - auto events = GetOrCreatePerThreadEvents(myLogger, threadId, myOnlineSerialization); - auto stack = events->CurrentStack; + const auto events = GetOrCreatePerThreadEvents(myLogger, threadId, myOnlineSerialization); + const auto stack = events->CurrentStack; while (!stack->empty()) { - auto top = stack->top(); + const auto top = stack->top(); if (top == catcherFunctionId) { break; } @@ -106,7 +106,7 @@ EventsWithThreadId* ShadowStack::GetOrCreatePerThreadEvents(ProcfilerLogger* log if (!ourIsInitialized) { if (onlineSerialization) { std::string directory; - if (!TryGetEnvVar(binaryStackSavePath, directory)) { + if (!TryGetEnvVar(binaryStackSavePathEnv, directory)) { logger->LogError("The save path directory was not specified"); } @@ -125,7 +125,7 @@ EventsWithThreadId* ShadowStack::GetOrCreatePerThreadEvents(ProcfilerLogger* log return ourEvents; } -std::map* ShadowStack::GetAllStacks() const { +std::map* ShadowStack::GetAllStacks() { return &ourEventsPerThreads; } @@ -136,8 +136,8 @@ void ShadowStack::AdjustShadowStacks() { } for (const auto& pair : *GetAllStacks()) { - auto events = pair.second; - auto stack = events->CurrentStack; + const auto events = pair.second; + const auto stack = events->CurrentStack; while (!stack->empty()) { const auto& top = stack->top(); diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.h index 2f809de8b..4ade38165 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/ShadowStack.h @@ -25,7 +25,6 @@ #endif class ShadowStack { -private: static EventsWithThreadId* GetOrCreatePerThreadEvents(ProcfilerLogger* logger, DWORD threadId, bool onlineSerialization); std::regex* myFilterRegex{nullptr}; @@ -37,7 +36,7 @@ class ShadowStack { std::atomic myCanProcessFunctionEvents{true}; bool CanProcessFunctionEvents(); - bool ShouldAddFunc(FunctionID& id, DWORD threadId); + bool ShouldAddFunc(FunctionID& id, DWORD threadId) const; public: explicit ShadowStack(ICorProfilerInfo15* profilerInfo, ProcfilerLogger* logger, bool onlineSerialization); @@ -49,7 +48,8 @@ class ShadowStack { void SuppressFurtherMethodsEvents(); void WaitForPendingMethodsEvents(); void AdjustShadowStacks(); - std::map* GetAllStacks() const; + + static std::map* GetAllStacks(); }; struct FunctionEventProcessingCookie { diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.cpp b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.cpp index fa251988d..e7be9e483 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.cpp @@ -11,18 +11,18 @@ BinaryShadowStackSerializer::BinaryShadowStackSerializer(ICorProfilerInfo15* pro } void BinaryShadowStackSerializer::Init() { - if (!TryGetEnvVar(binaryStackSavePath, this->mySavePath)) { + if (!TryGetEnvVar(binaryStackSavePathEnv, this->mySavePath)) { myLogger->LogError("Binary shadow stack save path was not defined"); } std::string value; - TryGetEnvVar(useSeparateBinStacksFiles, value); + TryGetEnvVar(useSeparateBinStacksFilesEnv, value); myUseSeparateBinstacksFiles = value == trueEnvVarValue; } void BinaryShadowStackSerializer::Serialize(ShadowStack* shadowStack) { - if (mySavePath.length() == 0) { + if (mySavePath.empty()) { myLogger->LogError("Will not serialize shadow stack to binary format as save path was not provided"); return; } @@ -37,14 +37,14 @@ void BinaryShadowStackSerializer::Serialize(ShadowStack* shadowStack) { } void BinaryShadowStackSerializer::WriteThreadStack(ThreadID threadId, - std::vector* events, + const std::vector* events, std::ofstream& fout, std::set& filteredOutFunctions, - std::regex* methodsFilterRegex) { + const std::regex* methodsFilterRegex) const { fout.write((char*) &threadId, sizeof(long long)); auto framesCount = (long long) events->size(); - auto countPos = fout.tellp(); + const auto countPos = fout.tellp(); fout.write((char*) &framesCount, sizeof(long long)); long long writtenFrames = 0; @@ -71,16 +71,16 @@ void BinaryShadowStackSerializer::WriteThreadStack(ThreadID threadId, ++writtenFrames; } - auto streamPos = fout.tellp(); + const auto streamPos = fout.tellp(); fout.seekp(countPos); fout.write((char*) &writtenFrames, sizeof(long long)); fout.seekp(streamPos); } -std::regex* BinaryShadowStackSerializer::TryCreateMethodsFilterRegex() { +std::regex* BinaryShadowStackSerializer::TryCreateMethodsFilterRegex() const { std::string methodFilterRegex; std::regex* regex = nullptr; - if (TryGetEnvVar(filterMethodsRegex, methodFilterRegex)) { + if (TryGetEnvVar(filterMethodsRegexEnv, methodFilterRegex)) { try { myLogger->LogInformation("Creating regex from " + methodFilterRegex); regex = new std::regex(methodFilterRegex); @@ -94,14 +94,14 @@ std::regex* BinaryShadowStackSerializer::TryCreateMethodsFilterRegex() { return regex; } -void BinaryShadowStackSerializer::SerializeInSingleFile(ShadowStack* shadowStack) { +void BinaryShadowStackSerializer::SerializeInSingleFile(const ShadowStack* shadowStack) const { myLogger->LogInformation("Started serializing shadow stack to binary file"); std::ofstream fout(mySavePath, std::ios::binary); std::set filteredOutFunctions; - std::regex* regex = TryCreateMethodsFilterRegex(); + const std::regex* regex = TryCreateMethodsFilterRegex(); - for (auto& pair: *(shadowStack->GetAllStacks())) { - auto offlineEvents = dynamic_cast(pair.second); + for (const auto& pair: *ShadowStack::GetAllStacks()) { + const auto offlineEvents = dynamic_cast(pair.second); if (offlineEvents != nullptr) { WriteThreadStack(pair.first, offlineEvents->Events, fout, filteredOutFunctions, regex); } @@ -111,13 +111,13 @@ void BinaryShadowStackSerializer::SerializeInSingleFile(ShadowStack* shadowStack delete regex; } -void BinaryShadowStackSerializer::SerializeInDifferentFiles(ShadowStack* shadowStack) { +void BinaryShadowStackSerializer::SerializeInDifferentFiles(const ShadowStack* shadowStack) const { myLogger->LogInformation("Started serializing shadow stack to several binary files"); std::set filteredOutFunctions; - std::regex* regex = TryCreateMethodsFilterRegex(); + const std::regex* regex = TryCreateMethodsFilterRegex(); - for (auto& pair: *(shadowStack->GetAllStacks())) { - auto offlineEvents = dynamic_cast(pair.second); + for (auto& pair: *ShadowStack::GetAllStacks()) { + const auto offlineEvents = dynamic_cast(pair.second); if (offlineEvents != nullptr) { std::string filePath = createBinStackSavePath(mySavePath, pair.first); diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.h index 22dcee371..8633967ee 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/BinaryShadowStackSerializer.h @@ -6,22 +6,21 @@ #include "../EventsWithThreadId.h" class BinaryShadowStackSerializer : public ShadowStackSerializer { -private: std::string mySavePath; ICorProfilerInfo15* myProfilerInfo; ProcfilerLogger* myLogger; bool myUseSeparateBinstacksFiles{false}; - void SerializeInSingleFile(ShadowStack* shadowStack); - void SerializeInDifferentFiles(ShadowStack* shadowStack); + void SerializeInSingleFile(const ShadowStack* shadowStack) const; + void SerializeInDifferentFiles(const ShadowStack* shadowStack) const; void WriteThreadStack(ThreadID threadId, - std::vector* events, + const std::vector* events, std::ofstream& fout, std::set& filteredOutFunctions, - std::regex* methodsFilterRegex); + const std::regex* methodsFilterRegex) const; - std::regex* TryCreateMethodsFilterRegex(); + std::regex* TryCreateMethodsFilterRegex() const; public: explicit BinaryShadowStackSerializer(ICorProfilerInfo15* profilerInfo, ProcfilerLogger* logger); ~BinaryShadowStackSerializer() override = default; diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.cpp b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.cpp index 250fd9660..b688fb07d 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.cpp @@ -8,14 +8,13 @@ DebugShadowStackSerializer::DebugShadowStackSerializer(ICorProfilerInfo15* profi } void DebugShadowStackSerializer::Init() { - if (!TryGetEnvVar(shadowStackDebugSavePath, this->mySavePath)) { + if (!TryGetEnvVar(shadowStackDebugSavePathEnv, this->mySavePath)) { myLogger->LogError("Debug shadow stack save path was not defined"); - return; } } void DebugShadowStackSerializer::Serialize(ShadowStack* shadowStack) { - if (mySavePath.length() == 0) { + if (mySavePath.empty()) { return; } @@ -24,7 +23,7 @@ void DebugShadowStackSerializer::Serialize(ShadowStack* shadowStack) { const std::string startPrefix = "[START]: "; const std::string endPrefix = "[ END ]: "; - for (const auto& pair: *(shadowStack->GetAllStacks())) { + for (const auto& pair: *ShadowStack::GetAllStacks()) { auto offlineEvents = dynamic_cast(pair.second); if (offlineEvents == nullptr) continue; diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.h index c05fafa86..ed0dd7743 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/DebugShadowStackSerializer.h @@ -4,7 +4,6 @@ #include "ShadowStackSerializer.h" class DebugShadowStackSerializer : public ShadowStackSerializer { -private: std::string mySavePath; ICorProfilerInfo15* myProfilerInfo; ProcfilerLogger* myLogger; diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.cpp b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.cpp index 79ddbb8c3..6c25ba1e6 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.cpp @@ -13,14 +13,14 @@ void EventPipeShadowStackSerializer::Init() { void EventPipeShadowStackSerializer::Serialize(ShadowStack* shadowStack) { HRESULT hr; - auto events = shadowStack->GetAllStacks(); + const auto events = shadowStack->GetAllStacks(); std::map resolvedFunctions; for (const auto& pair: *events) { - auto offlineEvents = dynamic_cast(pair.second); + const auto offlineEvents = dynamic_cast(pair.second); if (offlineEvents == nullptr) continue; - auto threadId = pair.first; + const auto threadId = pair.first; for (const auto& event: *(offlineEvents->Events)) { hr = FAILED(LogFunctionEvent(event, threadId, resolvedFunctions)); @@ -64,7 +64,7 @@ HRESULT EventPipeShadowStackSerializer::DefineProcfilerMethodInfoEvent() { {COR_PRF_EVENTPIPE_STRING, 0, ToWString("FunctionName").c_str()}, }; - auto paramsCount = sizeof(eventParameters) / sizeof(COR_PRF_EVENTPIPE_PARAM_DESC); + const auto paramsCount = sizeof(eventParameters) / sizeof(COR_PRF_EVENTPIPE_PARAM_DESC); return myProfilerInfo->EventPipeDefineEvent( myEventPipeProvider, @@ -96,7 +96,7 @@ HRESULT EventPipeShadowStackSerializer::DefineMethodStartOrEndEventInternal(cons {COR_PRF_EVENTPIPE_UINT64, 0, ToWString("ThreadId").c_str()}, }; - auto paramsCount = sizeof(eventParameters) / sizeof(COR_PRF_EVENTPIPE_PARAM_DESC); + const auto paramsCount = sizeof(eventParameters) / sizeof(COR_PRF_EVENTPIPE_PARAM_DESC); return profilerInfo->EventPipeDefineEvent( provider, @@ -118,25 +118,25 @@ HRESULT EventPipeShadowStackSerializer::InitializeProvidersAndEvents() { HRESULT hr; if ((hr = DefineProcfilerEventPipeProvider()) != S_OK) { - auto logMessage = "Failed to initialize Event Pipe Provider, HR = " + std::to_string(hr); + const auto logMessage = "Failed to initialize Event Pipe Provider, HR = " + std::to_string(hr); myLogger->LogError(logMessage); return hr; } if ((hr = DefineProcfilerMethodStartEvent()) != S_OK) { - auto logMessage = "Failed to initialize method start event, HR = " + std::to_string(hr); + const auto logMessage = "Failed to initialize method start event, HR = " + std::to_string(hr); myLogger->LogError(logMessage); return hr; } if ((hr = DefineProcfilerMethodEndEvent()) != S_OK) { - auto logMessage = "Failed to initialize method end event, HR = " + std::to_string(hr); + const auto logMessage = "Failed to initialize method end event, HR = " + std::to_string(hr); myLogger->LogError(logMessage); return hr; } if ((hr = DefineProcfilerMethodInfoEvent()) != S_OK) { - auto logMessage = "Failed to initialize method info event, HR = " + std::to_string(hr); + const auto logMessage = "Failed to initialize method info event, HR = " + std::to_string(hr); myLogger->LogError(logMessage); return hr; } @@ -148,12 +148,12 @@ HRESULT EventPipeShadowStackSerializer::InitializeProvidersAndEvents() { HRESULT EventPipeShadowStackSerializer::LogFunctionEvent(const FunctionEvent& event, const DWORD& threadId, - std::map& resolvedFunctions) { + std::map& resolvedFunctions) const { if (!resolvedFunctions.count(event.Id)) { resolvedFunctions[event.Id] = FunctionInfo::GetFunctionInfo(myProfilerInfo, event.Id); } - auto eventPipeEvent = event.EventKind == FunctionEventKind::Started ? myMethodStartEvent : myMethodEndEvent; + const auto eventPipeEvent = event.EventKind == FunctionEventKind::Started ? myMethodStartEvent : myMethodEndEvent; COR_PRF_EVENT_DATA eventData[3]; @@ -166,12 +166,12 @@ HRESULT EventPipeShadowStackSerializer::LogFunctionEvent(const FunctionEvent& ev eventData[2].ptr = reinterpret_cast(&threadId); eventData[2].size = sizeof(DWORD); - auto dataCount = sizeof(eventData) / sizeof(COR_PRF_EVENT_DATA); + const auto dataCount = sizeof(eventData) / sizeof(COR_PRF_EVENT_DATA); return myProfilerInfo->EventPipeWriteEvent(eventPipeEvent, dataCount, eventData, NULL, NULL); } -HRESULT EventPipeShadowStackSerializer::LogMethodInfo(const FunctionID& functionId, const FunctionInfo& functionInfo) { +HRESULT EventPipeShadowStackSerializer::LogMethodInfo(const FunctionID& functionId, const FunctionInfo& functionInfo) const { COR_PRF_EVENT_DATA eventData[2]; eventData[0].ptr = reinterpret_cast(&functionId); @@ -181,7 +181,7 @@ HRESULT EventPipeShadowStackSerializer::LogMethodInfo(const FunctionID& function eventData[1].ptr = reinterpret_cast(&functionName); eventData[1].size = static_cast(functionName.length() + 1) * sizeof(WCHAR); - auto dataCount = sizeof(eventData) / sizeof(COR_PRF_EVENT_DATA); + const auto dataCount = sizeof(eventData) / sizeof(COR_PRF_EVENT_DATA); return myProfilerInfo->EventPipeWriteEvent(myMethodInfoEvent, dataCount, eventData, NULL, NULL); -} \ No newline at end of file +} diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.h index 85ab07186..dec3b6c53 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/EventPipeShadowStackSerializer.h @@ -4,7 +4,6 @@ #include "ShadowStackSerializer.h" class EventPipeShadowStackSerializer : public ShadowStackSerializer { -private: const UINT32 ourMethodStartEventId = 8000; const UINT32 ourMethodEndEventId = 8001; const UINT32 ourMethodInfoEventId = 8002; @@ -31,9 +30,9 @@ class EventPipeShadowStackSerializer : public ShadowStackSerializer { HRESULT LogFunctionEvent(const FunctionEvent& event, const DWORD& threadId, - std::map& resolvedFunctions); + std::map& resolvedFunctions) const; - HRESULT LogMethodInfo(const FunctionID& functionId, const FunctionInfo& functionInfo); + HRESULT LogMethodInfo(const FunctionID& functionId, const FunctionInfo& functionInfo) const; static HRESULT DefineMethodStartOrEndEventInternal(const wstring& eventName, diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/ShadowStackSerializer.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/ShadowStackSerializer.h index 9b3f8062f..2b01527c3 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/ShadowStackSerializer.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/serializers/ShadowStackSerializer.h @@ -13,7 +13,7 @@ class ShadowStackSerializer { virtual void Serialize(ShadowStack* shadowStack) = 0; }; -class ShadowStackSerializerStub : public ShadowStackSerializer { +class ShadowStackSerializerStub final : public ShadowStackSerializer { public: ~ShadowStackSerializerStub() override = default; diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.cpp b/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.cpp index fddcaacbc..21a2a8deb 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.cpp +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.cpp @@ -2,8 +2,8 @@ #include void writeFunctionEvent(const FunctionEvent& event, std::ofstream& fout) { - char startOrEnd = event.EventKind == FunctionEventKind::Started ? 1 : 0; - fout.write((char*) &startOrEnd, sizeof(char)); + const char startOrEnd = event.EventKind == FunctionEventKind::Started ? 1 : 0; + fout.write(&startOrEnd, sizeof(char)); fout.write((char*) &event.Timestamp, sizeof(long long)); fout.write((char*) &event.Id, sizeof(long long)); } diff --git a/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.h b/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.h index 41bb9906c..ea72361d6 100644 --- a/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.h +++ b/Procfiler/src/cpp/offline/corprofiler/shadowstack/utils.h @@ -15,13 +15,25 @@ struct FunctionEvent { FunctionEventKind EventKind; int64_t Timestamp; - FunctionEvent(FunctionID id, FunctionEventKind eventKind, int64_t timestamp) : - Id(id), - EventKind(eventKind), - Timestamp(timestamp) { + FunctionEvent(const FunctionID id, const FunctionEventKind eventKind, const int64_t timestamp) : Id(id), + EventKind(eventKind), + Timestamp(timestamp) { } }; +struct ObjectFunctionEvent : FunctionEvent { + int64_t ObjectId; + int64_t TypeId; + + ObjectFunctionEvent( + const FunctionID id, + const FunctionEventKind eventKind, + const int64_t timestamp, + const int64_t objectId, + const int64_t typeId + ) : FunctionEvent(id, eventKind, timestamp), ObjectId(objectId), TypeId(typeId) { + } +}; void writeFunctionEvent(const FunctionEvent& event, std::ofstream& fout); diff --git a/Procfiler/src/cpp/offline/dllmain.cpp b/Procfiler/src/cpp/offline/dllmain.cpp index d3af8cb3c..e6bb90c0e 100644 --- a/Procfiler/src/cpp/offline/dllmain.cpp +++ b/Procfiler/src/cpp/offline/dllmain.cpp @@ -6,7 +6,7 @@ BOOL STDMETHODCALLTYPE DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID } extern "C" HRESULT STDMETHODCALLTYPE DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { - auto factory = new ClassFactory(); + const auto factory = new ClassFactory(); return factory->QueryInterface(riid, ppv); } diff --git a/Procfiler/src/cpp/online/corprofiler/eventpipe/EventPipeWriter.cpp b/Procfiler/src/cpp/online/corprofiler/eventpipe/EventPipeWriter.cpp index bfbd87f52..37b6f4cdd 100644 --- a/Procfiler/src/cpp/online/corprofiler/eventpipe/EventPipeWriter.cpp +++ b/Procfiler/src/cpp/online/corprofiler/eventpipe/EventPipeWriter.cpp @@ -21,7 +21,7 @@ void EventPipeWriter::Init() { void EventPipeWriter::InitMethodsFilterRegex() { std::string value; - if (TryGetEnvVar(filterMethodsRegex, value)) { + if (TryGetEnvVar(filterMethodsRegexEnv, value)) { try { myMethodsFilterRegex = new std::regex(value); } diff --git a/Procfiler/src/cpp/shared/info/AssemblyInfo.cpp b/Procfiler/src/cpp/shared/info/AssemblyInfo.cpp index f9bf2b265..a5b758483 100644 --- a/Procfiler/src/cpp/shared/info/AssemblyInfo.cpp +++ b/Procfiler/src/cpp/shared/info/AssemblyInfo.cpp @@ -28,7 +28,7 @@ AssemblyInfo AssemblyInfo::GetAssemblyInfo(ICorProfilerInfo15* info, AssemblyID ToString(appDomainName, appDomainNameLength) }; } -AssemblyID AssemblyInfo::GetAssemblyId() { +AssemblyID AssemblyInfo::GetAssemblyId() const { return myAssemblyId; } @@ -36,11 +36,11 @@ wstring AssemblyInfo::GetName() { return myName; } -ModuleID AssemblyInfo::GetModuleId() { +ModuleID AssemblyInfo::GetModuleId() const { return myManifestModuleId; } -AppDomainID AssemblyInfo::GetAppDomainId() { +AppDomainID AssemblyInfo::GetAppDomainId() const { return myAppDomainId; } diff --git a/Procfiler/src/cpp/shared/info/AssemblyInfo.h b/Procfiler/src/cpp/shared/info/AssemblyInfo.h index 7f5010d31..813e1d54e 100644 --- a/Procfiler/src/cpp/shared/info/AssemblyInfo.h +++ b/Procfiler/src/cpp/shared/info/AssemblyInfo.h @@ -18,7 +18,7 @@ struct AssemblyInfo { public: AssemblyInfo() : myAssemblyId(0), myName(""_W), myManifestModuleId(0), myAppDomainId(0), myAppDomainName(""_W) {} - AssemblyInfo(AssemblyID id, wstring name, ModuleID manifestModuleId, AppDomainID appDomainId, wstring appDomainName) + AssemblyInfo(const AssemblyID id, wstring name, const ModuleID manifestModuleId, const AppDomainID appDomainId, wstring appDomainName) : myAssemblyId(id), myName(std::move(name)), myManifestModuleId(manifestModuleId), @@ -27,9 +27,9 @@ struct AssemblyInfo { static AssemblyInfo GetAssemblyInfo(ICorProfilerInfo15* info, AssemblyID assemblyId); - AssemblyID GetAssemblyId(); + AssemblyID GetAssemblyId() const; wstring GetName(); - ModuleID GetModuleId(); - AppDomainID GetAppDomainId(); + ModuleID GetModuleId() const; + AppDomainID GetAppDomainId() const; wstring GetAppDomainName(); }; diff --git a/Procfiler/src/cpp/shared/info/FunctionInfo.cpp b/Procfiler/src/cpp/shared/info/FunctionInfo.cpp index 534343900..f234db742 100644 --- a/Procfiler/src/cpp/shared/info/FunctionInfo.cpp +++ b/Procfiler/src/cpp/shared/info/FunctionInfo.cpp @@ -3,7 +3,7 @@ #include -FunctionInfo FunctionInfo::GetFunctionInfo(ICorProfilerInfo15* info, FunctionID funcId) { +FunctionInfo FunctionInfo::GetFunctionInfo(ICorProfilerInfo15* info, const FunctionID funcId) { mdToken functionToken; ClassID classId; ModuleID moduleId; @@ -96,7 +96,7 @@ FunctionInfo FunctionInfo::GetFunctionInfo(IMetaDataImport2* metadataImport, mdT MethodSignature(ToRaw(rawSignature, rawSignatureLength)), attributes}; } -std::unordered_set ExtractAttributes(IMetaDataImport2* metadataImport, mdToken token) { +std::unordered_set ExtractAttributes(IMetaDataImport2* metadataImport, const mdToken token) { std::unordered_set attributes{}; HRESULT hr; @@ -175,7 +175,7 @@ std::string FunctionInfo::GetFullName() { return ToString(myType.GetName()) + "." + ToString(myName); } -mdToken FunctionInfo::GetId() { +mdToken FunctionInfo::GetId() const { return myId; } diff --git a/Procfiler/src/cpp/shared/info/FunctionInfo.h b/Procfiler/src/cpp/shared/info/FunctionInfo.h index b1d3c4757..de72e282b 100644 --- a/Procfiler/src/cpp/shared/info/FunctionInfo.h +++ b/Procfiler/src/cpp/shared/info/FunctionInfo.h @@ -37,7 +37,7 @@ struct FunctionInfo { myMethodDefId(methodDefId), myAttributes(attributes) {} - FunctionInfo(mdToken id, wstring name, TypeInfo type, MethodSignature signature, + FunctionInfo(const mdToken id, wstring name, TypeInfo type, MethodSignature signature, const std::unordered_set& attributes) : myId(id), myName(std::move(name)), @@ -51,7 +51,7 @@ struct FunctionInfo { static FunctionInfo GetFunctionInfo(ICorProfilerInfo15* info, FunctionID funcId); std::string GetFullName(); - mdToken GetId(); + mdToken GetId() const; wstring GetName() const; TypeInfo GetTypeInfo(); MethodSignature GetMethodSignature(); diff --git a/Procfiler/src/cpp/shared/info/GenericMethodSignature.cpp b/Procfiler/src/cpp/shared/info/GenericMethodSignature.cpp index c8fcc5405..91fc66486 100644 --- a/Procfiler/src/cpp/shared/info/GenericMethodSignature.cpp +++ b/Procfiler/src/cpp/shared/info/GenericMethodSignature.cpp @@ -14,7 +14,7 @@ GenericMethodSignature::GenericMethodSignature(std::vector rawSignature) : for (size_t i = 0; i < number; i++) { - auto begin = iter; + const auto begin = iter; if (!ParseType(iter)) { break; diff --git a/Procfiler/src/cpp/shared/info/MethodSignature.cpp b/Procfiler/src/cpp/shared/info/MethodSignature.cpp index 2f6a8766a..8ac0f94ec 100644 --- a/Procfiler/src/cpp/shared/info/MethodSignature.cpp +++ b/Procfiler/src/cpp/shared/info/MethodSignature.cpp @@ -10,7 +10,7 @@ MethodSignature::MethodSignature(std::vector rawSignature) : myRawSignature(std::move(rawSignature)) { - auto begin = myRawSignature.begin() + 2 + (IsGeneric() ? 1 : 0); + const auto begin = myRawSignature.begin() + 2 + (IsGeneric() ? 1 : 0); auto iter = begin; if (ParseRetType(iter)) { myReturnType = std::vector(begin, iter); @@ -24,7 +24,7 @@ void MethodSignature::ParseArguments() { std::advance(iter, myArgumentsOffset); for (size_t i = 0; i < NumberOfArguments(); i++) { - auto begin = iter; + const auto begin = iter; if (!ParseParam(iter)) { break; } diff --git a/Procfiler/src/cpp/shared/info/ModuleInfo.cpp b/Procfiler/src/cpp/shared/info/ModuleInfo.cpp index 10d1da2c8..0d7973ac2 100644 --- a/Procfiler/src/cpp/shared/info/ModuleInfo.cpp +++ b/Procfiler/src/cpp/shared/info/ModuleInfo.cpp @@ -19,7 +19,7 @@ ModuleInfo ModuleInfo::GetModuleInfo(ICorProfilerInfo15* info, ModuleID moduleId return { moduleId, ToString(modulePath, length), AssemblyInfo::GetAssemblyInfo(info, assemblyId), moduleFlags }; } -ModuleID ModuleInfo::GetId() { +ModuleID ModuleInfo::GetId() const { return myId; } @@ -31,6 +31,6 @@ AssemblyInfo ModuleInfo::GetAssemblyInfo() { return myAssembly; } -DWORD ModuleInfo::GetFlags() { +DWORD ModuleInfo::GetFlags() const { return myFlags; -} \ No newline at end of file +} diff --git a/Procfiler/src/cpp/shared/info/ModuleInfo.h b/Procfiler/src/cpp/shared/info/ModuleInfo.h index 0cdaa723f..16ef80512 100644 --- a/Procfiler/src/cpp/shared/info/ModuleInfo.h +++ b/Procfiler/src/cpp/shared/info/ModuleInfo.h @@ -16,14 +16,14 @@ struct ModuleInfo { public: ModuleInfo() : myId(0), myPath(""_W), myAssembly({}), myFlags(0) {} - ModuleInfo(ModuleID id, wstring path, AssemblyInfo assembly, DWORD flags) + ModuleInfo(const ModuleID id, wstring path, AssemblyInfo assembly, const DWORD flags) : myId(id), myPath(std::move(path)), myAssembly(std::move(assembly)), myFlags(flags) {} static ModuleInfo GetModuleInfo(ICorProfilerInfo15* info, ModuleID moduleId); - ModuleID GetId(); + ModuleID GetId() const; wstring GetPath(); AssemblyInfo GetAssemblyInfo(); - DWORD GetFlags(); + DWORD GetFlags() const; }; diff --git a/Procfiler/src/cpp/shared/info/TypeInfo.cpp b/Procfiler/src/cpp/shared/info/TypeInfo.cpp index eb4a20cd0..b670c2059 100644 --- a/Procfiler/src/cpp/shared/info/TypeInfo.cpp +++ b/Procfiler/src/cpp/shared/info/TypeInfo.cpp @@ -6,10 +6,11 @@ TypeInfo::TypeInfo(const std::vector& raw) : myRaw(raw) { myIsRefType = !raw.empty() && raw[0] == ELEMENT_TYPE_BYREF; + myIsClass = !raw.empty() && raw[0] == ELEMENT_TYPE_CLASS; myIsVoid = !raw.empty() && raw[0] == ELEMENT_TYPE_VOID; - auto shift = myIsRefType ? 1 : 0; + const auto shift = myIsRefType ? 1 : 0; switch (raw[myIsRefType]) { case ELEMENT_TYPE_VOID: @@ -70,7 +71,7 @@ void TypeInfo::TryParseGeneric() { ParseNumber(iter, number); for (size_t i = 0; i < number; i++) { - auto begin = iter; + const auto begin = iter; if (!ParseType(iter)) { break; } @@ -130,7 +131,7 @@ TypeInfo TypeInfo::GetTypeInfo(IMetaDataImport2* metadataImport, mdToken token) return {token, ToString(typeName, typeNameLength), {}}; } -mdToken TypeInfo::GetToken() { +mdToken TypeInfo::GetToken() const { return myToken; } @@ -146,34 +147,38 @@ std::vector TypeInfo::GetGenerics() { return myGenerics; } -bool TypeInfo::IsRefType() { +bool TypeInfo::IsRefType() const { return myIsRefType; } -void TypeInfo::SetRefType(bool isRefType) { +void TypeInfo::SetRefType(const bool isRefType) { myIsRefType = isRefType; } -bool TypeInfo::IsBoxed() { +bool TypeInfo::IsClass() const { + return myIsClass; +} + +bool TypeInfo::IsBoxed() const { return myIsBoxed; } -bool TypeInfo::IsVoid() { +bool TypeInfo::IsVoid() const { return myIsVoid; } -bool TypeInfo::IsGenericClassRef() { +bool TypeInfo::IsGenericClassRef() const { return myIsGenericClassRef; } -bool TypeInfo::IsGenericMethodRef() { +bool TypeInfo::IsGenericMethodRef() const { return myIsGenericMethodRef; } -BYTE TypeInfo::GetTypeDef() { +BYTE TypeInfo::GetTypeDef() const { return myTypeDef; } -ULONG TypeInfo::GetGenericRefNumber() { +ULONG TypeInfo::GetGenericRefNumber() const { return myGenericRefNumber; } diff --git a/Procfiler/src/cpp/shared/info/TypeInfo.h b/Procfiler/src/cpp/shared/info/TypeInfo.h index 9886a97d9..76d83df25 100644 --- a/Procfiler/src/cpp/shared/info/TypeInfo.h +++ b/Procfiler/src/cpp/shared/info/TypeInfo.h @@ -14,6 +14,7 @@ struct TypeInfo { std::vector myGenerics{}; bool myIsRefType = false; + bool myIsClass = false; BYTE myTypeDef = 0; bool myIsBoxed = false; bool myIsVoid = false; @@ -25,7 +26,7 @@ struct TypeInfo { public: TypeInfo() : myToken(0), myName(""_W) {} - TypeInfo(mdToken id, wstring name, const std::vector& raw) : myToken(id), myName(std::move(name)), myRaw(raw) {} + TypeInfo(const mdToken id, wstring name, const std::vector& raw) : myToken(id), myName(std::move(name)), myRaw(raw) {} TypeInfo(const std::vector& raw); @@ -33,20 +34,21 @@ struct TypeInfo { static TypeInfo GetTypeInfo(IMetaDataImport2* metadataImport, mdToken token); - mdToken GetToken(); + mdToken GetToken() const; wstring GetName(); std::vector GetRawInfo(); std::vector GetGenerics(); - bool IsRefType(); + bool IsRefType() const; void SetRefType(bool isRefType); + bool IsClass() const; - bool IsBoxed(); - bool IsVoid(); + bool IsBoxed() const; + bool IsVoid() const; - bool IsGenericClassRef(); - bool IsGenericMethodRef(); + bool IsGenericClassRef() const; + bool IsGenericMethodRef() const; - BYTE GetTypeDef(); - ULONG GetGenericRefNumber(); + BYTE GetTypeDef() const; + ULONG GetGenericRefNumber() const; }; \ No newline at end of file diff --git a/Procfiler/src/cpp/shared/info/clr/profilerstring.hpp b/Procfiler/src/cpp/shared/info/clr/profilerstring.hpp index 4bded3776..112be9ade 100644 --- a/Procfiler/src/cpp/shared/info/clr/profilerstring.hpp +++ b/Procfiler/src/cpp/shared/info/clr/profilerstring.hpp @@ -76,7 +76,7 @@ class String { assert(other != nullptr); - size_t otherLen = wcslen(other) + 1; + const size_t otherLen = wcslen(other) + 1; if (buffer == nullptr || otherLen > bufferLen) { bufferLen = DefaultStringLength > otherLen ? DefaultStringLength : otherLen; @@ -179,9 +179,9 @@ class String String& operator+=(const String& other) { - size_t currLen = wcslen(buffer); - size_t otherLen = wcslen(other.buffer); - size_t candidateLen = currLen + otherLen + 1; + const size_t currLen = wcslen(buffer); + const size_t otherLen = wcslen(other.buffer); + const size_t candidateLen = currLen + otherLen + 1; if (candidateLen > bufferLen) { @@ -196,18 +196,17 @@ class String return *this; } - WCHAR& operator[] (size_t pos) + WCHAR& operator[] (const size_t pos) { return buffer[pos]; } - const WCHAR& operator[] (size_t pos) const + const WCHAR& operator[] (const size_t pos) const { return buffer[pos]; } - void Clear() - { + void Clear() const { if (buffer != nullptr) { buffer[0] = 0; @@ -244,8 +243,7 @@ class String return printBuffer; } - wstring ToWString() - { + wstring ToWString() const { wstring temp; for (size_t i = 0; i < bufferLen; ++i) { @@ -283,8 +281,8 @@ inline std::wostream& operator<<(std::wostream& os, const String& obj) inline bool EndsWith(const char *lhs, const char *rhs) { - size_t lhsLen = strlen(lhs); - size_t rhsLen = strlen(rhs); + const size_t lhsLen = strlen(lhs); + const size_t rhsLen = strlen(rhs); if (lhsLen < rhsLen) { return false; @@ -309,8 +307,8 @@ inline bool EndsWith(const char *lhs, const char *rhs) inline bool EndsWith(const String &lhs, const String &rhs) { - size_t lhsLength = lhs.Length(); - size_t rhsLength = rhs.Length(); + const size_t lhsLength = lhs.Length(); + const size_t rhsLength = rhs.Length(); if (lhsLength < rhsLength) { return false; diff --git a/Procfiler/src/cpp/shared/info/parser.cpp b/Procfiler/src/cpp/shared/info/parser.cpp index 0f79d02fa..9f9b80ed9 100644 --- a/Procfiler/src/cpp/shared/info/parser.cpp +++ b/Procfiler/src/cpp/shared/info/parser.cpp @@ -3,8 +3,7 @@ bool ParseTypeDefOrRefEncoded(std::vector::iterator& begin) { mdToken typeToken; - ULONG result; - result = CorSigUncompressToken(&*begin, &typeToken); + const ULONG result = CorSigUncompressToken(&*begin, &typeToken); if (result == -1) { return false; } @@ -36,12 +35,10 @@ bool ParseOptionalCustomMods(std::vector::iterator& begin) { return true; } } - - return false; } bool ParseNumber(std::vector::iterator& begin, ULONG& number) { - ULONG result = CorSigUncompressData(&*begin, &number); + const ULONG result = CorSigUncompressData(&*begin, &number); if (result == -1) { return false; } @@ -135,7 +132,7 @@ bool ParseArrayShape(std::vector::iterator& begin) { } bool ParseType(std::vector::iterator& begin) { - auto elementType = *begin; + const auto elementType = *begin; ULONG number = 0; std::advance(begin, 1); diff --git a/Procfiler/src/cpp/shared/info/sigparser/sigparser.cpp b/Procfiler/src/cpp/shared/info/sigparser/sigparser.cpp new file mode 100644 index 000000000..f4bdf2f72 --- /dev/null +++ b/Procfiler/src/cpp/shared/info/sigparser/sigparser.cpp @@ -0,0 +1,664 @@ +#include "sigparser.h" + +bool SigParser::Parse(sig_byte *pb, sig_count cbBuffer) +{ + pbBase = pb; + pbCur = pb; + pbEnd = pbBase + cbBuffer; + + sig_elem_type elem_type; + + if (!ParseByte(&elem_type)) + return false; + + switch (elem_type & 0xf) + { + case SIG_METHOD_DEFAULT: // default calling convention + case SIG_METHOD_C: // C calling convention + case SIG_METHOD_STDCALL: // Stdcall calling convention + case SIG_METHOD_THISCALL: // thiscall calling convention + case SIG_METHOD_FASTCALL: // fastcall calling convention + case SIG_METHOD_VARARG: // vararg calling convention + return ParseMethod(elem_type); + break; + + case SIG_FIELD: // encodes a field + return ParseField(elem_type); + break; + + case SIG_LOCAL_SIG: // used for the .locals directive + return ParseLocals(elem_type); + break; + + case SIG_PROPERTY: // used to encode a property + return ParseProperty(elem_type); + break; + + default: + // unknown signature + break; + } + + return false; +} + + +bool SigParser::ParseByte(sig_byte *pbOut) +{ + if (pbCur < pbEnd) + { + *pbOut = *pbCur; + pbCur++; + return true; + } + + return false; +} + + +bool SigParser::ParseMethod(sig_elem_type elem_type) +{ + // MethodDefSig ::= [[HASTHIS] [EXPLICITTHIS]] (DEFAULT|VARARG|GENERIC GenParamCount) + // ParamCount RetType Param* [SENTINEL Param+] + + NotifyBeginMethod(elem_type); + + sig_count gen_param_count; + sig_count param_count; + + if (elem_type & (SIG_HASTHIS | SIG_EXPLICITTHIS)) + { + NotifyHasThis(); + } + + if (elem_type & SIG_GENERIC) + { + if (!ParseNumber(&gen_param_count)) + return false; + + NotifyGenericParamCount(gen_param_count); + } + + if (!ParseNumber(¶m_count)) + return false; + + NotifyParamCount(param_count); + + if (!ParseRetType()) + return false; + + bool fEncounteredSentinel = false; + + for (sig_count i = 0; i < param_count; i++) + { + if (pbCur >= pbEnd) + return false; + + if (*pbCur == ELEMENT_TYPE_SENTINEL) + { + if (fEncounteredSentinel) + return false; + + fEncounteredSentinel = true; + NotifySentinel(); + pbCur++; + } + + if (!ParseParam()) + return false; + } + + NotifyEndMethod(); + + return true; +} + + +bool SigParser::ParseField(sig_elem_type elem_type) +{ + // FieldSig ::= FIELD CustomMod* Type + + NotifyBeginField(elem_type); + + if (!ParseOptionalCustomMods()) + return false; + + if (!ParseType()) + return false; + + NotifyEndField(); + + return true; +} + + +bool SigParser::ParseProperty(sig_elem_type elem_type) +{ + // PropertySig ::= PROPERTY [HASTHIS] ParamCount CustomMod* Type Param* + + NotifyBeginProperty(elem_type); + + sig_count param_count; + + if (!ParseNumber(¶m_count)) + return false; + + NotifyParamCount(param_count); + + if (!ParseOptionalCustomMods()) + return false; + + for (sig_count i = 0; i < param_count; i++) + { + if (!ParseParam()) + return false; + } + + NotifyEndProperty(); + + return true; +} + + +bool SigParser::ParseLocals(sig_elem_type elem_type) +{ + // LocalVarSig ::= LOCAL_SIG Count (TYPEDBYREF | ([CustomMod] [Constraint])* [BYREF] Type)+ + + NotifyBeginLocals(elem_type); + + sig_count local_count; + + if (!ParseNumber(&local_count)) + return false; + + NotifyLocalsCount(local_count); + + for (sig_count i = 0; i < local_count; i++) + { + if (!ParseLocal()) + return false; + } + + NotifyEndLocals(); + + return true; +} + + +bool SigParser::ParseLocal() +{ + //TYPEDBYREF | ([CustomMod] [Constraint])* [BYREF] Type + NotifyBeginLocal(); + + if (pbCur >= pbEnd) + return false; + + if (*pbCur == ELEMENT_TYPE_TYPEDBYREF) + { + NotifyTypedByref(); + pbCur++; + goto Success; + } + + if (!ParseOptionalCustomModsOrConstraint()) + return false; + + if (pbCur >= pbEnd) + return false; + + if (*pbCur == ELEMENT_TYPE_BYREF) + { + NotifyByref(); + pbCur++; + } + + if (!ParseType()) + return false; + +Success: + NotifyEndLocal(); + return true; +} + + +bool SigParser::ParseOptionalCustomModsOrConstraint() +{ + for (;;) + { + if (pbCur >= pbEnd) + return true; + + switch (*pbCur) + { + case ELEMENT_TYPE_CMOD_OPT: + case ELEMENT_TYPE_CMOD_REQD: + if (!ParseCustomMod()) + return false; + break; + + case ELEMENT_TYPE_PINNED: + NotifyConstraint(*pbCur); + pbCur++; + break; + + default: + return true; + } + } + + return false; +} + + +bool SigParser::ParseOptionalCustomMods() +{ + for (;;) + { + if (pbCur >= pbEnd) + return true; + + switch (*pbCur) + { + case ELEMENT_TYPE_CMOD_OPT: + case ELEMENT_TYPE_CMOD_REQD: + if (!ParseCustomMod()) + return false; + break; + + default: + return true; + } + } + + return false; +} + + + +bool SigParser::ParseCustomMod() +{ + sig_elem_type cmod = 0; + sig_index index; + sig_index_type indexType; + + if (!ParseByte(&cmod)) + return false; + + if (cmod == ELEMENT_TYPE_CMOD_OPT || cmod == ELEMENT_TYPE_CMOD_REQD) + { + if (!ParseTypeDefOrRefEncoded(&indexType, &index)) + return false; + + NotifyCustomMod(cmod, indexType, index); + return true; + } + + return false; +} + + +bool SigParser::ParseParam() +{ + // Param ::= CustomMod* ( TYPEDBYREF | [BYREF] Type ) + + NotifyBeginParam(); + + if (!ParseOptionalCustomMods()) + return false; + + if (pbCur >= pbEnd) + return false; + + if (*pbCur == ELEMENT_TYPE_TYPEDBYREF) + { + NotifyTypedByref(); + pbCur++; + goto Success; + } + + if (*pbCur == ELEMENT_TYPE_BYREF) + { + NotifyByref(); + pbCur++; + } + + if (!ParseType()) + return false; + +Success: + NotifyEndParam(); + return true; +} + + +bool SigParser::ParseRetType() +{ + // RetType ::= CustomMod* ( VOID | TYPEDBYREF | [BYREF] Type ) + + NotifyBeginRetType(); + + if (!ParseOptionalCustomMods()) + return false; + + if (pbCur >= pbEnd) + return false; + + if (*pbCur == ELEMENT_TYPE_TYPEDBYREF) + { + NotifyTypedByref(); + pbCur++; + goto Success; + } + + if (*pbCur == ELEMENT_TYPE_VOID) + { + NotifyVoid(); + pbCur++; + goto Success; + } + + if (*pbCur == ELEMENT_TYPE_BYREF) + { + NotifyByref(); + pbCur++; + } + + if (!ParseType()) + return false; + +Success: + NotifyEndRetType(); + return true; +} + +bool SigParser::ParseArrayShape() +{ + sig_count rank; + sig_count numsizes; + sig_count size; + + // ArrayShape ::= Rank NumSizes Size* NumLoBounds LoBound* + NotifyBeginArrayShape(); + if (!ParseNumber(&rank)) + return false; + + NotifyRank(rank); + + if (!ParseNumber(&numsizes)) + return false; + + NotifyNumSizes(numsizes); + + for (sig_count i = 0; i < numsizes; i++) + { + if (!ParseNumber(&size)) + return false; + + NotifySize(size); + } + + if (!ParseNumber(&numsizes)) + return false; + + NotifyNumLoBounds(numsizes); + + for (sig_count i = 0; i < numsizes; i++) + { + if (!ParseNumber(&size)) + return false; + + NotifyLoBound(size); + } + + NotifyEndArrayShape(); + return true; +} + +bool SigParser::ParseType() +{ + /* + Type ::= ( BOOLEAN | CHAR | I1 | U1 | U2 | U2 | I4 | U4 | I8 | U8 | R4 | R8 | I | U | + | VALUETYPE TypeDefOrRefEncoded + | CLASS TypeDefOrRefEncoded + | STRING + | OBJECT + | PTR CustomMod* VOID + | PTR CustomMod* Type + | FNPTR MethodDefSig + | FNPTR MethodRefSig + | ARRAY Type ArrayShape + | SZARRAY CustomMod* Type + | GENERICINST (CLASS | VALUETYPE) TypeDefOrRefEncoded GenArgCount Type * + | VAR Number + | MVAR Number + + */ + + NotifyBeginType(); + + sig_elem_type elem_type; + sig_index index; + sig_mem_number number; + sig_index_type indexType; + + if (!ParseByte(&elem_type)) + return false; + + switch (elem_type) + { + case ELEMENT_TYPE_BOOLEAN: + case ELEMENT_TYPE_CHAR: + case ELEMENT_TYPE_I1: + case ELEMENT_TYPE_U1: + case ELEMENT_TYPE_U2: + case ELEMENT_TYPE_I2: + case ELEMENT_TYPE_I4: + case ELEMENT_TYPE_U4: + case ELEMENT_TYPE_I8: + case ELEMENT_TYPE_U8: + case ELEMENT_TYPE_R4: + case ELEMENT_TYPE_R8: + case ELEMENT_TYPE_I: + case ELEMENT_TYPE_U: + case ELEMENT_TYPE_STRING: + case ELEMENT_TYPE_OBJECT: + // simple types + NotifyTypeSimple(elem_type); + break; + + case ELEMENT_TYPE_PTR: + // PTR CustomMod* VOID + // PTR CustomMod* Type + + NotifyTypePointer(); + + if (!ParseOptionalCustomMods()) + return false; + + if (pbCur >= pbEnd) + return false; + + if (*pbCur == ELEMENT_TYPE_VOID) + { + pbCur++; + NotifyVoid(); + break; + } + + if (!ParseType()) + return false; + + break; + + case ELEMENT_TYPE_CLASS: + // CLASS TypeDefOrRefEncoded + NotifyTypeClass(); + + if (!ParseTypeDefOrRefEncoded(&indexType, &index)) + return false; + + NotifyTypeDefOrRef(indexType, index); + break; + + case ELEMENT_TYPE_VALUETYPE: + //VALUETYPE TypeDefOrRefEncoded + NotifyTypeValueType(); + + if (!ParseTypeDefOrRefEncoded(&indexType, &index)) + return false; + + NotifyTypeDefOrRef(indexType, index); + break; + + case ELEMENT_TYPE_FNPTR: + // FNPTR MethodDefSig + // FNPTR MethodRefSig + NotifyTypeFunctionPointer(); + + if (!ParseByte(&elem_type)) + return false; + + if (!ParseMethod(elem_type)) + return false; + + break; + + case ELEMENT_TYPE_ARRAY: + // ARRAY Type ArrayShape + NotifyTypeArray(); + + if (!ParseType()) + return false; + + if (!ParseArrayShape()) + return false; + break; + + case ELEMENT_TYPE_SZARRAY: + // SZARRAY CustomMod* Type + + NotifyTypeSzArray(); + + if (!ParseOptionalCustomMods()) + return false; + + if (!ParseType()) + return false; + + break; + + case ELEMENT_TYPE_GENERICINST: + // GENERICINST (CLASS | VALUETYPE) TypeDefOrRefEncoded GenArgCount Type * + + if (!ParseByte(&elem_type)) + return false; + + if (elem_type != ELEMENT_TYPE_CLASS && elem_type != ELEMENT_TYPE_VALUETYPE) + return false; + + if (!ParseTypeDefOrRefEncoded(&indexType, &index)) + return false; + + if (!ParseNumber(&number)) + return false; + + NotifyTypeGenericInst(elem_type, indexType, index, number); + + { + for (sig_mem_number i=0; i < number; i++) + { + if (!ParseType()) + return false; + } + } + + break; + + case ELEMENT_TYPE_VAR: + // VAR Number + if (!ParseNumber(&number)) + return false; + NotifyTypeGenericTypeVariable(number); + break; + + case ELEMENT_TYPE_MVAR: + // MVAR Number + if (!ParseNumber(&number)) + return false; + NotifyTypeGenericMemberVariable(number); + break; + } + + NotifyEndType(); + + return true; +} + +bool SigParser::ParseTypeDefOrRefEncoded(sig_index_type *pIndexTypeOut, sig_index *pIndexOut) +{ + // parse an encoded typedef or typeref + + sig_count encoded = 0; + + if (!ParseNumber(&encoded)) + return false; + + *pIndexTypeOut = (sig_index_type) (encoded & 0x3); + *pIndexOut = (encoded >> 2); + return true; +} + +bool SigParser::ParseNumber(sig_count *pOut) +{ + // parse the variable length number format (0-4 bytes) + + sig_byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + + // at least one byte in the encoding, read that + + if (!ParseByte(&b1)) + return false; + + if (b1 == 0xff) + { + // special encoding of 'NULL' + // not sure what this means as a number, don't expect to see it except for string lengths + // which we don't encounter anyway so calling it an error + return false; + } + + // early out on 1 byte encoding + if ( (b1 & 0x80) == 0) + { + *pOut = (int)b1; + return true; + } + + // now at least 2 bytes in the encoding, read 2nd byte + if (!ParseByte(&b2)) + return false; + + // early out on 2 byte encoding + if ( (b1 & 0x40) == 0) + { + *pOut = (((b1 & 0x3f) << 8) | b2); + return true; + } + + // must be a 4 byte encoding + + if ( (b1 & 0x20) != 0) + { + // 4 byte encoding has this bit clear -- error if not + return false; + } + + if (!ParseByte(&b3)) + return false; + + if (!ParseByte(&b4)) + return false; + + *pOut = ((b1 & 0x1f)<<24) | (b2<<16) | (b3<<8) | b4; + return true; +} diff --git a/Procfiler/src/cpp/shared/info/sigparser/sigparser.h b/Procfiler/src/cpp/shared/info/sigparser/sigparser.h new file mode 100644 index 000000000..47235cc97 --- /dev/null +++ b/Procfiler/src/cpp/shared/info/sigparser/sigparser.h @@ -0,0 +1,293 @@ +#ifndef __PROFILER_SIGNATURE_PARSER__ +#define __PROFILER_SIGNATURE_PARSER__ + +/* + +Sig ::= MethodDefSig | MethodRefSig | StandAloneMethodSig | FieldSig | PropertySig | LocalVarSig + +MethodDefSig ::= [[HASTHIS] [EXPLICITTHIS]] (DEFAULT|VARARG|GENERIC GenParamCount) ParamCount RetType Param* + +MethodRefSig ::= [[HASTHIS] [EXPLICITTHIS]] VARARG ParamCount RetType Param* [SENTINEL Param+] + +StandAloneMethodSig ::= [[HASTHIS] [EXPLICITTHIS]] (DEFAULT|VARARG|C|STDCALL|THISCALL|FASTCALL) + ParamCount RetType Param* [SENTINEL Param+] + +FieldSig ::= FIELD CustomMod* Type + +PropertySig ::= PROPERTY [HASTHIS] ParamCount CustomMod* Type Param* + +LocalVarSig ::= LOCAL_SIG Count (TYPEDBYREF | ([CustomMod] [Constraint])* [BYREF] Type)+ + + +------------- + +CustomMod ::= ( CMOD_OPT | CMOD_REQD ) ( TypeDefEncoded | TypeRefEncoded ) + +Constraint ::= #define ELEMENT_TYPE_PINNED + +Param ::= CustomMod* ( TYPEDBYREF | [BYREF] Type ) + +RetType ::= CustomMod* ( VOID | TYPEDBYREF | [BYREF] Type ) + +Type ::= ( BOOLEAN | CHAR | I1 | U1 | U2 | U2 | I4 | U4 | I8 | U8 | R4 | R8 | I | U | + | VALUETYPE TypeDefOrRefEncoded + | CLASS TypeDefOrRefEncoded + | STRING + | OBJECT + | PTR CustomMod* VOID + | PTR CustomMod* Type + | FNPTR MethodDefSig + | FNPTR MethodRefSig + | ARRAY Type ArrayShape + | SZARRAY CustomMod* Type + | GENERICINST (CLASS | VALUETYPE) TypeDefOrRefEncoded GenArgCount Type* + | VAR Number + | MVAR Number + +ArrayShape ::= Rank NumSizes Size* NumLoBounds LoBound* + +TypeDefOrRefEncoded ::= TypeDefEncoded | TypeRefEncoded +TypeDefEncoded ::= 32-bit-3-part-encoding-for-typedefs-and-typerefs +TypeRefEncoded ::= 32-bit-3-part-encoding-for-typedefs-and-typerefs + +ParamCount ::= 29-bit-encoded-integer +GenArgCount ::= 29-bit-encoded-integer +Count ::= 29-bit-encoded-integer +Rank ::= 29-bit-encoded-integer +NumSizes ::= 29-bit-encoded-integer +Size ::= 29-bit-encoded-integer +NumLoBounds ::= 29-bit-encoded-integer +LoBounds ::= 29-bit-encoded-integer +Number ::= 29-bit-encoded-integer + +*/ + +#define ELEMENT_TYPE_END 0x00 //Marks end of a list +#define ELEMENT_TYPE_VOID 0x01 +#define ELEMENT_TYPE_BOOLEAN 0x02 +#define ELEMENT_TYPE_CHAR 0x03 +#define ELEMENT_TYPE_I1 0x04 +#define ELEMENT_TYPE_U1 0x05 +#define ELEMENT_TYPE_I2 0x06 +#define ELEMENT_TYPE_U2 0x07 +#define ELEMENT_TYPE_I4 0x08 +#define ELEMENT_TYPE_U4 0x09 +#define ELEMENT_TYPE_I8 0x0a +#define ELEMENT_TYPE_U8 0x0b +#define ELEMENT_TYPE_R4 0x0c +#define ELEMENT_TYPE_R8 0x0d +#define ELEMENT_TYPE_STRING 0x0e +#define ELEMENT_TYPE_PTR 0x0f // Followed by type +#define ELEMENT_TYPE_BYREF 0x10 // Followed by type +#define ELEMENT_TYPE_VALUETYPE 0x11 // Followed by TypeDef or TypeRef token +#define ELEMENT_TYPE_CLASS 0x12 // Followed by TypeDef or TypeRef token +#define ELEMENT_TYPE_VAR 0x13 // Generic parameter in a generic type definition, represented as number +#define ELEMENT_TYPE_ARRAY 0x14 // type rank boundsCount bound1 ... loCount lo1 ... +#define ELEMENT_TYPE_GENERICINST 0x15 // Generic type instantiation. Followed by type type-arg-count type-1 ... type-n +#define ELEMENT_TYPE_TYPEDBYREF 0x16 +#define ELEMENT_TYPE_I 0x18 // System.IntPtr +#define ELEMENT_TYPE_U 0x19 // System.UIntPtr +#define ELEMENT_TYPE_FNPTR 0x1b // Followed by full method signature +#define ELEMENT_TYPE_OBJECT 0x1c // System.Object +#define ELEMENT_TYPE_SZARRAY 0x1d // Single-dim array with 0 lower bound +#define ELEMENT_TYPE_MVAR 0x1e // Generic parameter in a generic method definition,represented as number +#define ELEMENT_TYPE_CMOD_REQD 0x1f // Required modifier : followed by a TypeDef or TypeRef token +#define ELEMENT_TYPE_CMOD_OPT 0x20 // Optional modifier : followed by a TypeDef or TypeRef token +#define ELEMENT_TYPE_INTERNAL 0x21 // Implemented within the CLI +#define ELEMENT_TYPE_MODIFIER 0x40 // Or'd with following element types +#define ELEMENT_TYPE_SENTINEL 0x41 // Sentinel for vararg method signature +#define ELEMENT_TYPE_PINNED 0x45 // Denotes a local variable that points at a pinned object + +#define SIG_METHOD_DEFAULT 0x00 // default calling convention +#define SIG_METHOD_C 0x01 // C calling convention +#define SIG_METHOD_STDCALL 0x02 // Stdcall calling convention +#define SIG_METHOD_THISCALL 0x03 // thiscall calling convention +#define SIG_METHOD_FASTCALL 0x04 // fastcall calling convention +#define SIG_METHOD_VARARG 0x05 // vararg calling convention +#define SIG_FIELD 0x06 // encodes a field +#define SIG_LOCAL_SIG 0x07 // used for the .locals directive +#define SIG_PROPERTY 0x08 // used to encode a property + +#define SIG_GENERIC 0x10 // used to indicate that the method has one or more generic parameters. +#define SIG_HASTHIS 0x20 // used to encode the keyword instance in the calling convention +#define SIG_EXPLICITTHIS 0x40 // used to encode the keyword explicit in the calling convention + +#define SIG_INDEX_TYPE_TYPEDEF 0x00 // ParseTypeDefOrRefEncoded returns this as the out index type for typedefs +#define SIG_INDEX_TYPE_TYPEREF 0x01 // ParseTypeDefOrRefEncoded returns this as the out index type for typerefs +#define SIG_INDEX_TYPE_TYPESPEC 0x02 // ParseTypeDefOrRefEncoded returns this as the out index type for typespecs + + +typedef unsigned char sig_byte; +typedef unsigned char sig_elem_type; +typedef unsigned char sig_index_type; +typedef unsigned int sig_index; +typedef unsigned int sig_count; +typedef unsigned int sig_mem_number; + +class SigParser +{ + sig_byte *pbBase; + sig_byte *pbCur; + sig_byte *pbEnd; + +public: + bool Parse(sig_byte *blob, sig_count len); + bool HasThis(); + +private: + bool ParseByte(sig_byte *pbOut); + bool ParseNumber(sig_count *pOut); + bool ParseTypeDefOrRefEncoded(sig_index_type *pOutIndexType, sig_index *pOutIndex); + + bool ParseMethod(sig_elem_type); + bool ParseField(sig_elem_type); + bool ParseProperty(sig_elem_type); + bool ParseLocals(sig_elem_type); + bool ParseLocal(); + bool ParseOptionalCustomMods(); + bool ParseOptionalCustomModsOrConstraint(); + bool ParseCustomMod(); + bool ParseRetType(); + bool ParseType(); + bool ParseParam(); + bool ParseArrayShape(); + +protected: + ~SigParser() = default; + + // subtype these methods to create your parser side-effects + + //---------------------------------------------------- + + // a method with given elem_type + virtual void NotifyBeginMethod(sig_elem_type elem_type) = 0; + virtual void NotifyEndMethod() = 0; + + // the method has a this pointer + virtual void NotifyHasThis() = 0; + + // total parameters for the method + virtual void NotifyParamCount(sig_count) = 0; + + // starting a return type + virtual void NotifyBeginRetType() = 0; + virtual void NotifyEndRetType() = 0; + + // starting a parameter + virtual void NotifyBeginParam() = 0; + virtual void NotifyEndParam() = 0; + + // sentinel indication the location of the "..." in the method signature + virtual void NotifySentinel() = 0; + + // number of generic parameters in this method signature (if any) + virtual void NotifyGenericParamCount(sig_count) = 0; + + //---------------------------------------------------- + + // a field with given elem_type + virtual void NotifyBeginField(sig_elem_type elem_type) = 0; + virtual void NotifyEndField() = 0; + + //---------------------------------------------------- + + // a block of locals with given elem_type (always just LOCAL_SIG for now) + virtual void NotifyBeginLocals(sig_elem_type elem_type) = 0; + virtual void NotifyEndLocals() = 0; + + // count of locals with a block + virtual void NotifyLocalsCount(sig_count) = 0; + + // starting a new local within a local block + virtual void NotifyBeginLocal() = 0; + virtual void NotifyEndLocal() = 0; + + // the only constraint available to locals at the moment is ELEMENT_TYPE_PINNED + virtual void NotifyConstraint(sig_elem_type elem_type) = 0; + + + //---------------------------------------------------- + + // a property with given element type + virtual void NotifyBeginProperty(sig_elem_type elem_type) = 0; + virtual void NotifyEndProperty() = 0; + + //---------------------------------------------------- + + // starting array shape information for array types + virtual void NotifyBeginArrayShape() = 0; + virtual void NotifyEndArrayShape() = 0; + + // array rank (total number of dimensions) + virtual void NotifyRank(sig_count) = 0; + + // number of dimensions with specified sizes followed by the size of each + virtual void NotifyNumSizes(sig_count) = 0; + virtual void NotifySize(sig_count) = 0; + + // BUG BUG lower bounds can be negative, how can this be encoded? + // number of dimensions with specified lower bounds followed by lower bound of each + virtual void NotifyNumLoBounds(sig_count) = 0; + virtual void NotifyLoBound(sig_count) = 0; + + //---------------------------------------------------- + + + // starting a normal type (occurs in many contexts such as param, field, local, etc) + virtual void NotifyBeginType() = 0; + virtual void NotifyEndType() = 0; + + virtual void NotifyTypedByref() = 0; + + // the type has the 'byref' modifier on it -- this normally proceeds the type definition in the context + // the type is used, so for instance a parameter might have the byref modifier on it + // so this happens before the BeginType in that context + virtual void NotifyByref() = 0; + + // the type is "VOID" (this has limited uses, function returns and void pointer) + virtual void NotifyVoid() = 0; + + // the type has the indicated custom modifiers (which can be optional or required) + virtual void NotifyCustomMod(sig_elem_type cmod, sig_index_type indexType, sig_index index) = 0; + + // the type is a simple type, the elem_type defines it fully + virtual void NotifyTypeSimple(sig_elem_type elem_type) = 0; + + // the type is specified by the given index of the given index type (normally a type index in the type metadata) + // this callback is normally qualified by other ones such as NotifyTypeClass or NotifyTypeValueType + virtual void NotifyTypeDefOrRef(sig_index_type indexType, int index) = 0; + + // the type is an instance of a generic + // elem_type indicates value_type or class + // indexType and index indicate the metadata for the type in question + // number indicates the number of type specifications for the generic types that will follow + virtual void NotifyTypeGenericInst(sig_elem_type elem_type, sig_index_type indexType, sig_index index, sig_mem_number number) = 0; + + // the type is the type of the nth generic type parameter for the class + virtual void NotifyTypeGenericTypeVariable(sig_mem_number number) = 0; + + // the type is the type of the nth generic type parameter for the member + virtual void NotifyTypeGenericMemberVariable(sig_mem_number number) = 0; + + // the type will be a value type + virtual void NotifyTypeValueType() = 0; + + // the type will be a class + virtual void NotifyTypeClass() = 0; + + // the type is a pointer to a type (nested type notifications follow) + virtual void NotifyTypePointer() = 0; + + // the type is a function pointer, followed by the type of the function + virtual void NotifyTypeFunctionPointer() = 0; + + // the type is an array, this is followed by the array shape, see above, as well as modifiers and element type + virtual void NotifyTypeArray() = 0; + + // the type is a simple zero-based array, this has no shape but does have custom modifiers and element type + virtual void NotifyTypeSzArray() = 0; +}; + +//---------------------------------------------------- + +#endif // __PROFILER_SIGNATURE_PARSER__ diff --git a/Procfiler/src/cpp/shared/info/sigparser/sigparserimpl.hpp b/Procfiler/src/cpp/shared/info/sigparser/sigparserimpl.hpp new file mode 100644 index 000000000..1b421dbb1 --- /dev/null +++ b/Procfiler/src/cpp/shared/info/sigparser/sigparserimpl.hpp @@ -0,0 +1,150 @@ +#ifndef PROCFILER_SIGPARSERIMPL_H +#define PROCFILER_SIGPARSERIMPL_H + +#include "sigparser.h" + +class SigFormatParserImpl final : public SigParser { + bool myHasThis = false; + +public: + bool HasThis() const { + return myHasThis; + } + +protected: + void NotifyHasThis() override { + myHasThis = true; + } + + void NotifyBeginMethod(sig_elem_type elem_type) override { + } + + void NotifyEndMethod() override { + } + + void NotifyParamCount(sig_count) override { + } + + void NotifyBeginRetType() override { + } + + void NotifyEndRetType() override { + } + + void NotifyBeginParam() override { + } + + void NotifyEndParam() override { + } + + void NotifySentinel() override { + } + + void NotifyGenericParamCount(sig_count) override { + } + + void NotifyBeginField(sig_elem_type elem_type) override { + } + + void NotifyEndField() override { + } + + void NotifyBeginLocals(sig_elem_type elem_type) override { + } + + void NotifyEndLocals() override { + } + + void NotifyLocalsCount(sig_count) override { + } + + void NotifyBeginLocal() override { + } + + void NotifyEndLocal() override { + } + + void NotifyConstraint(sig_elem_type elem_type) override { + } + + void NotifyBeginProperty(sig_elem_type elem_type) override { + } + + void NotifyEndProperty() override { + } + + void NotifyBeginArrayShape() override { + } + + void NotifyEndArrayShape() override { + } + + void NotifyRank(sig_count) override { + } + + void NotifyNumSizes(sig_count) override { + } + + void NotifySize(sig_count) override { + } + + void NotifyNumLoBounds(sig_count) override { + } + + void NotifyLoBound(sig_count) override { + } + + void NotifyBeginType() override { + } + + void NotifyEndType() override { + } + + void NotifyTypedByref() override { + } + + void NotifyByref() override { + } + + void NotifyVoid() override { + } + + void NotifyCustomMod(sig_elem_type cmod, sig_index_type indexType, sig_index index) override { + } + + void NotifyTypeSimple(sig_elem_type elem_type) override { + } + + void NotifyTypeDefOrRef(sig_index_type indexType, int index) override { + } + + void NotifyTypeGenericInst(sig_elem_type elem_type, sig_index_type indexType, sig_index index, + sig_mem_number number) override { + } + + void NotifyTypeGenericTypeVariable(sig_mem_number number) override { + } + + void NotifyTypeGenericMemberVariable(sig_mem_number number) override { + } + + void NotifyTypeValueType() override { + } + + void NotifyTypeClass() override { + } + + void NotifyTypePointer() override { + } + + void NotifyTypeFunctionPointer() override { + } + + void NotifyTypeArray() override { + } + + void NotifyTypeSzArray() override { + } +}; + +#endif //PROCFILER_SIGPARSERIMPL_H diff --git a/Procfiler/src/cpp/shared/miniutf/miniutf.cpp b/Procfiler/src/cpp/shared/miniutf/miniutf.cpp index a06c71b97..ca2321c27 100644 --- a/Procfiler/src/cpp/shared/miniutf/miniutf.cpp +++ b/Procfiler/src/cpp/shared/miniutf/miniutf.cpp @@ -22,6 +22,7 @@ #include "miniutf.hpp" #include +#include namespace miniutf { @@ -103,7 +104,7 @@ namespace miniutf { if (((b1 = str[i + 1]) & 0xC0) != 0x80) return invalid_pt; - char32_t pt = (b0 & 0x1F) << 6 | (b1 & 0x3F); + const char32_t pt = (b0 & 0x1F) << 6 | (b1 & 0x3F); if (pt < 0x80) return invalid_pt; @@ -116,7 +117,7 @@ namespace miniutf { if (((b2 = str[i + 2]) & 0xC0) != 0x80) return invalid_pt; - char32_t pt = (b0 & 0x0F) << 12 | (b1 & 0x3F) << 6 | (b2 & 0x3F); + const char32_t pt = (b0 & 0x0F) << 12 | (b1 & 0x3F) << 6 | (b2 & 0x3F); if (pt < 0x800) return invalid_pt; @@ -131,7 +132,7 @@ namespace miniutf { if (((b3 = str[i + 3]) & 0xC0) != 0x80) return invalid_pt; - char32_t pt = (b0 & 0x0F) << 18 | (b1 & 0x3F) << 12 + const char32_t pt = (b0 & 0x0F) << 18 | (b1 & 0x3F) << 12 | (b2 & 0x3F) << 6 | (b3 & 0x3F); if (pt < 0x10000 || pt >= 0x110000) return invalid_pt; @@ -154,7 +155,7 @@ namespace miniutf { static offset_pt utf16_decode_check(const std::u16string& str, std::u16string::size_type i) { if (is_high_surrogate(str[i]) && is_low_surrogate(str[i + 1])) { // High surrogate followed by low surrogate - char32_t pt = (((str[i] - 0xD800) << 10) | (str[i + 1] - 0xDC00)) + 0x10000; + const char32_t pt = (((str[i] - 0xD800) << 10) | (str[i + 1] - 0xDC00)) + 0x10000; return { 2, pt }; } else if (is_high_surrogate(str[i]) || is_low_surrogate(str[i])) { @@ -184,7 +185,7 @@ namespace miniutf { char32_t utf8_decode(const std::string& str, std::string::size_type& i, bool* replacement_flag) { - offset_pt res = utf8_decode_check(str, i); + const offset_pt res = utf8_decode_check(str, i); if (res.offset < 0) { if (replacement_flag) *replacement_flag = true; @@ -199,7 +200,7 @@ namespace miniutf { char32_t utf16_decode(const std::u16string& str, std::u16string::size_type& i, bool* replacement_flag) { - offset_pt res = utf16_decode_check(str, i); + const offset_pt res = utf16_decode_check(str, i); if (res.offset < 0) { if (replacement_flag) *replacement_flag = true; @@ -262,7 +263,7 @@ namespace miniutf { std::string to_utf8(const std::u32string& str) { std::string out; out.reserve(str.length() * 3 / 2); // estimate - for (char32_t pt : str) + for (const char32_t pt : str) utf8_encode(pt, out); return out; } @@ -275,7 +276,7 @@ namespace miniutf { std::string out; out.reserve(str.size()); for (size_t i = 0; i < str.length(); ) { - int32_t pt = utf8_decode(str, i); + const int32_t pt = utf8_decode(str, i); utf8_encode(pt + lowercase_offset(pt), out); } return out; @@ -305,7 +306,7 @@ namespace miniutf { return; } - size_t length = (decomp_start_idx >> 14) + 1; + const size_t length = (decomp_start_idx >> 14) + 1; decomp_start_idx &= (1 << 14) - 1; for (size_t i = 0; i < length; i++) { @@ -344,7 +345,7 @@ namespace miniutf { std::u32string codepoints; codepoints.reserve(str.size()); for (size_t i = 0; i < str.length(); ) { - uint32_t pt = utf8_decode(str, i, replacement_flag); + const uint32_t pt = utf8_decode(str, i, replacement_flag); unicode_decompose(pt, codepoints); } @@ -375,10 +376,10 @@ namespace miniutf { char32_t starter = codepoints[0]; while (i < codepoints.length()) { - char32_t ch = codepoints[i]; - int ch_class = ccc(ch); + const char32_t ch = codepoints[i]; + const int ch_class = ccc(ch); - uint32_t composite = unicode_compose(starter, ch); + const uint32_t composite = unicode_compose(starter, ch); if (composite && last_class < ch_class) { codepoints[starter_pos] = composite; starter = composite; @@ -406,7 +407,7 @@ namespace miniutf { } std::string normalize8(const std::string& str, bool compose, bool* replacement_flag) { - std::u32string codepoints = normalize32(str, compose, replacement_flag); + const std::u32string codepoints = normalize32(str, compose, replacement_flag); return to_utf8(codepoints); } diff --git a/Procfiler/src/cpp/shared/util/MetadataCookie.hpp b/Procfiler/src/cpp/shared/util/MetadataCookie.hpp new file mode 100644 index 000000000..e8734f605 --- /dev/null +++ b/Procfiler/src/cpp/shared/util/MetadataCookie.hpp @@ -0,0 +1,24 @@ +// +// Created by HYPERPC on 9/13/2025. +// + +#ifndef PROCFILER_METADATACOOKIE_H +#define PROCFILER_METADATACOOKIE_H +#include + + +class MetadataCookie { + IMetaDataImport2* myMetadata; + +public: + explicit MetadataCookie(IMetaDataImport2* metadata) { + myMetadata = metadata; + } + + ~MetadataCookie() { + myMetadata->Release(); + } +}; + + +#endif //PROCFILER_METADATACOOKIE_H diff --git a/Procfiler/src/cpp/shared/util/env_constants.cpp b/Procfiler/src/cpp/shared/util/env_constants.cpp index 956e86c0e..4ca1e5055 100644 --- a/Procfiler/src/cpp/shared/util/env_constants.cpp +++ b/Procfiler/src/cpp/shared/util/env_constants.cpp @@ -5,8 +5,8 @@ bool IsEnvVarDefined(const std::string& envVarName) { } bool TryGetEnvVar(const std::string& envVarName, std::string& value) { - auto envVar = std::getenv(envVarName.c_str()); - bool isEnvVarDefined = envVar != nullptr; + const auto envVar = std::getenv(envVarName.c_str()); + const bool isEnvVarDefined = envVar != nullptr; value = isEnvVarDefined ? std::string(envVar) : ""; return isEnvVarDefined; } diff --git a/Procfiler/src/cpp/shared/util/env_constants.h b/Procfiler/src/cpp/shared/util/env_constants.h index afd6cca8c..21e860ef0 100644 --- a/Procfiler/src/cpp/shared/util/env_constants.h +++ b/Procfiler/src/cpp/shared/util/env_constants.h @@ -5,16 +5,19 @@ const std::string trueEnvVarValue = "1"; -const std::string shadowStackDebugSavePath = "PROCFILER_DEBUG_SAVE_CALL_STACKS_PATH"; -const std::string enableConsoleLogging = "PROCFILER_ENABLE_CONSOLE_LOGGING"; -const std::string binaryStackSavePath = "PROCFILER_BINARY_SAVE_STACKS_PATH"; -const std::string eventPipeSaveShadowStack = "PROCFILER_EVENT_PIPE_SAVE_STACKS"; - -const std::string filterMethodsRegex = "PROCFILER_FILTER_METHODS_REGEX"; -const std::string filterMethodsDuringRuntime = "PROCFILER_FILTER_METHODS_DURING_RUNTIME"; -const std::string useSeparateBinStacksFiles = "PROCFILER_USE_SEPARATE_BINSTACKS_FILES"; +const std::string shadowStackDebugSavePathEnv = "PROCFILER_DEBUG_SAVE_CALL_STACKS_PATH"; +const std::string enableConsoleLoggingEnv = "PROCFILER_ENABLE_CONSOLE_LOGGING"; +const std::string binaryStackSavePathEnv = "PROCFILER_BINARY_SAVE_STACKS_PATH"; +const std::string eventPipeSaveShadowStackEnv = "PROCFILER_EVENT_PIPE_SAVE_STACKS"; + +const std::string filterMethodsRegexEnv = "PROCFILER_FILTER_METHODS_REGEX"; +const std::string filterMethodsDuringRuntimeEnv = "PROCFILER_FILTER_METHODS_DURING_RUNTIME"; +const std::string useSeparateBinStacksFilesEnv = "PROCFILER_USE_SEPARATE_BINSTACKS_FILES"; const std::string onlineSerializationEnv = "PROCFILER_ONLINE_SERIALIZATION"; +const std::string produceObjectBinStacksEnv = "PROCFILER_PRODUCE_OBJECT_BIN_STACKS"; +const std::string objectsTrackingFilterRegex = "PROCFILER_OBJECTS_TRACKING_FILTER_REGEX"; + bool IsEnvVarDefined(const std::string& envVarName); bool TryGetEnvVar(const std::string& envVarName, std::string& value); diff --git a/Procfiler/src/cpp/shared/util/helpers.cpp b/Procfiler/src/cpp/shared/util/helpers.cpp index b9b0912d3..112bed04a 100644 --- a/Procfiler/src/cpp/shared/util/helpers.cpp +++ b/Procfiler/src/cpp/shared/util/helpers.cpp @@ -7,13 +7,13 @@ HRESULT CreateAssemblyRef(IMetaDataAssemblyEmit* metadataAssemblyEmit, mdAssemblyRef* libRef, const std::vector& public_key, - ASSEMBLYMETADATA metadata, + const ASSEMBLYMETADATA& metadata, const wstring& assemblyName) { - HRESULT hr = metadataAssemblyEmit->DefineAssemblyRef( - (void*) public_key.data(), - (ULONG) public_key.size(), - assemblyName.c_str(), &metadata, NULL, 0, 0, - libRef); + const HRESULT hr = metadataAssemblyEmit->DefineAssemblyRef( + (void*) public_key.data(), + (ULONG) public_key.size(), + assemblyName.c_str(), &metadata, NULL, 0, 0, + libRef); return hr; } diff --git a/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.cpp b/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.cpp index 71c2a87d2..6c6b5f86d 100644 --- a/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.cpp +++ b/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.cpp @@ -3,7 +3,7 @@ #include "../util/env_constants.h" char* PatchMessage(const std::string& message) { - auto patchedMessage = new char[message.length() + 1]; + const auto patchedMessage = new char[message.length() + 1]; auto i = 0; for (;i < message.length(); ++i) { patchedMessage[i] = message[i]; @@ -13,24 +13,24 @@ char* PatchMessage(const std::string& message) { return patchedMessage; } -void ProcfilerLogger::LogInformation(const std::string& message) { +void ProcfilerLogger::LogInformation(const std::string& message) const { if (!myIsEnabled) return; - auto patchedMessage = PatchMessage(message); + const auto patchedMessage = PatchMessage(message); std::cout << patchedMessage; delete[] patchedMessage; } ProcfilerLogger::ProcfilerLogger() { - auto enableLoggingEnv = std::getenv(enableConsoleLogging.c_str()); + const auto enableLoggingEnv = std::getenv(enableConsoleLoggingEnv.c_str()); myIsEnabled = enableLoggingEnv != nullptr && std::string(enableLoggingEnv) == "1"; } -void ProcfilerLogger::LogError(const std::string &message) { +void ProcfilerLogger::LogError(const std::string &message) const { if (!myIsEnabled) return; - auto patchedMessage = PatchMessage(message); + const auto patchedMessage = PatchMessage(message); std::cerr << patchedMessage; delete[] patchedMessage; diff --git a/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.h b/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.h index e12fb5bc6..963038588 100644 --- a/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.h +++ b/Procfiler/src/cpp/shared/util/logging/ProcfilerLogger.h @@ -10,8 +10,8 @@ class ProcfilerLogger { public: ProcfilerLogger(); - void LogInformation(const std::string& message); - void LogError(const std::string& message); + void LogInformation(const std::string& message) const; + void LogError(const std::string& message) const; }; diff --git a/Procfiler/src/cpp/shared/util/util.cpp b/Procfiler/src/cpp/shared/util/util.cpp index 31e3938e5..89c63decd 100644 --- a/Procfiler/src/cpp/shared/util/util.cpp +++ b/Procfiler/src/cpp/shared/util/util.cpp @@ -3,7 +3,7 @@ std::string GetEnvironmentValue(const std::string& name) { - auto cstr = std::getenv(name.c_str()); + const auto cstr = std::getenv(name.c_str()); if (cstr == nullptr) { return ""; } @@ -35,12 +35,12 @@ std::vector ToRaw(PCCOR_SIGNATURE signature, ULONG length) { WCHAR operator "" _W(const char c) { return WCHAR(c); } wstring operator "" _W(const char* arr, size_t size) { - std::string str(arr, size); + const std::string str(arr, size); return ToWString(str); } std::string ToString(const wstring& wstr) { - std::u16string ustr(reinterpret_cast(wstr.c_str())); + const std::u16string ustr(reinterpret_cast(wstr.c_str())); return miniutf::to_utf8(ustr); } @@ -49,7 +49,7 @@ wstring ToWString(const char* str) { } wstring ToWString(const std::string& str) { - auto ustr = miniutf::to_utf16(str); + const auto ustr = miniutf::to_utf16(str); return wstring(reinterpret_cast(ustr.c_str())); } @@ -60,14 +60,14 @@ wstring Trim(const wstring& str) { wstring trimmed = str; - auto trimSymbols = " \t\r\n\0"_W; + const auto trimSymbols = " \t\r\n\0"_W; - auto lpos = trimmed.find_first_not_of(trimSymbols); + const auto lpos = trimmed.find_first_not_of(trimSymbols); if (lpos != std::string::npos && lpos > 0) { trimmed = trimmed.substr(lpos); } - auto rpos = trimmed.find_last_not_of(trimSymbols); + const auto rpos = trimmed.find_last_not_of(trimSymbols); if (rpos != std::string::npos) { trimmed = trimmed.substr(0, rpos + 1); } @@ -82,14 +82,14 @@ std::string Trim(const std::string& str) { std::string trimmed = str; - auto trimSymbols = " \t\r\n\0"; + const auto trimSymbols = " \t\r\n\0"; - auto lpos = trimmed.find_first_not_of(trimSymbols); + const auto lpos = trimmed.find_first_not_of(trimSymbols); if (lpos != std::string::npos && lpos > 0) { trimmed = trimmed.substr(lpos); } - auto rpos = trimmed.find_last_not_of(trimSymbols); + const auto rpos = trimmed.find_last_not_of(trimSymbols); if (rpos != std::string::npos) { trimmed = trimmed.substr(0, rpos + 1); } diff --git a/Procfiler/src/dotnet/Core/Collector/IEventPipeProvidersProvider.cs b/Procfiler/src/dotnet/Core/Collector/IEventPipeProvidersProvider.cs index 9f51ec1eb..1adbcf621 100644 --- a/Procfiler/src/dotnet/Core/Collector/IEventPipeProvidersProvider.cs +++ b/Procfiler/src/dotnet/Core/Collector/IEventPipeProvidersProvider.cs @@ -41,8 +41,7 @@ public class EventPipeProvidersProviderImpl : IEventPipeProvidersProvider [ new EventPipeProvider(ClrTraceEventParser.ProviderName, EventLevel.Verbose, (long)ClrTraceEventParser.Keywords.All), new EventPipeProvider(SampleProfilerTraceEventParser.ProviderName, EventLevel.Verbose), - new EventPipeProvider(TplEtwProviderTraceEventParser.ProviderName, EventLevel.Verbose, - (long)TplEtwProviderTraceEventParser.Keywords.Default), + new EventPipeProvider(TplEtwProviderTraceEventParser.ProviderName, EventLevel.Verbose, (long)TplEtwProviderTraceEventParser.Keywords.Default), new EventPipeProvider(ClrPrivateTraceEventParser.ProviderName, EventLevel.Verbose, ClrPrivateTraceEventParserKeywords), new EventPipeProvider(EventPipeProvidersNames.FrameworkEventSource, EventLevel.Verbose, FrameworkTraceEventParserKeywords), new EventPipeProvider(EventPipeProvidersNames.NetHttp, EventLevel.Verbose), @@ -79,8 +78,7 @@ public class EventPipeProvidersProviderImpl : IEventPipeProvidersProvider [ new EventPipeProvider(EventPipeProvidersNames.ProcfilerCppProvider, EventLevel.LogAlways), new EventPipeProvider(ClrTraceEventParser.ProviderName, EventLevel.Verbose, (long)ClrTraceEventParser.Keywords.Jit), - new EventPipeProvider(TplEtwProviderTraceEventParser.ProviderName, EventLevel.Verbose, - (long)TplEtwProviderTraceEventParser.Keywords.Tasks) + new EventPipeProvider(TplEtwProviderTraceEventParser.ProviderName, EventLevel.Verbose, (long)TplEtwProviderTraceEventParser.Keywords.Tasks) ] }; diff --git a/Procfiler/src/dotnet/Core/CommandLine/Utils.cs b/Procfiler/src/dotnet/Core/CommandLine/Utils.cs index ee0b3e209..609d64a89 100644 --- a/Procfiler/src/dotnet/Core/CommandLine/Utils.cs +++ b/Procfiler/src/dotnet/Core/CommandLine/Utils.cs @@ -8,26 +8,29 @@ namespace Core.CommandLine; public static class ParseResultExtensions { - public static bool HasErrors(this ParseResult parseResult, IProcfilerLogger logger) + extension(ParseResult parseResult) { - var errors = parseResult.Errors; - if (errors.Count <= 0) return false; - - foreach (var error in errors) + public bool HasErrors(IProcfilerLogger logger) { - logger.LogError(error.Message); - } + var errors = parseResult.Errors; + if (errors.Count <= 0) return false; - return true; - } + foreach (var error in errors) + { + logger.LogError(error.Message); + } - public static void AssertAllOptionsArePresent(this ParseResult parseResult, IEnumerable