You can use the C interface to call ___alloc_scmobj with the first argument equal to the processor state, or call ##still-copy to make a still copy of an existing u8vector:
;; this code is specific to the C backend
(define (make-u8vector-still len)
(let ((result
((c-lambda
(unsigned-int)
scheme-object
"___SCMOBJ result = ___EXT(___alloc_scmobj) (___ps, ___sU8VECTOR, ___arg1);
if (!___FIXNUMP(result))
___still_obj_refcount_dec (result);
___return(result);
")
len)))
(if (##fixnum? result)
(begin
(##raise-heap-overflow-exception)
(make-u8vector-still len))
result)))
(define still?
(c-lambda
(scheme-object)
bool
"___return(___HD_TYP(___HEADER(___arg1)) == ___STILL);"))
(pp (still? (make-u8vector 1000))) ;; #f (small objects are movable)
(pp (still? (make-u8vector 3000))) ;; #t (large objects are still)
(pp (still? (##still-copy (make-u8vector 10)))) ;; #t (make a still copy)
(pp (still? (make-u8vector-still 10))) ;; #t (allocated as still even if small)
Marc
> On Nov 15, 2019, at 3:39 AM, Dimitris Vyzovitis <vyzo@hackzen.org> wrote:
>
> What's the magic incantation to allocate a still u8vector?
> I can't seem to find any primitive procedure (in scheme or in C) for this.
>
> -- vyzo
> _______________________________________________
> Gambit-list mailing list
> Gambit-list@iro.umontreal.ca
> https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list