* psyntax is not working under chaitin.

This commit is contained in:
Abdulaziz Ghuloum 2007-02-16 10:11:21 -05:00
parent 649e7f022a
commit 85bf359150
6 changed files with 99 additions and 42 deletions

View File

@ -90,7 +90,12 @@
[movl (disp -4 %esp) %eax] [movl (disp -4 %esp) %eax]
[ret])) [ret]))
(asm-test 2
'([movl 12 (disp -8 %esp)] ;;; 12 = 001100
[movl 24 %eax] ;;; 24 = 011000
[andl %eax (disp -8 %esp)]
[movl (disp -8 %esp) %eax]
[ret]))
(asm-test 3 (asm-test 3
'([movl 4 (disp -4 %esp)] '([movl 4 (disp -4 %esp)]

Binary file not shown.

View File

@ -229,6 +229,14 @@
[$code->closure v] [$code->closure v]
[$closure-code v] [$closure-code v]
[$make-tcbucket v]
[$tcbucket-key v]
[$tcbucket-val v]
[$tcbucket-next v]
[$set-tcbucket-tconc! e]
[$set-tcbucket-val! e]
[$set-tcbucket-next! e]
[$cpref v] [$cpref v]
[primitive-set! e] [primitive-set! e]
[primitive-ref v] [primitive-ref v]
@ -731,27 +739,18 @@
[(primcall op arg*) [(primcall op arg*)
(case op (case op
[(nop) nop] [(nop) nop]
[(primitive-set!) [(primitive-set! $set-symbol-value! $set-symbol-string!
(let ([x (Value (car arg*))] [v (Value (cadr arg*))]) $set-symbol-unique-string! $set-symbol-plist!)
(mem-assign v x (let ([off
(- disp-symbol-system-value symbol-tag)))] (case op
[($set-symbol-value!) [(primitive-set!) disp-symbol-system-value]
(tbind ([x (Value (car arg*))] [($set-symbol-value!) disp-symbol-value]
[v (Value (cadr arg*))]) [($set-symbol-string!) disp-symbol-string]
(mem-assign v x [($set-symbol-unique-string!) disp-symbol-unique-string]
(- disp-symbol-value symbol-tag)))] [($set-symbol-plist) disp-symbol-plist]
[($set-symbol-string!) [else (err x)])])
(tbind ([x (Value (car arg*))] [v (Value (cadr arg*))]) (tbind ([x (Value (car arg*))] [v (Value (cadr arg*))])
(mem-assign v x (mem-assign v x (- off symbol-tag))))]
(- disp-symbol-string symbol-tag)))]
[($set-symbol-unique-string!)
(tbind ([x (Value (car arg*))] [v (Value (cadr arg*))])
(mem-assign v x
(- disp-symbol-unique-string symbol-tag)))]
[($set-symbol-plist!)
(tbind ([x (Value (car arg*))] [v (Value (cadr arg*))])
(mem-assign v x
(- disp-symbol-plist symbol-tag)))]
[($vector-set! $record-set!) [($vector-set! $record-set!)
(tbind ([x (Value (car arg*))] (tbind ([x (Value (car arg*))]
[v (Value (caddr arg*))]) [v (Value (caddr arg*))])
@ -829,17 +828,39 @@
(prm 'sll v (K (- 8 fixnum-shift)))))] (prm 'sll v (K (- 8 fixnum-shift)))))]
[($unset-interrupted!) ;;; PCB INTERRUPT [($unset-interrupted!) ;;; PCB INTERRUPT
(prm 'mset pcr (K 40) (K 0))] (prm 'mset pcr (K 40) (K 0))]
[($set-port-input-index! $set-port-output-index! [($set-port-input-index! $set-port-output-index!)
$set-port-input-size! $set-port-output-size!)
(let ([off (case op (let ([off (case op
[($set-port-input-index!) disp-port-input-index] [($set-port-input-index!) disp-port-input-index]
[($set-port-input-size!) disp-port-input-size] [($set-port-output-index!) disp-port-output-index]
[($set-port-output-index!) disp-port-output-index]
[($set-port-output-size!) disp-port-output-size]
[else (err x)])]) [else (err x)])])
(tbind ([p (Value (car arg*))] (tbind ([x (Value (car arg*))]
[v (Value (cadr arg*))]) [v (Value (cadr arg*))])
(prm 'mset p (K (- off vector-tag)) v)))] (prm 'mset x (K (- off vector-tag)) v)))]
[($set-port-input-size! $set-port-output-size!)
(let-values ([(sz-off idx-off)
(case op
[($set-port-input-size!)
(values disp-port-input-size
disp-port-input-index)]
[($set-port-output-size!)
(values disp-port-output-size
disp-port-output-index)]
[else (err x)])])
(tbind ([x (Value (car arg*))]
[v (Value (cadr arg*))])
(seq*
(prm 'mset x (K (- idx-off vector-tag)) (K 0))
(prm 'mset x (K (- sz-off vector-tag)) v))))]
[($set-tcbucket-next! $set-tcbucket-val! $set-tcbucket-tconc!)
(tbind ([x (Value (car arg*))]
[v (Value (cadr arg*))])
(mem-assign v x
(- (case op
[($set-tcbucket-tconc!) disp-tcbucket-tconc]
[($set-tcbucket-next!) disp-tcbucket-next]
[($set-tcbucket-val!) disp-tcbucket-val]
[else (err 'tcbucket!)])
vector-tag)))]
[else (error who "invalid effect prim ~s" op)])] [else (error who "invalid effect prim ~s" op)])]
[(forcall op arg*) [(forcall op arg*)
(make-forcall op (map Value arg*))] (make-forcall op (map Value arg*))]
@ -854,12 +875,10 @@
(define (tag-test x mask tag) (define (tag-test x mask tag)
(tbind ([x x]) (tbind ([x x])
(if mask (if mask
(make-primcall '= (prm '=
(list (make-primcall 'logand (prm 'logand x (K mask))
(list x (make-constant mask))) (K tag))
(make-constant tag))) (prm '= x (K tag)))))
(make-primcall '=
(list x (make-constant tag))))))
(define (sec-tag-test x pmask ptag smask stag) (define (sec-tag-test x pmask ptag smask stag)
(tbind ([t x]) (tbind ([t x])
(make-conditional (make-conditional
@ -1418,7 +1437,7 @@
(apply (apply
(lambda (handler buf/i idx/i sz/i buf/o idx/o sz/o) (lambda (handler buf/i idx/i sz/i buf/o idx/o sz/o)
(tbind ([p (prm 'alloc (tbind ([p (prm 'alloc
(K (align port-size)) (K (align port-size))
(K vector-tag))]) (K vector-tag))])
(seq* (seq*
(prm 'mset p (prm 'mset p
@ -1490,6 +1509,37 @@
(K (- disp-code-data vector-tag)))) (K (- disp-code-data vector-tag))))
(K 255)) (K 255))
(K fixnum-shift)))] (K fixnum-shift)))]
[($make-tcbucket)
(tbind ([tconc (Value (car arg*))]
[key (Value (cadr arg*))]
[val (Value (caddr arg*))]
[next (Value (cadddr arg*))])
(tbind ([x (prm 'alloc
(K (align tcbucket-size))
(K vector-tag))])
(seq*
(prm 'mset x
(K (- disp-tcbucket-tconc vector-tag))
tconc)
(prm 'mset x
(K (- disp-tcbucket-key vector-tag))
key)
(prm 'mset x
(K (- disp-tcbucket-val vector-tag))
val)
(prm 'mset x
(K (- disp-tcbucket-next vector-tag))
next)
x)))]
[($tcbucket-key)
(tbind ([x (Value (car arg*))])
(prm 'mref x (K (- disp-tcbucket-key vector-tag))))]
[($tcbucket-val)
(tbind ([x (Value (car arg*))])
(prm 'mref x (K (- disp-tcbucket-val vector-tag))))]
[($tcbucket-next)
(tbind ([x (Value (car arg*))])
(prm 'mref x (K (- disp-tcbucket-next vector-tag))))]
[else (error who "value prim ~a not supported" (unparse x))])] [else (error who "value prim ~a not supported" (unparse x))])]
[(forcall op arg*) [(forcall op arg*)
(make-forcall op (map Value arg*))] (make-forcall op (map Value arg*))]

View File

@ -90,6 +90,7 @@
($make-port/both handler ($make-port/both handler
input-buffer 0 ($string-length input-buffer) input-buffer 0 ($string-length input-buffer)
output-buffer 0 ($string-length output-buffer)))) output-buffer 0 ($string-length output-buffer))))
;;;
(primitive-set! 'make-input/output-port (primitive-set! 'make-input/output-port
(lambda (handler input-buffer output-buffer) (lambda (handler input-buffer output-buffer)
(if (procedure? handler) (if (procedure? handler)

View File

@ -586,6 +586,8 @@
(CODE #x81 (ModRM 3 '/4 dst (IMM32 src ac)))] (CODE #x81 (ModRM 3 '/4 dst (IMM32 src ac)))]
[(and (reg? src) (reg? dst)) [(and (reg? src) (reg? dst))
(CODE #x21 (ModRM 3 src dst ac))] (CODE #x21 (ModRM 3 src dst ac))]
[(and (reg? src) (mem? dst))
((CODE/digit #x21 src) dst ac)]
[(and (mem? src) (reg? dst)) [(and (mem? src) (reg? dst))
(CODErd #x23 dst src ac)] (CODErd #x23 dst src ac)]
[else (error who "invalid ~s" instr)])] [else (error who "invalid ~s" instr)])]

View File

@ -613,6 +613,8 @@
(lambda (symbol) (lambda (symbol)
(getprop symbol '*sc-expander*))) (getprop symbol '*sc-expander*)))
(define put-global-definition-hook (define put-global-definition-hook
(lambda (symbol x) (lambda (symbol x)
(if (not x) (if (not x)
@ -777,9 +779,6 @@
(define-syntax build-foreign-call (define-syntax build-foreign-call
(syntax-rules () (syntax-rules ()
[(_ ae name arg*) `(foreign-call ,name . ,arg*)])) [(_ ae name arg*) `(foreign-call ,name . ,arg*)]))
;;;X (define-syntax build-$apply
;;;X (syntax-rules ()
;;;X [(_ ae proc arg*) `($apply ,proc . ,arg*)]))
(define-syntax build-data (define-syntax build-data
(syntax-rules () (syntax-rules ()
@ -801,7 +800,6 @@
body-exp body-exp
`(letrec ,(map list vars val-exps) ,body-exp)))) `(letrec ,(map list vars val-exps) ,body-exp))))
(define build-body (define build-body
(lambda (ae vars val-exps body-exp) (lambda (ae vars val-exps body-exp)
(build-letrec ae vars val-exps body-exp))) (build-letrec ae vars val-exps body-exp)))
@ -1734,7 +1732,8 @@
(let dobody ((body body)) (let dobody ((body body))
(if (null? body) (if (null? body)
'() '()
(let ((first (chi-top (car body) r w ctem rtem meta? ribcage meta-residualize! #f))) (let ((first (chi-top (car body) r w ctem rtem meta? ribcage
meta-residualize! #f)))
(cons first (dobody (cdr body))))))))) (cons first (dobody (cdr body)))))))))
(define chi-top (define chi-top