<div dir="ltr"><div>thanks Marc!</div><div><br></div><div>-- vyzo<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 15, 2019 at 1:16 PM Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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:<br>
<br>
<br>
;; this code is specific to the C backend<br>
<br>
(define (make-u8vector-still len)<br>
(let ((result<br>
((c-lambda<br>
(unsigned-int)<br>
scheme-object<br>
"___SCMOBJ result = ___EXT(___alloc_scmobj) (___ps, ___sU8VECTOR, ___arg1);<br>
if (!___FIXNUMP(result))<br>
___still_obj_refcount_dec (result);<br>
___return(result);<br>
")<br>
len)))<br>
(if (##fixnum? result)<br>
(begin<br>
(##raise-heap-overflow-exception)<br>
(make-u8vector-still len))<br>
result)))<br>
<br>
(define still?<br>
(c-lambda<br>
(scheme-object)<br>
bool<br>
"___return(___HD_TYP(___HEADER(___arg1)) == ___STILL);"))<br>
<br>
<br>
(pp (still? (make-u8vector 1000))) ;; #f (small objects are movable)<br>
<br>
(pp (still? (make-u8vector 3000))) ;; #t (large objects are still)<br>
<br>
(pp (still? (##still-copy (make-u8vector 10)))) ;; #t (make a still copy)<br>
<br>
(pp (still? (make-u8vector-still 10))) ;; #t (allocated as still even if small)<br>
<br>
<br>
Marc<br>
<br>
<br>
<br>
> On Nov 15, 2019, at 3:39 AM, Dimitris Vyzovitis <<a href="mailto:vyzo@hackzen.org" target="_blank">vyzo@hackzen.org</a>> wrote:<br>
> <br>
> What's the magic incantation to allocate a still u8vector? <br>
> I can't seem to find any primitive procedure (in scheme or in C) for this.<br>
> <br>
> -- vyzo<br>
> _______________________________________________<br>
> Gambit-list mailing list<br>
> <a href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">Gambit-list@iro.umontreal.ca</a><br>
> <a href="https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list</a><br>
<br>
<br>
</blockquote></div>