diff --git a/src/cmp/cmpglobals.lsp b/src/cmp/cmpglobals.lsp index abec2466d..8ba09e7d1 100644 --- a/src/cmp/cmpglobals.lsp +++ b/src/cmp/cmpglobals.lsp @@ -234,6 +234,9 @@ slashes before special characters.") in the translated C/C++ file. Notice that it is unspecified where these lines are inserted, but the order is preserved") +(defvar *compile-time-too* nil) +(defvar *not-compile-time* nil) + (defvar *permanent-data* nil) ; detemines whether we use *permanent-objects* ; or *temporary-objects* (defvar *permanent-objects* nil) ; holds { ( object (VV vv-index) ) }* @@ -311,6 +314,7 @@ be deleted if they have been opened with LoadLibrary.") (*global-cfuns-array* nil) (*undefined-vars* nil) (*top-level-forms* nil) + (*compile-time-too* nil) (*clines-string-list* '()) (*inline-blocks* 0) (*open-c-braces* 0) diff --git a/src/cmp/cmptop.lsp b/src/cmp/cmptop.lsp index 6ca0a5626..122adad01 100644 --- a/src/cmp/cmptop.lsp +++ b/src/cmp/cmptop.lsp @@ -37,8 +37,7 @@ (when (member fun *toplevel-forms-to-print*) (print-current-form)) (cond - ((consp fun) - (t1ordinary form)) + ((consp fun) (t1ordinary form)) ((not (symbolp fun)) (cmperr "~s is illegal function." fun)) ((eq fun 'QUOTE) @@ -95,7 +94,8 @@ (defun emit-local-funs () (declare (si::c-local)) ;; Local functions and closure functions - (do ((*compile-toplevel* nil)) + (do ((*compile-time-too* nil) + (*compile-toplevel* nil)) ;; repeat until t3local-fun generates no more ((eq *emitted-local-funs* *local-funs*)) ;; scan *local-funs* backwards @@ -269,13 +269,12 @@ (execute-flag nil)) (dolist (situation (car args)) (case situation - ((CL:LOAD :LOAD-TOPLEVEL) - (setq load-flag t)) - ((CL:COMPILE :COMPILE-TOPLEVEL) - (setq compile-flag t)) + ((CL:LOAD :LOAD-TOPLEVEL) (setq load-flag t)) + ((CL:COMPILE :COMPILE-TOPLEVEL) (setq compile-flag t)) ((CL:EVAL :EXECUTE) - (unless *compile-toplevel* - (setq execute-flag t))) + (if *compile-toplevel* + (setq compile-flag (or *compile-time-too* compile-flag)) + (setq execute-flag t))) (otherwise (cmperr "The EVAL-WHEN situation ~s is illegal." situation)))) (cond ((not *compile-toplevel*) @@ -440,7 +439,9 @@ (otherwise "cl_object "))) (defun t1ordinary (form) - (let ((*compile-toplevel* nil)) + (when *compile-time-too* (cmp-eval form)) + (let ((*compile-toplevel* nil) + (*compile-time-too* nil)) (add-load-time-values (make-c1form* 'ORDINARY :args (c1expr form))))) (defun p1ordinary (c1form assumptions form) @@ -751,7 +752,10 @@ ;;; (defun t1fset (args) (let ((form `(si::fset ,@args))) - (let ((*compile-toplevel* nil)) + (when *compile-time-too* + (cmp-eval form)) + (let ((*compile-toplevel* nil) + (*compile-time-too* nil)) (add-load-time-values (c1fset form))))) (defun c1fset (form)