mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-21 03:51:47 -08:00
cmp: cleanup: move the function NEW-LOCAL to cmppass2-fun
This commit is contained in:
parent
e8f3609078
commit
debec42950
4 changed files with 25 additions and 23 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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*))
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue