Lua-RTOS-ESP32
Lua-RTOS-ESP32 copied to clipboard
JIT bytecode optimizer fails on table init
On table init parameter values mixed up. This is the Lua code:
function border(e, x, y, h, rgb, buttons)
local dl = {
e.COLOR_RGB(rgb[1], rgb[2], rgb[3]),
e.BEGIN(e.RECTS),
e.LINE_WIDTH(480),
e.VERTEX2II(x + 30, y + 30),
e.VERTEX2II(511, h - 30),
e.END(),
VERTEX2II = function(x, y, handle, cell) -- FT800
print('---->', x, y, handle, cell)
return (2 << 30) | (x << 21) | (y << 12) | ((handle or 0) << 7) | (cell or 0)
end,
The call:
block.border1 = border(e, 0, 0, 272, {50, 102, 204}, {'Main', 'Calibrate', 'Log'})
Without optimizer the output is: ----> 30 30 nil nil ----> 511 242 nil nil
With optimizer: ----> 30 30 nil nil ----> 30 242 nil nil
The second parameter of the first line is inserted as the first parameter of the second (I found out through value variations). The 511 is ignored. When I comment out the first line, the value is a large, meaningless number.
Greetings André