lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 13/12/15 12:03 AM, Dibyendu Majumdar wrote:
On 13 December 2015 at 00:20, Soni L. <> wrote:
My aim is to generate a bytecode instruction that asserts the type of
an expression. I am treating the operator has a unary operator. Unlike
the existing unary operators the difference is that in this case the
bytecode has only one operand A which identifies a register - and the
bytecode asserts the type of the value held in that register. As this
is a unary operator then it can be used within expressions.

Why not add opcodes that push special (internal) functions on the stack? And
special-case them on the JIT?

That way you'd probably have less work to do.

Hi - actually that is harder to do as Lua doesn't know that a name is
a function and by the time a function call is identified, arguments
have already been pushed on to the stack. The approach I have taken
has low overhead as all it does is a type assertion on an existing

My approach so far has been to keep the existing Lua parser and code
generator - which is very fast and efficient - but because code is
generated as the parser proceeds, some things are hard to do. I may
end up creating a new parser that generates an AST first but I am
trying to avoid that.


I'm not talking about a name.


Exactly that code.

In lvm.c you make it push a hardcoded internal function.

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.