From e3cc0eeb3a9c94f018540e659c4686f5e986b48c Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 28 Oct 2015 17:03:42 +0000 Subject: 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 (): 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. --- module/system/vm/debug.scm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'module/system/vm/debug.scm') diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm index cd8c19e13..814472b7a 100644 --- a/module/system/vm/debug.scm +++ b/module/system/vm/debug.scm @@ -1,6 +1,6 @@ ;;; Guile runtime debug information -;;; Copyright (C) 2013, 2014 Free Software Foundation, Inc. +;;; Copyright (C) 2013, 2014, 2015 Free Software Foundation, Inc. ;;; ;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public @@ -381,9 +381,14 @@ section of the ELF image. Returns an ELF symbol, or @code{#f}." (call-with-values (lambda () (read-uleb128 bv pos)) (lambda (def-offset pos) (call-with-values (lambda () (read-uleb128 bv pos)) - (lambda (slot pos) - (cons (vector name def-offset slot) - (lp pos names)))))))))) + (lambda (slot+representation pos) + (let ((slot (ash slot+representation -2)) + (representation (case (logand slot+representation #x3) + ((0) 'scm) + ((1) 'f64) + (else 'unknown)))) + (cons (vector name def-offset slot representation) + (lp pos names))))))))))) (define (load-symbols pos) (let lp ((pos pos) (n nlocals) (out '())) (if (zero? n) -- cgit v1.2.3