summaryrefslogtreecommitdiffstats
path: root/byterun/obj.c
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2004-05-26 11:10:52 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2004-05-26 11:10:52 +0000
commit6a940ef65d7b70f94e221f4b6731b4ed7a9c410e (patch)
treea002b52a1f42795af154463599d59c883fd01bef /byterun/obj.c
parentd1482d5a412e7b42841a174d48e0288f5ab447b5 (diff)
switch to new vtable representation
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6331 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/obj.c')
-rw-r--r--byterun/obj.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/byterun/obj.c b/byterun/obj.c
index 6f95f952a..ef340701d 100644
--- a/byterun/obj.c
+++ b/byterun/obj.c
@@ -197,3 +197,50 @@ CAMLprim value caml_lazy_make_forward (value v)
Modify (&Field (res, 0), v);
CAMLreturn (res);
}
+
+/* For camlinternalOO.ml
+ See also GETPUBMET in interp.c
+ */
+
+CAMLprim value caml_get_public_method (value obj, value tag)
+{
+ value meths = Field (obj, 0);
+ int li = 3, hi = Field(meths,0), mi;
+ while (li < hi) {
+ mi = ((li+hi) >> 1) | 1;
+ if (tag < Field(meths,mi)) hi = mi-2;
+ else li = mi;
+ }
+ return Field (meths, li-1);
+}
+
+/*
+value caml_cache_public_method (value meths, value tag, value *cache)
+{
+ int li = 3, hi = Field(meths,0), mi;
+ while (li < hi) {
+ mi = ((li+hi) >> 1) | 1;
+ if (tag < Field(meths,mi)) hi = mi-2;
+ else li = mi;
+ }
+ *cache = (li-3)*sizeof(value)+1;
+ return Field (meths, li-1);
+}
+
+value caml_cache_public_method2 (value *meths, value tag, value *cache)
+{
+ value ofs = *cache & meths[1];
+ if (*(value*)(((char*)(meths+3)) + ofs - 1) == tag)
+ return *(value*)(((char*)(meths+2)) + ofs - 1);
+ {
+ int li = 3, hi = meths[0], mi;
+ while (li < hi) {
+ mi = ((li+hi) >> 1) | 1;
+ if (tag < meths[mi]) hi = mi-2;
+ else li = mi;
+ }
+ *cache = (li-3)*sizeof(value)+1;
+ return meths[li-1];
+ }
+}
+*/