Update to BLUAJIT 449b76f
This commit is contained in:
1 parent
0bf0441f49
commit
eb9d1982fa
10 files changed
+48
-34
No files matched your search
@@ -227,9 +227,7 @@ local function prof_finish()
|
||||
local samples = prof_samples
|
||||
if samples == 0 then
|
||||
if prof_raw ~= true then out:write("[No samples collected]\n") end
|
||||
return
|
||||
end
|
||||
if prof_ann then
|
||||
elseif prof_ann then
|
||||
prof_annotate(prof_count1, samples)
|
||||
else
|
||||
prof_top(prof_count1, prof_count2, samples, "")
|
||||
|
||||
@@ -98,7 +98,7 @@ LJLIB_ASM(bit_lshift) LJLIB_REC(bit_shift IR_BSHL)
|
||||
x = lj_carith_shift64(x, sh, curr_func(L)->c.ffid - (int)FF_bit_lshift);
|
||||
return bit_result64(L, id, x);
|
||||
}
|
||||
if (id2) setintV(L->base+1, sh);
|
||||
setintV(L->base+1, sh);
|
||||
return FFH_RETRY;
|
||||
#else
|
||||
lj_lib_checknumber(L, 1);
|
||||
|
||||
@@ -949,11 +949,11 @@ static int asm_sunk_store(ASMState *as, IRIns *ira, IRIns *irs)
|
||||
static void asm_snap_alloc1(ASMState *as, IRRef ref)
|
||||
{
|
||||
IRIns *ir = IR(ref);
|
||||
if (!irref_isk(ref) && ir->r != RID_SUNK) {
|
||||
if (!irref_isk(ref)) {
|
||||
bloomset(as->snapfilt1, ref);
|
||||
bloomset(as->snapfilt2, hashrot(ref, ref + HASH_BIAS));
|
||||
if (ra_used(ir)) return;
|
||||
if (ir->r == RID_SINK) {
|
||||
if (ir->r == RID_SINK || ir->r == RID_SUNK) {
|
||||
ir->r = RID_SUNK;
|
||||
#if LJ_HASFFI
|
||||
if (ir->o == IR_CNEWI) { /* Allocate CNEWI value. */
|
||||
|
||||
@@ -408,7 +408,7 @@ static int bcread_header(LexState *ls)
|
||||
#endif
|
||||
}
|
||||
if ((flags & BCDUMP_F_STRIP)) {
|
||||
ls->chunkname = lj_str_newz(ls->L, ls->chunkarg);
|
||||
ls->chunkname = lj_str_newz(ls->L, *ls->chunkarg == BCDUMP_HEAD1 ? "=?" : ls->chunkarg);
|
||||
} else {
|
||||
MSize len = bcread_uleb128(ls);
|
||||
bcread_need(ls, len);
|
||||
|
||||
@@ -2970,10 +2970,11 @@ static int parse_stmt(LexState *ls)
|
||||
case TK_break:
|
||||
lj_lex_next(ls);
|
||||
#if BLUAJIT_MULTILEVEL_BREAK
|
||||
int levels = numberVint(&ls->tokval);
|
||||
if (lex_opt(ls, TK_number))
|
||||
parse_break(ls, levels);
|
||||
else
|
||||
if (ls->tok == TK_number) {
|
||||
int levels = numberVint(&ls->tokval);
|
||||
lj_lex_next(ls);
|
||||
parse_break(ls, levels);
|
||||
} else
|
||||
#endif
|
||||
parse_break(ls, 1);
|
||||
return !LJ_52; /* Must be last in Lua 5.1. */
|
||||
|
||||
+33
-18
@@ -2084,25 +2084,19 @@ static TRef rec_tnew(jit_State *J, uint32_t ah)
|
||||
|
||||
typedef struct RecCatDataCP {
|
||||
jit_State *J;
|
||||
RecordIndex *ix;
|
||||
BCReg baseslot, topslot;
|
||||
TRef tr;
|
||||
} RecCatDataCP;
|
||||
|
||||
static TValue *rec_mm_concat_cp(lua_State *L, lua_CFunction dummy, void *ud)
|
||||
{
|
||||
RecCatDataCP *rcd = (RecCatDataCP *)ud;
|
||||
UNUSED(L); UNUSED(dummy);
|
||||
rec_mm_arith(rcd->J, rcd->ix, MM_concat); /* Call __concat metamethod. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
|
||||
{
|
||||
jit_State *J = rcd->J;
|
||||
BCReg baseslot = rcd->baseslot, topslot = rcd->topslot;
|
||||
TRef *top = &J->base[topslot];
|
||||
TValue savetv[5+LJ_FR2];
|
||||
BCReg s;
|
||||
RecordIndex ix;
|
||||
RecCatDataCP rcd;
|
||||
int errcode;
|
||||
UNUSED(L); UNUSED(dummy);
|
||||
lj_assertJ(baseslot < topslot, "bad CAT arg");
|
||||
for (s = baseslot; s <= topslot; s++)
|
||||
(void)getslot(J, s); /* Ensure all arguments have a reference. */
|
||||
@@ -2124,7 +2118,10 @@ static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
|
||||
} while (trp <= top);
|
||||
tr = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
|
||||
J->maxslot = (BCReg)(xbase - J->base);
|
||||
if (xbase == base) return tr; /* Return simple concatenation result. */
|
||||
if (xbase == base) {
|
||||
rcd->tr = tr; /* Return simple concatenation result. */
|
||||
return NULL;
|
||||
}
|
||||
/* Pass partial result. */
|
||||
topslot = J->maxslot--;
|
||||
*xbase = tr;
|
||||
@@ -2137,13 +2134,31 @@ static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
|
||||
copyTV(J->L, &ix.tabv, &J->L->base[topslot-1]);
|
||||
ix.tab = top[-1];
|
||||
ix.key = top[0];
|
||||
memcpy(savetv, &J->L->base[topslot-1], sizeof(savetv)); /* Save slots. */
|
||||
rec_mm_arith(J, &ix, MM_concat); /* Call __concat metamethod. */
|
||||
rcd->tr = 0; /* No result yet. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
|
||||
{
|
||||
lua_State *L = J->L;
|
||||
ptrdiff_t delta = L->top - L->base;
|
||||
TValue savetv[5+LJ_FR2], errobj;
|
||||
RecCatDataCP rcd;
|
||||
int errcode;
|
||||
rcd.J = J;
|
||||
rcd.ix = &ix;
|
||||
errcode = lj_vm_cpcall(J->L, NULL, &rcd, rec_mm_concat_cp);
|
||||
memcpy(&J->L->base[topslot-1], savetv, sizeof(savetv)); /* Restore slots. */
|
||||
if (errcode) return (TRef)(-errcode);
|
||||
return 0; /* No result yet. */
|
||||
rcd.baseslot = baseslot;
|
||||
rcd.topslot = topslot;
|
||||
memcpy(savetv, &L->base[topslot-1], sizeof(savetv)); /* Save slots. */
|
||||
errcode = lj_vm_cpcall(L, NULL, &rcd, rec_mm_concat_cp);
|
||||
if (errcode) copyTV(L, &errobj, L->top-1);
|
||||
memcpy(&L->base[topslot-1], savetv, sizeof(savetv)); /* Restore slots. */
|
||||
if (errcode) {
|
||||
L->top = L->base + delta;
|
||||
copyTV(L, L->top++, &errobj);
|
||||
return (TRef)(-errcode);
|
||||
}
|
||||
return rcd.tr;
|
||||
}
|
||||
|
||||
/* -- Record bytecode ops ------------------------------------------------- */
|
||||
|
||||
@@ -635,7 +635,7 @@ LJ_NOINLINE static MSize tab_len_slow(GCtab *t, size_t hi)
|
||||
while ((tv = lj_tab_getint(t, (int32_t)hi)) && !tvisnil(tv)) {
|
||||
lo = hi;
|
||||
hi += hi;
|
||||
if (hi > (size_t)(INT_MAX-2)) { /* Punt and do a linear search. */
|
||||
if (hi > (size_t)(0x7fffffff - 2)) { /* Punt and do a linear search. */
|
||||
lo = 1;
|
||||
while ((tv = lj_tab_getint(t, (int32_t)lo)) && !tvisnil(tv)) lo++;
|
||||
return (MSize)(lo - 1);
|
||||
|
||||
@@ -78,7 +78,7 @@ int32_t lj_vm_foldarith_int(int32_t x, int32_t y, int op)
|
||||
case IR_MOD - IR_ADD: return x%y; break;
|
||||
case IR_POW - IR_ADD: return pow(x, y); break;
|
||||
case IR_NEG - IR_ADD: return -x; break;
|
||||
case IR_ABS - IR_ADD: return fabs(x); break;
|
||||
case IR_ABS - IR_ADD: return abs(x); break;
|
||||
#if LJ_HASJIT
|
||||
case IR_LDEXP - IR_ADD: return ldexp(x, (int)y); break;
|
||||
case IR_MIN - IR_ADD: return x < y ? x : y; break;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0501
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Default path for loading Lua and C modules with require(). */
|
||||
|
||||
@@ -1420,9 +1420,10 @@ static void build_subroutines(BuildCtx *ctx)
|
||||
| sltu AT, TMP1, TMP2
|
||||
| bnez AT, ->fff_fallback
|
||||
|. lbu TMP3, DISPATCH_GL(hookmask)(DISPATCH)
|
||||
| daddiu NARGS8:RC, NARGS8:RC, -8
|
||||
| bltz NARGS8:RC, ->fff_fallback
|
||||
| daddiu NARGS8:TMP0, NARGS8:RC, -8
|
||||
| bltz NARGS8:TMP0, ->fff_fallback
|
||||
|. move TMP2, BASE
|
||||
| move NARGS8:RC, NARGS8:TMP0
|
||||
| daddiu BASE, BASE, 16
|
||||
| // Remember active hook before pcall.
|
||||
| srl TMP3, TMP3, HOOK_ACTIVE_SHIFT
|
||||
|
||||
Reference in new issue
Block a user