Assembler Interface of LuaJIT VM.

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Assembler Interface of LuaJIT VM.

neha mahajan

Dear Sir,

we are very much impressed by the performance of LuaJIT.
 
we was going through the code, but we are unable to understand the assembler interface of vm i.e. lj_vm.s. we are unable to understand the basic functionality of this file so could you please through some light on these functions like lj_vm_pcall, lj_vm_cpcall, lj_vm_call etc.
 
we have already disassemble the lj_vm.s, but its corresponding pseudo code or logic functionality of these assembly functions are still missing.
your suggestion will be quite helpful.

Thanks,
Neha.

Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

Erik Lindroos
Hi,

I'm not Mike Pall, but I can tell you that the source to the interpreter (which becomes lj_vm.obj) is in buildvm_x86.dasc in the form of DynASM source. The functions mentioned simply implement different forms of function calls and are used by, for example, the similarly named Lua API functions.

/Erik

On Wed, Sep 1, 2010 at 1:34 PM, neha mahajan <[hidden email]> wrote:

Dear Sir,

we are very much impressed by the performance of LuaJIT.
 
we was going through the code, but we are unable to understand the assembler interface of vm i.e. lj_vm.s. we are unable to understand the basic functionality of this file so could you please through some light on these functions like lj_vm_pcall, lj_vm_cpcall, lj_vm_call etc.
 
we have already disassemble the lj_vm.s, but its corresponding pseudo code or logic functionality of these assembly functions are still missing.
your suggestion will be quite helpful.

Thanks,
Neha.


Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

Mike Pall-19
In reply to this post by neha mahajan
neha mahajan wrote:
> we have already disassemble the lj_vm.s, but its corresponding pseudo code
> or logic functionality of these assembly functions are still missing.

There is no need to disassemble anything; LuaJIT is distributed
with source code. The interpreter is generated from the *.dasc
files and these have all the comments.

--Mike

Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

neha mahajan
Thanks Mike for clarification.
 
but I wanted to know that on what basis Action Names and their numbers are assigned for a particular architecture. I have checked out both x86 & ppc code. The build_actionlist is so confusing in itself. can you put some light on these aspects also. As action names are different from opcodes for a particular architecture.
 
--Neha.

On Wed, Sep 1, 2010 at 10:16 PM, Mike Pall <[hidden email]> wrote:
neha mahajan wrote:
> we have already disassemble the lj_vm.s, but its corresponding pseudo code
> or logic functionality of these assembly functions are still missing.

There is no need to disassemble anything; LuaJIT is distributed
with source code. The interpreter is generated from the *.dasc
files and these have all the comments.

--Mike




--
Neha Mahajan.
Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

云帆江
In reply to this post by Mike Pall-19
so it it possible to rum luajit on mips ? i have an nanonote which use a jz4740 cpu

On Thu, Sep 2, 2010 at 12:46 AM, Mike Pall <[hidden email]> wrote:
neha mahajan wrote:
> we have already disassemble the lj_vm.s, but its corresponding pseudo code
> or logic functionality of these assembly functions are still missing.

There is no need to disassemble anything; LuaJIT is distributed
with source code. The interpreter is generated from the *.dasc
files and these have all the comments.

--Mike




--
welcom to gtalk me
http://hi.baidu.com/jyf1987
Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

steve donovan
On Fri, Sep 3, 2010 at 10:08 AM, 江云帆 <[hidden email]> wrote:
> so it it possible to rum luajit on mips ? i have an nanonote which use a
> jz4740 cpu

Only x86 and x86_64 is supported. Mr Pall is working on a PPC-like
port.  Naturally us ARM programmers would also be keen, but there's
only one Mike Pall, unless someone manages to clone his process ;)

Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

云帆江
but is there any tutorial for implement llvm version Lua vm?

On Fri, Sep 3, 2010 at 5:45 PM, steve donovan <[hidden email]> wrote:
On Fri, Sep 3, 2010 at 10:08 AM, 江云帆 <[hidden email]> wrote:
> so it it possible to rum luajit on mips ? i have an nanonote which use a
> jz4740 cpu

Only x86 and x86_64 is supported. Mr Pall is working on a PPC-like
port.  Naturally us ARM programmers would also be keen, but there's
only one Mike Pall, unless someone manages to clone his process ;)




--
welcom to gtalk me
http://hi.baidu.com/jyf1987
Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

Mike Pall-19
In reply to this post by neha mahajan
neha mahajan wrote:
> but I wanted to know that on what basis Action Names and their
> numbers are assigned for a particular architecture. I have
> checked out both x86 & ppc code.

These are based on the relocations and variable operand
substitutions needed for a particular instruction set.

> The build_actionlist is so confusing in itself. can you put some light
> on these aspects also.

Well, x86 has really complex rules for immediates, displacements
and relocations. This implies a complex set of actions to encode
them. DynASM for PowerPC has only 10 actions and should be easier
to understand.

But DynASM is just a tool used during the build step. There's no
need to understand its inner workings to understand LuaJIT.

> As action names are different from opcodes for a particular
> architecture.

Action names are based on operands, not on opcodes. E.g. look at
PPC 'addi reg, reg, simm16' with a variable immediate. This is
suffixed with an IMM action (signed=1, scale=0, bits=16, shift=0)
which inserts the immediate into the previous instruction.

--Mike

Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

Mike Pall-19
In reply to this post by 云帆江
江云帆 wrote:
> but is there any tutorial for implement llvm version Lua vm?

Someone has already done so: http://code.google.com/p/llvm-lua/
Alas, performance may be disappointing, as this is not one of its
main goals.

--Mike

Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

neha mahajan
In reply to this post by Erik Lindroos
Thanks Erik,

but I wanted to know why the implementation of ASM functions are in .dasc file, means we can implement the same in c with inline assembly functions. Then why this complex encoding engine[Dynasm] with its input source file.


On Wed, Sep 1, 2010 at 10:08 PM, Erik Lindroos <[hidden email]> wrote:
Hi,

I'm not Mike Pall, but I can tell you that the source to the interpreter (which becomes lj_vm.obj) is in buildvm_x86.dasc in the form of DynASM source. The functions mentioned simply implement different forms of function calls and are used by, for example, the similarly named Lua API functions.

/Erik


On Wed, Sep 1, 2010 at 1:34 PM, neha mahajan <[hidden email]> wrote:

Dear Sir,

we are very much impressed by the performance of LuaJIT.
 
we was going through the code, but we are unable to understand the assembler interface of vm i.e. lj_vm.s. we are unable to understand the basic functionality of this file so could you please through some light on these functions like lj_vm_pcall, lj_vm_cpcall, lj_vm_call etc.
 
we have already disassemble the lj_vm.s, but its corresponding pseudo code or logic functionality of these assembly functions are still missing.
your suggestion will be quite helpful.

Thanks,
Neha.





--
Neha Mahajan.
Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

neha mahajan
In reply to this post by Mike Pall-19
Mike can u comment something about the performance of llvm-lua and luajit on ARM ???
 
--Neha.

On Fri, Sep 3, 2010 at 4:38 PM, Mike Pall <[hidden email]> wrote:
江云帆 wrote:
> but is there any tutorial for implement llvm version Lua vm?

Someone has already done so: http://code.google.com/p/llvm-lua/
Alas, performance may be disappointing, as this is not one of its
main goals.

--Mike




--
Neha Mahajan.
Reply | Threaded
Open this post in threaded view
|

Re: Assembler Interface of LuaJIT VM.

Mike Pall-20
neha mahajan wrote:
> Mike can u comment something about the performance of llvm-lua and luajit on
> ARM ???

Well, since LuaJIT doesn't run on ARM (yet), there's no way to do
a real comparison.

But from early benchmarking of the PPC port, I would expect to see
similar performance ratios on all architectures. Possibly limited
by the lower FP-performance of non-x86/x64 chips. I.e. a future
LuaJIT on ARM would probably beat LLVM-Lua by a wide margin.

--Mike