diff --git a/doc/internals-notes/metaspace b/doc/internals-notes/metaspace index 8e22c3473..e78e6645b 100644 --- a/doc/internals-notes/metaspace +++ b/doc/internals-notes/metaspace @@ -105,7 +105,7 @@ that will need to be changed to wrappers: ('x' indicates completed) [x] CLASSOID-LAYOUT [x] *FORWARD-REFERENCED-LAYOUTS* [ ] elements of a LAYOUT-INHERITS vector -[ ] values in the CLASSOID-SUBCLASSES hash-table +[x] values in the CLASSOID-SUBCLASSES hash-table [ ] the FASL loader table and stack [ ] everything in the CLOS implementation diff --git a/make-target-2-load.lisp b/make-target-2-load.lisp index f3d33e186..59e951dac 100644 --- a/make-target-2-load.lisp +++ b/make-target-2-load.lisp @@ -70,6 +70,7 @@ :PACKAGE-LOCAL-NICKNAMES ;; Developer mode features. A release build will never have them, ;; hence it makes no difference whether they're public or not. + :METASPACE :SB-FLUID :SB-DEVEL :SB-DEVEL-LOCK-PACKAGES)"))) (removable-features (append non-target-features public-features))) @@ -132,9 +133,9 @@ ;; can't be uninterned if referenced by a defstruct-description. ;; So loop over all structure classoids and clobber any ;; symbol that should be uninternable. - (maphash (lambda (classoid layout) + (maphash (lambda (classoid wrapper) (when (structure-classoid-p classoid) - (let ((dd (layout-info layout))) + (let ((dd (wrapper-%info wrapper))) (setf (dd-constructors dd) (delete-if (lambda (x) (and (consp x) (uninternable-p (car x)))) diff --git a/src/code/class.lisp b/src/code/class.lisp index ad9390784..27d20edd8 100644 --- a/src/code/class.lisp +++ b/src/code/class.lisp @@ -64,6 +64,10 @@ #-sb-xc-host (when *print-layout-id* (layout-id layout)) (layout-proper-name layout) (layout-invalid layout)))) +#+(and metaspace (not sb-xc-host)) +(defmethod print-object ((wrapper wrapper) stream) + (print-unreadable-object (wrapper stream :type t :identity t) + (write (wrapper-friend wrapper) :stream stream))) (eval-when (#-sb-xc :compile-toplevel :load-toplevel :execute) (defun layout-proper-name (layout) @@ -265,10 +269,10 @@ between the ~A definition and the ~A definition" (when classoid-layout (%modify-classoid classoid) (when subclasses - (dohash ((subclass subclass-layout) subclasses :locked t) + (dohash ((subclass subclass-wrapper) subclasses :locked t) (%modify-classoid subclass) (when invalidate - (%invalidate-layout subclass-layout)))) + (%invalidate-layout (wrapper-friend subclass-wrapper))))) (when invalidate (%invalidate-layout classoid-layout) (setf (classoid-subclasses classoid) nil))) @@ -331,7 +335,7 @@ between the ~A definition and the ~A definition" (classoid-name super)) (setf (classoid-state super) :read-only)) (setf (gethash classoid subclasses) - (or destruct-layout layout)))))) + (layout-friend (or destruct-layout layout))))))) (values))) @@ -724,8 +728,8 @@ between the ~A definition and the ~A definition" (o-sub (classoid-subclasses other))) (if (and s-sub o-sub) (collect ((res *empty-type* type-union)) - (dohash ((subclass layout) s-sub :locked t) - (declare (ignore layout)) + (dohash ((subclass wrapper) s-sub :locked t) + (declare (ignore wrapper)) (when (gethash subclass o-sub) (res (specifier-type subclass)))) (res)) diff --git a/src/code/defstruct.lisp b/src/code/defstruct.lisp index b83e5253d..fda57e527 100644 --- a/src/code/defstruct.lisp +++ b/src/code/defstruct.lisp @@ -1272,10 +1272,10 @@ unless :NAMED is also specified."))) (let ((subclasses (classoid-subclasses classoid))) (when subclasses (collect ((subs)) - (dohash ((classoid layout) + (dohash ((classoid wrapper) subclasses :locked t) - (declare (ignore layout)) + (declare (ignore wrapper)) (undeclare-structure classoid nil) (subs (classoid-proper-name classoid))) ;; Is it really necessary to warn about diff --git a/src/code/early-classoid.lisp b/src/code/early-classoid.lisp index fdd06b036..14f7dcc0f 100644 --- a/src/code/early-classoid.lisp +++ b/src/code/early-classoid.lisp @@ -706,9 +706,9 @@ #-sb-xc-host (defun id-to-layout (id) - (maphash (lambda (k v) - (declare (ignore k)) - (when (eql (layout-id v) id) (return-from id-to-layout v))) + (maphash (lambda (classoid wrapper &aux (layout (wrapper-friend wrapper))) + (declare (ignore classoid)) + (when (eql (layout-id layout) id) (return-from id-to-layout layout))) (classoid-subclasses (find-classoid 't)))) (export 'id-to-layout) diff --git a/src/code/macros.lisp b/src/code/macros.lisp index 5fa771765..7f824c774 100644 --- a/src/code/macros.lisp +++ b/src/code/macros.lisp @@ -963,8 +963,8 @@ symbol-case giving up: case=((V U) (F)) (let ((classoid (pop worklist))) (visited classoid) (awhen (classoid-subclasses classoid) - (dohash ((classoid layout) it) - (declare (ignore layout)) + (dohash ((classoid wrapper) it) + (declare (ignore wrapper)) (unless (or (member classoid (visited)) (member classoid worklist)) (setf worklist (nconc worklist (list classoid)))))))) diff --git a/src/compiler/proclaim.lisp b/src/compiler/proclaim.lisp index d79609f25..65eedde9f 100644 --- a/src/compiler/proclaim.lisp +++ b/src/compiler/proclaim.lisp @@ -247,8 +247,8 @@ (setf (classoid-state class) :sealed) (let ((subclasses (classoid-subclasses class))) (when subclasses - (dohash ((subclass layout) subclasses :locked t) - (declare (ignore layout)) + (dohash ((subclass wrapper) subclasses :locked t) + (declare (ignore wrapper)) (setf (classoid-state subclass) :sealed))))) (defun process-freeze-type-declaration (type-specifier) diff --git a/src/pcl/defs.lisp b/src/pcl/defs.lisp index aa0aacf29..629d7c480 100644 --- a/src/pcl/defs.lisp +++ b/src/pcl/defs.lisp @@ -195,8 +195,8 @@ (let ((subs (classoid-subclasses class))) (/noshow subs) (when subs - (dohash ((sub v) subs) - (declare (ignore v)) + (dohash ((sub wrapper) subs) + (declare (ignore wrapper)) (/noshow sub) (when (member class (direct-supers sub) :test #'eq) (res sub))))) diff --git a/src/pcl/fixup.lisp b/src/pcl/fixup.lisp index 13f1c5748..b23f283f0 100644 --- a/src/pcl/fixup.lisp +++ b/src/pcl/fixup.lisp @@ -60,8 +60,8 @@ (compute-standard-slot-locations) (dolist (s '(condition function structure-object)) - (dohash ((k v) (classoid-subclasses (find-classoid s))) - (declare (ignore v)) + (dohash ((k wrapper) (classoid-subclasses (find-classoid s))) + (declare (ignore wrapper)) (find-class (classoid-name k)))) (setq **boot-state** 'complete) diff --git a/src/pcl/std-class.lisp b/src/pcl/std-class.lisp index 26ee1a896..ec00d9853 100644 --- a/src/pcl/std-class.lisp +++ b/src/pcl/std-class.lisp @@ -185,7 +185,7 @@ (make-hash-table :hash-function #'type-hash-value :test 'eq :synchronized t))))) - (setf (gethash classoid subclasses) layout))))))) + (setf (gethash classoid subclasses) (sb-kernel::layout-friend layout)))))))) subclass)) (defmethod remove-direct-subclass ((class class) (subclass class)) (with-slots (direct-subclasses) class diff --git a/tests/condition.pure.lisp b/tests/condition.pure.lisp index c29149d4f..e28675f5d 100644 --- a/tests/condition.pure.lisp +++ b/tests/condition.pure.lisp @@ -423,10 +423,12 @@ is not of type ;;; Instances of LAYOUT for condition classoids created by genesis ;;; should resemble ones created normally. Due to a bug, they did not. +;;; (The LENGTH slot had the wrong value) (with-test (:name :condition-layout-lengths) - (loop for layout being each hash-value of (sb-kernel:classoid-subclasses - (sb-kernel:find-classoid 'condition)) - for len = (sb-kernel:layout-length layout) + (loop for wrapper being each hash-value of (sb-kernel:classoid-subclasses + (sb-kernel:find-classoid 'condition)) + for len = (sb-kernel:layout-length + (#+metaspace sb-kernel::wrapper-friend #-metaspace progn wrapper)) minimize len into min maximize len into max finally (assert (= min max)))) diff --git a/tests/type.pure.lisp b/tests/type.pure.lisp index 3ab365bb4..6053895f1 100644 --- a/tests/type.pure.lisp +++ b/tests/type.pure.lisp @@ -16,10 +16,12 @@ (mapc #'try '(typexpand-1 typexpand typexpand-all)))) (with-test (:name :stream-layout-bits) - (loop for layout being each hash-value + (loop for wrapper being each hash-value of (sb-kernel:classoid-subclasses (sb-kernel:find-classoid 't)) do (flet ((check-bit (bit ancestor-type) - (let ((ancestor (sb-kernel:find-layout ancestor-type))) + (let* ((layout #+metaspace (sb-kernel::wrapper-friend wrapper) + #-metaspace wrapper) + (ancestor (sb-kernel:find-layout ancestor-type))) (when (or (eq layout ancestor) (find ancestor (sb-kernel:layout-inherits layout))) (assert (logtest bit (sb-kernel:layout-flags layout)))))))