mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 04:05:09 +02:00
Update LuaJIT to the latest 2.1.0 source (0bee44c)
This commit is contained in:
@@ -17,12 +17,13 @@
|
||||
#include "lj_ir.h"
|
||||
#include "lj_jit.h"
|
||||
#include "lj_iropt.h"
|
||||
#include "lj_ircall.h"
|
||||
|
||||
/* Some local macros to save typing. Undef'd at the end. */
|
||||
#define IR(ref) (&J->cur.ir[(ref)])
|
||||
#define fins (&J->fold.ins)
|
||||
#define fleft (&J->fold.left)
|
||||
#define fright (&J->fold.right)
|
||||
#define fleft (J->fold.left)
|
||||
#define fright (J->fold.right)
|
||||
|
||||
/*
|
||||
** Caveat #1: return value is not always a TRef -- only use with tref_ref().
|
||||
@@ -179,7 +180,8 @@ static TRef fwd_ahload(jit_State *J, IRRef xref)
|
||||
}
|
||||
ref = store->prev;
|
||||
}
|
||||
lua_assert(ir->o != IR_TNEW || irt_isnil(fins->t));
|
||||
if (ir->o == IR_TNEW && !irt_isnil(fins->t))
|
||||
return 0; /* Type instability in loop-carried dependency. */
|
||||
if (irt_ispri(fins->t)) {
|
||||
return TREF_PRI(irt_type(fins->t));
|
||||
} else if (irt_isnum(fins->t) || (LJ_DUALNUM && irt_isint(fins->t)) ||
|
||||
@@ -308,7 +310,21 @@ int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J)
|
||||
return 1; /* No conflict. Can fold to niltv. */
|
||||
}
|
||||
|
||||
/* Check whether there's no aliasing NEWREF for the left operand. */
|
||||
/* Check whether there's no aliasing table.clear. */
|
||||
static int fwd_aa_tab_clear(jit_State *J, IRRef lim, IRRef ta)
|
||||
{
|
||||
IRRef ref = J->chain[IR_CALLS];
|
||||
while (ref > lim) {
|
||||
IRIns *calls = IR(ref);
|
||||
if (calls->op2 == IRCALL_lj_tab_clear &&
|
||||
(ta == calls->op1 || aa_table(J, ta, calls->op1) != ALIAS_NO))
|
||||
return 0; /* Conflict. */
|
||||
ref = calls->prev;
|
||||
}
|
||||
return 1; /* No conflict. Can safely FOLD/CSE. */
|
||||
}
|
||||
|
||||
/* Check whether there's no aliasing NEWREF/table.clear for the left operand. */
|
||||
int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim)
|
||||
{
|
||||
IRRef ta = fins->op1;
|
||||
@@ -319,7 +335,7 @@ int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim)
|
||||
return 0; /* Conflict. */
|
||||
ref = newref->prev;
|
||||
}
|
||||
return 1; /* No conflict. Can safely FOLD/CSE. */
|
||||
return fwd_aa_tab_clear(J, lim, ta);
|
||||
}
|
||||
|
||||
/* ASTORE/HSTORE elimination. */
|
||||
@@ -854,6 +870,10 @@ TRef LJ_FASTCALL lj_opt_fwd_tab_len(jit_State *J)
|
||||
ref = store->prev;
|
||||
}
|
||||
|
||||
/* Search for aliasing table.clear. */
|
||||
if (!fwd_aa_tab_clear(J, lim, tab))
|
||||
return lj_ir_emit(J);
|
||||
|
||||
/* Try to find a matching load. Below the conflicting store, if any. */
|
||||
return lj_opt_cselim(J, lim);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user