X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fgeneric%2Futils.lisp;h=b63b3c66bd87eb4c45e680f06456873350bb33e7;hb=f9d6d21a7f54638292214ceb9886edc03b99d545;hp=5df590b467757f58db2668edcc1b8015d2ab54ca;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/compiler/generic/utils.lisp b/src/compiler/generic/utils.lisp index 5df590b..b63b3c6 100644 --- a/src/compiler/generic/utils.lisp +++ b/src/compiler/generic/utils.lisp @@ -11,12 +11,11 @@ (in-package "SB!VM") +;;; Make a fixnum out of NUM. (I.e. shift by two bits if it will fit.) (defun fixnumize (num) - #!+sb-doc - "Make a fixnum out of NUM. (i.e. shift by two bits if it will fit.)" (if (<= #x-20000000 num #x1fffffff) (ash num 2) - (error "~D is too big for a fixnum." num))) + (error "~W is too big for a fixnum." num))) ;;;; routines for dealing with static symbols @@ -24,41 +23,38 @@ (or (null symbol) (and (member symbol *static-symbols*) t))) +;;; the byte offset of the static symbol SYMBOL (defun static-symbol-offset (symbol) - #!+sb-doc - "the byte offset of the static symbol SYMBOL" (if symbol (let ((posn (position symbol *static-symbols*))) (unless posn (error "~S is not a static symbol." symbol)) (+ (* posn (pad-data-block symbol-size)) (pad-data-block (1- symbol-size)) - other-pointer-type - (- list-pointer-type))) + other-pointer-lowtag + (- list-pointer-lowtag))) 0)) +;;; Given a byte offset, OFFSET, return the appropriate static symbol. (defun offset-static-symbol (offset) - #!+sb-doc - "Given a byte offset, OFFSET, return the appropriate static symbol." (if (zerop offset) nil (multiple-value-bind (n rem) - (truncate (+ offset list-pointer-type (- other-pointer-type) + (truncate (+ offset list-pointer-lowtag (- other-pointer-lowtag) (- (pad-data-block (1- symbol-size)))) (pad-data-block symbol-size)) (unless (and (zerop rem) (<= 0 n (1- (length *static-symbols*)))) - (error "The byte offset ~D is not valid." offset)) + (error "The byte offset ~W is not valid." offset)) (elt *static-symbols* n)))) -(defun static-function-offset (name) - #!+sb-doc - "Return the (byte) offset from NIL to the start of the fdefn object - for the static function NAME." +;;; Return the (byte) offset from NIL to the start of the fdefn object +;;; for the static function NAME. +(defun static-fun-offset (name) (let ((static-syms (length *static-symbols*)) - (static-function-index (position name *static-functions*))) - (unless static-function-index + (static-fun-index (position name *static-funs*))) + (unless static-fun-index (error "~S isn't a static function." name)) (+ (* static-syms (pad-data-block symbol-size)) (pad-data-block (1- symbol-size)) - (- list-pointer-type) - (* static-function-index (pad-data-block fdefn-size)) - (* fdefn-raw-addr-slot word-bytes)))) + (- list-pointer-lowtag) + (* static-fun-index (pad-data-block fdefn-size)) + (* fdefn-raw-addr-slot n-word-bytes))))