Skip to content

Fix caml_alloc_shr_check_gc for tags >= No_scan_tag #2203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ocaml/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);
}
}