From 38be0a3022246bf8bb4bfa5c162170e710bc4145 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Wed, 19 Jan 2022 11:36:29 -0500 Subject: [PATCH] Name dumped MAKE-LOAD-FORM results opaquely The name had no use except seemingly to disambiguate a call stack when debugging the compiler per se. Any random name suffices, even if unstable. (If you "need" that name, you've got bigger problems) --- src/compiler/main.lisp | 8 +++++++- tests/mlf.impure-cload.lisp | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/mlf.impure-cload.lisp diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index 717933ba1..e413bcb13 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -1568,7 +1568,13 @@ necessary, since type inference may take arbitrarily long to converge.") (fasl-note-dumpable-instance constant fasl) t) (t - (let* ((name (write-to-string constant :level 1 :length 2)) + ;; Allow dumping objects that can't be printed + ;; Non-invocation of PRINT-OBJECT is tested by 'mlf.impure-cload.lisp'. + (let* ((name #+sb-xc-host 'blobby ; the name means nothing + #-sb-xc-host + (format nil "the-~A-formerly-known-as-~X" + (type-of constant) + (get-lisp-obj-address constant))) (info (if init-form (list constant name init-form) (list constant)))) diff --git a/tests/mlf.impure-cload.lisp b/tests/mlf.impure-cload.lisp new file mode 100644 index 000000000..cbe60c2a9 --- /dev/null +++ b/tests/mlf.impure-cload.lisp @@ -0,0 +1,20 @@ +(eval-when (:compile-toplevel :load-toplevel :execute) + (defstruct fool x)) +(eval-when (:compile-toplevel) + (defmethod make-load-form ((self fool) &optional env) + (declare (ignore env)) + `(make-fool :x ,(fool-x self))) + (defparameter *crashy* t) + (defmethod print-object ((self fool) stream) + (if *crashy* + (progn + (setq *crashy* nil) + (error "Sorry!")) + (call-next-method)))) + +;;; We used to try to "name" everything dumped. +;;; If nothing else, the name should have been written with :READABLY NIL +;;; just in case it was going to signal print-not-readable. +;;; Now we don't print-object at all. +(defvar *foolz* + '#.(list (make-fool :x 1) (make-fool :x 2)))