Export (0) Print
Expand All
Expand Minimize

OpCodes.Tailcall Field

Performs a postfixed method call instruction such that the current method's stack frame is removed before the actual call instruction is executed.

Namespace:  System.Reflection.Emit
Assemblies:   mscorlib (in mscorlib.dll)
  System.Reflection.Primitives (in System.Reflection.Primitives.dll)

public static readonly OpCode Tailcall

The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

Format

Assembly Format

Description

FE 14

tail.

Subsequent call terminates current methods

There is no stack transition behavior defined for this instruction.

The tail prefix instruction must immediately precede a Call, Calli, or Callvirt instruction. It indicates that the current method's stack frame should be removed before the call instruction is executed. It also implies that the value returned from the following call is also the value returned by the current method, and the call can therefore be converted into a cross-method jump.

The stack must be empty except for the arguments being transferred by the following call. The instruction following the call instruction must be a ret. Thus the only valid code sequence is tail. call (or calli or callvirt). Correct Microsoft Intermediate Language (MSIL) instructions must not branch to the call instruction, but they may branch to the subsequent Ret.

The current frame cannot be discarded when control is transferred from untrusted code to trusted code, since this would jeopardize code identity security. The .NET Framework security checks can therefore cause the tail to be ignored, leaving a standard Call instruction. Similarly, in order to allow the exit of a synchronized region to occur after the call returns, the tail prefix is ignored when used to exit a method that is marked synchronized.

The following Emit method overload can use the tail opcode:

  • ILGenerator.Emit(OpCode)

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft