English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
The 'restart' Bytecode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-07-20 (10:47)
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 ' '
         acc 2
         getglobal String!
         getfield 0
         apply 2
         const "\n"
         acc 2
         envacc 1
         apply 2
         envacc 1
         appterm 2, 4

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.


-- Christian