123456789101112131415161718192021222324252627282930 |
- %ifndef BLTN_CLOSURE_ASM
- %define BLTN_CLOSURE_ASM
- %include "syscalls.asm"
- %include "print_type.asm"
- %include "heap.asm"
- %include "type_check.asm"
- section .text
- bltn_alloc_closure:
- ;; INPUT: rax closure length, r8 the label
- ;; OUTPUT: rax the heap address of the uninitialized closure
-
- ;; uses rcx as a temporary
-
- mov rcx, rax
- add rax, 1
- call heap_alloc
-
- mov [rax], r8
- mov [rax + 8], rcx
-
- or rax, 0b011 ; tag it as a closure
-
- ret
- %endif
-
|