This commit is contained in:
2026-05-16 10:26:11 -06:00
parent 466e2a38a9
commit f5536ca2e2
7 changed files with 24 additions and 11 deletions

View File

@@ -410,7 +410,7 @@ lowerCdr
lowerCdr r x e k = do
x1 <- gensym
Emit [ QBE.BinaryOp (x1 QBE.:= QBE.Long)
QBE.Add x (lowerInt' (sizeofScm `quot` 2))
QBE.Add x (lowerInt' sizeofScm)
, QBE.Load (lowerName r QBE.:= QBE.Long) QBE.Long
(QBE.ValTemporary x1)
]

BIN
play/t

Binary file not shown.

View File

@@ -1,4 +1,8 @@
;;; -*- mode:scheme -*-
(let ((x0 (prim:cons 4 2)) (x2 (prim:write x1)) (x1 (prim:car x0))) x2)
(let ((x0 (prim:cons 4 2))
(x3 (prim:write x2))
(x2 (prim:* 3 x1))
(x1 (prim:cdr x0)))
x3)

View File

@@ -7,7 +7,7 @@ main:
callq GC_malloc
movq $18, (%rax)
movq $10, 8(%rax)
movl $18, %edi
movl $26, %edi
callq scm_write
leave
ret

View File

@@ -1,3 +1,2 @@
(let ((pair (prim:cons 4 2)))
(begin (prim:write (prim:car pair))
(prim:write (prim:cdr pair))))
(prim:write (prim:* 3
(prim:cdr (prim:cons 4 2))))

View File

@@ -2,10 +2,16 @@ export
function w $main () {
@start
%x0 =l call $GC_malloc (l 16)
%.3 =l add %x0, 8
%.4 =l add %x0, 8
storel 18, %x0
storel 10, %.3
%x1 =l loadl %x0
%x2 =l call $scm_write (l %x1)
ret %x2
storel 10, %.4
%.5 =l add %x0, 8
%x1 =l loadl %.5
%.6 =l shr 14, 2
%.7 =l shr %x1, 2
%.8 =l mul %.6, %.7
%.9 =l shl %.8, 2
%x2 =l add %.9, 2
%x3 =l call $scm_write (l %x2)
ret %x3
}

View File

@@ -15,6 +15,10 @@ typedef union SCM { struct { scm_t_bits n; } n; } SCM;
#define SCM_NIMP(x) (!SCM_IMP (x))
#define SCM_HEAP_OBJECT_P(x) (SCM_NIMP (x))
#define SCM_FALSE 0b00100
#define SCM_TRUE 0b01100
#define SCM_EOL 0b10100
SCM scm_write (SCM);