Revision: 1182
http://vcs.pcre.org/viewvc?view=rev&revision=1182
Author: zherczeg
Date: 2012-10-28 05:22:32 +0000 (Sun, 28 Oct 2012)
Log Message:
-----------
JIT compiler update.
Modified Paths:
--------------
code/trunk/sljit/sljitConfigInternal.h
code/trunk/sljit/sljitExecAllocator.c
code/trunk/sljit/sljitLir.c
code/trunk/sljit/sljitLir.h
code/trunk/sljit/sljitNativeARM_Thumb2.c
code/trunk/sljit/sljitNativeARM_v5.c
code/trunk/sljit/sljitNativeMIPS_32.c
code/trunk/sljit/sljitNativeMIPS_common.c
code/trunk/sljit/sljitNativePPC_32.c
code/trunk/sljit/sljitNativePPC_64.c
code/trunk/sljit/sljitNativePPC_common.c
code/trunk/sljit/sljitNativeSPARC_32.c
code/trunk/sljit/sljitNativeSPARC_common.c
code/trunk/sljit/sljitNativeX86_common.c
code/trunk/sljit/sljitUtils.c
Modified: code/trunk/sljit/sljitConfigInternal.h
===================================================================
--- code/trunk/sljit/sljitConfigInternal.h 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitConfigInternal.h 2012-10-28 05:22:32 UTC (rev 1182)
@@ -34,7 +34,7 @@
SLJIT_32BIT_ARCHITECTURE : 32 bit architecture
SLJIT_64BIT_ARCHITECTURE : 64 bit architecture
SLJIT_WORD_SHIFT : the shift required to apply when accessing a sljit_w/sljit_uw array by index
- SLJIT_FLOAT_SHIFT : the shift required to apply when accessing a double array by index
+ SLJIT_DOUBLE_SHIFT : the shift required to apply when accessing a double array by index
SLJIT_LITTLE_ENDIAN : little endian architecture
SLJIT_BIG_ENDIAN : big endian architecture
SLJIT_UNALIGNED : allows unaligned memory accesses for non-fpu operations (only!)
@@ -45,7 +45,10 @@
sljit_b, sljit_ub : signed and unsigned 8 bit byte
sljit_h, sljit_uh : signed and unsigned 16 bit half-word (short) type
sljit_i, sljit_ui : signed and unsigned 32 bit integer type
- sljit_w, sljit_uw : signed and unsigned machine word, enough to store a pointer (same as intptr_t)
+ sljit_w, sljit_uw : signed and unsigned machine word, enough to store a pointer
+ sljit_p : unsgined pointer value (usually the same as sljit_uw, but
+ some 64 bit ABIs may use 32 bit pointers)
+ sljit_d : double precision floating point value
SLJIT_CALL : C calling convention define for both calling JIT form C and C callbacks for JIT
SLJIT_W(number) : defining 64 bit constants on 64 bit architectures (compiler independent helper)
*/
@@ -272,9 +275,15 @@
#endif
#endif
-/* Double precision. */
-#define SLJIT_FLOAT_SHIFT 3
+typedef sljit_uw sljit_p;
+typedef double sljit_d;
+/* Shift for pointer sized data. */
+#define SLJIT_POINTER_SHIFT SLJIT_WORD_SHIFT
+
+/* Shift for double precision sized data. */
+#define SLJIT_DOUBLE_SHIFT 3
+
#ifndef SLJIT_W
/* Defining long constants. */
Modified: code/trunk/sljit/sljitExecAllocator.c
===================================================================
--- code/trunk/sljit/sljitExecAllocator.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitExecAllocator.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -52,7 +52,7 @@
The unused blocks are stored in a chain list pointed by free_blocks. This
list is useful if we need to find a suitable memory area when the allocator
is called.
-
+
When a block is freed, the new free block is connected to its adjacent free
blocks if possible.
@@ -83,7 +83,7 @@
static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
{
- return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
}
static SLJIT_INLINE void free_chunk(void* chunk, sljit_uw size)
@@ -94,11 +94,20 @@
#else
-#include <sys/mman.h>
-
static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
{
- void* retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
+ void* retval;
+
+#ifdef MAP_ANON
+ retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
+#else
+ if (dev_zero < 0) {
+ if (open_dev_zero())
+ return NULL;
+ }
+ retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero, 0);
+#endif
+
return (retval != MAP_FAILED) ? retval : NULL;
}
Modified: code/trunk/sljit/sljitLir.c
===================================================================
--- code/trunk/sljit/sljitLir.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitLir.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -280,7 +280,9 @@
sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1
&& sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2
&& sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4
- && ((sizeof(sljit_w) == 4 && sizeof(sljit_uw) == 4) || (sizeof(sljit_w) == 8 && sizeof(sljit_uw) == 8)),
+ && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
+ && (sizeof(sljit_w) == 4 || sizeof(sljit_w) == 8)
+ && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
invalid_integer_types);
/* Only the non-zero members must be set. */
@@ -609,10 +611,10 @@
SLJIT_ASSERT_STOP();
#define FUNCTION_CHECK_OP1() \
- if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_SI) { \
+ if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \
} \
- if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_SI) { \
+ if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \
SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \
if ((src & SLJIT_MEM) && (src & 0xf)) \
@@ -697,10 +699,10 @@
(char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv",
/* op1 */
(char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh",
- (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"movu",
- (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh", (char*)"movu.sh",
- (char*)"movu.ui", (char*)"movu.si", (char*)"not", (char*)"neg",
- (char*)"clz",
+ (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"mov.p",
+ (char*)"movu", (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh",
+ (char*)"movu.sh", (char*)"movu.ui", (char*)"movu.si", (char*)"movu.p",
+ (char*)"not", (char*)"neg", (char*)"clz",
/* op2 */
(char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
(char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
@@ -809,7 +811,7 @@
#if (defined SLJIT_DEBUG && SLJIT_DEBUG)
if (op != SLJIT_UNUSED) {
- SLJIT_ASSERT(op >= SLJIT_MOV && op <= SLJIT_MOV_SI);
+ SLJIT_ASSERT(op >= SLJIT_MOV && op <= SLJIT_MOV_P);
FUNCTION_CHECK_SRC(src, srcw);
}
else
@@ -1231,10 +1233,11 @@
return SLJIT_SUCCESS;
#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
- if (src == SLJIT_RETURN_REG && op == SLJIT_MOV)
+ /* At the moment the pointer size is always equal to sljit_w. May be changed in the future. */
+ if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
return SLJIT_SUCCESS;
#else
- if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI))
+ if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI || op == SLJIT_MOV_P))
return SLJIT_SUCCESS;
#endif
Modified: code/trunk/sljit/sljitLir.h
===================================================================
--- code/trunk/sljit/sljitLir.h 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitLir.h 2012-10-28 05:22:32 UTC (rev 1182)
@@ -369,7 +369,7 @@
/* Return from machine code. The op argument can be SLJIT_UNUSED which means the
function does not return with anything or any opcode between SLJIT_MOV and
- SLJIT_MOV_SI (see sljit_emit_op1). As for src and srcw they must be 0 if op
+ SLJIT_MOV_P (see sljit_emit_op1). As for src and srcw they must be 0 if op
is SLJIT_UNUSED, otherwise see below the description about source and
destination arguments. */
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op,
@@ -377,13 +377,13 @@
/* Really fast calling method for utility functions inside sljit (see SLJIT_FAST_CALL).
All registers and even the stack frame is passed to the callee. The return address is
- preserved in dst/dstw by sljit_emit_fast_enter, and sljit_emit_fast_return can
- use this as a return value later. */
+ preserved in dst/dstw by sljit_emit_fast_enter (the type of the value stored by this
+ function is sljit_p), and sljit_emit_fast_return can use this as a return value later. */
-/* Note: only for sljit specific, non ABI compilant calls. Fast, since only a few machine instructions
- are needed. Excellent for small uility functions, where saving registers and setting up
- a new stack frame would cost too much performance. However, it is still possible to return
- to the address of the caller (or anywhere else). */
+/* Note: only for sljit specific, non ABI compilant calls. Fast, since only a few machine
+ instructions are needed. Excellent for small uility functions, where saving registers
+ and setting up a new stack frame would cost too much performance. However, it is still
+ possible to return to the address of the caller (or anywhere else). */
/* Note: flags are not changed (unlike sljit_emit_enter / sljit_emit_return). */
@@ -512,8 +512,11 @@
or SLJIT_MEM2(r1, r2), r1 is increased by the sum of r2 and the constant argument
UB = unsigned byte (8 bit)
SB = signed byte (8 bit)
- UH = unsgined half (16 bit)
- SH = unsgined half (16 bit) */
+ UH = unsigned half (16 bit)
+ SH = signed half (16 bit)
+ UI = unsigned int (32 bit)
+ SI = signed int (32 bit)
+ P = pointer (sljit_p) size */
/* Flags: - (never set any flags) */
#define SLJIT_MOV 6
@@ -530,68 +533,72 @@
/* Flags: - (never set any flags) */
#define SLJIT_MOV_SI 12
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU 13
+#define SLJIT_MOV_P 13
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_UB 14
+#define SLJIT_MOVU 14
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_SB 15
+#define SLJIT_MOVU_UB 15
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_UH 16
+#define SLJIT_MOVU_SB 16
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_SH 17
+#define SLJIT_MOVU_UH 17
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_UI 18
+#define SLJIT_MOVU_SH 18
/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_SI 19
+#define SLJIT_MOVU_UI 19
+/* Flags: - (never set any flags) */
+#define SLJIT_MOVU_SI 20
+/* Flags: - (never set any flags) */
+#define SLJIT_MOVU_P 21
/* Flags: I | E | K */
-#define SLJIT_NOT 20
+#define SLJIT_NOT 22
/* Flags: I | E | O | K */
-#define SLJIT_NEG 21
+#define SLJIT_NEG 23
/* Count leading zeroes
Flags: I | E | K
Important note! Sparc 32 does not support K flag, since
the required popc instruction is introduced only in sparc 64. */
-#define SLJIT_CLZ 22
+#define SLJIT_CLZ 24
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct sljit_compiler *compiler, int op,
int dst, sljit_w dstw,
int src, sljit_w srcw);
/* Flags: I | E | O | C | K */
-#define SLJIT_ADD 23
+#define SLJIT_ADD 25
/* Flags: I | C | K */
-#define SLJIT_ADDC 24
+#define SLJIT_ADDC 26
/* Flags: I | E | S | U | O | C | K */
-#define SLJIT_SUB 25
+#define SLJIT_SUB 27
/* Flags: I | C | K */
-#define SLJIT_SUBC 26
+#define SLJIT_SUBC 28
/* Note: integer mul
Flags: I | O (see SLJIT_C_MUL_*) | K */
-#define SLJIT_MUL 27
+#define SLJIT_MUL 29
/* Flags: I | E | K */
-#define SLJIT_AND 28
+#define SLJIT_AND 30
/* Flags: I | E | K */
-#define SLJIT_OR 29
+#define SLJIT_OR 31
/* Flags: I | E | K */
-#define SLJIT_XOR 30
+#define SLJIT_XOR 32
/* Flags: I | E | K
Let bit_length be the length of the shift operation: 32 or 64.
If src2 is immediate, src2w is masked by (bit_length - 1).
Otherwise, if the content of src2 is outside the range from 0
to bit_length - 1, the operation is undefined. */
-#define SLJIT_SHL 31
+#define SLJIT_SHL 33
/* Flags: I | E | K
Let bit_length be the length of the shift operation: 32 or 64.
If src2 is immediate, src2w is masked by (bit_length - 1).
Otherwise, if the content of src2 is outside the range from 0
to bit_length - 1, the operation is undefined. */
-#define SLJIT_LSHR 32
+#define SLJIT_LSHR 34
/* Flags: I | E | K
Let bit_length be the length of the shift operation: 32 or 64.
If src2 is immediate, src2w is masked by (bit_length - 1).
Otherwise, if the content of src2 is outside the range from 0
to bit_length - 1, the operation is undefined. */
-#define SLJIT_ASHR 33
+#define SLJIT_ASHR 35
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,
int dst, sljit_w dstw,
@@ -628,26 +635,26 @@
Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED is set,
the comparison result is unpredictable.
Flags: E | S (see SLJIT_C_FLOAT_*) */
-#define SLJIT_FCMP 34
+#define SLJIT_FCMP 36
/* Flags: - (never set any flags) */
-#define SLJIT_FMOV 35
+#define SLJIT_FMOV 37
/* Flags: - (never set any flags) */
-#define SLJIT_FNEG 36
+#define SLJIT_FNEG 38
/* Flags: - (never set any flags) */
-#define SLJIT_FABS 37
+#define SLJIT_FABS 39
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,
int dst, sljit_w dstw,
int src, sljit_w srcw);
/* Flags: - (never set any flags) */
-#define SLJIT_FADD 38
+#define SLJIT_FADD 40
/* Flags: - (never set any flags) */
-#define SLJIT_FSUB 39
+#define SLJIT_FSUB 41
/* Flags: - (never set any flags) */
-#define SLJIT_FMUL 40
+#define SLJIT_FMUL 42
/* Flags: - (never set any flags) */
-#define SLJIT_FDIV 41
+#define SLJIT_FDIV 43
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,
int dst, sljit_w dstw,
Modified: code/trunk/sljit/sljitNativeARM_Thumb2.c
===================================================================
--- code/trunk/sljit/sljitNativeARM_Thumb2.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeARM_Thumb2.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -702,9 +702,11 @@
case SLJIT_MOV:
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
+ case SLJIT_MOV_P:
case SLJIT_MOVU:
case SLJIT_MOVU_UI:
case SLJIT_MOVU_SI:
+ case SLJIT_MOVU_P:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
return push_inst16(compiler, MOV | SET_REGS44(dst, arg2));
case SLJIT_MOV_UB:
@@ -1314,57 +1316,59 @@
op_type = GET_OPCODE(op);
dst_r = (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) ? dst : TMP_REG1;
- if (op_type >= SLJIT_MOV && op_type <= SLJIT_MOVU_SI) {
+ if (op_type >= SLJIT_MOV && op_type <= SLJIT_MOVU_P) {
switch (op_type) {
case SLJIT_MOV:
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
+ case SLJIT_MOV_P:
flags = WORD_SIZE;
break;
case SLJIT_MOV_UB:
flags = BYTE_SIZE;
if (src & SLJIT_IMM)
- srcw = (unsigned char)srcw;
+ srcw = (sljit_ub)srcw;
break;
case SLJIT_MOV_SB:
flags = BYTE_SIZE | SIGNED;
if (src & SLJIT_IMM)
- srcw = (signed char)srcw;
+ srcw = (sljit_b)srcw;
break;
case SLJIT_MOV_UH:
flags = HALF_SIZE;
if (src & SLJIT_IMM)
- srcw = (unsigned short)srcw;
+ srcw = (sljit_uh)srcw;
break;
case SLJIT_MOV_SH:
flags = HALF_SIZE | SIGNED;
if (src & SLJIT_IMM)
- srcw = (signed short)srcw;
+ srcw = (sljit_h)srcw;
break;
case SLJIT_MOVU:
case SLJIT_MOVU_UI:
case SLJIT_MOVU_SI:
+ case SLJIT_MOVU_P:
flags = WORD_SIZE | UPDATE;
break;
case SLJIT_MOVU_UB:
flags = BYTE_SIZE | UPDATE;
if (src & SLJIT_IMM)
- srcw = (unsigned char)srcw;
+ srcw = (sljit_ub)srcw;
break;
case SLJIT_MOVU_SB:
flags = BYTE_SIZE | SIGNED | UPDATE;
if (src & SLJIT_IMM)
- srcw = (signed char)srcw;
+ srcw = (sljit_b)srcw;
break;
case SLJIT_MOVU_UH:
flags = HALF_SIZE | UPDATE;
if (src & SLJIT_IMM)
- srcw = (unsigned short)srcw;
+ srcw = (sljit_uh)srcw;
break;
case SLJIT_MOVU_SH:
flags = HALF_SIZE | SIGNED | UPDATE;
if (src & SLJIT_IMM)
- srcw = (signed short)srcw;
+ srcw = (sljit_h)srcw;
break;
default:
SLJIT_ASSERT_STOP();
Modified: code/trunk/sljit/sljitNativeARM_v5.c
===================================================================
--- code/trunk/sljit/sljitNativeARM_v5.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeARM_v5.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -1870,36 +1870,38 @@
case SLJIT_MOV:
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
+ case SLJIT_MOV_P:
return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UB:
- return emit_op(compiler, SLJIT_MOV_UB, ALLOW_ANY_IMM | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UB, ALLOW_ANY_IMM | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
case SLJIT_MOV_SB:
- return emit_op(compiler, SLJIT_MOV_SB, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SB, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_b)srcw : srcw);
case SLJIT_MOV_UH:
- return emit_op(compiler, SLJIT_MOV_UH, ALLOW_ANY_IMM | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UH, ALLOW_ANY_IMM | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
case SLJIT_MOV_SH:
- return emit_op(compiler, SLJIT_MOV_SH, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SH, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_h)srcw : srcw);
case SLJIT_MOVU:
case SLJIT_MOVU_UI:
case SLJIT_MOVU_SI:
+ case SLJIT_MOVU_P:
return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UB:
- return emit_op(compiler, SLJIT_MOV_UB, ALLOW_ANY_IMM | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UB, ALLOW_ANY_IMM | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
case SLJIT_MOVU_SB:
- return emit_op(compiler, SLJIT_MOV_SB, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SB, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_b)srcw : srcw);
case SLJIT_MOVU_UH:
- return emit_op(compiler, SLJIT_MOV_UH, ALLOW_ANY_IMM | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UH, ALLOW_ANY_IMM | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
case SLJIT_MOVU_SH:
- return emit_op(compiler, SLJIT_MOV_SH, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SH, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_h)srcw : srcw);
case SLJIT_NOT:
return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw);
Modified: code/trunk/sljit/sljitNativeMIPS_32.c
===================================================================
--- code/trunk/sljit/sljitNativeMIPS_32.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeMIPS_32.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -75,6 +75,7 @@
case SLJIT_MOV:
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
+ case SLJIT_MOV_P:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
if (dst != src2)
return push_inst(compiler, ADDU | S(src2) | TA(0) | D(dst), DR(dst));
Modified: code/trunk/sljit/sljitNativeMIPS_common.c
===================================================================
--- code/trunk/sljit/sljitNativeMIPS_common.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeMIPS_common.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -969,10 +969,9 @@
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
- SLJIT_COMPILE_ASSERT(SLJIT_MOV + 7 == SLJIT_MOVU, movu_offset);
-
switch (GET_OPCODE(op)) {
case SLJIT_MOV:
+ case SLJIT_MOV_P:
return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UI:
@@ -982,18 +981,19 @@
return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UB:
- return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
case SLJIT_MOV_SB:
- return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_b)srcw : srcw);
case SLJIT_MOV_UH:
- return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
case SLJIT_MOV_SH:
- return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_h)srcw : srcw);
case SLJIT_MOVU:
+ case SLJIT_MOVU_P:
return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UI:
@@ -1003,16 +1003,16 @@
return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UB:
- return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
case SLJIT_MOVU_SB:
- return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_b)srcw : srcw);
case SLJIT_MOVU_UH:
- return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
case SLJIT_MOVU_SH:
- return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_h)srcw : srcw);
case SLJIT_NOT:
return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw);
Modified: code/trunk/sljit/sljitNativePPC_32.c
===================================================================
--- code/trunk/sljit/sljitNativePPC_32.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativePPC_32.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -48,6 +48,7 @@
case SLJIT_MOV:
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
+ case SLJIT_MOV_P:
SLJIT_ASSERT(src1 == TMP_REG1);
if (dst != src2)
return push_inst(compiler, OR | S(src2) | A(dst) | B(src2));
Modified: code/trunk/sljit/sljitNativePPC_64.c
===================================================================
--- code/trunk/sljit/sljitNativePPC_64.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativePPC_64.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -150,6 +150,7 @@
{
switch (op) {
case SLJIT_MOV:
+ case SLJIT_MOV_P:
SLJIT_ASSERT(src1 == TMP_REG1);
if (dst != src2)
return push_inst(compiler, OR | S(src2) | A(dst) | B(src2));
Modified: code/trunk/sljit/sljitNativePPC_common.c
===================================================================
--- code/trunk/sljit/sljitNativePPC_common.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativePPC_common.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -1170,6 +1170,7 @@
switch (GET_OPCODE(op)) {
case SLJIT_MOV:
+ case SLJIT_MOV_P:
return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UI:
@@ -1179,18 +1180,19 @@
return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UB:
- return EMIT_MOV(SLJIT_MOV_UB, BYTE_DATA, (unsigned char));
+ return EMIT_MOV(SLJIT_MOV_UB, BYTE_DATA, (sljit_ub));
case SLJIT_MOV_SB:
- return EMIT_MOV(SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA, (signed char));
+ return EMIT_MOV(SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA, (sljit_b));
case SLJIT_MOV_UH:
- return EMIT_MOV(SLJIT_MOV_UH, HALF_DATA, (unsigned short));
+ return EMIT_MOV(SLJIT_MOV_UH, HALF_DATA, (sljit_uh));
case SLJIT_MOV_SH:
- return EMIT_MOV(SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA, (signed short));
+ return EMIT_MOV(SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA, (sljit_h));
case SLJIT_MOVU:
+ case SLJIT_MOVU_P:
return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UI:
@@ -1200,16 +1202,16 @@
return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UB:
- return EMIT_MOV(SLJIT_MOV_UB, BYTE_DATA | WRITE_BACK, (unsigned char));
+ return EMIT_MOV(SLJIT_MOV_UB, BYTE_DATA | WRITE_BACK, (sljit_ub));
case SLJIT_MOVU_SB:
- return EMIT_MOV(SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA | WRITE_BACK, (signed char));
+ return EMIT_MOV(SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA | WRITE_BACK, (sljit_b));
case SLJIT_MOVU_UH:
- return EMIT_MOV(SLJIT_MOV_UH, HALF_DATA | WRITE_BACK, (unsigned short));
+ return EMIT_MOV(SLJIT_MOV_UH, HALF_DATA | WRITE_BACK, (sljit_uh));
case SLJIT_MOVU_SH:
- return EMIT_MOV(SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA | WRITE_BACK, (signed short));
+ return EMIT_MOV(SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA | WRITE_BACK, (sljit_h));
case SLJIT_NOT:
return emit_op(compiler, SLJIT_NOT, flags, dst, dstw, TMP_REG1, 0, src, srcw);
Modified: code/trunk/sljit/sljitNativeSPARC_32.c
===================================================================
--- code/trunk/sljit/sljitNativeSPARC_32.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeSPARC_32.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -44,6 +44,7 @@
case SLJIT_MOV:
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
+ case SLJIT_MOV_P:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
if (dst != src2)
return push_inst(compiler, OR | D(dst) | S1(0) | S2(src2), DR(dst));
Modified: code/trunk/sljit/sljitNativeSPARC_common.c
===================================================================
--- code/trunk/sljit/sljitNativeSPARC_common.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeSPARC_common.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -776,11 +776,10 @@
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
- SLJIT_COMPILE_ASSERT(SLJIT_MOV + 7 == SLJIT_MOVU, movu_offset);
-
op = GET_OPCODE(op);
switch (op) {
case SLJIT_MOV:
+ case SLJIT_MOV_P:
return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UI:
@@ -790,18 +789,19 @@
return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_UB:
- return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
case SLJIT_MOV_SB:
- return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_b)srcw : srcw);
case SLJIT_MOV_UH:
- return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
case SLJIT_MOV_SH:
- return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_h)srcw : srcw);
case SLJIT_MOVU:
+ case SLJIT_MOVU_P:
return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UI:
@@ -811,16 +811,16 @@
return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOVU_UB:
- return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
case SLJIT_MOVU_SB:
- return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_b)srcw : srcw);
case SLJIT_MOVU_UH:
- return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
case SLJIT_MOVU_SH:
- return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_h)srcw : srcw);
case SLJIT_NOT:
case SLJIT_CLZ:
Modified: code/trunk/sljit/sljitNativeX86_common.c
===================================================================
--- code/trunk/sljit/sljitNativeX86_common.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitNativeX86_common.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -1065,38 +1065,38 @@
compiler->mode32 = op & SLJIT_INT_OP;
#endif
- if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_SI) {
+ if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_P) {
op = GET_OPCODE(op);
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
compiler->mode32 = 0;
#endif
- SLJIT_COMPILE_ASSERT(SLJIT_MOV + 7 == SLJIT_MOVU, movu_offset);
+ SLJIT_COMPILE_ASSERT(SLJIT_MOV + 8 == SLJIT_MOVU, movu_offset);
if (op >= SLJIT_MOVU) {
update = 1;
- op -= 7;
+ op -= 8;
}
if (src & SLJIT_IMM) {
switch (op) {
case SLJIT_MOV_UB:
- srcw = (unsigned char)srcw;
+ srcw = (sljit_ub)srcw;
break;
case SLJIT_MOV_SB:
- srcw = (signed char)srcw;
+ srcw = (sljit_b)srcw;
break;
case SLJIT_MOV_UH:
- srcw = (unsigned short)srcw;
+ srcw = (sljit_uh)srcw;
break;
case SLJIT_MOV_SH:
- srcw = (signed short)srcw;
+ srcw = (sljit_h)srcw;
break;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
case SLJIT_MOV_UI:
- srcw = (unsigned int)srcw;
+ srcw = (sljit_ui)srcw;
break;
case SLJIT_MOV_SI:
- srcw = (signed int)srcw;
+ srcw = (sljit_i)srcw;
break;
#endif
}
@@ -1115,7 +1115,7 @@
}
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- if (SLJIT_UNLIKELY(dst_is_ereg) && (!(op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI) || (src & SLJIT_MEM))) {
+ if (SLJIT_UNLIKELY(dst_is_ereg) && (!(op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI || op == SLJIT_MOV_P) || (src & SLJIT_MEM))) {
SLJIT_ASSERT(dst == SLJIT_MEM1(SLJIT_LOCALS_REG));
dst = TMP_REGISTER;
}
@@ -1123,6 +1123,7 @@
switch (op) {
case SLJIT_MOV:
+ case SLJIT_MOV_P:
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
case SLJIT_MOV_UI:
case SLJIT_MOV_SI:
@@ -1130,23 +1131,23 @@
FAIL_IF(emit_mov(compiler, dst, dstw, src, srcw));
break;
case SLJIT_MOV_UB:
- FAIL_IF(emit_mov_byte(compiler, 0, dst, dstw, src, (src & SLJIT_IMM) ? (unsigned char)srcw : srcw));
+ FAIL_IF(emit_mov_byte(compiler, 0, dst, dstw, src, srcw));
break;
case SLJIT_MOV_SB:
- FAIL_IF(emit_mov_byte(compiler, 1, dst, dstw, src, (src & SLJIT_IMM) ? (signed char)srcw : srcw));
+ FAIL_IF(emit_mov_byte(compiler, 1, dst, dstw, src, srcw));
break;
case SLJIT_MOV_UH:
- FAIL_IF(emit_mov_half(compiler, 0, dst, dstw, src, (src & SLJIT_IMM) ? (unsigned short)srcw : srcw));
+ FAIL_IF(emit_mov_half(compiler, 0, dst, dstw, src, srcw));
break;
case SLJIT_MOV_SH:
- FAIL_IF(emit_mov_half(compiler, 1, dst, dstw, src, (src & SLJIT_IMM) ? (signed short)srcw : srcw));
+ FAIL_IF(emit_mov_half(compiler, 1, dst, dstw, src, srcw));
break;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
case SLJIT_MOV_UI:
- FAIL_IF(emit_mov_int(compiler, 0, dst, dstw, src, (src & SLJIT_IMM) ? (unsigned int)srcw : srcw));
+ FAIL_IF(emit_mov_int(compiler, 0, dst, dstw, src, srcw));
break;
case SLJIT_MOV_SI:
- FAIL_IF(emit_mov_int(compiler, 1, dst, dstw, src, (src & SLJIT_IMM) ? (signed int)srcw : srcw));
+ FAIL_IF(emit_mov_int(compiler, 1, dst, dstw, src, srcw));
break;
#endif
}
Modified: code/trunk/sljit/sljitUtils.c
===================================================================
--- code/trunk/sljit/sljitUtils.c 2012-10-27 18:04:36 UTC (rev 1181)
+++ code/trunk/sljit/sljitUtils.c 2012-10-28 05:22:32 UTC (rev 1182)
@@ -148,15 +148,55 @@
/* Stack */
/* ------------------------------------------------------------------------ */
-#if (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK)
+#if (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK) || (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
#ifdef _WIN32
#include "windows.h"
#else
+/* Provides mmap function. */
#include <sys/mman.h>
+/* For detecting the page size. */
#include <unistd.h>
+
+#ifndef MAP_ANON
+
+#include <fcntl.h>
+
+/* Some old systems does not have MAP_ANON. */
+static int dev_zero = -1;
+
+#if (defined SLJIT_SINGLE_THREADED && SLJIT_SINGLE_THREADED)
+
+static SLJIT_INLINE int open_dev_zero(void)
+{
+ dev_zero = open("/dev/zero", O_RDWR);
+ return dev_zero < 0;
+}
+
+#else /* SLJIT_SINGLE_THREADED */
+
+#include <pthread.h>
+
+static pthread_mutex_t dev_zero_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static SLJIT_INLINE int open_dev_zero(void)
+{
+ pthread_mutex_lock(&dev_zero_mutex);
+ dev_zero = open("/dev/zero", O_RDWR);
+ pthread_mutex_unlock(&dev_zero_mutex);
+ return dev_zero < 0;
+}
+
+#endif /* SLJIT_SINGLE_THREADED */
+
#endif
+#endif
+
+#endif /* SLJIT_UTIL_STACK || SLJIT_EXECUTABLE_ALLOCATOR */
+
+#if (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK)
+
/* Planning to make it even more clever in the future. */
static sljit_w sljit_page_align = 0;
@@ -197,7 +237,7 @@
return NULL;
#ifdef _WIN32
- base.ptr = VirtualAlloc(0, max_limit, MEM_RESERVE, PAGE_READWRITE);
+ base.ptr = VirtualAlloc(NULL, max_limit, MEM_RESERVE, PAGE_READWRITE);
if (!base.ptr) {
SLJIT_FREE(stack);
return NULL;
@@ -210,7 +250,17 @@
return NULL;
}
#else
+#ifdef MAP_ANON
base.ptr = mmap(0, max_limit, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+#else
+ if (dev_zero < 0) {
+ if (open_dev_zero()) {
+ SLJIT_FREE(stack);
+ return NULL;
+ }
+ }
+ base.ptr = mmap(0, max_limit, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero, 0);
+#endif
if (base.ptr == MAP_FAILED) {
SLJIT_FREE(stack);
return NULL;