Commit 5cfcd347 authored by Stas Boukarev's avatar Stas Boukarev
Browse files

write-ascii-non-base-string-optimized: Fix offset calculation.

parent ce85ba82
......@@ -49,9 +49,12 @@
(defmethod create-test-object ((type (eql 'string)) &key object-size)
(make-string (or object-size 10000)))
(defmethod create-test-object ((type (eql 'constant-string)) &key)
(defmethod create-test-object ((type (eql 'simple-base-string)) &key)
#.(coerce "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 'simple-base-string))
(defmethod create-test-object ((type (eql 'ascii-string)) &key)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
(defun class-preallocation-test (storage)
(loop for class in (storage-data storage)
for length = (length (objects-of-class class))
......
......@@ -343,10 +343,10 @@
(declare (simple-string string))
(write-n-bytes #.(type-code 'string) 1 stream)
(write-n-bytes (length string) +sequence-length+ stream)
#-(and sb-unicode (or x86 x86-64))
#-(and nil sb-unicode (or x86 x86-64))
(loop for char across string
do (write-n-bytes (char-code char) +char-length+ stream))
#+(and sb-unicode (or x86 x86-64))
#+(and nil sb-unicode (or x86 x86-64))
(write-multibyte-string-optimized string stream))
(defmethod write-object ((string string) stream)
......
......@@ -319,7 +319,8 @@
(setf (output-stream-buffer-position stream)
(output-stream-buffer-end stream))
(flush-buffer stream)
(copy-mem-non-base-string (sb-sys:sap+ string-sap left)
(copy-mem-non-base-string (sb-sys:sap+ string-sap
(* left 4))
(sb-sys:int-sap start) left-length)
(setf (output-stream-buffer-position stream)
(sb-ext:truly-the word (+ start left-length)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment