From e76d09ac06650a32f585f349d1369fefbed78baf Mon Sep 17 00:00:00 2001 From: Andon Andonov Date: Mon, 7 Jan 2019 19:36:11 -0800 Subject: [PATCH] Add large version bubble test --- src/jit/importer.cpp | 1 - tests/runtest.cmd | 89 ++++++++++--------- tests/runtest.py | 6 ++ tests/src/CLRTest.CrossGen.targets | 5 +- .../readytorun/tests/versionbubbles/helper.cs | 13 +++ .../tests/versionbubbles/helper.csproj | 33 +++++++ .../tests/versionbubbles/versionbubbles.cs | 46 ++++++++++ .../versionbubbles/versionbubbles.csproj | 59 ++++++++++++ 8 files changed, 208 insertions(+), 44 deletions(-) create mode 100644 tests/src/readytorun/tests/versionbubbles/helper.cs create mode 100644 tests/src/readytorun/tests/versionbubbles/helper.csproj create mode 100644 tests/src/readytorun/tests/versionbubbles/versionbubbles.cs create mode 100644 tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp index 6062511ce18f..047085449143 100644 --- a/src/jit/importer.cpp +++ b/src/jit/importer.cpp @@ -19186,7 +19186,6 @@ void Compiler::impMarkInlineCandidate(GenTree* callNode, inlineResult.NoteFatal(InlineObservation::CALLSITE_IS_CALL_TO_HELPER); return; } - /* Ignore indirect calls */ if (call->gtCallType == CT_INDIRECT) { diff --git a/tests/runtest.cmd b/tests/runtest.cmd index 7b458064dfc8..858b0d67e35b 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -59,50 +59,52 @@ if /i "%1" == "-h" goto Usage if /i "%1" == "/help" goto Usage if /i "%1" == "-help" goto Usage -if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop) -if /i "%1" == "x86" (set __BuildArch=x86&shift&goto Arg_Loop) -if /i "%1" == "arm" (set __BuildArch=arm&shift&goto Arg_Loop) -if /i "%1" == "arm64" (set __BuildArch=arm64&shift&goto Arg_Loop) - -if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop) -if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop) -if /i "%1" == "checked" (set __BuildType=Checked&shift&goto Arg_Loop) - -if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop) -if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop) - -if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "AgainstPackages" (set __AgainstPackages=1&shift&goto Arg_Loop) -if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop) -if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop) -if /i "%1" == "crossgenaltjit" (set __DoCrossgen=1&set __CrossgenAltJit=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop) -if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop) -if /i "%1" == "jitstress" (set COMPlus_JitStress=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "jitstressregs" (set COMPlus_JitStressRegs=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "jitminopts" (set COMPlus_JITMinOpts=1&shift&goto Arg_Loop) -if /i "%1" == "jitforcerelocs" (set COMPlus_ForceRelocs=1&shift&goto Arg_Loop) -if /i "%1" == "jitdisasm" (set __JitDisasm=1&shift&goto Arg_Loop) -if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop) -if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&shift&goto Arg_Loop) -if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&shift&goto Arg_Loop) -if /i "%1" == "buildxunitwrappers" (set __BuildXunitWrappers=1&shift&goto Arg_Loop) -if /i "%1" == "printlastresultsonly" (set __PrintLastResultsOnly=1&shift&goto Arg_Loop) -if /i "%1" == "PerfTests" (set __PerfTests=true&shift&goto Arg_Loop) -if /i "%1" == "CoreFXTests" (set __CoreFXTests=true&shift&goto Arg_Loop) -if /i "%1" == "CoreFXTestsAll" (set __CoreFXTests=true&set __CoreFXTestsRunAllAvailable=true&shift&goto Arg_Loop) -if /i "%1" == "CoreFXTestList" (set __CoreFXTests=true&set __CoreFXTestList=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop) -if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop) +if /i "%1" == "x86" (set __BuildArch=x86&shift&goto Arg_Loop) +if /i "%1" == "arm" (set __BuildArch=arm&shift&goto Arg_Loop) +if /i "%1" == "arm64" (set __BuildArch=arm64&shift&goto Arg_Loop) + +if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop) +if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop) +if /i "%1" == "checked" (set __BuildType=Checked&shift&goto Arg_Loop) + +if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop) +if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop) + +if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "AgainstPackages" (set __AgainstPackages=1&shift&goto Arg_Loop) +if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop) +if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop) +if /i "%1" == "crossgenaltjit" (set __DoCrossgen=1&set __CrossgenAltJit=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop) +if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop) +if /i "%1" == "jitstress" (set COMPlus_JitStress=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "jitstressregs" (set COMPlus_JitStressRegs=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "jitminopts" (set COMPlus_JITMinOpts=1&shift&goto Arg_Loop) +if /i "%1" == "jitforcerelocs" (set COMPlus_ForceRelocs=1&shift&goto Arg_Loop) +if /i "%1" == "jitdisasm" (set __JitDisasm=1&shift&goto Arg_Loop) +if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop) +if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&shift&goto Arg_Loop) +if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&shift&goto Arg_Loop) +if /i "%1" == "buildxunitwrappers" (set __BuildXunitWrappers=1&shift&goto Arg_Loop) +if /i "%1" == "printlastresultsonly" (set __PrintLastResultsOnly=1&shift&goto Arg_Loop) +if /i "%1" == "PerfTests" (set __PerfTests=true&shift&goto Arg_Loop) +if /i "%1" == "CoreFXTests" (set __CoreFXTests=true&shift&goto Arg_Loop) +if /i "%1" == "CoreFXTestsAll" (set __CoreFXTests=true&set __CoreFXTestsRunAllAvailable=true&shift&goto Arg_Loop) +if /i "%1" == "CoreFXTestList" (set __CoreFXTests=true&set __CoreFXTestList=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop) +// This test feature is currently intentionally undocumented +if /i "%1" == "runlargeversionbubblecrossgentests" (set RunCrossGen=true&set CrossgenLargeVersionBubble=true&shift&goto Arg_Loop) +if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop) REM tieredcompilation is on by default now, but setting this environment variable is harmless and I didn't want to break any automation that might be using it just yet -if /i "%1" == "tieredcompilation" (set COMPLUS_TieredCompilation=1&shift&goto Arg_Loop) -if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "timeout" (set __TestTimeout=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "altjitarch" (set __AltJitArch=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "tieredcompilation" (set COMPLUS_TieredCompilation=1&shift&goto Arg_Loop) +if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "timeout" (set __TestTimeout=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "altjitarch" (set __AltJitArch=%2&shift&shift&goto Arg_Loop) REM change it to COMPlus_GCStress when we stop using xunit harness -if /i "%1" == "gcstresslevel" (set COMPlus_GCStress=%2&set __TestTimeout=1800000&shift&shift&goto Arg_Loop) -if /i "%1" == "collectdumps" (set __CollectDumps=true&shift&goto Arg_Loop) +if /i "%1" == "gcstresslevel" (set COMPlus_GCStress=%2&set __TestTimeout=1800000&shift&shift&goto Arg_Loop) +if /i "%1" == "collectdumps" (set __CollectDumps=true&shift&goto Arg_Loop) if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs :: All the rest of the args will be collected and passed directly to msbuild. @@ -205,6 +207,11 @@ if defined __DoCrossgen ( set __RuntestPyArgs=%__RuntestPyArgs% --precompile_core_root ) +if defined CrossgenLargeVersionBubble +( + set __RuntestPyArgs=%__RuntestPyArgs% --large_version_bubble +) + if defined __PrintLastResultsOnly ( set __RuntestPyArgs=%__RuntestPyArgs% --analyze_results_only ) diff --git a/tests/runtest.py b/tests/runtest.py index dee7c3a9344f..b8592345d483 100755 --- a/tests/runtest.py +++ b/tests/runtest.py @@ -118,6 +118,7 @@ parser.add_argument("--jitdisasm", dest="jitdisasm", action="store_true", default=False) parser.add_argument("--ilasmroundtrip", dest="ilasmroundtrip", action="store_true", default=False) parser.add_argument("--run_crossgen_tests", dest="run_crossgen_tests", action="store_true", default=False) +parser.add_argument("--large_version_bubble", dest="large_version_bubble", action="store_true", default=False) parser.add_argument("--precompile_core_root", dest="precompile_core_root", action="store_true", default=False) parser.add_argument("--sequential", dest="sequential", action="store_true", default=False) @@ -761,6 +762,10 @@ def run_tests(host_os, print("Running tests R2R") os.environ["RunCrossGen"] = "true" + if large_version_bubble: + print("Large Version Bubble enabled") + os.environ["LargeVersionBubble"] = "true" + if gc_stress: print("Running GCStress, extending timeout to 120 minutes.") os.environ["__TestTimeout"] = str(120*60*1000) # 1,800,000 ms @@ -2047,6 +2052,7 @@ def do_setup(host_os, is_ilasm=unprocessed_args.ilasmroundtrip, run_sequential=unprocessed_args.sequential, run_crossgen_tests=unprocessed_args.run_crossgen_tests, + large_version_bubble=unprocessed_args.large_version_bubble, test_env=test_env) ################################################################################ diff --git a/tests/src/CLRTest.CrossGen.targets b/tests/src/CLRTest.CrossGen.targets index 7dddfa2c365e..9dc441f63694 100644 --- a/tests/src/CLRTest.CrossGen.targets +++ b/tests/src/CLRTest.CrossGen.targets @@ -75,6 +75,7 @@ fi REM CrossGen Script if defined RunCrossGen ( + if defined LargeVersionBubble ( set OptionalArguments=!OptionalArguments! /largeversionbubble) set COMPlus_ZapRequire=$(ZapRequire) set COMPlus_ZapRequireList=$(MSBuildProjectName) if not exist "$(MSBuildProjectName).org" ( @@ -84,8 +85,8 @@ if defined RunCrossGen ( mkdir IL copy $(MSBuildProjectName).exe IL\$(MSBuildProjectName).exe ren $(MSBuildProjectName).exe $(MSBuildProjectName).org - echo "%_DebuggerFullPath% %CORE_ROOT%\crossgen.exe" /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe - %_DebuggerFullPath% "%CORE_ROOT%\crossgen.exe" /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe + echo "%_DebuggerFullPath% %CORE_ROOT%\crossgen.exe" !OptionalArguments! /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe + %_DebuggerFullPath% "%CORE_ROOT%\crossgen.exe" !OptionalArguments! /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe set CrossGenStatus=!ERRORLEVEL! ) call :ReleaseLock diff --git a/tests/src/readytorun/tests/versionbubbles/helper.cs b/tests/src/readytorun/tests/versionbubbles/helper.cs new file mode 100644 index 000000000000..8aeb51286326 --- /dev/null +++ b/tests/src/readytorun/tests/versionbubbles/helper.cs @@ -0,0 +1,13 @@ +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +public class Helper +{ + [MethodImplAttribute(MethodImplOptions.AggressiveInlining)] + public string GetLastMethodName() + { + StackTrace st = new StackTrace(); + return st.GetFrame(0).GetMethod().Name; + } +} \ No newline at end of file diff --git a/tests/src/readytorun/tests/versionbubbles/helper.csproj b/tests/src/readytorun/tests/versionbubbles/helper.csproj new file mode 100644 index 000000000000..45acb5ede084 --- /dev/null +++ b/tests/src/readytorun/tests/versionbubbles/helper.csproj @@ -0,0 +1,33 @@ + + + + + Debug + AnyCPU + 2.0 + {F74F55A1-DFCF-4C7C-B462-E96E1D0BB667} + library + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\..\ + $(DefineConstants);STATIC;CORECLR + SharedLibrary + True + + + + + + + + + False + + + + + + + + + + \ No newline at end of file diff --git a/tests/src/readytorun/tests/versionbubbles/versionbubbles.cs b/tests/src/readytorun/tests/versionbubbles/versionbubbles.cs new file mode 100644 index 000000000000..f3af29731da1 --- /dev/null +++ b/tests/src/readytorun/tests/versionbubbles/versionbubbles.cs @@ -0,0 +1,46 @@ +using System; + +public class Program +{ + public static int Main() + { + return RunTest(); + } + + public static int RunTest() + { + Helper helper = new Helper(); + string lastMethodName = String.Empty; + try + { + lastMethodName = helper.GetLastMethodName(); + } + catch (System.MissingMethodException e) + { + if((System.Environment.GetEnvironmentVariable("LargeVersionBubble") != null)) + { + // Cross-Assembly inlining is only allowed in multi-module version bubbles + Console.WriteLine("FAIL"); + return 101; + } + else + { + // The missing method is expected in the default crossgen case (i.e. no large version bubble) + Console.WriteLine("PASS"); + return 100; + } + } + + if (lastMethodName != "GetNumber") + { + // method in helper.cs has been inlined + Console.WriteLine("PASS"); + return 100; + } + else + { + Console.WriteLine("FAIL"); + return 101; + } + } +} \ No newline at end of file diff --git a/tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj b/tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj new file mode 100644 index 000000000000..08f8ca8620d4 --- /dev/null +++ b/tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj @@ -0,0 +1,59 @@ + + + + + Debug + AnyCPU + 2.0 + {7DECC55A-B584-4456-83BA-6C42A5B3B3CB} + exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + BuildAndRun + $(DefineConstants);STATIC;CORECLR + 1 + 1 + PdbOnly + True + + + + + + + + + False + + + + + {F74F55A1-DFCF-4C7C-B462-E96E1D0BB667} + + + + + + + + + + + + +