[Tarantool-patches] [PATCH luajit 02/19] test: introduce mcode generator for tests
Sergey Bronnikov
sergeyb at tarantool.org
Wed Aug 16 17:32:40 MSK 2023
Hi, Sergey
Thanks for the patch!
Sergey
On 8/9/23 18:35, Sergey Kaplun wrote:
<snipped>
> ls/frontend.lua b/test/tarantool-tests/utils/frontend.lua
> index 2afebbb2..414257fd 100644
> --- a/test/tarantool-tests/utils/frontend.lua
> +++ b/test/tarantool-tests/utils/frontend.lua
> @@ -1,6 +1,10 @@
> local M = {}
>
> local bc = require('jit.bc')
> +local jutil = require('jit.util')
> +local vmdef = require('jit.vmdef')
> +local bcnames = vmdef.bcnames
> +local band, rshift = bit.band, bit.rshift
>
> function M.hasbc(f, bytecode)
> assert(type(f) == 'function', 'argument #1 should be a function')
> @@ -22,4 +26,24 @@ function M.hasbc(f, bytecode)
> return hasbc
> end
>
> +-- Get traceno of the trace assotiated for the given function.
> +function M.gettraceno(func)
> + assert(type(func) == 'function', 'argument #1 should be a function')
> +
> + -- The 0th BC is the header.
> + local func_ins = jutil.funcbc(func, 0)
> + local BC_NAME_LENGTH = 6
> + local RD_SHIFT = 16
Nit: AFAIK usually we left a comment with a source of constants.
<snipped>
More information about the Tarantool-patches
mailing list