Skip to content

Commit ea25ac1

Browse files
Merge branch 'v2.1' into v2.1-agentzh
2 parents 098183d + 19878ec commit ea25ac1

File tree

6 files changed

+54
-32
lines changed

6 files changed

+54
-32
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ export MULTILIB= lib
3737
DPREFIX= $(DESTDIR)$(PREFIX)
3838
INSTALL_BIN= $(DPREFIX)/bin
3939
INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
40-
INSTALL_SHARE= $(DPREFIX)/share
40+
INSTALL_SHARE_= $(PREFIX)/share
41+
INSTALL_SHARE= $(DESTDIR)$(INSTALL_SHARE_)
4142
INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MMVERSION)
4243
INSTALL_INC= $(INSTALL_DEFINC)
4344

44-
export INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(MMVERSION)
45-
INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
45+
export INSTALL_LJLIBD= $(INSTALL_SHARE_)/luajit-$(MMVERSION)
46+
INSTALL_JITLIB= $(DESTDIR)$(INSTALL_LJLIBD)/jit
4647
INSTALL_LMODD= $(INSTALL_SHARE)/lua
4748
INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
4849
INSTALL_CMODD= $(INSTALL_LIB)/lua
@@ -71,7 +72,7 @@ INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)
7172

7273
INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) $(INSTALL_MAN) \
7374
$(INSTALL_PKGCONFIG) $(INSTALL_JITLIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
74-
UNINSTALL_DIRS= $(INSTALL_JITLIB) $(INSTALL_LJLIBD) $(INSTALL_INC) \
75+
UNINSTALL_DIRS= $(INSTALL_JITLIB) $(DESTDIR)$(INSTALL_LJLIBD) $(INSTALL_INC) \
7576
$(INSTALL_LMOD) $(INSTALL_LMODD) $(INSTALL_CMOD) $(INSTALL_CMODD)
7677

7778
RM= rm -f

src/jit/p.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ local function prof_finish()
227227
local samples = prof_samples
228228
if samples == 0 then
229229
if prof_raw ~= true then out:write("[No samples collected]\n") end
230-
return
231-
end
232-
if prof_ann then
230+
elseif prof_ann then
233231
prof_annotate(prof_count1, samples)
234232
else
235233
prof_top(prof_count1, prof_count2, samples, "")

src/lj_asm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,11 +949,11 @@ static int asm_sunk_store(ASMState *as, IRIns *ira, IRIns *irs)
949949
static void asm_snap_alloc1(ASMState *as, IRRef ref)
950950
{
951951
IRIns *ir = IR(ref);
952-
if (!irref_isk(ref) && ir->r != RID_SUNK) {
952+
if (!irref_isk(ref)) {
953953
bloomset(as->snapfilt1, ref);
954954
bloomset(as->snapfilt2, hashrot(ref, ref + HASH_BIAS));
955955
if (ra_used(ir)) return;
956-
if (ir->r == RID_SINK) {
956+
if (ir->r == RID_SINK || ir->r == RID_SUNK) {
957957
ir->r = RID_SUNK;
958958
#if LJ_HASFFI
959959
if (ir->o == IR_CNEWI) { /* Allocate CNEWI value. */

src/lj_record.c

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,25 +2080,19 @@ static TRef rec_tnew(jit_State *J, uint32_t ah)
20802080

20812081
typedef struct RecCatDataCP {
20822082
jit_State *J;
2083-
RecordIndex *ix;
2083+
BCReg baseslot, topslot;
2084+
TRef tr;
20842085
} RecCatDataCP;
20852086

20862087
static TValue *rec_mm_concat_cp(lua_State *L, lua_CFunction dummy, void *ud)
20872088
{
20882089
RecCatDataCP *rcd = (RecCatDataCP *)ud;
2089-
UNUSED(L); UNUSED(dummy);
2090-
rec_mm_arith(rcd->J, rcd->ix, MM_concat); /* Call __concat metamethod. */
2091-
return NULL;
2092-
}
2093-
2094-
static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
2095-
{
2090+
jit_State *J = rcd->J;
2091+
BCReg baseslot = rcd->baseslot, topslot = rcd->topslot;
20962092
TRef *top = &J->base[topslot];
2097-
TValue savetv[5+LJ_FR2];
20982093
BCReg s;
20992094
RecordIndex ix;
2100-
RecCatDataCP rcd;
2101-
int errcode;
2095+
UNUSED(L); UNUSED(dummy);
21022096
lj_assertJ(baseslot < topslot, "bad CAT arg");
21032097
for (s = baseslot; s <= topslot; s++)
21042098
(void)getslot(J, s); /* Ensure all arguments have a reference. */
@@ -2120,7 +2114,10 @@ static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
21202114
} while (trp <= top);
21212115
tr = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
21222116
J->maxslot = (BCReg)(xbase - J->base);
2123-
if (xbase == base) return tr; /* Return simple concatenation result. */
2117+
if (xbase == base) {
2118+
rcd->tr = tr; /* Return simple concatenation result. */
2119+
return NULL;
2120+
}
21242121
/* Pass partial result. */
21252122
topslot = J->maxslot--;
21262123
*xbase = tr;
@@ -2133,13 +2130,31 @@ static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
21332130
copyTV(J->L, &ix.tabv, &J->L->base[topslot-1]);
21342131
ix.tab = top[-1];
21352132
ix.key = top[0];
2136-
memcpy(savetv, &J->L->base[topslot-1], sizeof(savetv)); /* Save slots. */
2133+
rec_mm_arith(J, &ix, MM_concat); /* Call __concat metamethod. */
2134+
rcd->tr = 0; /* No result yet. */
2135+
return NULL;
2136+
}
2137+
2138+
static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
2139+
{
2140+
lua_State *L = J->L;
2141+
ptrdiff_t delta = L->top - L->base;
2142+
TValue savetv[5+LJ_FR2], errobj;
2143+
RecCatDataCP rcd;
2144+
int errcode;
21372145
rcd.J = J;
2138-
rcd.ix = &ix;
2139-
errcode = lj_vm_cpcall(J->L, NULL, &rcd, rec_mm_concat_cp);
2140-
memcpy(&J->L->base[topslot-1], savetv, sizeof(savetv)); /* Restore slots. */
2141-
if (errcode) return (TRef)(-errcode);
2142-
return 0; /* No result yet. */
2146+
rcd.baseslot = baseslot;
2147+
rcd.topslot = topslot;
2148+
memcpy(savetv, &L->base[topslot-1], sizeof(savetv)); /* Save slots. */
2149+
errcode = lj_vm_cpcall(L, NULL, &rcd, rec_mm_concat_cp);
2150+
if (errcode) copyTV(L, &errobj, L->top-1);
2151+
memcpy(&L->base[topslot-1], savetv, sizeof(savetv)); /* Restore slots. */
2152+
if (errcode) {
2153+
L->top = L->base + delta;
2154+
copyTV(L, L->top++, &errobj);
2155+
return (TRef)(-errcode);
2156+
}
2157+
return rcd.tr;
21432158
}
21442159

21452160
/* -- Record bytecode ops ------------------------------------------------- */

src/msvcbuild.bat

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
106106
@if "%1"=="static" goto :STATIC
107107
%LJCOMPILE% %LJDYNBUILD% lj_*.c lib_*.c
108108
@if errorlevel 1 goto :BAD
109-
%LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj
109+
%LJLINK% /DLL /OUT:%LJDLLNAME% lj_*.obj lib_*.obj
110110
@if errorlevel 1 goto :BAD
111111
@goto :MTDLL
112112
:STATIC
@@ -116,17 +116,24 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
116116
@if errorlevel 1 goto :BAD
117117
@goto :MTDLL
118118
:AMALGDLL
119+
@if "%2"=="static" goto :AMALGSTATIC
119120
%LJCOMPILE% %LJDYNBUILD% ljamalg.c
120121
@if errorlevel 1 goto :BAD
121-
%LJLINK% /DLL /out:%LJDLLNAME% ljamalg.obj lj_vm.obj
122+
%LJLINK% /DLL /OUT:%LJDLLNAME% ljamalg.obj lj_vm.obj
123+
@if errorlevel 1 goto :BAD
124+
@goto :MTDLL
125+
:AMALGSTATIC
126+
%LJCOMPILE% ljamalg.c
127+
@if errorlevel 1 goto :BAD
128+
%LJLINK% /OUT:%LJDLLNAME% ljamalg.obj lj_vm.obj
122129
@if errorlevel 1 goto :BAD
123130
:MTDLL
124131
if exist %LJDLLNAME%.manifest^
125132
%LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2
126133

127134
%LJCOMPILE% luajit.c
128135
@if errorlevel 1 goto :BAD
129-
%LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME%
136+
%LJLINK% /OUT:luajit.exe luajit.obj %LJLIBNAME%
130137
@if errorlevel 1 goto :BAD
131138
if exist luajit.exe.manifest^
132139
%LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe

src/vm_mips64.dasc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,9 +1420,10 @@ static void build_subroutines(BuildCtx *ctx)
14201420
| sltu AT, TMP1, TMP2
14211421
| bnez AT, ->fff_fallback
14221422
|. lbu TMP3, DISPATCH_GL(hookmask)(DISPATCH)
1423-
| daddiu NARGS8:RC, NARGS8:RC, -8
1424-
| bltz NARGS8:RC, ->fff_fallback
1423+
| daddiu NARGS8:TMP0, NARGS8:RC, -8
1424+
| bltz NARGS8:TMP0, ->fff_fallback
14251425
|. move TMP2, BASE
1426+
| move NARGS8:RC, NARGS8:TMP0
14261427
| daddiu BASE, BASE, 16
14271428
| // Remember active hook before pcall.
14281429
| srl TMP3, TMP3, HOOK_ACTIVE_SHIFT

0 commit comments

Comments
 (0)