From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA02851; Tue, 14 Aug 2001 09:32:26 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA02913 for ; Tue, 14 Aug 2001 09:32:26 +0200 (MET DST) Received: from kerne.inria.fr (kerne.inria.fr [128.93.8.140]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7E7WJP23478; Tue, 14 Aug 2001 09:32:19 +0200 (MET DST) Received: (from lefessan@localhost) by kerne.inria.fr (8.11.3/8.11.3) id f7EDYrT03365; Tue, 14 Aug 2001 09:34:53 -0400 X-Authentication-Warning: kerne.inria.fr: lefessan set sender to fabrice.le_fessant@inria.fr using -f From: Fabrice Le Fessant MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15225.10490.155943.191262@kerne.inria.fr> Date: Tue, 14 Aug 2001 09:34:50 -0400 (EDT) To: Xavier Leroy Cc: Chris Hecker , caml-list@inria.fr Subject: Re: [Caml-list] calling native code from bytecode? References: <200108012345.QAA29668@smtp3-cm.mail.eni.net> <20010803140351.A3307@pauillac.inria.fr> <4.3.2.7.2.20010803065549.02761be0@shell16.ba.best.com> <20010808104615.A3590@pauillac.inria.fr> X-Mailer: VM 6.75 under Emacs 20.7.1 Reply-To: fabrice.le_fessant@inria.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk A few years ago :), I implemented the mixing of bytecode and native code in JoCaml. The bytecode interpreter included in native code runtimes was modified so that bytecode functions were wrapped inside native code functions, using a special tag. This tag was checked before executing a closure, to either call a wrapper for real native code functions, or to find the bytecode pointer in the closure for bytecode functions. In native code, calling directly the wrapped function started a new interpreter to execute its bytecode. For exceptions, a flag is used to know whether the first exception handler is executing native code or bytecode. Depending on this flag, the exception is raised in bytecode or native style. I did not measure the cost of this, but I noticed a slowdown. I don't know if there is a better solution. One of my (unfortunately long list of) projects is to improve asmdynlink to produce JIT native code for bytecode ... maybe next year ! - Fabrice ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr