mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +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:
parent
e7660a607c
commit
e3cc0eeb3a
9 changed files with 149 additions and 77 deletions
|
@ -1162,10 +1162,9 @@ returned instead."
|
|||
(define-macro-assembler (source asm source)
|
||||
(set-asm-sources! asm (acons (asm-start asm) source (asm-sources asm))))
|
||||
|
||||
(define-macro-assembler (definition asm name slot)
|
||||
(define-macro-assembler (definition asm name slot representation)
|
||||
(let* ((arity (car (meta-arities (car (asm-meta asm)))))
|
||||
(def (vector name
|
||||
slot
|
||||
(def (vector name slot representation
|
||||
(* (- (asm-start asm) (arity-low-pc arity)) 4))))
|
||||
(set-arity-definitions! arity (cons def (arity-definitions arity)))))
|
||||
|
||||
|
@ -1876,7 +1875,7 @@ procedure with label @var{rw-init}. @var{rw-init} may be false. If
|
|||
(let lp ((definitions (arity-definitions arity)))
|
||||
(match definitions
|
||||
(() relocs)
|
||||
((#(name slot def) . definitions)
|
||||
((#(name slot representation def) . definitions)
|
||||
(let ((sym (if (symbol? name)
|
||||
(string-table-intern! strtab (symbol->string name))
|
||||
0)))
|
||||
|
@ -1886,9 +1885,13 @@ procedure with label @var{rw-init}. @var{rw-init} may be false. If
|
|||
(let lp ((definitions (arity-definitions arity)))
|
||||
(match definitions
|
||||
(() relocs)
|
||||
((#(name slot def) . definitions)
|
||||
((#(name slot representation def) . definitions)
|
||||
(put-uleb128 names-port def)
|
||||
(put-uleb128 names-port slot)
|
||||
(let ((tag (case representation
|
||||
((scm) 0)
|
||||
((f64) 1)
|
||||
(else (error "what!" representation)))))
|
||||
(put-uleb128 names-port (logior (ash slot 2) tag)))
|
||||
(lp definitions))))))
|
||||
(let lp ((metas metas) (pos arities-prefix-len) (relocs '()))
|
||||
(match metas
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue