On Fri, May 11, 2018 at 9:47 PM, Waldek Hebisch
<[email protected]> wrote:
> oldk1331 wrote:
>>
>> On Fri, Mar 9, 2018 at 9:46 PM, Waldek Hebisch <[email protected]> 
>> wrote:
>> > Now all things planned for this release are commited.  There
>> > is now time for testing.  Qian says that 'sbcl_make_sized_vector'
>> > is buggy -- I will look into this.
>>
>> Any update on 'sbcl_make_sized_vector'?
>
> Earlier:
>
>> It is a bug to have "`(ceiling (* ,n ,n-bits) sb-vm:n-word-bits)"
>> in 'sbcl_make_sized_vector', we should fix it to
>> "`(ceiling (* ,n ,nb) sb-vm:n-word-bits)".
>
> The difference between 'n-bits' and 'nb' is that we want 'nb'
> but 'n-bits' is what sbcl thinks that we should use.  It
> is safer to use value that sbcl wants to have.  So no
> bug.

What does this mean? Can you elaborate it?

I think there is still a bug in 'sbcl_make_sized_vector':

(6) -> )lisp (sbcl_make_sized_vector 32 5)

Value = #(0 0 0 0 229)

The vector is not initialized to 0.

> BTW: The code was changed to current form because simpler
> version did not work.  I do not remember if I tested
> 'nb' but first formula that I tried did not work, so
> I changed computation to exactly match what sbcl was
> doing.

My patch posted on March 8 works and is much simpler.
But it depends on ALLOCATE-VECTOR-WITH-WIDETAG.

--- a/src/lisp/primitives.lisp
+++ b/src/lisp/primitives.lisp
@@ -101,22 +101,14 @@

 #+:sbcl
 (defmacro sbcl_make_sized_vector(nb n)
-    (let ((get-tag (find-symbol "%VECTOR-WIDETAG-AND-N-BITS" "SB-IMPL"))
-          (length-sym nil))
+    (let ((get-tag (find-symbol "%VECTOR-WIDETAG-AND-N-BITS" "SB-IMPL")))
         (if (null get-tag)
-            (progn
-                (setf get-tag
-                    (find-symbol "%VECTOR-WIDETAG-AND-N-BITS-SHIFT"
-                                 "SB-IMPL"))
-                (setf length-sym (find-symbol "VECTOR-LENGTH-IN-WORDS"
-                                              "SB-IMPL"))))
+            (setf get-tag
+                (find-symbol "%VECTOR-WIDETAG-AND-N-BITS-SHIFT"
+                             "SB-IMPL")))
         (multiple-value-bind (typetag n-bits)
             (FUNCALL get-tag `(unsigned-byte ,nb))
-            (let ((length-form
-                   (if length-sym
-                       `(,length-sym ,n ,n-bits)
-                       `(ceiling (* ,n ,n-bits) sb-vm:n-word-bits))))
-                `(SB-KERNEL:ALLOCATE-VECTOR ,typetag ,n ,length-form)))))
+            `(SB-IMPL::ALLOCATE-VECTOR-WITH-WIDETAG ,typetag ,n ,n-bits))))

 (defmacro DEF_SIZED_UOPS(nb)

>> Also I think it is better to use ALLOCATE-VECTOR-WITH-WIDETAG
>> than ALLOCATE-VECTOR.
>
> We can not use ALLOCATE-VECTOR-WITH-WIDETAG because it is not
> present in earlier versions of sbcl.
>
> --
>                               Waldek Hebisch

ALLOCATE-VECTOR-WITH-WIDETAG is introduced in
2012-12-19 and in sbcl-1.1.3.

Our binary is built by sbcl-1.1.1, can we consider to version
bump sbcl to 1.1.3?

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to