Open viruscamp opened 10 years ago
跳转的 LOADBOOL 只有这种形式 LOADBOOL R0 0 1 LOADBOOL R0 1 0
https://github.com/viruscamp/luadec/blob/master/lua-5.1/src/lcode.c#L400
local a,b,c,y
y = (a > b or c) -- assigne statement may be bool or value, bool is not calucated at last
--[[
[1] lt 1 1 0 ; R1 < R0, pc+=1 (goto [3]) if false
[2] jmp 3 ; pc+=3 (goto [6])
[3] move 3 2 ; R3 := R2
[4] jmp 2 ; pc+=2 (goto [7])
[5] loadbool 3 0 1 ; R3 := false; PC := pc+=1 (goto [7])
[6] loadbool 3 1 0 ; R3 := true
[7] return 0 1 ; return
]]--
当赋值语句值可能为 bool 或其他,且 bool 不是最后计算时
https://github.com/viruscamp/luadec/issues/8#issuecomment-96224579
单独的 OP_JMP 跳到 OP_LOADBOOL 且 sbc=2 时,与 #1 相关 在 ProcessCode case:OP_JMP 到下列分支
测试代码