* racompiler compiles integers.
This commit is contained in:
parent
f5d870f23b
commit
1eff505ab4
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -192,11 +192,19 @@
|
|||
(lambda (n ac)
|
||||
(cond
|
||||
[(int? n)
|
||||
(list* (byte n)
|
||||
(byte (fxsra n 8))
|
||||
(byte (fxsra n 16))
|
||||
(byte (fxsra n 24))
|
||||
ac)]
|
||||
(if (fixnum? n)
|
||||
(list* (byte n)
|
||||
(byte (fxsra n 8))
|
||||
(byte (fxsra n 16))
|
||||
(byte (fxsra n 24))
|
||||
ac)
|
||||
(let ([lo (remainder n 256)]
|
||||
[hi (quotient n 256)])
|
||||
(list* (byte lo)
|
||||
(byte hi)
|
||||
(byte (fxsra hi 8))
|
||||
(byte (fxsra hi 16))
|
||||
ac)))]
|
||||
[(obj? n)
|
||||
(let ([v (cadr n)])
|
||||
(if (immediate? v)
|
||||
|
|
|
@ -80,11 +80,13 @@
|
|||
;;;
|
||||
(define rv-register (mkreg '%eax))
|
||||
;;;
|
||||
(define (return x)
|
||||
(mkseq (mkset rv-register x)
|
||||
(mkprm 'return rv-register)))
|
||||
(define (Tail x)
|
||||
(record-case x
|
||||
[(constant c)
|
||||
(mkseq (mkset rv-register x)
|
||||
(mkprm 'return rv-register))]
|
||||
[(constant) (return x)]
|
||||
[(int) (return x)]
|
||||
[else (error who "invalid tail ~s" x)]))
|
||||
;;;
|
||||
(Tail x))
|
||||
|
@ -94,9 +96,10 @@
|
|||
;;;
|
||||
(define (op x)
|
||||
(record-case x
|
||||
[(register r) r]
|
||||
[(reg r) r]
|
||||
[(constant c) `(obj ,c)]
|
||||
[(int i) `(int ,i)]
|
||||
[(int i) i]
|
||||
[else (error who "invalid op ~s" x)]))
|
||||
;;;
|
||||
(define (Effect x ac)
|
||||
(record-case x
|
||||
|
@ -117,7 +120,7 @@
|
|||
[else (error who "invalid tail prim ~s" op)])]
|
||||
[else (error who "invalid tail ~s" x)]))
|
||||
;;;
|
||||
(list (Tail x '())))
|
||||
(list (cons 0 (Tail x '()))))
|
||||
;;;
|
||||
(define (compile x)
|
||||
(let* ([x (expand x)]
|
||||
|
@ -151,3 +154,4 @@
|
|||
|
||||
(load "tests/tests-1.1-req.scm")
|
||||
|
||||
(printf "ALL IS GOOD :-)\n")
|
||||
|
|
Loading…
Reference in New Issue