Dumper/loader can avoid building primordial layouts bottom up.

This commit is contained in:
Douglas Katzman 2015-02-12 21:49:40 -05:00
parent 98ec9458e5
commit 4dcf6674c5
3 changed files with 37 additions and 1 deletions

View file

@ -62,7 +62,9 @@ echo //checking for leftover cold-init symbols
(sb-vm::map-allocated-objects
(lambda (obj type size)
(declare (ignore type size))
(when (and (symbolp obj) (search "!" (string obj)))
(when (and (symbolp obj)
(search "!" (string obj))
(not (symbol-package obj)))
(push obj l)))
:dynamic)
(format t "Found ~D:~%" (1- (length l)))

View file

@ -706,3 +706,30 @@ a bug.~@:>")
(when (eql *skip-until* label)
(setf *skip-until* nil))
(values))
;;; Primordial layouts.
;;; At the rate the opcode space is filling up, it might be wise to
;;; rethink using 16 each for FOP-CODE and -SYMBOL-IN-PACKAGE-SAVE.
(macrolet ((frob (&rest specs)
`(progn
(defun known-layout-fop (name)
(case name
,@(mapcar (lambda (spec) `((,(cadr spec)) ,(car spec)))
specs)))
,@(mapcar (lambda (spec)
`(!define-fop ,(car spec)
(,(symbolicate "FOP-LAYOUT-OF-"
(cadr spec)))
(find-layout ',(cadr spec))))
specs))))
(frob (#x6c t)
(#x6d structure-object)
(#x6e structure!object)
(#x6f definition-source-location)
(#x70 sb!c::debug-fun)
(#x71 sb!c::compiled-debug-fun)
(#x72 sb!c::debug-info)
(#x73 sb!c::compiled-debug-info)
(#x74 sb!c::debug-source)
(#x75 defstruct-description)
(#x76 defstruct-slot-description)))

View file

@ -1323,6 +1323,13 @@
;; Q: Shouldn't we aver that NAME is the proper name for its classoid?
(unless name
(compiler-error "dumping anonymous layout: ~S" obj))
;; The target lisp can save some space in fasls (sometimes),
;; but the cross-compiler can't because we need to construct the
;; cold representation of all layouts, not reference host layouts.
#-sb-xc-host
(let ((fop (known-layout-fop name)))
(when fop
(return-from dump-layout (dump-byte fop file))))
(dump-object name file))
(sub-dump-object (layout-inherits obj) file)
(sub-dump-object (layout-depthoid obj) file)