1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

Rename gc-pointer-ref to pointer-ref

The pointer dereferencing instructions will keep the pointer alive by
referencing a containing object.

* module/language/cps/compile-bytecode.scm:
* libguile/vm-engine.c:
* module/language/cps/cse.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/specialize-primcalls.scm:
* module/language/cps/types.scm:
* module/system/vm/assembler.scm:
* module/system/vm/debug.scm: Rename instructions.
This commit is contained in:
Andy Wingo 2018-01-14 13:40:05 +01:00
parent 13cafca168
commit 73f55cb9ae
10 changed files with 21 additions and 29 deletions

View file

@ -1421,7 +1421,7 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
NEXT (1); NEXT (1);
} }
VM_DEFINE_OP (45, gc_pointer_ref_immediate, "gc-pointer-ref/immediate", OP1 (X8_S8_S8_C8) | OP_DST) VM_DEFINE_OP (45, pointer_ref_immediate, "pointer-ref/immediate", OP1 (X8_S8_S8_C8) | OP_DST)
{ {
scm_t_uint8 dst, obj, idx; scm_t_uint8 dst, obj, idx;
@ -1432,7 +1432,7 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
NEXT (1); NEXT (1);
} }
VM_DEFINE_OP (46, gc_pointer_set_immediate, "gc-pointer-set!/immediate", OP1 (X8_S8_C8_S8)) VM_DEFINE_OP (46, pointer_set_immediate, "pointer-set!/immediate", OP1 (X8_S8_C8_S8))
{ {
scm_t_uint8 obj, idx, val; scm_t_uint8 obj, idx, val;

View file

@ -170,8 +170,8 @@
(from-sp (slot idx)))) (from-sp (slot idx))))
(($ $primcall 'word-ref/immediate (annotation . idx) (obj)) (($ $primcall 'word-ref/immediate (annotation . idx) (obj))
(emit-word-ref/immediate asm (from-sp dst) (from-sp (slot obj)) idx)) (emit-word-ref/immediate asm (from-sp dst) (from-sp (slot obj)) idx))
(($ $primcall 'gc-pointer-ref/immediate (annotation . idx) (obj)) (($ $primcall 'pointer-ref/immediate (annotation . idx) (obj))
(emit-gc-pointer-ref/immediate asm (from-sp dst) (from-sp (slot obj)) idx)) (emit-pointer-ref/immediate asm (from-sp dst) (from-sp (slot obj)) idx))
(($ $primcall 'struct-ref/immediate idx (struct)) (($ $primcall 'struct-ref/immediate idx (struct))
(emit-struct-ref/immediate asm (from-sp dst) (from-sp (slot struct)) (emit-struct-ref/immediate asm (from-sp dst) (from-sp (slot struct))
idx)) idx))
@ -347,9 +347,9 @@
(($ $primcall 'word-set!/immediate (annotation . idx) (obj val)) (($ $primcall 'word-set!/immediate (annotation . idx) (obj val))
(emit-word-set!/immediate asm (from-sp (slot obj)) idx (emit-word-set!/immediate asm (from-sp (slot obj)) idx
(from-sp (slot val)))) (from-sp (slot val))))
(($ $primcall 'gc-pointer-set!/immediate (annotation . idx) (obj val)) (($ $primcall 'pointer-set!/immediate (annotation . idx) (obj val))
(emit-gc-pointer-set!/immediate asm (from-sp (slot obj)) idx (emit-pointer-set!/immediate asm (from-sp (slot obj)) idx
(from-sp (slot val)))) (from-sp (slot val))))
(($ $primcall 'free-set! idx (closure value)) (($ $primcall 'free-set! idx (closure value))
(emit-free-set! asm (from-sp (slot closure)) (from-sp (slot value)) (emit-free-set! asm (from-sp (slot closure)) (from-sp (slot value))
idx)) idx))

View file

@ -256,7 +256,7 @@ false. It could be that both true and false proofs are available."
((scm-set!/immediate p s x) (x <- scm-ref/immediate p s)) ((scm-set!/immediate p s x) (x <- scm-ref/immediate p s))
((word-set! p s i x) (x <- word-ref p s i)) ((word-set! p s i x) (x <- word-ref p s i))
((word-set!/immediate p s x) (x <- word-ref/immediate p s)) ((word-set!/immediate p s x) (x <- word-ref/immediate p s))
((gc-pointer-set!/immediate p s x) (x <- gc-pointer-ref/immediate p s)) ((pointer-set!/immediate p s x) (x <- pointer-ref/immediate p s))
((s <- allocate-struct #f v n) (v <- struct-vtable #f s)) ((s <- allocate-struct #f v n) (v <- struct-vtable #f s))
((s <- allocate-struct/immediate n v) (v <- struct-vtable #f s)) ((s <- allocate-struct/immediate n v) (v <- struct-vtable #f s))

View file

@ -381,11 +381,11 @@ the LABELS that are clobbered by the effects of LABEL."
((ann . idx) ((ann . idx)
(&write-field (&write-field
(annotation->memory-kind ann) idx)))) (annotation->memory-kind ann) idx))))
((gc-pointer-ref/immediate obj) (match param ((pointer-ref/immediate obj) (match param
((ann . idx) ((ann . idx)
(&read-field (&read-field
(annotation->memory-kind ann) idx)))) (annotation->memory-kind ann) idx))))
((gc-pointer-set!/immediate obj val) ((pointer-set!/immediate obj val)
(match param (match param
((ann . idx) ((ann . idx)
(&write-field (&write-field

View file

@ -337,7 +337,7 @@
(setk label ($kargs names vars (setk label ($kargs names vars
($continue kop src ($continue kop src
($primcall 'load-u64 n ()))))))))) ($primcall 'load-u64 n ())))))))))
;; Assume gc-pointer-ref/immediate is within u8 range. ;; Assume pointer-ref/immediate is within u8 range.
(((or 'word-ref/immediate 'scm-ref/immediate) obj) (((or 'word-ref/immediate 'scm-ref/immediate) obj)
(match param (match param
((ann . idx) ((ann . idx)

View file

@ -768,8 +768,8 @@ are comparable with eqv?. A tmp slot may be used."
's8-ref 's16-ref 's32-ref 's64-ref 's8-ref 's16-ref 's32-ref 's64-ref
'bv-s8-ref 'bv-s16-ref 'bv-s32-ref 'bv-s64-ref)) 'bv-s8-ref 'bv-s16-ref 'bv-s32-ref 'bv-s64-ref))
(intmap-add representations var 's64)) (intmap-add representations var 's64))
(($ $primcall (or 'gc-pointer-ref/immediate)) (($ $primcall (or 'pointer-ref/immediate))
(intmap-add representations var 'gcptr)) (intmap-add representations var 'ptr))
(_ (_
(intmap-add representations var 'scm)))) (intmap-add representations var 'scm))))
(vars (vars
@ -854,7 +854,7 @@ are comparable with eqv?. A tmp slot may be used."
(#f slot-map) (#f slot-map)
(slot (slot
(let ((desc (match (intmap-ref representations var) (let ((desc (match (intmap-ref representations var)
((or 'u64 'f64 's64) slot-desc-live-raw) ((or 'u64 'f64 's64 'ptr) slot-desc-live-raw)
('scm slot-desc-live-scm)))) ('scm slot-desc-live-scm))))
(logior slot-map (ash desc (* 2 slot))))))) (logior slot-map (ash desc (* 2 slot)))))))
live-vars 0)) live-vars 0))

View file

@ -127,8 +127,7 @@
(('allocate-words (? uint? n)) (allocate-words/immediate n ())) (('allocate-words (? uint? n)) (allocate-words/immediate n ()))
(('scm-ref o (? uint? i)) (scm-ref/immediate i (o))) (('scm-ref o (? uint? i)) (scm-ref/immediate i (o)))
(('scm-set! o (? uint? i) x) (scm-set!/immediate i (o x))) (('scm-set! o (? uint? i) x) (scm-set!/immediate i (o x)))
;; Assume gc-pointer-ref/immediate can always be emitted ;; Assume pointer-ref/immediate can always be emitted directly.
;; directly.
(('word-ref o (? uint? i)) (word-ref/immediate i (o))) (('word-ref o (? uint? i)) (word-ref/immediate i (o)))
(('word-set! o (? uint? i) x) (word-set!/immediate i (o x))) (('word-set! o (? uint? i) x) (word-set!/immediate i (o x)))
(('add x (? num? y)) (add/immediate y (x))) (('add x (? num? y)) (add/immediate y (x)))

View file

@ -783,16 +783,9 @@ minimum, and maximum."
((annotation . idx) ((annotation . idx)
(restrict! obj (annotation->type annotation) (1+ idx) +inf.0)))) (restrict! obj (annotation->type annotation) (1+ idx) +inf.0))))
(define-type-inferrer/param (gc-pointer-ref/immediate param obj result) (define-type-inferrer/param (pointer-ref/immediate param obj result)
(match param (define! result &other-heap-object -inf.0 +inf.0))
((annotation . idx)
(restrict! obj (annotation->type annotation) (1+ idx) +inf.0)
(define! result &other-heap-object -inf.0 +inf.0))))
(define-type-inferrer/param (gc-pointer-set!/immediate param obj word)
(match param
((annotation . idx)
(restrict! obj (annotation->type annotation) (1+ idx) +inf.0))))

View file

@ -155,8 +155,8 @@
emit-word-ref/immediate emit-word-ref/immediate
emit-word-set!/immediate emit-word-set!/immediate
emit-gc-pointer-ref/immediate emit-pointer-ref/immediate
emit-gc-pointer-set!/immediate emit-pointer-set!/immediate
emit-u8-ref emit-u8-ref
emit-s8-ref emit-s8-ref
@ -2152,7 +2152,7 @@ procedure with label @var{rw-init}. @var{rw-init} may be false. If
((f64) 1) ((f64) 1)
((u64) 2) ((u64) 2)
((s64) 3) ((s64) 3)
((gc-ptr) 4) ((ptr) 4)
(else (error "what!" representation))))) (else (error "what!" representation)))))
(put-uleb128 names-port (logior (ash slot 3) tag))) (put-uleb128 names-port (logior (ash slot 3) tag)))
(lp definitions)))))) (lp definitions))))))

View file

@ -388,7 +388,7 @@ section of the ELF image. Returns an ELF symbol, or @code{#f}."
((1) 'f64) ((1) 'f64)
((2) 'u64) ((2) 'u64)
((3) 's64) ((3) 's64)
((4) 'gcptr) ((4) 'ptr)
(else 'unknown)))) (else 'unknown))))
(cons (vector name def-offset slot representation) (cons (vector name def-offset slot representation)
(lp pos names))))))))))) (lp pos names)))))))))))