/[pcre]/code/trunk/sljit/sljitLir.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitLir.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1182 by zherczeg, Sun Oct 28 05:22:32 2012 UTC revision 1215 by zherczeg, Fri Nov 9 08:13:13 2012 UTC
# Line 89  Line 89 
89          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))
90    
91  #define GET_ALL_FLAGS(op) \  #define GET_ALL_FLAGS(op) \
92          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))          ((op) & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
93    
94    #define TYPE_CAST_NEEDED(op) \
95            (((op) >= SLJIT_MOV_UB && (op) <= SLJIT_MOV_SH) || ((op) >= SLJIT_MOVU_UB && (op) <= SLJIT_MOVU_SH))
96    
97  #define BUF_SIZE        4096  #define BUF_SIZE        4096
98    
# Line 105  Line 108 
108  /* SLJIT_REWRITABLE_JUMP is 0x1000. */  /* SLJIT_REWRITABLE_JUMP is 0x1000. */
109    
110  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
111          #define PATCH_MB        0x4  #       define PATCH_MB 0x4
112          #define PATCH_MW        0x8  #       define PATCH_MW 0x8
113  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
114          #define PATCH_MD        0x10  #       define PATCH_MD 0x10
115  #endif  #endif
116  #endif  #endif
117    
118  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
119          #define IS_BL           0x4  #       define IS_BL            0x4
120          #define PATCH_B         0x8  #       define PATCH_B          0x8
121  #endif  #endif
122    
123  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
124          #define CPOOL_SIZE      512  #       define CPOOL_SIZE       512
125  #endif  #endif
126    
127  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
128          #define IS_COND         0x04  #       define IS_COND          0x04
129          #define IS_BL           0x08  #       define IS_BL            0x08
130          /* cannot be encoded as branch */          /* cannot be encoded as branch */
131          #define B_TYPE0         0x00  #       define B_TYPE0          0x00
132          /* conditional + imm8 */          /* conditional + imm8 */
133          #define B_TYPE1         0x10  #       define B_TYPE1          0x10
134          /* conditional + imm20 */          /* conditional + imm20 */
135          #define B_TYPE2         0x20  #       define B_TYPE2          0x20
136          /* IT + imm24 */          /* IT + imm24 */
137          #define B_TYPE3         0x30  #       define B_TYPE3          0x30
138          /* imm11 */          /* imm11 */
139          #define B_TYPE4         0x40  #       define B_TYPE4          0x40
140          /* imm24 */          /* imm24 */
141          #define B_TYPE5         0x50  #       define B_TYPE5          0x50
142          /* BL + imm24 */          /* BL + imm24 */
143          #define BL_TYPE6        0x60  #       define BL_TYPE6 0x60
144          /* 0xf00 cc code for branches */          /* 0xf00 cc code for branches */
145  #endif  #endif
146    
147  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
148          #define UNCOND_B        0x04  #       define UNCOND_B 0x04
149          #define PATCH_B         0x08  #       define PATCH_B          0x08
150          #define ABSOLUTE_B      0x10  #       define ABSOLUTE_B       0x10
151  #endif  #endif
152    
153  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
154          #define IS_MOVABLE      0x04  #       define IS_MOVABLE       0x04
155          #define IS_JAL          0x08  #       define IS_JAL           0x08
156          #define IS_BIT26_COND   0x10  #       define IS_BIT26_COND    0x10
157          #define IS_BIT16_COND   0x20  #       define IS_BIT16_COND    0x20
158    
159          #define IS_COND         (IS_BIT26_COND | IS_BIT16_COND)  #       define IS_COND          (IS_BIT26_COND | IS_BIT16_COND)
160    
161          #define PATCH_B         0x40  #       define PATCH_B          0x40
162          #define PATCH_J         0x80  #       define PATCH_J          0x80
163    
164          /* instruction types */          /* instruction types */
165          #define MOVABLE_INS     0  #       define MOVABLE_INS      0
166          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
167          /* no destination (i.e: store) */          /* no destination (i.e: store) */
168          #define UNMOVABLE_INS   32  #       define UNMOVABLE_INS    32
169          /* FPU status register */          /* FPU status register */
170          #define FCSR_FCC        33  #       define FCSR_FCC 33
171  #endif  #endif
172    
173  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
174          #define IS_MOVABLE      0x04  #       define IS_MOVABLE       0x04
175          #define IS_COND         0x08  #       define IS_COND          0x08
176          #define IS_CALL         0x10  #       define IS_CALL          0x10
177    
178          #define PATCH_B         0x20  #       define PATCH_B          0x20
179          #define PATCH_CALL      0x40  #       define PATCH_CALL       0x40
180    
181          /* instruction types */          /* instruction types */
182          #define MOVABLE_INS     0  #       define MOVABLE_INS      0
183          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
184          /* no destination (i.e: store) */          /* no destination (i.e: store) */
185          #define UNMOVABLE_INS   32  #       define UNMOVABLE_INS    32
186    
187          #define DST_INS_MASK    0xff  #       define DST_INS_MASK     0xff
188    
189          /* ICC_SET is the same as SET_FLAGS. */          /* ICC_SET is the same as SET_FLAGS. */
190          #define ICC_IS_SET      (1 << 23)  #       define ICC_IS_SET       (1 << 23)
191          #define FCC_IS_SET      (1 << 24)  #       define FCC_IS_SET       (1 << 24)
192  #endif  #endif
193    
194  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
# Line 195  Line 198 
198  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
199  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
200  #ifdef _WIN64  #ifdef _WIN64
201  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((4 + 2) * sizeof(sljit_sw))
202  #else  #else
203  #define FIXED_LOCALS_OFFSET (sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (sizeof(sljit_sw))
204  #endif  #endif
205  #endif  #endif
206    
207  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
208  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
209  #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)  #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
210  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
211  #else  #else
212  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_sw))
213  #endif  #endif
214  #endif  #endif
215    
216  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
217  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
218  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
219  #endif  #endif
220    
221  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
222  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
223  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_sw))
224  #endif  #endif
225    
226  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
227  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
228  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_sw))
229  #endif  #endif
230    
231  #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)  #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)
# Line 264  Line 267 
267    
268  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || ((defined SLJIT_SSE2 && SLJIT_SSE2) && ((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)))  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || ((defined SLJIT_SSE2 && SLJIT_SSE2) && ((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)))
269  #define SLJIT_NEEDS_COMPILER_INIT 1  #define SLJIT_NEEDS_COMPILER_INIT 1
270  static int compiler_initialized = 0;  static sljit_si compiler_initialized = 0;
271  /* A thread safe initialization. */  /* A thread safe initialization. */
272  static void init_compiler(void);  static void init_compiler(void);
273  #endif  #endif
# Line 277  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 280  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
280          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
281    
282          SLJIT_COMPILE_ASSERT(          SLJIT_COMPILE_ASSERT(
283                  sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1                  sizeof(sljit_sb) == 1 && sizeof(sljit_ub) == 1
284                  && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2                  && sizeof(sljit_sh) == 2 && sizeof(sljit_uh) == 2
285                  && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4                  && sizeof(sljit_si) == 4 && sizeof(sljit_ui) == 4
286                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
287                  && (sizeof(sljit_w) == 4 || sizeof(sljit_w) == 8)                  && sizeof(sljit_p) <= sizeof(sljit_sw)
288                    && (sizeof(sljit_sw) == 4 || sizeof(sljit_sw) == 8)
289                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
290                  invalid_integer_types);                  invalid_integer_types);
291            SLJIT_COMPILE_ASSERT(SLJIT_INT_OP == SLJIT_SINGLE_OP,
292                    int_op_and_single_op_must_be_the_same);
293            SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_SINGLE_OP,
294                    rewritable_jump_and_single_op_must_not_be_the_same);
295    
296          /* Only the non-zero members must be set. */          /* Only the non-zero members must be set. */
297          compiler->error = SLJIT_SUCCESS;          compiler->error = SLJIT_SUCCESS;
# Line 305  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 313  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
313          compiler->abuf->next = NULL;          compiler->abuf->next = NULL;
314          compiler->abuf->used_size = 0;          compiler->abuf->used_size = 0;
315    
316          compiler->temporaries = -1;          compiler->scratches = -1;
317          compiler->saveds = -1;          compiler->saveds = -1;
318    
319  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
# Line 411  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 419  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
419  /*  Private functions                                                    */  /*  Private functions                                                    */
420  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
421    
422  static void* ensure_buf(struct sljit_compiler *compiler, int size)  static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
423  {  {
424          sljit_ub *ret;          sljit_ub *ret;
425          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
426    
427          if (compiler->buf->used_size + size <= (int)(BUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
428            if (compiler->buf->used_size + size <= (BUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
429                  ret = compiler->buf->memory + compiler->buf->used_size;                  ret = compiler->buf->memory + compiler->buf->used_size;
430                  compiler->buf->used_size += size;                  compiler->buf->used_size += size;
431                  return ret;                  return ret;
# Line 429  static void* ensure_buf(struct sljit_com Line 438  static void* ensure_buf(struct sljit_com
438          return new_frag->memory;          return new_frag->memory;
439  }  }
440    
441  static void* ensure_abuf(struct sljit_compiler *compiler, int size)  static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
442  {  {
443          sljit_ub *ret;          sljit_ub *ret;
444          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
445    
446          if (compiler->abuf->used_size + size <= (int)(ABUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
447            if (compiler->abuf->used_size + size <= (ABUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
448                  ret = compiler->abuf->memory + compiler->abuf->used_size;                  ret = compiler->abuf->memory + compiler->abuf->used_size;
449                  compiler->abuf->used_size += size;                  compiler->abuf->used_size += size;
450                  return ret;                  return ret;
# Line 447  static void* ensure_abuf(struct sljit_co Line 457  static void* ensure_abuf(struct sljit_co
457          return new_frag->memory;          return new_frag->memory;
458  }  }
459    
460  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, int size)  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size)
461  {  {
462          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
463    
# Line 490  static SLJIT_INLINE void set_label(struc Line 500  static SLJIT_INLINE void set_label(struc
500          compiler->last_label = label;          compiler->last_label = label;
501  }  }
502    
503  static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, int flags)  static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, sljit_si flags)
504  {  {
505          jump->next = NULL;          jump->next = NULL;
506          jump->flags = flags;          jump->flags = flags;
# Line 535  static SLJIT_INLINE void set_const(struc Line 545  static SLJIT_INLINE void set_const(struc
545          case SLJIT_MUL: \          case SLJIT_MUL: \
546                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \
547                  break; \                  break; \
548          case SLJIT_FCMP: \          case SLJIT_CMPD: \
549                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
550                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
551                  break; \                  break; \
552          case SLJIT_ADD: \          case SLJIT_ADD: \
# Line 548  static SLJIT_INLINE void set_const(struc Line 558  static SLJIT_INLINE void set_const(struc
558          case SLJIT_SUBC: \          case SLJIT_SUBC: \
559                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O))); \
560                  break; \                  break; \
561          default: \          case SLJIT_BREAKPOINT: \
562            case SLJIT_NOP: \
563            case SLJIT_UMUL: \
564            case SLJIT_SMUL: \
565            case SLJIT_MOV: \
566            case SLJIT_MOV_P: \
567            case SLJIT_MOVU: \
568            case SLJIT_MOVU_P: \
569                  /* Nothing allowed */ \                  /* Nothing allowed */ \
570                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
571                  break; \                  break; \
572            default: \
573                    /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
574                    SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
575                    break; \
576          }          }
577    
578  #define FUNCTION_CHECK_IS_REG(r) \  #define FUNCTION_CHECK_IS_REG(r) \
579          ((r) == SLJIT_UNUSED || \          ((r) == SLJIT_UNUSED || \
580          ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          ((r) >= SLJIT_SCRATCH_REG1 && (r) <= SLJIT_SCRATCH_REG1 - 1 + compiler->scratches) || \
581          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))
582    
583  #define FUNCTION_CHECK_SRC(p, i) \  #define FUNCTION_CHECK_SRC(p, i) \
584          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
585          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
586                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \
587          else if ((p) == SLJIT_IMM) \          else if ((p) == SLJIT_IMM) \
# Line 579  static SLJIT_INLINE void set_const(struc Line 600  static SLJIT_INLINE void set_const(struc
600                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
601    
602  #define FUNCTION_CHECK_DST(p, i) \  #define FUNCTION_CHECK_DST(p, i) \
603          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
604          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
605                  SLJIT_ASSERT((i) == 0); \                  SLJIT_ASSERT((i) == 0); \
606          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
# Line 596  static SLJIT_INLINE void set_const(struc Line 617  static SLJIT_INLINE void set_const(struc
617                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
618    
619  #define FUNCTION_FCHECK(p, i) \  #define FUNCTION_FCHECK(p, i) \
620          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG4) \          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG6) \
621                  SLJIT_ASSERT(i == 0); \                  SLJIT_ASSERT(i == 0); \
622          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
623                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \
# Line 611  static SLJIT_INLINE void set_const(struc Line 632  static SLJIT_INLINE void set_const(struc
632                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
633    
634  #define FUNCTION_CHECK_OP1() \  #define FUNCTION_CHECK_OP1() \
635          if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_P) { \          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
                 SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \  
         } \  
         if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \  
636                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \
637                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \
638                  if ((src & SLJIT_MEM) && (src & 0xf)) \                  if ((src & SLJIT_MEM) && (src & 0xf)) \
# Line 637  static char* reg_names[] = { Line 655  static char* reg_names[] = {
655  };  };
656    
657  static char* freg_names[] = {  static char* freg_names[] = {
658          (char*)"<noreg>", (char*)"float_r1", (char*)"float_r2", (char*)"float_r3", (char*)"float_r4"          (char*)"<noreg>", (char*)"float_r1", (char*)"float_r2", (char*)"float_r3",
659            (char*)"float_r4", (char*)"float_r5", (char*)"float_r6"
660  };  };
661    
662  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
663  #ifdef _WIN64  #ifdef _WIN64
664          #define SLJIT_PRINT_D   "I64"  #       define SLJIT_PRINT_D    "I64"
665  #else  #else
666          #define SLJIT_PRINT_D   "l"  #       define SLJIT_PRINT_D    "l"
667  #endif  #endif
668  #else  #else
669          #define SLJIT_PRINT_D   ""  #       define SLJIT_PRINT_D    ""
670  #endif  #endif
671    
672  #define sljit_verbose_param(p, i) \  #define sljit_verbose_param(p, i) \
# Line 708  static SLJIT_CONST char* op_names[] = { Line 727  static SLJIT_CONST char* op_names[] = {
727          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
728          (char*)"shl", (char*)"lshr", (char*)"ashr",          (char*)"shl", (char*)"lshr", (char*)"ashr",
729          /* fop1 */          /* fop1 */
730          (char*)"fcmp", (char*)"fmov", (char*)"fneg", (char*)"fabs",          (char*)"cmp", (char*)"mov", (char*)"neg", (char*)"abs",
731          /* fop2 */          /* fop2 */
732          (char*)"fadd", (char*)"fsub", (char*)"fmul", (char*)"fdiv"          (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
733  };  };
734    
735  static char* jump_names[] = {  static char* jump_names[] = {
# Line 724  static char* jump_names[] = { Line 743  static char* jump_names[] = {
743          (char*)"c_float_equal", (char*)"c_float_not_equal",          (char*)"c_float_equal", (char*)"c_float_not_equal",
744          (char*)"c_float_less", (char*)"c_float_greater_equal",          (char*)"c_float_less", (char*)"c_float_greater_equal",
745          (char*)"c_float_greater", (char*)"c_float_less_equal",          (char*)"c_float_greater", (char*)"c_float_less_equal",
746          (char*)"c_float_nan", (char*)"c_float_not_nan",          (char*)"c_float_unordered", (char*)"c_float_ordered",
747          (char*)"jump", (char*)"fast_call",          (char*)"jump", (char*)"fast_call",
748          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
749  };  };
# Line 754  static SLJIT_INLINE void check_sljit_gen Line 773  static SLJIT_INLINE void check_sljit_gen
773  #endif  #endif
774  }  }
775    
776  static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si local_size)
777  {  {
778          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
779          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
780          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
781          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
782          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
783          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
784    
785          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
786          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NO_TMP_REGISTERS);
787          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
788          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
789          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
790  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
791          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
792                  fprintf(compiler->verbose, "  enter args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);                  fprintf(compiler->verbose, "  enter args=%d scratches=%d saveds=%d local_size=%d\n", args, scratches, saveds, local_size);
793  #endif  #endif
794  }  }
795    
796  static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si local_size)
797  {  {
798          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
799          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
800          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
801          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
802          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
803          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
804    
# Line 791  static SLJIT_INLINE void check_sljit_set Line 810  static SLJIT_INLINE void check_sljit_set
810  #endif  #endif
811    
812          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
813          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NO_TMP_REGISTERS);
814          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
815          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
816          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
817  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
818          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
819                  fprintf(compiler->verbose, "  set_context args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);                  fprintf(compiler->verbose, "  set_context args=%d scratches=%d saveds=%d local_size=%d\n", args, scratches, saveds, local_size);
820  #endif  #endif
821  }  }
822    
823  static SLJIT_INLINE void check_sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)  static SLJIT_INLINE void check_sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
824  {  {
825          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
826          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 830  static SLJIT_INLINE void check_sljit_emi Line 849  static SLJIT_INLINE void check_sljit_emi
849  #endif  #endif
850  }  }
851    
852  static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw)  static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
853  {  {
854          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
855          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 849  static SLJIT_INLINE void check_sljit_emi Line 868  static SLJIT_INLINE void check_sljit_emi
868  #endif  #endif
869  }  }
870    
871  static SLJIT_INLINE void check_sljit_emit_fast_return(struct sljit_compiler *compiler, int src, sljit_w srcw)  static SLJIT_INLINE void check_sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
872  {  {
873          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
874          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 868  static SLJIT_INLINE void check_sljit_emi Line 887  static SLJIT_INLINE void check_sljit_emi
887  #endif  #endif
888  }  }
889    
890  static SLJIT_INLINE void check_sljit_emit_op0(struct sljit_compiler *compiler, int op)  static SLJIT_INLINE void check_sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
891  {  {
892          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
893          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 882  static SLJIT_INLINE void check_sljit_emi Line 901  static SLJIT_INLINE void check_sljit_emi
901  #endif  #endif
902  }  }
903    
904  static SLJIT_INLINE void check_sljit_emit_op1(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
905          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
906          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
907  {  {
908          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
909          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 911  static SLJIT_INLINE void check_sljit_emi Line 930  static SLJIT_INLINE void check_sljit_emi
930  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
931          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
932                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],
933                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S", !(op & SLJIT_SET_U) ? "" : "U", !(op & SLJIT_SET_O) ? "" : "O", !(op & SLJIT_SET_C) ? "" : "C", !(op & SLJIT_KEEP_FLAGS) ? "" : "K");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s", !(op & SLJIT_SET_U) ? "" : ".u",
934                            !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
935                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
936                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
937                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(src, srcw);
# Line 920  static SLJIT_INLINE void check_sljit_emi Line 940  static SLJIT_INLINE void check_sljit_emi
940  #endif  #endif
941  }  }
942    
943  static SLJIT_INLINE void check_sljit_emit_op2(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
944          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
945          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
946          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
947  {  {
948          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
949          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 952  static SLJIT_INLINE void check_sljit_emi Line 972  static SLJIT_INLINE void check_sljit_emi
972  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
973          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
974                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],
975                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S", !(op & SLJIT_SET_U) ? "" : "U", !(op & SLJIT_SET_O) ? "" : "O", !(op & SLJIT_SET_C) ? "" : "C", !(op & SLJIT_KEEP_FLAGS) ? "" : "K");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s", !(op & SLJIT_SET_U) ? "" : ".u",
976                            !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
977                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
978                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
979                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(src1, src1w);
# Line 963  static SLJIT_INLINE void check_sljit_emi Line 984  static SLJIT_INLINE void check_sljit_emi
984  #endif  #endif
985  }  }
986    
987  static SLJIT_INLINE void check_sljit_get_register_index(int reg)  static SLJIT_INLINE void check_sljit_get_register_index(sljit_si reg)
988  {  {
989          SLJIT_UNUSED_ARG(reg);          SLJIT_UNUSED_ARG(reg);
990          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);
991  }  }
992    
993  static SLJIT_INLINE void check_sljit_emit_op_custom(struct sljit_compiler *compiler,  static SLJIT_INLINE void check_sljit_emit_op_custom(struct sljit_compiler *compiler,
994          void *instruction, int size)          void *instruction, sljit_si size)
995  {  {
996          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
997          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 978  static SLJIT_INLINE void check_sljit_emi Line 999  static SLJIT_INLINE void check_sljit_emi
999          SLJIT_ASSERT(instruction);          SLJIT_ASSERT(instruction);
1000  }  }
1001    
1002  static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
1003          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1004          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1005  {  {
1006          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1007          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 998  static SLJIT_INLINE void check_sljit_emi Line 1019  static SLJIT_INLINE void check_sljit_emi
1019  #endif  #endif
1020    
1021          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1022          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FCMP && GET_OPCODE(op) <= SLJIT_FABS);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_CMPD && GET_OPCODE(op) <= SLJIT_ABSD);
1023  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1024          FUNCTION_CHECK_OP();          FUNCTION_CHECK_OP();
1025          FUNCTION_FCHECK(src, srcw);          FUNCTION_FCHECK(src, srcw);
# Line 1006  static SLJIT_INLINE void check_sljit_emi Line 1027  static SLJIT_INLINE void check_sljit_emi
1027  #endif  #endif
1028  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1029          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1030                  fprintf(compiler->verbose, "  %s%s%s ", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s ", op_names[GET_OPCODE(op)], (op & SLJIT_SINGLE_OP) ? "s" : "d",
1031                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s");
1032                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(dst, dstw);
1033                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1034                  sljit_verbose_fparam(src, srcw);                  sljit_verbose_fparam(src, srcw);
# Line 1016  static SLJIT_INLINE void check_sljit_emi Line 1037  static SLJIT_INLINE void check_sljit_emi
1037  #endif  #endif
1038  }  }
1039    
1040  static SLJIT_INLINE void check_sljit_emit_fop2(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
1041          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1042          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1043          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1044  {  {
1045          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1046          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1032  static SLJIT_INLINE void check_sljit_emi Line 1053  static SLJIT_INLINE void check_sljit_emi
1053          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1054    
1055          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1056          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FADD && GET_OPCODE(op) <= SLJIT_FDIV);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_ADDD && GET_OPCODE(op) <= SLJIT_DIVD);
1057  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1058          FUNCTION_CHECK_OP();          FUNCTION_CHECK_OP();
1059          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1041  static SLJIT_INLINE void check_sljit_emi Line 1062  static SLJIT_INLINE void check_sljit_emi
1062  #endif  #endif
1063  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1064          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1065                  fprintf(compiler->verbose, "  %s ", op_names[GET_OPCODE(op)]);                  fprintf(compiler->verbose, "  %s%s ", op_names[GET_OPCODE(op)], (op & SLJIT_SINGLE_OP) ? "s" : "d");
1066                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(dst, dstw);
1067                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1068                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(src1, src1w);
# Line 1063  static SLJIT_INLINE void check_sljit_emi Line 1084  static SLJIT_INLINE void check_sljit_emi
1084  #endif  #endif
1085  }  }
1086    
1087  static SLJIT_INLINE void check_sljit_emit_jump(struct sljit_compiler *compiler, int type)  static SLJIT_INLINE void check_sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
1088  {  {
1089          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1090          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1080  static SLJIT_INLINE void check_sljit_emi Line 1101  static SLJIT_INLINE void check_sljit_emi
1101          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);
1102  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1103          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
1104                  fprintf(compiler->verbose, "  jump%s <%s>\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);                  fprintf(compiler->verbose, "  jump%s<%s>\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1105  #endif  #endif
1106  }  }
1107    
1108  static SLJIT_INLINE void check_sljit_emit_cmp(struct sljit_compiler *compiler, int type,  static SLJIT_INLINE void check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1109          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1110          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1111  {  {
1112          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1113          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1095  static SLJIT_INLINE void check_sljit_emi Line 1116  static SLJIT_INLINE void check_sljit_emi
1116          SLJIT_UNUSED_ARG(src2);          SLJIT_UNUSED_ARG(src2);
1117          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1118    
1119          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_INT_OP)));
1120          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_C_SIG_LESS_EQUAL);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_C_SIG_LESS_EQUAL);
1121  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1122          FUNCTION_CHECK_SRC(src1, src1w);          FUNCTION_CHECK_SRC(src1, src1w);
# Line 1103  static SLJIT_INLINE void check_sljit_emi Line 1124  static SLJIT_INLINE void check_sljit_emi
1124  #endif  #endif
1125  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1126          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1127                  fprintf(compiler->verbose, "  %scmp%s <%s> ", !(type & SLJIT_INT_OP) ? "" : "i", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);                  fprintf(compiler->verbose, "  %scmp%s<%s> ", !(type & SLJIT_INT_OP) ? "" : "i", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1128                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(src1, src1w);
1129                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1130                  sljit_verbose_param(src2, src2w);                  sljit_verbose_param(src2, src2w);
# Line 1112  static SLJIT_INLINE void check_sljit_emi Line 1133  static SLJIT_INLINE void check_sljit_emi
1133  #endif  #endif
1134  }  }
1135    
1136  static SLJIT_INLINE void check_sljit_emit_fcmp(struct sljit_compiler *compiler, int type,  static SLJIT_INLINE void check_sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
1137          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1138          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1139  {  {
1140          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1141          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1124  static SLJIT_INLINE void check_sljit_emi Line 1145  static SLJIT_INLINE void check_sljit_emi
1145          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1146    
1147          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1148          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_SINGLE_OP)));
1149          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);
1150  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1151          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1132  static SLJIT_INLINE void check_sljit_emi Line 1153  static SLJIT_INLINE void check_sljit_emi
1153  #endif  #endif
1154  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1155          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1156                  fprintf(compiler->verbose, "  fcmp%s <%s> ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);                  fprintf(compiler->verbose, "  %scmp%s<%s> ", (type & SLJIT_SINGLE_OP) ? "s" : "d",
1157                            !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1158                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(src1, src1w);
1159                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1160                  sljit_verbose_fparam(src2, src2w);                  sljit_verbose_fparam(src2, src2w);
# Line 1141  static SLJIT_INLINE void check_sljit_emi Line 1163  static SLJIT_INLINE void check_sljit_emi
1163  #endif  #endif
1164  }  }
1165    
1166  static SLJIT_INLINE void check_sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)  static SLJIT_INLINE void check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
1167  {  {
1168          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1169          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1149  static SLJIT_INLINE void check_sljit_emi Line 1171  static SLJIT_INLINE void check_sljit_emi
1171          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
1172          SLJIT_UNUSED_ARG(srcw);          SLJIT_UNUSED_ARG(srcw);
1173    
1174    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1175            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1176                    compiler->skip_checks = 0;
1177                    return;
1178            }
1179    #endif
1180    
1181          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
1182  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1183          FUNCTION_CHECK_SRC(src, srcw);          FUNCTION_CHECK_SRC(src, srcw);
1184  #endif  #endif
1185  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1186          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1187                  fprintf(compiler->verbose, "  ijump <%s> ", jump_names[type]);                  fprintf(compiler->verbose, "  ijump<%s> ", jump_names[type]);
1188                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(src, srcw);
1189                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1190          }          }
1191  #endif  #endif
1192  }  }
1193    
1194  static SLJIT_INLINE void check_sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)  static SLJIT_INLINE void check_sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
1195            sljit_si dst, sljit_sw dstw,
1196            sljit_si src, sljit_sw srcw,
1197            sljit_si type)
1198  {  {
1199          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1200          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1201          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1202          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1203          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1204            SLJIT_UNUSED_ARG(src);
1205            SLJIT_UNUSED_ARG(srcw);
1206          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1207    
1208          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);
1209          SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_OR);          SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_UI || GET_OPCODE(op) == SLJIT_MOV_SI
1210          SLJIT_ASSERT(GET_ALL_FLAGS(op) == 0 || GET_ALL_FLAGS(op) == SLJIT_SET_E || GET_ALL_FLAGS(op) == SLJIT_KEEP_FLAGS);                  || (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));
1211            SLJIT_ASSERT((op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C)) == 0);
1212            SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
1213  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1214            if (GET_OPCODE(op) < SLJIT_ADD) {
1215                    SLJIT_ASSERT(src == SLJIT_UNUSED && srcw == 0);
1216            } else {
1217                    SLJIT_ASSERT(src == dst && srcw == dstw);
1218            }
1219          FUNCTION_CHECK_DST(dst, dstw);          FUNCTION_CHECK_DST(dst, dstw);
1220  #endif  #endif
1221  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1222          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1223                  fprintf(compiler->verbose, "  cond_set%s%s <%s> ", !(op & SLJIT_SET_E) ? "" : "E",                  fprintf(compiler->verbose, "  op_flags<%s%s%s%s> ", !(op & SLJIT_INT_OP) ? "" : "i",
1224                          !(op & SLJIT_KEEP_FLAGS) ? "" : "K", op_names[GET_OPCODE(op)]);                          op_names[GET_OPCODE(op)], !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
1225                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
1226                    if (src != SLJIT_UNUSED) {
1227                            fprintf(compiler->verbose, ", ");
1228                            sljit_verbose_param(src, srcw);
1229                    }
1230                  fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);                  fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);
1231          }          }
1232  #endif  #endif
1233  }  }
1234    
1235  static SLJIT_INLINE void check_sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)  static SLJIT_INLINE void check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
1236  {  {
1237          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1238          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1206  static SLJIT_INLINE void check_sljit_get Line 1251  static SLJIT_INLINE void check_sljit_get
1251  #endif  #endif
1252  }  }
1253    
1254  static SLJIT_INLINE void check_sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w init_value)  static SLJIT_INLINE void check_sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
1255  {  {
1256          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1257          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1226  static SLJIT_INLINE void check_sljit_emi Line 1271  static SLJIT_INLINE void check_sljit_emi
1271  #endif  #endif
1272  }  }
1273    
1274  static SLJIT_INLINE int emit_mov_before_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)  static SLJIT_INLINE sljit_si emit_mov_before_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
1275  {  {
1276          /* Return if don't need to do anything. */          /* Return if don't need to do anything. */
1277          if (op == SLJIT_UNUSED)          if (op == SLJIT_UNUSED)
1278                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1279    
1280  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1281          /* At the moment the pointer size is always equal to sljit_w. May be changed in the future. */          /* At the moment the pointer size is always equal to sljit_sw. May be changed in the future. */
1282          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
1283                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1284  #else  #else
# Line 1274  static SLJIT_INLINE int emit_mov_before_ Line 1319  static SLJIT_INLINE int emit_mov_before_
1319  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
1320    
1321  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
1322          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
1323  #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
1324          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
1325  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
1326          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_v5.c"
1327  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
1328          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_v5.c"
1329  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1330          #include "sljitNativeARM_Thumb2.c"  #       include "sljitNativeARM_Thumb2.c"
1331  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
1332          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1333  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
1334          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1335  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1336          #include "sljitNativeMIPS_common.c"  #       include "sljitNativeMIPS_common.c"
1337  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
1338          #include "sljitNativeSPARC_common.c"  #       include "sljitNativeSPARC_common.c"
1339  #endif  #endif
1340    
1341  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1342    
1343  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1344          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1345          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1346  {  {
1347          /* Default compare for most architectures. */          /* Default compare for most architectures. */
1348          int flags, tmp_src, condition;          sljit_si flags, tmp_src, condition;
1349          sljit_w tmp_srcw;          sljit_sw tmp_srcw;
1350    
1351          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
1352          check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);
# Line 1362  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1407  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1407          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
1408  }  }
1409    
1410  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
1411          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1412          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1413  {  {
1414          int flags, condition;          sljit_si flags, condition;
1415    
1416          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);
1417    
1418          condition = type & 0xff;          condition = type & 0xff;
1419          if (condition <= SLJIT_C_FLOAT_NOT_EQUAL)          flags = (condition <= SLJIT_C_FLOAT_NOT_EQUAL) ? SLJIT_SET_E : SLJIT_SET_S;
1420                  flags = SLJIT_SET_E;          if (type & SLJIT_SINGLE_OP)
1421          else                  flags |= SLJIT_SINGLE_OP;
                 flags = SLJIT_SET_S;  
1422    
1423  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1424          compiler->skip_checks = 1;          compiler->skip_checks = 1;
1425  #endif  #endif
1426          sljit_emit_fop1(compiler, SLJIT_FCMP | flags, src1, src1w, src2, src2w);          sljit_emit_fop1(compiler, SLJIT_CMPD | flags, src1, src1w, src2, src2w);
1427    
1428  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1429          compiler->skip_checks = 1;          compiler->skip_checks = 1;
# Line 1391  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1435  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1435    
1436  #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) && !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) && !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
1437    
1438  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
1439  {  {
1440          CHECK_ERROR();          CHECK_ERROR();
1441          check_sljit_get_local_base(compiler, dst, dstw, offset);          check_sljit_get_local_base(compiler, dst, dstw, offset);
# Line 1428  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1472  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1472          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1473  }  }
1474    
1475  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, int size)  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size)
1476  {  {
1477          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1478          SLJIT_UNUSED_ARG(size);          SLJIT_UNUSED_ARG(size);
# Line 1458  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1502  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1502          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1503  }  }
1504    
1505  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si local_size)
1506  {  {
1507          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1508          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1509          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1510          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1511          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1512          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1513          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1514  }  }
1515    
1516  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si local_size)
1517  {  {
1518          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1519          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1520          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1521          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1522          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1523          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1524  }  }
1525    
1526  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
1527  {  {
1528          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1529          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1489  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1533  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1533          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1534  }  }
1535    
1536  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
1537  {  {
1538          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1539          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1540          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
         SLJIT_UNUSED_ARG(args);  
         SLJIT_UNUSED_ARG(temporaries);  
         SLJIT_UNUSED_ARG(saveds);  
         SLJIT_UNUSED_ARG(local_size);  
1541          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1542          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1543  }  }
1544    
1545  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(struct sljit_compiler *compiler, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
1546  {  {
1547          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1548          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
# Line 1511  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1551  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1551          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1552  }  }
1553    
1554  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
1555  {  {
1556          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1557          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1519  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1559  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1559          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1560  }  }
1561    
1562  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
1563          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1564          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1565  {  {
1566          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1567          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1533  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1573  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1573          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1574  }  }
1575    
1576  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
1577          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1578          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1579          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1580  {  {
1581          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1582          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1550  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1590  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1590          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1591  }  }
1592    
1593  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
1594  {  {
1595          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1596          return reg;          return reg;
1597  }  }
1598    
1599  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op_custom(struct sljit_compiler *compiler,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
1600          void *instruction, int size)          void *instruction, sljit_si size)
1601  {  {
1602          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1603          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 1566  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1606  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1606          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1607  }  }
1608    
1609  SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
1610  {  {
1611          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1612          return 0;          return 0;
1613  }  }
1614    
1615  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
1616          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1617          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1618  {  {
1619          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1620          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1586  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1626  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1626          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1627  }  }
1628    
1629  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
1630          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1631          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1632          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1633  {  {
1634          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1635          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1610  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la Line 1650  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la
1650          return NULL;          return NULL;
1651  }  }
1652    
1653  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, int type)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
1654  {  {
1655          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1656          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1618  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1658  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1658          return NULL;          return NULL;
1659  }  }
1660    
1661  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1662          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1663          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1664  {  {
1665          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1666          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1632  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1672  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1672          return NULL;          return NULL;
1673  }  }
1674    
1675  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
1676          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1677          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1678  {  {
1679          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1680          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1660  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1700  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1700          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1701  }  }
1702    
1703  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
1704  {  {
1705          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1706          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1670  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1710  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1710          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1711  }  }
1712    
1713  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
1714            sljit_si dst, sljit_sw dstw,
1715            sljit_si src, sljit_sw srcw,
1716            sljit_si type)
1717  {  {
1718          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1719          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1720          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1721          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1722            SLJIT_UNUSED_ARG(src);
1723            SLJIT_UNUSED_ARG(srcw);
1724          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1725          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1726          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1727  }  }
1728    
1729  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
1730  {  {
1731          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1732          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1691  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l Line 1736  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l
1736          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1737  }  }
1738    
1739  SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w initval)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw initval)
1740  {  {
1741          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1742          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1708  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1753  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1753          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1754  }  }
1755    
1756  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_w new_constant)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant)
1757  {  {
1758          SLJIT_UNUSED_ARG(addr);          SLJIT_UNUSED_ARG(addr);
1759          SLJIT_UNUSED_ARG(new_constant);          SLJIT_UNUSED_ARG(new_constant);

Legend:
Removed from v.1182  
changed lines
  Added in v.1215

  ViewVC Help
Powered by ViewVC 1.1.5