* racompiler compiles integers.

This commit is contained in:
Abdulaziz Ghuloum 2007-02-05 14:30:42 -05:00
parent f5d870f23b
commit 1eff505ab4
3 changed files with 23 additions and 11 deletions

Binary file not shown.

View File

@ -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)

View File

@ -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")