mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-19 19:20:23 +02:00
Assignment conversion uses unchecked memory accessors
* module/language/cps/effects-analysis.scm (annotation->memory-kind): Add box type annotation. * module/language/cps/reify-primitives.scm (primitive-ref): Reify scm-ref/immediate instead of box-ref. * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Remove needless and unbound -> literal. * module/language/cps/types.scm (annotation->type): Add box type. * module/language/tree-il/compile-cps.scm (convert): Reify scm-ref/immediate / scm-set!/immediate instead of box-ref / box-set!.
This commit is contained in:
parent
dd8bf6a98c
commit
eed4e09723
5 changed files with 32 additions and 20 deletions
|
@ -341,7 +341,8 @@ the LABELS that are clobbered by the effects of LABEL."
|
|||
;; FIXME: Flesh this out.
|
||||
(match annotation
|
||||
('pair &pair)
|
||||
('vector &vector)))
|
||||
('vector &vector)
|
||||
('box &box)))
|
||||
|
||||
(define-primitive-effects* param
|
||||
((allocate-words size) (&allocate (annotation->memory-kind param)))
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
(lambda (cps box)
|
||||
(with-cps cps
|
||||
(build-term
|
||||
($continue k src ($primcall 'box-ref #f (box))))))))
|
||||
($continue k src
|
||||
($primcall 'scm-ref/immediate '(box . 1) (box))))))))
|
||||
|
||||
(define (builtin-ref cps idx k src)
|
||||
(with-cps cps
|
||||
|
@ -257,7 +258,7 @@
|
|||
(letv n*)
|
||||
(letk kop ($kargs ('n) (n*)
|
||||
($continue k src
|
||||
($primcall 'allocate-words ann (n)))))
|
||||
($primcall 'allocate-words ann (n*)))))
|
||||
(setk label ($kargs names vars
|
||||
($continue kop src
|
||||
($primcall 'load-u64 n ())))))))))
|
||||
|
|
|
@ -108,10 +108,10 @@
|
|||
(define (rename name)
|
||||
(build-exp ($primcall name param args)))
|
||||
(define-syntax compute-constant
|
||||
(syntax-rules (->)
|
||||
((_ (c -> exp) body)
|
||||
(syntax-rules ()
|
||||
((_ (c exp) body)
|
||||
(let* ((c (intmap-ref constants c)) (c exp)) body))
|
||||
((_ c body) (compute-constant (c -> c) body))))
|
||||
((_ c body) (compute-constant (c c) body))))
|
||||
(define-syntax-rule (specialize-case (pat (op c (arg ...))) ...)
|
||||
(match (cons name args)
|
||||
(pat
|
||||
|
@ -125,11 +125,11 @@
|
|||
(('allocate-struct v (? uint? n)) (allocate-struct/immediate n (v)))
|
||||
(('struct-ref s (? uint? n)) (struct-ref/immediate n (s)))
|
||||
(('struct-set! s (? uint? n) x) (struct-set!/immediate n (s x)))
|
||||
(('allocate-words (? uint? n)) (allocate-words/immediate (n -> (cons param n)) ()))
|
||||
(('scm-ref o (? uint? i)) (scm-ref/immediate (i -> (cons param i)) (o)))
|
||||
(('scm-set! o (? uint? i) x) (scm-set!/immediate (i -> (cons param i)) (o x)))
|
||||
(('word-ref o (? uint? i)) (word-ref/immediate (i -> (cons param i)) (o)))
|
||||
(('word-set! o (? uint? i) x) (word-set!/immediate (i -> (cons param i)) (o x)))
|
||||
(('allocate-words (? uint? n)) (allocate-words/immediate (n (cons param n)) ()))
|
||||
(('scm-ref o (? uint? i)) (scm-ref/immediate (i (cons param i)) (o)))
|
||||
(('scm-set! o (? uint? i) x) (scm-set!/immediate (i (cons param i)) (o x)))
|
||||
(('word-ref o (? uint? i)) (word-ref/immediate (i (cons param i)) (o)))
|
||||
(('word-set! o (? uint? i) x) (word-set!/immediate (i (cons param i)) (o x)))
|
||||
(('add x (? num? y)) (add/immediate y (x)))
|
||||
(('add (? num? y) x) (add/immediate y (x)))
|
||||
(('sub x (? num? y)) (sub/immediate y (x)))
|
||||
|
|
|
@ -712,7 +712,8 @@ minimum, and maximum."
|
|||
(define (annotation->type ann)
|
||||
;; Expand me!
|
||||
(match ann
|
||||
('vector &vector)))
|
||||
('vector &vector)
|
||||
('box &box)))
|
||||
|
||||
(define-type-inferrer/param (allocate-words param size result)
|
||||
(define! result (annotation->type param) (&min/0 size) (&max/scm-size size)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue