[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-devel
Subject:    Re: [Sbcl-devel] [Sbcl-bugs] "SB-KERNEL:ALLOCATE-VECTOR" is not defined after sbcl-2.1.5
From:       Christophe Rhodes <csr21 () cantab ! net>
Date:       2022-06-17 17:32:41
Message-ID: 87bkurdwli.fsf () shin
[Download RAW message or body]

Qian Yun <oldk1331@gmail.com> writes:

> Our usage starts at line 121 of
> https://github.com/fricas/fricas/blob/master/src/lisp/primitives.lisp
>
> The complicated usage of "find-symbol" is to be backward compatible
> with as much as sbcl old versions as possible.
>
> So the use case here is to stuff 8/16/32-bit integer into
> vectors to take less space:
>
> (defmacro sbcl_make_sized_vector(nb b_spec n)
>     (let ((get-tag (find-symbol "%VECTOR-WIDETAG-AND-N-BITS" "SB-IMPL"))
>           (length-sym nil))
>         (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"))))
>         (multiple-value-bind (typetag n-bits)
>             (FUNCALL get-tag `(,b_spec ,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)))))

In what way is this different from just

(defmacro sbcl_make_sized_vector (nb b_spec n)
  `(make-array ,n :element-type '(,b_spec ,nb)))

Christophe


_______________________________________________
Sbcl-devel mailing list
Sbcl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic