diff options
author | Jun FURUSE / 古瀬 淳 <jun.furuse@gmail.com> | 2004-06-18 05:04:14 +0000 |
---|---|---|
committer | Jun FURUSE / 古瀬 淳 <jun.furuse@gmail.com> | 2004-06-18 05:04:14 +0000 |
commit | 5e1bf20850aaa9b1ceb86a971848609ee9e84c47 (patch) | |
tree | f3a6e5b5c38263fe527e6275ff95425f12637226 /bytecomp/bytegen.ml | |
parent | 8ec769214e067da9ee8b33d05f4ef275e9269dd5 (diff) | |
download | ocaml-gcaml.tar.gz |
port to the latest ocaml (2004/06/18)gcaml
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gcaml@6419 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'bytecomp/bytegen.ml')
-rw-r--r-- | bytecomp/bytegen.ml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/bytecomp/bytegen.ml b/bytecomp/bytegen.ml index cdc4c9e287..8a8652488c 100644 --- a/bytecomp/bytegen.ml +++ b/bytecomp/bytegen.ml @@ -409,20 +409,27 @@ let rec comp_expr env exp sz cont = (Kpush :: comp_expr env func (sz + 3 + nargs) (Kapply nargs :: cont1)) end - | Lsend(met, obj, args) -> + | Lsend(kind, met, obj, args) -> + let args = if kind = Cached then List.tl args else args in let nargs = List.length args + 1 in + let getmethod, args' = + if kind = Self then (Kgetmethod, met::obj::args) else + match met with + Lconst(Const_base(Const_int n)) -> (Kgetpubmet n, obj::args) + | _ -> (Kgetdynmet, met::obj::args) + in if is_tailcall cont then - comp_args env (met::obj::args) sz - (Kgetmethod :: Kappterm(nargs, sz + nargs) :: discard_dead_code cont) + comp_args env args' sz + (getmethod :: Kappterm(nargs, sz + nargs) :: discard_dead_code cont) else if nargs < 4 then - comp_args env (met::obj::args) sz - (Kgetmethod :: Kapply nargs :: cont) + comp_args env args' sz + (getmethod :: Kapply nargs :: cont) else begin let (lbl, cont1) = label_code cont in Kpush_retaddr lbl :: - comp_args env (met::obj::args) (sz + 3) - (Kgetmethod :: Kapply nargs :: cont1) + comp_args env args' (sz + 3) + (getmethod :: Kapply nargs :: cont1) end | Lfunction(kind, params, body) -> (* assume kind = Curried *) let lbl = new_label() in @@ -714,7 +721,7 @@ let rec comp_expr env exp sz cont = let info = match lam with Lapply(_, args) -> Event_return (List.length args) - | Lsend(_, _, args) -> Event_return (List.length args + 1) + | Lsend(_, _, _, args) -> Event_return (List.length args + 1) | _ -> Event_other in let ev = event (Event_after ty) info in |