mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-16 22:32:05 -08:00
When processing the externalizable data, places for data created with load-forms must not be eliminated.
This commit is contained in:
parent
b20cefe9ab
commit
7d40377ec0
5 changed files with 25 additions and 17 deletions
|
|
@ -168,15 +168,18 @@ static cl_object VV[VM];
|
|||
(unless (or *compiler-constants* (not *use-static-constants-p*))
|
||||
(let ((static-constants 0))
|
||||
(flet ((try-turning-static (record)
|
||||
(destructuring-bind (object (&whole location vv-tag index object-copy)
|
||||
index-copy)
|
||||
(unless (or (null record)
|
||||
(load-form-data-place-p record))
|
||||
(destructuring-bind (object (&whole location vv-tag index object-copy)
|
||||
index-copy)
|
||||
record
|
||||
(let ((builder (static-constant-expression object)))
|
||||
(when builder
|
||||
(let* ((next-index (incf static-constants))
|
||||
(name (format nil "_ecl_static_~D" next-index)))
|
||||
(setf (second location) name)
|
||||
(funcall builder name object stream)
|
||||
(setf record nil)))))
|
||||
(setf record nil))))))
|
||||
record))
|
||||
(map-into *permanent-objects* #'try-turning-static *permanent-objects*)
|
||||
(map-into *temporary-objects* #'try-turning-static *temporary-objects*)))))
|
||||
|
|
@ -191,19 +194,21 @@ static cl_object VV[VM];
|
|||
(defun replace-optimizable-constants ()
|
||||
(let ((found nil))
|
||||
(flet ((try-inlining (record)
|
||||
(destructuring-bind (object (&whole location vv-tag index
|
||||
&optional object-copy)
|
||||
index-copy)
|
||||
record
|
||||
(let* ((x (assoc object +optimizable-constants+))
|
||||
(new-location (cdr x)))
|
||||
(when new-location
|
||||
(setf found t)
|
||||
(format *dump-output* "~&;;; Replacing constant ~A with ~A"
|
||||
(unless (or (null record)
|
||||
(load-form-data-place-p record))
|
||||
(destructuring-bind (object (&whole location vv-tag index
|
||||
&optional object-copy)
|
||||
index-copy)
|
||||
record
|
||||
(let* ((x (assoc object +optimizable-constants+))
|
||||
(new-location (cdr x)))
|
||||
(when new-location
|
||||
(setf found t)
|
||||
(format *dump-output* "~&;;; Replacing constant ~A with ~A"
|
||||
object (second new-location))
|
||||
(setf (second location) (second new-location)
|
||||
(first location) (first new-location)
|
||||
record nil))))
|
||||
(setf (second location) (second new-location)
|
||||
(first location) (first new-location)
|
||||
record nil)))))
|
||||
record))
|
||||
(map-into *permanent-objects* #'try-inlining *permanent-objects*)
|
||||
(map-into *temporary-objects* #'try-inlining *temporary-objects*)
|
||||
|
|
|
|||
|
|
@ -337,7 +337,6 @@
|
|||
(t
|
||||
(when (and (consp object) (eq (first object) 'QUOTE))
|
||||
(setq object (second object)))
|
||||
(error ")
|
||||
(wt (add-object object :permanent t))))))
|
||||
(#\#
|
||||
(let* ((k (read-char s))
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@
|
|||
(defun data-empty-loc ()
|
||||
(add-object 0 :duplicate t :permanent t))
|
||||
|
||||
(defun load-form-data-place-p (data-record)
|
||||
(typep (first data-record) 'fixnum))
|
||||
|
||||
(defun add-load-form (object location)
|
||||
(when (clos::need-to-make-load-form-p object)
|
||||
(if (not (eq *compiler-phase* 't1))
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ lines are inserted, but the order is preserved")
|
|||
;;; where each vv-index should be given an object before
|
||||
;;; defining the current function during loading process.
|
||||
|
||||
(defvar *use-static-constants-p* nil) ; T/NIL flag to determine whether one may
|
||||
(defvar *use-static-constants-p* t) ; T/NIL flag to determine whether one may
|
||||
; generate lisp constant values as C structs
|
||||
|
||||
(defvar *compiler-constants* nil) ; a vector with all constants
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@
|
|||
"DATA-PERMANENT-STORAGE-SIZE" "DATA-TEMPORARY-STORAGE-SIZE"
|
||||
"DATA-SIZE" "DATA-GET-ALL-OBJECTS" "DATA-INIT"
|
||||
"ADD-OBJECT" "ADD-SYMBOL" "ADD-KEYWORDS"
|
||||
"LOAD-FORM-DATA-PLACE-P"
|
||||
|
||||
"*COMPILER-CONSTANTS*"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue