1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 11:10:25 +02:00

Lower box, box-ref, box-set! primcalls

* module/language/tree-il/compile-cps.scm (box, ensure-box):
  (box-ref, box-set!): Lower box primcalls.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/cse.scm (compute-equivalent-subexpressions):
* module/language/cps/dce.scm (compute-live-code):
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm: Remove special support for boxes.  What
  a pleasure!
This commit is contained in:
Andy Wingo 2018-01-10 07:43:00 +01:00
parent 97301efca4
commit 24f998e4d2
6 changed files with 64 additions and 35 deletions

View file

@ -316,8 +316,6 @@
(($ $primcall 'free-set! idx (closure value))
(emit-free-set! asm (from-sp (slot closure)) (from-sp (slot value))
idx))
(($ $primcall 'box-set! #f (box value))
(emit-box-set! asm (from-sp (slot box)) (from-sp (slot value))))
(($ $primcall 'struct-set! #f (struct index value))
(emit-struct-set! asm (from-sp (slot struct)) (from-sp (slot index))
(from-sp (slot value))))

View file

@ -251,9 +251,6 @@ false. It could be that both true and false proofs are available."
(add-def! (list 'op* arg* ...) aux) ...)
(_ (add-definitions . clauses))))))
(add-definitions
((b <- box #f o) (o <- box-ref #f b))
((box-set! #f b o) (o <- box-ref #f b))
((scm-set! p s i x) (x <- scm-ref p s i))
((scm-set!/tag p s x) (x <- scm-ref/tag p s))
((scm-set!/immediate p s x) (x <- scm-ref/immediate p s))

View file

@ -188,8 +188,7 @@ sites."
(and (causes-effect? fx &write)
(match exp
(($ $primcall
(or 'box-set!
'scm-set! 'scm-set!/tag 'scm-set!/immediate
(or 'scm-set! 'scm-set!/tag 'scm-set!/immediate
'word-set! 'word-set!/immediate) _
(obj . _))
(or (var-live? obj live-vars)

View file

@ -381,12 +381,6 @@ the LABELS that are clobbered by the effects of LABEL."
(&write-field
(annotation->memory-kind ann) idx)))))
;; Variables.
(define-primitive-effects
((box v) (&allocate &box))
((box-ref v) (&read-object &box) &type-check)
((box-set! v x) (&write-object &box) &type-check))
;; Structs.
(define-primitive-effects* param
((allocate-struct vt n) (&allocate &struct) &type-check)

View file

@ -805,28 +805,6 @@ minimum, and maximum."
((current-thread) &all-types))
;;;
;;; Prompts. (Nothing to do.)
;;;
;;;
;;; Variables.
;;;
(define-simple-types
((box &all-types) (&box 1))
((box-ref (&box 1)) &all-types))
(define-simple-type-checker (box-set! (&box 0 1) &all-types))
(define-type-inferrer (box-set! box val)
(restrict! box &box 1 1))
;;;