Skip to content

Commit 85945f0

Browse files
committed
Update Knock+ [list] and [vector] forms for new representations
1 parent 2a37dae commit 85945f0

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

knock-plus/compile-ops.rkt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@
222222
(Mov r9 (Mem r8 (- type-vect)))
223223
(Cmp r10 r9)
224224
(Jge 'err)
225-
(Sar r10 1) ; convert to byte offset
226-
(Mov (Mem r8 r10 (- 8 type-vect)) rax)
225+
(Sar r10 1) ; convert to byte offset
226+
(Mov (Mem r8 r10 (- 8 type-vect)) rax)
227227
(Mov rax (value->bits (void))))]))
228228

229229
;; OpN Natural -> Asm
@@ -234,9 +234,9 @@
234234
(compile-op-list n))]
235235
['vector
236236
(match n
237-
[0 (seq (Mov rax type-vect))]
237+
[0 (seq (Lea rax (Mem 'empty type-vect)))]
238238
[n (seq (compile-op-vect n)
239-
(Mov r9 n)
239+
(Mov r9 (value->bits n))
240240
(Mov (Mem rbx) r9)
241241
(Mov rax rbx)
242242
(Xor rax type-vect)
@@ -246,8 +246,8 @@
246246
(match n
247247
[0 (seq)]
248248
[n (seq (Pop r9)
249-
(Mov (Mem rbx) 'rax)
250-
(Mov (Mem rbx 8) 'r9)
249+
(Mov (Mem rbx 8) rax)
250+
(Mov (Mem rbx 0) r9)
251251
(Mov rax rbx)
252252
(Xor rax type-cons)
253253
(Add rbx 16)
@@ -291,4 +291,3 @@
291291
;; Undo the stack alignment after a call
292292
(define unpad-stack
293293
(seq (Add rsp r15)))
294-

0 commit comments

Comments
 (0)