Skip to content

Commit 678358f

Browse files
committed
Add symbol type to unload-bits-asm.
1 parent 5cea194 commit 678358f

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

langs/mug/test/test-runner.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@
292292
#f)
293293
(check-equal? (run '(eq? (symbol->string 'foo) (symbol->string 'foo))) #f)
294294
(check-equal? (run '(string? (symbol->string 'foo))) #t)
295-
(check-equal? (run '(eq? (symbol->string 'foo) "foo")) #f))
295+
(check-equal? (run '(eq? (symbol->string 'foo) "foo")) #f)
296+
(check-equal? (run ''foo) 'foo))
296297

297298
(define (test-runner-io run)
298299
;; Evildoer examples

langs/mug/types.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@
6969

7070
(define (proc-bits? v)
7171
(zero? (bitwise-xor (bitwise-and v imm-mask) type-proc)))
72+
73+
(define (symb-bits? v)
74+
(zero? (bitwise-xor (bitwise-and v imm-mask) type-symb)))

langs/mug/unload-bits-asm.rkt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
(string)
3131
(build-string (heap-ref i)
3232
(lambda (j)
33-
(char-ref (+ i 8) j))))]))
33+
(char-ref (+ i 8) j))))]
34+
[(? symb-bits? i)
35+
(string->symbol
36+
(if (zero? (untag i))
37+
(string)
38+
(build-string (heap-ref i)
39+
(lambda (j)
40+
(char-ref (+ i 8) j)))))]))
3441

3542
(define (untag i)
3643
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))

0 commit comments

Comments
 (0)