Skip to content

Latest commit

 

History

History
31 lines (17 loc) · 1.46 KB

iii.3.47-localloc.md

File metadata and controls

31 lines (17 loc) · 1.46 KB

III.3.47 localloc – allocate space in the local dynamic memory pool

Format Assembly Format Description
FE 0F localloc Allocate space from the local memory pool.

Stack Transition:

sizeaddress

Description:

The localloc instruction allocates size (type native unsigned int or U4) bytes from the local dynamic memory pool and returns the address (an unmanaged pointer, type native int) of the first allocated byte. If the localsinit flag on the method is true, the block of memory returned is initialized to 0; otherwise, the initial value of that block of memory is unspecified. The area of memory is newly allocated. When the current method returns, the local memory pool is available for reuse.

address is aligned so that any built-in data type can be stored there using the stind instructions and loaded using the ldind instructions.

The localloc instruction cannot occur within an exception block: filter, catch, finally, or fault.

[Rationale: localloc is used to create local aggregates whose size shall be computed at runtime. It can be used for C's intrinsic alloca method. end rationale]

Exceptions:

System.StackOverflowException is thrown if there is insufficient memory to service the request.

Correctness:

Correct CIL requires that the evaluation stack be empty, apart from the size item

Verifiability:

This instruction is never verifiable.