caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* The 'restart' Bytecode
@ 2005-07-20 10:47 Christian Lindig
  2005-07-23 12:11 ` [Caml-list] " Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Lindig @ 2005-07-20 10:47 UTC (permalink / raw)
  To: Caml List


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/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-23 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-20 10:47 The 'restart' Bytecode Christian Lindig
2005-07-23 12:11 ` [Caml-list] " Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).