summaryrefslogtreecommitdiffstats
path: root/byterun/obj.c
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-10-23 14:28:31 +0000
committerAlain Frisch <alain@frisch.fr>2013-10-23 14:28:31 +0000
commit0f6f367ad4c2210bdf393ac60dbc0b6f7b8c796d (patch)
tree23038cc2fa16b7d37019e24012aaa22493ecd948 /byterun/obj.c
parentfe3afbdce8bbf5d1b959855aed4dec05f0ddba16 (diff)
Change the representation of exception slots: instead of being represented as 'string ref', they are now blocks
of size 2, with tag = Object_tag, the first field being the pointer to the string, and second one being a unique id, generated from the same sequence as for object values. Special case for predefined exceptions, represented with a negative id. The unique id generator is moved from camlinternalOO to the C runtime system. Also fix some bugs. git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14239 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/obj.c')
-rw-r--r--byterun/obj.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/byterun/obj.c b/byterun/obj.c
index 8e00282e5..1fe8b2280 100644
--- a/byterun/obj.c
+++ b/byterun/obj.c
@@ -24,6 +24,7 @@
#include "misc.h"
#include "mlvalues.h"
#include "prims.h"
+#include "stdio.h"
CAMLprim value caml_static_alloc(value size)
{
@@ -247,3 +248,11 @@ value caml_cache_public_method2 (value *meths, value tag, value *cache)
}
}
#endif /*CAML_JIT*/
+
+static value oo_last_id = Val_int(0);
+
+CAMLprim value caml_set_oo_id (value obj) {
+ Field(obj, 1) = oo_last_id;
+ oo_last_id += 2;
+ return obj;
+}