Compartir a través de


OpCodes.Tailcall Field

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared ReadOnly Tailcall As OpCode
public static readonly OpCode Tailcall

Remarks

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 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)

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.