[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Basic Question about Virtual Machine in Lua
- From: Tim Hill <drtimhill@...>
- Date: Mon, 13 Jan 2014 19:42:26 -0800
On Jan 13, 2014, at 6:57 PM, William Ahern <william@25thandClement.com> wrote:
>
> But it was always intended to be JITd even before Sun published the
> specification. Sun was doing JIT compilation before Java was created, and
> that experience fed directly into the design of Java.
Hmm, I’ve never heard that, and certainly it was a LONG time between Java getting into the wild and the hotspot VM appearing.
> Yet both Java bytecode and the CIL use stack-based virtual machine models,
> which is the precise thing you don't want to do if you want to make native
> code compilation easier. Stack-based is what you use when you want things to
> be simpler and more convenient for compilation and execution in software.
The issue is less about register vs stack based (they both have pros and cons) so much as the metadata output by the compiler along with the bytecode. Java bytecode has very little, whereas MSIL is much richer, providing the hints needed for the JIT to do a better (and faster) job. This really comes down to the design point; Java bytecode was designed to be executed, MSIL was designed to be JITted. I’m no great fan of .Net over Java, but this is one place where the MS design is better than Sun’s (MS compensated for this by messing up the rest of .net wonderfully :).
—Tim