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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public struct NodeFactoryOptimizationFlags
public bool PrintReproArgs;
public bool EnableCachedInterfaceDispatchSupport;
public bool IsComponentModule;
public bool StripInliningInfo;
public bool StripDebugInfo;
}

// To make the code future compatible to the composite R2R story
Expand Down Expand Up @@ -753,7 +755,7 @@ public void AttachToDependencyGraph(DependencyAnalyzerBase<NodeFactory> graph, I
TypesTableNode typesTable = new TypesTableNode(inputModule);
tableHeader.Add(Internal.Runtime.ReadyToRunSectionType.AvailableTypes, typesTable, typesTable);

if (CompilationModuleGroup.IsCompositeBuildMode)
if (CompilationModuleGroup.IsCompositeBuildMode && !OptimizationFlags.StripInliningInfo)
{
InliningInfoNode inliningInfoTable = new InliningInfoNode(inputModule, InliningInfoNode.InfoType.InliningInfo2);
tableHeader.Add(Internal.Runtime.ReadyToRunSectionType.InliningInfo2, inliningInfoTable, inliningInfoTable);
Expand Down Expand Up @@ -788,19 +790,25 @@ public void AttachToDependencyGraph(DependencyAnalyzerBase<NodeFactory> graph, I
}
}

InliningInfoNode crossModuleInliningInfoTable = new InliningInfoNode(null,
CompilationModuleGroup.IsCompositeBuildMode ? InliningInfoNode.InfoType.CrossModuleInliningForCrossModuleDataOnly : InliningInfoNode.InfoType.CrossModuleAllMethods);
Header.Add(Internal.Runtime.ReadyToRunSectionType.CrossModuleInlineInfo, crossModuleInliningInfoTable, crossModuleInliningInfoTable);
this.CrossModuleInlningInfo = crossModuleInliningInfoTable;
if (!OptimizationFlags.StripInliningInfo)
{
InliningInfoNode crossModuleInliningInfoTable = new InliningInfoNode(null,
CompilationModuleGroup.IsCompositeBuildMode ? InliningInfoNode.InfoType.CrossModuleInliningForCrossModuleDataOnly : InliningInfoNode.InfoType.CrossModuleAllMethods);
Header.Add(Internal.Runtime.ReadyToRunSectionType.CrossModuleInlineInfo, crossModuleInliningInfoTable, crossModuleInliningInfoTable);
this.CrossModuleInlningInfo = crossModuleInliningInfoTable;
}

InstanceEntryPointTable = new InstanceEntryPointTableNode(this);
Header.Add(Internal.Runtime.ReadyToRunSectionType.InstanceMethodEntryPoints, InstanceEntryPointTable, InstanceEntryPointTable);

ImportSectionsTable = new ImportSectionsTableNode(this);
Header.Add(Internal.Runtime.ReadyToRunSectionType.ImportSections, ImportSectionsTable, ImportSectionsTable);

DebugInfoTable = new DebugInfoTableNode();
Header.Add(Internal.Runtime.ReadyToRunSectionType.DebugInfo, DebugInfoTable, DebugInfoTable);
if (!OptimizationFlags.StripDebugInfo)
{
DebugInfoTable = new DebugInfoTableNode();
Header.Add(Internal.Runtime.ReadyToRunSectionType.DebugInfo, DebugInfoTable, DebugInfoTable);
}

EagerImports = new ImportSectionNode(
"EagerImports",
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ internal class Crossgen2RootCommand : RootCommand
new("--make-repro-path") { Description = "Path where to place a repro package" };
public Option<bool> HotColdSplitting { get; } =
new("--hot-cold-splitting") { Description = SR.HotColdSplittingOption };
public Option<bool> StripInliningInfo { get; } =
new("--strip-inlining-info") { Description = SR.StripInliningInfoOption };
public Option<bool> StripDebugInfo { get; } =
new("--strip-debug-info") { Description = SR.StripDebugInfoOption };
public Option<bool> SynthesizeRandomMibc { get; } =
new("--synthesize-random-mibc");

Expand Down Expand Up @@ -219,6 +223,8 @@ public Crossgen2RootCommand(string[] args) : base(SR.Crossgen2BannerText)
Options.Add(CallChainProfileFile);
Options.Add(MakeReproPath);
Options.Add(HotColdSplitting);
Options.Add(StripInliningInfo);
Options.Add(StripDebugInfo);
Options.Add(SynthesizeRandomMibc);
Options.Add(DeterminismStress);

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/tools/aot/crossgen2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ private void RunSingleCompilation(Dictionary<string, string> inFilePaths, Instru
nodeFactoryFlags.DeterminismStress = Get(_command.DeterminismStress);
nodeFactoryFlags.PrintReproArgs = Get(_command.PrintReproInstructions);
nodeFactoryFlags.EnableCachedInterfaceDispatchSupport = Get(_command.EnableCachedInterfaceDispatchSupport) ?? !typeSystemContext.TargetAllowsRuntimeCodeGeneration;
nodeFactoryFlags.StripInliningInfo = Get(_command.StripInliningInfo);
nodeFactoryFlags.StripDebugInfo = Get(_command.StripDebugInfo);

builder
.UseMapFile(Get(_command.Map))
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/tools/aot/crossgen2/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,10 @@
<data name="ErrorContainerFormatRequiresComposite" xml:space="preserve">
<value>Error: Producing ReadyToRun output in the {0} format is only supported for Composite ReadyToRun images.</value>
</data>
<data name="StripInliningInfoOption" xml:space="preserve">
<value>Strip inlining info from the R2R image.</value>
</data>
<data name="StripDebugInfoOption" xml:space="preserve">
Copy link
Member

Choose a reason for hiding this comment

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

Is this managed or native debug info? i.e. does this affect native stack traces / crash reports in any way?

Copy link
Member

Choose a reason for hiding this comment

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

It is managed debug info. It does not affect what you see in the native debugger.

<value>Strip debug info from the R2R image.</value>
</data>
</root>
12 changes: 12 additions & 0 deletions src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ Copyright (c) .NET Foundation. All rights reserved.
<PublishReadyToRunEmitSymbols Condition="'$(PublishReadyToRunEmitSymbols)' == '' and $(RuntimeIdentifier.StartsWith('tvossimulator-'))">false</PublishReadyToRunEmitSymbols>
<PublishReadyToRunEmitSymbols Condition="'$(PublishReadyToRunEmitSymbols)' == '' and $(RuntimeIdentifier.StartsWith('maccatalyst-'))">false</PublishReadyToRunEmitSymbols>
<PublishReadyToRunEmitSymbols Condition="'$(PublishReadyToRunEmitSymbols)' == '' and $(RuntimeIdentifier.StartsWith('osx-'))">false</PublishReadyToRunEmitSymbols>

<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripInliningInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('ios-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripInliningInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('tvos-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripInliningInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('iossimulator-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripInliningInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('tvossimulator-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripInliningInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('maccatalyst-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info</PublishReadyToRunCrossgen2ExtraArgs>

<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('ios-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('tvos-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('iossimulator-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('tvossimulator-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('maccatalyst-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>
</PropertyGroup>

<!--
Expand Down
Loading