diff --git a/src/cmp/cmpbackend-cxx/cmppass2-fun.lsp b/src/cmp/cmpbackend-cxx/cmppass2-fun.lsp index 322136b4e..3e467a7d8 100644 --- a/src/cmp/cmpbackend-cxx/cmppass2-fun.lsp +++ b/src/cmp/cmpbackend-cxx/cmppass2-fun.lsp @@ -55,6 +55,24 @@ (c2expr body) (close-inline-blocks)) +;;; Mechanism for sharing code. +(defun new-local (fun) + (declare (type fun fun)) + (case (fun-closure fun) + (CLOSURE + (setf (fun-level fun) 0 + (fun-env fun) *env*)) + (LEXICAL + ;; Only increase the lexical level if there have been some + ;; new variables created. This way, the same lexical environment + ;; can be propagated through nested FLET/LABELS. + (setf (fun-level fun) (if (plusp *lex*) (1+ *level*) *level*) + (fun-env fun) 0)) + (otherwise + (setf (fun-level fun) 0 + (fun-env fun) 0))) + (push fun *local-funs*)) + #| Steps: 1. defun creates declarations for requireds + va_alist 2. c2lambda-expr adds declarations for: diff --git a/src/cmp/cmpbackend-cxx/cmppass2-special.lsp b/src/cmp/cmpbackend-cxx/cmppass2-special.lsp index 3e794287f..ca3fe95b1 100644 --- a/src/cmp/cmpbackend-cxx/cmppass2-special.lsp +++ b/src/cmp/cmpbackend-cxx/cmppass2-special.lsp @@ -21,20 +21,3 @@ (defun c2function (c1form fname) (declare (ignore c1form)) (unwind-exit `(FDEFINITION ,fname))) - -;;; Mechanism for sharing code. -(defun new-local (fun) - ;; returns the previous function or NIL. - (declare (type fun fun)) - (case (fun-closure fun) - (CLOSURE - (setf (fun-level fun) 0 (fun-env fun) *env*)) - (LEXICAL - ;; Only increase the lexical level if there have been some - ;; new variables created. This way, the same lexical environment - ;; can be propagated through nested FLET/LABELS. - (setf (fun-level fun) (if (plusp *lex*) (1+ *level*) *level*) - (fun-env fun) 0)) - (otherwise - (setf (fun-env fun) 0 (fun-level fun) 0))) - (push fun *local-funs*)) diff --git a/src/cmp/cmpbackend-cxx/cmppass2-top.lsp b/src/cmp/cmpbackend-cxx/cmppass2-top.lsp index a22a9f294..cc70d0eee 100644 --- a/src/cmp/cmpbackend-cxx/cmppass2-top.lsp +++ b/src/cmp/cmpbackend-cxx/cmppass2-top.lsp @@ -484,9 +484,8 @@ (defun c2fset (c1form fun fname macro pprint c1forms) (declare (ignore pprint)) (when (fun-no-entry fun) - (wt-nl "(void)0; /* No entry created for " - (format nil "~A" (fun-name fun)) - " */") + (wt-nl "(void)0; " + (format nil "/* No entry created for ~A */" (fun-name fun))) ;; FIXME! Look at C2LOCALS! (new-local fun) (return-from c2fset)) @@ -499,7 +498,8 @@ (push (list loc fname fun) *global-cfuns-array*) ;; FIXME! Look at C2LOCALS! (new-local fun) - (wt-nl (if macro "ecl_cmp_defmacro(" "ecl_cmp_defun(") - loc ");") + (if macro + (wt-nl "ecl_cmp_defmacro(" loc ");") + (wt-nl "ecl_cmp_defun(" loc ");")) (wt-comment (loc-immediate-value fname)) (close-inline-blocks))) diff --git a/src/cmp/cmppass1-top.lsp b/src/cmp/cmppass1-top.lsp index 6d18e089e..42396f7e4 100644 --- a/src/cmp/cmppass1-top.lsp +++ b/src/cmp/cmppass1-top.lsp @@ -131,7 +131,8 @@ ;; When using COMPILE, we set *load-time-values* to 'VALUES and ;; thus signal that we do not want to compile these forms, but ;; just to retain their value. - (return-from c1load-time-value (c1constant-value (cmp-eval form) :always t))) + (return-from c1load-time-value + (c1constant-value (cmp-eval form) :always t))) ((typep form '(or list symbol)) (setf loc (data-empty-loc)) (push (make-c1form* 'LOAD-TIME-VALUE :args loc (c1expr form))