OpCodes.Localloc 欄位


從區域動態記憶體集區中配置某些數量的位元組,並將第一個配置的位元組的位址 (暫時性指標,型別 ) 推入至評估堆疊。Allocates a certain number of bytes from the local dynamic memory pool and pushes the address (a transient pointer, type ) of the first allocated byte onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Localloc;
public static readonly System.Reflection.Emit.OpCode Localloc;
 staticval mutable Localloc : System.Reflection.Emit.OpCode
Public Shared ReadOnly Localloc As OpCode 




下表列出指示的十六進位和 Microsoft 中繼語言 (MSIL) 元件格式,以及簡短的參考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

格式Format 元件格式Assembly Format DescriptionDescription
FE 0FFE 0F localloclocalloc 配置本機堆積的空間。Allocate space from the local heap.

堆疊轉換行為(依順序)為:The stack transitional behavior, in sequential order, is:

  1. 要配置的位元組數目會推送至堆疊。The number of bytes to be allocated is pushed onto the stack.

  2. 從堆疊彈出的位元組數目;對應至大小的記憶體數量是從本機堆積配置。The number of bytes is popped from the stack; an amount of memory corresponding to the size is allocated from the local heap.

  3. 已配置記憶體的第一個位元組指標會推送至堆疊。A pointer to the first byte of the allocated memory is pushed onto the stack.

localloc指令會從本機動態記憶體集區配置 size (類型 natural unsigned int) 個位元組,並傳回 (暫時性指標的位址,類型 *) 第一個配置的位元組。The localloc instruction allocates size (type natural unsigned int) bytes from the local dynamic memory pool and returns the address (a transient pointer, type *) of the first allocated byte. 只有當方法上的 initialize 旗標為時,才會將傳回的記憶體區塊初始化為 0 trueThe block of memory returned is initialized to 0 only if the initialize flag on the method is true. 當目前的方法執行時 Ret ,本機記憶體集區可供重複使用。When the current method executes a Ret, the local memory pool is made available for reuse.

產生的位址會對齊,如此一來,您就可以使用 (之類的指示,將任何基本資料類型儲存在該處,例如 stind Stind_I4) ,然後使用 ldind) (之類的指示進行載入 Ldind_I4The resulting address is aligned so that any primitive data type can be stored there using the stind instructions (such as Stind_I4) and loaded using the ldind instructions (such as Ldind_I4).

localloc指令不能出現在 filtercatchfinally 或區塊內 faultThe localloc instruction cannot occur within a filter, catch, finally, or fault block.

StackOverflowException 如果記憶體不足,無法處理要求,就會擲回。StackOverflowException is thrown if there is insufficient memory to service the request.

下列方法多載 Emit 可以使用 localloc opcode:The following Emit method overload can use the localloc opcode: