Skip to content

Commit

Permalink
flambda-backend: Fix caml_alloc_shr_check_gc for tags >= No_scan_tag (#…
Browse files Browse the repository at this point in the history
…2203)

Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com>
  • Loading branch information
mshinwell and xclerc authored Jan 2, 2024
1 parent 0df692c commit ecabd07
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions runtime/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CAMLexport value caml_alloc (mlsize_t wosize, tag_t tag)
value result;
mlsize_t i;

CAMLassert (tag < 256);
CAMLassert (tag < Num_tags);
CAMLassert (tag != Infix_tag);
if (wosize <= Max_young_wosize){
if (wosize == 0){
Expand Down Expand Up @@ -67,10 +67,13 @@ CAMLexport value caml_alloc (mlsize_t wosize, tag_t tag)
#ifdef NATIVE_CODE
CAMLexport value caml_alloc_shr_check_gc (mlsize_t wosize, tag_t tag)
{
CAMLassert(tag < No_scan_tag);
CAMLassert (tag < Num_tags);
CAMLassert (tag != Infix_tag);
caml_check_urgent_gc (Val_unit);
value result = caml_alloc_shr (wosize, tag);
for (mlsize_t i = 0; i < wosize; i++) Field (result, i) = Val_unit;
if (tag < No_scan_tag) {
for (mlsize_t i = 0; i < wosize; i++) Field (result, i) = Val_unit;
}
return result;
}
#endif
Expand Down Expand Up @@ -405,4 +408,4 @@ CAMLprim value caml_atomic_make_contended(value v)
caml_initialize(&Field(res, 0), v);
for (mlsize_t i = 1; i < sz; i++) Field(res, i) = Val_unit;
CAMLreturn(res);
}
}

0 comments on commit ecabd07

Please sign in to comment.