Skip to content

Commit f7e7bc6

Browse files
committed
Remove gensym, slight tweak to memcpy call.
1 parent 57eb512 commit f7e7bc6

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

langs/mug/compile-ops.rkt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(define r8 'r8) ; scratch
1212
(define r9 'r9) ; scratch
1313
(define r10 'r10) ; scratch
14+
(define r12 'r12) ; save across call to memcpy
1415
(define r15 'r15) ; stack pad (non-volatile)
1516
(define rsp 'rsp) ; stack
1617

@@ -23,11 +24,7 @@
2324
unpad-stack)]
2425
['peek-byte (seq pad-stack
2526
(Call 'peek_byte)
26-
unpad-stack)]
27-
['gensym (seq pad-stack
28-
(Call 'gensym)
29-
unpad-stack
30-
(Or rax type-symb))]))
27+
unpad-stack)]))
3128

3229
;; Op1 -> Asm
3330
(define (compile-op1 p)
@@ -142,16 +139,14 @@
142139
(Add rdx 1) ; #words = 1 + (len+1)/2
143140
(Sar rdx 1)
144141
(Add rdx 1)
145-
(Sal rdx 3) ; #bytes = 8*#words
146-
147-
(Mov 'r12 rdx) ; save rdx before destroyed
142+
(Sal rdx 3) ; #bytes = 8*#words
143+
(Mov r12 rdx) ; save rdx before destroyed
148144
pad-stack
149145
(Call 'memcpy)
150146
unpad-stack
151-
(Mov rbx rax) ; dst is returned, install as heap pointer
152-
(Add rbx 'r12)))
153-
154-
147+
; rbx should be preserved by memcpy
148+
;(Mov rbx rax) ; dst is returned, install as heap pointer
149+
(Add rbx r12)))
155150

156151
;; Op2 -> Asm
157152
(define (compile-op2 p)

0 commit comments

Comments
 (0)