summaryrefslogtreecommitdiffstats
path: root/byterun/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/array.c')
-rw-r--r--byterun/array.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/byterun/array.c b/byterun/array.c
index a8830d58e..327f2b564 100644
--- a/byterun/array.c
+++ b/byterun/array.c
@@ -137,12 +137,23 @@ CAMLprim value caml_array_unsafe_set(value array, value index, value newval)
CAMLprim value caml_make_float_vect(value len)
{
- mlsize_t wsize = Long_val(len) * Double_wosize;
- if (wsize == 0)
+ mlsize_t wosize = Long_val(len) * Double_wosize;
+ value result;
+ if (wosize == 0)
return Atom(0);
- if (wsize > Max_wosize)
- caml_invalid_argument("Array.make");
- return caml_alloc(wsize, Double_array_tag);
+ else if (wosize <= Max_young_wosize){
+#define Setup_for_gc
+#define Restore_after_gc
+ Alloc_small (result, wosize, Double_array_tag);
+#undef Setup_for_gc
+#undef Restore_after_gc
+ }else if (wosize > Max_wosize)
+ caml_invalid_argument("Array.make_float");
+ else {
+ result = caml_alloc_shr (wosize, Double_array_tag);
+ result = caml_check_urgent_gc (result);
+ }
+ return result;
}
CAMLprim value caml_make_vect(value len, value init)