From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 39449BB81 for ; Wed, 20 Jul 2005 12:47:58 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6KAlv6n010398 for ; Wed, 20 Jul 2005 12:47:57 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA29110 for ; Wed, 20 Jul 2005 12:47:57 +0200 (MET DST) Received: from triton.rz.uni-saarland.de (triton.rz.uni-saarland.de [134.96.7.25]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6KAluGb010395 for ; Wed, 20 Jul 2005 12:47:57 +0200 Received: from uni-sb.de (uni-sb.de [134.96.7.230]) by triton.rz.uni-saarland.de (8.12.10/8.12.10) with ESMTP id j6KAltkR1068331 for ; Wed, 20 Jul 2005 12:47:56 +0200 (CEST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.13.4/2005060800) with ESMTP id j6KAlt7f015367 for ; Wed, 20 Jul 2005 12:47:55 +0200 (CEST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.13.4/2005033000) with ESMTP id j6KAls7D013040 for ; Wed, 20 Jul 2005 12:47:55 +0200 (CEST) Received: from mail.st.cs.uni-sb.de (goscinny.cs.uni-sb.de [134.96.235.32]) by mail.cs.uni-sb.de (8.13.4/2005060800) with ESMTP id j6KAlsUi011551 for ; Wed, 20 Jul 2005 12:47:54 +0200 (CEST) X-Authentication-Warning: mail.cs.uni-sb.de: Host goscinny.cs.uni-sb.de [134.96.235.32] claimed to be mail.st.cs.uni-sb.de Received: from [134.96.235.101] (jonagold.cs.uni-sb.de [134.96.235.101]) by mail.st.cs.uni-sb.de (Postfix) with ESMTP id 37BEE1BDD2 for ; Wed, 20 Jul 2005 12:47:54 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v619.2) Content-Transfer-Encoding: 7bit Message-Id: <26df9c585c97ae7d4bc258277bd812e8@cs.uni-sb.de> Content-Type: text/plain; charset=US-ASCII; format=flowed To: Caml List From: Christian Lindig Subject: The 'restart' Bytecode Date: Wed, 20 Jul 2005 12:47:51 +0200 X-Mailer: Apple Mail (2.619.2) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.1 (triton.rz.uni-saarland.de [134.96.7.25]); Wed, 20 Jul 2005 12:47:56 +0200 (CEST) X-AntiVirus: checked by AntiVir Milter 1.0.6; AVE 6.31.0.9; VDF 6.31.0.238 X-Miltered: at nez-perce with ID 42DE2BDD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42DE2BDC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lindig:01 lindig:01 bytecode:01 recursive:01 bytecode:01 ocaml:01 implements:01 interp:01 const:01 const:01 interacts:01 ocaml:01 xavier's:01 uni-sb:01 uni-sb:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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/