caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@cs.uni-sb.de>
To: Caml List <caml-list@inria.fr>
Subject: The 'restart' Bytecode
Date: Wed, 20 Jul 2005 12:47:51 +0200	[thread overview]
Message-ID: <26df9c585c97ae7d4bc258277bd812e8@cs.uni-sb.de> (raw)


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/


             reply	other threads:[~2005-07-20 10:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-20 10:47 Christian Lindig [this message]
2005-07-23 12:11 ` [Caml-list] " Xavier Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26df9c585c97ae7d4bc258277bd812e8@cs.uni-sb.de \
    --to=lindig@cs.uni-sb.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).