Comment 2 for bug 1826607

Revision history for this message
Douglas Katzman (dougk) wrote :

I suspect I'll apply this diff after freeze. It makes the test case work.

diff --git a/src/pcl/fngen.lisp b/src/pcl/fngen.lisp
index c6b51b63d..6721e3959 100644
--- a/src/pcl/fngen.lisp
+++ b/src/pcl/fngen.lisp
@@ -116,7 +116,12 @@
                                (declare (muffle-conditions compiler-note)
                                         (optimize (sb-c:store-source-form 0)))
                                (function ,code))))
- (let ((generator (compile nil generator-lambda)))
+ ;; Reliance on COMPILE is a hidden detail - for all people know,
+ ;; we turn EMFs into assembly code via an oracle.
+ ;; As such we need to minimize externally visible effects
+ ;; like invoking user-supplied macroexpander hooks.
+ (let ((generator (let ((*macroexpand-hook* #'funcall))
+ (compile nil generator-lambda))))
         (ensure-fgen test gensyms generator generator-lambda nil)
         generator))))

@@ -133,6 +138,7 @@

 (defun compute-code (lambda code-converter)
   (let ((*walk-form-expand-macros-p* t)
+ (*macroexpand-hook* #'funcall) ; See comment at GET-NEW-FUN-GENERATOR
         (gensyms ()))
     (values (walk-form lambda
                        nil
@@ -149,6 +155,7 @@

 (defun compute-constants (lambda constant-converter)
   (let ((*walk-form-expand-macros-p* t) ; doesn't matter here.
+ (*macroexpand-hook* #'funcall) ; See comment at GET-NEW-FUN-GENERATOR
         collect)
     (walk-form lambda
                nil