Skip to content

Commit

Permalink
Fix assembly references in tests (dotnet#31986)
Browse files Browse the repository at this point in the history
* Fix build warnings

* Reference System.Runtime instead of System.Private.CoreLib

* Change to System.Console

* Update C# script
  • Loading branch information
nxtn authored Feb 9, 2020
1 parent 46d72b5 commit 5c5aeb5
Show file tree
Hide file tree
Showing 12 changed files with 1,346 additions and 1,343 deletions.
2,603 changes: 1,302 additions & 1,301 deletions src/coreclr/tests/src/JIT/Directed/Convert/ldind_conv.il

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions src/coreclr/tests/src/JIT/Directed/Convert/ldind_conv_gen.csx
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ class Test
public void WriteCheckMethod(TextWriter writer)
{
writer.WriteLine();
writer.WriteLine($" .method private hidebysig static int32 Check_{Name}({Load.Type.ActualType.Name} input, {Store.Type.Name} expected, class [System.Private.CoreLib]System.String desc) cil managed noinlining");
writer.WriteLine($" .method private hidebysig static int32 Check_{Name}({Load.Type.ActualType.Name} input, {Store.Type.Name} expected, class [System.Runtime]System.String desc) cil managed noinlining");
writer.WriteLine($" {{");
writer.WriteLine($" .maxstack 4");
writer.WriteLine($" .locals init({Load.Type.Name} src, {Store.Type.Name} dst)");
writer.WriteLine($" ldarg.2");
writer.WriteLine($" call void Program::print(class [System.Private.CoreLib]System.String)");
writer.WriteLine($" call void Program::print(class [System.Runtime]System.String)");
writer.WriteLine($" ldarg.0");
writer.WriteLine($" stloc 0");
writer.WriteLine($" ldloca 0");
Expand All @@ -306,20 +306,20 @@ class Test
public void WriteCheckOverflowMethod(TextWriter writer)
{
writer.WriteLine();
writer.WriteLine($" .method private hidebysig static int32 CheckOvf_{Name}({Load.Type.ActualType.Name} input, class [System.Private.CoreLib]System.String desc) cil managed noinlining");
writer.WriteLine($" .method private hidebysig static int32 CheckOvf_{Name}({Load.Type.ActualType.Name} input, class [System.Runtime]System.String desc) cil managed noinlining");
writer.WriteLine($" {{");
writer.WriteLine($" .maxstack 4");
writer.WriteLine($" .locals init({Load.Type.Name} src, {Store.Type.Name} dst, int32 ovf)");
writer.WriteLine($" ldarg.1");
writer.WriteLine($" call void Program::print(class [System.Private.CoreLib]System.String)");
writer.WriteLine($" call void Program::print(class [System.Runtime]System.String)");
writer.WriteLine($" ldarg.0");
writer.WriteLine($" stloc 0");
writer.WriteLine($" .try {{");
writer.WriteLine($" ldloca 0");
writer.WriteLine($" ldloca 1");
writer.WriteLine($" call void Program::Test_{Name}({Load.Type.Name}&, {Store.Type.Name}&)");
writer.WriteLine($" leave END");
writer.WriteLine($" }} catch [System.Private.CoreLib]System.OverflowException {{");
writer.WriteLine($" }} catch [System.Runtime]System.OverflowException {{");
writer.WriteLine($" ldc.i4 1");
writer.WriteLine($" stloc 2");
writer.WriteLine($" leave END");
Expand Down Expand Up @@ -348,16 +348,17 @@ const string FileBeginIL = @"// Licensed to the .NET Foundation under one or mor
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
.assembly extern System.Private.CoreLib { auto }
.assembly extern System.Console { auto }
.assembly extern System.Runtime { auto }
.assembly test { }
.class auto Program extends [System.Private.CoreLib]System.Object
.class auto Program extends [System.Runtime]System.Object
{
.method private static void print(class [System.Private.CoreLib]System.String) cil managed
.method private static void print(class [System.Runtime]System.String) cil managed
{
.maxstack 1
ldarg 0
call void [System.Private.CoreLib]Internal.Console::WriteLine(class [System.Private.CoreLib]System.String)
call void [System.Console]System.Console::WriteLine(class [System.Runtime]System.String)
ret
}";

Expand All @@ -373,7 +374,7 @@ const string MainMethodEndIL = @"
FAIL:
ldstr ""FAILED""
call void Program::print(class [System.Private.CoreLib]System.String)
call void Program::print(class [System.Runtime]System.String)
ldc.i4 1
ret
}";
Expand Down Expand Up @@ -433,13 +434,13 @@ void WriteMainMethod(TextWriter write, IEnumerable<Test> tests)
if (i.Expected == null)
{
writer.WriteLine($" ldstr \"Checking {t.Name}({t.Load.Type.Hex(i.Input)}) == OverflowException\"");
writer.WriteLine($" call int32 Program::CheckOvf_{t.Name}({t.Load.Type.ActualType.Name}, class [System.Private.CoreLib]System.String)");
writer.WriteLine($" call int32 Program::CheckOvf_{t.Name}({t.Load.Type.ActualType.Name}, class [System.Runtime]System.String)");
}
else
{
writer.WriteLine($" {t.Store.Type.ILConst(i.Expected.Value)}");
writer.WriteLine($" ldstr \"Checking {t.Name}({t.Load.Type.Hex(i.Input)}) == {t.Store.Type.Hex(i.Expected.Value)}\"");
writer.WriteLine($" call int32 Program::Check_{t.Name}({t.Load.Type.ActualType.Name}, {t.Store.Type.Name}, class [System.Private.CoreLib]System.String)");
writer.WriteLine($" call int32 Program::Check_{t.Name}({t.Load.Type.ActualType.Name}, {t.Store.Type.Name}, class [System.Runtime]System.String)");
}

writer.WriteLine($" brfalse FAIL");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// See the LICENSE file in the project root for more information.


.assembly extern System.Private.CoreLib { auto }
.assembly extern System.Runtime { auto }
.assembly extern System.Numerics.Vectors { auto }
.assembly extern System.Runtime.CompilerServices.Unsafe { auto }
.assembly extern mscorlib { auto }

.assembly GitHub_11804
{
.custom instance void [System.Private.CoreLib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [System.Private.CoreLib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [System.Runtime]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.

.hash algorithm 0x00008004
Expand All @@ -28,7 +28,7 @@


.class private abstract auto ansi sealed beforefieldinit C
extends [System.Private.CoreLib]System.Object
extends [System.Runtime]System.Object
{
.method private hidebysig static int32
UnsafeGrab() cil managed noinlining
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


.assembly extern mscorlib { auto }
.assembly extern System.Private.CoreLib { auto }
.assembly extern System.Runtime { auto }

.assembly GitHub_13822
{
Expand All @@ -14,7 +14,7 @@
// =============== CLASS MEMBERS DECLARATION ===================

.class public sequential ansi sealed beforefieldinit GCStruct
extends [System.Private.CoreLib]System.ValueType
extends [System.Runtime]System.ValueType
{
.field public string str
.field public int32 i
Expand Down Expand Up @@ -44,7 +44,7 @@
// before calling the constructor on each iteration of the loop.

.class public auto ansi beforefieldinit Test
extends [System.Private.CoreLib]System.Object
extends [System.Runtime]System.Object
{
.method public hidebysig static int32 Main() cil managed
{
Expand Down Expand Up @@ -94,7 +94,7 @@
// Code size 7 (0x7)
.maxstack 8
ldarg.0
call instance void [System.Private.CoreLib]System.Object::.ctor()
call instance void [System.Runtime]System.Object::.ctor()
ret
} // end of method Test::.ctor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@


// Test for remorphing subexpressions in casts of long shifts.
.assembly extern System.Private.CoreLib { auto }
.assembly extern System.Runtime { auto }
.assembly extern mscorlib { auto }

.assembly GitHub_15319_1 {}

.class private auto ansi beforefieldinit Q
extends [System.Private.CoreLib]System.Object
extends [System.Runtime]System.Object
{
.method public hidebysig static int32 P(int64 x) cil managed noinlining
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// This test is similar to GitHub_21061_StackOverflowInFunctionProlog. The main difference is that StackOverflow is thrown from a funclet prolog.
//

.assembly extern System.Private.CoreLib
.assembly extern System.Runtime
{
}

Expand All @@ -34,7 +34,7 @@
#>

.class private explicit ansi sealed beforefieldinit GitHub_21061.<#= structName #>
extends [System.Private.CoreLib]System.ValueType
extends [System.Runtime]System.ValueType
{
.field [0] private int32 _0
.field [<#= structSizeInBytes #>] private int32 <#= structName #>
Expand All @@ -59,7 +59,7 @@

leave _Return
}
catch [System.Private.CoreLib]System.DivideByZeroException
catch [System.Runtime]System.DivideByZeroException
{
pop

Expand Down Expand Up @@ -92,7 +92,7 @@
#>

.class private auto ansi beforefieldinit GitHub_21061.Program
extends [System.Private.CoreLib]System.Object
extends [System.Runtime]System.Object
{
.method public hidebysig static void Keep(int32 i) cil managed noinlining
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// This test is designed to be run manually under debugger to validate different stack probing mechanisms implemented in CodeGen::genAllocLclFrame().
// For example, this can be used to check whether a debugger can unwind and show stack trace when StackOverflow occurs in a function prolog while doing stack probing.

.assembly extern System.Private.CoreLib
.assembly extern System.Runtime
{
}

Expand All @@ -36,7 +36,7 @@
#>

.class private explicit ansi sealed beforefieldinit GitHub_21061.<#= structName #>
extends [System.Private.CoreLib]System.ValueType
extends [System.Runtime]System.ValueType
{
.field [0] private int32 _0
.field [<#= structSizeInBytes #>] private int32 <#= structName #>
Expand All @@ -61,7 +61,7 @@
#>

.class private auto ansi beforefieldinit GitHub_21061.Program
extends [System.Private.CoreLib]System.Object
extends [System.Runtime]System.Object
{
.method public hidebysig static void Keep(int32 i) cil managed noinlining
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// GitHub 25027: Tail call stress shouldn't cause asserts
// in the presence of invalid IL

.assembly extern System.Private.CoreLib { auto }
.assembly extern System.Runtime { auto }
.assembly extern mscorlib { auto }
.assembly GitHub_25027 {}

.class private auto ansi beforefieldinit X
extends [System.Private.CoreLib]System.Object
extends [System.Runtime]System.Object
{
.method public hidebysig static int32 Main() cil managed
{
Expand All @@ -26,7 +26,7 @@
leave.s join

}
catch [System.Private.CoreLib]System.InvalidProgramException
catch [System.Runtime]System.InvalidProgramException
{
pop
ldc.i4.s 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.ver 4:0:0:0
}
// TODO: use the contract once this is exposed from contracts
.assembly extern System.Private.CoreLib { }
.assembly extern System.Runtime { }

.assembly diamondshape
{
Expand Down Expand Up @@ -652,7 +652,7 @@
IL_002b: leave.s IL_004a

} // end .try
catch [System.Private.CoreLib]System.Runtime.AmbiguousImplementationException
catch [System.Runtime]System.Runtime.AmbiguousImplementationException
{
IL_002d: stloc.s V_6
IL_002f: nop
Expand Down Expand Up @@ -690,7 +690,7 @@
IL_0074: leave.s IL_0093

} // end .try
catch [System.Private.CoreLib]System.Runtime.AmbiguousImplementationException
catch [System.Runtime]System.Runtime.AmbiguousImplementationException
{
IL_0076: stloc.s V_7
IL_0078: nop
Expand Down Expand Up @@ -729,7 +729,7 @@
IL_00c1: leave.s IL_00e0

} // end .try
catch [System.Private.CoreLib]System.Runtime.AmbiguousImplementationException
catch [System.Runtime]System.Runtime.AmbiguousImplementationException
{
IL_00c3: stloc.s V_9
IL_00c5: nop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

.assembly extern mscorlib { }
.assembly extern System.Runtime { }

.assembly reabstraction { }

Expand Down Expand Up @@ -187,7 +188,7 @@ PureVirtualDelegateOK:
pop
leave Fail
}
catch [System.Private.CoreLib]System.Runtime.AmbiguousImplementationException
catch [System.Runtime]System.Runtime.AmbiguousImplementationException
{
pop
leave DiamondCaseOK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.assembly extern System.Runtime { }

// TODO: use the contract once this is exposed from contracts
.assembly extern System.Private.CoreLib { }
.assembly extern System.Runtime { }

.assembly ambiguousconstraint { }

Expand Down Expand Up @@ -54,7 +54,7 @@
callvirt instance void IFoo::Frob()
leave.s Fail
}
catch [System.Private.CoreLib]System.Runtime.AmbiguousImplementationException
catch [System.Runtime]System.Runtime.AmbiguousImplementationException
{
pop
leave.s Success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// It needs to be crossgen-ed with large version bubble enabled to test. It always succeeds
// in other cases.
//
.assembly extern System.Private.CoreLib { auto }
.assembly extern System.Runtime { auto }
.assembly extern System.Console { auto }

.assembly test24524{}
Expand All @@ -19,8 +19,8 @@
.entrypoint
.maxstack 2

ldtoken field object [System.Private.CoreLib]System.Type::Missing
call class[System.Private.CoreLib]System.Reflection.FieldInfo [System.Private.CoreLib]System.Reflection.FieldInfo::GetFieldFromHandle(valuetype [System.Private.CoreLib]System.RuntimeFieldHandle)
ldtoken field object [System.Runtime]System.Type::Missing
call class[System.Runtime]System.Reflection.FieldInfo [System.Runtime]System.Reflection.FieldInfo::GetFieldFromHandle(valuetype [System.Runtime]System.RuntimeFieldHandle)
call void [System.Console]System.Console::WriteLine(object)

ldc.i4 100
Expand Down

0 comments on commit 5c5aeb5

Please sign in to comment.