ABSTRACT

Many Lisp systems have both an interpreter and a compiler. In such systems, compilation of those functions that contain macro calls sometimes causes a trouble. The interpreter always uses the latest macro definition since macro forms are expanded at execution time. On the other hand, the compiler expands macros at compile time and thus uses those macro definitions that exist at compile time. Therefore, when a function is compiled, all macros that the function references must have already been defined. If a macro is redefined, the change cannot be reflected to compiled functions since macro forms have already been expanded. As the result, the behavior of a compiled function may be different from an interpreted function, depending on the time of macro definition. In this paper, we propose a mechanism to guarantee that a compiled function behaves in the same way as the interpreted function. A Lisp system with this mechanism uses a dependence graph of functions and macros. When a macro is redefined, the system automatically recompiles those functions that depend on the macro. The proposed mechanism can avoid redundant recompilation and discard unnecessary information for recompilation, by making use of weak conses.