Permalink
Browse files

initialize blocks with Val_unit, not zero

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14720 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent 521ac02 commit 05100e597e4296a2e79e6c2d9cd75b7e1cc595c9 @mshinwell mshinwell committed May 1, 2014
Showing with 12 additions and 8 deletions.
  1. +2 −0 Changes
  2. +4 −2 byterun/alloc.c
  3. +6 −6 byterun/memory.h
View
@@ -65,6 +65,8 @@ Toplevel interactive system:
- PR#5377: New "#show_*" directives
Runtime system:
+- Blocks initialized by [CAMLlocal*] and [caml_alloc] are now filled with
+ [Val_unit] rather than zero.
- Fixed a major performance problem on large heaps (~1GB) by making heap
increments proportional to heap size
- PR#4765: Structural equality should treat exception specifically
View
@@ -39,11 +39,13 @@ CAMLexport value caml_alloc (mlsize_t wosize, tag_t tag)
}else if (wosize <= Max_young_wosize){
Alloc_small (result, wosize, tag);
if (tag < No_scan_tag){
- for (i = 0; i < wosize; i++) Field (result, i) = 0;
+ for (i = 0; i < wosize; i++) Field (result, i) = Val_unit;
}
}else{
result = caml_alloc_shr (wosize, tag);
- if (tag < No_scan_tag) memset (Bp_val (result), 0, Bsize_wsize (wosize));
+ if (tag < No_scan_tag){
+ for (i = 0; i < wosize; i++) Field (result, i) = Val_unit;
+ }
result = caml_check_urgent_gc (result);
}
return result;
View
@@ -266,27 +266,27 @@ CAMLextern struct caml__roots_block *caml_local_roots; /* defined in roots.c */
0)
#define CAMLlocal1(x) \
- value x = 0; \
+ value x = Val_unit; \
CAMLxparam1 (x)
#define CAMLlocal2(x, y) \
- value x = 0, y = 0; \
+ value x = Val_unit, y = Val_unit; \
CAMLxparam2 (x, y)
#define CAMLlocal3(x, y, z) \
- value x = 0, y = 0, z = 0; \
+ value x = Val_unit, y = Val_unit, z = Val_unit; \
CAMLxparam3 (x, y, z)
#define CAMLlocal4(x, y, z, t) \
- value x = 0, y = 0, z = 0, t = 0; \
+ value x = Val_unit, y = Val_unit, z = Val_unit, t = Val_unit; \
CAMLxparam4 (x, y, z, t)
#define CAMLlocal5(x, y, z, t, u) \
- value x = 0, y = 0, z = 0, t = 0, u = 0; \
+ value x = Val_unit, y = Val_unit, z = Val_unit, t = Val_unit, u = Val_unit; \
CAMLxparam5 (x, y, z, t, u)
#define CAMLlocalN(x, size) \
- value x [(size)] = { 0, /* 0, 0, ... */ }; \
+ value x [(size)] = { Val_unit, /* Val_unit, Val_unit, ... */ }; \
CAMLxparamN (x, (size))

0 comments on commit 05100e5

Please sign in to comment.