#!-sb-fluid (declaim (inline read-byte))
+;;; FIXME: why do all of these reading functions and macros declare
+;;; (SPEED 0)? was there some bug in the compiler which has since
+;;; been fixed? --njf, 2004-09-08
+
;;; This expands into code to read an N-byte unsigned integer using
;;; FAST-READ-BYTE.
(defmacro fast-read-u-integer (n)
(cnt 1 (1+ cnt)))
((>= cnt n) res))))
-;;; Read an N-byte unsigned integer from the *FASL-INPUT-STREAM*
+;;; Read an N-byte unsigned integer from the *FASL-INPUT-STREAM*.
(defmacro read-arg (n)
(declare (optimize (speed 0)))
(if (= n 1)
(fast-read-u-integer ,n)
(done-with-fast-read-byte)))))
-;;; FIXME: This deserves a more descriptive name, and should probably
-;;; be implemented as an ordinary function, not a macro.
-;;;
-;;; (for the names: There seem to be only two cases, so it could be
-;;; named READ-U-INTEGER-8 and READ-U-INTEGER-32 or something.)
+(declaim (inline read-byte-arg read-halfword-arg read-word-arg))
+(defun read-byte-arg ()
+ (declare (optimize (speed 0)))
+ (read-arg 1))
+
+(defun read-halfword-arg ()
+ (declare (optimize (speed 0)))
+ (read-arg #.(/ sb!vm:n-word-bytes 2)))
+
+(defun read-word-arg ()
+ (declare (optimize (speed 0)))
+ (read-arg #.sb!vm:n-word-bytes))
+
\f
;;;; the fop table
;; Read and validate version-specific compatibility stuff.
(flet ((string-from-stream ()
- (let* ((length (read-arg 4))
+ (let* ((length (read-word-arg))
(result (make-string length)))
(read-string-as-bytes stream result)
result)))
(let* ((implementation (keywordicate (string-from-stream)))
;; FIXME: The logic above to read a keyword from the fasl file
;; could probably be shared with the read-a-keyword fop.
- (version (read-arg 4)))
+ (version (read-word-arg)))
(flet ((check-version (variant
possible-implementation
needed-version)
#!+sb-show
(defvar *show-fops-p* nil)
+;; buffer for loading symbols
+(defvar *fasl-symbol-buffer*)
+(declaim (simple-string *fasl-symbol-buffer*))
+
+;;;
;;; a helper function for LOAD-AS-FASL
;;;
;;; Return true if we successfully load a group from the stream, or
(maybe-announce-load stream verbose)
(sb!thread:with-recursive-lock (sb!c::*big-compiler-lock*)
(let* ((*fasl-input-stream* stream)
+ (*fasl-symbol-buffer* (make-string 100))
(*current-fop-table* (or (pop *free-fop-tables*) (make-array 1000)))
(*current-fop-table-size* (length *current-fop-table*))
(*fop-stack* (make-array 100 :fill-pointer 0 :adjustable t)))
;; that this would go away?
(fill *current-fop-table* nil))))
t)
-
-;;; This is used in in target-load and also genesis, using
-;;; *COLD-FOREIGN-SYMBOL-TABLE*. All the speculative prefix-adding
-;;; code for foreign symbol lookup should be here.
-(defun find-foreign-symbol-in-table (name table)
- (let ((prefixes
- #!+(or osf1 sunos linux freebsd netbsd darwin) #("" "ldso_stub__")
- #!+openbsd #("")))
- (declare (notinline some)) ; to suppress bug 117 bogowarning
- (some (lambda (prefix)
- (gethash (concatenate 'string prefix name)
- table
- nil))
- prefixes)))
\f
;;;; stuff for debugging/tuning by collecting statistics on FOPs (?)