wanted: compiler macro expansion in later compilation stages (e.g. after inlining)
Bug #632368 reported by
Tobias C. Rittweiler
This bug affects 4 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
Compiler macros seem to be expanded early in compilation; this prevents e.g.
(declaim (inline matches?))
(defun matches? (regex)
#'(lambda (line) (cl-ppcre:scan regex line)))
from triggering the compiler macro on CL-PPCRE:SCAN.
To post a comment you must log in.
This is an interesting notion.
Attached diff shows one way to do this: allow IR1-OPTIMIZE to reconstitute source forms for compiler-macros to look at if any of the arguments is a constant.
The same approach could be extended by annotating the lexenv with derived types of arguments, so compiler-macros could benefit from Python's type derivation.
Stuff to do if this is to go in:
* Annotate the lexenv calling the compiler- macro-function.
* Don't do this more than once per combination unless more constants become apparent during optimization.