var size = Pop();
+ Check(_stackTop == 0, VerifierError.LocallocStackNotEmpty);
+
CheckIsInteger(size);
Push(StackValue.CreatePrimitive(StackValueKind.NativeInt));
<data name="InterfaceMethodNotImplemented" xml:space="preserve">
<value>Class implements interface but not method, Class: '{0}' Interface: '{1}' Missing method: '{2}'.</value>
</data>
+ <data name="LocallocStackNotEmpty" xml:space="preserve">
+ <value>Stack must be empty before localloc, except for the size item.</value>
+ </data>
</root>
//IDS_E_GLOBAL "<GlobalFunction>"
//IDS_E_MDTOKEN "[mdToken=0x%x]"
InterfaceImplHasDuplicate, // InterfaceImpl has a duplicate
- InterfaceMethodNotImplemented // Class implements interface but not method
+ InterfaceMethodNotImplemented, // Class implements interface but not method
+ LocallocStackNotEmpty, // localloc requires that stack must be empty, except for 'size' argument
}
}
}
}
-.class public auto ansi beforefieldinit ChildClassInheritsFromInterfaceWithDefaultImplementationWhereChildInterfaceReabstractsInterfaceMethod_InvalidType_InterfaceMethodNotImplemented
+.class public auto ansi beforefieldinit ChildClassInheritsFromInterfaceWithDefaultImplementationWhereChildInterfaceReabstractsInterfaceMethod_InvalidType_InterfaceMethodNotImplemented@InterfaceMethodNotImplemented
extends [System.Runtime]System.Object
implements IReabstractDefaultImplementation, IInheritedDefaultImplInterface, IInterface
{
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+.assembly extern System.Runtime
+{
+}
+
+.assembly extern LocalAllocTestsFriend
+{
+}
+
+.assembly LocalAllocTests
+{
+}
+
+.class public auto ansi beforefieldinit LocAllocTests
+ extends [System.Runtime]System.Object
+{
+ .method private hidebysig instance void Load.LocAllocShouldFailWhenStackNotEmpty_Invalid_Unverifiable.LocallocStackNotEmpty() cil managed
+ {
+ ldnull // pretend there's meaningfull value on stack
+ ldc.i4.2 // size parameter for localloc
+ localloc
+ pop // pop localloc pointer
+ pop // pop ldnull
+ ret
+ }
+
+ .method private hidebysig instance void Load.LocAllocShouldFailWhenSizeIsAbsent_Invalid_Unverifiable.StackUnderflow() cil managed
+ {
+ localloc
+ pop // pop localloc pointer
+ ret
+ }
+
+ .method private hidebysig instance void Load.LocAllocShouldSuccesWhenSizeIsPresent_Invalid_Unverifiable() cil managed
+ {
+ ldc.i4.2 // size parameter for localloc
+ localloc
+ pop // pop localloc pointer
+ ret
+ }
+}
--- /dev/null
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>