Minor JIT compiler update.

This commit is contained in:
Zoltán Herczeg 2017-08-01 08:26:01 +00:00
parent 4d82a61d47
commit 6a42f68b34
5 changed files with 31 additions and 8 deletions

View File

@ -230,6 +230,9 @@ warning. PCRE2 now also treats this as a literal.
53. Related to 52, though PCRE2 was throwing an error for [[:digit:]-X] it was 53. Related to 52, though PCRE2 was throwing an error for [[:digit:]-X] it was
not doing so for [\d-X] (and similar escapes), as is documented. not doing so for [\d-X] (and similar escapes), as is documented.
54. Fixed a MIPS issue in the JIT compiler reported by Joshua Kinard.
Version 10.23 14-February-2017 Version 10.23 14-February-2017
------------------------------ ------------------------------

View File

@ -124,10 +124,10 @@
/* SLJIT_REWRITABLE_JUMP is 0x1000. */ /* SLJIT_REWRITABLE_JUMP is 0x1000. */
#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
# define PATCH_MB 0x4 # define PATCH_MB 0x4
# define PATCH_MW 0x8 # define PATCH_MW 0x8
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
# define PATCH_MD 0x10 # define PATCH_MD 0x10
#endif #endif
#endif #endif
@ -1561,6 +1561,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmov(struct sljit_compile
CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_I32_OP)); CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_I32_OP));
if (src != SLJIT_IMM) { if (src != SLJIT_IMM) {
CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(src)); CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(src));
CHECK_ARGUMENT(srcw == 0);
} }
if ((type & 0xff) <= SLJIT_NOT_ZERO) if ((type & 0xff) <= SLJIT_NOT_ZERO)
@ -1586,6 +1587,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmov(struct sljit_compile
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset) static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
{ {
/* Any offset is allowed. */
SLJIT_UNUSED_ARG(offset); SLJIT_UNUSED_ARG(offset);
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)

View File

@ -1225,7 +1225,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compil
sljit_s32 dst_reg, sljit_s32 dst_reg,
sljit_s32 src, sljit_sw srcw); sljit_s32 src, sljit_sw srcw);
/* Copies the base address of SLJIT_SP + offset to dst. /* Copies the base address of SLJIT_SP + offset to dst. The offset can be
anything to negate the effect of relative addressing. For example if an
array of sljit_sw values is stored on the stack from offset 0x40, and R0
contains the offset of an array item plus 0x120, this item can be
overwritten by two SLJIT instructions:
sljit_get_local_base(compiler, SLJIT_R1, 0, 0x40 - 0x120);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM2(SLJIT_R1, SLJIT_R0), 0, SLJIT_IMM, 0x5);
Flags: - (may destroy flags) */ Flags: - (may destroy flags) */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset); SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset);

View File

@ -498,12 +498,13 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type) SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
{ {
sljit_sw fir = 0;
switch (feature_type) { switch (feature_type) {
case SLJIT_HAS_FPU: case SLJIT_HAS_FPU:
#ifdef SLJIT_IS_FPU_AVAILABLE #ifdef SLJIT_IS_FPU_AVAILABLE
return SLJIT_IS_FPU_AVAILABLE; return SLJIT_IS_FPU_AVAILABLE;
#elif defined(__GNUC__) #elif defined(__GNUC__)
sljit_sw fir;
asm ("cfc1 %0, $0" : "=r"(fir)); asm ("cfc1 %0, $0" : "=r"(fir));
return (fir >> 22) & 0x1; return (fir >> 22) & 0x1;
#else #else
@ -517,7 +518,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
#endif #endif
default: default:
return 0; return fir;
} }
} }

View File

@ -760,7 +760,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
(((inst) & ~(INT_ALIGNED | UPDATE_REQ)) | (((flags) & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg))) (((inst) & ~(INT_ALIGNED | UPDATE_REQ)) | (((flags) & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg)))
#endif #endif
static const sljit_ins data_transfer_insts[64 + 8] = { static const sljit_ins data_transfer_insts[64 + 16] = {
/* -------- Unsigned -------- */ /* -------- Unsigned -------- */
@ -869,11 +869,20 @@ static const sljit_ins data_transfer_insts[64 + 8] = {
/* d n x s */ HI(31) | LO(727) /* stfdx */, /* d n x s */ HI(31) | LO(727) /* stfdx */,
/* d n x l */ HI(31) | LO(599) /* lfdx */, /* d n x l */ HI(31) | LO(599) /* lfdx */,
/* d w i s */ HI(55) /* stfdu */,
/* d w i l */ HI(51) /* lfdu */,
/* d w x s */ HI(31) | LO(759) /* stfdux */,
/* d w x l */ HI(31) | LO(631) /* lfdux */,
/* s n i s */ HI(52) /* stfs */, /* s n i s */ HI(52) /* stfs */,
/* s n i l */ HI(48) /* lfs */, /* s n i l */ HI(48) /* lfs */,
/* s n x s */ HI(31) | LO(663) /* stfsx */, /* s n x s */ HI(31) | LO(663) /* stfsx */,
/* s n x l */ HI(31) | LO(535) /* lfsx */, /* s n x l */ HI(31) | LO(535) /* lfsx */,
/* s w i s */ HI(53) /* stfsu */,
/* s w i l */ HI(49) /* lfsu */,
/* s w x s */ HI(31) | LO(695) /* stfsux */,
/* s w x l */ HI(31) | LO(567) /* lfsux */,
}; };
#undef ARCH_32_64 #undef ARCH_32_64
@ -1753,7 +1762,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */ /* Floating point operators */
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 6)) #define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 5))
#define SELECT_FOP(op, single, double) ((op & SLJIT_F32_OP) ? single : double) #define SELECT_FOP(op, single, double) ((op & SLJIT_F32_OP) ? single : double)
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)