summaryrefslogtreecommitdiff
path: root/module/system/vm
diff options
context:
space:
mode:
Diffstat (limited to 'module/system/vm')
-rw-r--r--module/system/vm/assembler.scm4
-rw-r--r--module/system/vm/debug.scm18
-rw-r--r--module/system/vm/program.scm13
3 files changed, 20 insertions, 15 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index d6b417f76..7020487fd 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -1380,8 +1380,8 @@ it will be added to the GC roots at runtime."
(define (write-arity-headers metas bv endianness)
(define (write-arity-header* pos low-pc high-pc flags nreq nopt)
- (bytevector-u32-set! bv pos low-pc endianness)
- (bytevector-u32-set! bv (+ pos 4) high-pc endianness)
+ (bytevector-u32-set! bv pos (* low-pc 4) endianness)
+ (bytevector-u32-set! bv (+ pos 4) (* high-pc 4) endianness)
(bytevector-u32-set! bv (+ pos 8) 0 endianness) ; offset
(bytevector-u32-set! bv (+ pos 12) flags endianness)
(bytevector-u32-set! bv (+ pos 16) nreq endianness)
diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm
index a3aede73c..561143263 100644
--- a/module/system/vm/debug.scm
+++ b/module/system/vm/debug.scm
@@ -272,12 +272,18 @@ section of the ELF image. Returns an ELF symbol, or @code{#f}."
(define (is-case-lambda? flags) (not (zero? (logand flags (ash 1 3)))))
(define (arity-low-pc arity)
- (arity-low-pc* (elf-bytes (debug-context-elf (arity-context arity)))
- (arity-header-offset arity)))
+ (let ((ctx (arity-context arity)))
+ (+ (debug-context-base ctx)
+ (debug-context-text-base ctx)
+ (arity-low-pc* (elf-bytes (debug-context-elf ctx))
+ (arity-header-offset arity)))))
(define (arity-high-pc arity)
- (arity-high-pc* (elf-bytes (debug-context-elf (arity-context arity)))
- (arity-header-offset arity)))
+ (let ((ctx (arity-context arity)))
+ (+ (debug-context-base ctx)
+ (debug-context-text-base ctx)
+ (arity-high-pc* (elf-bytes (debug-context-elf ctx))
+ (arity-header-offset arity)))))
(define (arity-nreq arity)
(arity-nreq* (elf-bytes (debug-context-elf (arity-context arity)))
@@ -352,9 +358,9 @@ section of the ELF image. Returns an ELF symbol, or @code{#f}."
(let lp ((pos headers-start))
(cond
((>= pos headers-end) #f)
- ((< text-offset (* (arity-low-pc* bv pos) 4))
+ ((< text-offset (arity-low-pc* bv pos))
#f)
- ((<= (* (arity-high-pc* bv pos) 4) text-offset)
+ ((<= (arity-high-pc* bv pos) text-offset)
(lp (+ pos arity-header-len)))
(else
(make-arity context base pos))))))
diff --git a/module/system/vm/program.scm b/module/system/vm/program.scm
index ecac6a791..cf77c2824 100644
--- a/module/system/vm/program.scm
+++ b/module/system/vm/program.scm
@@ -314,13 +314,12 @@
prog
(list 0 0 nreq nopt rest? '(#f . ()))))))))
((rtl-program? prog)
- (let ((pc (and ip (+ (rtl-program-code prog) ip))))
- (or-map (lambda (arity)
- (and (or (not pc)
- (and (<= (arity-low-pc arity) pc)
- (< pc (arity-high-pc arity))))
- (arity-arguments-alist arity)))
- (or (find-program-arities (rtl-program-code prog)) '()))))
+ (or-map (lambda (arity)
+ (and (or (not ip)
+ (and (<= (arity-low-pc arity) ip)
+ (< ip (arity-high-pc arity))))
+ (arity-arguments-alist arity)))
+ (or (find-program-arities (rtl-program-code prog)) '())))
(else
(let ((arity (program-arity prog ip)))
(and arity