summaryrefslogtreecommitdiffstats
path: root/byterun/intern.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/intern.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/intern.c')
-rw-r--r--byterun/intern.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/byterun/intern.c b/byterun/intern.c
index bfe18b1a1..92cd90b2f 100644
--- a/byterun/intern.c
+++ b/byterun/intern.c
@@ -64,10 +64,6 @@ static value intern_block;
/* Point to the heap block allocated as destination block.
Meaningful only if intern_extra_block is NULL. */
-static value * camlinternaloo_last_id = NULL;
-/* Pointer to a reference holding the last object id.
- -1 means not available (CamlinternalOO not loaded). */
-
static char * intern_resolve_code_pointer(unsigned char digest[16],
asize_t offset);
static void intern_bad_code_pointer(unsigned char digest[16]) Noreturn;
@@ -290,16 +286,9 @@ static void intern_rec(value *dest)
switch (sp->op) {
case OFreshOID:
/* Refresh the object ID */
- if (camlinternaloo_last_id == NULL) {
- camlinternaloo_last_id = caml_named_value("CamlinternalOO.last_id");
- if (camlinternaloo_last_id == NULL)
- camlinternaloo_last_id = (value*) (-1);
- }
- if (camlinternaloo_last_id != (value*) (-1)) {
- value id = Field(*camlinternaloo_last_id,0);
- Field(dest, 0) = id;
- Field(*camlinternaloo_last_id,0) = id + 2;
- }
+ /* but do not do it for predefined exception slots */
+ if (Int_val(Field(dest, 1)) >= 0)
+ caml_set_oo_id((value)dest);
/* Pop item and iterate */
sp--;
break;
@@ -336,7 +325,7 @@ static void intern_rec(value *dest)
/* Request freshing OID */
PushItem();
sp->op = OFreshOID;
- sp->dest = &Field(v, 1);
+ sp->dest = v;
sp->arg = 1;
/* Finally read first two block elements: method table and old OID */
ReadItems(&Field(v, 0), 2);
@@ -503,8 +492,6 @@ static void intern_alloc(mlsize_t whsize, mlsize_t num_objects)
{
mlsize_t wosize;
- if (camlinternaloo_last_id == (value*)-1)
- camlinternaloo_last_id = NULL; /* Reset ignore flag */
if (whsize == 0) {
intern_obj_table = NULL;
intern_extra_block = NULL;