Attached patch fixes a segfault when trying to describe a brokwn weak
ptr. I also added a clause in the case construct to dispatch on a
described value to catch unknown immediate values instead of crashing
in the locative test (which expects block values).
felix
From 9b104e139f8dda862a3a78876b832514b0b1a76b Mon Sep 17 00:00:00 2001
From: felix
Date: Mon, 19 Jun 2023 13:35:55 +0200
Subject: [PATCH] handle #!bwp in csi's "describe" function properly
also adds guard clause to avoid segfault for newly
introduced immediate types.
---
csi.scm | 6 ++
1 file changed, 6 insertions(+)
diff --git a/csi.scm b/csi.scm
index ea618521..b3db4521 100644
--- a/csi.scm
+++ b/csi.scm
@@ -592,6 +592,9 @@ EOF
((eq? x #t) (fprintf out "boolean true~%"))
((eq? x #f) (fprintf out "boolean false~%"))
((null? x) (fprintf out "empty list~%"))
+((##core#inline "C_bwpp" x)
+ ;; TODO: replace with bwp-object? later
+ (fprintf out "broken weak pointer~%"))
((eof-object? x) (fprintf out "end-of-file object~%"))
((eq? (##sys#void) x) (fprintf out "unspecified object~%"))
((fixnum? x)
@@ -657,6 +660,9 @@ EOF
(##sys#slot x 7)
(##sys#slot x 3)
(##sys#peek-unsigned-integer x 0) ) )
+((not (##core#inline "C_blockp" x))
+ ;; catch immediates here, as ##sys#locative? crashes on non-block
+ (fprintf out "unknown immediate object~%"))
((##sys#locative? x)
(fprintf out "locative~% pointer ~X~% index ~A~% type ~A~%"
(##sys#peek-unsigned-integer x 0)
--
2.33.0