From: Taras Glek <taras.judge@shaw.ca>
To: skaller <skaller@users.sourceforge.net>
Cc: Gordon Henriksen <gordonhenriksen@mac.com>,
Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] JIT VM in OCaml: Impossible?
Date: Thu, 16 Aug 2007 11:05:28 -0700 [thread overview]
Message-ID: <46C491E8.9010007@shaw.ca> (raw)
In-Reply-To: <1187285851.6017.17.camel@rosella.wigram>
skaller wrote:
> On Thu, 2007-08-16 at 12:24 -0400, Gordon Henriksen wrote:
>
>> On 2007-08-16, at 10:10, Joel Reymont wrote:
>>
>>
>>> Is it possible to write a JIT VM in OCaml?
>>>
>>>
>>> It seems that this should not be possible as OCaml does not allow
>>> for code generation at runtime. Am I mistaken?
>>>
>> Sure. You could write a compiler and assembler in ocaml.
>> But you'd need to write glue code in C or assembly to
>> convert the ocaml representation to machine data structures,
>>
>
> Why? Ocaml is just as capable of generating binary data as C ..
> if not more capable. You would need some glue to actually
> *execute* this code, but that is also true in C. For Unix,
> mmap() would probably be used.
>
> The question is: why would you do this? Why not just generate
> C (or C++ as Felix does) and compile it to a shared library,
> then link and execute it?
>
Because that would be bloody slow and depend on having a toolchain
installed? For a JIT you want a fast compiler that only compiles as
little as is needed.
Taras
next prev parent reply other threads:[~2007-08-16 18:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-16 14:10 Joel Reymont
2007-08-16 14:37 ` Sylvain Le Gall
2007-08-16 15:32 ` [Caml-list] " Oliver Bandel
2007-08-16 15:56 ` Joel Reymont
2007-08-16 16:15 ` Jon Harrop
2007-08-16 15:11 ` [Caml-list] " Oliver Bandel
2007-08-16 16:24 ` Gordon Henriksen
2007-08-16 17:37 ` skaller
2007-08-16 18:05 ` Taras Glek [this message]
2007-08-17 2:50 ` skaller
2007-08-17 3:09 ` Erick Tryzelaar
2007-08-17 5:42 ` skaller
2007-08-17 7:52 ` Joel Reymont
2007-08-17 8:36 ` Jon Harrop
2007-08-17 9:20 ` Joel Reymont
2007-08-17 8:39 ` Jon Harrop
2007-08-16 18:49 ` Jon Harrop
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46C491E8.9010007@shaw.ca \
--to=taras.judge@shaw.ca \
--cc=caml-list@inria.fr \
--cc=gordonhenriksen@mac.com \
--cc=skaller@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).