|
Unless things have changed drastically since I studied the Lua
implementation (research for my own realtime scripting engine), Lua
compiles to bytecode that is then executed by a register based VM. In
practical terms, there's a C switch() statement that switches on VM
opcodes in order to execute the right native code snippet for each VM
instruction.
That is, the VM (unless you count the peephole optimizer, which is
part of the compiler IIRC) operates *entirely* at run-time. No native
machine code is generated by the compiler, or any part of the VM.
LuaJIT OTOH, does generate machine code - but AFAIK, even that happens
entirely at run-time (it's not done by the compiler), and it's only
done for bytecode that's used intensely enough to motivate it.
--
On Mon, Jan 13, 2014 at 12:16 PM, Journeyer J. Joh
<oosaprogrammer@gmail.com> wrote:
> And I'd like to compare Lua VM with JVM or .net or Dalvic.
>
> I believe Lua VM doesn't work at run-time at all.
> This gives the impression that Lua VM look very much similar to LLVM.
> And, this would distinguish Lua VM from JVM, .net or Dalvic.
>
> Do I think correctly?
>
> Thank you very much also.
>
> Ha ve a good day,
> Journeyer
>
>
> ----------------------------------------
> Journeyer J. Joh
> o o s a p r o g r a m m e r
> a t
> g m a i l d o t c o m
> ----------------------------------------
>
>
> 2014/1/13 Journeyer J. Joh <oosaprogrammer@gmail.com>
>>
>> Hi,
>>
>> I suddenly faced a basic question about virtual machine in lua.
>> Frankly speaking I didn't search about this question on internet.
>> I am asking this question directly on this maillist.
>>
>> I wonder if the virtual machine in Lua is pretty much same with the one in
>> LLVM.
>>
>> I noticed sqlite3 uses VM also.
>> I know there are several different type of VM.
>> Frankly, I don't know very well about LLVM neigher.
>>
>> I think VM of LLVM provides a isolated environment from any machine so
>> that compile-time optimization is done with better result.
>>
>> I guess lua VM is used for the same purpose. VM in lua provides a virtual
>> machine in which compile-time optimization is done better.
>>
>> Thank you for the kind answer in advance.
>>
>> Have a good day.
>> Journeyer
>> ----------------------------------------
>> Journeyer J. Joh
>> o o s a p r o g r a m m e r
>> a t
>> g m a i l d o t c o m
>> ----------------------------------------
>
>
//David Olofson - Consultant, Developer, Artist, Open Source Advocate
.--- Games, examples, libraries, scripting, sound, music, graphics ---.
| http://consulting.olofson.net http://olofsonarcade.com |
'---------------------------------------------------------------------'