Skip to content
Snippets Groups Projects
Commit e940c9ea authored by wlott's avatar wlott
Browse files

Generalized the static-mumble-offset routines to also consider nil a

static symbol at offset 0.
parent f5cef96c
No related branches found
No related tags found
No related merge requests found
...@@ -7,12 +7,10 @@ ...@@ -7,12 +7,10 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/utils.lisp,v 1.3 1992/03/12 15:25:02 wlott Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/utils.lisp,v 1.4 1992/07/13 01:45:12 wlott Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/utils.lisp,v 1.3 1992/03/12 15:25:02 wlott Exp $
;;;
;;; Utility functions needed by the back end to generate code. ;;; Utility functions needed by the back end to generate code.
;;; ;;;
;;; Written by William Lott. ;;; Written by William Lott.
...@@ -38,27 +36,32 @@ ...@@ -38,27 +36,32 @@
;;;; Routines for dealing with static symbols. ;;;; Routines for dealing with static symbols.
(defun static-symbol-p (symbol) (defun static-symbol-p (symbol)
(member symbol static-symbols)) (or (null symbol)
(and (member symbol static-symbols) t)))
(defun static-symbol-offset (symbol) (defun static-symbol-offset (symbol)
"Returns the byte offset of the static symbol Symbol." "Returns the byte offset of the static symbol Symbol."
(let ((posn (position symbol static-symbols))) (if symbol
(unless posn (error "~S is not a static symbol." symbol)) (let ((posn (position symbol static-symbols)))
(+ (* posn (pad-data-block symbol-size)) (unless posn (error "~S is not a static symbol." symbol))
(pad-data-block (1- symbol-size)) (+ (* posn (pad-data-block symbol-size))
other-pointer-type (pad-data-block (1- symbol-size))
(- list-pointer-type)))) other-pointer-type
(- list-pointer-type)))
0))
(defun offset-static-symbol (offset) (defun offset-static-symbol (offset)
"Given a byte offset, Offset, returns the appropriate static symbol." "Given a byte offset, Offset, returns the appropriate static symbol."
(multiple-value-bind (if (zerop offset)
(n rem) nil
(truncate (+ offset list-pointer-type (- other-pointer-type) (multiple-value-bind
(- (pad-data-block (1- symbol-size)))) (n rem)
(pad-data-block symbol-size)) (truncate (+ offset list-pointer-type (- other-pointer-type)
(unless (and (zerop rem) (<= 0 n (1- (length static-symbols)))) (- (pad-data-block (1- symbol-size))))
(error "Byte offset, ~D, is not correct." offset)) (pad-data-block symbol-size))
(elt static-symbols n))) (unless (and (zerop rem) (<= 0 n (1- (length static-symbols))))
(error "Byte offset, ~D, is not correct." offset))
(elt static-symbols n))))
(defun static-function-offset (name) (defun static-function-offset (name)
"Return the (byte) offset from NIL to the start of the fdefn object "Return the (byte) offset from NIL to the start of the fdefn object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment