mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +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
|
@ -104,7 +104,7 @@ a procedure."
|
|||
'((begin-program countdown
|
||||
((name . countdown)))
|
||||
(begin-standard-arity (x) 4 #f)
|
||||
(definition x 1)
|
||||
(definition x 1 scm)
|
||||
(br fix-body)
|
||||
(label loop-head)
|
||||
(br-if-= 1 2 #f out)
|
||||
|
@ -143,7 +143,7 @@ a procedure."
|
|||
(begin-program accum
|
||||
((name . accum)))
|
||||
(begin-standard-arity (x) 4 #f)
|
||||
(definition x 1)
|
||||
(definition x 1 scm)
|
||||
(free-ref 1 3 0)
|
||||
(box-ref 0 1)
|
||||
(add 0 0 2)
|
||||
|
@ -164,7 +164,7 @@ a procedure."
|
|||
'((begin-program call
|
||||
((name . call)))
|
||||
(begin-standard-arity (f) 7 #f)
|
||||
(definition f 1)
|
||||
(definition f 1 scm)
|
||||
(mov 1 5)
|
||||
(call 5 1)
|
||||
(receive 1 5 7)
|
||||
|
@ -179,7 +179,7 @@ a procedure."
|
|||
'((begin-program call-with-3
|
||||
((name . call-with-3)))
|
||||
(begin-standard-arity (f) 7 #f)
|
||||
(definition f 1)
|
||||
(definition f 1 scm)
|
||||
(mov 1 5)
|
||||
(load-constant 0 3)
|
||||
(call 5 2)
|
||||
|
@ -196,7 +196,7 @@ a procedure."
|
|||
'((begin-program call
|
||||
((name . call)))
|
||||
(begin-standard-arity (f) 2 #f)
|
||||
(definition f 1)
|
||||
(definition f 1 scm)
|
||||
(mov 1 0)
|
||||
(tail-call 1)
|
||||
(end-arity)
|
||||
|
@ -209,7 +209,7 @@ a procedure."
|
|||
'((begin-program call-with-3
|
||||
((name . call-with-3)))
|
||||
(begin-standard-arity (f) 2 #f)
|
||||
(definition f 1)
|
||||
(definition f 1 scm)
|
||||
(mov 1 0) ;; R0 <- R1
|
||||
(load-constant 0 3) ;; R1 <- 3
|
||||
(tail-call 2)
|
||||
|
@ -234,7 +234,7 @@ a procedure."
|
|||
(begin-program sqrt-trampoline
|
||||
((name . sqrt-trampoline)))
|
||||
(begin-standard-arity (x) 3 #f)
|
||||
(definition x 1)
|
||||
(definition x 1 scm)
|
||||
(cached-toplevel-box 0 sqrt-scope sqrt #t)
|
||||
(box-ref 2 0)
|
||||
(tail-call 2)
|
||||
|
@ -287,7 +287,7 @@ a procedure."
|
|||
(begin-program sqrt-trampoline
|
||||
((name . sqrt-trampoline)))
|
||||
(begin-standard-arity (x) 3 #f)
|
||||
(definition x 1)
|
||||
(definition x 1 scm)
|
||||
(cached-module-box 0 (guile) sqrt #t #t)
|
||||
(box-ref 2 0)
|
||||
(tail-call 2)
|
||||
|
@ -368,8 +368,8 @@ a procedure."
|
|||
(assemble-program
|
||||
'((begin-program foo ((name . foo)))
|
||||
(begin-standard-arity (x y) 3 #f)
|
||||
(definition x 1)
|
||||
(definition y 2)
|
||||
(definition x 1 scm)
|
||||
(definition y 2 scm)
|
||||
(load-constant 1 42)
|
||||
(return-values 2)
|
||||
(end-arity)
|
||||
|
@ -380,9 +380,9 @@ a procedure."
|
|||
(assemble-program
|
||||
'((begin-program foo ((name . foo)))
|
||||
(begin-opt-arity (x) (y) z 4 #f)
|
||||
(definition x 1)
|
||||
(definition y 2)
|
||||
(definition z 3)
|
||||
(definition x 1 scm)
|
||||
(definition y 2 scm)
|
||||
(definition z 3 scm)
|
||||
(load-constant 2 42)
|
||||
(return-values 2)
|
||||
(end-arity)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue