summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2004-01-29 00:15:23 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2004-01-29 00:15:23 +0000
commit4aa3094433b026b96608ea2191b16bc282ac8661 (patch)
treef74913ac8ce4210bc533e9c73373c507e44b47b2
parent15a6cf84827a43fc83c8c8fa1ef838c2c92964f0 (diff)
downloadocaml-4aa3094433b026b96608ea2191b16bc282ac8661.tar.gz
caml_cache_method as subroutine
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/newoolab@6093 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/cmmgen.ml21
1 files changed, 19 insertions, 2 deletions
diff --git a/asmcomp/cmmgen.ml b/asmcomp/cmmgen.ml
index 2e983a845f..4f6edb63c5 100644
--- a/asmcomp/cmmgen.ml
+++ b/asmcomp/cmmgen.ml
@@ -346,7 +346,6 @@ let lookup_tag_cache obj tag cache n =
in
Cop(Cextcall("oo_cache_public_method2", typ_addr, false),
[Cop(Cload Word, [obj]); tag; cache n]))
-*)
let lookup_tag_cache obj tag cache n =
Compilenv.need_apply_fun 1;
@@ -355,6 +354,7 @@ let lookup_tag_cache obj tag cache n =
Cop(Cadda, [cache; Cconst_int (n * size_addr)]) ]
in
Cop(Capply typ_addr, cargs)
+*)
let lookup_tag obj tag =
bind "tag" tag (fun tag ->
@@ -370,6 +370,7 @@ let call_cached_method obj tag cache n args =
let cache =
if n = 0 then cache else Cop(Cadda, [cache; Cconst_int (n * size_addr)]) in
Compilenv.need_apply_fun (-arity);
+ Compilenv.need_apply_fun 1;
Cop(Capply typ_addr,
Cconst_symbol("caml_cached_method" ^ string_of_int arity) ::
obj :: tag :: cache :: args)
@@ -1738,6 +1739,7 @@ let compunit size ulam =
Cdefine_symbol glob;
Cskip(size * size_addr)] :: c3
+(*
let get_cached_method () =
let cache = Ident.create "cache"
and obj = Ident.create "obj"
@@ -1765,6 +1767,7 @@ let get_cached_method () =
fun_args = [obj, typ_addr; tag, typ_int; cache, typ_addr];
fun_body = body;
fun_fast = true}
+*)
(*
CAMLprim value oo_cache_public_method (value meths, value tag, value *cache)
@@ -1818,6 +1821,17 @@ let cache_public_method meths tag cache =
[meths; lsl_const (Cvar li) log2_size_addr]);
Cconst_int(-size_addr)])])))))
+let get_cached_method () =
+ let cache = Ident.create "cache"
+ and meths = Ident.create "meths"
+ and tag = Ident.create "tag" in
+ let body = cache_public_method (Cvar meths) (Cvar tag) (Cvar cache) in
+ Cfunction
+ {fun_name = "caml_cache_method";
+ fun_args = [meths, typ_addr; tag, typ_int; cache, typ_addr];
+ fun_body = body;
+ fun_fast = true}
+
(* Generate an application function:
(defun caml_applyN (a1 ... aN clos)
(if (= clos.arity N)
@@ -1874,7 +1888,10 @@ let call_cached_method arity =
Cifthenelse(Cop(Ccmpa Cne, [tag'; tag]),
(* Cop(Cextcall("oo_cache_public_method", typ_addr, false),
[Cvar meths; tag; cache]), *)
- cache_public_method (Cvar meths) tag cache,
+ (* cache_public_method (Cvar meths) tag cache, *)
+ Cop(Capply typ_addr,
+ [Cconst_symbol "caml_cache_method";
+ Cvar meths; tag; cache]),
Cop(Cload Word, [meth_pos]))
))
in