Skip to content

Commit dcc9c9e

Browse files
Merge branch 'v2.1' into v2.1-agentzh
2 parents afc7431 + 871db2c commit dcc9c9e

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

src/lj_asm_x86.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,8 @@ static void asm_intarith(ASMState *as, IRIns *ir, x86Arith xa)
20842084
RegSet allow = RSET_GPR;
20852085
Reg dest, right;
20862086
int32_t k = 0;
2087-
if (as->flagmcp == as->mcp) { /* Drop test r,r instruction. */
2087+
if (as->flagmcp == as->mcp && xa != XOg_X_IMUL) {
2088+
/* Drop test r,r instruction. */
20882089
MCode *p = as->mcp + ((LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2);
20892090
MCode *q = p[0] == 0x0f ? p+1 : p;
20902091
if ((*q & 15) < 14) {

src/lj_crecord.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,18 +1261,19 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
12611261
if (ctype_isfunc(info)) {
12621262
TRef func = emitir(IRT(IR_FLOAD, tp), J->base[0], IRFL_CDATA_PTR);
12631263
CType *ctr = ctype_rawchild(cts, ct);
1264+
CTInfo ctr_info = ctr->info; /* crec_call_args may invalidate ctr. */
12641265
IRType t = crec_ct2irt(cts, ctr);
12651266
TRef tr;
12661267
TValue tv;
12671268
/* Check for blacklisted C functions that might call a callback. */
12681269
tv.u64 = ((uintptr_t)cdata_getptr(cdataptr(cd), (LJ_64 && tp == IRT_P64) ? 8 : 4) >> 2) | U64x(800000000, 00000000);
12691270
if (tvistrue(lj_tab_get(J->L, cts->miscmap, &tv)))
12701271
lj_trace_err(J, LJ_TRERR_BLACKL);
1271-
if (ctype_isvoid(ctr->info)) {
1272+
if (ctype_isvoid(ctr_info)) {
12721273
t = IRT_NIL;
12731274
rd->nres = 0;
1274-
} else if (!(ctype_isnum(ctr->info) || ctype_isptr(ctr->info) ||
1275-
ctype_isenum(ctr->info)) || t == IRT_CDATA) {
1275+
} else if (!(ctype_isnum(ctr_info) || ctype_isptr(ctr_info) ||
1276+
ctype_isenum(ctr_info)) || t == IRT_CDATA) {
12761277
lj_trace_err(J, LJ_TRERR_NYICALL);
12771278
}
12781279
if ((info & CTF_VARARG)
@@ -1283,7 +1284,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
12831284
func = emitir(IRT(IR_CARG, IRT_NIL), func,
12841285
lj_ir_kint(J, ctype_typeid(cts, ct)));
12851286
tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func);
1286-
if (ctype_isbool(ctr->info)) {
1287+
if (ctype_isbool(ctr_info)) {
12871288
if (frame_islua(J->L->base-1) && bc_b(frame_pc(J->L->base-1)[-1]) == 1) {
12881289
/* Don't check result if ignored. */
12891290
tr = TREF_NIL;
@@ -1299,7 +1300,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
12991300
tr = TREF_TRUE;
13001301
}
13011302
} else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) ||
1302-
t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr->info)) {
1303+
t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr_info)) {
13031304
TRef trid = lj_ir_kint(J, ctype_cid(info));
13041305
tr = emitir(IRTG(IR_CNEWI, IRT_CDATA), trid, tr);
13051306
if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J);

src/lj_debug.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
101101
pt = funcproto(fn);
102102
pos = proto_bcpos(pt, ins) - 1;
103103
#if LJ_HASJIT
104+
if (pos == NO_BCPOS) return 1; /* Pretend it's the first bytecode. */
104105
if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */
105106
if (bc_isret(bc_op(ins[-1]))) {
106107
GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));

src/msvcbuild.bat

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
@rem Then cd to this directory and run this script. Use the following
66
@rem options (in order), if needed. The default is a dynamic release build.
77
@rem
8-
@rem nogc64 disable LJ_GC64 mode for x64
9-
@rem debug emit debug symbols
10-
@rem amalg amalgamated build
11-
@rem static create static lib to statically link into your project
12-
@rem mixed create static lib to build a DLL in your project
8+
@rem nogc64 disable LJ_GC64 mode for x64
9+
@rem debug emit debug symbols
10+
@rem lua52compat enable extra Lua 5.2 extensions
11+
@rem amalg amalgamated build
12+
@rem static create static lib to statically link into your project
13+
@rem mixed create static lib to build a DLL in your project
1314

1415
@if not defined INCLUDE goto :FAIL
1516

@@ -101,6 +102,10 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
101102
@set LJDYNBUILD=%LJDYNBUILD_DEBUG%
102103
@set LJLINKTYPE=%LJLINKTYPE_DEBUG%
103104
:NODEBUG
105+
@if "%1" neq "lua52compat" goto :NOLUA52COMPAT
106+
@shift
107+
@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_ENABLE_LUA52COMPAT
108+
:NOLUA52COMPAT
104109
@set LJCOMPILE=%LJCOMPILE% %LJCOMPILETARGET%
105110
@set LJLINK=%LJLINK% %LJLINKTYPE% %LJLINKTARGET%
106111
@if "%1"=="amalg" goto :AMALGDLL

0 commit comments

Comments
 (0)