pour CAML_JIT
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6375 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
d29a2ec4df
commit
6ca9627bfa
|
@ -217,6 +217,11 @@ CAMLprim value caml_get_public_method (value obj, value tag)
|
|||
/* these two functions might be useful to an hypothetical JIT */
|
||||
|
||||
#ifdef CAML_JIT
|
||||
#ifdef NATIVE_CODE
|
||||
#define MARK 1
|
||||
#else
|
||||
#define MARK 0
|
||||
#endif
|
||||
value caml_cache_public_method (value meths, value tag, value *cache)
|
||||
{
|
||||
int li = 3, hi = Field(meths,0), mi;
|
||||
|
@ -225,15 +230,15 @@ value caml_cache_public_method (value meths, value tag, value *cache)
|
|||
if (tag < Field(meths,mi)) hi = mi-2;
|
||||
else li = mi;
|
||||
}
|
||||
*cache = (li-3)*sizeof(value)+1;
|
||||
*cache = (li-3)*sizeof(value) + MARK;
|
||||
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);
|
||||
if (*(value*)(((char*)(meths+3)) + ofs - MARK) == tag)
|
||||
return *(value*)(((char*)(meths+2)) + ofs - MARK);
|
||||
{
|
||||
int li = 3, hi = meths[0], mi;
|
||||
while (li < hi) {
|
||||
|
@ -241,7 +246,7 @@ value caml_cache_public_method2 (value *meths, value tag, value *cache)
|
|||
if (tag < meths[mi]) hi = mi-2;
|
||||
else li = mi;
|
||||
}
|
||||
*cache = (li-3)*sizeof(value)+1;
|
||||
*cache = (li-3)*sizeof(value) + MARK;
|
||||
return meths[li-1];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue