Changeset 13873


Ignore:
Timestamp:
Jun 23, 2010, 10:04:02 PM (9 years ago)
Author:
gb
Message:

Define and export OBJECT-DIRECT-SIZE, which is basically the SIZEOF
function from openmcl-devel a few months ago.

Location:
trunk/source/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/ccl-export-syms.lisp

    r13556 r13873  
    727727     *vector-output-stream-default-initial-allocation*   
    728728     external-process-creation-failure
     729     object-direct-size
    729730
    730731     ) "CCL"
  • trunk/source/lib/misc.lisp

    r13658 r13873  
    12171217  (values))
    12181218
    1219 
     1219(defun object-direct-size (thing)
     1220  "Returns the size of THING (in bytes), including any headers and
     1221   alignment overhead.  Does not descend an object's components."
     1222  (cond ((consp thing) #+64-bit-target 16 #+32-bit-target 8)
     1223        #+x8664-target ((symbolp thing)
     1224                        (object-direct-size (%symptr->symvector thing)))
     1225        #+x8664-target ((functionp thing)
     1226                        (object-direct-size (function-to-function-vector thing)))
     1227        ((uvectorp thing)
     1228         (let* ((typecode (ccl::typecode thing))
     1229                (element-count (ccl::uvsize thing))
     1230                (sizeof-content-in-octets
     1231                 ;; Call the architecture-specific backend function.
     1232                 (funcall (arch::target-array-data-size-function
     1233                           (backend-target-arch *host-backend*))
     1234                          typecode element-count)))
     1235           (logandc2 (+ sizeof-content-in-octets
     1236                           #+64-bit-target (+ 8 15)
     1237                           #+32-bit-target (+ 4 7))
     1238                     #+64-bit-target 15
     1239                     #+32-bit-target 7)))
     1240        (t 0)))
    12201241
    12211242(defun static-cons (car-value cdr-value)
Note: See TracChangeset for help on using the changeset viewer.