(define-prim (##make-u8vector k #!optional (fill (macro-absent-obj)))
(##declare (not interrupts-enabled))
(let ((v (##c-code #<<end-of-code
long i;
long n = ___INT(___ARG1);
long words = ___WORDS(n) + 1;
___SCMOBJ result;
if (n > ___CAST(___WORD, ___LMASK>>___LF))
result = ___FIX(___HEAP_OVERFLOW_ERR); /* requested object is too big! */
else if (words > ___MSECTION_BIGGEST)
{
___FRAME_STORE_RA(___R0)
___W_ALL
result = ___alloc_scmobj (___sU8VECTOR, n, ___STILL);
___R_ALL
___SET_R0(___FRAME_FETCH_RA)
if (!___FIXNUMP(result))
___still_obj_refcount_dec (result);
}
else
{
___BOOL overflow = 0;
___hp += words;
if (___hp > ___ps->heap_limit)
{
___FRAME_STORE_RA(___R0)
___W_ALL
overflow = ___heap_limit () && ___garbage_collect (0);
___R_ALL
___SET_R0(___FRAME_FETCH_RA)
}
else
___hp -= words;
if (overflow)
result = ___FIX(___HEAP_OVERFLOW_ERR);
else
{
result = ___TAG(___hp, ___tSUBTYPED);
___HEADER(result) = ___MAKE_HD_BYTES(n, ___sU8VECTOR);
___hp += words;
}
}
if (!___FIXNUMP(result) && ___ARG2 != ___ABSENT)
{
for (i=0; i<n; i++)
___U8VECTORSET(result,___FIX(i),___ARG2)
}
___RESULT = result;
end-of-code
k
fill)))
(if (##fixnum? v)
(begin
(##raise-heap-overflow-exception)
(##make-u8vector k fill))
v)))