cmp: change handling of *cmp-env-root*

Due to the recent introduction of cross compilation features,
*cmp-env* has to contain type information throughout the entire
compilation (not only while we are compiling a form) so that (typep x
type *cmp-env*) works correctly. Therefore, we can't set *cmp-env* to
nil initially as we did previously. Instead, we set *cmp-env*
to *cmp-env-root* initially.
This commit is contained in:
Marius Gerbershagen 2025-10-25 15:44:45 +02:00
parent 79d33bdd83
commit c5f6cd0246
4 changed files with 5 additions and 7 deletions

View file

@ -231,7 +231,7 @@ be deleted if they have been opened with LoadLibrary.")
(*callbacks* nil) (*callbacks* nil)
(*functions* nil) (*functions* nil)
(*cmp-env-root* (copy-tree *cmp-env-root*)) (*cmp-env-root* (copy-tree *cmp-env-root*))
(*cmp-env* nil) (*cmp-env* *cmp-env-root*)
(*load-objects* (make-hash-table :size 128 :test #'equal)) (*load-objects* (make-hash-table :size 128 :test #'equal))
(*make-forms* nil) (*make-forms* nil)
(*referenced-objects* (make-array 256 :adjustable t :fill-pointer 0)) (*referenced-objects* (make-array 256 :adjustable t :fill-pointer 0))

View file

@ -214,7 +214,7 @@ after compilation."
(*cmp-env-root* *cmp-env-root*)) (*cmp-env-root* *cmp-env-root*))
(with-compiler-env (compiler-conditions) (with-compiler-env (compiler-conditions)
(setf form (set-closure-env form lexenv *cmp-env-root*)) (setf form (set-closure-env form lexenv *cmp-env*))
(compiler-pass1 form) (compiler-pass1 form)
(compiler-pass/propagate-types) (compiler-pass/propagate-types)
(let (#+(or mingw32 msvc cygwin)(*self-destructing-fasl* t)) (let (#+(or mingw32 msvc cygwin)(*self-destructing-fasl* t))
@ -297,7 +297,7 @@ from the C language code. NIL means \"do not create the file\"."
(*cmp-env-root* *cmp-env-root*)) (*cmp-env-root* *cmp-env-root*))
(with-compiler-env (compiler-conditions) (with-compiler-env (compiler-conditions)
(with-cxx-env () (with-cxx-env ()
(setf disassembled-form (set-closure-env disassembled-form lexenv *cmp-env-root*)) (setf disassembled-form (set-closure-env disassembled-form lexenv *cmp-env*))
(unwind-protect (unwind-protect
(progn (progn
(setf (symbol-function 'T3FUNCTION) (setf (symbol-function 'T3FUNCTION)

View file

@ -11,9 +11,7 @@
(defun t1expr (form) (defun t1expr (form)
(let* ((*current-toplevel-form* nil) (let* ((*current-toplevel-form* nil)
(*cmp-env* (if *cmp-env* (*cmp-env* (cmp-env-copy *cmp-env*)))
(cmp-env-copy *cmp-env*)
(cmp-env-root))))
(push (t1expr* form) *top-level-forms*))) (push (t1expr* form) *top-level-forms*)))
(defvar *toplevel-forms-to-print* (defvar *toplevel-forms-to-print*

View file

@ -53,7 +53,7 @@
(compiler-error #'handle-compiler-error) (compiler-error #'handle-compiler-error)
(serious-condition #'handle-compiler-internal-error)) (serious-condition #'handle-compiler-internal-error))
(mp:with-lock (mp:+load-compile-lock+) (mp:with-lock (mp:+load-compile-lock+)
(let ,+init-env-form+ (let* ,+init-env-form+
(with-compilation-unit () (with-compilation-unit ()
,@body)))) ,@body))))
(abort ())) (abort ()))