mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-20 14:03:26 +00:00
Merge branch 'LuaJIT:v2.1' into dontstarve
This commit is contained in:
commit
14eb04d173
@ -85,7 +85,7 @@ operations.
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The string buffer library also includes a high-performance
|
The string buffer library also includes a high-performance
|
||||||
<a href="serialize">serializer</a> for Lua objects.
|
<a href="#serialize">serializer</a> for Lua objects.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="use">Using the String Buffer Library</h2>
|
<h2 id="use">Using the String Buffer Library</h2>
|
||||||
|
@ -440,6 +440,19 @@ If you don't do this, the default Lua number → <tt>double</tt>
|
|||||||
conversion rule applies. A vararg C function expecting an integer
|
conversion rule applies. A vararg C function expecting an integer
|
||||||
will see a garbled or uninitialized value.
|
will see a garbled or uninitialized value.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Note: this is the only place where creating a boxed scalar number type is
|
||||||
|
actually useful. <b>Never use <tt>ffi.new("int")</tt>, <tt>ffi.new("float")</tt>
|
||||||
|
etc. anywhere else!</b>
|
||||||
|
</p>
|
||||||
|
<p style="font-size: 8pt;">
|
||||||
|
Ditto for <tt>ffi.cast()</tt>. Explicitly boxing scalars <b>does not</b>
|
||||||
|
improve performance or force <tt>int</tt> or <tt>float</tt> arithmetic! It
|
||||||
|
just adds costly boxing, unboxing and conversions steps. And it may lead
|
||||||
|
to surprise results, because
|
||||||
|
<a href="#cdata_arith">cdata arithmetic on scalar numbers</a>
|
||||||
|
is always performed on 64 bit integers.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h2 id="init">Initializers</h2>
|
<h2 id="init">Initializers</h2>
|
||||||
<p>
|
<p>
|
||||||
|
@ -1005,6 +1005,7 @@ static void recff_format(jit_State *J, RecordFFData *rd, TRef hdr, int sbufx)
|
|||||||
GCstr *fmt = argv2str(J, &rd->argv[arg]);
|
GCstr *fmt = argv2str(J, &rd->argv[arg]);
|
||||||
FormatState fs;
|
FormatState fs;
|
||||||
SFormat sf;
|
SFormat sf;
|
||||||
|
int nfmt = 0;
|
||||||
/* Specialize to the format string. */
|
/* Specialize to the format string. */
|
||||||
emitir(IRTG(IR_EQ, IRT_STR), trfmt, lj_ir_kstr(J, fmt));
|
emitir(IRTG(IR_EQ, IRT_STR), trfmt, lj_ir_kstr(J, fmt));
|
||||||
lj_strfmt_init(&fs, strdata(fmt), fmt->len);
|
lj_strfmt_init(&fs, strdata(fmt), fmt->len);
|
||||||
@ -1082,6 +1083,7 @@ static void recff_format(jit_State *J, RecordFFData *rd, TRef hdr, int sbufx)
|
|||||||
recff_nyiu(J, rd);
|
recff_nyiu(J, rd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (++nfmt > 100) lj_trace_err(J, LJ_TRERR_TRACEOV);
|
||||||
}
|
}
|
||||||
if (sbufx) {
|
if (sbufx) {
|
||||||
emitir(IRT(IR_USE, IRT_NIL), tr, 0);
|
emitir(IRT(IR_USE, IRT_NIL), tr, 0);
|
||||||
|
@ -460,8 +460,8 @@ typedef struct jit_State {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
IRIns *irbuf; /* Temp. IR instruction buffer. Biased with REF_BIAS. */
|
IRIns *irbuf; /* Temp. IR instruction buffer. Biased with REF_BIAS. */
|
||||||
IRRef irtoplim; /* Upper limit of instuction buffer (biased). */
|
IRRef irtoplim; /* Upper limit of instruction buffer (biased). */
|
||||||
IRRef irbotlim; /* Lower limit of instuction buffer (biased). */
|
IRRef irbotlim; /* Lower limit of instruction buffer (biased). */
|
||||||
IRRef loopref; /* Last loop reference or ref of final LOOP (or 0). */
|
IRRef loopref; /* Last loop reference or ref of final LOOP (or 0). */
|
||||||
|
|
||||||
MSize sizesnap; /* Size of temp. snapshot buffer. */
|
MSize sizesnap; /* Size of temp. snapshot buffer. */
|
||||||
|
@ -801,7 +801,6 @@ static void snap_restoredata(jit_State *J, GCtrace *T, ExitState *ex,
|
|||||||
*(lua_Number *)dst = (lua_Number)*(int32_t *)dst;
|
*(lua_Number *)dst = (lua_Number)*(int32_t *)dst;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
src = (int32_t *)&ex->gpr[r-RID_MIN_GPR];
|
|
||||||
#if !LJ_SOFTFP
|
#if !LJ_SOFTFP
|
||||||
if (r >= RID_MAX_GPR) {
|
if (r >= RID_MAX_GPR) {
|
||||||
src = (int32_t *)&ex->fpr[r-RID_MIN_FPR];
|
src = (int32_t *)&ex->fpr[r-RID_MIN_FPR];
|
||||||
@ -815,7 +814,10 @@ static void snap_restoredata(jit_State *J, GCtrace *T, ExitState *ex,
|
|||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (LJ_64 && LJ_BE && sz == 4) src++;
|
{
|
||||||
|
src = (int32_t *)&ex->gpr[r-RID_MIN_GPR];
|
||||||
|
if (LJ_64 && LJ_BE && sz == 4) src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lj_assertJ(sz == 1 || sz == 2 || sz == 4 || sz == 8,
|
lj_assertJ(sz == 1 || sz == 2 || sz == 4 || sz == 8,
|
||||||
|
@ -99,20 +99,21 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
|
|||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
|
|
||||||
@rem ---- Cross compiler ----
|
@rem ---- Cross compiler ----
|
||||||
|
@set NXCOMPILER_ROOT="%NINTENDO_SDK_ROOT%\Compilers\NintendoClang"
|
||||||
@if "%platform%" neq "x64" goto :NX32_CROSSBUILD
|
@if "%platform%" neq "x64" goto :NX32_CROSSBUILD
|
||||||
@set LJCOMPILE="%NINTENDO_SDK_ROOT%\Compilers\NX\nx\aarch64\bin\clang" -Wall -I%NINTENDO_SDK_ROOT%\Include %DASMTARGET% -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC -c
|
@set LJCOMPILE="%NXCOMPILER_ROOT%\bin\clang" --target=aarch64-nintendo-nx-elf -Wall -I%NINTENDO_SDK_ROOT%\Include %DASMTARGET% -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC -c
|
||||||
@set LJLIB="%NINTENDO_SDK_ROOT%\Compilers\NX\nx\aarch64\bin\aarch64-nintendo-nx-elf-ar" rc
|
@set LJLIB="%NXCOMPILER_ROOT%\bin\llvm-ar" rc
|
||||||
@set TARGETLIB_SUFFIX=nx64
|
@set TARGETLIB_SUFFIX=nx64
|
||||||
|
|
||||||
%NINTENDO_SDK_ROOT%\Compilers\NX\nx\aarch64\bin\aarch64-nintendo-nx-elf-as -o lj_vm.o lj_vm.s
|
%NXCOMPILER_ROOT%\bin\clang --target=aarch64-nintendo-nx-elf -o lj_vm.o -c lj_vm.s
|
||||||
goto :DEBUGCHECK
|
goto :DEBUGCHECK
|
||||||
|
|
||||||
:NX32_CROSSBUILD
|
:NX32_CROSSBUILD
|
||||||
@set LJCOMPILE="%NINTENDO_SDK_ROOT%\Compilers\NX\nx\armv7l\bin\clang" -Wall -I%NINTENDO_SDK_ROOT%\Include %DASMTARGET% -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC -c
|
@set LJCOMPILE="%NXCOMPILER_ROOT%\bin\clang" --target=armv7l-nintendo-nx-eabihf -Wall -I%NINTENDO_SDK_ROOT%\Include %DASMTARGET% -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC -c
|
||||||
@set LJLIB="%NINTENDO_SDK_ROOT%\Compilers\NX\nx\armv7l\bin\armv7l-nintendo-nx-eabihf-ar" rc
|
@set LJLIB="%NXCOMPILER_ROOT%\bin\llvm-ar" rc
|
||||||
@set TARGETLIB_SUFFIX=nx32
|
@set TARGETLIB_SUFFIX=nx32
|
||||||
|
|
||||||
%NINTENDO_SDK_ROOT%\Compilers\NX\nx\armv7l\bin\armv7l-nintendo-nx-eabihf-as -o lj_vm.o lj_vm.s
|
%NXCOMPILER_ROOT%\bin\clang --target=armv7l-nintendo-nx-eabihf -o lj_vm.o -c lj_vm.s
|
||||||
:DEBUGCHECK
|
:DEBUGCHECK
|
||||||
|
|
||||||
@if "%1" neq "debug" goto :NODEBUG
|
@if "%1" neq "debug" goto :NODEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user