标准Lua字节码和LuaJIT字节码之间的差异
我一直在尝试反编译 LuaJIT 字节码文件。我已设法将其拆卸(但找不到任何重新组装的方法)。所以我正在考虑编写一些软件来从 LuaJIT 字节码转换为标准 Lua 字节码,然后可以通过 LuaDec 正常运行。
但是 LuaJIT 字节码和标准 Lua 字节码有什么区别呢?
I've been trying to decompile a LuaJIT bytecode file. I have managed to disassemble it (but can't find any way to reassemble it). So I am considering writing some software to convert from LuaJIT bytecode to standard Lua bytecode that would then run through LuaDec fine.
But what are the differences between LuaJIT bytecode and standard Lua bytecode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
差异相当大。 LuaJIT 使用比标准 Lua 更多的操作码,因为它专门处理某些操作,例如从函数返回与返回 1 个返回值等。
您可以做的最好的事情就是比较 Lua 操作码 和 LuaJIT 操作码 看看你是否可以翻译他们之间,但这不会是微不足道的......
The differences are pretty substantial. LuaJIT uses a lot more opcodes than standard Lua, because it specializes on some operations, like returning from a function vs. returning with 1 return value, etc.
The best you could do is compare the definitions of Lua opcodes and LuaJIT opcodes and see if you could translate between them, but this not going to be trivial...
要获得确切的答案,您只需要比较两个项目的 BC 生成器即可,但是,为什么要麻烦使用转换器呢,LuaJIT 是开源的,IIRC 也是 LuaDec,将其转换为 LuaJIT 的字节码应该非常简单。
但是,你应该看看LuaJIT本身使用的命令行选项,有一些可以转储输出字节码列表,或者转储字节码的 C/h/obj/o 文件,这两种方法都可以用来做你想做的事情。
For an exact answer, you need only compare the BC generators from both projects, however, why bother with a converter, LuaJIT is open-source, and IIRC so is LuaDec, it should be pretty simple to convert it to LuaJIT's bytecode.
However, you should look at the the command-line options of LuaJIT itself of use, there are ones for dumping out the bytecode listing, or dumping out C/h/obj/o files of bytecode, both of which can be used to do what you want.