1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00

Reflection support for unboxed f64 slots

* module/system/vm/assembler.scm (emit-definition): Add representation
  field.
  (write-arities): Emit representations into the arities section.

* module/system/vm/debug.scm (arity-definitions): Read representations.

* module/system/vm/frame.scm (<binding>): Add representation field and
  binding-representation getter.
  (available-bindings): Pass representation to make-binding.
  (frame-binding-set!, frame-binding-ref, frame-call-representation):
  Pass representation to frame-local-ref / frame-local-set!.

* test-suite/tests/rtl.test: Update definition instructions.

* module/language/cps/slot-allocation.scm ($allocation): Add
  representations field.
  (lookup-representation): New public function.
  (allocate-slots): Pass representations to make-$allocation.

* module/language/cps/compile-bytecode.scm (compile-function): Adapt to
  emit-definition change.

* libguile/frames.h:
* libguile/frames.c (scm_frame_local_ref, scm_frame_local_set_x): Take
  representation argument.
  (scm_to_stack_item_representation): New internal helper.
This commit is contained in:
Andy Wingo 2015-10-28 17:03:42 +00:00
parent e7660a607c
commit e3cc0eeb3a
9 changed files with 149 additions and 77 deletions

View file

@ -475,7 +475,8 @@
(for-each (lambda (name var)
(let ((slot (maybe-slot var)))
(when slot
(emit-definition asm name slot))))
(let ((repr (lookup-representation var allocation)))
(emit-definition asm name slot repr)))))
names vars)
(when src
(emit-source asm src))

View file

@ -35,6 +35,7 @@
#:export (allocate-slots
lookup-slot
lookup-maybe-slot
lookup-representation
lookup-constant-value
lookup-maybe-constant-value
lookup-nlocals
@ -43,7 +44,8 @@
lookup-slot-map))
(define-record-type $allocation
(make-allocation slots constant-values call-allocs shuffles frame-sizes)
(make-allocation slots representations constant-values call-allocs
shuffles frame-sizes)
allocation?
;; A map of VAR to slot allocation. A slot allocation is an integer,
@ -51,6 +53,11 @@
;;
(slots allocation-slots)
;; A map of VAR to representation. A representation is either 'scm or
;; 'f64.
;;
(representations allocation-representations)
;; A map of VAR to constant value, for variables with constant values.
;;
(constant-values allocation-constant-values)
@ -95,6 +102,9 @@
(define (lookup-slot var allocation)
(intmap-ref (allocation-slots allocation) var))
(define (lookup-representation var allocation)
(intmap-ref (allocation-representations allocation) var))
(define *absent* (list 'absent))
(define (lookup-constant-value var allocation)
@ -1006,4 +1016,5 @@ are comparable with eqv?. A tmp slot may be used."
(let* ((slots (allocate-lazy-vars cps slots calls live-in lazy))
(shuffles (compute-shuffles cps slots calls live-in))
(frame-sizes (compute-frame-sizes cps slots calls shuffles)))
(make-allocation slots constants calls shuffles frame-sizes))))))
(make-allocation slots representations constants calls
shuffles frame-sizes))))))