[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch main updated: Avoid 'frame-local-ref' errors when

From: Daniel Llorens
Subject: [Guile-commits] branch main updated: Avoid 'frame-local-ref' errors when printing backtrace.
Date: Tue, 29 Nov 2022 05:55:27 -0500

This is an automated email from the git hooks/post-receive script.

lloda pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new c7fa78fc7 Avoid 'frame-local-ref' errors when printing backtrace.
c7fa78fc7 is described below

commit c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a
Author: Andrew Whatson <>
AuthorDate: Tue Sep 20 17:23:58 2022 +1000

    Avoid 'frame-local-ref' errors when printing backtrace.
    Workaround for <>.
    * module/system/vm/frame.scm (frame-call-representation): Treat a
    binding as "unspecified" if its slot exceeds 'frame-num-locals'.
 module/system/vm/frame.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/module/system/vm/frame.scm b/module/system/vm/frame.scm
index 3be73e29c..6b14fc62a 100644
--- a/module/system/vm/frame.scm
+++ b/module/system/vm/frame.scm
@@ -381,8 +381,16 @@
         (frame-local-ref frame i 'scm))
        ((find-slot i bindings)
         => (lambda (binding)
-             (let ((val (frame-local-ref frame (binding-slot binding)
-                                         (binding-representation binding))))
+             (let* ((slot (binding-slot binding))
+                    ;; HACK: Avoid out-of-range from frame-local-ref.
+                    ;; Some frames have bindings beyond nlocals.  That
+                    ;; is probably a bug somewhere else, but at least
+                    ;; this workaround allows them to be printed.
+                    (val (if (< slot nlocals)
+                             (frame-local-ref frame slot
+                                              (binding-representation binding))
+                             ;; else #<unspecified>
+                             )))
                ;; It could be that there's a value that isn't clobbered
                ;; by a call but that isn't live after a call either.  In
                ;; that case, if GC runs during the call, the value will

reply via email to

[Prev in Thread] Current Thread [Next in Thread]