[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christian Lindig <lindig@c...> |
| Subject: | The 'restart' Bytecode |
To verify that some function is indeed tail recursive I sometimes
inspect its bytecode using "ocaml -dinstr". The 'appterm' instruction
implements the desired tail call and thus is what I am looking for.
However, sometimes the appterm instruction is followed by a restart
instruction. I could neither figure out what it does (by looking at
interp.c) nor I was expecting code following an appterm to be reachable
at all. For example:
L3: grab 1
const ' '
push
acc 2
push
getglobal String!
getfield 0
apply 2
push
const "\n"
push
acc 2
push
envacc 1
apply 2
push
envacc 1
appterm 2, 4
restart
I would be grateful if some could elaborate what restart does and how
it interacts with tail calls. Some information about the OCaml Bytecode
machine can be found here, and also in Xavier's ZINC paper.
http://pauillac.inria.fr/~lebotlan/docaml_eng.html
-- Christian
--
http://www.st.cs.uni-sb.de/~lindig/