diff options
author | Andy Wingo <wingo@pobox.com> | 2015-10-28 17:03:42 +0000 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2015-10-28 17:43:55 +0000 |
commit | e3cc0eeb3a9c94f018540e659c4686f5e986b48c (patch) | |
tree | 14966378a33895bcb61100f9223fd66a8798f97c /module/system/vm/assembler.scm | |
parent | e7660a607cabdb0061784ada2869e47db946275b (diff) | |
download | guile-e3cc0eeb3a9c94f018540e659c4686f5e986b48c.tar.gz |
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.
Diffstat (limited to 'module/system/vm/assembler.scm')
-rw-r--r-- | module/system/vm/assembler.scm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm index 379539f6a..dd96709e5 100644 --- a/module/system/vm/assembler.scm +++ b/module/system/vm/assembler.scm @@ -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 |