Skip to content

Commit af121ca

Browse files
committed
Update template
1 parent eae18f8 commit af121ca

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

compile.rkt

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
(Sar rax char-shift)
100100
(Sal rax int-shift))]
101101
['integer->char
102-
(seq assert-codepoint
102+
(seq (assert-codepoint #f)
103103
(Sar rax int-shift)
104104
(Sal rax char-shift)
105105
(Xor rax type-char))]
@@ -253,7 +253,7 @@
253253
(define assert-cons
254254
(assert-type ptr-mask type-cons))
255255

256-
(define assert-codepoint
256+
(define (assert-codepoint x)
257257
(let ((ok (gensym)))
258258
(seq (assert-integer rax)
259259
(Cmp rax (imm->bits 0))

types.rkt

+3
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,8 @@
5656
(define (cons-bits? v)
5757
(zero? (bitwise-xor (bitwise-and v imm-mask) type-cons)))
5858

59+
(define (string-bits? v)
60+
(zero? (bitwise-xor (bitwise-and v imm-mask) type-string)))
61+
5962
(define (box-bits? v)
6063
(zero? (bitwise-xor (bitwise-and v imm-mask) type-box)))

unload-bits-asm.rkt

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
(box (unload-value (heap-ref i)))]
1919
[(? cons-bits? i)
2020
(cons (unload-value (heap-ref (+ i (arithmetic-shift 1 imm-shift))))
21-
(unload-value (heap-ref i)))]))
21+
(unload-value (heap-ref i)))]
22+
[(? string-bits? i)
23+
(let* ((n (unload-value (heap-ref i)))
24+
(cs (map (lambda (j) (unload-value (heap-ref (+ i (* 8 j) 8)))) (build-list n values))))
25+
(apply string cs))]
26+
))
2227

2328
(define (untag i)
2429
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))

unload.rkt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
(match v
1414
[(? integer?) v]
1515
[(? boolean?) v]
16-
[(? char?) v]
16+
[(? char?) v]
17+
[(? string?) v]
1718
[(? eof-object?) v]
1819
[(? void?) v]
1920
['() '()]

0 commit comments

Comments
 (0)