LjTools icon indicating copy to clipboard operation
LjTools copied to clipboard

LuaJIT bytecode generation for use with OpenResty

Open avolver opened this issue 4 years ago • 5 comments

Hello! Please upgrade LuaJIT dependency to version 2.1-20201027 from stable OpenResty 1.19.3.1 package (/bundle/LuaJIT-2.1-20201027/) and modify the bytecode generation for it.

This will make it possible to use Oberon (and smalltalk, etc) to develop modern web applications based on nginx+ngx_lua(jit).

avolver avatar Apr 08 '21 08:04 avolver

LJ 2.1 compatibility is on the list for the longer term. The differences between 2.0 and 2.1 in the bytecode are not that big. But I don't have the overview how the countless variants of LJ 2.1 differ. And at the moment I'm quite busy with other priorities (my new Oberon variant, and the debugger is still far from working the way I want). It's also questionable how many people actually want to use Oberon in OpenResty, and whether the Qt dependency won't get in the way.

rochus-keller avatar Apr 08 '21 09:04 rochus-keller

Thanks for the answer!

It's also questionable how many people actually want to use Oberon in OpenResty, and whether the Qt dependency won't get in the way.

No Qt dependency needed for use with OpenResty. The code will be written in the your Oberon IDE and exported LuaJIT bytecode will be used in ngx_lua bundled luajit.

avolver avatar Apr 08 '21 11:04 avolver

All of my stuff depends on Qt core (compiler, runtime, ide, you name it); I use Qt core instead of Boost.

rochus-keller avatar Apr 08 '21 12:04 rochus-keller

All of my stuff depends on Qt core

Yes, I understand. I mean — the OberonIDE is used to write code and compile a bytecode, which is exported (by "Export binary..." menu option) and executed in OpenResty as ljbc.

For example, I compiled an old version of the OpenResty (1.4.3.6), compatible with LuaJIT 2.0.5, slightly modified scripts/(obnlj|Out).lua and ran the assembled bytecode (ljbc file) in OpenResty.

You can see the result in the screenshot: oberon-resty

avolver avatar Apr 09 '21 19:04 avolver

Looks great; and you're lucky that Out.String and Out.ln are fully implemented in Lua; but have a look at ObLjbcGen.cpp, obnlj.lua, ObLjLib.cpp and ObLjLibFfi.cpp; depending on which Oberon features you use one of the latter two is involved, and ObLjLib.cpp is also dependent on Qt; the forthcoming Obx* implementation depends on Qt as well; getting rid of the Qt dependency requires quite some work, and even then you still need a native shared library.

rochus-keller avatar Apr 09 '21 20:04 rochus-keller