mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Add HREFK forwarding. Eliminate HREFK guard for TDUP refs.
This commit is contained in:
parent
0d1056eeed
commit
a9bf455b96
@ -120,6 +120,7 @@ LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_uload(jit_State *J);
|
|||||||
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_fload(jit_State *J);
|
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_fload(jit_State *J);
|
||||||
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_xload(jit_State *J);
|
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_xload(jit_State *J);
|
||||||
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_tab_len(jit_State *J);
|
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_tab_len(jit_State *J);
|
||||||
|
LJ_FUNC TRef LJ_FASTCALL lj_opt_fwd_hrefk(jit_State *J);
|
||||||
LJ_FUNC int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J);
|
LJ_FUNC int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J);
|
||||||
LJ_FUNC int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim);
|
LJ_FUNC int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim);
|
||||||
LJ_FUNC int lj_opt_fwd_wasnonnil(jit_State *J, IROpT loadop, IRRef xref);
|
LJ_FUNC int lj_opt_fwd_wasnonnil(jit_State *J, IROpT loadop, IRRef xref);
|
||||||
|
@ -1846,6 +1846,9 @@ LJFOLDF(cse_uref)
|
|||||||
return EMITFOLD;
|
return EMITFOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LJFOLD(HREFK any any)
|
||||||
|
LJFOLDX(lj_opt_fwd_hrefk)
|
||||||
|
|
||||||
LJFOLD(HREF TNEW any)
|
LJFOLD(HREF TNEW any)
|
||||||
LJFOLDF(fwd_href_tnew)
|
LJFOLDF(fwd_href_tnew)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
/* Some local macros to save typing. Undef'd at the end. */
|
/* Some local macros to save typing. Undef'd at the end. */
|
||||||
#define IR(ref) (&J->cur.ir[(ref)])
|
#define IR(ref) (&J->cur.ir[(ref)])
|
||||||
#define fins (&J->fold.ins)
|
#define fins (&J->fold.ins)
|
||||||
|
#define fleft (&J->fold.left)
|
||||||
#define fright (&J->fold.right)
|
#define fright (&J->fold.right)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -255,6 +256,30 @@ TRef LJ_FASTCALL lj_opt_fwd_hload(jit_State *J)
|
|||||||
return EMITFOLD;
|
return EMITFOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* HREFK forwarding. */
|
||||||
|
TRef LJ_FASTCALL lj_opt_fwd_hrefk(jit_State *J)
|
||||||
|
{
|
||||||
|
IRRef tab = fleft->op1;
|
||||||
|
IRRef ref = J->chain[IR_NEWREF];
|
||||||
|
while (ref > tab) {
|
||||||
|
IRIns *newref = IR(ref);
|
||||||
|
if (tab == newref->op1) {
|
||||||
|
if (fright->op1 == newref->op2)
|
||||||
|
return ref; /* Forward from NEWREF. */
|
||||||
|
else
|
||||||
|
goto docse;
|
||||||
|
} else if (aa_table(J, tab, newref->op1) != ALIAS_NO) {
|
||||||
|
goto docse;
|
||||||
|
}
|
||||||
|
ref = newref->prev;
|
||||||
|
}
|
||||||
|
/* No conflicting NEWREF: key location unchanged for HREFK of TDUP. */
|
||||||
|
if (IR(tab)->o == IR_TDUP)
|
||||||
|
fins->t.irt &= ~IRT_GUARD; /* Drop HREFK guard. */
|
||||||
|
docse:
|
||||||
|
return CSEFOLD;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check whether HREF of TNEW/TDUP can be folded to niltv. */
|
/* Check whether HREF of TNEW/TDUP can be folded to niltv. */
|
||||||
int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J)
|
int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J)
|
||||||
{
|
{
|
||||||
@ -872,6 +897,7 @@ int lj_opt_fwd_wasnonnil(jit_State *J, IROpT loadop, IRRef xref)
|
|||||||
|
|
||||||
#undef IR
|
#undef IR
|
||||||
#undef fins
|
#undef fins
|
||||||
|
#undef fleft
|
||||||
#undef fright
|
#undef fright
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user