From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA01959 for caml-red; Thu, 4 Jan 2001 14:06:32 +0100 (MET) 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 QAA08970 for ; Wed, 3 Jan 2001 16:27:28 +0100 (MET) Received: from talisker.channelpoint.com ([216.253.252.33]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f03FRQb16648 for ; Wed, 3 Jan 2001 16:27:27 +0100 (MET) Received: from cpex1.channelpoint.com (cpex1.channelpoint.com [10.112.2.7]) by talisker.channelpoint.com (8.11.0/8.11.0) with ESMTP id f03FQbT17846; Wed, 3 Jan 2001 08:26:37 -0700 (MST) Received: by cpex1.channelpoint.com with Internet Mail Service (5.5.2650.21) id ; Wed, 3 Jan 2001 08:24:54 -0700 Message-ID: <03E742431696D311BD1B00062938251704C4C6AD@cpex1.channelpoint.com> From: Jerry Jackson To: "'Alain Frisch'" , Markus Mottl Cc: OCAML Subject: RE: JIT-compilation for OCaml? Date: Wed, 3 Jan 2001 08:24:53 -0700 Importance: low X-Priority: 5 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Sender: weis@pauillac.inria.fr -----Original Message----- From: Alain Frisch [mailto:frisch@clipper.ens.fr] Sent: Wednesday, January 03, 2001 5:15 AM To: Markus Mottl Cc: Mattias Waldau; OCAML Subject: Re: JIT-compilation for OCaml? Hello, Compiling the code really during runtime opens the door to further optimizations (I guess this is how Java JIT compilers work, but I have no idea). For instance, it is possible to watch conditionnal jumps and reorganize the code so that the most taken branches don't need any jump. The GC and the memory allocator have the opportunity to adapt themselves to the application. Of course, this only makes sense for long running applications. The user should be able to record the optimization information collected. Actually, there are two operations involved: a profiler (a bytecode interpreter that also collects optimization information) and a bytecode-to-nativecode converter as in the previous paragraph. I don't see the advantage of mixing them in a complex JIT compiler (which will be slow for a long time after startup if the optimizations are non trivial). [JRJ] There are many other sorts of optimizations that can be done by compiling at runtime. A simple case is that processor-specific instructions can be generated instead of generic ones (e.g. Pentium III instructions rather than generic 486). A more interesting example is used by Sun's current JIT compiler... Aggressive inlining and direct dispatch are done for all sorts of method calls (that could potentially be overloaded). If a class is later loaded that extends one of the inlined or directly called methods, the JIT compiler goes back and "unoptimizes" the code it had previously optimized!