Hi! Thanks for the fixes! LGTM   > >> >>+-- Those `rn` variables before and after `main_payload` are >> >>+-- required to generate enough register pressure (for GPR). Amount >> >>+-- of repeats is empirical. >> >>+-- Additional `test_f(...)` wrapper is needed for IR_VLOAD usage, >> >>+-- when `main_payload` is just `...`. >> >>+local function generate_payload(n_fillers, main_payload) >> >>+ local code_chunk = 'local function test_f(...)\n' >> >>+ code_chunk = code_chunk .. 'local r\n' >> >>+ for i = 1, n_fillers do >> >>+ code_chunk = code_chunk .. ('local rup%d\n'):format(i) >> >>+ end >> >>+ code_chunk = code_chunk .. 'for _ = 1, 4 do\n' >> >>+ for i = 1, n_fillers do >> >>+ code_chunk = code_chunk .. >> >>+ ('local r%d = ffi.cast("int", %d)\n'):format(i, i) >> >>+ end >> >>+ code_chunk = code_chunk .. 'r = ' .. main_payload .. '\n' >> >>+ for i = 1, n_fillers do >> >>+ code_chunk = code_chunk .. ('rup%d = r%d\n'):format(i, i) >> >>+ end >> >>+ code_chunk = code_chunk .. 'end\nend\n' >> >>+ code_chunk = code_chunk .. 'return test_f' >> >>+ local f, err = loadstring(code_chunk, 'test_function') >> >>+ assert(type(f) == 'function', err) >> >>+ f = f() >> >>+ assert(type(f) == 'function', 'returned generated value is not a function') >> >>+ return f >> >>+end >> >That section is really hard to read, is there any way to make it more >> >readable? I believe even slight reformatting might help. > >I've add the additional empty lines to separate cycle's body >generation. >Does it help? Yes, that is way better, thanks. -- Best regards, Maxim Kokryashkin