aboutsummaryrefslogtreecommitdiff
path: root/driver.s
diff options
context:
space:
mode:
Diffstat (limited to 'driver.s')
-rw-r--r--driver.s18
1 files changed, 10 insertions, 8 deletions
diff --git a/driver.s b/driver.s
index 429b147..7a089a8 100644
--- a/driver.s
+++ b/driver.s
@@ -42,7 +42,7 @@ driver:
sw $ra,($sp)
print:
lw $t0,($s1)
- andi $t0,$t0,2
+ andi $t0,$t0,4
bne $t0,$0,print_hnf
nop
la $s2,EVALROOT
@@ -53,13 +53,13 @@ print:
addi $s1,$s3,0
print_hnf:
lw $t0,($s1)
- la $t1,_cINT+2
+ la $t1,_cINT+4
beq $t0,$t1,print_int
- lw $t1,2($t0) # name length
- addi $t2,$t0,6 # name
+ lw $t1,($t0) # name length
+ addi $t2,$t0,4 # name
add $t1,$t1,$t2
print_cons:
- lw $t3,-2($t0) # arity
+ lw $t3,-4($t0) # arity
beq $t3,$0,print_cons_no_paren
li $a0,'('
li $v0,11 # print_char
@@ -96,7 +96,7 @@ print_rewind:
addi $t0,$s0,0
addi $t1,$s0,0 # argument pointer
lw $t2,($t0)
- lw $t2,-2($t2) # arity
+ lw $t2,-4($t2) # arity
print_rewind_loop:
addi $t1,$t1,4
lw $t3,($t1)
@@ -132,7 +132,7 @@ print_rewind_root:
eval:
lw $t0,($s3)
# Exit early in case of hnf
- andi $t1,$t0,2
+ andi $t1,$t0,4
bne $t1,$0,eval_rewind
# Walk through indirections
la $t1,_nindir
@@ -144,7 +144,7 @@ eval_indir:
beq $t0,$t1,eval_indir
sw $s3,4($t2) # update original indir; optimizes chained indirs
# Check again for hnf
- andi $t1,$t0,2
+ andi $t1,$t0,4
bne $t1,$0,eval_rewind
nop
eval_indir_done:
@@ -203,6 +203,7 @@ eval_rewind_root:
cycle_error:
.asciiz "error: cycle in spine detected\n"
.text
+ .align 3
.word 0 # strictness
.word 1 # arity
_nroot:
@@ -215,6 +216,7 @@ _nroot:
indir_error:
.asciiz "error: indirection evaluated\n"
.text
+ .align 3
.word 0x1 # strictness
.word 1 # arity
_nindir: