Unify compilation environment markers

In both bytecmp and c compiler we use si:function-boundary and
si:unwind-protect-boundary where appropriate. Previously bytecmp used an ad-hoc
special variable for function-boundary and didn't mark unwind-protect at all.

Remove recently-introduced ECI package (maybe we will reintroduce it later when
we'll have a common frontend for compilers).
This commit is contained in:
Daniel Kochmanski 2018-02-15 12:44:49 +01:00
parent c94784ac77
commit e92cfdf437
10 changed files with 45 additions and 33 deletions

View file

@ -19,10 +19,10 @@
;;; A dummy variable is created to hold the block identifier. When a reference
;;; to the block (via `return-from') is found, the `var-ref' count for that
;;; variable is incremented only if the reference appears across a boundary
;;; (`ECI:FUNCTION' or `ECI:UNWIND-PROTECT'), while the `blk-ref' is always
;;; incremented. Therefore `blk-ref' represents whether the block is used at
;;; all and `var-ref' for the dummy variable represents whether a block
;;; identifier must be created and stored in such variable.
;;; (`SI:FUNCTION-BOUNDARY' or `SI:UNWIND-PROTECT-BOUNDARY'), while the
;;; `blk-ref' is always incremented. Therefore `blk-ref' represents whether the
;;; block is used at all and `var-ref' for the dummy variable represents whether
;;; a block identifier must be created and stored in such variable.
(defun c1block (args)
(check-args-number 'BLOCK args 1)

View file

@ -59,7 +59,7 @@
(c1expr (first args)))
(T
(incf *setjmps*)
(let ((form (let ((*cmp-env* (cmp-env-mark 'ECI:UNWIND-PROTECT)))
(let ((form (let ((*cmp-env* (cmp-env-mark 'SI:UNWIND-PROTECT-BOUNDARY)))
(c1expr (first args)))))
(make-c1form* 'UNWIND-PROTECT :type (c1form-type form) :sp-change t
:args form (c1progn (rest args)))))))

View file

@ -121,9 +121,9 @@ that are susceptible to be changed by PROCLAIM."
(unw nil)
(found nil))
(dolist (record (cmp-env-functions env))
(cond ((eq record 'ECI:FUNCTION)
(cond ((eq record 'SI:FUNCTION-BOUNDARY)
(setf cfb t))
((eq record 'ECI:UNWIND-PROTECT)
((eq record 'SI:UNWIND-PROTECT-BOUNDARY)
(setf unw t))
((atom record)
(baboon :format-control "Uknown record found in environment~%~S"
@ -139,9 +139,9 @@ that are susceptible to be changed by PROCLAIM."
(unw nil)
(found nil))
(dolist (record (cmp-env-variables env))
(cond ((eq record 'ECI:FUNCTION)
(cond ((eq record 'SI:FUNCTION-BOUNDARY)
(setf cfb t))
((eq record 'ECI:UNWIND-PROTECT)
((eq record 'SI:UNWIND-PROTECT-BOUNDARY)
(setf unw t))
((atom record)
(baboon :format-control "Uknown record found in environment~%~S"

View file

@ -165,21 +165,21 @@ variable-record = (:block block-name) |
(:function function-name) |
(var-name {:special | nil} bound-p) |
(symbol si::symbol-macro macro-function) |
ECI:FUNCTION |
ECI:UNWIND-PROTECT
SI:FUNCTION-BOUNDARY |
SI:UNWIND-PROTECT-BOUNDARY
macro-record = (function-name function) |
(macro-name si::macro macro-function)
ECI:FUNCTION |
ECI:UNWIND-PROTECT
SI:FUNCTION-BOUNDARY |
SI:UNWIND-PROTECT-BOUNDARY
A *-NAME is a symbol. A TAG-ID is either a symbol or a number. A MACRO-FUNCTION
is a function that provides us with the expansion for that local macro or symbol
macro. BOUND-P is true when the variable has been bound by an enclosing form,
while it is NIL if the variable-record corresponds just to a special
declaration. ECI:FUNCTION and ECI:UNWIND-PROTECT are only used by the C
compiler and they denote function and unwind-protect boundaries. Note that
compared with the bytecodes compiler, these records contain an additional
declaration. SI:FUNCTION-BOUNDARY and SI:UNWIND-PROTECT-BOUNDARY are only used
by the C compiler and they denote function and unwind-protect boundaries. Note
that compared with the bytecodes compiler, these records contain an additional
variable, block, tag or function object at the end.")
(defvar *cmp-env-root*

View file

@ -108,7 +108,7 @@ The function thus belongs to the type of functions that ecl_make_cfun accepts."
(when *current-function*
(push fun (fun-child-funs *current-function*)))
(let* ((*current-function* fun)
(*cmp-env* (setf (fun-cmp-env fun) (cmp-env-mark 'ECI:FUNCTION)))
(*cmp-env* (setf (fun-cmp-env fun) (cmp-env-mark 'SI:FUNCTION-BOUNDARY)))
(setjmps *setjmps*)
(decl (si::process-declarations (rest lambda-list-and-body)))
(global (and *use-c-global*

View file

@ -14,10 +14,6 @@
;;;; CMPPACKAGE -- Package definitions and exported symbols
;;;;
(defpackage #:ecl-cmp-internals
(:export #:unwind-protect
#:function))
(defpackage "C"
(:nicknames "COMPILER")
(:use "FFI" "EXT" #+threads "MP" "CL")
@ -54,4 +50,3 @@
"COMPILER-LET"))
(ext:package-lock "CL" nil)
(ext:add-package-local-nickname "ECI" '#:ecl-cmp-internals '#:compiler)