%allot ( dst size class temp -- )


Inputs and outputs
dstdestination register symbol
sizenumber of bytes to allocate
classone of the built-in classes listed in type-numbers
temptemporary register symbol

Word description
Emits machine code for allocating memory.

In this example 40 bytes is allocated and a tagged pointer to the memory is put in RAX:

USING: cpu.architecture make ; [ RAX 40 tuple RCX %allot ] B{ } make disassemble 0000000002270cc0: 498d4d10 lea rcx, [r13+0x10] 0000000002270cc4: 488b01 mov rax, [rcx] 0000000002270cc7: 48c7001c000000 mov qword [rax], 0x1c 0000000002270cce: 4883c807 or rax, 0x7 0000000002270cd2: 48830130 add qword [rcx], 0x30


HOOK: %allot cpu ( dst size class temp -- )


M:: x86 %allot ( dst size class nursery-ptr -- )
nursery-ptr dst load-allot-ptr dst class store-header
dst class store-tagged nursery-ptr size inc-allot-ptr ;