From 48d1f01fbc5857b0e3d3a58bea39ed4742c9b65d Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Sat, 10 Sep 2016 12:40:03 -0700 Subject: [PATCH] Fix #24: compile already compiled function If the function is already compiled and we don't have the source for it any more, just return without recompiling anything. --- src/compiler/main.lisp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index 5c5386dd8..58ab89c35 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -2045,7 +2045,7 @@ (function-lambda-expression definition) (if (and exp (not lexenv)) `#',exp - `',definition))))) + definition))))) (*source-info* (make-lisp-source-info form)) (*top-level-lambdas* ()) (*converting-for-interpreter* nil) @@ -2069,6 +2069,14 @@ (*gensym-counter* 0) (*current-function-names* (list name)) (intl::*default-domain* intl::*default-domain*)) + ;; As mentioned above, we can return the same function if the + ;; function was already compiled. We do this when FORM is EQ + ;; to DEFINITION (which happens above if we have a compiled + ;; function that we don't have the source for or was defined + ;; in a non-null environment. + (when (and name (eq form definition)) + (return-from compile + (values name nil nil))) (with-debug-counters (clear-stuff) (find-source-paths form 0) -- GitLab