@@ -51,7 +51,7 @@ ifeq ($(strip $(USE_READLINE)),yes) C_SRC_FILES += completion.c endif -LUA_BASE_FILES = bspline.lua fft-init.lua integ-init.lua template.lua check.lua graph-init.lua rng.lua rnd.lua randist.lua iter.lua time.lua gsl-check.lua linfit.lua roots.lua contour.lua gsl.lua matrix.lua strict.lua csv.lua gslext.lua num.lua demo-init.lua import.lua plot3d.lua sf.lua vegas.lua +LUA_BASE_FILES = bspline.lua fft-init.lua integ-init.lua template.lua check.lua graph-init.lua rng.lua rnd.lua randist.lua iter.lua time.lua gsl-check.lua linfit.lua roots.lua contour.lua gsl.lua matrix.lua csv.lua gslext.lua num.lua demo-init.lua import.lua plot3d.lua sf.lua vegas.lua eigen.lua DEMOS_LIST = bspline fft plot wave-particle fractals ode nlinfit integ anim linfit contour svg graphics sf vegas LUA_TEMPLATES = gauss-kronrod-x-wgs qag rk8pd lmfit qng rkf45 ode-defs rk4 sf-defs vegas-defs diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp index 0b0f9a19..336d1bbd 100644 --- a/agg-plot/lua-plot.cpp +++ b/agg-plot/lua-plot.cpp @@ -68,7 +68,8 @@ static int plot_xlab_angle_get (lua_State *L); static int plot_ylab_angle_set (lua_State *L); static int plot_ylab_angle_get (lua_State *L); static int plot_set_categories (lua_State *L); -static int plot_set_mini (lua_State *L); +static int plot_set_legend (lua_State *L); +static int plot_get_legend (lua_State *L); static int plot_sync_mode_get (lua_State *L); static int plot_sync_mode_set (lua_State *L); @@ -108,7 +109,8 @@ static const struct luaL_Reg plot_methods[] = { {"save", bitmap_save_image }, {"save_svg", plot_save_svg }, {"set_categories", plot_set_categories}, - {"set_mini", plot_set_mini}, + {"set_legend", plot_set_legend}, + {"get_legend", plot_get_legend}, {NULL, NULL} }; @@ -229,6 +231,7 @@ objref_mref_add (lua_State *L, int table_index, int index, int value_index) lua_pop (L, 1); } + void plot_lua_add_ref (lua_State* L, int plot_index, int ref_index) { @@ -671,15 +674,12 @@ plot_set_categories (lua_State *L) return 0; } -int -plot_set_mini(lua_State *L) +static sg_plot::placement_e +char_to_placement_enum(lua_State* L, const char *s) { - sg_plot* p = object_check<sg_plot>(L, 1, GS_PLOT); - sg_plot* mp = object_check<sg_plot>(L, 2, GS_PLOT); - const char* placement = luaL_optstring(L, 3, "r"); sg_plot::placement_e pos; - char letter = placement[0]; + char letter = s[0]; if (letter == 'r') pos = sg_plot::right; else if (letter == 'l') @@ -689,14 +689,26 @@ plot_set_mini(lua_State *L) else if (letter == 't') pos = sg_plot::top; else - return luaL_error (L, "invalid mini plot placement specification."); + luaL_error (L, "invalid legend placement specification."); + + return pos; +} + +int +plot_set_legend(lua_State *L) +{ + sg_plot* p = object_check<sg_plot>(L, 1, GS_PLOT); + sg_plot* mp = object_check<sg_plot>(L, 2, GS_PLOT); + const char* placement = luaL_optstring(L, 3, "r"); + sg_plot::placement_e pos = char_to_placement_enum(L, placement); int ref_index = (1 << 16) + (int)pos; - lua_getfenv (L, 1); - objref_mref_add (L, -1, ref_index, 2); + lua_getfenv(L, 1); + lua_pushvalue(L, 2); + lua_rawseti(L, -2, ref_index); AGG_LOCK(); - p->add_mini_plot(mp, pos); + p->add_legend(mp, pos); AGG_UNLOCK(); plot_update_raw (L, p, 1); @@ -704,6 +716,18 @@ plot_set_mini(lua_State *L) return 0; } +int +plot_get_legend(lua_State *L) +{ + object_check<sg_plot>(L, 1, GS_PLOT); + const char* placement = luaL_optstring(L, 2, "r"); + sg_plot::placement_e pos = char_to_placement_enum(L, placement); + int ref_index = (1 << 16) + (int)pos; + lua_getfenv(L, 1); + lua_rawgeti(L, -1, ref_index); + return 1; +} + void plot_register (lua_State *L) { diff --git a/agg-plot/plot.h b/agg-plot/plot.h index 539b29c0..0a7a5e9e 100644 --- a/agg-plot/plot.h +++ b/agg-plot/plot.h @@ -138,7 +138,7 @@ public: { compute_user_trans(); for (unsigned k = 0; k < 4; k++) - m_mini_plot[k] = 0; + m_legend[k] = 0; }; virtual ~plot() @@ -156,10 +156,8 @@ public: str& x_axis_title() { return m_x_axis.title; } str& y_axis_title() { return m_y_axis.title; } - void add_mini_plot(plot* p, placement_e where) - { - m_mini_plot[where] = p; - } + void add_legend(plot* p, placement_e where) { m_legend[where] = p; } + plot* get_legend(placement_e where) { return m_legend[where]; } axis& get_axis(axis_e axis_dir) { @@ -256,7 +254,7 @@ protected: void draw_element(item& c, canvas_type &canvas, agg::trans_affine& m); void draw_axis(canvas_type& can, agg::trans_affine& m, agg::rect_base<int>* clip = 0); - agg::trans_affine draw_mini_plots(canvas_type& canvas, + agg::trans_affine draw_legends(canvas_type& canvas, agg::trans_affine& canvas_mtx); agg::trans_affine get_scaled_matrix(agg::trans_affine& canvas_mtx); @@ -295,7 +293,7 @@ private: bool m_sync_mode; axis m_x_axis, m_y_axis; - plot* m_mini_plot[4]; + plot* m_legend[4]; }; static double compute_scale(agg::trans_affine& m) @@ -368,7 +366,7 @@ template <class Canvas> void plot<VS,RM>::draw(Canvas& _canvas, agg::trans_affin agg::rect_base<int> clip = rect_of_slot_matrix<int>(canvas_mtx); - agg::trans_affine area_mtx = draw_mini_plots(canvas, canvas_mtx); + agg::trans_affine area_mtx = draw_legends(canvas, canvas_mtx); if (area_is_valid(area_mtx)) { @@ -572,7 +570,7 @@ static inline double approx_text_height(double text_size) } template <class VS, class RM> -agg::trans_affine plot<VS,RM>::draw_mini_plots(canvas_type& canvas, +agg::trans_affine plot<VS,RM>::draw_legends(canvas_type& canvas, agg::trans_affine& canvas_mtx) { const double sx = canvas_mtx.sx, sy = canvas_mtx.sy; @@ -607,7 +605,7 @@ agg::trans_affine plot<VS,RM>::draw_mini_plots(canvas_type& canvas, for (int k = 0; k < 4; k++) { - plot* mp = m_mini_plot[k]; + plot* mp = m_legend[k]; if (mp) { @@ -644,7 +642,8 @@ agg::trans_affine plot<VS,RM>::draw_mini_plots(canvas_type& canvas, if (px >= 0 && py >= 0 && px + dx < sx && py + dy < sy) { - agg::trans_affine mtx(dx, 0.0, 0.0, dy, px, py); + const double tx = canvas_mtx.tx, ty = canvas_mtx.ty; + agg::trans_affine mtx(dx, 0.0, 0.0, dy, tx + px, ty + py); mp->before_draw(); mp->draw_axis(canvas, mtx); mp->draw_elements(canvas, mtx); diff --git a/benchmarks/ode/ode-benchmark-rk8pd.lua b/benchmarks/ode/ode-benchmark-rk8pd.lua index 0ab54e8f..92d3d46b 100644 --- a/benchmarks/ode/ode-benchmark-rk8pd.lua +++ b/benchmarks/ode/ode-benchmark-rk8pd.lua @@ -15,11 +15,11 @@ local f = f_vanderpol_gen(10.0) local s = num.ode {N= 2, eps_abs= 1e-8, method= 'rk8pd'} local x, y = 1, 0 local t0, t1, h0 = 0, 20000, 0.01 -local evol = s.evolve +local step = s.step for k=1, 10 do s:init(t0, h0, f, x, y) while s.t < t1 do - evol(s, f, t1) + step(s, t1) end results[#results+1] = format('%g %g %g', s.t, s.y[1], s.y[2]) end diff --git a/benchmarks/ode/ode-benchmark.lua b/benchmarks/ode/ode-benchmark.lua index d0d71762..04236ab4 100644 --- a/benchmarks/ode/ode-benchmark.lua +++ b/benchmarks/ode/ode-benchmark.lua @@ -15,11 +15,11 @@ local f = f_vanderpol_gen(10.0) local s = num.ode {N= 2, eps_abs= 1e-8, method= 'rkf45'} local x, y = 1, 0 local t0, t1, h0 = 0, 20000, 0.01 -local evol = s.evolve +local step = s.step for k=1, 10 do s:init(t0, h0, f, x, y) while s.t < t1 do - evol(s, f, t1) + step(s, t1) end results[#results+1] = format('%g %g %g', s.t, s.y[1], s.y[2]) end diff --git a/benchmarks/plot-benchmark.lua b/benchmarks/plot-benchmark.lua index cfe1eb37..5608113f 100644 --- a/benchmarks/plot-benchmark.lua +++ b/benchmarks/plot-benchmark.lua @@ -84,7 +84,7 @@ local function htable_barplot(ht) local lgs = iter.ilist(|k| {fb[k], graph.webcolor(k), 'square'}, #fb) local lg = graph.legend(lgs) - p:set_mini(lg) + p:set_legend(lg) p:show() return p diff --git a/contour.lua b/contour.lua index 7d8e3278..1c3fc379 100644 --- a/contour.lua +++ b/contour.lua @@ -826,7 +826,7 @@ function contour.plot(f, x1, y1, x2, y2, options) if opt 'legend' then local lgd = g.create_legend() - p:set_mini(lgd) + p:set_legend(lgd) end if opt 'show' then p:show() end @@ -849,7 +849,7 @@ function contour.polar_plot(f, R, options) if opt 'legend' then local lgd = g.create_legend() - p:set_mini(lgd) + p:set_legend(lgd) end if opt 'lines' then g.draw_lines(p, 'black') end diff --git a/demos/ode.lua b/demos/ode.lua index b39374cc..2e4f5c75 100644 --- a/demos/ode.lua +++ b/demos/ode.lua @@ -20,39 +20,13 @@ use 'math' -function f_vanderpol_gen(mu) - return function(t, x, y) return y, -x + mu * y * (1-x^2) end -end - -local function xyodeplot(f, t0, t1, x0, y0, h0, tsmp) - local s = num.ode {N= 2, eps_abs= 1e-8, method='rk8pd'} - local evol = s.evolve - local ln = graph.path(x0, y0) - s:init(t0, h0, f, x0, y0) - for t = tsmp, t1, tsmp do - while s.t < t do - evol(s, f, t) - end - ln:line_to(s.y[1], s.y[2]) - end - - local p = graph.plot('ODE integration example') - p:addline(ln) - p:show() - return p -end - -- T is the period for the Poincare section local function poincareplot(f, t0, t1, x0, y0, h0, tsmp, T) local s = num.ode {N= 2, eps_abs= 1e-8, method='rk8pd'} - local evol = s.evolve s:init(t0, h0, f, x0, y0) local ln = graph.path(x0, y0) - for t = t0, t1, tsmp do - while s.t < t do - evol(s, f, t) - end - if t % T <= tsmp then ln:line_to(s.y[1], s.y[2]) end + for t, y1, y2 in s:evolve(t1, tsmp) do + if t % T <= tsmp then ln:line_to(y1, y2) end end local p = graph.plot('Poincare section') @@ -61,56 +35,54 @@ local function poincareplot(f, t0, t1, x0, y0, h0, tsmp, T) return p end -local function modeplot(s, f, t0, y0, t1, tsmp) - local n = #y0 - local t = {} - for k=1, n do t[k] = graph.path(t0, y0[k]) end - local evol = s.evolve - - if tsmp then - for t = tsmp, t1, tsmp do - while s.t < t do - evol(s, f, t) - end - for k=1, n do - t[k]:line_to(s.t, s.y[k]) - end - end - else - while s.t < t1 do - evol(s, f, t1) - for k=1, n do - t[k]:line_to(s.t, s.y[k]) - end - end +local function demo1() + local f = function(t, x, y) + return -y-x^2, 2*x - y^3 + end + + local x0, y0 = 1, 1 + local t0, t1 = 0, 30 + + local s = num.ode {N= 2, eps_abs= 1e-8, method='rk8pd'} + local ln = graph.path(x0, y0) + + s:init(t0, 1e-3, f, x0, y0) + for t, y1, y2 in s:evolve(t1, 0.04) do + ln:line_to(y1, y2) end local p = graph.plot('ODE integration example') - for k=1, n do p:addline(t[k], graph.rainbow(k)) end + p:addline(ln) p:show() return p end -local function demo1() - local odef = function(t, x, y) - return -y-x^2, 2*x - y^3 - end - - local x, y = 1, 1 - - return xyodeplot(odef, 0, 30, x, y, 1e-3, 0.04) +function f_vanderpol_gen(mu) + return function(t, x, y) return y, -x + mu * y * (1-x^2) end end local function demo2() local f = f_vanderpol_gen(10.0) local t0, t1, h = 0, 50, 0.01 - local y0 = {1, 0} + local x0, y0 = 1, 0 - local s = num.ode {N= 2, eps_abs= 1e-8} - s:init(t0, h, f, y0[1], y0[2]) + local s = num.ode {N= 2, eps_abs= 1e-8, methdo='rk8pd'} + s:init(t0, h, f, x0, y0) + + local ln1, ln2 = graph.path(t0, x0), graph.path(t0, y0) - return modeplot(s, f, t0, y0, t1) + while s.t <= t1 do + s:step(t1) + ln1:line_to(s.t, s.y[1]) + ln2:line_to(s.t, s.y[2]) + end + + local p = graph.plot('ODE integration example') + p:addline(ln1, 'red') + p:addline(ln2, 'blue') + p:show() + return p end local function f_sincos_damp(damp_f) @@ -124,14 +96,11 @@ local function demo3() local x, y = 1, 0 local s = num.ode {N= 2, eps_abs= 1e-8} local f = f_sincos_damp(damp_f) - local t0, t1, h0, hsamp = 0, 100, 1e-6, 0.5 + local t0, t1, h0, tsmp = 0, 100, 1e-6, 0.5 s:init(t0, h0, f, x, y) local ln = graph.path(t0, x) - for t= hsamp, t1, hsamp do - while s.t < t do - s:evolve(f, t) - end - ln:line_to(s.t, s.y[1]) + for t, y1 in s:evolve(t1, tsmp) do + ln:line_to(t, y1) end local p = graph.plot() p:addline(ln) @@ -164,20 +133,16 @@ local function demo5() local ln1 = graph.path(t0, x0) local ln2 = graph.path(t0, y0) - local evol = s.evolve s:init(t0, h0, f, x0, y0) - for t = tsmp, t1, tsmp do - while s.t < t do - evol(s, f, t) - end - ln1:line_to(s.t, s.y[1]) - ln2:line_to(s.t, s.y[2]) + for t, y1, y2 in s:evolve(t1, tsmp) do + ln1:line_to(t, y1) + ln2:line_to(t, y2) end local p = graph.plot('Lotka-Volterra ODE integration') p.clip = false - p:add(graph.marker(0, x0, 'cross', 8), 'red') + p:add(graph.marker(0, x0, 'circle', 8), 'red') p:add(graph.marker(0, y0, 'circle', 8), 'blue') p:add(graph.text(0.5, x0, 'Preys'), 'black') @@ -203,22 +168,19 @@ local function demo6() end local x0, y0, z0 = -1, 3, 4 - local t0, t1, h0, tsmp = 0, 30, 1e-3, 1e-3 + local t0, t1, h0 = 0, 30, 1e-3 local s = num.ode {N= 3, eps_abs= 1e-8, method='rk8pd'} - local evol = s.evolve + local step = s.step local lnxy = graph.path(x0, y0) local lnxz = graph.path(x0, z0) local lnyz = graph.path(y0, z0) - --local ln2 = graph.path(t0, y0) s:init(t0, h0, f, x0, y0, z0) - for t = tsmp, t1, tsmp do - while s.t < t do - evol(s, f, t) - end - lnxy:line_to(s.y[1], s.y[2]) - lnxz:line_to(s.y[1], s.y[3]) - lnyz:line_to(s.y[2], s.y[3]) + + for t, y1, y2, y3 in s:evolve(t1, 1e-3) do + lnxy:line_to(y1, y2) + lnxz:line_to(y1, y3) + lnyz:line_to(y2, y3) end local w = graph.window("v...") diff --git a/demos/plot.lua b/demos/plot.lua index 0bc56dc0..aa5273dd 100644 --- a/demos/plot.lua +++ b/demos/plot.lua @@ -137,7 +137,7 @@ local function legend_demo() mp.title = 'Plot example' mp.xtitle = 'x axis title' - mp:set_mini(p) + mp:set_legend(p) mp:save_svg('demo.svg', 600, 400) p:save_svg('legend.svg', 400, 200) diff --git a/doc/user-manual/eigen.rst b/doc/user-manual/eigen.rst new file mode 100644 index 00000000..e1098f77 --- /dev/null +++ b/doc/user-manual/eigen.rst @@ -0,0 +1,153 @@ +.. highlight:: lua +.. _eigensystems: +.. module:: eigen + +Eigensystems +======================= + +This chapter describes functions for computing eigenvalues and eigenvectors of matrices. +There are routines for real symmetric, real nonsymmetric, complex hermitian, real generalized symmetric-definite, complex generalized hermitian-definite, and real generalized nonsymmetric eigensystems. +Eigenvalues can be computed with or without eigenvectors. +The hermitian and real symmetric matrix algorithms are symmetric bidiagonalization followed by QR reduction. +The nonsymmetric algorithm is the Francis QR double-shift. The generalized nonsymmetric algorithm is the QZ method due to Moler and Stewart. + +Real Symmetric Matrices +--------------------------- + +.. function:: symm(A [, order]) + + This function computes the eigenvalues and eigenvectors of the real symmetric matrix A. The default ordering of the eigenvalues and eigenvectors is descending order in numerical value. + You can however choose from the following sorting shemes for the eigenvalues: + + 'desc' + descending order in numerical value + 'asc' + ascending order in numerical value + 'abs_asc' + ascending order in magnitude + 'abs_desc' + descending order in magnitude + 'none' + eigenvalue sorting + + The function returns:: + + eval, evec = symm(A, 'abs_asc') + + while the first eigenvalue correpsonds to the first eigenvector stored in the first column of the eigenvectors matrix. + For real symmetric matrices, the library uses the symmetric bidiagonalization and QR reduction method. + This is described in Golub & van Loan, section 8.3. The computed eigenvalues are accurate to an absolute accuracy of :math:`\epsilon ||m||_2`, where :math:`\epsilon` is the machine precision. + +Real Nonsymmetric Matrices +-------------------------- + +.. function:: non_symm(A [, order ] ]) + + The solution of the real nonsymmetric eigensystem problem for a matrix A involves computing the Schur decomposition + + :math:`A = Z T Z^T` + + where Z is an orthogonal matrix of Schur vectors and T, the Schur form, is quasi upper triangular with diagonal 1-by-1 blocks which are real eigenvalues of A, + and diagonal 2-by-2 blocks whose eigenvalues are complex conjugate eigenvalues of A. The algorithm used is the double-shift Francis method. + + This function computes eigenvalues and right eigenvectors of the n-by-n real nonsymmetric matrix A. + The computed eigenvectors are normalized to have unit magnitude. On output, the upper portion of A contains the Schur form T:: + + eval, evec, A = non_symm(A, 'abs_asc') + + +Complex Hermitian Matrices +---------------------------- + +.. function::herm(A [, order]) + + For hermitian matrices, the library uses the complex form of the symmetric bidiagonalization and QR reduction method. + This function computes the eigenvalues and eigenvectors of the complex hermitian matrix A + +Real Generalized Symmetric-Definite Eigensystems +------------------------------------------------- + +.. function:: gensymm(a, b) + + The real generalized symmetric-definite eigenvalue problem is to find eigenvalues \lambda and eigenvectors x such that + + .. math:: + A x = \lambda B x + + where A and B are symmetric matrices, and B is positive-definite. + This problem reduces to the standard symmetric eigenvalue problem by applying the Cholesky decomposition to B: + + .. math:: + A x = \lambda B x + + A x = \lambda L L^t x + + ( L^{-1} A L^{-t} ) L^t x = \lambda L^t x + + Therefore, the problem becomes :math:`C y = \lambda y` where :math:`C = L^{-1} A L^{-t}` is symmetric, and :math:`y = L^t x`. + The standard symmetric eigensolver can be applied to the matrix C. + The resulting eigenvectors are backtransformed to find the vectors of the original problem. + The eigenvalues and eigenvectors of the generalized symmetric-definite eigenproblem are always real. + +Complex Generalized Hermitian-Definite Eigensystems +------------------------------------------------------ + +.. function:: genherm(a, b) + + The complex generalized hermitian-definite eigenvalue problem is to find eigenvalues \lambda and eigenvectors x such that + + .. math:: + + A x = \lambda B x + + where A and B are hermitian matrices, and B is positive-definite. + Similarly to the real case, this can be reduced to :math:`C y = \lambda y` where :math:`C = L^{-1} A L^{-H}` is hermitian, + and :math:`y = L^H x`. The standard hermitian eigensolver can be applied to the matrix C. + The resulting eigenvectors are backtransformed to find the vectors of the original problem. + The eigenvalues of the generalized hermitian-definite eigenproblem are always real. + +Real Generalized Nonsymmetric Eigensystems +-------------------------------------------- + +.. function:: gen(a, b) + + Given two square matrices (A, B), the generalized nonsymmetric eigenvalue problem is to find eigenvalues \lambda and eigenvectors x such that + + .. math:: + + A x = \lambda B x + + We may also define the problem as finding eigenvalues \mu and eigenvectors y such that + + .. math:: + + \mu A y = B y + + Note that these two problems are equivalent (with \lambda = 1/\mu) if neither \lambda nor \mu is zero. If say, \lambda is zero, then it is still a well defined eigenproblem, but its alternate problem involving \mu is not. Therefore, to allow for zero (and infinite) eigenvalues, the problem which is actually solved is + + .. math:: + + \beta A x = \alpha B x + + The eigensolver routines below will return two values :math:`\alpha` and :math:`\beta` and leave it to the user + to perform the divisions :math:`\lambda = \alpha / \beta` and :math:`\mu = \beta / \alpha`. + + If the determinant of the matrix pencil :math:`A - \lambda B` is zero for all :math:`\lambda`, + the problem is said to be singular; otherwise it is called regular. + Singularity normally leads to some :math:`\alpha = \beta = 0` which means the eigenproblem is ill-conditioned + and generally does not have well defined eigenvalue solutions. + The routines below are intended for regular matrix pencils and could yield unpredictable results when applied to singular pencils. + + The solution of the real generalized nonsymmetric eigensystem problem for a matrix pair (A, B) + involves computing the generalized Schur decomposition + + .. math:: + + A = Q S Z^T + + B = Q T Z^T + + where Q and Z are orthogonal matrices of left and right Schur vectors respectively, + and (S, T) is the generalized Schur form whose diagonal elements give the :math:`\alpha` and :math:`\beta` values. + The algorithm used is the QZ method due to Moler and Stewart (see references). + diff --git a/doc/user-manual/graphics.rst b/doc/user-manual/graphics.rst index eebd3685..6b4c9e22 100644 --- a/doc/user-manual/graphics.rst +++ b/doc/user-manual/graphics.rst @@ -537,15 +537,19 @@ You can add elements to a plot in any moments even when it is already shown. GSL Two optional parameters can be given to specify the width and height of the drawing area. - .. method:: set_mini(p[, placement]) + .. method:: set_legend(p[, placement]) - Add the plot ``p`` as a small plot is the side area of the main plot. + Add the plot ``p`` as a legend is the side area of the main plot. The argument ``placement`` is used to give the placement of the mini plot and should be on of the letters 'l', 'r', 'b', 't'. They stands for "left", "right", "bottom" and "top" respectively. By default the placement of the mini plot is on the right side. - The mini plot is shown using an region of the drawing area are equal to the bounding box of the mini plot itself. - When rendered as a mini plot the plot coordinates and the screen coordinates are therefore in a one-to-one scale rapport. + The plot legend is drawn on the screen using an area that is equal, in pixal, to the logical size of the plot legend itself. + + .. method:: get_legend([placement]) + + Return the plot legend stored in the given ``placement``. + The placement parameter is interpreted as in the :meth:`~Plot.set_legend` method. .. method:: set_categories(axis, categories) diff --git a/doc/user-manual/index.rst b/doc/user-manual/index.rst index fdb6e8ec..0158c180 100644 --- a/doc/user-manual/index.rst +++ b/doc/user-manual/index.rst @@ -28,6 +28,7 @@ Contents: matrices.rst lua-base.rst linalg.rst + eigen.rst random.rst randist.rst pdf.rst diff --git a/doc/user-manual/ode.rst b/doc/user-manual/ode.rst index d74bf911..539e111d 100644 --- a/doc/user-manual/ode.rst +++ b/doc/user-manual/ode.rst @@ -74,7 +74,7 @@ and here the code that we can write to implement it:: -- the ODE solver is iterated till the time t1 is reached while s.t < t1 do - s:evolve(odef, t1) + s:step(t1) end In alternative you may want to make a plot of the curve that you obtain. Here an example, we create a "path" to describe the curve that we want to plot and then we iterate with the ODE solver and we add all the points with the "line_to" method. The we create an empty plot and we add the line that we have just created:: @@ -82,7 +82,7 @@ In alternative you may want to make a plot of the curve that you obtain. Here an -- we create a line and add the points obtained by integrating the ODE ln = graph.path(x0, y0) while s.t < t1 do - s:evolve(odef, t1) + s:step(t1) ln:line_to(s.y[1], s.y[2]) end @@ -97,6 +97,30 @@ And here the plot that you will obtain: Curve obtained by integration of the above ODE system. +A Slightly Improved Example +--------------------------- + +In the example given above we have used the :meth:`~ODE.step` method to advance the ODE integrator. +When you use :meth:`ODE.step` the ODE integrator will adapt at each step the step size in order to respect the maximum absolute and relative error that you requested. +This is a quite convenient behaviour but it can have a drawback since the sampling points can be very tightly packed or very largely spaced depending on the ODE system and the integration method. +In some cases this is undesirable and you may want to obtain the values with a fixed sampling size. +In this case you can use the :meth:`~ODE.evolve` method to obtain the values with a given sampling step. + +So, in the example above you can change the while loop and use the :meth:`~ODE.evolve` method instead:: + + -- we create a line and add the points obtained by integrating the ODE + ln = graph.path(x0, y0) + for t, y1, y2 in s:evolve(t1, 0.1) do + ln:line_to(y1, y2) + end + +to obtain values sampled with a spacing of 0.1 for the t values. + +You can see that the :meth:`~ODE.evolve` method works actually as a Lua iterator. + +You may also note that the :meth:`~ODE.evolve` iterator provides at each iteration the value t and each of the system variables in the standard order. + + ODE Solver Class Definition --------------------------- @@ -130,9 +154,22 @@ ODE Solver Class Definition It will be called like ``f(t, y_1, y_2, ..., y_N)`` where ``t`` is the time and ``y_1, y_2, ...`` are the values of the N independent values conventionally denoted here by 'y'. The function ``f`` should return N values that correspond to values ``f_i(t, y_1, ..., y_N)`` for each component ``f_i`` of the ODE system function. - .. method:: evolve(f, t1) + .. method:: step(t1) Advance the solution of the system by a step chosen adaptively based on the previous step size. The new values (t, y) are stored internally by the solver and can be retrieved as properties with the name ``t`` and ``y`` where the latter is a column matrix of size N. The new values of t will be less than or equal to the value given ``t1``. If the value ``s.t`` is less then ``t1`` then the function evolve should be called again by the user. + + .. method:: evolve(t1, t_step) + + Returns a Lua iterator that advance the ODE system at each iteration of a step ``t_step`` until the value ``t1`` is reached. + The iterators returns the value ``t`` itself and all the system variables ``y0``, ``y1``, ... in the standard order. + + Example:: + + -- we suppose an ODE system 's' is already defined and initialized + local t1 = 50 + for t, y1, y2 in s:evolve(t1, 0.5) do + print(t, y1, y2) + end diff --git a/eigen.lua b/eigen.lua new file mode 100644 index 00000000..ab30a52a --- /dev/null +++ b/eigen.lua @@ -0,0 +1,469 @@ +--Eigensystem module + +local ffi = require 'ffi' +local gsl = require 'gsl' + +local sqrt, abs = math.sqrt, math.abs +local format = string.format + +local check = require 'check' +local gsl_check = require'gsl-check' +local is_integer, is_real = check.is_integer, check.is_real +local matrix = require 'matrix' + +------------------------------------------------------------ + +--Eigensystem struct und function definitions +ffi.cdef[[ + +typedef struct { + size_t size; + double * d; + double * sd; +} gsl_eigen_symm_workspace; + +gsl_eigen_symm_workspace * gsl_eigen_symm_alloc (const size_t n); +void gsl_eigen_symm_free (gsl_eigen_symm_workspace * w); +int gsl_eigen_symm (gsl_matrix * A, gsl_vector * eval, gsl_eigen_symm_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * gc; + double * gs; +} gsl_eigen_symmv_workspace; + +gsl_eigen_symmv_workspace * gsl_eigen_symmv_alloc (const size_t n); +void gsl_eigen_symmv_free (gsl_eigen_symmv_workspace * w); +int gsl_eigen_symmv (gsl_matrix * A, gsl_vector * eval, gsl_matrix * evec, gsl_eigen_symmv_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * tau; +} gsl_eigen_herm_workspace; + +gsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n); +void gsl_eigen_herm_free (gsl_eigen_herm_workspace * w); +int gsl_eigen_herm (gsl_matrix_complex * A, gsl_vector * eval, + gsl_eigen_herm_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * tau; + double * gc; + double * gs; +} gsl_eigen_hermv_workspace; + +gsl_eigen_hermv_workspace * gsl_eigen_hermv_alloc (const size_t n); +void gsl_eigen_hermv_free (gsl_eigen_hermv_workspace * w); +int gsl_eigen_hermv (gsl_matrix_complex * A, gsl_vector * eval, + gsl_matrix_complex * evec, + gsl_eigen_hermv_workspace * w); + +typedef struct { + size_t size; /* matrix size */ + size_t max_iterations; /* max iterations since last eigenvalue found */ + size_t n_iter; /* number of iterations since last eigenvalue found */ + size_t n_evals; /* number of eigenvalues found so far */ + + int compute_t; /* compute Schur form T = Z^t A Z */ + + gsl_matrix *H; /* pointer to Hessenberg matrix */ + gsl_matrix *Z; /* pointer to Schur vector matrix */ +} gsl_eigen_francis_workspace; + +gsl_eigen_francis_workspace * gsl_eigen_francis_alloc (void); +void gsl_eigen_francis_free (gsl_eigen_francis_workspace * w); +void gsl_eigen_francis_T (const int compute_t, + gsl_eigen_francis_workspace * w); +int gsl_eigen_francis (gsl_matrix * H, gsl_vector_complex * eval, + gsl_eigen_francis_workspace * w); +int gsl_eigen_francis_Z (gsl_matrix * H, gsl_vector_complex * eval, + gsl_matrix * Z, + gsl_eigen_francis_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *diag; /* diagonal matrix elements from balancing */ + gsl_vector *tau; /* Householder coefficients */ + gsl_matrix *Z; /* pointer to Z matrix */ + int do_balance; /* perform balancing transformation? */ + size_t n_evals; /* number of eigenvalues found */ + + gsl_eigen_francis_workspace *francis_workspace_p; +} gsl_eigen_nonsymm_workspace; + +gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n); +void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w); +void gsl_eigen_nonsymm_params (const int compute_t, const int balance, + gsl_eigen_nonsymm_workspace *w); +int gsl_eigen_nonsymm (gsl_matrix * A, gsl_vector_complex * eval, + gsl_eigen_nonsymm_workspace * w); +int gsl_eigen_nonsymm_Z (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *work; /* scratch workspace */ + gsl_vector *work2; /* scratch workspace */ + gsl_vector *work3; /* scratch workspace */ + + gsl_matrix *Z; /* pointer to Schur vectors */ + + gsl_eigen_nonsymm_workspace *nonsymm_workspace_p; +} gsl_eigen_nonsymmv_workspace; + +gsl_eigen_nonsymmv_workspace * gsl_eigen_nonsymmv_alloc (const size_t n); +void gsl_eigen_nonsymmv_free (gsl_eigen_nonsymmv_workspace * w); +void gsl_eigen_nonsymmv_params (const int balance, + gsl_eigen_nonsymmv_workspace *w); +int gsl_eigen_nonsymmv (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix_complex * evec, + gsl_eigen_nonsymmv_workspace * w); +int gsl_eigen_nonsymmv_Z (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix_complex * evec, gsl_matrix * Z, + gsl_eigen_nonsymmv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_symm_workspace *symm_workspace_p; +} gsl_eigen_gensymm_workspace; + +gsl_eigen_gensymm_workspace * gsl_eigen_gensymm_alloc (const size_t n); +void gsl_eigen_gensymm_free (gsl_eigen_gensymm_workspace * w); +int gsl_eigen_gensymm (gsl_matrix * A, gsl_matrix * B, + gsl_vector * eval, gsl_eigen_gensymm_workspace * w); +int gsl_eigen_gensymm_standardize (gsl_matrix * A, const gsl_matrix * B); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_symmv_workspace *symmv_workspace_p; +} gsl_eigen_gensymmv_workspace; + +gsl_eigen_gensymmv_workspace * gsl_eigen_gensymmv_alloc (const size_t n); +void gsl_eigen_gensymmv_free (gsl_eigen_gensymmv_workspace * w); +int gsl_eigen_gensymmv (gsl_matrix * A, gsl_matrix * B, + gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_gensymmv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_herm_workspace *herm_workspace_p; +} gsl_eigen_genherm_workspace; + +gsl_eigen_genherm_workspace * gsl_eigen_genherm_alloc (const size_t n); +void gsl_eigen_genherm_free (gsl_eigen_genherm_workspace * w); +int gsl_eigen_genherm (gsl_matrix_complex * A, gsl_matrix_complex * B, + gsl_vector * eval, gsl_eigen_genherm_workspace * w); +int gsl_eigen_genherm_standardize (gsl_matrix_complex * A, + const gsl_matrix_complex * B); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_hermv_workspace *hermv_workspace_p; +} gsl_eigen_genhermv_workspace; + +gsl_eigen_genhermv_workspace * gsl_eigen_genhermv_alloc (const size_t n); +void gsl_eigen_genhermv_free (gsl_eigen_genhermv_workspace * w); +int gsl_eigen_genhermv (gsl_matrix_complex * A, gsl_matrix_complex * B, + gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_genhermv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *work; /* scratch workspace */ + + size_t n_evals; /* number of eigenvalues found */ + size_t max_iterations; /* maximum QZ iterations allowed */ + size_t n_iter; /* number of iterations since last eigenvalue found */ + double eshift; /* exceptional shift counter */ + + int needtop; /* need to compute top index? */ + + double atol; /* tolerance for splitting A matrix */ + double btol; /* tolerance for splitting B matrix */ + + double ascale; /* scaling factor for shifts */ + double bscale; /* scaling factor for shifts */ + + gsl_matrix *H; /* pointer to hessenberg matrix */ + gsl_matrix *R; /* pointer to upper triangular matrix */ + + int compute_s; /* compute generalized Schur form S */ + int compute_t; /* compute generalized Schur form T */ + + gsl_matrix *Q; /* pointer to left Schur vectors */ + gsl_matrix *Z; /* pointer to right Schur vectors */ +} gsl_eigen_gen_workspace; + +gsl_eigen_gen_workspace * gsl_eigen_gen_alloc (const size_t n); +void gsl_eigen_gen_free (gsl_eigen_gen_workspace * w); +void gsl_eigen_gen_params (const int compute_s, const int compute_t, + const int balance, gsl_eigen_gen_workspace * w); +int gsl_eigen_gen (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_eigen_gen_workspace * w); +int gsl_eigen_gen_QZ (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix * Q, gsl_matrix * Z, + gsl_eigen_gen_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + + gsl_vector *work1; /* 1-norm of columns of A */ + gsl_vector *work2; /* 1-norm of columns of B */ + gsl_vector *work3; /* real part of eigenvector */ + gsl_vector *work4; /* imag part of eigenvector */ + gsl_vector *work5; /* real part of back-transformed eigenvector */ + gsl_vector *work6; /* imag part of back-transformed eigenvector */ + + gsl_matrix *Q; /* pointer to left Schur vectors */ + gsl_matrix *Z; /* pointer to right Schur vectors */ + + gsl_eigen_gen_workspace *gen_workspace_p; +} gsl_eigen_genv_workspace; + +gsl_eigen_genv_workspace * gsl_eigen_genv_alloc (const size_t n); +void gsl_eigen_genv_free (gsl_eigen_genv_workspace * w); +int gsl_eigen_genv (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_eigen_genv_workspace * w); +int gsl_eigen_genv_QZ (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_matrix * Q, gsl_matrix * Z, + gsl_eigen_genv_workspace * w); + + + +typedef enum { + GSL_EIGEN_SORT_VAL_ASC, + GSL_EIGEN_SORT_VAL_DESC, + GSL_EIGEN_SORT_ABS_ASC, + GSL_EIGEN_SORT_ABS_DESC, + GSL_EIGEN_SORT_NONE +} +gsl_eigen_sort_t; + +/* Sort eigensystem results based on eigenvalues. + * Sorts in order of increasing value or increasing + * absolute value. + * + * exceptions: GSL_EBADLEN + */ + +int gsl_eigen_symmv_sort(gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_hermv_sort(gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_nonsymmv_sort(gsl_vector_complex * eval, + gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_gensymmv_sort (gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_genhermv_sort (gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_genv_sort (gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +/* Prototypes for the schur module */ + +int gsl_schur_gen_eigvals(const gsl_matrix *A, const gsl_matrix *B, + double *wr1, double *wr2, double *wi, + double *scale1, double *scale2); + +int gsl_schur_solve_equation(double ca, const gsl_matrix *A, double z, + double d1, double d2, const gsl_vector *b, + gsl_vector *x, double *s, double *xnorm, + double smin); + +int gsl_schur_solve_equation_z(double ca, const gsl_matrix *A, + gsl_complex *z, double d1, double d2, + const gsl_vector_complex *b, + gsl_vector_complex *x, double *s, + double *xnorm, double smin); + + +/* The following functions are obsolete: */ + +/* Eigensolve by Jacobi Method + * + * The data in the matrix input is destroyed. + * + * exceptions: + */ +int +gsl_eigen_jacobi(gsl_matrix * matrix, + gsl_vector * eval, + gsl_matrix * evec, + unsigned int max_rot, + unsigned int * nrot); + + +/* Invert by Jacobi Method + * + * exceptions: + */ +int +gsl_eigen_invert_jacobi(const gsl_matrix * matrix, + gsl_matrix * ainv, + unsigned int max_rot); +]] + +------------------------------------------------------------------------------- +eigen = {} + +order_lookup = { + asc = gsl.GSL_EIGEN_SORT_VAL_ASC, + desc = gsl.GSL_EIGEN_SORT_VAL_DESC, + abs_asc = gsl.GSL_EIGEN_SORT_ABS_ASC, + abs_desc = gsl.GSL_EIGEN_SORT_ABS_DESC, + none = gsl.GSL_EIGEN_SORT_NONE +} + +local SORT_NONE = gsl.GSL_EIGEN_SORT_NONE + +local function get_order(order) + local sel = order and order_lookup[order] or gsl.GSL_EIGEN_SORT_VAL_DESC + if not sel then error('invalid order specification: '..order, 3) end + return sel +end + +--Calculates the eigenvalues/eigenvectors of the symmetric matrix m +--the order can be used to determine the sorting of the eigenvalues according to their value +function eigen.symm(m, order) + local size = m.size1 + local A = matrix.copy(m) + local eval = matrix.alloc(size, 1) + local evec = matrix.alloc (size, size) + local xeval = gsl.gsl_matrix_column(eval, 0) + local order_sel = get_order(order) + + local w = gsl.gsl_eigen_symmv_alloc (size) + gsl_check(gsl.gsl_eigen_symmv (A, xeval, evec, w)) + gsl.gsl_eigen_symmv_free (w) + + if order_sel ~= SORT_NONE then + gsl.gsl_eigen_symmv_sort (xeval, evec, order_sel) + end + + return eval,evec +end + +--Calculates the eigenvalues/eigenvectors of the real nonsymmetric matrix m +--the order can be used to determine the sorting of the eigenvalues according to their value +function eigen.non_symm(m, order) + local size = m.size1 + local A = matrix.copy(m) + local eval = matrix.calloc(size, 1) + local evec = matrix.calloc (size, size) + local xeval = gsl.gsl_matrix_complex_column(eval, 0) + local order_sel = get_order(order) + + local w = gsl.gsl_eigen_nonsymmv_alloc (size) + gsl_check(gsl.gsl_eigen_nonsymmv (A, xeval, evec, w)) + gsl.gsl_eigen_nonsymmv_free (w) + + if order_sel ~= SORT_NONE then + gsl.gsl_eigen_nonsymmv_sort (xeval, evec, order_sel) + end + + return eval,evec +end + +function eigen.herm(m, order, eigenvalues_only) + local size = m.size1 + local A = matrix_complex.copy(m) + local eval = matrix.alloc(size, 1) + local xeval = gsl.gsl_matrix_column(eval, 0) + local evec = matrix.calloc (size, size) + local order_sel = get_order(order) + + local w = gsl.gsl_eigen_hermv_alloc (size) + gsl_check(gsl.gsl_eigen_hermv(A, xeval, evec, w)) + gsl.gsl_eigen_hermv_free (w) + + if order_sel ~= SORT_NONE then + gsl.gsl_eigen_hermv_sort (xeval, evec, order_sel) + end + + return eval,evec + +end + +function eigen.gensymm(a, b) + local size = a.size1 + local A = matrix.copy(a) + local B = matrix.copy(b) + local eval = matrix.alloc(size, 1) + local xeval = gsl.gsl_matrix_column(eval, 0) + local evec = matrix.alloc (size, size) + local order_sel = get_order(order) + + local w = gsl.gsl_eigen_gensymmv_alloc (size) + gsl_check(gsl.gsl_eigen_gensymmv(A,B, xeval, evec, w)) + gsl.gsl_eigen_gensymmv_free (w) + + if order_sel ~= SORT_NONE then + gsl.gsl_eigen_gensymmv_sort (xeval, evec, order_sel) + end + + return eval,evec +end + +function eigen.genherm(a, b) + local size = a.size1 + local A = matrix_complex.copy(a) + local B = matrix_complex.copy(b) + local eval = matrix.alloc(size, 1) + local xeval = gsl.gsl_matrix_column(eval, 0) + local evec = matrix.calloc (size, size) + local order_sel = get_order(order) + + local w = gsl.gsl_eigen_genhermv_alloc (size) + gsl_check(gsl.gsl_eigen_genhermv(A,B, xeval, evec, w)) + gsl.gsl_eigen_genhermv_free (w) + + if order_sel ~= SORT_NONE then + gsl.gsl_eigen_genhermv_sort (xeval, evec, order_sel) + end + + return eval,evec +end + +function eigen.gen(a, b) + local size = a.size1 + local A = matrix.copy(a) + local B = matrix.copy(b) + local alpha = matrix.calloc(size, 1) + local alpha_vec = gsl.gsl_matrix_complex_column(alpha, 0) + + local beta = matrix.alloc(size,size) + local beta_vec = gsl.gsl_matrix_column(beta, 0) + + local evec = matrix.calloc (size, size) + local order_sel = get_order(order) + + local w = gsl.gsl_eigen_genv_alloc (size) + gsl_check(gsl.gsl_eigen_genv(A,B, alpha_vec, beta_vec, evec, w)) + gsl.gsl_eigen_genv_free (w) + + if order_sel ~= SORT_NONE then + gsl.gsl_eigen_genv_sort (alpha_vec, beta_vec, evec, order_sel) + end + + return alpha, beta, evec +end diff --git a/gslext.lua b/gslext.lua index dc045784..aba7cecc 100644 --- a/gslext.lua +++ b/gslext.lua @@ -2,6 +2,7 @@ require('iter') require('matrix') +require('eigen') require('num') require('rng') require('rnd') diff --git a/luajit2/Makefile b/luajit2/Makefile index 5c8ea119..7f0eae2d 100644 --- a/luajit2/Makefile +++ b/luajit2/Makefile @@ -16,7 +16,7 @@ MAJVER= 2 MINVER= 0 RELVER= 0 -PREREL= -beta9 +PREREL= -beta10 VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL) ABIVER= 5.1 NODOTABIVER= 51 diff --git a/luajit2/README b/luajit2/README index 5d44efa4..56dd07f2 100644 --- a/luajit2/README +++ b/luajit2/README @@ -1,5 +1,5 @@ -README for LuaJIT 2.0.0-beta9 ------------------------------ +README for LuaJIT 2.0.0-beta10 +------------------------------ LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. diff --git a/luajit2/doc/bluequad.css b/luajit2/doc/bluequad.css index ffd32019..677962c4 100644 --- a/luajit2/doc/bluequad.css +++ b/luajit2/doc/bluequad.css @@ -193,6 +193,12 @@ img.right { .ext { color: #ff8000; } +.new { + font-size: 6pt; + vertical-align: middle; + background: #ff8000; + color: #ffffff; +} #site { clear: both; float: left; diff --git a/luajit2/doc/changes.html b/luajit2/doc/changes.html index 253df6d7..f3f8604c 100644 --- a/luajit2/doc/changes.html +++ b/luajit2/doc/changes.html @@ -54,13 +54,17 @@ div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; } <a href="http://luajit.org/performance.html">Performance <span >»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> <p> This is a list of changes between the released versions of LuaJIT.<br> -The current <span style="color: #c00000;">development version</span> is <strong>LuaJIT 2.0.0-beta9</strong>.<br> -The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT 1.1.7</strong>. +The current <span style="color: #c00000;">development version</span> is <strong>LuaJIT 2.0.0-beta10</strong>.<br> +The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT 1.1.8</strong>. </p> <p> Please check the @@ -69,6 +73,78 @@ to see whether newer versions are available. </p> <div class="major" style="background: #ffd0d0;"> +<h2 id="LuaJIT-2.0.0-beta10">LuaJIT 2.0.0-beta10 — 2012年05月09日</h2> +<ul> +<li>New features: +<ul> +<li>The MIPS of LuaJIT is complete. It requires a CPU conforming to the +MIPS32 R1 architecture with hardware FPU. O32 hard-fp ABI, +little-endian or big-endian.</li> +<li>Auto-detect target arch via cross-compiler. No need for +<tt>TARGET=arch</tt> anymore.</li> +<li>Make DynASM compatible with Lua 5.2.</li> +<li>From Lua 5.2: Try <tt>__tostring</tt> metamethod on non-string error +messages..</li> +</ul></li> +<li>Correctness and completeness: +<ul> +<li>Fix parsing of hex literals with exponents.</li> +<li>Fix bytecode dump for certain number constants.</li> +<li>Fix argument type in error message for relative arguments.</li> +<li>Fix argument error handling on Lua stacks without a frame.</li> +<li>Add missing mcode limit check in assembler backend.</li> +<li>Fix compilation on OpenBSD.</li> +<li>Avoid recursive GC steps after GC-triggered trace exit.</li> +<li>Replace <tt><unwind.h></tt> definitions with our own.</li> +<li>Fix OSX build issues. Bump minimum required OSX version to 10.4.</li> +<li>Fix discharge order of comparisons in Lua parser.</li> +<li>Ensure running <tt>__gc</tt> of userdata created in <tt>__gc</tt> +at state close.</li> +<li>Limit number of userdata <tt>__gc</tt> separations at state close.</li> +<li>Fix bytecode <tt>JMP</tt> slot range when optimizing +<tt>and</tt>/<tt>or</tt> with constant LHS.</li> +<li>Fix DSE of <tt>USTORE</tt>.</li> +<li>Make <tt>lua_concat()</tt> work from C hook with partial frame.</li> +<li>Add required PHIs for implicit conversions, e.g. via <tt>XREF</tt> +forwarding.</li> +<li>Add more comparison variants to Valgrind suppressions file.</li> +<li>Disable loading bytecode with an extra header (BOM or <tt>#!</tt>).</li> +<li>Fix PHI stack slot syncing.</li> +<li>ARM: Reorder type/value tests to silence Valgrind.</li> +<li>ARM: Fix register allocation for <tt>ldrd</tt>-optimized +<tt>HREFK</tt>.</li> +<li>ARM: Fix conditional branch fixup for <tt>OBAR</tt>.</li> +<li>ARM: Invoke SPLIT pass for <tt>double</tt> args in FFI call.</li> +<li>ARM: Handle all <tt>CALL*</tt> ops with <tt>double</tt> results in +SPLIT pass.</li> +<li>ARM: Fix rejoin of <tt>POW</tt> in SPLIT pass.</li> +<li>ARM: Fix compilation of <tt>math.sinh</tt>, <tt>math.cosh</tt>, +<tt>math.tanh</tt>.</li> +<li>ARM, PPC: Avoid pointless arg clearing in <tt>BC_IFUNCF</tt>.</li> +<li>PPC: Fix resume after yield from hook.</li> +<li>PPC: Fix argument checking for <tt>rawget()</tt>.</li> +<li>PPC: Fix fusion of floating-point <tt>XLOAD</tt>/<tt>XSTORE</tt>.</li> +<li>PPC: Fix <tt>HREFK</tt> code generation for huge tables.</li> +<li>PPC: Use builtin D-Cache/I-Cache sync code.</li> +</ul></li> +<li>FFI library: +<ul> +<li>Ignore empty statements in <tt>ffi.cdef()</tt>.</li> +<li>Ignore number parsing errors while skipping definitions.</li> +<li>Don't touch frame in callbacks with tailcalls to fast functions.</li> +<li>Fix library unloading on POSIX systems.</li> +<li>Finalize cdata before userdata when closing the state.</li> +<li>Change <tt>ffi.load()</tt> library name resolution for Cygwin.</li> +<li>Fix resolving of function name redirects on Windows/x86.</li> +<li>Fix symbol resolving error messages on Windows.</li> +<li>Fix blacklisting of C functions calling callbacks.</li> +<li>Fix result type of pointer difference.</li> +<li>Use correct PC in FFI metamethod error message.</li> +<li>Allow <tt>'typedef _Bool int BOOL;'</tt> for the Windows API.</li> +<li>Don't record test for bool result of call, if ignored.</li> +</ul></li> +</ul> + <h2 id="LuaJIT-2.0.0-beta9">LuaJIT 2.0.0-beta9 — 2011年12月14日</h2> <ul> <li>New features: @@ -405,6 +481,12 @@ no point in listing differences over earlier versions.</li> </div> <div class="major" style="background: #d0d0ff;"> +<h2 id="LuaJIT-1.1.8">LuaJIT 1.1.8 — 2012年04月16日</h2> +<ul> +<li>Merged with Lua 5.1.5. Also integrated fixes for all +<a href="http://www.lua.org/bugs.html#5.1.5"><span class="ext">»</span> <span class="ext">»</span> currently known bugs in Lua 5.1.5</a>.</li> +</ul> + <h2 id="LuaJIT-1.1.7">LuaJIT 1.1.7 — 2011年05月05日</h2> <ul> <li>Added fixes for the diff --git a/luajit2/doc/contact.html b/luajit2/doc/contact.html index 14c93295..aa725005 100644 --- a/luajit2/doc/contact.html +++ b/luajit2/doc/contact.html @@ -51,12 +51,16 @@ <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> <p> Please send general questions to the -<a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. +<a href="http://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a>. You can also send any questions you have directly to me: </p> diff --git a/luajit2/doc/ext_c_api.html b/luajit2/doc/ext_c_api.html index 416c141e..df4084bf 100644 --- a/luajit2/doc/ext_c_api.html +++ b/luajit2/doc/ext_c_api.html @@ -51,6 +51,10 @@ <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> diff --git a/luajit2/doc/ext_ffi.html b/luajit2/doc/ext_ffi.html index c12a781b..9a6200c6 100644 --- a/luajit2/doc/ext_ffi.html +++ b/luajit2/doc/ext_ffi.html @@ -57,6 +57,10 @@ pre.mark { padding-left: 2em; } <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> @@ -123,7 +127,7 @@ C function — Yes, it's that simple! Actually, what goes on behind the scenes is far from simple: <span style="color:#4040c0;">③</span> makes use of the standard C library namespace <tt>ffi.C</tt>. Indexing this namespace with -a symbol name (<tt>"printf"</tt>) automatically binds it to the the +a symbol name (<tt>"printf"</tt>) automatically binds it to the standard C library. The result is a special kind of object which, when called, runs the <tt>printf</tt> function. The arguments passed to this function are automatically converted from Lua objects to the diff --git a/luajit2/doc/ext_ffi_api.html b/luajit2/doc/ext_ffi_api.html index c85b8560..16066612 100644 --- a/luajit2/doc/ext_ffi_api.html +++ b/luajit2/doc/ext_ffi_api.html @@ -56,6 +56,10 @@ td.abiparam { font-weight: bold; width: 6em; } <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> diff --git a/luajit2/doc/ext_ffi_semantics.html b/luajit2/doc/ext_ffi_semantics.html index aac5ff5e..bacb4fb8 100644 --- a/luajit2/doc/ext_ffi_semantics.html +++ b/luajit2/doc/ext_ffi_semantics.html @@ -57,6 +57,10 @@ td.convop { font-style: italic; width: 16em; } <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> @@ -287,22 +291,24 @@ arguments to C calls: <tr class="odd separate"> <td class="convin">nil</td><td class="convop"><tt>NULL</tt> →</td><td class="convout"><tt>(void *)</tt></td></tr> <tr class="even"> -<td class="convin">userdata</td><td class="convop">userdata payload →</td><td class="convout"><tt>(void *)</tt></td></tr> -<tr class="odd"> <td class="convin">lightuserdata</td><td class="convop">lightuserdata address →</td><td class="convout"><tt>(void *)</tt></td></tr> -<tr class="even separate"> -<td class="convin">string</td><td class="convop">match against <tt>enum</tt> constant</td><td class="convout"><tt>enum</tt></td></tr> <tr class="odd"> -<td class="convin">string</td><td class="convop">copy string data + zero-byte</td><td class="convout"><tt>int8_t[]</tt>, <tt>uint8_t[]</tt></td></tr> +<td class="convin">userdata</td><td class="convop">userdata payload →</td><td class="convout"><tt>(void *)</tt></td></tr> <tr class="even"> -<td class="convin">string</td><td class="convop">string data →</td><td class="convout"><tt>const char[]</tt></td></tr> +<td class="convin">io.* file</td><td class="convop">get FILE * handle →</td><td class="convout"><tt>(void *)</tt></td></tr> <tr class="odd separate"> -<td class="convin">function</td><td class="convop"><a href="#callback">create callback</a> →</td><td class="convout">C function type</td></tr> +<td class="convin">string</td><td class="convop">match against <tt>enum</tt> constant</td><td class="convout"><tt>enum</tt></td></tr> +<tr class="even"> +<td class="convin">string</td><td class="convop">copy string data + zero-byte</td><td class="convout"><tt>int8_t[]</tt>, <tt>uint8_t[]</tt></td></tr> +<tr class="odd"> +<td class="convin">string</td><td class="convop">string data →</td><td class="convout"><tt>const char[]</tt></td></tr> <tr class="even separate"> +<td class="convin">function</td><td class="convop"><a href="#callback">create callback</a> →</td><td class="convout">C function type</td></tr> +<tr class="odd separate"> <td class="convin">table</td><td class="convop"><a href="#init_table">table initializer</a></td><td class="convout">Array</td></tr> -<tr class="odd"> +<tr class="even"> <td class="convin">table</td><td class="convop"><a href="#init_table">table initializer</a></td><td class="convout"><tt>struct</tt>/<tt>union</tt></td></tr> -<tr class="even separate"> +<tr class="odd separate"> <td class="convin">cdata</td><td class="convop">cdata payload →</td><td class="convout">C type</td></tr> </table> <p> @@ -722,6 +728,11 @@ of them is an <tt>uint64_t</tt>, the other side is converted to an both sides are converted to an <tt>int64_t</tt> and a signed comparison is performed.</li> +<li><b>Comparisons for equality/inequality</b> never raise an error. +Even incompatible pointers can be compared for equality by address. Any +other incompatible comparison (also with non-cdata objects) treats the +two sides as unequal.</li> + </ul> <h3 id="cdata_key">cdata objects as table keys</h3> diff --git a/luajit2/doc/ext_ffi_tutorial.html b/luajit2/doc/ext_ffi_tutorial.html index 802a2041..2b717526 100644 --- a/luajit2/doc/ext_ffi_tutorial.html +++ b/luajit2/doc/ext_ffi_tutorial.html @@ -64,6 +64,10 @@ td.idiomlua b { font-weight: normal; color: #2142bf; } <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> @@ -93,6 +97,11 @@ Please note this doesn't define an <tt>ffi</tt> variable in the table of globals — you really need to use the local variable. The <tt>require</tt> function ensures the library is only loaded once. </p> +<p style="font-size: 8pt;"> +Note: If you want to experiment with the FFI from the interactive prompt +of the command line executable, omit the <tt>local</tt>, as it doesn't +preserve local variables across lines. +</p> <h2 id="sleep">Accessing Standard System Functions</h2> <p> diff --git a/luajit2/doc/ext_jit.html b/luajit2/doc/ext_jit.html index 7fa2dc7f..6d683899 100644 --- a/luajit2/doc/ext_jit.html +++ b/luajit2/doc/ext_jit.html @@ -51,6 +51,10 @@ <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> diff --git a/luajit2/doc/extensions.html b/luajit2/doc/extensions.html index 9d6a4f20..a5baf11c 100644 --- a/luajit2/doc/extensions.html +++ b/luajit2/doc/extensions.html @@ -68,6 +68,10 @@ td.excinterop { <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> diff --git a/luajit2/doc/faq.html b/luajit2/doc/faq.html index f4bc9edd..a36e878d 100644 --- a/luajit2/doc/faq.html +++ b/luajit2/doc/faq.html @@ -54,26 +54,30 @@ dd { margin-left: 1.5em; } <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> <dl> -<dt>Q: Where can I learn more about Lua and LuaJIT?</dt> +<dt>Q: Where can I learn more about LuaJIT and Lua?</dt> <dd> <ul style="padding: 0;"> +<li>The <a href="http://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a> focuses on topics +related to LuaJIT.</li> +<li>The <a href="http://wiki.luajit.org/"><span class="ext">»</span> LuaJIT wiki</a> gathers community +resources about LuaJIT.</li> +<li>News about Lua itself can be found at the +<a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. +The mailing list archives are worth checking out for older postings +about LuaJIT.</li> <li>The <a href="http://lua.org"><span class="ext">»</span> main Lua.org site</a> has complete <a href="http://www.lua.org/docs.html"><span class="ext">»</span> documentation</a> of the language and links to books and papers about Lua.</li> <li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">»</span> Lua Wiki</a> has information about diverse topics.</li> -<li>The primary source of information for the latest developments surrounding -Lua is the <a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. -You can check out the <a href="http://lua-users.org/lists/lua-l/"><span class="ext">»</span> mailing -list archive</a> or -<a href="http://bazar2.conectiva.com.br/mailman/listinfo/lua"><span class="ext">»</span> subscribe</a> -to the list (you need to be subscribed before posting).<br> -This is also the place where announcements and discussions about LuaJIT -take place.</li> </ul> </dl> diff --git a/luajit2/doc/install.html b/luajit2/doc/install.html index 60253387..3731b305 100644 --- a/luajit2/doc/install.html +++ b/luajit2/doc/install.html @@ -80,6 +80,10 @@ td.compatno { <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> @@ -185,8 +189,8 @@ open a terminal window and change to this directory. Now unpack the archive and change to the newly created directory: </p> <pre class="code"> -tar zxf LuaJIT-2.0.0-beta9.tar.gz -cd LuaJIT-2.0.0-beta9</pre> +tar zxf LuaJIT-2.0.0-beta10.tar.gz +cd LuaJIT-2.0.0-beta10</pre> <h3>Building LuaJIT</h3> <p> The supplied Makefiles try to auto-detect the settings needed for your @@ -236,11 +240,11 @@ Obviously the prefixes given during build and installation need to be the same. <p style="color: #c00000;"> Note: to avoid overwriting a previous version, the beta test releases only install the LuaJIT executable under the versioned name (i.e. -<tt>luajit-2.0.0-beta9</tt>). You probably want to create a symlink +<tt>luajit-2.0.0-beta10</tt>). You probably want to create a symlink for convenience, with a command like this: </p> <pre class="code" style="color: #c00000;"> -sudo ln -sf luajit-2.0.0-beta9 /usr/local/bin/luajit +sudo ln -sf luajit-2.0.0-beta10 /usr/local/bin/luajit </pre> <h2 id="windows">Windows Systems</h2> diff --git a/luajit2/doc/luajit.html b/luajit2/doc/luajit.html index b96e5691..d8f20b35 100644 --- a/luajit2/doc/luajit.html +++ b/luajit2/doc/luajit.html @@ -52,6 +52,10 @@ <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> diff --git a/luajit2/doc/running.html b/luajit2/doc/running.html index b74ebd4a..e725f636 100644 --- a/luajit2/doc/running.html +++ b/luajit2/doc/running.html @@ -73,6 +73,10 @@ td.param_default { <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> @@ -85,11 +89,11 @@ interactive mode, too. <p class="indent" style="color: #c00000;"> Note: the beta test releases only install under the versioned name on POSIX systems (to avoid overwriting a previous version). You either need -to type <tt>luajit-2.0.0-beta9</tt> to start it or create a symlink +to type <tt>luajit-2.0.0-beta10</tt> to start it or create a symlink with a command like this: </p> <pre class="code" style="color: #c00000;"> -sudo ln -sf luajit-2.0.0-beta9 /usr/local/bin/luajit +sudo ln -sf luajit-2.0.0-beta10 /usr/local/bin/luajit </pre> <p> Unlike previous versions <b>optimization is turned on by default</b> in @@ -195,7 +199,7 @@ itself. For a description of their options and output format, please read the comment block at the start of their source. They can be found in the <tt>lib</tt> directory of the source distribution or installed under the <tt>jit</tt> directory. By default -this is <tt>/usr/local/share/luajit-2.0.0-beta9/jit</tt> on POSIX +this is <tt>/usr/local/share/luajit-2.0.0-beta10/jit</tt> on POSIX systems. </p> diff --git a/luajit2/doc/status.html b/luajit2/doc/status.html index dd16e71e..7ac04782 100644 --- a/luajit2/doc/status.html +++ b/luajit2/doc/status.html @@ -54,13 +54,17 @@ ul li { padding-bottom: 0.3em; } <a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a> </li><li> <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> +</li><li> +<a href="http://wiki.luajit.org/">Wiki <span class="ext">»</span></a> +</li><li> +<a href="http://luajit.org/list.html">Mailing List <span class="ext">»</span></a> </li></ul> </div> <div id="main"> <p> The <span style="color: #0000c0;">LuaJIT 1.x</span> series represents the current <span style="color: #0000c0;">stable branch</span>. -Only a single bug has been discovered in the last two years. So, if +Only a single bug has been discovered in the last three years. So, if you need a rock-solid VM, you are encouraged to fetch the latest release of LuaJIT 1.x from the <a href="http://luajit.org/download.html"><span class="ext">»</span> Download</a> page. @@ -68,10 +72,10 @@ page. <p> <span style="color: #c00000;">LuaJIT 2.0</span> is the currently active <span style="color: #c00000;">development branch</span>. -It has <b>Beta Test</b> status and is still undergoing -substantial changes. +It still has <b>Beta Test</b> status, but it's not undergoing substantial +changes anymore. It has <a href="http://luajit.org/performance.html"><span class="ext">»</span> much better performance</a> than LuaJIT 1.x. -It's maturing quickly, so you should definitely +It's nearly feature-complete, so you should definitely start to evaluate it for new projects right now. </p> @@ -86,8 +90,7 @@ rewritten from the ground up. Please report your findings together with the circumstances needed to reproduce the bug. If possible, reduce the problem down to a simple test case.<br> There is no formal bug tracker at the moment. The best place for -discussion is the -<a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. Of course +discussion is the <a href="http://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a>. Of course you may also send your bug reports <a href="contact.html">directly to me</a>, especially when they contain lengthy debug output or if you require confidentiality. diff --git a/luajit2/etc/luajit.pc b/luajit2/etc/luajit.pc index 974abde4..9fc4754a 100644 --- a/luajit2/etc/luajit.pc +++ b/luajit2/etc/luajit.pc @@ -2,7 +2,7 @@ majver=2 minver=0 relver=0 -version=${majver}.${minver}.${relver}-beta9 +version=${majver}.${minver}.${relver}-beta10 abiver=5.1 prefix=/usr/local diff --git a/luajit2/src/Makefile b/luajit2/src/Makefile index 314ede6a..e895b878 100644 --- a/luajit2/src/Makefile +++ b/luajit2/src/Makefile @@ -142,6 +142,7 @@ XCFLAGS= # # This define is required to run LuaJIT under Valgrind. The Valgrind # header files must be installed. You should enable debug information, too. +# Use --suppressions=lj.supp to avoid some false positives. #XCFLAGS+= -DLUAJIT_USE_VALGRIND # # This is the client for the GDB JIT API. GDB 7.0 or higher is required diff --git a/luajit2/src/buildvm_arm.dasc b/luajit2/src/buildvm_arm.dasc index 2e0914a1..6f0e3878 100644 --- a/luajit2/src/buildvm_arm.dasc +++ b/luajit2/src/buildvm_arm.dasc @@ -935,8 +935,8 @@ static void build_subroutines(BuildCtx *ctx) | ldrd CARG34, NODE:INS->key // STALL: early NODE:INS. | ldrd CARG12, NODE:INS->val | ldr NODE:INS, NODE:INS->next - | cmp CARG3, STR:RC - | checktpeq CARG4, LJ_TSTR + | checktp CARG4, LJ_TSTR + | cmpeq CARG3, STR:RC | beq >5 | cmp NODE:INS, #0 | bne <3 @@ -988,8 +988,11 @@ static void build_subroutines(BuildCtx *ctx) | |//-- Base library: conversions ------------------------------------------ | - |.ffunc_1 tonumber + |.ffunc tonumber | // Only handles the number case inline (without a base argument). + | ldrd CARG12, [BASE] + | cmp NARGS8:RC, #8 + | bne ->fff_fallback | checktp CARG2, LJ_TISNUM | bls ->fff_restv | b ->fff_fallback @@ -1300,6 +1303,7 @@ static void build_subroutines(BuildCtx *ctx) | b ->fff_restv | |2: // |x| < 1 + | bcs ->fff_restv // |x| is not finite. | orr CARG3, CARG3, CARG1 // ztest = abs(hi) | lo |.if "func" == "floor" | tst CARG3, CARG2, asr #31 // return (ztest & sign) == 0 ? 0 : -1 @@ -1805,6 +1809,7 @@ static void build_subroutines(BuildCtx *ctx) | bic CARG2, PC, #FRAME_TYPEP | ldreq INS, [PC, #-4] | andeq CARG2, MASKR8, INS, lsr #5 // Conditional decode_RA8. + | addeq CARG2, CARG2, #8 | sub RB, BASE, CARG2 | b ->vm_call_dispatch // Resolve again for tailcall. | @@ -2052,6 +2057,7 @@ static void build_subroutines(BuildCtx *ctx) | bx lr | |2: // |x| < 1: + | bxcs lr // |x| is not finite. | orr CARG3, CARG3, CARG1 // ztest = (2*hi) | lo |.if "func" == "floor" | tst CARG3, CARG2, asr #31 // iszero = ((ztest & signmask) == 0) @@ -3111,8 +3117,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | ldrd CARG12, NODE:INS->key // STALL: early NODE:INS. | ldrd CARG34, NODE:INS->val | ldr NODE:INS, NODE:INS->next - | cmp CARG1, STR:RC - | checktpeq CARG2, LJ_TSTR + | checktp CARG2, LJ_TSTR + | cmpeq CARG1, STR:RC | bne >4 | checktp CARG4, LJ_TNIL | beq >5 @@ -3242,8 +3248,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | ldrd CARG12, NODE:INS->key | ldr CARG4, NODE:INS->val.it | ldr NODE:CARG3, NODE:INS->next - | cmp CARG1, STR:RC - | checktpeq CARG2, LJ_TSTR + | checktp CARG2, LJ_TSTR + | cmpeq CARG1, STR:RC | bne >5 | ldrb CARG2, TAB:RB->marked | checktp CARG4, LJ_TNIL // Key found, but nil value? diff --git a/luajit2/src/buildvm_arm.h b/luajit2/src/buildvm_arm.h index 2c97cee0..aec421dd 100644 --- a/luajit2/src/buildvm_arm.h +++ b/luajit2/src/buildvm_arm.h @@ -12,7 +12,7 @@ #define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_SUB 1 #define DASM_MAXSECTION 2 -static const unsigned int build_actionlist[5777] = { +static const unsigned int build_actionlist[5784] = { 0x00010001, 0x00060014, 0xe3160000, @@ -796,9 +796,9 @@ static const unsigned int build_actionlist[5777] = { 0x000c8100, 0xe51ee000, 0x000d8180, -0xe152000b, -0x03730000, +0xe3730000, 0x000a0000, +0x0152000b, 0x0a000000, 0x00050005, 0xe35e0000, @@ -891,7 +891,7 @@ static const unsigned int build_actionlist[5777] = { 0x0006004d, 0xe1c900d0, 0xe35b0008, -0x3a000000, +0x1a000000, 0x00050046, 0xe3710000, 0x000a0000, @@ -1421,6 +1421,8 @@ static const unsigned int build_actionlist[5777] = { 0xea000000, 0x00050049, 0x0006000c, +0x2a000000, +0x00050049, 0xe1822000, 0xe1120fc1, 0x03a00000, @@ -1484,6 +1486,8 @@ static const unsigned int build_actionlist[5777] = { 0xea000000, 0x00050049, 0x0006000c, +0x2a000000, +0x00050049, 0xe1822000, 0xe1d22fc1, 0x03a00000, @@ -1501,9 +1505,9 @@ static const unsigned int build_actionlist[5777] = { 0x4a000000, 0x0005000b, 0x0006000e, +0x00000000, 0xeb000000, 0x0005005c, -0x00000000, 0xea000000, 0x00050049, 0x00040007, @@ -1563,11 +1567,11 @@ static const unsigned int build_actionlist[5777] = { 0xea000000, 0x0005000f, 0x0006005f, +0x00000000, 0xe1c900d0, 0xe35b0008, 0x3a000000, 0x00050046, -0x00000000, 0xe3710000, 0x000a0000, 0x2a000000, @@ -2711,6 +2715,7 @@ static const unsigned int build_actionlist[5777] = { 0x0516e004, 0x00020000, 0x000412ae, +0x02811008, 0xe049c001, 0xea000000, 0x00050024, @@ -2995,6 +3000,7 @@ static const unsigned int build_actionlist[5777] = { 0xe0c11002, 0xe12fff1e, 0x0006000c, +0x212fff1e, 0xe1822000, 0xe1120fc1, 0xe3a00000, @@ -3030,6 +3036,7 @@ static const unsigned int build_actionlist[5777] = { 0xe0c11002, 0xe12fff1e, 0x0006000c, +0x212fff1e, 0xe1822000, 0xe1d22fc1, 0xe3a00000, @@ -4613,9 +4620,9 @@ static const unsigned int build_actionlist[5777] = { 0x000c8100, 0xe51ee000, 0x000d8180, -0xe150000b, -0x03710000, +0xe3710000, 0x000a0000, +0x0150000b, 0x1a000000, 0x00050004, 0xe3730000, @@ -4807,9 +4814,9 @@ static const unsigned int build_actionlist[5777] = { 0x000d8180, 0xe51e2000, 0x000d8180, -0xe150000b, -0x03710000, +0xe3710000, 0x000a0000, +0x0150000b, 0x1a000000, 0x00050005, 0xe55c1000, @@ -6299,235 +6306,235 @@ static void build_subroutines(BuildCtx *ctx) dasm_put(Dst, 1246, Dt8(->upvalue[0].gcr), Dt1(->base), Dt1(->top), Dt1(->status), Dt1(->base), Dt1(->maxstack), Dt1(->cframe), LUA_YIELD, Dt1(->top), Dt1(->top), Dt1(->base), LJ_VMST_INTERP, Dt1(->top), DISPATCH_GL(vmstate), LUA_YIELD); dasm_put(Dst, 1302, Dt1(->base), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, Dt1(->cframe), Dt1(->base), CFRAME_RESUME, Dt1(->top)); dasm_put(Dst, 1361, LUA_YIELD, Dt1(->cframe), Dt1(->status), -LJ_TISNUM, ~LJ_TISNUM, ~LJ_TISNUM); - dasm_put(Dst, 1427, -LJ_TISNUM, ~LJ_TISNUM, ~LJ_TISNUM); - dasm_put(Dst, 1491, -LJ_TISNUM, (1+1)*8, FRAME_TYPE, ~LJ_TNIL); + dasm_put(Dst, 1429, -LJ_TISNUM, ~LJ_TISNUM, ~LJ_TISNUM); + dasm_put(Dst, 1493, -LJ_TISNUM, (1+1)*8, FRAME_TYPE, ~LJ_TNIL); dasm_put(Dst, 1555, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1560); + dasm_put(Dst, 1564); } - dasm_put(Dst, 1562); + dasm_put(Dst, 1566); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1565); + dasm_put(Dst, 1569); } - dasm_put(Dst, 1567, -LJ_TISNUM); + dasm_put(Dst, 1571, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1579); + dasm_put(Dst, 1583); } - dasm_put(Dst, 1581); + dasm_put(Dst, 1585); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1584); + dasm_put(Dst, 1588); } - dasm_put(Dst, 1586, -LJ_TISNUM); + dasm_put(Dst, 1590, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1598); + dasm_put(Dst, 1602); } - dasm_put(Dst, 1600); + dasm_put(Dst, 1604); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1603); + dasm_put(Dst, 1607); } - dasm_put(Dst, 1605, -LJ_TISNUM); + dasm_put(Dst, 1609, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1617); + dasm_put(Dst, 1621); } - dasm_put(Dst, 1619); + dasm_put(Dst, 1623); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1622); + dasm_put(Dst, 1626); } - dasm_put(Dst, 1624, -LJ_TISNUM); + dasm_put(Dst, 1628, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1636); + dasm_put(Dst, 1640); } - dasm_put(Dst, 1638); + dasm_put(Dst, 1642); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1641); + dasm_put(Dst, 1645); } - dasm_put(Dst, 1643, -LJ_TISNUM); + dasm_put(Dst, 1647, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1655); + dasm_put(Dst, 1659); } - dasm_put(Dst, 1657); + dasm_put(Dst, 1661); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1660); + dasm_put(Dst, 1664); } - dasm_put(Dst, 1662, -LJ_TISNUM); + dasm_put(Dst, 1666, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1674); + dasm_put(Dst, 1678); } - dasm_put(Dst, 1676); + dasm_put(Dst, 1680); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1679); + dasm_put(Dst, 1683); } - dasm_put(Dst, 1681, -LJ_TISNUM); + dasm_put(Dst, 1685, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1693); + dasm_put(Dst, 1697); } - dasm_put(Dst, 1695); + dasm_put(Dst, 1699); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1698); + dasm_put(Dst, 1702); } - dasm_put(Dst, 1700, -LJ_TISNUM); + dasm_put(Dst, 1704, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1712); + dasm_put(Dst, 1716); } - dasm_put(Dst, 1714); + dasm_put(Dst, 1718); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1717); + dasm_put(Dst, 1721); } - dasm_put(Dst, 1719, -LJ_TISNUM); + dasm_put(Dst, 1723, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1731); + dasm_put(Dst, 1735); } - dasm_put(Dst, 1733); + dasm_put(Dst, 1737); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1736); + dasm_put(Dst, 1740); } - dasm_put(Dst, 1738, -LJ_TISNUM); + dasm_put(Dst, 1742, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1750); + dasm_put(Dst, 1754); } - dasm_put(Dst, 1752); + dasm_put(Dst, 1756); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1755); + dasm_put(Dst, 1759); } - dasm_put(Dst, 1757, -LJ_TISNUM); + dasm_put(Dst, 1761, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1769); + dasm_put(Dst, 1773); } - dasm_put(Dst, 1771); + dasm_put(Dst, 1775); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1774); + dasm_put(Dst, 1778); } - dasm_put(Dst, 1776, -LJ_TISNUM); + dasm_put(Dst, 1780, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1788); + dasm_put(Dst, 1792); } - dasm_put(Dst, 1790); + dasm_put(Dst, 1794); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1793); + dasm_put(Dst, 1797); } - dasm_put(Dst, 1795, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 1799, -LJ_TISNUM, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1810); + dasm_put(Dst, 1814); } - dasm_put(Dst, 1812); + dasm_put(Dst, 1816); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1815); + dasm_put(Dst, 1819); } - dasm_put(Dst, 1817, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 1821, -LJ_TISNUM, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1832); + dasm_put(Dst, 1836); } - dasm_put(Dst, 1834); + dasm_put(Dst, 1838); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1837); + dasm_put(Dst, 1841); } - dasm_put(Dst, 1839, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 1843, -LJ_TISNUM, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1854); + dasm_put(Dst, 1858); } - dasm_put(Dst, 1856); + dasm_put(Dst, 1860); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1859); + dasm_put(Dst, 1863); } - dasm_put(Dst, 1861, -LJ_TISNUM, Dt8(->upvalue[0]), -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 1865, -LJ_TISNUM, Dt8(->upvalue[0]), -LJ_TISNUM, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1894); + dasm_put(Dst, 1898); } - dasm_put(Dst, 1896); + dasm_put(Dst, 1900); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1899); + dasm_put(Dst, 1903); } - dasm_put(Dst, 1901, -LJ_TISNUM); + dasm_put(Dst, 1905, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1914); + dasm_put(Dst, 1918); } - dasm_put(Dst, 1916); + dasm_put(Dst, 1920); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1919); + dasm_put(Dst, 1923); } - dasm_put(Dst, 1921, ~LJ_TISNUM, (2+1)*8, -LJ_TISNUM); + dasm_put(Dst, 1925, ~LJ_TISNUM, (2+1)*8, -LJ_TISNUM); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1943); + dasm_put(Dst, 1947); } - dasm_put(Dst, 1945); + dasm_put(Dst, 1949); if (LJ_TARGET_OSX) { - dasm_put(Dst, 1948); + dasm_put(Dst, 1952); } - dasm_put(Dst, 1950, (2+1)*8, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM); - dasm_put(Dst, 2001, -LJ_TISNUM, -LJ_TISNUM); - dasm_put(Dst, 2055, -LJ_TISNUM, -LJ_TSTR, Dt5(->len), ~LJ_TISNUM, -LJ_TSTR, Dt5(->len), Dt5([1])); - dasm_put(Dst, 2109, ~LJ_TISNUM, (0+1)*8, (1+1)*8, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TISNUM, Dt1(->base), Dt1(->base), ~LJ_TSTR, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); - dasm_put(Dst, 2168, -LJ_TISNUM, -LJ_TSTR, Dt5(->len), -LJ_TISNUM, sizeof(GCstr)-1, -DISPATCH_GL(strempty), ~LJ_TSTR, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TSTR, -LJ_TISNUM, Dt5(->len)); - dasm_put(Dst, 2230, DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), Dt5([1]), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), sizeof(GCstr)); - dasm_put(Dst, 2283, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), sizeof(GCstr), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); - dasm_put(Dst, 2343, -LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), sizeof(GCstr), -LJ_TTAB); + dasm_put(Dst, 1954, (2+1)*8, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 2005, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 2059, -LJ_TISNUM, -LJ_TSTR, Dt5(->len), ~LJ_TISNUM, -LJ_TSTR, Dt5(->len), Dt5([1])); + dasm_put(Dst, 2113, ~LJ_TISNUM, (0+1)*8, (1+1)*8, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TISNUM, Dt1(->base), Dt1(->base), ~LJ_TSTR, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); + dasm_put(Dst, 2172, -LJ_TISNUM, -LJ_TSTR, Dt5(->len), -LJ_TISNUM, sizeof(GCstr)-1, -DISPATCH_GL(strempty), ~LJ_TSTR, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TSTR, -LJ_TISNUM, Dt5(->len)); + dasm_put(Dst, 2234, DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), Dt5([1]), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), sizeof(GCstr)); + dasm_put(Dst, 2287, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), -LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), sizeof(GCstr), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); + dasm_put(Dst, 2347, -LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), DISPATCH_GL(tmpbuf.buf), sizeof(GCstr), -LJ_TTAB); if (LJ_TARGET_OSX) { - dasm_put(Dst, 2381); + dasm_put(Dst, 2385); } - dasm_put(Dst, 2383); + dasm_put(Dst, 2387); if (LJ_TARGET_OSX) { - dasm_put(Dst, 2386); + dasm_put(Dst, 2390); } - dasm_put(Dst, 2388, ~LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM); - dasm_put(Dst, 2459, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM); - dasm_put(Dst, 2519, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM); - dasm_put(Dst, 2575, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM); - dasm_put(Dst, 2632, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, Dt1(->maxstack), Dt1(->top), Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->base), Dt1(->top), Dt7(->field_pc), FRAME_TYPE, FRAME_TYPEP); - dasm_put(Dst, 2695, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base)); + dasm_put(Dst, 2392, ~LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 2463, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM); + dasm_put(Dst, 2523, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 2579, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM); + dasm_put(Dst, 2636, -LJ_TISNUM, -LJ_TISNUM, ~LJ_TISNUM, Dt1(->maxstack), Dt1(->top), Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->base), Dt1(->top), Dt7(->field_pc), FRAME_TYPE, FRAME_TYPEP); + dasm_put(Dst, 2699, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base)); #if LJ_HASJIT - dasm_put(Dst, 2729, DISPATCH_GL(hookmask), HOOK_VMEVENT, DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount)); + dasm_put(Dst, 2734, DISPATCH_GL(hookmask), HOOK_VMEVENT, DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount)); #endif - dasm_put(Dst, 2749, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount), LUA_MASKLINE, Dt1(->base), Dt1(->base)); - dasm_put(Dst, 2795, GG_DISP2STATIC); + dasm_put(Dst, 2754, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount), LUA_MASKLINE, Dt1(->base), Dt1(->base)); + dasm_put(Dst, 2800, GG_DISP2STATIC); #if LJ_HASJIT - dasm_put(Dst, 2811, -GG_DISP2J, Dt7(->field_pc), DISPATCH_J(L), PC2PROTO(framesize), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 2816, -GG_DISP2J, Dt7(->field_pc), DISPATCH_J(L), PC2PROTO(framesize), Dt1(->base), Dt1(->top)); #endif - dasm_put(Dst, 2832); + dasm_put(Dst, 2837); #if LJ_HASJIT - dasm_put(Dst, 2835); + dasm_put(Dst, 2840); #endif - dasm_put(Dst, 2838); + dasm_put(Dst, 2843); #if LJ_HASJIT - dasm_put(Dst, 2840); + dasm_put(Dst, 2845); #endif - dasm_put(Dst, 2843, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 2848, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); #if LJ_HASJIT - dasm_put(Dst, 2866, LJ_VMST_EXIT, DISPATCH_GL(vmstate), DISPATCH_GL(jit_L), DISPATCH_GL(jit_base), DISPATCH_J(exitno), DISPATCH_J(L), Dt1(->base), DISPATCH_GL(jit_L), -GG_DISP2J, Dt1(->cframe), Dt1(->base), ~CFRAME_RAWMASK); + dasm_put(Dst, 2871, LJ_VMST_EXIT, DISPATCH_GL(vmstate), DISPATCH_GL(jit_L), DISPATCH_GL(jit_base), DISPATCH_J(exitno), DISPATCH_J(L), Dt1(->base), DISPATCH_GL(jit_L), -GG_DISP2J, Dt1(->cframe), Dt1(->base), ~CFRAME_RAWMASK); #endif - dasm_put(Dst, 2914); + dasm_put(Dst, 2919); #if LJ_HASJIT - dasm_put(Dst, 2916, Dt7(->field_pc), DISPATCH_GL(jit_L), LJ_VMST_INTERP, PC2PROTO(k), DISPATCH_GL(vmstate), BC_FUNCF); + dasm_put(Dst, 2921, Dt7(->field_pc), DISPATCH_GL(jit_L), LJ_VMST_INTERP, PC2PROTO(k), DISPATCH_GL(vmstate), BC_FUNCF); #endif - dasm_put(Dst, 2953); + dasm_put(Dst, 2958); #if LJ_HASJIT - dasm_put(Dst, 3027); + dasm_put(Dst, 3034); #endif - dasm_put(Dst, 3041); + dasm_put(Dst, 3048); { int i; for (i = 31; i >= 0; i--) { - dasm_put(Dst, 3077, i, i); + dasm_put(Dst, 3084, i, i); } } - dasm_put(Dst, 3082); + dasm_put(Dst, 3089); #if LJ_HASJIT - dasm_put(Dst, 3111); + dasm_put(Dst, 3118); #else - dasm_put(Dst, 3136); + dasm_put(Dst, 3143); #endif - dasm_put(Dst, 3138); + dasm_put(Dst, 3145); #if LJ_HASFFI #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V) - dasm_put(Dst, 3140, Dt2(->ctype_state), GG_G2DISP, DtE(->cb.gpr[0]), DtE(->cb.gpr[2]), CFRAME_SIZE, DtE(->cb.stack), DtE(->cb.slot), Dt1(->base), LJ_VMST_INTERP, Dt1(->top), DISPATCH_GL(vmstate), Dt7(->field_pc)); + dasm_put(Dst, 3147, Dt2(->ctype_state), GG_G2DISP, DtE(->cb.gpr[0]), DtE(->cb.gpr[2]), CFRAME_SIZE, DtE(->cb.stack), DtE(->cb.slot), Dt1(->base), LJ_VMST_INTERP, Dt1(->top), DISPATCH_GL(vmstate), Dt7(->field_pc)); #endif - dasm_put(Dst, 3183); + dasm_put(Dst, 3190); #if LJ_HASFFI - dasm_put(Dst, 3185, DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0])); + dasm_put(Dst, 3192, DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0])); #endif - dasm_put(Dst, 3202); + dasm_put(Dst, 3209); #if LJ_HASFFI #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) - dasm_put(Dst, 3204, DtF(->spadj), DtF(->nsp), offsetof(CCallState, stack), DtF(->func), DtF(->gpr[0]), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3]), DtF(->gpr[0]), DtF(->gpr[1])); + dasm_put(Dst, 3211, DtF(->spadj), DtF(->nsp), offsetof(CCallState, stack), DtF(->func), DtF(->gpr[0]), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3]), DtF(->gpr[0]), DtF(->gpr[1])); #endif } @@ -6535,7 +6542,7 @@ static void build_subroutines(BuildCtx *ctx) static void build_ins(BuildCtx *ctx, BCOp op, int defop) { int vk = 0; - dasm_put(Dst, 3242, defop); + dasm_put(Dst, 3249, defop); switch (op) { @@ -6544,174 +6551,174 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) /* Remember: all ops branch for a true comparison, fall through otherwise. */ case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: - dasm_put(Dst, 3244, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3251, -LJ_TISNUM, -LJ_TISNUM); if (op == BC_ISLT) { - dasm_put(Dst, 3260); + dasm_put(Dst, 3267); } else if (op == BC_ISGE) { - dasm_put(Dst, 3262); + dasm_put(Dst, 3269); } else if (op == BC_ISLE) { - dasm_put(Dst, 3264); + dasm_put(Dst, 3271); } else { - dasm_put(Dst, 3266); + dasm_put(Dst, 3273); } - dasm_put(Dst, 3268, -LJ_TISNUM); + dasm_put(Dst, 3275, -LJ_TISNUM); if (op == BC_ISLT) { - dasm_put(Dst, 3304); + dasm_put(Dst, 3311); } else if (op == BC_ISGE) { - dasm_put(Dst, 3306); + dasm_put(Dst, 3313); } else if (op == BC_ISLE) { - dasm_put(Dst, 3308); + dasm_put(Dst, 3315); } else { - dasm_put(Dst, 3310); + dasm_put(Dst, 3317); } - dasm_put(Dst, 3312); + dasm_put(Dst, 3319); break; case BC_ISEQV: case BC_ISNEV: vk = op == BC_ISEQV; - dasm_put(Dst, 3315, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3322, -LJ_TISNUM, -LJ_TISNUM); if (vk) { - dasm_put(Dst, 3326); + dasm_put(Dst, 3333); } else { - dasm_put(Dst, 3329); + dasm_put(Dst, 3336); } if (LJ_HASFFI) { - dasm_put(Dst, 3332, -LJ_TCDATA, -LJ_TCDATA); + dasm_put(Dst, 3339, -LJ_TCDATA, -LJ_TCDATA); } - dasm_put(Dst, 3339, -LJ_TISPRI); + dasm_put(Dst, 3346, -LJ_TISPRI); if (vk) { - dasm_put(Dst, 3348, -LJ_TISTABUD); + dasm_put(Dst, 3355, -LJ_TISTABUD); } else { - dasm_put(Dst, 3365, -LJ_TISTABUD); + dasm_put(Dst, 3372, -LJ_TISTABUD); } - dasm_put(Dst, 3372, Dt6(->metatable)); + dasm_put(Dst, 3379, Dt6(->metatable)); if (vk) { - dasm_put(Dst, 3376); + dasm_put(Dst, 3383); } else { - dasm_put(Dst, 3379); + dasm_put(Dst, 3386); } - dasm_put(Dst, 3382, Dt6(->nomm), 1-vk, 1<<MM_eq); + dasm_put(Dst, 3389, Dt6(->nomm), 1-vk, 1<<MM_eq); if (vk) { - dasm_put(Dst, 3392); + dasm_put(Dst, 3399); } else { - dasm_put(Dst, 3395); + dasm_put(Dst, 3402); } break; case BC_ISEQS: case BC_ISNES: vk = op == BC_ISEQS; - dasm_put(Dst, 3405, -LJ_TSTR); + dasm_put(Dst, 3412, -LJ_TSTR); if (LJ_HASFFI) { - dasm_put(Dst, 3414); + dasm_put(Dst, 3421); } else { - dasm_put(Dst, 3418); + dasm_put(Dst, 3425); } if (vk) { - dasm_put(Dst, 3420); + dasm_put(Dst, 3427); } else { - dasm_put(Dst, 3423); + dasm_put(Dst, 3430); } - dasm_put(Dst, 3426); + dasm_put(Dst, 3433); if (LJ_HASFFI) { - dasm_put(Dst, 3433, -LJ_TCDATA); + dasm_put(Dst, 3440, -LJ_TCDATA); } break; case BC_ISEQN: case BC_ISNEN: vk = op == BC_ISEQN; - dasm_put(Dst, 3441); + dasm_put(Dst, 3448); if (vk) { - dasm_put(Dst, 3448); + dasm_put(Dst, 3455); } else { - dasm_put(Dst, 3450); + dasm_put(Dst, 3457); } - dasm_put(Dst, 3452, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3459, -LJ_TISNUM, -LJ_TISNUM); if (vk) { - dasm_put(Dst, 3462); + dasm_put(Dst, 3469); } else { - dasm_put(Dst, 3465); + dasm_put(Dst, 3472); } - dasm_put(Dst, 3468); + dasm_put(Dst, 3475); if (LJ_HASFFI) { - dasm_put(Dst, 3477); + dasm_put(Dst, 3484); } else { if (!vk) { - dasm_put(Dst, 3480); + dasm_put(Dst, 3487); } - dasm_put(Dst, 3482); + dasm_put(Dst, 3489); } - dasm_put(Dst, 3485, -LJ_TISNUM); + dasm_put(Dst, 3492, -LJ_TISNUM); if (vk) { - dasm_put(Dst, 3501); + dasm_put(Dst, 3508); } else { - dasm_put(Dst, 3503); + dasm_put(Dst, 3510); } - dasm_put(Dst, 3505); + dasm_put(Dst, 3512); if (LJ_HASFFI) { - dasm_put(Dst, 3508, -LJ_TCDATA); + dasm_put(Dst, 3515, -LJ_TCDATA); } break; case BC_ISEQP: case BC_ISNEP: vk = op == BC_ISEQP; - dasm_put(Dst, 3516); + dasm_put(Dst, 3523); if (LJ_HASFFI) { - dasm_put(Dst, 3522, -LJ_TCDATA); + dasm_put(Dst, 3529, -LJ_TCDATA); } - dasm_put(Dst, 3527); + dasm_put(Dst, 3534); if (vk) { - dasm_put(Dst, 3529); + dasm_put(Dst, 3536); } else { - dasm_put(Dst, 3531); + dasm_put(Dst, 3538); } - dasm_put(Dst, 3533); + dasm_put(Dst, 3540); break; /* -- Unary test and copy ops ------------------------------------------- */ case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: - dasm_put(Dst, 3540, -LJ_TTRUE); + dasm_put(Dst, 3547, -LJ_TTRUE); if (op == BC_ISTC || op == BC_IST) { - dasm_put(Dst, 3548); + dasm_put(Dst, 3555); if (op == BC_ISTC) { - dasm_put(Dst, 3550); + dasm_put(Dst, 3557); } } else { - dasm_put(Dst, 3552); + dasm_put(Dst, 3559); if (op == BC_ISFC) { - dasm_put(Dst, 3554); + dasm_put(Dst, 3561); } } - dasm_put(Dst, 3556); + dasm_put(Dst, 3563); break; /* -- Unary ops --------------------------------------------------------- */ case BC_MOV: - dasm_put(Dst, 3563); + dasm_put(Dst, 3570); break; case BC_NOT: - dasm_put(Dst, 3573, -LJ_TTRUE, ~LJ_TFALSE, ~LJ_TTRUE); + dasm_put(Dst, 3580, -LJ_TTRUE, ~LJ_TFALSE, ~LJ_TTRUE); break; case BC_UNM: - dasm_put(Dst, 3590, -LJ_TISNUM); + dasm_put(Dst, 3597, -LJ_TISNUM); break; case BC_LEN: - dasm_put(Dst, 3616, -LJ_TSTR, Dt5(->len), ~LJ_TISNUM, -LJ_TTAB); + dasm_put(Dst, 3623, -LJ_TSTR, Dt5(->len), ~LJ_TISNUM, -LJ_TTAB); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 3640, Dt6(->metatable)); + dasm_put(Dst, 3647, Dt6(->metatable)); #endif - dasm_put(Dst, 3647); + dasm_put(Dst, 3654); if (LJ_TARGET_OSX) { - dasm_put(Dst, 3649); + dasm_put(Dst, 3656); } - dasm_put(Dst, 3651); + dasm_put(Dst, 3658); if (LJ_TARGET_OSX) { - dasm_put(Dst, 3654); + dasm_put(Dst, 3661); } - dasm_put(Dst, 3656); + dasm_put(Dst, 3663); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 3659, Dt6(->nomm), 1<<MM_len); + dasm_put(Dst, 3666, Dt6(->nomm), 1<<MM_len); #endif break; @@ -6719,403 +6726,403 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: - dasm_put(Dst, 3669); + dasm_put(Dst, 3676); vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3672); + dasm_put(Dst, 3679); break; case 1: - dasm_put(Dst, 3675); + dasm_put(Dst, 3682); break; default: - dasm_put(Dst, 3678); + dasm_put(Dst, 3685); break; } - dasm_put(Dst, 3681); + dasm_put(Dst, 3688); if (vk == 1) { - dasm_put(Dst, 3683, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3690, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3688, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3695, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3693); + dasm_put(Dst, 3700); switch (vk) { case 0: - dasm_put(Dst, 3697); + dasm_put(Dst, 3704); break; case 1: - dasm_put(Dst, 3700); + dasm_put(Dst, 3707); break; default: - dasm_put(Dst, 3703); + dasm_put(Dst, 3710); break; } - dasm_put(Dst, 3706); + dasm_put(Dst, 3713); switch (vk) { case 0: if (vk == 1) { - dasm_put(Dst, 3715, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3722, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3720, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3727, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3725); + dasm_put(Dst, 3732); break; case 1: if (vk == 1) { - dasm_put(Dst, 3728, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3735, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3733, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3740, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3738); + dasm_put(Dst, 3745); break; default: if (vk == 1) { - dasm_put(Dst, 3741, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3748, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3746, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3753, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3751); + dasm_put(Dst, 3758); break; } - dasm_put(Dst, 3754); + dasm_put(Dst, 3761); break; case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: - dasm_put(Dst, 3760); + dasm_put(Dst, 3767); vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3763); + dasm_put(Dst, 3770); break; case 1: - dasm_put(Dst, 3766); + dasm_put(Dst, 3773); break; default: - dasm_put(Dst, 3769); + dasm_put(Dst, 3776); break; } - dasm_put(Dst, 3772); + dasm_put(Dst, 3779); if (vk == 1) { - dasm_put(Dst, 3774, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3781, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3779, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3786, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3784); + dasm_put(Dst, 3791); switch (vk) { case 0: - dasm_put(Dst, 3788); + dasm_put(Dst, 3795); break; case 1: - dasm_put(Dst, 3791); + dasm_put(Dst, 3798); break; default: - dasm_put(Dst, 3794); + dasm_put(Dst, 3801); break; } - dasm_put(Dst, 3797); + dasm_put(Dst, 3804); switch (vk) { case 0: if (vk == 1) { - dasm_put(Dst, 3806, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3813, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3811, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3818, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3816); + dasm_put(Dst, 3823); break; case 1: if (vk == 1) { - dasm_put(Dst, 3819, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3826, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3824, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3831, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3829); + dasm_put(Dst, 3836); break; default: if (vk == 1) { - dasm_put(Dst, 3832, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3839, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3837, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3844, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3842); + dasm_put(Dst, 3849); break; } - dasm_put(Dst, 3845); + dasm_put(Dst, 3852); break; case BC_MULVN: case BC_MULNV: case BC_MULVV: - dasm_put(Dst, 3851); + dasm_put(Dst, 3858); vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3854); + dasm_put(Dst, 3861); break; case 1: - dasm_put(Dst, 3857); + dasm_put(Dst, 3864); break; default: - dasm_put(Dst, 3860); + dasm_put(Dst, 3867); break; } - dasm_put(Dst, 3863); + dasm_put(Dst, 3870); if (vk == 1) { - dasm_put(Dst, 3865, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3872, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3870, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3877, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3875); + dasm_put(Dst, 3882); switch (vk) { case 0: - dasm_put(Dst, 3880); + dasm_put(Dst, 3887); break; case 1: - dasm_put(Dst, 3883); + dasm_put(Dst, 3890); break; default: - dasm_put(Dst, 3886); + dasm_put(Dst, 3893); break; } - dasm_put(Dst, 3889); + dasm_put(Dst, 3896); switch (vk) { case 0: if (vk == 1) { - dasm_put(Dst, 3898, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3905, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3903, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3910, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3908); + dasm_put(Dst, 3915); break; case 1: if (vk == 1) { - dasm_put(Dst, 3911, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3918, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3916, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3923, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3921); + dasm_put(Dst, 3928); break; default: if (vk == 1) { - dasm_put(Dst, 3924, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3931, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3929, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3936, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3934); + dasm_put(Dst, 3941); break; } - dasm_put(Dst, 3937); + dasm_put(Dst, 3944); break; case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: - dasm_put(Dst, 3943); + dasm_put(Dst, 3950); vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3946); + dasm_put(Dst, 3953); break; case 1: - dasm_put(Dst, 3949); + dasm_put(Dst, 3956); break; default: - dasm_put(Dst, 3952); + dasm_put(Dst, 3959); break; } switch (vk) { case 0: if (vk == 1) { - dasm_put(Dst, 3955, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3962, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3960, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3967, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3965); + dasm_put(Dst, 3972); break; case 1: if (vk == 1) { - dasm_put(Dst, 3968, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3975, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3973, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3980, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3978); + dasm_put(Dst, 3985); break; default: if (vk == 1) { - dasm_put(Dst, 3981, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3988, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 3986, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 3993, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 3991); + dasm_put(Dst, 3998); break; } - dasm_put(Dst, 3994); + dasm_put(Dst, 4001); break; case BC_MODVN: case BC_MODNV: case BC_MODVV: - dasm_put(Dst, 4004); + dasm_put(Dst, 4011); vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 4007); + dasm_put(Dst, 4014); break; case 1: - dasm_put(Dst, 4010); + dasm_put(Dst, 4017); break; default: - dasm_put(Dst, 4013); + dasm_put(Dst, 4020); break; } if (vk == 1) { - dasm_put(Dst, 4016, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4023, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4021, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4028, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4026); + dasm_put(Dst, 4033); switch (vk) { case 0: - dasm_put(Dst, 4030); + dasm_put(Dst, 4037); break; case 1: - dasm_put(Dst, 4033); + dasm_put(Dst, 4040); break; default: - dasm_put(Dst, 4036); + dasm_put(Dst, 4043); break; } - dasm_put(Dst, 4039, ~LJ_TISNUM); + dasm_put(Dst, 4046, ~LJ_TISNUM); switch (vk) { case 0: if (vk == 1) { - dasm_put(Dst, 4053, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4060, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4058, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4065, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4063); + dasm_put(Dst, 4070); break; case 1: if (vk == 1) { - dasm_put(Dst, 4066, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4073, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4071, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4078, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4076); + dasm_put(Dst, 4083); break; default: if (vk == 1) { - dasm_put(Dst, 4079, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4086, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4084, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4091, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4089); + dasm_put(Dst, 4096); break; } - dasm_put(Dst, 4092); + dasm_put(Dst, 4099); break; case BC_POW: - dasm_put(Dst, 4097); + dasm_put(Dst, 4104); vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 4100); + dasm_put(Dst, 4107); break; case 1: - dasm_put(Dst, 4103); + dasm_put(Dst, 4110); break; default: - dasm_put(Dst, 4106); + dasm_put(Dst, 4113); break; } switch (vk) { case 0: if (vk == 1) { - dasm_put(Dst, 4109, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4116, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4114, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4121, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4119); + dasm_put(Dst, 4126); break; case 1: if (vk == 1) { - dasm_put(Dst, 4122, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4129, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4127, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4134, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4132); + dasm_put(Dst, 4139); break; default: if (vk == 1) { - dasm_put(Dst, 4135, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4142, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 4140, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 4147, -LJ_TISNUM, -LJ_TISNUM); } - dasm_put(Dst, 4145); + dasm_put(Dst, 4152); break; } if (LJ_TARGET_OSX) { - dasm_put(Dst, 4148); + dasm_put(Dst, 4155); } - dasm_put(Dst, 4150); + dasm_put(Dst, 4157); if (LJ_TARGET_OSX) { - dasm_put(Dst, 4153); + dasm_put(Dst, 4160); } - dasm_put(Dst, 4155); + dasm_put(Dst, 4162); break; case BC_CAT: - dasm_put(Dst, 4163, Dt1(->base), Dt1(->base)); + dasm_put(Dst, 4170, Dt1(->base), Dt1(->base)); break; /* -- Constant ops ------------------------------------------------------ */ case BC_KSTR: - dasm_put(Dst, 4189, ~LJ_TSTR); + dasm_put(Dst, 4196, ~LJ_TSTR); break; case BC_KCDATA: #if LJ_HASFFI - dasm_put(Dst, 4201, ~LJ_TCDATA); + dasm_put(Dst, 4208, ~LJ_TCDATA); #endif break; case BC_KSHORT: - dasm_put(Dst, 4213, ~LJ_TISNUM); + dasm_put(Dst, 4220, ~LJ_TISNUM); break; case BC_KNUM: - dasm_put(Dst, 4224); + dasm_put(Dst, 4231); break; case BC_KPRI: - dasm_put(Dst, 4234); + dasm_put(Dst, 4241); break; case BC_KNIL: - dasm_put(Dst, 4244, ~LJ_TNIL); + dasm_put(Dst, 4251, ~LJ_TNIL); break; /* -- Upvalue and function ops ------------------------------------------ */ case BC_UGET: - dasm_put(Dst, 4263, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 4270, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_USETV: - dasm_put(Dst, 4279, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->closed), DtA(->v), LJ_GC_BLACK, -LJ_TISGCV, -(LJ_TISNUM - LJ_TISGCV), Dt4(->gch.marked), -GG_DISP2G, LJ_GC_WHITES); + dasm_put(Dst, 4286, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->closed), DtA(->v), LJ_GC_BLACK, -LJ_TISGCV, -(LJ_TISNUM - LJ_TISGCV), Dt4(->gch.marked), -GG_DISP2G, LJ_GC_WHITES); if (LJ_TARGET_OSX) { - dasm_put(Dst, 4319); - } else { dasm_put(Dst, 4326); + } else { + dasm_put(Dst, 4333); } - dasm_put(Dst, 4329); + dasm_put(Dst, 4336); break; case BC_USETS: - dasm_put(Dst, 4332, offsetof(GCfuncL, uvptr), ~LJ_TSTR, DtA(->marked), DtA(->v), DtA(->closed), LJ_GC_BLACK, Dt5(->marked), LJ_GC_WHITES, -GG_DISP2G); + dasm_put(Dst, 4339, offsetof(GCfuncL, uvptr), ~LJ_TSTR, DtA(->marked), DtA(->v), DtA(->closed), LJ_GC_BLACK, Dt5(->marked), LJ_GC_WHITES, -GG_DISP2G); if (LJ_TARGET_OSX) { - dasm_put(Dst, 4368); - } else { dasm_put(Dst, 4375); + } else { + dasm_put(Dst, 4382); } - dasm_put(Dst, 4378); + dasm_put(Dst, 4385); break; case BC_USETN: - dasm_put(Dst, 4381, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 4388, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_USETP: - dasm_put(Dst, 4398, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 4405, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_UCLO: - dasm_put(Dst, 4414, Dt1(->openupval), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 4421, Dt1(->openupval), Dt1(->base), Dt1(->base)); break; case BC_FNEW: - dasm_put(Dst, 4437, Dt1(->base), Dt1(->base), ~LJ_TFUNC); + dasm_put(Dst, 4444, Dt1(->base), Dt1(->base), ~LJ_TFUNC); break; /* -- Table ops --------------------------------------------------------- */ @@ -7123,115 +7130,115 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_TNEW: case BC_TDUP: if (op == BC_TDUP) { - dasm_put(Dst, 4458); + dasm_put(Dst, 4465); } - dasm_put(Dst, 4460, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); + dasm_put(Dst, 4467, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); if (op == BC_TNEW) { - dasm_put(Dst, 4473); + dasm_put(Dst, 4480); } else { - dasm_put(Dst, 4482); + dasm_put(Dst, 4489); } - dasm_put(Dst, 4486, Dt1(->base), ~LJ_TTAB); + dasm_put(Dst, 4493, Dt1(->base), ~LJ_TTAB); break; case BC_GGET: case BC_GSET: - dasm_put(Dst, 4504, Dt7(->env)); + dasm_put(Dst, 4511, Dt7(->env)); if (op == BC_GGET) { - dasm_put(Dst, 4510); + dasm_put(Dst, 4517); } else { - dasm_put(Dst, 4513); + dasm_put(Dst, 4520); } break; case BC_TGETV: - dasm_put(Dst, 4516, -LJ_TTAB, -LJ_TISNUM, Dt6(->array), Dt6(->asize), -LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, -LJ_TSTR); + dasm_put(Dst, 4523, -LJ_TTAB, -LJ_TISNUM, Dt6(->array), Dt6(->asize), -LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, -LJ_TSTR); break; case BC_TGETS: - dasm_put(Dst, 4573, -LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), DtB(->key), DtB(->val), DtB(->next), -LJ_TSTR, -LJ_TNIL, Dt6(->metatable), ~LJ_TNIL, Dt6(->nomm)); - dasm_put(Dst, 4633, 1<<MM_index); + dasm_put(Dst, 4580, -LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), DtB(->key), DtB(->val), DtB(->next), -LJ_TSTR, -LJ_TNIL, Dt6(->metatable), ~LJ_TNIL, Dt6(->nomm)); + dasm_put(Dst, 4640, 1<<MM_index); break; case BC_TGETB: - dasm_put(Dst, 4640, -LJ_TTAB, Dt6(->asize), Dt6(->array), -LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 4647, -LJ_TTAB, Dt6(->asize), Dt6(->array), -LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); break; case BC_TSETV: - dasm_put(Dst, 4683, -LJ_TTAB, -LJ_TISNUM, Dt6(->array), Dt6(->asize), -LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); - dasm_put(Dst, 4743, DISPATCH_GL(gc.grayagain), LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist), -LJ_TSTR); + dasm_put(Dst, 4690, -LJ_TTAB, -LJ_TISNUM, Dt6(->array), Dt6(->asize), -LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); + dasm_put(Dst, 4750, DISPATCH_GL(gc.grayagain), LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist), -LJ_TSTR); break; case BC_TSETS: - dasm_put(Dst, 4764, -LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), DtB(->key), DtB(->val.it), DtB(->next), -LJ_TSTR, Dt6(->marked), -LJ_TNIL, LJ_GC_BLACK, DtB(->val)); - dasm_put(Dst, 4822, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, ~LJ_TSTR, Dt1(->base), DISPATCH_GL(gc.grayagain), LJ_GC_BLACK); - dasm_put(Dst, 4875, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 4771, -LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), DtB(->key), DtB(->val.it), DtB(->next), -LJ_TSTR, Dt6(->marked), -LJ_TNIL, LJ_GC_BLACK, DtB(->val)); + dasm_put(Dst, 4829, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, ~LJ_TSTR, Dt1(->base), DISPATCH_GL(gc.grayagain), LJ_GC_BLACK); + dasm_put(Dst, 4882, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETB: - dasm_put(Dst, 4884, -LJ_TTAB, Dt6(->asize), Dt6(->array), -LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), LJ_GC_BLACK); - dasm_put(Dst, 4942, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 4891, -LJ_TTAB, Dt6(->asize), Dt6(->array), -LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), LJ_GC_BLACK); + dasm_put(Dst, 4949, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETM: - dasm_put(Dst, 4951, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt1(->base)); + dasm_put(Dst, 4958, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt1(->base)); if (LJ_TARGET_OSX) { - dasm_put(Dst, 4996, Dt1(->base)); + dasm_put(Dst, 5003, Dt1(->base)); } - dasm_put(Dst, 4999, DISPATCH_GL(gc.grayagain), LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 5006, DISPATCH_GL(gc.grayagain), LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; /* -- Calls and vararg handling ----------------------------------------- */ case BC_CALLM: - dasm_put(Dst, 5015); + dasm_put(Dst, 5022); break; case BC_CALL: - dasm_put(Dst, 5021, -LJ_TFUNC, Dt7(->field_pc)); + dasm_put(Dst, 5028, -LJ_TFUNC, Dt7(->field_pc)); break; case BC_CALLMT: - dasm_put(Dst, 5041); + dasm_put(Dst, 5048); break; case BC_CALLT: - dasm_put(Dst, 5046, -LJ_TFUNC, Dt7(->ffid), FRAME_TYPE, Dt7(->field_pc), Dt7(->field_pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP); - dasm_put(Dst, 5107, FRAME_TYPE); + dasm_put(Dst, 5053, -LJ_TFUNC, Dt7(->ffid), FRAME_TYPE, Dt7(->field_pc), Dt7(->field_pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP); + dasm_put(Dst, 5114, FRAME_TYPE); break; case BC_ITERC: - dasm_put(Dst, 5118, -LJ_TFUNC, Dt7(->field_pc)); + dasm_put(Dst, 5125, -LJ_TFUNC, Dt7(->field_pc)); break; case BC_ITERN: #if LJ_HASJIT #endif - dasm_put(Dst, 5142, Dt6(->asize), Dt6(->array), -LJ_TNIL, ~LJ_TISNUM, Dt6(->hmask), Dt6(->node), DtB(->val), -LJ_TNIL, DtB(->key)); + dasm_put(Dst, 5149, Dt6(->asize), Dt6(->array), -LJ_TNIL, ~LJ_TISNUM, Dt6(->hmask), Dt6(->node), DtB(->val), -LJ_TNIL, DtB(->key)); break; case BC_ISNEXT: - dasm_put(Dst, 5207, -LJ_TFUNC, Dt8(->ffid), -LJ_TTAB, -LJ_TNIL, FF_next_N, BC_JMP, BC_ITERC); + dasm_put(Dst, 5214, -LJ_TFUNC, Dt8(->ffid), -LJ_TTAB, -LJ_TNIL, FF_next_N, BC_JMP, BC_ITERC); break; case BC_VARG: - dasm_put(Dst, 5246, FRAME_VARG, ~LJ_TNIL, Dt1(->maxstack), Dt1(->top), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 5253, FRAME_VARG, ~LJ_TNIL, Dt1(->maxstack), Dt1(->top), Dt1(->base), Dt1(->base)); break; /* -- Returns ----------------------------------------------------------- */ case BC_RETM: - dasm_put(Dst, 5318); + dasm_put(Dst, 5325); break; case BC_RET: - dasm_put(Dst, 5325, FRAME_TYPE, FRAME_VARG, Dt7(->field_pc), PC2PROTO(k), ~LJ_TNIL, FRAME_TYPEP); + dasm_put(Dst, 5332, FRAME_TYPE, FRAME_VARG, Dt7(->field_pc), PC2PROTO(k), ~LJ_TNIL, FRAME_TYPEP); break; case BC_RET0: case BC_RET1: - dasm_put(Dst, 5390, FRAME_TYPE, FRAME_VARG); + dasm_put(Dst, 5397, FRAME_TYPE, FRAME_VARG); if (op == BC_RET1) { - dasm_put(Dst, 5401); + dasm_put(Dst, 5408); } - dasm_put(Dst, 5403); + dasm_put(Dst, 5410); if (op == BC_RET1) { - dasm_put(Dst, 5406); + dasm_put(Dst, 5413); } - dasm_put(Dst, 5408, Dt7(->field_pc), PC2PROTO(k), ~LJ_TNIL); + dasm_put(Dst, 5415, Dt7(->field_pc), PC2PROTO(k), ~LJ_TNIL); break; /* -- Loops and branches ------------------------------------------------ */ @@ -7239,7 +7246,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_FORL: #if LJ_HASJIT - dasm_put(Dst, 5434, -GG_DISP2HOT, HOTCOUNT_LOOP); + dasm_put(Dst, 5441, -GG_DISP2HOT, HOTCOUNT_LOOP); #endif break; @@ -7251,68 +7258,68 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_FORI: case BC_IFORL: vk = (op == BC_IFORL || op == BC_JFORL); - dasm_put(Dst, 5445); + dasm_put(Dst, 5452); if (op != BC_JFORL) { - dasm_put(Dst, 5447); + dasm_put(Dst, 5454); } if (!vk) { - dasm_put(Dst, 5449, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 5456, -LJ_TISNUM, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 5467, -LJ_TISNUM); + dasm_put(Dst, 5474, -LJ_TISNUM); if (op == BC_IFORL) { - dasm_put(Dst, 5475); + dasm_put(Dst, 5482); } else { - dasm_put(Dst, 5477); + dasm_put(Dst, 5484); } - dasm_put(Dst, 5480); + dasm_put(Dst, 5487); } - dasm_put(Dst, 5485); + dasm_put(Dst, 5492); if (op == BC_FORI) { - dasm_put(Dst, 5487); + dasm_put(Dst, 5494); } else if (op == BC_JFORI) { - dasm_put(Dst, 5489); + dasm_put(Dst, 5496); } else if (op == BC_IFORL) { - dasm_put(Dst, 5492); + dasm_put(Dst, 5499); } if (vk) { - dasm_put(Dst, 5494); + dasm_put(Dst, 5501); } - dasm_put(Dst, 5496); + dasm_put(Dst, 5503); if (op == BC_JFORI || op == BC_JFORL) { - dasm_put(Dst, 5501, BC_JLOOP); + dasm_put(Dst, 5508, BC_JLOOP); } - dasm_put(Dst, 5504); + dasm_put(Dst, 5511); if (!vk) { - dasm_put(Dst, 5511); + dasm_put(Dst, 5518); } else { - dasm_put(Dst, 5513); + dasm_put(Dst, 5520); } - dasm_put(Dst, 5515); + dasm_put(Dst, 5522); if (!vk) { - dasm_put(Dst, 5519, -LJ_TISNUM, -LJ_TISNUM); + dasm_put(Dst, 5526, -LJ_TISNUM, -LJ_TISNUM); } else { - dasm_put(Dst, 5531); + dasm_put(Dst, 5538); } - dasm_put(Dst, 5540); + dasm_put(Dst, 5547); if (op == BC_FORI) { - dasm_put(Dst, 5544); + dasm_put(Dst, 5551); } else if (op == BC_JFORI) { - dasm_put(Dst, 5546, BC_JLOOP); + dasm_put(Dst, 5553, BC_JLOOP); } else if (op == BC_IFORL) { - dasm_put(Dst, 5551); + dasm_put(Dst, 5558); } else { - dasm_put(Dst, 5553, BC_JLOOP); + dasm_put(Dst, 5560, BC_JLOOP); } - dasm_put(Dst, 5556); + dasm_put(Dst, 5563); if (vk) { - dasm_put(Dst, 5562); + dasm_put(Dst, 5569); } - dasm_put(Dst, 5567); + dasm_put(Dst, 5574); break; case BC_ITERL: #if LJ_HASJIT - dasm_put(Dst, 5573, -GG_DISP2HOT, HOTCOUNT_LOOP); + dasm_put(Dst, 5580, -GG_DISP2HOT, HOTCOUNT_LOOP); #endif break; @@ -7321,40 +7328,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IITERL: - dasm_put(Dst, 5584); + dasm_put(Dst, 5591); if (op == BC_JITERL) { - dasm_put(Dst, 5586, -LJ_TNIL, BC_JLOOP); + dasm_put(Dst, 5593, -LJ_TNIL, BC_JLOOP); } else { - dasm_put(Dst, 5592, -LJ_TNIL); + dasm_put(Dst, 5599, -LJ_TNIL); } - dasm_put(Dst, 5598); + dasm_put(Dst, 5605); break; case BC_LOOP: #if LJ_HASJIT - dasm_put(Dst, 5605, -GG_DISP2HOT, HOTCOUNT_LOOP); + dasm_put(Dst, 5612, -GG_DISP2HOT, HOTCOUNT_LOOP); #endif break; case BC_ILOOP: - dasm_put(Dst, 5616); + dasm_put(Dst, 5623); break; case BC_JLOOP: #if LJ_HASJIT - dasm_put(Dst, 5623, DISPATCH_J(trace), DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); + dasm_put(Dst, 5630, DISPATCH_J(trace), DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); #endif break; case BC_JMP: - dasm_put(Dst, 5637); + dasm_put(Dst, 5644); break; /* -- Function headers -------------------------------------------------- */ case BC_FUNCF: #if LJ_HASJIT - dasm_put(Dst, 5646, -GG_DISP2HOT, HOTCOUNT_CALL); + dasm_put(Dst, 5653, -GG_DISP2HOT, HOTCOUNT_CALL); #endif case BC_FUNCV: /* NYI: compiled vararg functions. */ break; @@ -7364,42 +7371,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IFUNCF: - dasm_put(Dst, 5657, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k)); + dasm_put(Dst, 5664, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k)); if (op != BC_JFUNCF) { - dasm_put(Dst, 5667); + dasm_put(Dst, 5674); } - dasm_put(Dst, 5670, ~LJ_TNIL); + dasm_put(Dst, 5677, ~LJ_TNIL); if (op == BC_JFUNCF) { - dasm_put(Dst, 5677, BC_JLOOP); + dasm_put(Dst, 5684, BC_JLOOP); } else { - dasm_put(Dst, 5681); + dasm_put(Dst, 5688); } - dasm_put(Dst, 5686); + dasm_put(Dst, 5693); break; case BC_JFUNCV: #if !LJ_HASJIT break; #endif - dasm_put(Dst, 5692); + dasm_put(Dst, 5699); break; /* NYI: compiled vararg functions. */ case BC_IFUNCV: - dasm_put(Dst, 5694, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), ~LJ_TNIL); + dasm_put(Dst, 5701, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), ~LJ_TNIL); break; case BC_FUNCC: case BC_FUNCCW: if (op == BC_FUNCC) { - dasm_put(Dst, 5735, Dt8(->f)); + dasm_put(Dst, 5742, Dt8(->f)); } else { - dasm_put(Dst, 5738, DISPATCH_GL(wrapf)); + dasm_put(Dst, 5745, DISPATCH_GL(wrapf)); } - dasm_put(Dst, 5741, Dt1(->maxstack), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 5748, Dt1(->maxstack), Dt1(->base), Dt1(->top)); if (op == BC_FUNCCW) { - dasm_put(Dst, 5751, Dt8(->f)); + dasm_put(Dst, 5758, Dt8(->f)); } - dasm_put(Dst, 5754, LJ_VMST_C, DISPATCH_GL(vmstate), Dt1(->base), LJ_VMST_INTERP, Dt1(->top), DISPATCH_GL(vmstate)); + dasm_put(Dst, 5761, LJ_VMST_C, DISPATCH_GL(vmstate), Dt1(->base), LJ_VMST_INTERP, Dt1(->top), DISPATCH_GL(vmstate)); break; /* ---------------------------------------------------------------------- */ @@ -7419,7 +7426,7 @@ static int build_backend(BuildCtx *ctx) build_subroutines(ctx); - dasm_put(Dst, 5776); + dasm_put(Dst, 5783); for (op = 0; op < BC__MAX; op++) build_ins(ctx, (BCOp)op, op); diff --git a/luajit2/src/buildvm_mips.dasc b/luajit2/src/buildvm_mips.dasc index 9e984189..a7c3b4ae 100644 --- a/luajit2/src/buildvm_mips.dasc +++ b/luajit2/src/buildvm_mips.dasc @@ -1900,6 +1900,7 @@ static void build_subroutines(BuildCtx *ctx) |. and TMP1, PC, AT | lbu TMP1, OFS_RA(PC) | sll TMP1, TMP1, 3 + | addiu TMP1, TMP1, 8 |3: | b ->vm_call_dispatch // Resolve again for tailcall. |. subu TMP2, BASE, TMP1 diff --git a/luajit2/src/buildvm_mips.h b/luajit2/src/buildvm_mips.h index 7c0f90bf..bab93343 100644 --- a/luajit2/src/buildvm_mips.h +++ b/luajit2/src/buildvm_mips.h @@ -12,7 +12,7 @@ #define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_SUB 1 #define DASM_MAXSECTION 2 -static const unsigned int build_actionlist[6323] = { +static const unsigned int build_actionlist[6324] = { 0xff010001, 0xff060014, 0x32410000, @@ -2930,6 +2930,7 @@ static const unsigned int build_actionlist[6323] = { 0x924d0000, 0xff098200, 0x000d68c0, +0x25ad0008, 0xff06000d, 0x10000000, 0xff050824, @@ -6736,51 +6737,51 @@ static void build_subroutines(BuildCtx *ctx) dasm_put(Dst, 2719, 8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(4,0), 8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(4,0), 8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(4,0)); dasm_put(Dst, 2790, 8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(4,0), 8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, Dt8(->f)); dasm_put(Dst, 2863, LJ_ENDIAN_SELECT(-4,-8), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), FRAME_TYPE, LJ_ENDIAN_SELECT(1,2), DISPATCH_GOT(lj_state_growstack), LUA_MINSTACK, Dt1(->base)); - dasm_put(Dst, 2931, DISPATCH_GOT(lj_gc_step), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4)); + dasm_put(Dst, 2932, DISPATCH_GOT(lj_gc_step), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4)); #if LJ_HASJIT - dasm_put(Dst, 2957, DISPATCH_GL(hookmask), HOOK_VMEVENT, DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount)); + dasm_put(Dst, 2958, DISPATCH_GL(hookmask), HOOK_VMEVENT, DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount)); #endif - dasm_put(Dst, 2980, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount), LUA_MASKLINE, DISPATCH_GOT(lj_dispatch_ins), Dt1(->base), Dt1(->base)); - dasm_put(Dst, 3028, GG_DISP2STATIC, -24+LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 2981, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount), LUA_MASKLINE, DISPATCH_GOT(lj_dispatch_ins), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 3029, GG_DISP2STATIC, -24+LJ_ENDIAN_SELECT(0,4)); #if LJ_HASJIT - dasm_put(Dst, 3047, LJ_ENDIAN_SELECT(-8,-4), GG_DISP2J, Dt7(->pc), DISPATCH_J(L), PC2PROTO(framesize), DISPATCH_GOT(lj_trace_hot), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 3048, LJ_ENDIAN_SELECT(-8,-4), GG_DISP2J, Dt7(->pc), DISPATCH_J(L), PC2PROTO(framesize), DISPATCH_GOT(lj_trace_hot), Dt1(->base), Dt1(->top)); #endif - dasm_put(Dst, 3072); + dasm_put(Dst, 3073); #if LJ_HASJIT - dasm_put(Dst, 3074); + dasm_put(Dst, 3075); #endif - dasm_put(Dst, 3077); + dasm_put(Dst, 3078); #if LJ_HASJIT - dasm_put(Dst, 3080); + dasm_put(Dst, 3081); #endif - dasm_put(Dst, 3083, DISPATCH_GOT(lj_dispatch_call), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4)); + dasm_put(Dst, 3084, DISPATCH_GOT(lj_dispatch_call), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4)); #if LJ_HASJIT - dasm_put(Dst, 3107, -(16+32*8+32*4), 16+0*8, 16+32*8+0*4, 16+32*8+1*4, 16+2*8, 16+32*8+2*4, 16+32*8+3*4, 16+4*8, 16+32*8+4*4, 16+32*8+5*4, 16+6*8, 16+32*8+6*4, 16+32*8+7*4, 16+8*8, 16+32*8+8*4, 16+32*8+9*4, 16+10*8, 16+32*8+10*4, 16+32*8+11*4, 16+12*8, 16+32*8+12*4, 16+32*8+13*4, 16+14*8); - dasm_put(Dst, 3154, 16+32*8+14*4, 16+32*8+15*4, 16+16*8, 16+32*8+16*4, 16+32*8+17*4, 16+18*8, 16+32*8+18*4, 16+32*8+19*4, 16+20*8, 16+32*8+20*4, 16+32*8+21*4, 16+22*8, 16+32*8+22*4, 16+32*8+23*4, 16+24*8, 16+32*8+24*4, 16+32*8+25*4, 16+26*8, 16+32*8+26*4, 16+32*8+27*4, 16+28*8, 16+32*8+28*4, 16+30*8); - dasm_put(Dst, 3201, 16+32*8+30*4, 16+32*8+31*4, ~LJ_VMST_EXIT, 16+32*8+32*4, -GG_DISP2G-32768, DISPATCH_GL(vmstate), 16+32*8+29*4, DISPATCH_GL(jit_L), DISPATCH_GL(jit_base), DISPATCH_GOT(lj_trace_exit), DISPATCH_J(L), DISPATCH_J(parent), DISPATCH_J(exitno), GG_DISP2J, Dt1(->base), Dt1(->cframe), Dt1(->base)); + dasm_put(Dst, 3108, -(16+32*8+32*4), 16+0*8, 16+32*8+0*4, 16+32*8+1*4, 16+2*8, 16+32*8+2*4, 16+32*8+3*4, 16+4*8, 16+32*8+4*4, 16+32*8+5*4, 16+6*8, 16+32*8+6*4, 16+32*8+7*4, 16+8*8, 16+32*8+8*4, 16+32*8+9*4, 16+10*8, 16+32*8+10*4, 16+32*8+11*4, 16+12*8, 16+32*8+12*4, 16+32*8+13*4, 16+14*8); + dasm_put(Dst, 3155, 16+32*8+14*4, 16+32*8+15*4, 16+16*8, 16+32*8+16*4, 16+32*8+17*4, 16+18*8, 16+32*8+18*4, 16+32*8+19*4, 16+20*8, 16+32*8+20*4, 16+32*8+21*4, 16+22*8, 16+32*8+22*4, 16+32*8+23*4, 16+24*8, 16+32*8+24*4, 16+32*8+25*4, 16+26*8, 16+32*8+26*4, 16+32*8+27*4, 16+28*8, 16+32*8+28*4, 16+30*8); + dasm_put(Dst, 3202, 16+32*8+30*4, 16+32*8+31*4, ~LJ_VMST_EXIT, 16+32*8+32*4, -GG_DISP2G-32768, DISPATCH_GL(vmstate), 16+32*8+29*4, DISPATCH_GL(jit_L), DISPATCH_GL(jit_base), DISPATCH_GOT(lj_trace_exit), DISPATCH_J(L), DISPATCH_J(parent), DISPATCH_J(exitno), GG_DISP2J, Dt1(->base), Dt1(->cframe), Dt1(->base)); #endif - dasm_put(Dst, 3245); + dasm_put(Dst, 3246); #if LJ_HASJIT - dasm_put(Dst, 3247, -GG_DISP2G-32768, LJ_ENDIAN_SELECT(-8,-4), LJ_TNIL, Dt7(->pc), DISPATCH_GL(jit_L), PC2PROTO(k), DISPATCH_GL(vmstate), BC_FUNCF*4, DISPATCH_GOT(lj_err_throw)); + dasm_put(Dst, 3248, -GG_DISP2G-32768, LJ_ENDIAN_SELECT(-8,-4), LJ_TNIL, Dt7(->pc), DISPATCH_GL(jit_L), PC2PROTO(k), DISPATCH_GL(vmstate), BC_FUNCF*4, DISPATCH_GOT(lj_err_throw)); #endif - dasm_put(Dst, 3296); + dasm_put(Dst, 3297); #if LJ_HASJIT - dasm_put(Dst, 3344); + dasm_put(Dst, 3345); #endif - dasm_put(Dst, 3367); + dasm_put(Dst, 3368); #if LJ_HASFFI #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V) - dasm_put(Dst, 3369, 72+9*4, 72+8*4, 24+5*8, 72+7*4, 72+6*4, 24+4*8, 72+5*4, 72+4*4, 24+3*8, 72+3*4, 72+2*4, 24+2*8, 72+1*4, 72+0*4, 24+1*8, 24+0*8, Dt2(->ctype_state), GG_G2DISP, DISPATCH_GOT(lj_ccallback_enter), DtE(->cb.slot), DtE(->cb.gpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[0])); - dasm_put(Dst, 3417, DtE(->cb.gpr[2]), DtE(->cb.gpr[3]), DtE(->cb.fpr[1]), 112+16, DtE(->cb.stack), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4), ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate), Dt7(->pc)); + dasm_put(Dst, 3370, 72+9*4, 72+8*4, 24+5*8, 72+7*4, 72+6*4, 24+4*8, 72+5*4, 72+4*4, 24+3*8, 72+3*4, 72+2*4, 24+2*8, 72+1*4, 72+0*4, 24+1*8, 24+0*8, Dt2(->ctype_state), GG_G2DISP, DISPATCH_GOT(lj_ccallback_enter), DtE(->cb.slot), DtE(->cb.gpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[0])); + dasm_put(Dst, 3418, DtE(->cb.gpr[2]), DtE(->cb.gpr[3]), DtE(->cb.fpr[1]), 112+16, DtE(->cb.stack), Dt1(->base), Dt1(->top), LJ_ENDIAN_SELECT(-8,-4), ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate), Dt7(->pc)); #endif - dasm_put(Dst, 3461); + dasm_put(Dst, 3462); #if LJ_HASFFI - dasm_put(Dst, 3463, DISPATCH_GOT(lj_ccallback_leave), DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[1])); + dasm_put(Dst, 3464, DISPATCH_GOT(lj_ccallback_leave), DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[1])); #endif - dasm_put(Dst, 3487); + dasm_put(Dst, 3488); #if LJ_HASFFI #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) - dasm_put(Dst, 3489, DtF(->spadj), DtF(->nsp), offsetof(CCallState, stack), DtF(->func), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3]), DtF(->fpr[0]), DtF(->fpr[1]), DtF(->gpr[0]), DtF(->gpr[0]), DtF(->gpr[1]), DtF(->fpr[0]), DtF(->fpr[1])); + dasm_put(Dst, 3490, DtF(->spadj), DtF(->nsp), offsetof(CCallState, stack), DtF(->func), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3]), DtF(->fpr[0]), DtF(->fpr[1]), DtF(->gpr[0]), DtF(->gpr[0]), DtF(->gpr[1]), DtF(->fpr[0]), DtF(->fpr[1])); #endif } @@ -6788,7 +6789,7 @@ static void build_subroutines(BuildCtx *ctx) static void build_ins(BuildCtx *ctx, BCOp op, int defop) { int vk = 0; - dasm_put(Dst, 3545, defop); + dasm_put(Dst, 3546, defop); switch (op) { @@ -6797,138 +6798,138 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) /* Remember: all ops branch for a true comparison, fall through otherwise. */ case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: - dasm_put(Dst, 3547, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(2,0), (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 3548, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_ENDIAN_SELECT(2,0), (-(BCBIAS_J*4 >> 16) & 65535)); if (op == BC_ISLT || op == BC_ISGE) { - dasm_put(Dst, 3570); + dasm_put(Dst, 3571); } else { - dasm_put(Dst, 3572); + dasm_put(Dst, 3573); } if (op == BC_ISLT || op == BC_ISLE) { - dasm_put(Dst, 3574); + dasm_put(Dst, 3575); } else { - dasm_put(Dst, 3576); + dasm_put(Dst, 3577); } - dasm_put(Dst, 3578); + dasm_put(Dst, 3579); break; case BC_ISEQV: case BC_ISNEV: vk = op == BC_ISEQV; - dasm_put(Dst, 3592, LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), LJ_ENDIAN_SELECT(4,0), (-(BCBIAS_J*4 >> 16) & 65535), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 3593, LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), LJ_ENDIAN_SELECT(4,0), (-(BCBIAS_J*4 >> 16) & 65535), LJ_TISNUM, LJ_TISNUM); if (vk) { - dasm_put(Dst, 3616); + dasm_put(Dst, 3617); } else { - dasm_put(Dst, 3618); + dasm_put(Dst, 3619); } - dasm_put(Dst, 3620, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 3621, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(0,4)); if (LJ_HASFFI) { - dasm_put(Dst, 3639, LJ_TCDATA); + dasm_put(Dst, 3640, LJ_TCDATA); } - dasm_put(Dst, 3644, LJ_TISPRI); + dasm_put(Dst, 3645, LJ_TISPRI); if (LJ_HASFFI) { - dasm_put(Dst, 3647); + dasm_put(Dst, 3648); } - dasm_put(Dst, 3650, LJ_TISTABUD+1); + dasm_put(Dst, 3651, LJ_TISTABUD+1); if (vk) { - dasm_put(Dst, 3661); + dasm_put(Dst, 3662); } else { - dasm_put(Dst, 3663); + dasm_put(Dst, 3664); } - dasm_put(Dst, 3665, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq, 1-vk); + dasm_put(Dst, 3666, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq, 1-vk); break; case BC_ISEQS: case BC_ISNES: vk = op == BC_ISEQS; - dasm_put(Dst, 3682, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), -4+LJ_ENDIAN_SELECT(2,0)); + dasm_put(Dst, 3683, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), -4+LJ_ENDIAN_SELECT(2,0)); if (LJ_HASFFI) { - dasm_put(Dst, 3693, LJ_TCDATA); + dasm_put(Dst, 3694, LJ_TCDATA); } - dasm_put(Dst, 3698, -LJ_TSTR, (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 3699, -LJ_TSTR, (-(BCBIAS_J*4 >> 16) & 65535)); if (vk) { - dasm_put(Dst, 3708); + dasm_put(Dst, 3709); } else { - dasm_put(Dst, 3710); + dasm_put(Dst, 3711); } - dasm_put(Dst, 3712); + dasm_put(Dst, 3713); break; case BC_ISEQN: case BC_ISNEN: vk = op == BC_ISEQN; - dasm_put(Dst, 3725, LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), (-(BCBIAS_J*4 >> 16) & 65535), LJ_TISNUM); + dasm_put(Dst, 3726, LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), (-(BCBIAS_J*4 >> 16) & 65535), LJ_TISNUM); if (LJ_HASFFI) { - dasm_put(Dst, 3740); + dasm_put(Dst, 3741); } else { - dasm_put(Dst, 3743); + dasm_put(Dst, 3744); } - dasm_put(Dst, 3746); + dasm_put(Dst, 3747); if (vk) { - dasm_put(Dst, 3749); + dasm_put(Dst, 3750); } else { - dasm_put(Dst, 3753); + dasm_put(Dst, 3754); } - dasm_put(Dst, 3757); + dasm_put(Dst, 3758); if (LJ_HASFFI) { - dasm_put(Dst, 3769, LJ_TCDATA); + dasm_put(Dst, 3770, LJ_TCDATA); } break; case BC_ISEQP: case BC_ISNEP: vk = op == BC_ISEQP; - dasm_put(Dst, 3779, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(2,0)); + dasm_put(Dst, 3780, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(2,0)); if (LJ_HASFFI) { - dasm_put(Dst, 3788, LJ_TCDATA); + dasm_put(Dst, 3789, LJ_TCDATA); } - dasm_put(Dst, 3793, (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 3794, (-(BCBIAS_J*4 >> 16) & 65535)); if (vk) { - dasm_put(Dst, 3799); + dasm_put(Dst, 3800); } else { - dasm_put(Dst, 3801); + dasm_put(Dst, 3802); } - dasm_put(Dst, 3803); + dasm_put(Dst, 3804); break; /* -- Unary test and copy ops ------------------------------------------- */ case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: - dasm_put(Dst, 3816, LJ_ENDIAN_SELECT(2,0), LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 3817, LJ_ENDIAN_SELECT(2,0), LJ_ENDIAN_SELECT(4,0)); if (op == BC_IST || op == BC_ISF) { - dasm_put(Dst, 3823, LJ_TISTRUECOND, (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 3824, LJ_TISTRUECOND, (-(BCBIAS_J*4 >> 16) & 65535)); if (op == BC_IST) { - dasm_put(Dst, 3830); + dasm_put(Dst, 3831); } else { - dasm_put(Dst, 3832); + dasm_put(Dst, 3833); } - dasm_put(Dst, 3834); + dasm_put(Dst, 3835); } else { - dasm_put(Dst, 3836, LJ_TISTRUECOND); + dasm_put(Dst, 3837, LJ_TISTRUECOND); if (op == BC_ISTC) { - dasm_put(Dst, 3840); + dasm_put(Dst, 3841); } else { - dasm_put(Dst, 3843); + dasm_put(Dst, 3844); } - dasm_put(Dst, 3846, (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 3847, (-(BCBIAS_J*4 >> 16) & 65535)); } - dasm_put(Dst, 3855); + dasm_put(Dst, 3856); break; /* -- Unary ops --------------------------------------------------------- */ case BC_MOV: - dasm_put(Dst, 3867); + dasm_put(Dst, 3868); break; case BC_NOT: - dasm_put(Dst, 3883, LJ_ENDIAN_SELECT(4,0), LJ_TFALSE, LJ_TISTRUECOND, LJ_TTRUE, LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 3884, LJ_ENDIAN_SELECT(4,0), LJ_TFALSE, LJ_TISTRUECOND, LJ_TTRUE, LJ_ENDIAN_SELECT(4,0)); break; case BC_UNM: - dasm_put(Dst, 3907, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 3908, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case BC_LEN: - dasm_put(Dst, 3930, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_TSTR, LJ_TTAB, Dt5(->len)); + dasm_put(Dst, 3931, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_TSTR, LJ_TTAB, Dt5(->len)); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 3964, Dt6(->metatable)); + dasm_put(Dst, 3965, Dt6(->metatable)); #endif - dasm_put(Dst, 3971, DISPATCH_GOT(lj_tab_len)); + dasm_put(Dst, 3972, DISPATCH_GOT(lj_tab_len)); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 3980, Dt6(->nomm), 1<<MM_len); + dasm_put(Dst, 3981, Dt6(->nomm), 1<<MM_len); #endif break; @@ -6937,273 +6938,273 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); - dasm_put(Dst, 3992); + dasm_put(Dst, 3993); switch (vk) { case 0: - dasm_put(Dst, 3996, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 3997, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case 1: - dasm_put(Dst, 4005, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4006, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; default: - dasm_put(Dst, 4014, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 4015, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); break; } - dasm_put(Dst, 4028); + dasm_put(Dst, 4029); break; case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); - dasm_put(Dst, 4045); + dasm_put(Dst, 4046); switch (vk) { case 0: - dasm_put(Dst, 4049, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4050, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case 1: - dasm_put(Dst, 4058, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4059, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; default: - dasm_put(Dst, 4067, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 4068, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); break; } - dasm_put(Dst, 4081); + dasm_put(Dst, 4082); break; case BC_MULVN: case BC_MULNV: case BC_MULVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); - dasm_put(Dst, 4098); + dasm_put(Dst, 4099); switch (vk) { case 0: - dasm_put(Dst, 4102, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4103, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case 1: - dasm_put(Dst, 4111, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4112, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; default: - dasm_put(Dst, 4120, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 4121, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); break; } - dasm_put(Dst, 4134); + dasm_put(Dst, 4135); break; case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); - dasm_put(Dst, 4151); + dasm_put(Dst, 4152); switch (vk) { case 0: - dasm_put(Dst, 4155, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4156, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case 1: - dasm_put(Dst, 4164, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4165, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; default: - dasm_put(Dst, 4173, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 4174, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); break; } - dasm_put(Dst, 4187); + dasm_put(Dst, 4188); break; case BC_MODVN: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); - dasm_put(Dst, 4204); + dasm_put(Dst, 4205); switch (vk) { case 0: - dasm_put(Dst, 4208, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4209, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case 1: - dasm_put(Dst, 4217, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4218, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; default: - dasm_put(Dst, 4226, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 4227, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); break; } - dasm_put(Dst, 4240); + dasm_put(Dst, 4241); break; case BC_MODNV: case BC_MODVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); - dasm_put(Dst, 4262); + dasm_put(Dst, 4263); switch (vk) { case 0: - dasm_put(Dst, 4266, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4267, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; case 1: - dasm_put(Dst, 4275, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); + dasm_put(Dst, 4276, LJ_ENDIAN_SELECT(4,0), LJ_TISNUM); break; default: - dasm_put(Dst, 4284, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); + dasm_put(Dst, 4285, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM); break; } - dasm_put(Dst, 4298); + dasm_put(Dst, 4299); break; case BC_POW: - dasm_put(Dst, 4305, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, DISPATCH_GOT(pow)); + dasm_put(Dst, 4306, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, DISPATCH_GOT(pow)); break; case BC_CAT: - dasm_put(Dst, 4341, Dt1(->base), DISPATCH_GOT(lj_meta_cat), Dt1(->base)); + dasm_put(Dst, 4342, Dt1(->base), DISPATCH_GOT(lj_meta_cat), Dt1(->base)); break; /* -- Constant ops ------------------------------------------------------ */ case BC_KSTR: - dasm_put(Dst, 4376, LJ_TSTR, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 4377, LJ_TSTR, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0)); break; case BC_KCDATA: #if LJ_HASFFI - dasm_put(Dst, 4398, LJ_TCDATA, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 4399, LJ_TCDATA, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0)); #endif break; case BC_KSHORT: - dasm_put(Dst, 4420); + dasm_put(Dst, 4421); break; case BC_KNUM: - dasm_put(Dst, 4437); + dasm_put(Dst, 4438); break; case BC_KPRI: - dasm_put(Dst, 4453, LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 4454, LJ_ENDIAN_SELECT(4,0)); break; case BC_KNIL: - dasm_put(Dst, 4470, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 4471, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0)); break; /* -- Upvalue and function ops ------------------------------------------ */ case BC_UGET: - dasm_put(Dst, 4494, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->v)); + dasm_put(Dst, 4495, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->v)); break; case BC_USETV: - dasm_put(Dst, 4517, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), LJ_ENDIAN_SELECT(4,0), LJ_GC_BLACK|1, -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), LJ_ENDIAN_SELECT(0,4), Dt4(->gch.marked), LJ_GC_WHITES, DISPATCH_GOT(lj_gc_barrieruv), GG_DISP2G); + dasm_put(Dst, 4518, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), LJ_ENDIAN_SELECT(4,0), LJ_GC_BLACK|1, -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), LJ_ENDIAN_SELECT(0,4), Dt4(->gch.marked), LJ_GC_WHITES, DISPATCH_GOT(lj_gc_barrieruv), GG_DISP2G); break; case BC_USETS: - dasm_put(Dst, 4577, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->marked), DtA(->v), Dt5(->marked), LJ_GC_BLACK, DtA(->closed), LJ_TSTR, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_GC_WHITES, DISPATCH_GOT(lj_gc_barrieruv), GG_DISP2G); + dasm_put(Dst, 4578, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->marked), DtA(->v), Dt5(->marked), LJ_GC_BLACK, DtA(->closed), LJ_TSTR, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_GC_WHITES, DISPATCH_GOT(lj_gc_barrieruv), GG_DISP2G); break; case BC_USETN: - dasm_put(Dst, 4632, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->v)); + dasm_put(Dst, 4633, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->v)); break; case BC_USETP: - dasm_put(Dst, 4655, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->v), LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 4656, LJ_ENDIAN_SELECT(-8,-4), Dt7(->uvptr), DtA(->v), LJ_ENDIAN_SELECT(4,0)); break; case BC_UCLO: - dasm_put(Dst, 4679, Dt1(->openupval), (-(BCBIAS_J*4 >> 16) & 65535), DISPATCH_GOT(lj_func_closeuv), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 4680, Dt1(->openupval), (-(BCBIAS_J*4 >> 16) & 65535), DISPATCH_GOT(lj_func_closeuv), Dt1(->base), Dt1(->base)); break; case BC_FNEW: - dasm_put(Dst, 4710, DISPATCH_GOT(lj_func_newL_gc), LJ_ENDIAN_SELECT(-8,-4), Dt1(->base), Dt1(->base), LJ_TFUNC, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 4711, DISPATCH_GOT(lj_func_newL_gc), LJ_ENDIAN_SELECT(-8,-4), Dt1(->base), Dt1(->base), LJ_TFUNC, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4)); break; /* -- Table ops --------------------------------------------------------- */ case BC_TNEW: case BC_TDUP: - dasm_put(Dst, 4743, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); + dasm_put(Dst, 4744, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); if (op == BC_TNEW) { - dasm_put(Dst, 4755, DISPATCH_GOT(lj_tab_new)); + dasm_put(Dst, 4756, DISPATCH_GOT(lj_tab_new)); } else { - dasm_put(Dst, 4766, DISPATCH_GOT(lj_tab_dup)); + dasm_put(Dst, 4767, DISPATCH_GOT(lj_tab_dup)); } - dasm_put(Dst, 4774, Dt1(->base), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), DISPATCH_GOT(lj_gc_step_fixtop)); + dasm_put(Dst, 4775, Dt1(->base), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), DISPATCH_GOT(lj_gc_step_fixtop)); break; case BC_GGET: case BC_GSET: - dasm_put(Dst, 4804, LJ_ENDIAN_SELECT(-8,-4), Dt7(->env)); + dasm_put(Dst, 4805, LJ_ENDIAN_SELECT(-8,-4), Dt7(->env)); if (op == BC_GGET) { - dasm_put(Dst, 4812); + dasm_put(Dst, 4813); } else { - dasm_put(Dst, 4815); + dasm_put(Dst, 4816); } - dasm_put(Dst, 4818); + dasm_put(Dst, 4819); break; case BC_TGETV: - dasm_put(Dst, 4820, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_TTAB, LJ_TISNUM, LJ_TSTR, Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); - dasm_put(Dst, 4895, LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 4821, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_TTAB, LJ_TISNUM, LJ_TSTR, Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 4896, LJ_ENDIAN_SELECT(0,4)); break; case BC_TGETS: - dasm_put(Dst, 4901, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->hmask), Dt5(->hash), Dt6(->node), offsetof(Node, key)+LJ_ENDIAN_SELECT(4,0), offsetof(Node, key)+LJ_ENDIAN_SELECT(0,4), DtB(->next), offsetof(Node, val)+LJ_ENDIAN_SELECT(4,0), -LJ_TSTR, Dt6(->metatable), offsetof(Node, val)+LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4)); - dasm_put(Dst, 4970, LJ_TNIL, Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 4902, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->hmask), Dt5(->hash), Dt6(->node), offsetof(Node, key)+LJ_ENDIAN_SELECT(4,0), offsetof(Node, key)+LJ_ENDIAN_SELECT(0,4), DtB(->next), offsetof(Node, val)+LJ_ENDIAN_SELECT(4,0), -LJ_TSTR, Dt6(->metatable), offsetof(Node, val)+LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 4971, LJ_TNIL, Dt6(->nomm), 1<<MM_index); break; case BC_TGETB: - dasm_put(Dst, 4987, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 4988, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); break; case BC_TSETV: - dasm_put(Dst, 5044, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_TTAB, LJ_TISNUM, LJ_TSTR, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_ENDIAN_SELECT(4,0), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); - dasm_put(Dst, 5117, LJ_ENDIAN_SELECT(0,4), DISPATCH_GL(gc.grayagain), ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 5045, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_TTAB, LJ_TISNUM, LJ_TSTR, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_ENDIAN_SELECT(4,0), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); + dasm_put(Dst, 5118, LJ_ENDIAN_SELECT(0,4), DISPATCH_GL(gc.grayagain), ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETS: - dasm_put(Dst, 5145, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), offsetof(Node, key)+LJ_ENDIAN_SELECT(4,0), offsetof(Node, key)+LJ_ENDIAN_SELECT(0,4), LJ_TSTR, DtB(->next), offsetof(Node, val)+LJ_ENDIAN_SELECT(4,0), Dt6(->marked), Dt6(->metatable), LJ_GC_BLACK); - dasm_put(Dst, 5203, DtB(->val), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), DISPATCH_GL(tmptv), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, DISPATCH_GOT(lj_tab_newkey), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), Dt1(->base), Dt1(->base)); - dasm_put(Dst, 5265, DISPATCH_GL(gc.grayagain), ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 5146, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), offsetof(Node, key)+LJ_ENDIAN_SELECT(4,0), offsetof(Node, key)+LJ_ENDIAN_SELECT(0,4), LJ_TSTR, DtB(->next), offsetof(Node, val)+LJ_ENDIAN_SELECT(4,0), Dt6(->marked), Dt6(->metatable), LJ_GC_BLACK); + dasm_put(Dst, 5204, DtB(->val), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), DISPATCH_GL(tmptv), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, DISPATCH_GOT(lj_tab_newkey), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 5266, DISPATCH_GL(gc.grayagain), ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETB: - dasm_put(Dst, 5282, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); - dasm_put(Dst, 5349, ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 5283, LJ_ENDIAN_SELECT(4,0), LJ_TTAB, LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); + dasm_put(Dst, 5350, ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETM: - dasm_put(Dst, 5360, -8+LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->marked), Dt6(->array), LJ_GC_BLACK, DISPATCH_GOT(lj_tab_reasize), Dt1(->base), Dt1(->base), DISPATCH_GL(gc.grayagain), ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked)); - dasm_put(Dst, 5433, Dt6(->gclist)); + dasm_put(Dst, 5361, -8+LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->marked), Dt6(->array), LJ_GC_BLACK, DISPATCH_GOT(lj_tab_reasize), Dt1(->base), Dt1(->base), DISPATCH_GL(gc.grayagain), ~LJ_GC_BLACK & 255, DISPATCH_GL(gc.grayagain), Dt6(->marked)); + dasm_put(Dst, 5434, Dt6(->gclist)); break; /* -- Calls and vararg handling ----------------------------------------- */ case BC_CALLM: - dasm_put(Dst, 5438); + dasm_put(Dst, 5439); break; case BC_CALL: - dasm_put(Dst, 5443, LJ_TFUNC, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(-4,-8), Dt7(->pc)); + dasm_put(Dst, 5444, LJ_TFUNC, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(-4,-8), Dt7(->pc)); break; case BC_CALLMT: - dasm_put(Dst, 5472); + dasm_put(Dst, 5473); break; case BC_CALLT: - dasm_put(Dst, 5474, LJ_TFUNC, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE, Dt7(->ffid), FRAME_VARG, LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), -8+LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc)); - dasm_put(Dst, 5543, PC2PROTO(k), FRAME_TYPEP, LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE); + dasm_put(Dst, 5475, LJ_TFUNC, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE, Dt7(->ffid), FRAME_VARG, LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), -8+LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc)); + dasm_put(Dst, 5544, PC2PROTO(k), FRAME_TYPEP, LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE); break; case BC_ITERC: - dasm_put(Dst, 5559, LJ_TFUNC, -24+LJ_ENDIAN_SELECT(4,0), -24+LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(-4,-8), Dt7(->pc)); + dasm_put(Dst, 5560, LJ_TFUNC, -24+LJ_ENDIAN_SELECT(4,0), -24+LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(-4,-8), Dt7(->pc)); break; case BC_ITERN: #if LJ_HASJIT #endif - dasm_put(Dst, 5594, -16+LJ_ENDIAN_SELECT(0,4), -8+LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), (-(BCBIAS_J*4 >> 16) & 65535), -8+LJ_ENDIAN_SELECT(0,4), Dt6(->hmask), Dt6(->node), LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), DtB(->key), (-(BCBIAS_J*4 >> 16) & 65535)); - dasm_put(Dst, 5676, -8+LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 5595, -16+LJ_ENDIAN_SELECT(0,4), -8+LJ_ENDIAN_SELECT(0,4), Dt6(->asize), Dt6(->array), LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), (-(BCBIAS_J*4 >> 16) & 65535), -8+LJ_ENDIAN_SELECT(0,4), Dt6(->hmask), Dt6(->node), LJ_ENDIAN_SELECT(4,0), -4+LJ_ENDIAN_SELECT(2,0), DtB(->key), (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 5677, -8+LJ_ENDIAN_SELECT(0,4)); break; case BC_ISNEXT: - dasm_put(Dst, 5679, -24+LJ_ENDIAN_SELECT(4,0), -24+LJ_ENDIAN_SELECT(0,4), -16+LJ_ENDIAN_SELECT(4,0), -8+LJ_ENDIAN_SELECT(4,0), LJ_TFUNC, -LJ_TTAB, Dt8(->ffid), -LJ_TNIL, -FF_next_N, (-(BCBIAS_J*4 >> 16) & 65535), -8+LJ_ENDIAN_SELECT(0,4), BC_JMP, BC_ITERC, -4+LJ_ENDIAN_SELECT(0,3), LJ_ENDIAN_SELECT(0,3)); + dasm_put(Dst, 5680, -24+LJ_ENDIAN_SELECT(4,0), -24+LJ_ENDIAN_SELECT(0,4), -16+LJ_ENDIAN_SELECT(4,0), -8+LJ_ENDIAN_SELECT(4,0), LJ_TFUNC, -LJ_TTAB, Dt8(->ffid), -LJ_TNIL, -FF_next_N, (-(BCBIAS_J*4 >> 16) & 65535), -8+LJ_ENDIAN_SELECT(0,4), BC_JMP, BC_ITERC, -4+LJ_ENDIAN_SELECT(0,3), LJ_ENDIAN_SELECT(0,3)); break; case BC_VARG: - dasm_put(Dst, 5736, LJ_ENDIAN_SELECT(-4,-8), FRAME_VARG, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), Dt1(->maxstack), DISPATCH_GOT(lj_state_growstack), Dt1(->top), Dt1(->base), Dt1(->base)); - dasm_put(Dst, 5823); + dasm_put(Dst, 5737, LJ_ENDIAN_SELECT(-4,-8), FRAME_VARG, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), Dt1(->maxstack), DISPATCH_GOT(lj_state_growstack), Dt1(->top), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 5824); break; /* -- Returns ----------------------------------------------------------- */ case BC_RETM: - dasm_put(Dst, 5825); + dasm_put(Dst, 5826); break; case BC_RET: - dasm_put(Dst, 5827, LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE, FRAME_VARG, LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), PC2PROTO(k), LJ_ENDIAN_SELECT(4,0), FRAME_TYPEP, LJ_ENDIAN_SELECT(-4,-8)); + dasm_put(Dst, 5828, LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE, FRAME_VARG, LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), PC2PROTO(k), LJ_ENDIAN_SELECT(4,0), FRAME_TYPEP, LJ_ENDIAN_SELECT(-4,-8)); break; case BC_RET0: case BC_RET1: - dasm_put(Dst, 5899, LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE, FRAME_VARG); + dasm_put(Dst, 5900, LJ_ENDIAN_SELECT(-4,-8), FRAME_TYPE, FRAME_VARG); if (op == BC_RET1) { - dasm_put(Dst, 5912); + dasm_put(Dst, 5913); } - dasm_put(Dst, 5914); + dasm_put(Dst, 5915); if (op == BC_RET1) { - dasm_put(Dst, 5919); + dasm_put(Dst, 5920); } - dasm_put(Dst, 5921, LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), PC2PROTO(k)); + dasm_put(Dst, 5922, LJ_ENDIAN_SELECT(-8,-4), Dt7(->pc), PC2PROTO(k)); if (op == BC_RET1) { - dasm_put(Dst, 5949, LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 5950, LJ_ENDIAN_SELECT(4,0)); } else { - dasm_put(Dst, 5952, -8+LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 5953, -8+LJ_ENDIAN_SELECT(4,0)); } break; @@ -7211,7 +7212,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_FORL: #if LJ_HASJIT - dasm_put(Dst, 5955, GG_DISP2HOT, -HOTCOUNT_LOOP, GG_DISP2HOT); + dasm_put(Dst, 5956, GG_DISP2HOT, -HOTCOUNT_LOOP, GG_DISP2HOT); #endif break; @@ -7223,35 +7224,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_FORI: case BC_IFORL: vk = (op == BC_IFORL || op == BC_JFORL); - dasm_put(Dst, 5967); + dasm_put(Dst, 5968); if (vk) { - dasm_put(Dst, 5969, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8+LJ_ENDIAN_SELECT(4,0), FORL_IDX*8); + dasm_put(Dst, 5970, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8+LJ_ENDIAN_SELECT(4,0), FORL_IDX*8); } else { - dasm_put(Dst, 5981, FORL_IDX*8+LJ_ENDIAN_SELECT(4,0), FORL_STEP*8+LJ_ENDIAN_SELECT(4,0), FORL_STOP*8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_TISNUM, FORL_IDX*8, FORL_STOP*8); + dasm_put(Dst, 5982, FORL_IDX*8+LJ_ENDIAN_SELECT(4,0), FORL_STEP*8+LJ_ENDIAN_SELECT(4,0), FORL_STOP*8+LJ_ENDIAN_SELECT(4,0), LJ_TISNUM, LJ_TISNUM, LJ_TISNUM, FORL_IDX*8, FORL_STOP*8); } if (op != BC_JFORL) { - dasm_put(Dst, 6002, (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 6003, (-(BCBIAS_J*4 >> 16) & 65535)); } - dasm_put(Dst, 6006, FORL_EXT*8); + dasm_put(Dst, 6007, FORL_EXT*8); if (op == BC_JFORI) { - dasm_put(Dst, 6011, -4+LJ_ENDIAN_SELECT(2,0), BC_JLOOP); + dasm_put(Dst, 6012, -4+LJ_ENDIAN_SELECT(2,0), BC_JLOOP); } else if (op == BC_JFORL) { - dasm_put(Dst, 6025, BC_JLOOP); + dasm_put(Dst, 6026, BC_JLOOP); } else { - dasm_put(Dst, 6035); + dasm_put(Dst, 6036); if (op == BC_FORI) { - dasm_put(Dst, 6039); + dasm_put(Dst, 6040); } else { - dasm_put(Dst, 6042); + dasm_put(Dst, 6043); } - dasm_put(Dst, 6045); + dasm_put(Dst, 6046); } - dasm_put(Dst, 6048); + dasm_put(Dst, 6049); break; case BC_ITERL: #if LJ_HASJIT - dasm_put(Dst, 6060, GG_DISP2HOT, -HOTCOUNT_LOOP, GG_DISP2HOT); + dasm_put(Dst, 6061, GG_DISP2HOT, -HOTCOUNT_LOOP, GG_DISP2HOT); #endif break; @@ -7260,40 +7261,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IITERL: - dasm_put(Dst, 6072, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 6073, LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4)); if (op == BC_JITERL) { - dasm_put(Dst, 6080, -8+LJ_ENDIAN_SELECT(4,0), BC_JLOOP, -8+LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 6081, -8+LJ_ENDIAN_SELECT(4,0), BC_JLOOP, -8+LJ_ENDIAN_SELECT(0,4)); } else { - dasm_put(Dst, 6087, (-(BCBIAS_J*4 >> 16) & 65535), -8+LJ_ENDIAN_SELECT(4,0), -8+LJ_ENDIAN_SELECT(0,4)); + dasm_put(Dst, 6088, (-(BCBIAS_J*4 >> 16) & 65535), -8+LJ_ENDIAN_SELECT(4,0), -8+LJ_ENDIAN_SELECT(0,4)); } - dasm_put(Dst, 6097); + dasm_put(Dst, 6098); break; case BC_LOOP: #if LJ_HASJIT - dasm_put(Dst, 6110, GG_DISP2HOT, -HOTCOUNT_LOOP, GG_DISP2HOT); + dasm_put(Dst, 6111, GG_DISP2HOT, -HOTCOUNT_LOOP, GG_DISP2HOT); #endif break; case BC_ILOOP: - dasm_put(Dst, 6122); + dasm_put(Dst, 6123); break; case BC_JLOOP: #if LJ_HASJIT - dasm_put(Dst, 6134, DISPATCH_J(trace), DISPATCH_GL(vmstate), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), DtD(->mcode), GG_DISP2G+32768); + dasm_put(Dst, 6135, DISPATCH_J(trace), DISPATCH_GL(vmstate), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), DtD(->mcode), GG_DISP2G+32768); #endif break; case BC_JMP: - dasm_put(Dst, 6152, (-(BCBIAS_J*4 >> 16) & 65535)); + dasm_put(Dst, 6153, (-(BCBIAS_J*4 >> 16) & 65535)); break; /* -- Function headers -------------------------------------------------- */ case BC_FUNCF: #if LJ_HASJIT - dasm_put(Dst, 6169, GG_DISP2HOT, -HOTCOUNT_CALL, GG_DISP2HOT); + dasm_put(Dst, 6170, GG_DISP2HOT, -HOTCOUNT_CALL, GG_DISP2HOT); #endif case BC_FUNCV: /* NYI: compiled vararg functions. */ break; @@ -7303,42 +7304,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IFUNCF: - dasm_put(Dst, 6181, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k)); + dasm_put(Dst, 6182, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k)); if (op != BC_JFUNCF) { - dasm_put(Dst, 6192); + dasm_put(Dst, 6193); } - dasm_put(Dst, 6195); + dasm_put(Dst, 6196); if (op == BC_JFUNCF) { - dasm_put(Dst, 6201, BC_JLOOP); + dasm_put(Dst, 6202, BC_JLOOP); } else { - dasm_put(Dst, 6206); + dasm_put(Dst, 6207); } - dasm_put(Dst, 6216, LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 6217, LJ_ENDIAN_SELECT(4,0)); break; case BC_JFUNCV: #if !LJ_HASJIT break; #endif - dasm_put(Dst, 6223); + dasm_put(Dst, 6224); break; /* NYI: compiled vararg functions. */ case BC_IFUNCV: - dasm_put(Dst, 6225, Dt1(->maxstack), LJ_ENDIAN_SELECT(0,4), 8+FRAME_VARG, -4+PC2PROTO(k), LJ_ENDIAN_SELECT(4,0), -4+PC2PROTO(numparams), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), 8+LJ_ENDIAN_SELECT(0,4), 8+LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0)); + dasm_put(Dst, 6226, Dt1(->maxstack), LJ_ENDIAN_SELECT(0,4), 8+FRAME_VARG, -4+PC2PROTO(k), LJ_ENDIAN_SELECT(4,0), -4+PC2PROTO(numparams), LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(0,4), 8+LJ_ENDIAN_SELECT(0,4), 8+LJ_ENDIAN_SELECT(4,0), LJ_ENDIAN_SELECT(4,0)); break; case BC_FUNCC: case BC_FUNCCW: if (op == BC_FUNCC) { - dasm_put(Dst, 6280, Dt8(->f)); + dasm_put(Dst, 6281, Dt8(->f)); } else { - dasm_put(Dst, 6283, DISPATCH_GL(wrapf)); + dasm_put(Dst, 6284, DISPATCH_GL(wrapf)); } - dasm_put(Dst, 6286, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); + dasm_put(Dst, 6287, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); if (op == BC_FUNCCW) { - dasm_put(Dst, 6298, Dt8(->f)); + dasm_put(Dst, 6299, Dt8(->f)); } - dasm_put(Dst, 6301, DISPATCH_GL(vmstate), Dt1(->base), Dt1(->top), ~LJ_VMST_INTERP, LJ_ENDIAN_SELECT(-4,-8), DISPATCH_GL(vmstate)); + dasm_put(Dst, 6302, DISPATCH_GL(vmstate), Dt1(->base), Dt1(->top), ~LJ_VMST_INTERP, LJ_ENDIAN_SELECT(-4,-8), DISPATCH_GL(vmstate)); break; /* ---------------------------------------------------------------------- */ @@ -7358,7 +7359,7 @@ static int build_backend(BuildCtx *ctx) build_subroutines(ctx); - dasm_put(Dst, 6322); + dasm_put(Dst, 6323); for (op = 0; op < BC__MAX; op++) build_ins(ctx, (BCOp)op, op); diff --git a/luajit2/src/buildvm_ppc.dasc b/luajit2/src/buildvm_ppc.dasc index 027e75b0..49f92d0a 100644 --- a/luajit2/src/buildvm_ppc.dasc +++ b/luajit2/src/buildvm_ppc.dasc @@ -2189,6 +2189,7 @@ static void build_subroutines(BuildCtx *ctx) | bne >3 | lwz INS, -4(PC) | decode_RA8 TMP1, INS + | addi TMP1, TMP1, 8 |3: | sub TMP2, BASE, TMP1 | b ->vm_call_dispatch // Resolve again for tailcall. diff --git a/luajit2/src/buildvm_ppc.h b/luajit2/src/buildvm_ppc.h index 81285d63..ce0941ec 100644 --- a/luajit2/src/buildvm_ppc.h +++ b/luajit2/src/buildvm_ppc.h @@ -12,7 +12,7 @@ #define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_SUB 1 #define DASM_MAXSECTION 2 -static const unsigned int build_actionlist[7762] = { +static const unsigned int build_actionlist[7763] = { 0x00010001, 0x00060014, 0x72000000, @@ -3624,6 +3624,7 @@ static const unsigned int build_actionlist[7762] = { 0x00050803, 0x80f0fffc, 0x54e8dd78, +0x39080008, 0x0006000d, 0x7d287050, 0x48000000, @@ -8512,59 +8513,59 @@ static void build_subroutines(BuildCtx *ctx) dasm_put(Dst, 3550); } dasm_put(Dst, 3558, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc), FRAME_TYPE, LUA_MINSTACK); - dasm_put(Dst, 3621, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 3622, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); #if LJ_HASJIT - dasm_put(Dst, 3647, DISPATCH_GL(hookmask), HOOK_VMEVENT, DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount)); + dasm_put(Dst, 3648, DISPATCH_GL(hookmask), HOOK_VMEVENT, DISPATCH_GL(hookcount), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount)); #endif - dasm_put(Dst, 3669, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); - dasm_put(Dst, 3716, GG_DISP2STATIC); + dasm_put(Dst, 3670, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 3717, GG_DISP2STATIC); #if LJ_HASJIT - dasm_put(Dst, 3734, GG_DISP2J, Dt7(->pc), DISPATCH_J(L), PC2PROTO(framesize), Dt1(->base), 31-3, Dt1(->top)); + dasm_put(Dst, 3735, GG_DISP2J, Dt7(->pc), DISPATCH_J(L), PC2PROTO(framesize), Dt1(->base), 31-3, Dt1(->top)); #endif - dasm_put(Dst, 3757); + dasm_put(Dst, 3758); #if LJ_HASJIT - dasm_put(Dst, 3760); + dasm_put(Dst, 3761); #endif - dasm_put(Dst, 3763); + dasm_put(Dst, 3764); #if LJ_HASJIT - dasm_put(Dst, 3765); + dasm_put(Dst, 3766); #endif - dasm_put(Dst, 3768, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 3769, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); #if LJ_HASJIT - dasm_put(Dst, 3791, -(16+32*8+32*4), 16+32*8+2*4, -GG_DISP2G-32768, ~LJ_VMST_EXIT, 16+32*8+32*4, DISPATCH_GL(vmstate), 16+0*8, 16+1*8, 16+2*8, 16+3*8, 16+4*8, 16+5*8, 16+6*8, 16+7*8, 16+32*8+32*4, 16+8*8, 16+9*8, 16+10*8, 16+11*8, 16+32*8+1*4, 16+12*8, 16+13*8); - dasm_put(Dst, 3838, 16+14*8, 16+15*8, 16+16*8, 16+17*8, 16+18*8, 16+19*8, 16+32*8+0*4, 16+20*8, 16+21*8, 16+22*8, 16+23*8, 16+24*8, 16+25*8, 16+26*8, 16+27*8, DISPATCH_GL(jit_L), 16+28*8, 16+29*8, 16+30*8, 16+31*8, DISPATCH_GL(jit_base), 32-2); - dasm_put(Dst, 3887, DISPATCH_J(L), DISPATCH_GL(jit_L), DISPATCH_J(parent), Dt1(->base), GG_DISP2J, DISPATCH_J(exitno), Dt1(->cframe), Dt1(->base)); + dasm_put(Dst, 3792, -(16+32*8+32*4), 16+32*8+2*4, -GG_DISP2G-32768, ~LJ_VMST_EXIT, 16+32*8+32*4, DISPATCH_GL(vmstate), 16+0*8, 16+1*8, 16+2*8, 16+3*8, 16+4*8, 16+5*8, 16+6*8, 16+7*8, 16+32*8+32*4, 16+8*8, 16+9*8, 16+10*8, 16+11*8, 16+32*8+1*4, 16+12*8, 16+13*8); + dasm_put(Dst, 3839, 16+14*8, 16+15*8, 16+16*8, 16+17*8, 16+18*8, 16+19*8, 16+32*8+0*4, 16+20*8, 16+21*8, 16+22*8, 16+23*8, 16+24*8, 16+25*8, 16+26*8, 16+27*8, DISPATCH_GL(jit_L), 16+28*8, 16+29*8, 16+30*8, 16+31*8, DISPATCH_GL(jit_base), 32-2); + dasm_put(Dst, 3888, DISPATCH_J(L), DISPATCH_GL(jit_L), DISPATCH_J(parent), Dt1(->base), GG_DISP2J, DISPATCH_J(exitno), Dt1(->cframe), Dt1(->base)); #endif - dasm_put(Dst, 3915); + dasm_put(Dst, 3916); #if LJ_HASJIT - dasm_put(Dst, 3917, -GG_DISP2G-32768, 31-3, Dt7(->pc), DISPATCH_GL(jit_L), PC2PROTO(k), LJ_TISNUM, LJ_TNIL, DISPATCH_GL(vmstate), BC_FUNCF*4); + dasm_put(Dst, 3918, -GG_DISP2G-32768, 31-3, Dt7(->pc), DISPATCH_GL(jit_L), PC2PROTO(k), LJ_TISNUM, LJ_TNIL, DISPATCH_GL(vmstate), BC_FUNCF*4); #endif - dasm_put(Dst, 3974); + dasm_put(Dst, 3975); #if LJ_HASJIT - dasm_put(Dst, 3982); + dasm_put(Dst, 3983); #endif - dasm_put(Dst, 3985); + dasm_put(Dst, 3986); #if LJ_HASJIT - dasm_put(Dst, 4065); + dasm_put(Dst, 4066); #else - dasm_put(Dst, 4087); + dasm_put(Dst, 4088); #endif - dasm_put(Dst, 4089); + dasm_put(Dst, 4090); #if LJ_HASFFI #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V) - dasm_put(Dst, 4113, 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8); - dasm_put(Dst, 4161, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, Dt2(->ctype_state), GG_G2DISP, DtE(->cb.slot), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[1]), DtE(->cb.gpr[2])); - dasm_put(Dst, 4208, DtE(->cb.fpr[2]), DtE(->cb.gpr[3]), DtE(->cb.fpr[3]), DtE(->cb.gpr[4]), DtE(->cb.fpr[4]), DtE(->cb.gpr[5]), DtE(->cb.fpr[5]), DtE(->cb.gpr[6]), DtE(->cb.fpr[6]), DtE(->cb.gpr[7]), DtE(->cb.fpr[7]), 272+8, DtE(->cb.stack), Dt1(->base), LJ_TISNUM, Dt1(->top), LJ_TNIL, ~LJ_VMST_INTERP, DISPATCH_GL(vmstate), Dt7(->pc)); + dasm_put(Dst, 4114, 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8); + dasm_put(Dst, 4162, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, Dt2(->ctype_state), GG_G2DISP, DtE(->cb.slot), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[1]), DtE(->cb.gpr[2])); + dasm_put(Dst, 4209, DtE(->cb.fpr[2]), DtE(->cb.gpr[3]), DtE(->cb.fpr[3]), DtE(->cb.gpr[4]), DtE(->cb.fpr[4]), DtE(->cb.gpr[5]), DtE(->cb.fpr[5]), DtE(->cb.gpr[6]), DtE(->cb.fpr[6]), DtE(->cb.gpr[7]), DtE(->cb.fpr[7]), 272+8, DtE(->cb.stack), Dt1(->base), LJ_TISNUM, Dt1(->top), LJ_TNIL, ~LJ_VMST_INTERP, DISPATCH_GL(vmstate), Dt7(->pc)); #endif - dasm_put(Dst, 4272); + dasm_put(Dst, 4273); #if LJ_HASFFI - dasm_put(Dst, 4274, DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1])); + dasm_put(Dst, 4275, DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1])); #endif - dasm_put(Dst, 4295); + dasm_put(Dst, 4296); #if LJ_HASFFI #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) - dasm_put(Dst, 4297, DtF(->spadj), DtF(->nsp), DtF(->nfpr), DtF(->stack), 31-2, DtF(->fpr[0]), DtF(->fpr[1]), DtF(->fpr[2]), DtF(->fpr[3]), DtF(->fpr[4]), DtF(->fpr[5]), DtF(->fpr[6]), DtF(->fpr[7]), DtF(->func), DtF(->gpr[1]), DtF(->gpr[2])); - dasm_put(Dst, 4354, DtF(->gpr[3]), DtF(->gpr[4]), DtF(->gpr[5]), DtF(->gpr[6]), DtF(->gpr[7]), DtF(->gpr[0]), DtF(->gpr[0]), DtF(->fpr[0]), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3])); + dasm_put(Dst, 4298, DtF(->spadj), DtF(->nsp), DtF(->nfpr), DtF(->stack), 31-2, DtF(->fpr[0]), DtF(->fpr[1]), DtF(->fpr[2]), DtF(->fpr[3]), DtF(->fpr[4]), DtF(->fpr[5]), DtF(->fpr[6]), DtF(->fpr[7]), DtF(->func), DtF(->gpr[1]), DtF(->gpr[2])); + dasm_put(Dst, 4355, DtF(->gpr[3]), DtF(->gpr[4]), DtF(->gpr[5]), DtF(->gpr[6]), DtF(->gpr[7]), DtF(->gpr[0]), DtF(->gpr[0]), DtF(->fpr[0]), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3])); #endif } @@ -8572,7 +8573,7 @@ static void build_subroutines(BuildCtx *ctx) static void build_ins(BuildCtx *ctx, BCOp op, int defop) { int vk = 0; - dasm_put(Dst, 4386, defop); + dasm_put(Dst, 4387, defop); switch (op) { @@ -8582,224 +8583,224 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: if (LJ_DUALNUM) { - dasm_put(Dst, 4388, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4389, -(BCBIAS_J*4 >> 16)); if (op == BC_ISLT) { - dasm_put(Dst, 4405); + dasm_put(Dst, 4406); } else if (op == BC_ISGE) { - dasm_put(Dst, 4408); + dasm_put(Dst, 4409); } else if (op == BC_ISLE) { - dasm_put(Dst, 4411); + dasm_put(Dst, 4412); } else { - dasm_put(Dst, 4414); + dasm_put(Dst, 4415); } - dasm_put(Dst, 4417); + dasm_put(Dst, 4418); if (op == BC_ISLT) { - dasm_put(Dst, 4456); + dasm_put(Dst, 4457); } else if (op == BC_ISGE) { - dasm_put(Dst, 4459); + dasm_put(Dst, 4460); } else if (op == BC_ISLE) { - dasm_put(Dst, 4462); + dasm_put(Dst, 4463); } else { - dasm_put(Dst, 4466); + dasm_put(Dst, 4467); } - dasm_put(Dst, 4470); + dasm_put(Dst, 4471); } else { - dasm_put(Dst, 4473, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4474, -(BCBIAS_J*4 >> 16)); if (op == BC_ISLT) { - dasm_put(Dst, 4490); + dasm_put(Dst, 4491); } else if (op == BC_ISGE) { - dasm_put(Dst, 4493); + dasm_put(Dst, 4494); } else if (op == BC_ISLE) { - dasm_put(Dst, 4496); + dasm_put(Dst, 4497); } else { - dasm_put(Dst, 4500); + dasm_put(Dst, 4501); } - dasm_put(Dst, 4504); + dasm_put(Dst, 4505); } break; case BC_ISEQV: case BC_ISNEV: vk = op == BC_ISEQV; if (LJ_DUALNUM) { - dasm_put(Dst, 4517, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4518, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 4530); + dasm_put(Dst, 4531); } else { - dasm_put(Dst, 4533); + dasm_put(Dst, 4534); } } else { - dasm_put(Dst, 4536, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4537, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 4553); + dasm_put(Dst, 4554); } else { - dasm_put(Dst, 4557); + dasm_put(Dst, 4558); } - dasm_put(Dst, 4561); + dasm_put(Dst, 4562); } - dasm_put(Dst, 4573); + dasm_put(Dst, 4574); if (!LJ_DUALNUM) { - dasm_put(Dst, 4575); + dasm_put(Dst, 4576); } if (LJ_HASFFI) { - dasm_put(Dst, 4578, LJ_TCDATA, LJ_TCDATA); + dasm_put(Dst, 4579, LJ_TCDATA, LJ_TCDATA); } - dasm_put(Dst, 4583, ~LJ_TISPRI); + dasm_put(Dst, 4584, ~LJ_TISPRI); if (LJ_HASFFI) { - dasm_put(Dst, 4588); + dasm_put(Dst, 4589); } - dasm_put(Dst, 4590, ~LJ_TISTABUD); + dasm_put(Dst, 4591, ~LJ_TISTABUD); if (LJ_HASFFI) { - dasm_put(Dst, 4593); + dasm_put(Dst, 4594); } - dasm_put(Dst, 4596); + dasm_put(Dst, 4597); if (vk) { - dasm_put(Dst, 4604); + dasm_put(Dst, 4605); } else { - dasm_put(Dst, 4609); + dasm_put(Dst, 4610); } if (LJ_DUALNUM) { - dasm_put(Dst, 4614); + dasm_put(Dst, 4615); } else { - dasm_put(Dst, 4629); + dasm_put(Dst, 4630); } - dasm_put(Dst, 4632, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); + dasm_put(Dst, 4633, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); break; case BC_ISEQS: case BC_ISNES: vk = op == BC_ISEQS; - dasm_put(Dst, 4651, 32-1); + dasm_put(Dst, 4652, 32-1); if (LJ_HASFFI) { - dasm_put(Dst, 4659, LJ_TCDATA); + dasm_put(Dst, 4660, LJ_TCDATA); } - dasm_put(Dst, 4662, LJ_TSTR); + dasm_put(Dst, 4663, LJ_TSTR); if (LJ_HASFFI) { - dasm_put(Dst, 4666); + dasm_put(Dst, 4667); } - dasm_put(Dst, 4669, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4670, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 4677); + dasm_put(Dst, 4678); } else { - dasm_put(Dst, 4679); + dasm_put(Dst, 4680); } - dasm_put(Dst, 4681); + dasm_put(Dst, 4682); break; case BC_ISEQN: case BC_ISNEN: vk = op == BC_ISEQN; if (LJ_DUALNUM) { - dasm_put(Dst, 4693, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4694, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 4705); + dasm_put(Dst, 4706); } else { - dasm_put(Dst, 4707); + dasm_put(Dst, 4708); } - dasm_put(Dst, 4709); + dasm_put(Dst, 4710); } else { if (vk) { - dasm_put(Dst, 4716); + dasm_put(Dst, 4717); } else { - dasm_put(Dst, 4718); + dasm_put(Dst, 4719); } - dasm_put(Dst, 4720, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4721, -(BCBIAS_J*4 >> 16)); } if (vk) { - dasm_put(Dst, 4733); + dasm_put(Dst, 4734); if (!LJ_HASFFI) { - dasm_put(Dst, 4738); + dasm_put(Dst, 4739); } } else { - dasm_put(Dst, 4740); + dasm_put(Dst, 4741); if (!LJ_HASFFI) { - dasm_put(Dst, 4744); + dasm_put(Dst, 4745); } - dasm_put(Dst, 4746); + dasm_put(Dst, 4747); } - dasm_put(Dst, 4749); + dasm_put(Dst, 4750); if (LJ_HASFFI) { - dasm_put(Dst, 4760, LJ_TCDATA); + dasm_put(Dst, 4761, LJ_TCDATA); } if (LJ_DUALNUM) { - dasm_put(Dst, 4768); + dasm_put(Dst, 4769); } break; case BC_ISEQP: case BC_ISNEP: vk = op == BC_ISEQP; - dasm_put(Dst, 4792, 32-3); + dasm_put(Dst, 4793, 32-3); if (LJ_HASFFI) { - dasm_put(Dst, 4799, LJ_TCDATA); + dasm_put(Dst, 4800, LJ_TCDATA); } - dasm_put(Dst, 4802); + dasm_put(Dst, 4803); if (LJ_HASFFI) { - dasm_put(Dst, 4804); + dasm_put(Dst, 4805); } - dasm_put(Dst, 4807, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4808, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 4813); + dasm_put(Dst, 4814); } else { - dasm_put(Dst, 4815); + dasm_put(Dst, 4816); } - dasm_put(Dst, 4817); + dasm_put(Dst, 4818); break; /* -- Unary test and copy ops ------------------------------------------- */ case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: - dasm_put(Dst, 4829); + dasm_put(Dst, 4830); if (op == BC_IST || op == BC_ISF) { - dasm_put(Dst, 4833, LJ_TTRUE, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4834, LJ_TTRUE, -(BCBIAS_J*4 >> 16)); if (op == BC_IST) { - dasm_put(Dst, 4840); + dasm_put(Dst, 4841); } else { - dasm_put(Dst, 4842); + dasm_put(Dst, 4843); } - dasm_put(Dst, 4844); + dasm_put(Dst, 4845); } else { - dasm_put(Dst, 4846, LJ_TFALSE); + dasm_put(Dst, 4847, LJ_TFALSE); if (op == BC_ISTC) { - dasm_put(Dst, 4851); + dasm_put(Dst, 4852); } else { - dasm_put(Dst, 4854); + dasm_put(Dst, 4855); } - dasm_put(Dst, 4857, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4858, -(BCBIAS_J*4 >> 16)); } - dasm_put(Dst, 4864); + dasm_put(Dst, 4865); break; /* -- Unary ops --------------------------------------------------------- */ case BC_MOV: - dasm_put(Dst, 4875); + dasm_put(Dst, 4876); break; case BC_NOT: - dasm_put(Dst, 4888, LJ_TTRUE); + dasm_put(Dst, 4889, LJ_TTRUE); break; case BC_UNM: - dasm_put(Dst, 4904); + dasm_put(Dst, 4905); if (LJ_DUALNUM) { - dasm_put(Dst, 4908); + dasm_put(Dst, 4909); } - dasm_put(Dst, 4936); + dasm_put(Dst, 4937); if (LJ_DUALNUM) { - dasm_put(Dst, 4946); + dasm_put(Dst, 4947); } else { - dasm_put(Dst, 4949); + dasm_put(Dst, 4950); } break; case BC_LEN: - dasm_put(Dst, 4958, LJ_TSTR, Dt5(->len)); + dasm_put(Dst, 4959, LJ_TSTR, Dt5(->len)); if (LJ_DUALNUM) { - dasm_put(Dst, 4968); + dasm_put(Dst, 4969); } else { - dasm_put(Dst, 4973); + dasm_put(Dst, 4974); } - dasm_put(Dst, 4980, LJ_TTAB); + dasm_put(Dst, 4981, LJ_TTAB); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 4994, Dt6(->metatable)); + dasm_put(Dst, 4995, Dt6(->metatable)); #endif - dasm_put(Dst, 5001); + dasm_put(Dst, 5002); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 5007, Dt6(->nomm), 1<<MM_len); + dasm_put(Dst, 5008, Dt6(->nomm), 1<<MM_len); #endif break; @@ -8811,77 +8812,77 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5017); + dasm_put(Dst, 5018); break; case 1: - dasm_put(Dst, 5023); + dasm_put(Dst, 5024); break; default: - dasm_put(Dst, 5029); + dasm_put(Dst, 5030); break; } - dasm_put(Dst, 5035); + dasm_put(Dst, 5036); switch (vk) { case 0: - dasm_put(Dst, 5062); + dasm_put(Dst, 5063); break; case 1: - dasm_put(Dst, 5065); + dasm_put(Dst, 5066); break; default: - dasm_put(Dst, 5068); + dasm_put(Dst, 5069); break; } - dasm_put(Dst, 5071); + dasm_put(Dst, 5072); if (vk == 1) { - dasm_put(Dst, 5073); + dasm_put(Dst, 5074); } else { - dasm_put(Dst, 5077); + dasm_put(Dst, 5078); } switch (vk) { case 0: - dasm_put(Dst, 5081); + dasm_put(Dst, 5082); break; case 1: - dasm_put(Dst, 5084); + dasm_put(Dst, 5085); break; default: - dasm_put(Dst, 5087); + dasm_put(Dst, 5088); break; } - dasm_put(Dst, 5090); + dasm_put(Dst, 5091); } else { vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5097); + dasm_put(Dst, 5098); if (LJ_DUALNUM) { - dasm_put(Dst, 5099); + dasm_put(Dst, 5100); } - dasm_put(Dst, 5101); + dasm_put(Dst, 5102); if (LJ_DUALNUM) { - dasm_put(Dst, 5104); + dasm_put(Dst, 5105); } else { - dasm_put(Dst, 5110); + dasm_put(Dst, 5111); } break; case 1: - dasm_put(Dst, 5114); + dasm_put(Dst, 5115); if (LJ_DUALNUM) { - dasm_put(Dst, 5116); + dasm_put(Dst, 5117); } - dasm_put(Dst, 5118); + dasm_put(Dst, 5119); if (LJ_DUALNUM) { - dasm_put(Dst, 5121); + dasm_put(Dst, 5122); } else { - dasm_put(Dst, 5127); + dasm_put(Dst, 5128); } break; default: - dasm_put(Dst, 5131); + dasm_put(Dst, 5132); break; } - dasm_put(Dst, 5141); + dasm_put(Dst, 5142); } break; case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: @@ -8889,77 +8890,77 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5154); + dasm_put(Dst, 5155); break; case 1: - dasm_put(Dst, 5160); + dasm_put(Dst, 5161); break; default: - dasm_put(Dst, 5166); + dasm_put(Dst, 5167); break; } - dasm_put(Dst, 5172); + dasm_put(Dst, 5173); switch (vk) { case 0: - dasm_put(Dst, 5199); + dasm_put(Dst, 5200); break; case 1: - dasm_put(Dst, 5202); + dasm_put(Dst, 5203); break; default: - dasm_put(Dst, 5205); + dasm_put(Dst, 5206); break; } - dasm_put(Dst, 5208); + dasm_put(Dst, 5209); if (vk == 1) { - dasm_put(Dst, 5210); + dasm_put(Dst, 5211); } else { - dasm_put(Dst, 5214); + dasm_put(Dst, 5215); } switch (vk) { case 0: - dasm_put(Dst, 5218); + dasm_put(Dst, 5219); break; case 1: - dasm_put(Dst, 5221); + dasm_put(Dst, 5222); break; default: - dasm_put(Dst, 5224); + dasm_put(Dst, 5225); break; } - dasm_put(Dst, 5227); + dasm_put(Dst, 5228); } else { vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5234); + dasm_put(Dst, 5235); if (LJ_DUALNUM) { - dasm_put(Dst, 5236); + dasm_put(Dst, 5237); } - dasm_put(Dst, 5238); + dasm_put(Dst, 5239); if (LJ_DUALNUM) { - dasm_put(Dst, 5241); + dasm_put(Dst, 5242); } else { - dasm_put(Dst, 5247); + dasm_put(Dst, 5248); } break; case 1: - dasm_put(Dst, 5251); + dasm_put(Dst, 5252); if (LJ_DUALNUM) { - dasm_put(Dst, 5253); + dasm_put(Dst, 5254); } - dasm_put(Dst, 5255); + dasm_put(Dst, 5256); if (LJ_DUALNUM) { - dasm_put(Dst, 5258); + dasm_put(Dst, 5259); } else { - dasm_put(Dst, 5264); + dasm_put(Dst, 5265); } break; default: - dasm_put(Dst, 5268); + dasm_put(Dst, 5269); break; } - dasm_put(Dst, 5278); + dasm_put(Dst, 5279); } break; case BC_MULVN: case BC_MULNV: case BC_MULVV: @@ -8967,188 +8968,188 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5291); + dasm_put(Dst, 5292); break; case 1: - dasm_put(Dst, 5297); + dasm_put(Dst, 5298); break; default: - dasm_put(Dst, 5303); + dasm_put(Dst, 5304); break; } - dasm_put(Dst, 5309); + dasm_put(Dst, 5310); switch (vk) { case 0: - dasm_put(Dst, 5336); + dasm_put(Dst, 5337); break; case 1: - dasm_put(Dst, 5339); + dasm_put(Dst, 5340); break; default: - dasm_put(Dst, 5342); + dasm_put(Dst, 5343); break; } - dasm_put(Dst, 5345); + dasm_put(Dst, 5346); if (vk == 1) { - dasm_put(Dst, 5347); + dasm_put(Dst, 5348); } else { - dasm_put(Dst, 5351); + dasm_put(Dst, 5352); } switch (vk) { case 0: - dasm_put(Dst, 5355); + dasm_put(Dst, 5356); break; case 1: - dasm_put(Dst, 5358); + dasm_put(Dst, 5359); break; default: - dasm_put(Dst, 5361); + dasm_put(Dst, 5362); break; } - dasm_put(Dst, 5364); + dasm_put(Dst, 5365); } else { vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5371); + dasm_put(Dst, 5372); if (LJ_DUALNUM) { - dasm_put(Dst, 5373); + dasm_put(Dst, 5374); } - dasm_put(Dst, 5375); + dasm_put(Dst, 5376); if (LJ_DUALNUM) { - dasm_put(Dst, 5378); + dasm_put(Dst, 5379); } else { - dasm_put(Dst, 5384); + dasm_put(Dst, 5385); } break; case 1: - dasm_put(Dst, 5388); + dasm_put(Dst, 5389); if (LJ_DUALNUM) { - dasm_put(Dst, 5390); + dasm_put(Dst, 5391); } - dasm_put(Dst, 5392); + dasm_put(Dst, 5393); if (LJ_DUALNUM) { - dasm_put(Dst, 5395); + dasm_put(Dst, 5396); } else { - dasm_put(Dst, 5401); + dasm_put(Dst, 5402); } break; default: - dasm_put(Dst, 5405); + dasm_put(Dst, 5406); break; } - dasm_put(Dst, 5415); + dasm_put(Dst, 5416); } break; case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5428); + dasm_put(Dst, 5429); if (LJ_DUALNUM) { - dasm_put(Dst, 5430); + dasm_put(Dst, 5431); } - dasm_put(Dst, 5432); + dasm_put(Dst, 5433); if (LJ_DUALNUM) { - dasm_put(Dst, 5435); + dasm_put(Dst, 5436); } else { - dasm_put(Dst, 5441); + dasm_put(Dst, 5442); } break; case 1: - dasm_put(Dst, 5445); + dasm_put(Dst, 5446); if (LJ_DUALNUM) { - dasm_put(Dst, 5447); + dasm_put(Dst, 5448); } - dasm_put(Dst, 5449); + dasm_put(Dst, 5450); if (LJ_DUALNUM) { - dasm_put(Dst, 5452); + dasm_put(Dst, 5453); } else { - dasm_put(Dst, 5458); + dasm_put(Dst, 5459); } break; default: - dasm_put(Dst, 5462); + dasm_put(Dst, 5463); break; } - dasm_put(Dst, 5472); + dasm_put(Dst, 5473); break; case BC_MODVN: if (LJ_DUALNUM) { vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5485); + dasm_put(Dst, 5486); break; case 1: - dasm_put(Dst, 5491); + dasm_put(Dst, 5492); break; default: - dasm_put(Dst, 5497); + dasm_put(Dst, 5498); break; } - dasm_put(Dst, 5503); + dasm_put(Dst, 5504); switch (vk) { case 0: - dasm_put(Dst, 5531); + dasm_put(Dst, 5532); break; case 1: - dasm_put(Dst, 5534); + dasm_put(Dst, 5535); break; default: - dasm_put(Dst, 5537); + dasm_put(Dst, 5538); break; } - dasm_put(Dst, 5540); + dasm_put(Dst, 5541); if (vk == 1) { - dasm_put(Dst, 5542); + dasm_put(Dst, 5543); } else { - dasm_put(Dst, 5546); + dasm_put(Dst, 5547); } switch (vk) { case 0: - dasm_put(Dst, 5550); + dasm_put(Dst, 5551); break; case 1: - dasm_put(Dst, 5553); + dasm_put(Dst, 5554); break; default: - dasm_put(Dst, 5556); + dasm_put(Dst, 5557); break; } - dasm_put(Dst, 5559); + dasm_put(Dst, 5560); } else { vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5571); + dasm_put(Dst, 5572); if (LJ_DUALNUM) { - dasm_put(Dst, 5573); + dasm_put(Dst, 5574); } - dasm_put(Dst, 5575); + dasm_put(Dst, 5576); if (LJ_DUALNUM) { - dasm_put(Dst, 5578); + dasm_put(Dst, 5579); } else { - dasm_put(Dst, 5584); + dasm_put(Dst, 5585); } break; case 1: - dasm_put(Dst, 5588); + dasm_put(Dst, 5589); if (LJ_DUALNUM) { - dasm_put(Dst, 5590); + dasm_put(Dst, 5591); } - dasm_put(Dst, 5592); + dasm_put(Dst, 5593); if (LJ_DUALNUM) { - dasm_put(Dst, 5595); + dasm_put(Dst, 5596); } else { - dasm_put(Dst, 5601); + dasm_put(Dst, 5602); } break; default: - dasm_put(Dst, 5605); + dasm_put(Dst, 5606); break; } - dasm_put(Dst, 5615); + dasm_put(Dst, 5616); } break; case BC_MODNV: case BC_MODVV: @@ -9156,297 +9157,297 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5633); + dasm_put(Dst, 5634); break; case 1: - dasm_put(Dst, 5639); + dasm_put(Dst, 5640); break; default: - dasm_put(Dst, 5645); + dasm_put(Dst, 5646); break; } - dasm_put(Dst, 5651); + dasm_put(Dst, 5652); switch (vk) { case 0: - dasm_put(Dst, 5679); + dasm_put(Dst, 5680); break; case 1: - dasm_put(Dst, 5682); + dasm_put(Dst, 5683); break; default: - dasm_put(Dst, 5685); + dasm_put(Dst, 5686); break; } - dasm_put(Dst, 5688); + dasm_put(Dst, 5689); if (vk == 1) { - dasm_put(Dst, 5690); + dasm_put(Dst, 5691); } else { - dasm_put(Dst, 5694); + dasm_put(Dst, 5695); } switch (vk) { case 0: - dasm_put(Dst, 5698); + dasm_put(Dst, 5699); break; case 1: - dasm_put(Dst, 5701); + dasm_put(Dst, 5702); break; default: - dasm_put(Dst, 5704); + dasm_put(Dst, 5705); break; } - dasm_put(Dst, 5707); + dasm_put(Dst, 5708); } else { vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 5710); + dasm_put(Dst, 5711); if (LJ_DUALNUM) { - dasm_put(Dst, 5712); + dasm_put(Dst, 5713); } - dasm_put(Dst, 5714); + dasm_put(Dst, 5715); if (LJ_DUALNUM) { - dasm_put(Dst, 5717); + dasm_put(Dst, 5718); } else { - dasm_put(Dst, 5723); + dasm_put(Dst, 5724); } break; case 1: - dasm_put(Dst, 5727); + dasm_put(Dst, 5728); if (LJ_DUALNUM) { - dasm_put(Dst, 5729); + dasm_put(Dst, 5730); } - dasm_put(Dst, 5731); + dasm_put(Dst, 5732); if (LJ_DUALNUM) { - dasm_put(Dst, 5734); + dasm_put(Dst, 5735); } else { - dasm_put(Dst, 5740); + dasm_put(Dst, 5741); } break; default: - dasm_put(Dst, 5744); + dasm_put(Dst, 5745); break; } - dasm_put(Dst, 5754); + dasm_put(Dst, 5755); } break; case BC_POW: - dasm_put(Dst, 5757); + dasm_put(Dst, 5758); break; case BC_CAT: - dasm_put(Dst, 5780, Dt1(->base), 32-3, Dt1(->base)); + dasm_put(Dst, 5781, Dt1(->base), 32-3, Dt1(->base)); break; /* -- Constant ops ------------------------------------------------------ */ case BC_KSTR: - dasm_put(Dst, 5810, 32-1, LJ_TSTR); + dasm_put(Dst, 5811, 32-1, LJ_TSTR); break; case BC_KCDATA: #if LJ_HASFFI - dasm_put(Dst, 5829, 32-1, LJ_TCDATA); + dasm_put(Dst, 5830, 32-1, LJ_TCDATA); #endif break; case BC_KSHORT: if (LJ_DUALNUM) { - dasm_put(Dst, 5848, 31-13); + dasm_put(Dst, 5849, 31-13); } else { - dasm_put(Dst, 5864, 31-13, 31-20); + dasm_put(Dst, 5865, 31-13, 31-20); } break; case BC_KNUM: - dasm_put(Dst, 5892); + dasm_put(Dst, 5893); break; case BC_KPRI: - dasm_put(Dst, 5905, 32-3); + dasm_put(Dst, 5906, 32-3); break; case BC_KNIL: - dasm_put(Dst, 5920); + dasm_put(Dst, 5921); break; /* -- Upvalue and function ops ------------------------------------------ */ case BC_UGET: - dasm_put(Dst, 5939, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 5940, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_USETV: - dasm_put(Dst, 5960, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); + dasm_put(Dst, 5961, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); break; case BC_USETS: - dasm_put(Dst, 6013, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_TSTR, LJ_GC_WHITES, GG_DISP2G); + dasm_put(Dst, 6014, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_TSTR, LJ_GC_WHITES, GG_DISP2G); break; case BC_USETN: - dasm_put(Dst, 6064, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 6065, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_USETP: - dasm_put(Dst, 6085, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 6086, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_UCLO: - dasm_put(Dst, 6108, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 6109, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); break; case BC_FNEW: - dasm_put(Dst, 6138, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC); + dasm_put(Dst, 6139, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC); break; /* -- Table ops --------------------------------------------------------- */ case BC_TNEW: case BC_TDUP: - dasm_put(Dst, 6166, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); + dasm_put(Dst, 6167, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); if (op == BC_TNEW) { - dasm_put(Dst, 6179); + dasm_put(Dst, 6180); } else { - dasm_put(Dst, 6188, 32-1); + dasm_put(Dst, 6189, 32-1); } - dasm_put(Dst, 6195, Dt1(->base), LJ_TTAB); + dasm_put(Dst, 6196, Dt1(->base), LJ_TTAB); if (op == BC_TNEW) { - dasm_put(Dst, 6212); + dasm_put(Dst, 6213); } - dasm_put(Dst, 6217); + dasm_put(Dst, 6218); break; case BC_GGET: case BC_GSET: - dasm_put(Dst, 6226, 32-1, Dt7(->env)); + dasm_put(Dst, 6227, 32-1, Dt7(->env)); if (op == BC_GGET) { - dasm_put(Dst, 6234); + dasm_put(Dst, 6235); } else { - dasm_put(Dst, 6237); + dasm_put(Dst, 6238); } break; case BC_TGETV: - dasm_put(Dst, 6240); + dasm_put(Dst, 6241); if (LJ_DUALNUM) { - dasm_put(Dst, 6244); + dasm_put(Dst, 6245); } else { - dasm_put(Dst, 6246); + dasm_put(Dst, 6247); } - dasm_put(Dst, 6248, LJ_TTAB); + dasm_put(Dst, 6249, LJ_TTAB); if (LJ_DUALNUM) { - dasm_put(Dst, 6254, Dt6(->asize), Dt6(->array), 31-3); + dasm_put(Dst, 6255, Dt6(->asize), Dt6(->array), 31-3); } else { - dasm_put(Dst, 6264, Dt6(->asize), Dt6(->array), 31-3); + dasm_put(Dst, 6265, Dt6(->asize), Dt6(->array), 31-3); } - dasm_put(Dst, 6281, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TSTR); + dasm_put(Dst, 6282, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TSTR); if (!LJ_DUALNUM) { - dasm_put(Dst, 6321); + dasm_put(Dst, 6322); } - dasm_put(Dst, 6323); + dasm_put(Dst, 6324); break; case BC_TGETS: - dasm_put(Dst, 6326, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL, DtB(->next)); - dasm_put(Dst, 6387, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 6327, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL, DtB(->next)); + dasm_put(Dst, 6388, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); break; case BC_TGETB: - dasm_put(Dst, 6407, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 6408, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); break; case BC_TSETV: - dasm_put(Dst, 6455); + dasm_put(Dst, 6456); if (LJ_DUALNUM) { - dasm_put(Dst, 6459); + dasm_put(Dst, 6460); } else { - dasm_put(Dst, 6461); + dasm_put(Dst, 6462); } - dasm_put(Dst, 6463, LJ_TTAB); + dasm_put(Dst, 6464, LJ_TTAB); if (LJ_DUALNUM) { - dasm_put(Dst, 6469, Dt6(->asize), Dt6(->array), 31-3); + dasm_put(Dst, 6470, Dt6(->asize), Dt6(->array), 31-3); } else { - dasm_put(Dst, 6479, Dt6(->asize), Dt6(->array), 31-3); + dasm_put(Dst, 6480, Dt6(->asize), Dt6(->array), 31-3); } - dasm_put(Dst, 6496, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); + dasm_put(Dst, 6497, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); if (!LJ_DUALNUM) { - dasm_put(Dst, 6543); + dasm_put(Dst, 6544); } - dasm_put(Dst, 6545, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 6546, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETS: - dasm_put(Dst, 6560, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), 4+offsetof(Node, key), DtB(->val), DtB(->next), LJ_TSTR, LJ_TNIL); - dasm_put(Dst, 6611, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); - dasm_put(Dst, 6668, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 6561, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), 4+offsetof(Node, key), DtB(->val), DtB(->next), LJ_TSTR, LJ_TNIL); + dasm_put(Dst, 6612, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); + dasm_put(Dst, 6669, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETB: - dasm_put(Dst, 6691, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); - dasm_put(Dst, 6749, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 6692, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); + dasm_put(Dst, 6750, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETM: - dasm_put(Dst, 6759, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); - dasm_put(Dst, 6828); + dasm_put(Dst, 6760, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 6829); break; /* -- Calls and vararg handling ----------------------------------------- */ case BC_CALLM: - dasm_put(Dst, 6831); + dasm_put(Dst, 6832); break; case BC_CALL: - dasm_put(Dst, 6833, LJ_TFUNC, Dt7(->pc)); + dasm_put(Dst, 6834, LJ_TFUNC, Dt7(->pc)); break; case BC_CALLMT: - dasm_put(Dst, 6854); + dasm_put(Dst, 6855); break; case BC_CALLT: - dasm_put(Dst, 6856, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); - dasm_put(Dst, 6920, FRAME_TYPE); + dasm_put(Dst, 6857, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); + dasm_put(Dst, 6921, FRAME_TYPE); break; case BC_ITERC: - dasm_put(Dst, 6929, LJ_TFUNC, Dt7(->pc)); + dasm_put(Dst, 6930, LJ_TFUNC, Dt7(->pc)); break; case BC_ITERN: #if LJ_HASJIT #endif - dasm_put(Dst, 6956, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL); + dasm_put(Dst, 6957, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL); if (LJ_DUALNUM) { - dasm_put(Dst, 6978); + dasm_put(Dst, 6979); } else { - dasm_put(Dst, 6981); + dasm_put(Dst, 6982); } - dasm_put(Dst, 6985, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 6986, -(BCBIAS_J*4 >> 16)); if (!LJ_DUALNUM) { - dasm_put(Dst, 6993); + dasm_put(Dst, 6994); } - dasm_put(Dst, 6995, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 6996, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16)); break; case BC_ISNEXT: - dasm_put(Dst, 7051, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7052, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); break; case BC_VARG: - dasm_put(Dst, 7101, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); - dasm_put(Dst, 7181); + dasm_put(Dst, 7102, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); + dasm_put(Dst, 7182); break; /* -- Returns ----------------------------------------------------------- */ case BC_RETM: - dasm_put(Dst, 7187); + dasm_put(Dst, 7188); break; case BC_RET: - dasm_put(Dst, 7189, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); + dasm_put(Dst, 7190, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); break; case BC_RET0: case BC_RET1: - dasm_put(Dst, 7259, FRAME_TYPE, FRAME_VARG); + dasm_put(Dst, 7260, FRAME_TYPE, FRAME_VARG); if (op == BC_RET1) { - dasm_put(Dst, 7272); + dasm_put(Dst, 7273); } - dasm_put(Dst, 7275, Dt7(->pc), PC2PROTO(k)); + dasm_put(Dst, 7276, Dt7(->pc), PC2PROTO(k)); break; /* -- Loops and branches ------------------------------------------------ */ case BC_FORL: #if LJ_HASJIT - dasm_put(Dst, 7303, GG_DISP2HOT, -HOTCOUNT_LOOP); + dasm_put(Dst, 7304, GG_DISP2HOT, -HOTCOUNT_LOOP); #endif break; @@ -9459,100 +9460,100 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_IFORL: vk = (op == BC_IFORL || op == BC_JFORL); if (LJ_DUALNUM) { - dasm_put(Dst, 7313, FORL_IDX*8+4); + dasm_put(Dst, 7314, FORL_IDX*8+4); if (vk) { - dasm_put(Dst, 7318, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4); + dasm_put(Dst, 7319, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4); } else { - dasm_put(Dst, 7332, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4); + dasm_put(Dst, 7333, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4); } - dasm_put(Dst, 7348, FORL_EXT*8); + dasm_put(Dst, 7349, FORL_EXT*8); if (op != BC_JFORL) { - dasm_put(Dst, 7355, 32-1); + dasm_put(Dst, 7356, 32-1); } - dasm_put(Dst, 7358, FORL_EXT*8+4); + dasm_put(Dst, 7359, FORL_EXT*8+4); if (op != BC_JFORL) { - dasm_put(Dst, 7361); + dasm_put(Dst, 7362); } if (op == BC_FORI) { - dasm_put(Dst, 7363); + dasm_put(Dst, 7364); } else if (op == BC_JFORI) { - dasm_put(Dst, 7366, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7367, -(BCBIAS_J*4 >> 16)); } else if (op == BC_IFORL) { - dasm_put(Dst, 7371, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7372, -(BCBIAS_J*4 >> 16)); } else { - dasm_put(Dst, 7376, BC_JLOOP); + dasm_put(Dst, 7377, BC_JLOOP); } - dasm_put(Dst, 7379); + dasm_put(Dst, 7380); if (vk) { - dasm_put(Dst, 7395); + dasm_put(Dst, 7396); } } if (vk) { if (LJ_DUALNUM) { - dasm_put(Dst, 7402, FORL_IDX*8); + dasm_put(Dst, 7403, FORL_IDX*8); } else { - dasm_put(Dst, 7406); + dasm_put(Dst, 7407); } - dasm_put(Dst, 7408, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8); + dasm_put(Dst, 7409, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8); } else { if (LJ_DUALNUM) { - dasm_put(Dst, 7418); + dasm_put(Dst, 7419); } else { - dasm_put(Dst, 7420, FORL_STEP*8, FORL_STOP*8); + dasm_put(Dst, 7421, FORL_STEP*8, FORL_STOP*8); } - dasm_put(Dst, 7429, FORL_IDX*8, FORL_STOP*8); + dasm_put(Dst, 7430, FORL_IDX*8, FORL_STOP*8); } - dasm_put(Dst, 7438); + dasm_put(Dst, 7439); if (op != BC_JFORL) { - dasm_put(Dst, 7440, 32-1); + dasm_put(Dst, 7441, 32-1); } - dasm_put(Dst, 7443, FORL_EXT*8); + dasm_put(Dst, 7444, FORL_EXT*8); if (op != BC_JFORL) { - dasm_put(Dst, 7446); + dasm_put(Dst, 7447); } - dasm_put(Dst, 7448); + dasm_put(Dst, 7449); if (op == BC_JFORI) { - dasm_put(Dst, 7450, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7451, -(BCBIAS_J*4 >> 16)); } - dasm_put(Dst, 7453); + dasm_put(Dst, 7454); if (op == BC_FORI) { - dasm_put(Dst, 7456); + dasm_put(Dst, 7457); } else if (op == BC_IFORL) { if (LJ_DUALNUM) { - dasm_put(Dst, 7459); + dasm_put(Dst, 7460); } else { - dasm_put(Dst, 7462); + dasm_put(Dst, 7463); } - dasm_put(Dst, 7465, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7466, -(BCBIAS_J*4 >> 16)); } else if (op == BC_JFORI) { - dasm_put(Dst, 7469); + dasm_put(Dst, 7470); } else { - dasm_put(Dst, 7472, BC_JLOOP); + dasm_put(Dst, 7473, BC_JLOOP); } if (LJ_DUALNUM) { - dasm_put(Dst, 7475); + dasm_put(Dst, 7476); } else { - dasm_put(Dst, 7478); + dasm_put(Dst, 7479); } - dasm_put(Dst, 7490); + dasm_put(Dst, 7491); if (op == BC_FORI) { - dasm_put(Dst, 7492, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7493, -(BCBIAS_J*4 >> 16)); } else if (op == BC_IFORL) { - dasm_put(Dst, 7498); + dasm_put(Dst, 7499); } else if (op == BC_JFORI) { - dasm_put(Dst, 7501); + dasm_put(Dst, 7502); } else { - dasm_put(Dst, 7504, BC_JLOOP); + dasm_put(Dst, 7505, BC_JLOOP); } - dasm_put(Dst, 7507); + dasm_put(Dst, 7508); if (op == BC_JFORI) { - dasm_put(Dst, 7510, BC_JLOOP); + dasm_put(Dst, 7511, BC_JLOOP); } break; case BC_ITERL: #if LJ_HASJIT - dasm_put(Dst, 7516, GG_DISP2HOT, -HOTCOUNT_LOOP); + dasm_put(Dst, 7517, GG_DISP2HOT, -HOTCOUNT_LOOP); #endif break; @@ -9561,40 +9562,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IITERL: - dasm_put(Dst, 7526, LJ_TNIL); + dasm_put(Dst, 7527, LJ_TNIL); if (op == BC_JITERL) { - dasm_put(Dst, 7533, BC_JLOOP); + dasm_put(Dst, 7534, BC_JLOOP); } else { - dasm_put(Dst, 7538, 32-1, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7539, 32-1, -(BCBIAS_J*4 >> 16)); } - dasm_put(Dst, 7546); + dasm_put(Dst, 7547); break; case BC_LOOP: #if LJ_HASJIT - dasm_put(Dst, 7558, GG_DISP2HOT, -HOTCOUNT_LOOP); + dasm_put(Dst, 7559, GG_DISP2HOT, -HOTCOUNT_LOOP); #endif break; case BC_ILOOP: - dasm_put(Dst, 7568); + dasm_put(Dst, 7569); break; case BC_JLOOP: #if LJ_HASJIT - dasm_put(Dst, 7579, DISPATCH_J(trace), 32-1, DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), GG_DISP2G+32768); + dasm_put(Dst, 7580, DISPATCH_J(trace), 32-1, DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), GG_DISP2G+32768); #endif break; case BC_JMP: - dasm_put(Dst, 7598, 32-1, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 7599, 32-1, -(BCBIAS_J*4 >> 16)); break; /* -- Function headers -------------------------------------------------- */ case BC_FUNCF: #if LJ_HASJIT - dasm_put(Dst, 7614, GG_DISP2HOT, -HOTCOUNT_CALL); + dasm_put(Dst, 7615, GG_DISP2HOT, -HOTCOUNT_CALL); #endif case BC_FUNCV: /* NYI: compiled vararg functions. */ break; @@ -9604,42 +9605,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IFUNCF: - dasm_put(Dst, 7624, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); + dasm_put(Dst, 7625, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); if (op != BC_JFUNCF) { - dasm_put(Dst, 7636); + dasm_put(Dst, 7637); } - dasm_put(Dst, 7639); + dasm_put(Dst, 7640); if (op == BC_JFUNCF) { - dasm_put(Dst, 7644, BC_JLOOP); + dasm_put(Dst, 7645, BC_JLOOP); } else { - dasm_put(Dst, 7648); + dasm_put(Dst, 7649); } - dasm_put(Dst, 7657); + dasm_put(Dst, 7658); break; case BC_JFUNCV: #if !LJ_HASJIT break; #endif - dasm_put(Dst, 7663); + dasm_put(Dst, 7664); break; /* NYI: compiled vararg functions. */ case BC_IFUNCV: - dasm_put(Dst, 7665, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL); + dasm_put(Dst, 7666, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL); break; case BC_FUNCC: case BC_FUNCCW: if (op == BC_FUNCC) { - dasm_put(Dst, 7718, Dt8(->f)); + dasm_put(Dst, 7719, Dt8(->f)); } else { - dasm_put(Dst, 7721, DISPATCH_GL(wrapf)); + dasm_put(Dst, 7722, DISPATCH_GL(wrapf)); } - dasm_put(Dst, 7724, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); + dasm_put(Dst, 7725, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); if (op == BC_FUNCCW) { - dasm_put(Dst, 7737, Dt8(->f)); + dasm_put(Dst, 7738, Dt8(->f)); } - dasm_put(Dst, 7740, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); + dasm_put(Dst, 7741, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); break; /* ---------------------------------------------------------------------- */ @@ -9659,7 +9660,7 @@ static int build_backend(BuildCtx *ctx) build_subroutines(ctx); - dasm_put(Dst, 7761); + dasm_put(Dst, 7762); for (op = 0; op < BC__MAX; op++) build_ins(ctx, (BCOp)op, op); diff --git a/luajit2/src/buildvm_ppcspe.dasc b/luajit2/src/buildvm_ppcspe.dasc index b9ee5b01..a7ef3ccd 100644 --- a/luajit2/src/buildvm_ppcspe.dasc +++ b/luajit2/src/buildvm_ppcspe.dasc @@ -1813,6 +1813,7 @@ static void build_subroutines(BuildCtx *ctx) | bne >3 | lwz INS, -4(PC) | decode_RA8 TMP1, INS + | addi TMP1, TMP1, 8 |3: | sub TMP2, BASE, TMP1 | b ->vm_call_dispatch // Resolve again for tailcall. diff --git a/luajit2/src/buildvm_ppcspe.h b/luajit2/src/buildvm_ppcspe.h index 32571ebe..44fed683 100644 --- a/luajit2/src/buildvm_ppcspe.h +++ b/luajit2/src/buildvm_ppcspe.h @@ -12,7 +12,7 @@ #define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_SUB 1 #define DASM_MAXSECTION 2 -static const unsigned int build_actionlist[4995] = { +static const unsigned int build_actionlist[4996] = { 0x00010001, 0x00060014, 0x72000000, @@ -2516,6 +2516,7 @@ static const unsigned int build_actionlist[4995] = { 0x00050803, 0x80f0fffc, 0x54e8dd78, +0x39080008, 0x0006000d, 0x7d287050, 0x48000000, @@ -5433,38 +5434,38 @@ static void build_subroutines(BuildCtx *ctx) dasm_put(Dst, 2417, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); dasm_put(Dst, 2496, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); #if LJ_HASJIT - dasm_put(Dst, 2538); + dasm_put(Dst, 2539); #endif - dasm_put(Dst, 2540, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); - dasm_put(Dst, 2587, GG_DISP2STATIC); + dasm_put(Dst, 2541, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 2588, GG_DISP2STATIC); #if LJ_HASJIT - dasm_put(Dst, 2605); + dasm_put(Dst, 2606); #endif - dasm_put(Dst, 2607); + dasm_put(Dst, 2608); #if LJ_HASJIT - dasm_put(Dst, 2610); + dasm_put(Dst, 2611); #endif - dasm_put(Dst, 2613); + dasm_put(Dst, 2614); #if LJ_HASJIT - dasm_put(Dst, 2615); + dasm_put(Dst, 2616); #endif - dasm_put(Dst, 2618, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); + dasm_put(Dst, 2619, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); #if LJ_HASJIT - dasm_put(Dst, 2640); + dasm_put(Dst, 2641); #endif - dasm_put(Dst, 2642); + dasm_put(Dst, 2643); #if LJ_HASJIT - dasm_put(Dst, 2644); + dasm_put(Dst, 2645); #endif - dasm_put(Dst, 2646); + dasm_put(Dst, 2647); #if LJ_HASJIT - dasm_put(Dst, 2730); + dasm_put(Dst, 2731); #else - dasm_put(Dst, 2753); + dasm_put(Dst, 2754); #endif - dasm_put(Dst, 2756); + dasm_put(Dst, 2757); #if LJ_HASFFI - dasm_put(Dst, 2819); + dasm_put(Dst, 2820); #endif } @@ -5472,7 +5473,7 @@ static void build_subroutines(BuildCtx *ctx) static void build_ins(BuildCtx *ctx, BCOp op, int defop) { int vk = 0; - dasm_put(Dst, 2821, defop); + dasm_put(Dst, 2822, defop); switch (op) { @@ -5481,118 +5482,118 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) /* Remember: all ops branch for a true comparison, fall through otherwise. */ case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: - dasm_put(Dst, 2823, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 2824, -(BCBIAS_J*4 >> 16)); if (op == BC_ISLE || op == BC_ISGT) { - dasm_put(Dst, 2837); + dasm_put(Dst, 2838); } if (op == BC_ISLT || op == BC_ISLE) { - dasm_put(Dst, 2840); + dasm_put(Dst, 2841); } else { - dasm_put(Dst, 2842); + dasm_put(Dst, 2843); } - dasm_put(Dst, 2844); + dasm_put(Dst, 2845); break; case BC_ISEQV: case BC_ISNEV: vk = op == BC_ISEQV; - dasm_put(Dst, 2855, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 2856, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 2869); + dasm_put(Dst, 2870); } else { - dasm_put(Dst, 2871); + dasm_put(Dst, 2872); } - dasm_put(Dst, 2873, ~LJ_TISPRI, ~LJ_TISTABUD); + dasm_put(Dst, 2874, ~LJ_TISPRI, ~LJ_TISTABUD); if (vk) { - dasm_put(Dst, 2895); + dasm_put(Dst, 2896); } else { - dasm_put(Dst, 2897); + dasm_put(Dst, 2898); } - dasm_put(Dst, 2899); + dasm_put(Dst, 2900); if (vk) { - dasm_put(Dst, 2901); + dasm_put(Dst, 2902); } else { - dasm_put(Dst, 2903); + dasm_put(Dst, 2904); } - dasm_put(Dst, 2905, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); + dasm_put(Dst, 2906, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); break; case BC_ISEQS: case BC_ISNES: vk = op == BC_ISEQS; - dasm_put(Dst, 2926, 32-1, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 2927, 32-1, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 2940); + dasm_put(Dst, 2941); } else { - dasm_put(Dst, 2942); + dasm_put(Dst, 2943); } - dasm_put(Dst, 2944); + dasm_put(Dst, 2945); break; case BC_ISEQN: case BC_ISNEN: vk = op == BC_ISEQN; - dasm_put(Dst, 2955, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 2956, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 2969); + dasm_put(Dst, 2970); } else { - dasm_put(Dst, 2972); + dasm_put(Dst, 2973); } - dasm_put(Dst, 2974); + dasm_put(Dst, 2975); if (!vk) { - dasm_put(Dst, 2986); + dasm_put(Dst, 2987); } break; case BC_ISEQP: case BC_ISNEP: vk = op == BC_ISEQP; - dasm_put(Dst, 2992, 32-3, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 2993, 32-3, -(BCBIAS_J*4 >> 16)); if (vk) { - dasm_put(Dst, 3004); + dasm_put(Dst, 3005); } else { - dasm_put(Dst, 3006); + dasm_put(Dst, 3007); } - dasm_put(Dst, 3008); + dasm_put(Dst, 3009); break; /* -- Unary test and copy ops ------------------------------------------- */ case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: - dasm_put(Dst, 3019); + dasm_put(Dst, 3020); if (op == BC_IST || op == BC_ISF) { - dasm_put(Dst, 3025, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 3026, -(BCBIAS_J*4 >> 16)); if (op == BC_IST) { - dasm_put(Dst, 3030); + dasm_put(Dst, 3031); } else { - dasm_put(Dst, 3032); + dasm_put(Dst, 3033); } } else { if (op == BC_ISTC) { - dasm_put(Dst, 3034); + dasm_put(Dst, 3035); } else { - dasm_put(Dst, 3037); + dasm_put(Dst, 3038); } - dasm_put(Dst, 3040, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 3041, -(BCBIAS_J*4 >> 16)); } - dasm_put(Dst, 3047); + dasm_put(Dst, 3048); break; /* -- Unary ops --------------------------------------------------------- */ case BC_MOV: - dasm_put(Dst, 3058); + dasm_put(Dst, 3059); break; case BC_NOT: - dasm_put(Dst, 3071, LJ_TTRUE); + dasm_put(Dst, 3072, LJ_TTRUE); break; case BC_UNM: - dasm_put(Dst, 3087); + dasm_put(Dst, 3088); break; case BC_LEN: - dasm_put(Dst, 3104, Dt5(->len)); + dasm_put(Dst, 3105, Dt5(->len)); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 3128, Dt6(->metatable)); + dasm_put(Dst, 3129, Dt6(->metatable)); #endif - dasm_put(Dst, 3135); + dasm_put(Dst, 3136); #ifdef LUAJIT_ENABLE_LUA52COMPAT - dasm_put(Dst, 3141, Dt6(->nomm), 1<<MM_len); + dasm_put(Dst, 3142, Dt6(->nomm), 1<<MM_len); #endif break; @@ -5603,262 +5604,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3151); + dasm_put(Dst, 3152); break; case 1: - dasm_put(Dst, 3157); + dasm_put(Dst, 3158); break; default: - dasm_put(Dst, 3163); + dasm_put(Dst, 3164); break; } - dasm_put(Dst, 3170); + dasm_put(Dst, 3171); break; case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3183); + dasm_put(Dst, 3184); break; case 1: - dasm_put(Dst, 3189); + dasm_put(Dst, 3190); break; default: - dasm_put(Dst, 3195); + dasm_put(Dst, 3196); break; } - dasm_put(Dst, 3202); + dasm_put(Dst, 3203); break; case BC_MULVN: case BC_MULNV: case BC_MULVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3215); + dasm_put(Dst, 3216); break; case 1: - dasm_put(Dst, 3221); + dasm_put(Dst, 3222); break; default: - dasm_put(Dst, 3227); + dasm_put(Dst, 3228); break; } - dasm_put(Dst, 3234); + dasm_put(Dst, 3235); break; case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3247); + dasm_put(Dst, 3248); break; case 1: - dasm_put(Dst, 3253); + dasm_put(Dst, 3254); break; default: - dasm_put(Dst, 3259); + dasm_put(Dst, 3260); break; } - dasm_put(Dst, 3266); + dasm_put(Dst, 3267); break; case BC_MODVN: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3279); + dasm_put(Dst, 3280); break; case 1: - dasm_put(Dst, 3285); + dasm_put(Dst, 3286); break; default: - dasm_put(Dst, 3291); + dasm_put(Dst, 3292); break; } - dasm_put(Dst, 3298); + dasm_put(Dst, 3299); break; case BC_MODNV: case BC_MODVV: vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); switch (vk) { case 0: - dasm_put(Dst, 3316); + dasm_put(Dst, 3317); break; case 1: - dasm_put(Dst, 3322); + dasm_put(Dst, 3323); break; default: - dasm_put(Dst, 3328); + dasm_put(Dst, 3329); break; } - dasm_put(Dst, 3335); + dasm_put(Dst, 3336); break; case BC_POW: - dasm_put(Dst, 3338); + dasm_put(Dst, 3339); break; case BC_CAT: - dasm_put(Dst, 3360, Dt1(->base), 32-3, Dt1(->base)); + dasm_put(Dst, 3361, Dt1(->base), 32-3, Dt1(->base)); break; /* -- Constant ops ------------------------------------------------------ */ case BC_KSTR: - dasm_put(Dst, 3390, 32-1); + dasm_put(Dst, 3391, 32-1); break; case BC_KCDATA: #if LJ_HASFFI - dasm_put(Dst, 3407, 32-1, LJ_TCDATA); + dasm_put(Dst, 3408, 32-1, LJ_TCDATA); #endif break; case BC_KSHORT: - dasm_put(Dst, 3426, 32-3); + dasm_put(Dst, 3427, 32-3); break; case BC_KNUM: - dasm_put(Dst, 3442); + dasm_put(Dst, 3443); break; case BC_KPRI: - dasm_put(Dst, 3455, 32-3); + dasm_put(Dst, 3456, 32-3); break; case BC_KNIL: - dasm_put(Dst, 3470); + dasm_put(Dst, 3471); break; /* -- Upvalue and function ops ------------------------------------------ */ case BC_UGET: - dasm_put(Dst, 3489, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 3490, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_USETV: - dasm_put(Dst, 3510, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); + dasm_put(Dst, 3511, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); break; case BC_USETS: - dasm_put(Dst, 3562, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); + dasm_put(Dst, 3563, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); break; case BC_USETN: - dasm_put(Dst, 3611, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); + dasm_put(Dst, 3612, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); break; case BC_USETP: - dasm_put(Dst, 3632, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); + dasm_put(Dst, 3633, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); break; case BC_UCLO: - dasm_put(Dst, 3655, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); + dasm_put(Dst, 3656, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); break; case BC_FNEW: - dasm_put(Dst, 3685, 32-1, Dt1(->base), Dt1(->base)); + dasm_put(Dst, 3686, 32-1, Dt1(->base), Dt1(->base)); break; /* -- Table ops --------------------------------------------------------- */ case BC_TNEW: case BC_TDUP: - dasm_put(Dst, 3711, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); + dasm_put(Dst, 3712, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); if (op == BC_TNEW) { - dasm_put(Dst, 3724); + dasm_put(Dst, 3725); } else { - dasm_put(Dst, 3732, 32-1); + dasm_put(Dst, 3733, 32-1); } - dasm_put(Dst, 3739, Dt1(->base)); + dasm_put(Dst, 3740, Dt1(->base)); break; case BC_GGET: case BC_GSET: - dasm_put(Dst, 3762, 32-1, Dt7(->env)); + dasm_put(Dst, 3763, 32-1, Dt7(->env)); if (op == BC_GGET) { - dasm_put(Dst, 3770); + dasm_put(Dst, 3771); } else { - dasm_put(Dst, 3773); + dasm_put(Dst, 3774); } break; case BC_TGETV: - dasm_put(Dst, 3776, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 3777, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); break; case BC_TGETS: - dasm_put(Dst, 3834, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); - dasm_put(Dst, 3898); + dasm_put(Dst, 3835, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 3899); break; case BC_TGETB: - dasm_put(Dst, 3903, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); + dasm_put(Dst, 3904, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); break; case BC_TSETV: - dasm_put(Dst, 3947, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); - dasm_put(Dst, 4014, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 3948, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); + dasm_put(Dst, 4015, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); break; case BC_TSETS: - dasm_put(Dst, 4026, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); - dasm_put(Dst, 4087, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); - dasm_put(Dst, 4138, Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 4027, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); + dasm_put(Dst, 4088, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); + dasm_put(Dst, 4139, Dt6(->marked), Dt6(->gclist)); break; case BC_TSETB: - dasm_put(Dst, 4145, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); - dasm_put(Dst, 4205, Dt6(->gclist)); + dasm_put(Dst, 4146, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); + dasm_put(Dst, 4206, Dt6(->gclist)); break; case BC_TSETM: - dasm_put(Dst, 4210, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); - dasm_put(Dst, 4279); + dasm_put(Dst, 4211, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); + dasm_put(Dst, 4280); break; /* -- Calls and vararg handling ----------------------------------------- */ case BC_CALLM: - dasm_put(Dst, 4282); + dasm_put(Dst, 4283); break; case BC_CALL: - dasm_put(Dst, 4284, Dt7(->pc)); + dasm_put(Dst, 4285, Dt7(->pc)); break; case BC_CALLMT: - dasm_put(Dst, 4304); + dasm_put(Dst, 4305); break; case BC_CALLT: - dasm_put(Dst, 4306, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); - dasm_put(Dst, 4371, FRAME_TYPE); + dasm_put(Dst, 4307, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); + dasm_put(Dst, 4372, FRAME_TYPE); break; case BC_ITERC: - dasm_put(Dst, 4378, Dt7(->pc)); + dasm_put(Dst, 4379, Dt7(->pc)); break; case BC_ITERN: #if LJ_HASJIT #endif - dasm_put(Dst, 4404, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); - dasm_put(Dst, 4483); + dasm_put(Dst, 4405, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4484); break; case BC_ISNEXT: - dasm_put(Dst, 4487, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4488, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); break; case BC_VARG: - dasm_put(Dst, 4538, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); - dasm_put(Dst, 4618); + dasm_put(Dst, 4539, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); + dasm_put(Dst, 4619); break; /* -- Returns ----------------------------------------------------------- */ case BC_RETM: - dasm_put(Dst, 4624); + dasm_put(Dst, 4625); break; case BC_RET: - dasm_put(Dst, 4626, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); + dasm_put(Dst, 4627, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); break; case BC_RET0: case BC_RET1: - dasm_put(Dst, 4696, FRAME_TYPE, FRAME_VARG); + dasm_put(Dst, 4697, FRAME_TYPE, FRAME_VARG); if (op == BC_RET1) { - dasm_put(Dst, 4709); + dasm_put(Dst, 4710); } - dasm_put(Dst, 4712, Dt7(->pc), PC2PROTO(k)); + dasm_put(Dst, 4713, Dt7(->pc), PC2PROTO(k)); break; /* -- Loops and branches ------------------------------------------------ */ case BC_FORL: #if LJ_HASJIT - dasm_put(Dst, 4740); + dasm_put(Dst, 4741); #endif break; @@ -5870,35 +5871,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) case BC_FORI: case BC_IFORL: vk = (op == BC_IFORL || op == BC_JFORL); - dasm_put(Dst, 4742, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); + dasm_put(Dst, 4743, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); if (!vk) { - dasm_put(Dst, 4750); + dasm_put(Dst, 4751); } if (vk) { - dasm_put(Dst, 4758, FORL_IDX*8); + dasm_put(Dst, 4759, FORL_IDX*8); } - dasm_put(Dst, 4762, FORL_EXT*8); + dasm_put(Dst, 4763, FORL_EXT*8); if (op != BC_JFORL) { - dasm_put(Dst, 4770, 32-1); + dasm_put(Dst, 4771, 32-1); if (op == BC_JFORI) { - dasm_put(Dst, 4774, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4775, -(BCBIAS_J*4 >> 16)); } else { - dasm_put(Dst, 4777, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4778, -(BCBIAS_J*4 >> 16)); } } if (op == BC_FORI) { - dasm_put(Dst, 4780); + dasm_put(Dst, 4781); } else if (op == BC_IFORL) { - dasm_put(Dst, 4782); + dasm_put(Dst, 4783); } else { - dasm_put(Dst, 4784, BC_JLOOP); + dasm_put(Dst, 4785, BC_JLOOP); } - dasm_put(Dst, 4787); + dasm_put(Dst, 4788); break; case BC_ITERL: #if LJ_HASJIT - dasm_put(Dst, 4802); + dasm_put(Dst, 4803); #endif break; @@ -5907,40 +5908,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IITERL: - dasm_put(Dst, 4804); + dasm_put(Dst, 4805); if (op == BC_JITERL) { - dasm_put(Dst, 4810); + dasm_put(Dst, 4811); } else { - dasm_put(Dst, 4812, 32-1, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4813, 32-1, -(BCBIAS_J*4 >> 16)); } - dasm_put(Dst, 4819); + dasm_put(Dst, 4820); break; case BC_LOOP: #if LJ_HASJIT - dasm_put(Dst, 4831); + dasm_put(Dst, 4832); #endif break; case BC_ILOOP: - dasm_put(Dst, 4833); + dasm_put(Dst, 4834); break; case BC_JLOOP: #if LJ_HASJIT - dasm_put(Dst, 4844); + dasm_put(Dst, 4845); #endif break; case BC_JMP: - dasm_put(Dst, 4846, 32-1, -(BCBIAS_J*4 >> 16)); + dasm_put(Dst, 4847, 32-1, -(BCBIAS_J*4 >> 16)); break; /* -- Function headers -------------------------------------------------- */ case BC_FUNCF: #if LJ_HASJIT - dasm_put(Dst, 4862); + dasm_put(Dst, 4863); #endif case BC_FUNCV: /* NYI: compiled vararg functions. */ break; @@ -5950,38 +5951,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) break; #endif case BC_IFUNCF: - dasm_put(Dst, 4864, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); + dasm_put(Dst, 4865, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); if (op == BC_JFUNCF) { - dasm_put(Dst, 4882); + dasm_put(Dst, 4883); } else { - dasm_put(Dst, 4884); + dasm_put(Dst, 4885); } - dasm_put(Dst, 4893); + dasm_put(Dst, 4894); break; case BC_JFUNCV: #if !LJ_HASJIT break; #endif - dasm_put(Dst, 4899); + dasm_put(Dst, 4900); break; /* NYI: compiled vararg functions. */ case BC_IFUNCV: - dasm_put(Dst, 4901, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); + dasm_put(Dst, 4902, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); break; case BC_FUNCC: case BC_FUNCCW: if (op == BC_FUNCC) { - dasm_put(Dst, 4951, Dt8(->f)); + dasm_put(Dst, 4952, Dt8(->f)); } else { - dasm_put(Dst, 4954, DISPATCH_GL(wrapf)); + dasm_put(Dst, 4955, DISPATCH_GL(wrapf)); } - dasm_put(Dst, 4957, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); + dasm_put(Dst, 4958, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); if (op == BC_FUNCCW) { - dasm_put(Dst, 4970, Dt8(->f)); + dasm_put(Dst, 4971, Dt8(->f)); } - dasm_put(Dst, 4973, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); + dasm_put(Dst, 4974, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); break; /* ---------------------------------------------------------------------- */ @@ -6001,7 +6002,7 @@ static int build_backend(BuildCtx *ctx) build_subroutines(ctx); - dasm_put(Dst, 4994); + dasm_put(Dst, 4995); for (op = 0; op < BC__MAX; op++) build_ins(ctx, (BCOp)op, op); diff --git a/luajit2/src/lib_base.c b/luajit2/src/lib_base.c index 927c1bca..149aa5cf 100644 --- a/luajit2/src/lib_base.c +++ b/luajit2/src/lib_base.c @@ -550,9 +550,10 @@ LJLIB_CF(coroutine_running) LJLIB_CF(coroutine_create) { - lua_State *L1 = lua_newthread(L); + lua_State *L1; if (!(L->base < L->top && tvisfunc(L->base))) lj_err_argt(L, 1, LUA_TFUNCTION); + L1 = lua_newthread(L); setfuncV(L, L1->top++, funcV(L->base)); return 1; } diff --git a/luajit2/src/lj.supp b/luajit2/src/lj.supp index f1126ad7..411f2617 100644 --- a/luajit2/src/lj.supp +++ b/luajit2/src/lj.supp @@ -1,4 +1,4 @@ -# Valgrind suppression file for LuaJIT 2.x. +# Valgrind suppression file for LuaJIT 2.0. { Optimized string compare Memcheck:Addr4 @@ -6,11 +6,21 @@ } { Optimized string compare + Memcheck:Addr1 + fun:lj_str_cmp +} +{ + Optimized string compare Memcheck:Addr4 fun:lj_str_new } { Optimized string compare + Memcheck:Addr1 + fun:lj_str_new +} +{ + Optimized string compare Memcheck:Cond fun:lj_str_new } diff --git a/luajit2/src/lj_asm.c b/luajit2/src/lj_asm.c index 1a78e32a..4da1a0a3 100644 --- a/luajit2/src/lj_asm.c +++ b/luajit2/src/lj_asm.c @@ -1079,6 +1079,64 @@ static void asm_phi_shuffle(ASMState *as) } } +/* Copy unsynced left/right PHI spill slots. Rarely needed. */ +static void asm_phi_copyspill(ASMState *as) +{ + int need = 0; + IRIns *ir; + for (ir = IR(as->orignins-1); ir->o == IR_PHI; ir--) + if (ra_hasspill(ir->s) && ra_hasspill(IR(ir->op1)->s)) + need |= irt_isfp(ir->t) ? 2 : 1; /* Unsynced spill slot? */ + if ((need & 1)) { /* Copy integer spill slots. */ +#if !LJ_TARGET_X86ORX64 + Reg r = RID_TMP; +#else + Reg r = RID_RET; + if ((as->freeset & RSET_GPR)) + r = rset_pickbot((as->freeset & RSET_GPR)); + else + emit_spload(as, IR(regcost_ref(as->cost[r])), r, SPOFS_TMP); +#endif + for (ir = IR(as->orignins-1); ir->o == IR_PHI; ir--) { + if (ra_hasspill(ir->s)) { + IRIns *irl = IR(ir->op1); + if (ra_hasspill(irl->s) && !irt_isfp(ir->t)) { + emit_spstore(as, irl, r, sps_scale(irl->s)); + emit_spload(as, ir, r, sps_scale(ir->s)); + } + } + } +#if LJ_TARGET_X86ORX64 + if (!rset_test(as->freeset, r)) + emit_spstore(as, IR(regcost_ref(as->cost[r])), r, SPOFS_TMP); +#endif + } +#if !LJ_SOFTFP + if ((need & 2)) { /* Copy FP spill slots. */ +#if LJ_TARGET_X86 + Reg r = RID_XMM0; +#else + Reg r = RID_FPRET; +#endif + if ((as->freeset & RSET_FPR)) + r = rset_pickbot((as->freeset & RSET_FPR)); + if (!rset_test(as->freeset, r)) + emit_spload(as, IR(regcost_ref(as->cost[r])), r, SPOFS_TMP); + for (ir = IR(as->orignins-1); ir->o == IR_PHI; ir--) { + if (ra_hasspill(ir->s)) { + IRIns *irl = IR(ir->op1); + if (ra_hasspill(irl->s) && irt_isfp(ir->t)) { + emit_spstore(as, irl, r, sps_scale(irl->s)); + emit_spload(as, ir, r, sps_scale(ir->s)); + } + } + } + if (!rset_test(as->freeset, r)) + emit_spstore(as, IR(regcost_ref(as->cost[r])), r, SPOFS_TMP); + } +#endif +} + /* Emit renames for left PHIs which are only spilled outside the loop. */ static void asm_phi_fixup(ASMState *as) { @@ -1132,7 +1190,7 @@ static void asm_phi(ASMState *as, IRIns *ir) if (ra_hasreg(irl->r) || ra_hasreg(irr->r)) lj_trace_err(as->J, LJ_TRERR_NYIPHI); ra_spill(as, ir); - irl->s = irr->s = ir->s; /* Sync left/right PHI spill slots. */ + irr->s = ir->s; /* Set right PHI spill slot. Sync left slot later. */ } } @@ -1142,6 +1200,7 @@ static void asm_loop_fixup(ASMState *as); /* Middle part of a loop. */ static void asm_loop(ASMState *as) { + MCode *mcspill; /* LOOP is a guard, so the snapno is up to date. */ as->loopsnapno = as->snapno; if (as->gcsteps) @@ -1151,10 +1210,14 @@ static void asm_loop(ASMState *as) as->sectref = 0; if (!neverfuse(as)) as->fuseref = 0; asm_phi_shuffle(as); + mcspill = as->mcp; + asm_phi_copyspill(as); asm_loop_fixup(as); as->mcloop = as->mcp; RA_DBGX((as, "===== LOOP =====")); if (!as->realign) RA_DBG_FLUSH(); + if (as->mcp != mcspill) + emit_jmp(as, mcspill); } /* -- Target-specific assembler ------------------------------------------- */ diff --git a/luajit2/src/lj_asm_arm.h b/luajit2/src/lj_asm_arm.h index a618c8a9..5ec3d59f 100644 --- a/luajit2/src/lj_asm_arm.h +++ b/luajit2/src/lj_asm_arm.h @@ -584,8 +584,8 @@ static void asm_href(ASMState *as, IRIns *ir, IROp merge) else emit_branch(as, ARMF_CC(ARMI_B, CC_EQ), l_end); if (!irt_ispri(kt)) { - emit_nm(as, ARMF_CC(ARMI_CMP, CC_EQ)^khi, tmp+1, keyhi); - emit_nm(as, ARMI_CMP^k, tmp, key); + emit_nm(as, ARMF_CC(ARMI_CMP, CC_EQ)^k, tmp, key); + emit_nm(as, ARMI_CMP^khi, tmp+1, keyhi); emit_lsox(as, ARMI_LDRD, tmp, dest, (int32_t)offsetof(Node, key)); } else { emit_n(as, ARMI_CMP^khi, tmp); @@ -656,7 +656,8 @@ static void asm_hrefk(ASMState *as, IRIns *ir) } asm_guardcc(as, CC_NE); if (!irt_ispri(irkey->t)) { - RegSet even = (as->freeset & (as->freeset >> 1) & allow & RSET_GPREVEN); + RegSet even = (as->freeset & allow); + even = even & (even >> 1) & RSET_GPREVEN; if (even) { key = ra_scratch(as, even); if (rset_test(as->freeset, key+1)) { @@ -674,10 +675,9 @@ static void asm_hrefk(ASMState *as, IRIns *ir) (int32_t)ir_knum(irkey)->u32.hi, allow); emit_opk(as, ARMI_CMP, 0, key, (int32_t)ir_knum(irkey)->u32.lo, allow); - } else if (ra_hasreg(key)) { - emit_n(as, ARMF_CC(ARMI_CMN, CC_EQ)|ARMI_K12|-irt_toitype(irkey->t), type); - emit_opk(as, ARMI_CMP, 0, key, irkey->i, allow); } else { + if (ra_hasreg(key)) + emit_opk(as, ARMF_CC(ARMI_CMP, CC_EQ), 0, key, irkey->i, allow); emit_n(as, ARMI_CMN|ARMI_K12|-irt_toitype(irkey->t), type); } emit_lso(as, ARMI_LDR, type, idx, kofs+4); @@ -1017,8 +1017,8 @@ static void asm_obar(ASMState *as, IRIns *ir) args[0] = ASMREF_TMP1; /* global_State *g */ args[1] = ir->op1; /* TValue *tv */ asm_gencall(as, ci, args); - if ((*as->mcp >> 28) == CC_AL) - *as->mcp = ARMF_CC(*as->mcp, CC_NE); + if ((l_end[-1] >> 28) == CC_AL) + l_end[-1] = ARMF_CC(l_end[-1], CC_NE); else emit_branch(as, ARMF_CC(ARMI_B, CC_EQ), l_end); ra_allockreg(as, i32ptr(J2G(as->J)), ra_releasetmp(as, ASMREF_TMP1)); diff --git a/luajit2/src/lj_carith.c b/luajit2/src/lj_carith.c index 56708bf6..583a3876 100644 --- a/luajit2/src/lj_carith.c +++ b/luajit2/src/lj_carith.c @@ -205,6 +205,10 @@ static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm) if (!tv) { const char *repr[2]; int i; + if (mm == MM_eq) { /* Equality checks never raise an error. */ + setboolV(L->top-1, 0); + return 1; + } for (i = 0; i < 2; i++) { if (ca->ct[i]) repr[i] = strdata(lj_ctype_repr(L, ctype_typeid(cts, ca->ct[i]), NULL)); diff --git a/luajit2/src/lj_cconv.c b/luajit2/src/lj_cconv.c index 818c1f44..b09c0abe 100644 --- a/luajit2/src/lj_cconv.c +++ b/luajit2/src/lj_cconv.c @@ -131,21 +131,23 @@ void lj_cconv_ct_ct(CTState *cts, CType *d, CType *s, /* Some basic sanity checks. */ lua_assert(!ctype_isnum(dinfo) || dsize > 0); lua_assert(!ctype_isnum(sinfo) || ssize > 0); - lua_assert(!ctype_isbool(dinfo) || dsize == 1); - lua_assert(!ctype_isbool(sinfo) || ssize == 1); + lua_assert(!ctype_isbool(dinfo) || dsize == 1 || dsize == 4); + lua_assert(!ctype_isbool(sinfo) || ssize == 1 || ssize == 4); lua_assert(!ctype_isinteger(dinfo) || (1u<<lj_fls(dsize)) == dsize); lua_assert(!ctype_isinteger(sinfo) || (1u<<lj_fls(ssize)) == ssize); switch (cconv_idx2(dinfo, sinfo)) { /* Destination is a bool. */ case CCX(B, B): - *dp = *sp; /* Source operand is already normalized. */ + /* Source operand is already normalized. */ + if (dsize == 1) *dp = *sp; else *(int *)dp = *sp; break; case CCX(B, I): { MSize i; uint8_t b = 0; for (i = 0; i < ssize; i++) b |= sp[i]; - *dp = (b != 0); + b = (b != 0); + if (dsize == 1) *dp = b; else *(int *)dp = b; break; } case CCX(B, F): { @@ -153,7 +155,7 @@ void lj_cconv_ct_ct(CTState *cts, CType *d, CType *s, if (ssize == sizeof(double)) b = (*(double *)sp != 0); else if (ssize == sizeof(float)) b = (*(float *)sp != 0); else goto err_conv; /* NYI: long double. */ - *dp = b; + if (dsize == 1) *dp = b; else *(int *)dp = b; break; } @@ -391,7 +393,7 @@ int lj_cconv_tv_ct(CTState *cts, CType *s, CTypeID sid, lua_assert(tvisnum(o)); } } else { - uint32_t b = (*sp != 0); + uint32_t b = s->size == 1 ? (*sp != 0) : (*(int *)sp != 0); setboolV(o, b); setboolV(&cts->g->tmptv2, b); /* Remember for trace recorder. */ } @@ -601,7 +603,10 @@ void lj_cconv_ct_tv(CTState *cts, CType *d, tmpptr = (void *)0; flags |= CCF_FROMTV; } else if (tvisudata(o)) { - tmpptr = uddata(udataV(o)); + GCudata *ud = udataV(o); + tmpptr = uddata(ud); + if (ud->udtype == UDTYPE_IO_FILE) + tmpptr = *(void **)tmpptr; } else if (tvislightud(o)) { tmpptr = lightudV(o); } else if (tvisfunc(o)) { diff --git a/luajit2/src/lj_clib.c b/luajit2/src/lj_clib.c index 3023b735..edc51362 100644 --- a/luajit2/src/lj_clib.c +++ b/luajit2/src/lj_clib.c @@ -213,7 +213,7 @@ static void clib_unloadlib(CLibrary *cl) { if (cl->handle == CLIB_DEFHANDLE) { MSize i; - for (i = 0; i < CLIB_HANDLE_MAX; i++) { + for (i = CLIB_HANDLE_KERNEL32; i < CLIB_HANDLE_MAX; i++) { void *h = clib_def_handle[i]; if (h) { clib_def_handle[i] = NULL; diff --git a/luajit2/src/lj_cparse.c b/luajit2/src/lj_cparse.c index 526332d4..ff5abc70 100644 --- a/luajit2/src/lj_cparse.c +++ b/luajit2/src/lj_cparse.c @@ -1502,8 +1502,13 @@ end_decl: /* Determine type info and size. */ CTInfo info = CTINFO(CT_NUM, (cds & CDF_UNSIGNED) ? CTF_UNSIGNED : 0); if ((cds & CDF_BOOL)) { - info = CTINFO(CT_NUM, CTF_UNSIGNED|CTF_BOOL); - lua_assert(sz == 1); + if ((cds & ~(CDF_SCL|CDF_BOOL|CDF_INT|CDF_SIGNED|CDF_UNSIGNED))) + cp_errmsg(cp, 0, LJ_ERR_FFI_INVTYPE); + info |= CTF_BOOL; + if (!sz) { + if (!(cds & CDF_SIGNED)) info |= CTF_UNSIGNED; + sz = 1; + } } else if ((cds & CDF_FP)) { info = CTINFO(CT_NUM, CTF_FP); if ((cds & CDF_LONG)) sz = sizeof(long double); diff --git a/luajit2/src/lj_crecord.c b/luajit2/src/lj_crecord.c index a8342015..268800e4 100644 --- a/luajit2/src/lj_crecord.c +++ b/luajit2/src/lj_crecord.c @@ -385,7 +385,14 @@ static TRef crec_ct_tv(jit_State *J, CType *d, TRef dp, TRef sp, cTValue *sval) } else if (tref_isnil(sp)) { sp = lj_ir_kptr(J, NULL); } else if (tref_isudata(sp)) { - sp = emitir(IRT(IR_ADD, IRT_P32), sp, lj_ir_kint(J, sizeof(GCudata))); + GCudata *ud = udataV(sval); + if (ud->udtype == UDTYPE_IO_FILE) { + TRef tr = emitir(IRT(IR_FLOAD, IRT_U8), sp, IRFL_UDATA_UDTYPE); + emitir(IRTGI(IR_EQ), tr, lj_ir_kint(J, UDTYPE_IO_FILE)); + sp = emitir(IRT(IR_FLOAD, IRT_PTR), sp, IRFL_UDATA_FILE); + } else { + sp = emitir(IRT(IR_ADD, IRT_P32), sp, lj_ir_kint(J, sizeof(GCudata))); + } } else if (tref_isstr(sp)) { if (ctype_isenum(d->info)) { /* Match string against enum constant. */ GCstr *str = strV(sval); @@ -802,6 +809,8 @@ static TRef crec_call_args(jit_State *J, RecordFFData *rd, else tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_I8 : IRT_I16,IRCONV_SEXT); } + } else if (LJ_SOFTFP && ctype_isfp(d->info) && d->size > 4) { + lj_needsplit(J); } #if LJ_TARGET_X86 /* 64 bit args must not end up in registers for fastcall/thiscall. */ @@ -901,10 +910,15 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd) lj_ir_kint(J, ctype_typeid(cts, ct))); tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func); if (ctype_isbool(ctr->info)) { - crec_snap_caller(J); - lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0)); - J->postproc = LJ_POST_FIXGUARDSNAP; - tr = TREF_TRUE; + if (frame_islua(J->L->base-1) && bc_b(frame_pc(J->L->base-1)[-1]) == 1) { + /* Don't check result if ignored. */ + tr = TREF_NIL; + } else { + crec_snap_caller(J); + lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0)); + J->postproc = LJ_POST_FIXGUARDSNAP; + tr = TREF_TRUE; + } } else if (t == IRT_FLOAT || t == IRT_U32) { tr = emitconv(tr, IRT_NUM, t, 0); } else if (t == IRT_I8 || t == IRT_I16) { @@ -1066,13 +1080,17 @@ static void crec_arith_meta(jit_State *J, CTState *cts, RecordFFData *rd) tv = lj_ctype_meta(cts, argv2cdata(J, J->base[1], &rd->argv[1])->typeid, (MMS)rd->data); } - if (tv && tvisfunc(tv)) { - J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME; - rd->nres = -1; /* Pending tailcall. */ - } else { - /* NYI: non-function metamethods. */ - lj_trace_err(J, LJ_TRERR_BADTYPE); + if (tv) { + if (tvisfunc(tv)) { + J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME; + rd->nres = -1; /* Pending tailcall. */ + return; + } /* NYI: non-function metamethods. */ + } else if ((MMS)rd->data == MM_eq) { + J->base[0] = TREF_FALSE; + return; } + lj_trace_err(J, LJ_TRERR_BADTYPE); } void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) diff --git a/luajit2/src/lj_ctype.c b/luajit2/src/lj_ctype.c index 353fe9e3..2ea08e25 100644 --- a/luajit2/src/lj_ctype.c +++ b/luajit2/src/lj_ctype.c @@ -43,7 +43,7 @@ #define CTKWDEF(_) \ /* Type specifiers. */ \ _("void", -1, CTOK_VOID) \ - _("_Bool", 1, CTOK_BOOL) \ + _("_Bool", 0, CTOK_BOOL) \ _("bool", 1, CTOK_BOOL) \ _("char", 1, CTOK_CHAR) \ _("int", 4, CTOK_INT) \ diff --git a/luajit2/src/lj_emit_arm.h b/luajit2/src/lj_emit_arm.h index 7654c19b..21ece88e 100644 --- a/luajit2/src/lj_emit_arm.h +++ b/luajit2/src/lj_emit_arm.h @@ -231,6 +231,8 @@ static void emit_branch(ASMState *as, ARMIns ai, MCode *target) as->mcp = p; } +#define emit_jmp(as, target) emit_branch(as, ARMI_B, (target)) + static void emit_call(ASMState *as, void *target) { MCode *p = --as->mcp; diff --git a/luajit2/src/lj_emit_mips.h b/luajit2/src/lj_emit_mips.h index 59f0640b..3edf8851 100644 --- a/luajit2/src/lj_emit_mips.h +++ b/luajit2/src/lj_emit_mips.h @@ -146,6 +146,12 @@ static void emit_branch(ASMState *as, MIPSIns mi, Reg rs, Reg rt, MCode *target) as->mcp = p; } +static void emit_jmp(ASMState *as, MCode *target) +{ + *--as->mcp = MIPSI_NOP; + emit_branch(as, MIPSI_B, RID_ZERO, RID_ZERO, (target)); +} + static void emit_call(ASMState *as, void *target) { MCode *p = as->mcp; diff --git a/luajit2/src/lj_emit_ppc.h b/luajit2/src/lj_emit_ppc.h index bc361c5b..f2bf0a94 100644 --- a/luajit2/src/lj_emit_ppc.h +++ b/luajit2/src/lj_emit_ppc.h @@ -142,12 +142,18 @@ typedef MCode *MCLabel; static void emit_condbranch(ASMState *as, PPCIns pi, PPCCC cc, MCode *target) { - MCode *p = as->mcp; - ptrdiff_t delta = ((char *)target - (char *)p) + 4; + MCode *p = --as->mcp; + ptrdiff_t delta = (char *)target - (char *)p; lua_assert(((delta + 0x8000) >> 16) == 0); pi ^= (delta & 0x8000) * (PPCF_Y/0x8000); - *--p = pi | PPCF_CC(cc) | ((uint32_t)delta & 0xffffu); - as->mcp = p; + *p = pi | PPCF_CC(cc) | ((uint32_t)delta & 0xffffu); +} + +static void emit_jmp(ASMState *as, MCode *target) +{ + MCode *p = --as->mcp; + ptrdiff_t delta = (char *)target - (char *)p; + *p = PPCI_B | (delta & 0x03fffffcu); } static void emit_call(ASMState *as, void *target) diff --git a/luajit2/src/lj_emit_x86.h b/luajit2/src/lj_emit_x86.h index 4f3a08a1..dfb70574 100644 --- a/luajit2/src/lj_emit_x86.h +++ b/luajit2/src/lj_emit_x86.h @@ -383,6 +383,15 @@ static void emit_jcc(ASMState *as, int cc, MCode *target) as->mcp = p - 6; } +/* jmp target */ +static void emit_jmp(ASMState *as, MCode *target) +{ + MCode *p = as->mcp; + *(int32_t *)(p-4) = jmprel(p, target); + p[-5] = XI_JMP; + as->mcp = p - 5; +} + /* call target */ static void emit_call_(ASMState *as, MCode *target) { diff --git a/luajit2/src/lj_err.c b/luajit2/src/lj_err.c index b46a6dc9..05813cf8 100644 --- a/luajit2/src/lj_err.c +++ b/luajit2/src/lj_err.c @@ -660,6 +660,7 @@ LJ_NOINLINE void lj_err_callermsg(lua_State *L, const char *msg) frame_func(frame)->c.ffid <= FF_ffi_meta___tostring) { L->base = pframe+1; L->top = frame; + setcframe_pc(cframe_raw(L->cframe), frame_contpc(frame)); } #endif } diff --git a/luajit2/src/lj_errmsg.h b/luajit2/src/lj_errmsg.h index 83c69ea8..d1db4386 100644 --- a/luajit2/src/lj_errmsg.h +++ b/luajit2/src/lj_errmsg.h @@ -139,6 +139,7 @@ ERRDEF(XFOR, LUA_QL("=") " or " LUA_QL("in") " expected") /* Bytecode reader errors. */ ERRDEF(BCFMT, "cannot load incompatible bytecode") ERRDEF(BCBAD, "cannot load malformed bytecode") +ERRDEF(BCHEAD, "attempt to load bytecode with extra header") #if LJ_HASFFI /* FFI errors. */ diff --git a/luajit2/src/lj_ffrecord.c b/luajit2/src/lj_ffrecord.c index b2b6282d..716226bc 100644 --- a/luajit2/src/lj_ffrecord.c +++ b/luajit2/src/lj_ffrecord.c @@ -476,7 +476,7 @@ static void LJ_FASTCALL recff_math_atrig(jit_State *J, RecordFFData *rd) static void LJ_FASTCALL recff_math_htrig(jit_State *J, RecordFFData *rd) { TRef tr = lj_ir_tonum(J, J->base[0]); - J->base[0] = lj_ir_call(J, rd->data, tr); + J->base[0] = emitir(IRTN(IR_CALLN), tr, rd->data); } static void LJ_FASTCALL recff_math_modf(jit_State *J, RecordFFData *rd) diff --git a/luajit2/src/lj_ircall.h b/luajit2/src/lj_ircall.h index 4e8b7246..39f054a9 100644 --- a/luajit2/src/lj_ircall.h +++ b/luajit2/src/lj_ircall.h @@ -114,9 +114,9 @@ typedef struct CCallInfo { _(ANY, lj_mem_newgco, 2, FS, P32, CCI_L) \ _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \ _(ANY, lj_vm_modi, 2, FN, INT, 0) \ - _(ANY, sinh, 1, N, NUM, 0) \ - _(ANY, cosh, 1, N, NUM, 0) \ - _(ANY, tanh, 1, N, NUM, 0) \ + _(ANY, sinh, ARG1_FP, N, NUM, 0) \ + _(ANY, cosh, ARG1_FP, N, NUM, 0) \ + _(ANY, tanh, ARG1_FP, N, NUM, 0) \ _(ANY, fputc, 2, S, INT, 0) \ _(ANY, fwrite, 4, S, INT, 0) \ _(ANY, fflush, 1, S, INT, 0) \ diff --git a/luajit2/src/lj_lex.c b/luajit2/src/lj_lex.c index d87a49dc..669d2dfe 100644 --- a/luajit2/src/lj_lex.c +++ b/luajit2/src/lj_lex.c @@ -411,6 +411,7 @@ static int llex(LexState *ls, TValue *tv) /* Setup lexer state. */ int lj_lex_setup(lua_State *L, LexState *ls) { + int header = 0; ls->L = L; ls->fs = NULL; ls->n = 0; @@ -430,6 +431,7 @@ int lj_lex_setup(lua_State *L, LexState *ls) ls->n -= 2; ls->p += 2; next(ls); + header = 1; } if (ls->current == '#') { /* Skip POSIX #! header line. */ do { @@ -437,8 +439,22 @@ int lj_lex_setup(lua_State *L, LexState *ls) if (ls->current == END_OF_STREAM) return 0; } while (!currIsNewline(ls)); inclinenumber(ls); + header = 1; } - return (ls->current == LUA_SIGNATURE[0]); /* Bytecode dump? */ + if (ls->current == LUA_SIGNATURE[0]) { /* Bytecode dump. */ + if (header) { + /* + ** Loading bytecode with an extra header is disabled for security + ** reasons. This may circumvent the usual check for bytecode vs. + ** Lua code by looking at the first char. Since this is a potential + ** security violation no attempt is made to echo the chunkname either. + */ + setstrV(L, L->top++, lj_err_str(L, LJ_ERR_BCHEAD)); + lj_err_throw(L, LUA_ERRSYNTAX); + } + return 1; + } + return 0; } /* Cleanup lexer state. */ diff --git a/luajit2/src/lj_opt_loop.c b/luajit2/src/lj_opt_loop.c index ed7d9252..ee5c4d1e 100644 --- a/luajit2/src/lj_opt_loop.c +++ b/luajit2/src/lj_opt_loop.c @@ -321,29 +321,37 @@ static void loop_unroll(jit_State *J) IRType1 t = ir->t; /* Get this first, since emitir may invalidate ir. */ IRRef ref = tref_ref(emitir(ir->ot & ~IRT_ISPHI, op1, op2)); subst[ins] = (IRRef1)ref; - if (ref != ins && ref < invar) { /* Loop-carried dependency? */ + if (ref != ins) { IRIns *irr = IR(ref); - /* Potential PHI? */ - if (!irref_isk(ref) && !irt_isphi(irr->t) && !irt_ispri(irr->t)) { - irt_setphi(irr->t); - if (nphi >= LJ_MAX_PHI) - lj_trace_err(J, LJ_TRERR_PHIOV); - phi[nphi++] = (IRRef1)ref; - } - /* Check all loop-carried dependencies for type instability. */ - if (!irt_sametype(t, irr->t)) { - if (irt_isinteger(t) && irt_isinteger(irr->t)) - continue; - else if (irt_isnum(t) && irt_isinteger(irr->t)) /* Fix int->num. */ - ref = tref_ref(emitir(IRTN(IR_CONV), ref, IRCONV_NUM_INT)); - else if (irt_isnum(irr->t) && irt_isinteger(t)) /* Fix num->int. */ - ref = tref_ref(emitir(IRTGI(IR_CONV), ref, - IRCONV_INT_NUM|IRCONV_CHECK)); - else - lj_trace_err(J, LJ_TRERR_TYPEINS); - subst[ins] = (IRRef1)ref; - /* May need a PHI for the CONV, too. */ + if (ref < invar) { /* Loop-carried dependency? */ + /* Potential PHI? */ + if (!irref_isk(ref) && !irt_isphi(irr->t) && !irt_ispri(irr->t)) { + irt_setphi(irr->t); + if (nphi >= LJ_MAX_PHI) + lj_trace_err(J, LJ_TRERR_PHIOV); + phi[nphi++] = (IRRef1)ref; + } + /* Check all loop-carried dependencies for type instability. */ + if (!irt_sametype(t, irr->t)) { + if (irt_isinteger(t) && irt_isinteger(irr->t)) + continue; + else if (irt_isnum(t) && irt_isinteger(irr->t)) /* Fix int->num. */ + ref = tref_ref(emitir(IRTN(IR_CONV), ref, IRCONV_NUM_INT)); + else if (irt_isnum(irr->t) && irt_isinteger(t)) /* Fix num->int. */ + ref = tref_ref(emitir(IRTGI(IR_CONV), ref, + IRCONV_INT_NUM|IRCONV_CHECK)); + else + lj_trace_err(J, LJ_TRERR_TYPEINS); + subst[ins] = (IRRef1)ref; + irr = IR(ref); + goto phiconv; + } + } else if (ref != REF_DROP && irr->o == IR_CONV && + ref > invar && irr->op1 < invar) { + /* May need an extra PHI for a CONV. */ + ref = irr->op1; irr = IR(ref); + phiconv: if (ref < invar && !irref_isk(ref) && !irt_isphi(irr->t)) { irt_setphi(irr->t); if (nphi >= LJ_MAX_PHI) diff --git a/luajit2/src/lj_opt_split.c b/luajit2/src/lj_opt_split.c index 8a2af24b..72720e86 100644 --- a/luajit2/src/lj_opt_split.c +++ b/luajit2/src/lj_opt_split.c @@ -281,7 +281,7 @@ static void split_ir(jit_State *J) tmp = split_emit(J, IRT(IR_CARG, IRT_NIL), tmp, arg3); tmp = split_emit(J, IRT(IR_CARG, IRT_NIL), tmp, arg4); ir->prev = tmp = split_emit(J, IRTI(IR_CALLN), tmp, IRCALL_pow); - hi = split_emit(J, IRT(IR_HIOP, LJ_SOFTFP), tmp, tmp); + hi = split_emit(J, IRT(IR_HIOP, IRT_SOFTFP), tmp, tmp); break; } } @@ -364,6 +364,8 @@ static void split_ir(jit_State *J) hi = split_emit(J, IRT(IR_HIOP, IRT_SOFTFP), nref, nref); break; } + case IR_CALLN: + case IR_CALLL: case IR_CALLS: case IR_CALLXS: goto split_call; diff --git a/luajit2/src/lj_snap.c b/luajit2/src/lj_snap.c index ddf07b6a..bbe7dcae 100644 --- a/luajit2/src/lj_snap.c +++ b/luajit2/src/lj_snap.c @@ -136,6 +136,11 @@ void lj_snap_add(jit_State *J) /* Merge if no ins. inbetween or if requested and no guard inbetween. */ if (J->mergesnap ? !irt_isguard(J->guardemit) : (nsnap > 0 && J->cur.snap[nsnap-1].ref == J->cur.nins)) { + if (nsnap == 1 && J->parent == 0) { + /* But preserve snap #0 PC for root traces. */ + J->mergesnap = 0; + return; + } nsnapmap = J->cur.snap[--nsnap].mapofs; } else { lj_snap_grow_buf(J, nsnap+1); diff --git a/luajit2/src/lj_target_arm.h b/luajit2/src/lj_target_arm.h index 96fc85e3..a24fc819 100644 --- a/luajit2/src/lj_target_arm.h +++ b/luajit2/src/lj_target_arm.h @@ -101,6 +101,8 @@ enum { #define SPS_FIXED 2 #define SPS_FIRST 2 +#define SPOFS_TMP 0 + #define sps_scale(slot) (4 * (int32_t)(slot)) #define sps_align(slot) (((slot) - SPS_FIXED + 1) & ~1) diff --git a/luajit2/src/lj_target_mips.h b/luajit2/src/lj_target_mips.h index e81d55bd..1b7727d0 100644 --- a/luajit2/src/lj_target_mips.h +++ b/luajit2/src/lj_target_mips.h @@ -102,6 +102,8 @@ enum { #define SPS_FIXED 5 #define SPS_FIRST 4 +#define SPOFS_TMP 0 + #define sps_scale(slot) (4 * (int32_t)(slot)) #define sps_align(slot) (((slot) - SPS_FIXED + 1) & ~1) diff --git a/luajit2/src/lj_target_x86.h b/luajit2/src/lj_target_x86.h index 3de408cc..cc15490b 100644 --- a/luajit2/src/lj_target_x86.h +++ b/luajit2/src/lj_target_x86.h @@ -139,6 +139,8 @@ enum { #define SPS_FIRST 2 #endif +#define SPOFS_TMP 0 + #define sps_scale(slot) (4 * (int32_t)(slot)) #define sps_align(slot) (((slot) - SPS_FIXED + 3) & ~3) diff --git a/luajit2/src/luaconf.h b/luajit2/src/luaconf.h index 68f04d4a..1652f648 100644 --- a/luajit2/src/luaconf.h +++ b/luajit2/src/luaconf.h @@ -30,12 +30,12 @@ #define LUA_LDIR LUA_ROOT "share/" LUA_VERSION_DIR "/" #define LUA_CDIR LUA_ROOT "lib/" LUA_VERSION_DIR "/" #ifdef LUA_XROOT -#define LUA_JDIR LUA_XROOT "share/luajit-2.0.0-beta9/" +#define LUA_JDIR LUA_XROOT "share/luajit-2.0.0-beta10/" #define LUA_XPATH \ ";" LUA_XROOT "share/" LUA_VERSION_DIR "/?.lua;" LUA_XROOT "share/" LUA_VERSION_DIR "/?/init.lua" #define LUA_XCPATH LUA_XROOT "lib/" LUA_VERSION_DIR "/?.so;" #else -#define LUA_JDIR LUA_ROOT "share/luajit-2.0.0-beta9/" +#define LUA_JDIR LUA_ROOT "share/luajit-2.0.0-beta10/" #define LUA_XPATH #define LUA_XCPATH #endif diff --git a/luajit2/src/luajit.h b/luajit2/src/luajit.h index 03db4282..10e926e1 100644 --- a/luajit2/src/luajit.h +++ b/luajit2/src/luajit.h @@ -30,9 +30,9 @@ #include "lua.h" -#define LUAJIT_VERSION "LuaJIT 2.0.0-beta9" +#define LUAJIT_VERSION "LuaJIT 2.0.0-beta10" #define LUAJIT_VERSION_NUM 20000 /* Version 2.0.0 = 02.00.00. */ -#define LUAJIT_VERSION_SYM luaJIT_version_2_0_0_beta9 +#define LUAJIT_VERSION_SYM luaJIT_version_2_0_0_beta10 #define LUAJIT_COPYRIGHT "Copyright (C) 2005-2012 Mike Pall" #define LUAJIT_URL "http://luajit.org/" diff --git a/matrix.lua b/matrix.lua index ac570eba..2ea5ff2f 100644 --- a/matrix.lua +++ b/matrix.lua @@ -724,6 +724,17 @@ local matrix_mt = { ffi.metatype(gsl_matrix, matrix_mt) +matrix_complex = { + alloc = matrix_calloc, + col = matrix_complex_col, + row = matrix_complex_row, + get = matrix_complex_get, + set = matrix_complex_set, + copy = matrix_complex_copy, + norm = matrix_complex_norm, + slice = matrix_complex_slice +} + local matrix_complex_methods = { alloc = matrix_calloc, col = matrix_complex_col, @@ -732,7 +743,7 @@ local matrix_complex_methods = { set = matrix_complex_set, copy = matrix_complex_copy, norm = matrix_complex_norm, - slice = matrix_complex_slice, + slice = matrix_complex_slice } local function matrix_complex_index(m, i) @@ -943,8 +954,6 @@ function matrix.svd(a) return u, s, v end -matrix.sv_decomp = matrix_sv_decomp - matrix.diag = function(d) local n = #d local m = d.alloc(n, n) @@ -24,7 +24,7 @@ function num.ode(spec) local ode = template.load(method, spec) local mt = { - __index = {evolve = ode.evolve, init = ode.init} + __index = {step = ode.step, init = ode.init, evolve = ode.evolve} } return setmetatable(ode.new(), mt) diff --git a/templates/ode-defs.lua.in b/templates/ode-defs.lua.in index d962662d..a4d33b3e 100644 --- a/templates/ode-defs.lua.in +++ b/templates/ode-defs.lua.in @@ -44,8 +44,23 @@ end local function ode_init(s, t0, h0, f, $(VL'y')) $(AL's.y.data') = $(VL'y') $(AL's.dydt.data') = f(t0, $(VL'y')) - s.t = t0 - s.h = h0 + s.t, s.h, s.f = t0, h0, f +end + +local function ode_evolve(s, t1, tsmp) + local step, t0, y = s.step, s.t, s.y + + local function it(s, t) + t = t and t + tsmp or t0 + if t <= t1 then + while s.t < t do + step(s, t) + end + return t, $(AL'y.data') + end + end + + return it, s end local function hadjust(rmax, h) diff --git a/templates/rk8pd.lua.in b/templates/rk8pd.lua.in index 08b2a76d..93b71ec5 100644 --- a/templates/rk8pd.lua.in +++ b/templates/rk8pd.lua.in @@ -162,14 +162,15 @@ $(include 'ode-defs') # y_err_only = (a_dydt == 0) -local function rk8pd_evolve(s, f, t1) - local t, h, s_y, s_dydt = s.t, s.h, s.y, s.dydt +local function rk8pd_step(s, t1) + local t, h, f = s.t, s.h, s.f + local s_y, s_dydt = s.y, s.dydt local hadj, inc local $(VL'y') local $(VL'k1') = $(AL's_dydt.data') - if t + h > t1 then h = t1 - t end + if t < t1 and t + h > t1 then h = t1 - t end while h > 0 do $(VL'y') = $(AL's_y.data') @@ -233,8 +234,6 @@ local function rk8pd_evolve(s, f, t1) # end s.t = t + h s.h = hadj - - return h end -return {new= ode_new, init= ode_init, evolve= rk8pd_evolve} +return {new= ode_new, init= ode_init, evolve= ode_evolve, step= rk8pd_step} diff --git a/templates/rkf45.lua.in b/templates/rkf45.lua.in index 89bbc912..fc286fb3 100644 --- a/templates/rkf45.lua.in +++ b/templates/rkf45.lua.in @@ -55,14 +55,15 @@ $(include 'ode-defs') # y_err_only = (a_dydt == 0) -local function rkf45_evolve(s, f, t1) - local t, h, s_y, s_dydt = s.t, s.h, s.y, s.dydt +local function rkf45_step(s, t1) + local t, h, f = s.t, s.h, s.f + local s_y, s_dydt = s.y, s.dydt local hadj, inc local $(VL'y') local $(VL'k1') = $(AL's_dydt.data') - if t + h > t1 then h = t1 - t end + if t < t1 and t + h > t1 then h = t1 - t end while h > 0 do $(VL'y') = $(AL's_y.data') @@ -124,8 +125,6 @@ local function rkf45_evolve(s, f, t1) # end s.t = t + h s.h = hadj - - return h end -return {new= ode_new, init= ode_init, evolve= rkf45_evolve} +return {new= ode_new, init= ode_init, evolve= ode_evolve, step= rkf45_step} diff --git a/tests/eigentests.lua b/tests/eigentests.lua new file mode 100644 index 00000000..207aa2ae --- /dev/null +++ b/tests/eigentests.lua @@ -0,0 +1,16 @@ +a = matrix.unit(5) + +b = matrix.calloc(5,5) +for i = 1,5 do b[i][i] = 1+0i end + +print("Symmetric ", eigen.symm(a, eigen.SORT_ABS_ASC)) + +print("Non Symmetric ", eigen.non_symm(a, eigen.SORT_ABS_ASC)) + +print("Hermitian ", eigen.herm(b, eigen.SORT_ABS_ASC)) + +print("Generalized Symmetric ", eigen.gensymm(a,a, eigen.SORT_ABS_ASC)) + +--print("Generalized Hermitian ", eigen.genherm(b,b, eigen.SORT_ABS_ASC)) + +print("General Non-Symmetric ", eigen.genv(a,a, eigen.SORT_ABS_ASC)) |