0.9.1.38:
[sbcl.git] / src / code / fop.lisp
index a981179..6a44362 100644 (file)
   #+sb-xc-host (bug "READ-STRING-AS-WORDS called")
   (dotimes (i length)
     (setf (aref string i)
-         (sb!xc:code-char (logior
-                            (read-byte stream)
-                            (ash (read-byte stream) 8)
-                            (ash (read-byte stream) 16)
-                            (ash (read-byte stream) 24)))))
+         (let ((code 0))
+           ;; FIXME: is this the same as READ-WORD-ARG?
+           (dotimes (k sb!vm:n-word-bytes (sb!xc:code-char code))
+             (setf code (logior code (ash (read-byte stream) 
+                                          (* k sb!vm:n-byte-bits))))))))
   (values))
 \f
 ;;;; miscellaneous fops
   (let* ((size (clone-arg))
         (res (%make-instance size)))
     (declare (type index size))
-    (do ((n (1- size) (1- n)))
-       ((minusp n))
-      (declare (type index-or-minus-1 n))
-      (setf (%instance-ref res n) (pop-stack)))
+    (let* ((layout (pop-stack))
+          (nuntagged (layout-n-untagged-slots layout))
+          (ntagged (- size nuntagged)))
+      (setf (%instance-ref res 0) layout)
+      (dotimes (n (1- ntagged))
+       (declare (type index n))
+       (setf (%instance-ref res (1+ n)) (pop-stack)))
+      (dotimes (n nuntagged)
+       (declare (type index n))
+       (setf (%raw-instance-ref/word res (- nuntagged n 1)) (pop-stack))))
     res))
 
 (define-fop (fop-layout 45)
-  (let ((length (pop-stack))
+  (let ((nuntagged (pop-stack))
+       (length (pop-stack))
        (depthoid (pop-stack))
        (inherits (pop-stack))
        (name (pop-stack)))
-    (find-and-init-or-check-layout name length inherits depthoid)))
+    (find-and-init-or-check-layout name length inherits depthoid nuntagged)))
 
 (define-fop (fop-end-group 64 :stackp nil)
   (/show0 "THROWing FASL-GROUP-END")
@@ -704,7 +711,7 @@ bug.~:@>")
   (let* ((kind (pop-stack))
         (code-object (pop-stack))
         (len (read-byte-arg))
-        (sym (make-string len)))
+        (sym (make-string len :element-type 'base-char)))
     (read-n-bytes *fasl-input-stream* sym 0 len)
     (sb!vm:fixup-code-object code-object
                             (read-word-arg)