* Altcogen works. Need to rethink how to code the conflict graphs.
This commit is contained in:
parent
a5dbb8f45d
commit
1dc9e83448
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -913,6 +913,7 @@
|
||||||
|
|
||||||
(define (make-empty-set) (make-set '()))
|
(define (make-empty-set) (make-set '()))
|
||||||
(define (set-member? x s)
|
(define (set-member? x s)
|
||||||
|
;(unless (fixnum? x) (error 'set-member? "~s is not a fixnum" x))
|
||||||
(unless (set? s) (error 'set-member? "~s is not a set" s))
|
(unless (set? s) (error 'set-member? "~s is not a set" s))
|
||||||
(memq x (set-v s)))
|
(memq x (set-v s)))
|
||||||
|
|
||||||
|
@ -925,6 +926,7 @@
|
||||||
(set-v s))
|
(set-v s))
|
||||||
|
|
||||||
(define (set-add x s)
|
(define (set-add x s)
|
||||||
|
;(unless (fixnum? x) (error 'set-add "~s is not a fixnum" x))
|
||||||
(unless (set? s) (error 'set-add "~s is not a set" s))
|
(unless (set? s) (error 'set-add "~s is not a set" s))
|
||||||
(cond
|
(cond
|
||||||
[(memq x (set-v s)) s]
|
[(memq x (set-v s)) s]
|
||||||
|
@ -937,6 +939,7 @@
|
||||||
[else (cons (car s) (rem x (cdr s)))]))
|
[else (cons (car s) (rem x (cdr s)))]))
|
||||||
|
|
||||||
(define (set-rem x s)
|
(define (set-rem x s)
|
||||||
|
;(unless (fixnum? x) (error 'set-rem "~s is not a fixnum" x))
|
||||||
(unless (set? s) (error 'set-rem "~s is not a set" s))
|
(unless (set? s) (error 'set-rem "~s is not a set" s))
|
||||||
(make-set (rem x (set-v s))))
|
(make-set (rem x (set-v s))))
|
||||||
|
|
||||||
|
@ -956,6 +959,7 @@
|
||||||
(make-set (union (set-v s1) (set-v s2))))
|
(make-set (union (set-v s1) (set-v s2))))
|
||||||
|
|
||||||
(define (list->set ls)
|
(define (list->set ls)
|
||||||
|
;(unless (andmap fixnum? ls) (error 'set-rem "~s is not a list of fixnum" ls))
|
||||||
(make-set ls))
|
(make-set ls))
|
||||||
|
|
||||||
(define (union s1 s2)
|
(define (union s1 s2)
|
||||||
|
@ -992,6 +996,7 @@
|
||||||
(define (empty-set? s) (eqv? s 0))
|
(define (empty-set? s) (eqv? s 0))
|
||||||
|
|
||||||
(define (set-member? n s)
|
(define (set-member? n s)
|
||||||
|
(unless (fixnum? n) (error 'set-member? "~s is not a fixnum" n))
|
||||||
(let f ([s s] [i (index-of n)] [j (mask-of n)])
|
(let f ([s s] [i (index-of n)] [j (mask-of n)])
|
||||||
(cond
|
(cond
|
||||||
[(pair? s)
|
[(pair? s)
|
||||||
|
@ -1002,6 +1007,7 @@
|
||||||
[else #f])))
|
[else #f])))
|
||||||
|
|
||||||
(define (set-add n s)
|
(define (set-add n s)
|
||||||
|
(unless (fixnum? n) (error 'set-add "~s is not a fixnum" n))
|
||||||
(let f ([s s] [i (index-of n)] [j (mask-of n)])
|
(let f ([s s] [i (index-of n)] [j (mask-of n)])
|
||||||
(cond
|
(cond
|
||||||
[(pair? s)
|
[(pair? s)
|
||||||
|
@ -1024,6 +1030,7 @@
|
||||||
(cons a d)))
|
(cons a d)))
|
||||||
|
|
||||||
(define (set-rem n s)
|
(define (set-rem n s)
|
||||||
|
(unless (fixnum? n) (error 'set-rem "~s is not a fixnum" n))
|
||||||
(let f ([s s] [i (index-of n)] [j (mask-of n)])
|
(let f ([s s] [i (index-of n)] [j (mask-of n)])
|
||||||
(cond
|
(cond
|
||||||
[(pair? s)
|
[(pair? s)
|
||||||
|
@ -1087,6 +1094,7 @@
|
||||||
(fxlogand s1 (fxlognot s2)))))
|
(fxlogand s1 (fxlognot s2)))))
|
||||||
|
|
||||||
(define (list->set ls)
|
(define (list->set ls)
|
||||||
|
(unless (andmap fixnum? ls) (error 'list->set "~s is not a list of fixnum" ls))
|
||||||
(let f ([ls ls] [s 0])
|
(let f ([ls ls] [s 0])
|
||||||
(cond
|
(cond
|
||||||
[(null? ls) s]
|
[(null? ls) s]
|
||||||
|
@ -2567,6 +2575,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define (flatten-codes x)
|
(define (flatten-codes x)
|
||||||
(define who 'flatten-codes)
|
(define who 'flatten-codes)
|
||||||
;;;
|
;;;
|
||||||
|
@ -2589,7 +2599,7 @@
|
||||||
(define (BYTE x)
|
(define (BYTE x)
|
||||||
(record-case x
|
(record-case x
|
||||||
[(constant x)
|
[(constant x)
|
||||||
(unless (and (integer? x) (fx<= x 255) (fx<= 0 x))
|
(unless (and (integer? x) (fx<= x 255) (fx<= -128 x))
|
||||||
(error who "invalid byte ~s" x))
|
(error who "invalid byte ~s" x))
|
||||||
x]
|
x]
|
||||||
[else (error who "invalid byte ~s" x)]))
|
[else (error who "invalid byte ~s" x)]))
|
||||||
|
|
|
@ -853,16 +853,10 @@
|
||||||
[(assq x locs) => cdr]
|
[(assq x locs) => cdr]
|
||||||
[else
|
[else
|
||||||
(error 'bootstrap "no location for ~s" x)])))
|
(error 'bootstrap "no location for ~s" x)])))
|
||||||
(let ([p (open-output-file "ikarus.boot.new" 'replace)]
|
(let ([p (open-output-file "ikarus.boot" 'replace)])
|
||||||
[idx 0])
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(set! idx (+ idx 1))
|
(alt-compile-core-expr-to-port x p))
|
||||||
(cond
|
|
||||||
[(memv idx '(1))
|
|
||||||
(alt-compile-core-expr-to-port x p)]
|
|
||||||
[else
|
|
||||||
(compile-core-expr-to-port x p)]))
|
|
||||||
core*)
|
core*)
|
||||||
(close-output-port p)))))
|
(close-output-port p)))))
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,8 @@
|
||||||
(section ;;; symbols
|
(section ;;; symbols
|
||||||
|
|
||||||
(define-primop symbol? safe
|
(define-primop symbol? safe
|
||||||
[(P x) (tag-test (T x) ptag-mask symbol-ptag)]
|
[(P x)
|
||||||
|
(sec-tag-test (T x) vector-mask vector-tag #f symbol-record-tag)]
|
||||||
[(E x) (nop)])
|
[(E x) (nop)])
|
||||||
|
|
||||||
(define-primop $make-symbol unsafe
|
(define-primop $make-symbol unsafe
|
||||||
|
@ -1195,7 +1196,10 @@
|
||||||
(unless (fixnum? c) (interrupt))
|
(unless (fixnum? c) (interrupt))
|
||||||
(prm 'bset/c (T x)
|
(prm 'bset/c (T x)
|
||||||
(K (+ i (- disp-bytevector-data bytevector-tag)))
|
(K (+ i (- disp-bytevector-data bytevector-tag)))
|
||||||
(K c))]
|
(K (cond
|
||||||
|
[(<= -128 c 127) c]
|
||||||
|
[(<= 128 c 255) (- c 256)]
|
||||||
|
[else (interrupt)])))]
|
||||||
[else
|
[else
|
||||||
(prm 'bset/h (T x)
|
(prm 'bset/h (T x)
|
||||||
(K (+ i (- disp-bytevector-data bytevector-tag)))
|
(K (+ i (- disp-bytevector-data bytevector-tag)))
|
||||||
|
@ -1208,7 +1212,10 @@
|
||||||
(prm 'int+
|
(prm 'int+
|
||||||
(prm 'sra (T i) (K fixnum-shift))
|
(prm 'sra (T i) (K fixnum-shift))
|
||||||
(K (- disp-bytevector-data bytevector-tag)))
|
(K (- disp-bytevector-data bytevector-tag)))
|
||||||
(K c))]
|
(K (cond
|
||||||
|
[(<= -128 c 127) c]
|
||||||
|
[(<= 128 c 255) (- c 256)]
|
||||||
|
[else (interrupt)])))]
|
||||||
[else
|
[else
|
||||||
(prm 'bset/h (T x)
|
(prm 'bset/h (T x)
|
||||||
(prm 'int+
|
(prm 'int+
|
||||||
|
|
Loading…
Reference in New Issue