[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: [NoW] Luac crashes when trying to display undefined instruction
- From: Egor Skriptunoff <egor.skriptunoff@...>
- Date: Wed, 23 Jan 2019 23:42:18 +0300
"NoW" means "Nitpicking on Wednesdays"
(unimportant questions about Lua design and implementation)
"luac" fails to display a bytecode containing VM instruction with reserved opcode.
It would be better to display undefined instruction as four numbers (opcode,A,B,C) instead of get crashed.
Why it may be useful:
Some Lua scripting environments add new instructions to Lua VM.
For example, "GameGuardian" (a memory patching tool for cracking android games) implements Lua 5.2 with extended syntax.
Opcode 43 is reserved шn PUC Lua 5.2 VM, but in GameGuardian Lua VM this opcode is used for VM instruction "bitwise OR".
Yes, they have both the function "bit32.bor(x,y)" and the operator "x|y" simultaneously in the language.
I guess GameGuardian is not the only occasion when Lua implementation has new VM instructions added without modifying the original instructions.
It would be nice if such bytecode would be viewable with standard "luac" utility.
The "format" byte in the header of a GameGuardian bytecode is zero.