diff --git a/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml b/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml index 94e4c34e833de..ccb447e5ebfc5 100644 --- a/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml +++ b/eng/pipelines/coreclr/templates/crossgen2-comparison-job.yml @@ -67,6 +67,8 @@ jobs: value: ${{ parameters.targetarch }} - name: crossgencompare_build_artifact value: crossgen_comparison_build_${{ parameters.targetos }}_${{ parameters.targetarch }} + - name: displayname_comparison_job + value: ${{ format('Test crossgen2-comparison {0}{1} {2} {3} to {4} {5}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.targetarch, parameters.targetos) }} - ${{ if eq(parameters.targetos, 'windows') }}: - name: target_crossgen2_os value: windows @@ -138,6 +140,7 @@ jobs: CorrelationPayloadDirectory: '$(Build.SourcesDirectory)/src/tests/Common/scripts' ${{ if ne(parameters.osGroup, 'windows') }}: WorkItemCommand: + echo $(displayname_comparison_job) ; echo Targeting $(targetFlavor) ; chmod +x $HELIX_WORKITEM_PAYLOAD/corerun; mkdir -p $HELIX_WORKITEM_PAYLOAD/log; @@ -154,6 +157,7 @@ jobs: --diff_dir $HELIX_WORKITEM_PAYLOAD/log ${{ if eq(parameters.osGroup, 'windows') }}: WorkItemCommand: + echo $(displayname_comparison_job) & echo Targeting $(targetFlavor) & md %HELIX_WORKITEM_PAYLOAD%\log & set CORE_ROOT=%HELIX_CORRELATION_PAYLOAD% & diff --git a/src/coreclr/src/gcdump/i386/gcdumpx86.cpp b/src/coreclr/src/gcdump/i386/gcdumpx86.cpp index 92b64430aece9..1bf3e61011bd3 100644 --- a/src/coreclr/src/gcdump/i386/gcdumpx86.cpp +++ b/src/coreclr/src/gcdump/i386/gcdumpx86.cpp @@ -255,7 +255,7 @@ size_t GCDump::DumpGCTable(PTR_CBYTE table, table = DumpEncoding(table, sz); - _ASSERTE(0 == ~OFFSET_MASK % sizeof(void*)); + _ASSERTE(0 == ~OFFSET_MASK % sizeof(uint32_t)); lowBits = OFFSET_MASK & stkOffs; stkOffs &= ~OFFSET_MASK; @@ -304,7 +304,7 @@ size_t GCDump::DumpGCTable(PTR_CBYTE table, DumpEncoding(bp, table-bp); - _ASSERTE(0 == ~OFFSET_MASK % sizeof(void*)); + _ASSERTE(0 == ~OFFSET_MASK % sizeof(uint32_t)); lowBits = varOffs & 0x3; varOffs &= ~OFFSET_MASK; diff --git a/src/coreclr/src/jit/lower.cpp b/src/coreclr/src/jit/lower.cpp index 6494b9515626b..d047083e763f3 100644 --- a/src/coreclr/src/jit/lower.cpp +++ b/src/coreclr/src/jit/lower.cpp @@ -2549,7 +2549,7 @@ GenTree* Lowering::OptimizeConstCompare(GenTree* cmp) // into ((x AND mask) NE|EQ 0) when mask is a single bit. // - if (isPow2(static_cast(op2Value)) && andOp2->IsIntegralConst(op2Value)) + if (isPow2(static_cast(op2Value)) && andOp2->IsIntegralConst(op2Value)) { op2Value = 0; op2->SetIconValue(0); diff --git a/src/coreclr/src/tools/aot/crossgen2/CommandLineOptions.cs b/src/coreclr/src/tools/aot/crossgen2/CommandLineOptions.cs index 1c8bcd4e63ed3..7fc55e36aaf68 100644 --- a/src/coreclr/src/tools/aot/crossgen2/CommandLineOptions.cs +++ b/src/coreclr/src/tools/aot/crossgen2/CommandLineOptions.cs @@ -53,6 +53,7 @@ internal class CommandLineOptions public string SingleMethodTypeName; public string SingleMethodName; + public int SingleMethodIndex; public IReadOnlyList SingleMethodGenericArg; public IReadOnlyList CodegenOptions; @@ -107,6 +108,7 @@ public CommandLineOptions(string[] args) syntax.DefineOption("singlemethodtypename", ref SingleMethodTypeName, SR.SingleMethodTypeName); syntax.DefineOption("singlemethodname", ref SingleMethodName, SR.SingleMethodMethodName); + syntax.DefineOption("singlemethodindex", ref SingleMethodIndex, SR.SingleMethodIndex); syntax.DefineOptionList("singlemethodgenericarg", ref SingleMethodGenericArg, SR.SingleMethodGenericArgs); syntax.DefineOption("parallelism", ref Parallelism, SR.ParalellismOption); diff --git a/src/coreclr/src/tools/aot/crossgen2/Program.cs b/src/coreclr/src/tools/aot/crossgen2/Program.cs index 86122bec482ff..751e10b190873 100644 --- a/src/coreclr/src/tools/aot/crossgen2/Program.cs +++ b/src/coreclr/src/tools/aot/crossgen2/Program.cs @@ -634,7 +634,50 @@ private MethodDesc CheckAndParseSingleMethodModeArguments(CompilerTypeSystemCont TypeDesc owningType = FindType(context, _commandLineOptions.SingleMethodTypeName); // TODO: allow specifying signature to distinguish overloads - MethodDesc method = owningType.GetMethod(_commandLineOptions.SingleMethodName, null); + MethodDesc method = null; + bool printMethodList = false; + int curIndex = 0; + foreach (var searchMethod in owningType.GetMethods()) + { + if (searchMethod.Name != _commandLineOptions.SingleMethodName) + continue; + + curIndex++; + if (_commandLineOptions.SingleMethodIndex != 0) + { + if (curIndex == _commandLineOptions.SingleMethodIndex) + { + method = searchMethod; + break; + } + } + else + { + if (method == null) + { + method = searchMethod; + } + else + { + printMethodList = true; + } + } + } + + if (printMethodList) + { + curIndex = 0; + foreach (var searchMethod in owningType.GetMethods()) + { + if (searchMethod.Name != _commandLineOptions.SingleMethodName) + continue; + + curIndex++; + Console.WriteLine($"{curIndex} - {searchMethod}"); + } + throw new CommandLineException(SR.SingleMethodIndexNeeded); + } + if (method == null) throw new CommandLineException(string.Format(SR.MethodNotFoundOnType, _commandLineOptions.SingleMethodName, _commandLineOptions.SingleMethodTypeName)); @@ -666,6 +709,20 @@ private static bool DumpReproArguments(CodeGenerationFailedException ex) Console.Write($"--singlemethodtypename \"{formatter.FormatName(failingMethod.OwningType, true)}\""); Console.Write($" --singlemethodname {failingMethod.Name}"); + { + int curIndex = 0; + foreach (var searchMethod in failingMethod.OwningType.GetMethods()) + { + if (searchMethod.Name != failingMethod.Name) + continue; + + curIndex++; + if (searchMethod == failingMethod.GetMethodDefinition()) + { + Console.Write($" --singlemethodindex {curIndex}"); + } + } + } for (int i = 0; i < failingMethod.Instantiation.Length; i++) Console.Write($" --singlemethodgenericarg \"{formatter.FormatName(failingMethod.Instantiation[i], true)}\""); diff --git a/src/coreclr/src/tools/aot/crossgen2/Properties/Resources.resx b/src/coreclr/src/tools/aot/crossgen2/Properties/Resources.resx index 687e7818f337d..6020c7a61f97d 100644 --- a/src/coreclr/src/tools/aot/crossgen2/Properties/Resources.resx +++ b/src/coreclr/src/tools/aot/crossgen2/Properties/Resources.resx @@ -226,7 +226,10 @@ Single method compilation: generic arguments to the method - Single method compilation: generic arguments to the method + Single method compilation: method name + + + Single method compilation: Index of method if there are multiple with the same name Single method compilation: name of the owning type @@ -252,6 +255,9 @@ Both method name and type name are required parameters for single method mode + + There are multiple methods with the same name. Specify --singlemethodindex [index] with the correct index. + Type '{0}' not found diff --git a/src/tests/Common/scripts/crossgen2_comparison.py b/src/tests/Common/scripts/crossgen2_comparison.py index e3db1300bea11..df87eb750585f 100644 --- a/src/tests/Common/scripts/crossgen2_comparison.py +++ b/src/tests/Common/scripts/crossgen2_comparison.py @@ -526,7 +526,7 @@ def _build_args_crossgen_il_file(self, il_filename, ni_filename, platform_assemb args.append(self.dotnet) args.append(self.crossgen_executable_filename) args.append('-r') - args.append(platform_assemblies_paths + self.platform_directory_sep + '*.dll') + args.append('"' + platform_assemblies_paths + self.platform_directory_sep + '*.dll"' ) args.append('-O') args.append('--out') args.append(ni_filename)