diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2008-09-17 14:55:30 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2008-09-17 14:55:30 +0000 |
commit | 61d26f938a4d80eb7c95ce40e9befd5d387e396b (patch) | |
tree | d1913b06bd5bacc22f07aef64b5dab2697efcb72 | |
parent | 6b3a3d371fe12f557d1d386519dc845f134950bd (diff) |
no integer in weak arrays (preparing an optimization)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9028 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | byterun/weak.c | 2 | ||||
-rw-r--r-- | stdlib/weak.mli | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/byterun/weak.c b/byterun/weak.c index e85468601..c6c4a223f 100644 --- a/byterun/weak.c +++ b/byterun/weak.c @@ -70,7 +70,7 @@ CAMLprim value caml_weak_set (value ar, value n, value el) if (offset < 1 || offset >= Wosize_val (ar)){ caml_invalid_argument ("Weak.set"); } - if (el != None_val){ + if (el != None_val && Is_block (el)){ Assert (Wosize_val (el) == 1); do_set (ar, offset, Field (el, 0)); }else{ diff --git a/stdlib/weak.mli b/stdlib/weak.mli index a0b794e66..70fcfa3f5 100644 --- a/stdlib/weak.mli +++ b/stdlib/weak.mli @@ -24,9 +24,11 @@ type 'a t any time. A weak pointer is said to be full if it points to a value, empty if the value was erased by the GC. - Note that weak arrays cannot be marshaled using - {!Pervasives.output_value} or the functions of the {!Marshal} - module. + + Notes: + - Integers are not allocated and cannot be stored in weak arrays. + - Weak arrays cannot be marshaled using {!Pervasives.output_value} + nor the functions of the {!Marshal} module. *) |