X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Froom.lisp;h=ecd7c012124911458bbec67687664f1e404b4364;hb=fbe6e22af842835f7c70309f4d48064ca3984ad0;hp=db1f7d54bf86b9e4b14087ee110ea65e043e810a;hpb=3358092524adbaecaa483d6510fb3d7031441ccb;p=sbcl.git diff --git a/src/code/room.lisp b/src/code/room.lisp index db1f7d5..ecd7c01 100644 --- a/src/code/room.lisp +++ b/src/code/room.lisp @@ -10,9 +10,6 @@ ;;;; files for more information. (in-package "SB!VM") - -(file-comment - "$Header$") ;;;; type format database @@ -24,7 +21,7 @@ (kind (required-argument) :type (member :lowtag :fixed :header :vector :string :code :closure :instance)) - ;; Length if fixed-length, shift amount for element size if :vector. + ;; Length if fixed-length, shift amount for element size if :VECTOR. (length nil :type (or fixnum null)))) (eval-when (:compile-toplevel :execute) @@ -201,7 +198,7 @@ (* (+ (%instance-length obj) 1) word-bytes)))) (declare (fixnum size)) (funcall fun obj header-type size) - (assert (zerop (logand size lowtag-mask))) + (aver (zerop (logand size lowtag-mask))) #+nil (when (> size 200000) (break "implausible size, prev ~S" prev)) #+nil @@ -212,7 +209,7 @@ (logior (sap-int current) other-pointer-type))) (size (ecase (room-info-kind info) (:fixed - (assert (or (eql (room-info-length info) + (aver (or (eql (room-info-length info) (1+ (get-header-data obj))) (floatp obj))) (round-to-dualword @@ -230,7 +227,7 @@ word-bytes))))))) (declare (fixnum size)) (funcall fun obj header-type size) - (assert (zerop (logand size lowtag-mask))) + (aver (zerop (logand size lowtag-mask))) #+nil (when (> size 200000) (break "Implausible size, prev ~S" prev)) @@ -238,7 +235,7 @@ (setq prev current) (setq current (sap+ current size)))))) (unless (sap< current end) - (assert (sap= current end)) + (aver (sap= current end)) (return))) #+nil @@ -355,16 +352,16 @@ (format t " ~10:D bytes for ~9:D ~(~A~) object~2:*~P (space total.)~%" total-bytes total-objects (car space-total)))) +;;; Print information about the heap memory in use. PRINT-SPACES is a +;;; list of the spaces to print detailed information for. +;;; COUNT-SPACES is a list of the spaces to scan. For either one, T +;;; means all spaces (i.e. :STATIC, :DYNAMIC and :READ-ONLY.) If +;;; PRINT-SUMMARY is true, then summary information will be printed. +;;; The defaults print only summary information for dynamic space. If +;;; true, CUTOFF is a fraction of the usage in a report below which +;;; types will be combined as OTHER. (defun memory-usage (&key print-spaces (count-spaces '(:dynamic)) (print-summary t) cutoff) - #!+sb-doc - "Print out information about the heap memory in use. :Print-Spaces is a list - of the spaces to print detailed information for. :Count-Spaces is a list of - the spaces to scan. For either one, T means all spaces (:Static, :Dyanmic - and :Read-Only.) If :Print-Summary is true, then summary information will be - printed. The defaults print only summary information for dynamic space. - If true, Cutoff is a fraction of the usage in a report below which types will - be combined as OTHER." (declare (type (or single-float null) cutoff)) (let* ((spaces (if (eq count-spaces t) '(:static :dynamic :read-only) @@ -382,9 +379,8 @@ (values)) +;;; Print info about how much code and no-ops there are in SPACE. (defun count-no-ops (space) - #!+sb-doc - "Print info about how much code and no-ops there are in Space." (declare (type spaces space)) (let ((code-words 0) (no-ops 0) @@ -477,12 +473,11 @@ non-descriptor-bytes non-descriptor-headers) (values))) +;;; Print a breakdown by instance type of all the instances allocated +;;; in SPACE. If TOP-N is true, print only information for the the +;;; TOP-N types with largest usage. (defun instance-usage (space &key (top-n 15)) (declare (type spaces space) (type (or fixnum null) top-n)) - #!+sb-doc - "Print a breakdown by instance type of all the instances allocated in - Space. If TOP-N is true, print only information for the the TOP-N types with - largest usage." (format t "~2&~@[Top ~D ~]~(~A~) instance types:~%" top-n space) (let ((totals (make-hash-table :test 'eq)) (total-objects 0) @@ -526,7 +521,7 @@ (let ((residual-objects (- total-objects printed-objects)) (residual-bytes (- total-bytes printed-bytes))) (unless (zerop residual-objects) - (format t " Other types: ~:D bytes, ~D: object~:P.~%" + (format t " Other types: ~:D bytes, ~D object~:P.~%" residual-bytes residual-objects)))) (format t " ~:(~A~) instance total: ~:D bytes, ~:D object~:P.~%" @@ -596,12 +591,15 @@ (return-from print-allocated-objects (values))) (unless count - (let ((this-page (* (the (unsigned-byte 32) - (truncate addr pagesize)) + (let ((this-page (* (the (values (unsigned-byte 32) t) + (truncate addr pagesize)) pagesize))) (declare (type (unsigned-byte 32) this-page)) (when (/= this-page last-page) (when (< pages-so-far pages) + ;; FIXME: What is this? (ERROR "Argh..")? or + ;; a warning? or code that can be removed + ;; once the system is stable? or what? (format stream "~2&**** Page ~D, address ~X:~%" pages-so-far addr)) (setq last-page this-page)