mirror of
https://github.com/kanaka/mal.git
synced 2024-09-21 02:27:10 +03:00
Merge pull request #343 from bendudson/nasm-catchless-try
NASM: Add catchless try to step 9 and step A
This commit is contained in:
commit
23342cb610
@ -1524,6 +1524,10 @@ eval:
|
||||
; Check second arg B
|
||||
|
||||
mov al, BYTE [rsi + Cons.typecdr]
|
||||
; If nil (catchless try)
|
||||
cmp al, content_nil
|
||||
je .catchless_try
|
||||
|
||||
cmp al, content_pointer
|
||||
jne .try_missing_catch
|
||||
|
||||
@ -1575,7 +1579,7 @@ eval:
|
||||
; Now have extracted from (try* A (catch* B C))
|
||||
; A in R8
|
||||
; B in R10
|
||||
; C in T9
|
||||
; C in R9
|
||||
|
||||
push R9
|
||||
push R10
|
||||
@ -1611,6 +1615,23 @@ eval:
|
||||
mov rax, r8
|
||||
jmp .return
|
||||
|
||||
.catchless_try:
|
||||
;; Evaluate the form in R8
|
||||
push r15 ; Environment
|
||||
|
||||
mov rsi, r15
|
||||
call incref_object ; Env released by eval
|
||||
mov rdi, r15 ; Env in RDI
|
||||
|
||||
mov rsi, r8 ; The form to evaluate (A)
|
||||
|
||||
call incref_object ; AST released by eval
|
||||
|
||||
call eval ; Result in RAX
|
||||
|
||||
pop r15 ; Environment
|
||||
|
||||
jmp .return
|
||||
.catch:
|
||||
; Jumps here on error
|
||||
; Value thrown in RSI
|
||||
|
@ -1539,6 +1539,10 @@ eval:
|
||||
; Check second arg B
|
||||
|
||||
mov al, BYTE [rsi + Cons.typecdr]
|
||||
; If nil (catchless try)
|
||||
cmp al, content_nil
|
||||
je .catchless_try
|
||||
|
||||
cmp al, content_pointer
|
||||
jne .try_missing_catch
|
||||
|
||||
@ -1590,7 +1594,7 @@ eval:
|
||||
; Now have extracted from (try* A (catch* B C))
|
||||
; A in R8
|
||||
; B in R10
|
||||
; C in T9
|
||||
; C in R9
|
||||
|
||||
push R9
|
||||
push R10
|
||||
@ -1626,6 +1630,23 @@ eval:
|
||||
mov rax, r8
|
||||
jmp .return
|
||||
|
||||
.catchless_try:
|
||||
;; Evaluate the form in R8
|
||||
push r15 ; Environment
|
||||
|
||||
mov rsi, r15
|
||||
call incref_object ; Env released by eval
|
||||
mov rdi, r15 ; Env in RDI
|
||||
|
||||
mov rsi, r8 ; The form to evaluate (A)
|
||||
|
||||
call incref_object ; AST released by eval
|
||||
|
||||
call eval ; Result in RAX
|
||||
|
||||
pop r15 ; Environment
|
||||
|
||||
jmp .return
|
||||
.catch:
|
||||
; Jumps here on error
|
||||
; Value thrown in RSI
|
||||
|
Loading…
Reference in New Issue
Block a user