Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
High-performance bytecode interpreter in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-15 (23:52)
From: Joel Reymont <joelr1@g...>
Subject: Re: [Caml-list] High-performance bytecode interpreter in OCaml
On Aug 15, 2007, at 4:18 PM, Jon Harrop wrote:

>   let rec compile bytecode = match bytecode with
>     | 0x83::x::t ->
>         let x = String.lowercase (string_of_int x) in
>         let t = compile t in
>         (fun k -> print_string x; k t)

I'm curious, would this be any faster than doing whatever the 0x83  
opcode requires and then just invoking (compile t)?

Does it actually make sense to convert the whole bytecode file into a  
chain of closures and then execute it repeatedly? Would there be a  
huge gain compared to interpreting every time?

I guess it would make sense if closures could be compiled into  
machine code "just in time" or if my VM was compiled using ocamlopt.  
I'm not sure, though, so I'm looking for input.

	Thanks, Joel