summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2008-01-25 08:39:49 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2008-01-25 08:39:49 +0000
commit759304681e8be86c56011c6989afb926de96e3d3 (patch)
treefd7ad2d99d35d9b2a37e3a40978f4a88e0d1067c
parentcb40742e750ae18c67828321aa87f312dcee4d6a (diff)
grant PR#3760
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8790 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--byterun/mlvalues.h5
-rw-r--r--byterun/obj.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/byterun/mlvalues.h b/byterun/mlvalues.h
index 110c808eb..d6263aefc 100644
--- a/byterun/mlvalues.h
+++ b/byterun/mlvalues.h
@@ -188,8 +188,11 @@ typedef opcode_t * code_t;
#define Class_val(val) Field((val), 0)
#define Oid_val(val) Long_val(Field((val), 1))
CAMLextern value caml_get_public_method (value obj, value tag);
-/* called as:
+/* Called as:
caml_callback(caml_get_public_method(obj, caml_hash_variant(name)), obj) */
+/* caml_get_public_method returns 0 if tag not in the table.
+ Note however that tags being hashed, same tag does not necessarily mean
+ same method name. */
/* Special case of tuples of fields: closures */
#define Closure_tag 247
diff --git a/byterun/obj.c b/byterun/obj.c
index 3ee12201e..6332e4de9 100644
--- a/byterun/obj.c
+++ b/byterun/obj.c
@@ -189,7 +189,7 @@ CAMLprim value caml_lazy_make_forward (value v)
CAMLreturn (res);
}
-/* For camlinternalOO.ml
+/* For mlvalues.h and camlinternalOO.ml
See also GETPUBMET in interp.c
*/
@@ -202,7 +202,8 @@ CAMLprim value caml_get_public_method (value obj, value tag)
if (tag < Field(meths,mi)) hi = mi-2;
else li = mi;
}
- return Field (meths, li-1);
+ /* return 0 if tag is not there */
+ return (tag == Field(meths,li) ? Field (meths, li-1) : 0);
}
/* these two functions might be useful to an hypothetical JIT */