/[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 1222 by zherczeg, Mon Nov 19 08:04:03 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)
195  #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1  #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1
196    #if !(defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
197    #define FIXED_LOCALS_OFFSET (3 * sizeof(sljit_sw))
198    #endif
199  #endif  #endif
200    
201  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
202  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
203  #ifdef _WIN64  #ifdef _WIN64
204  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((4 + 2) * sizeof(sljit_sw))
205  #else  #else
206  #define FIXED_LOCALS_OFFSET (sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (sizeof(sljit_sw))
207  #endif  #endif
208  #endif  #endif
209    
210  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
211  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
212  #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)  #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
213  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
214  #else  #else
215  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_sw))
216  #endif  #endif
217  #endif  #endif
218    
219  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
220  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
221  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
222  #endif  #endif
223    
224  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
225  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
226  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_sw))
227  #endif  #endif
228    
229  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
230  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
231  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_sw))
232  #endif  #endif
233    
234  #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 270 
270    
271  #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)))
272  #define SLJIT_NEEDS_COMPILER_INIT 1  #define SLJIT_NEEDS_COMPILER_INIT 1
273  static int compiler_initialized = 0;  static sljit_si compiler_initialized = 0;
274  /* A thread safe initialization. */  /* A thread safe initialization. */
275  static void init_compiler(void);  static void init_compiler(void);
276  #endif  #endif
# Line 277  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 283  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
283          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
284    
285          SLJIT_COMPILE_ASSERT(          SLJIT_COMPILE_ASSERT(
286                  sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1                  sizeof(sljit_sb) == 1 && sizeof(sljit_ub) == 1
287                  && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2                  && sizeof(sljit_sh) == 2 && sizeof(sljit_uh) == 2
288                  && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4                  && sizeof(sljit_si) == 4 && sizeof(sljit_ui) == 4
289                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
290                  && (sizeof(sljit_w) == 4 || sizeof(sljit_w) == 8)                  && sizeof(sljit_p) <= sizeof(sljit_sw)
291                    && (sizeof(sljit_sw) == 4 || sizeof(sljit_sw) == 8)
292                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
293                  invalid_integer_types);                  invalid_integer_types);
294            SLJIT_COMPILE_ASSERT(SLJIT_INT_OP == SLJIT_SINGLE_OP,
295                    int_op_and_single_op_must_be_the_same);
296            SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_SINGLE_OP,
297                    rewritable_jump_and_single_op_must_not_be_the_same);
298    
299          /* Only the non-zero members must be set. */          /* Only the non-zero members must be set. */
300          compiler->error = SLJIT_SUCCESS;          compiler->error = SLJIT_SUCCESS;
# Line 305  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 316  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
316          compiler->abuf->next = NULL;          compiler->abuf->next = NULL;
317          compiler->abuf->used_size = 0;          compiler->abuf->used_size = 0;
318    
319          compiler->temporaries = -1;          compiler->scratches = -1;
320          compiler->saveds = -1;          compiler->saveds = -1;
321    
322  #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 422  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
422  /*  Private functions                                                    */  /*  Private functions                                                    */
423  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
424    
425  static void* ensure_buf(struct sljit_compiler *compiler, int size)  static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
426  {  {
427          sljit_ub *ret;          sljit_ub *ret;
428          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
429    
430          if (compiler->buf->used_size + size <= (int)(BUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
431            if (compiler->buf->used_size + size <= (BUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
432                  ret = compiler->buf->memory + compiler->buf->used_size;                  ret = compiler->buf->memory + compiler->buf->used_size;
433                  compiler->buf->used_size += size;                  compiler->buf->used_size += size;
434                  return ret;                  return ret;
# Line 429  static void* ensure_buf(struct sljit_com Line 441  static void* ensure_buf(struct sljit_com
441          return new_frag->memory;          return new_frag->memory;
442  }  }
443    
444  static void* ensure_abuf(struct sljit_compiler *compiler, int size)  static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
445  {  {
446          sljit_ub *ret;          sljit_ub *ret;
447          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
448    
449          if (compiler->abuf->used_size + size <= (int)(ABUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
450            if (compiler->abuf->used_size + size <= (ABUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
451                  ret = compiler->abuf->memory + compiler->abuf->used_size;                  ret = compiler->abuf->memory + compiler->abuf->used_size;
452                  compiler->abuf->used_size += size;                  compiler->abuf->used_size += size;
453                  return ret;                  return ret;
# Line 447  static void* ensure_abuf(struct sljit_co Line 460  static void* ensure_abuf(struct sljit_co
460          return new_frag->memory;          return new_frag->memory;
461  }  }
462    
463  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)
464  {  {
465          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
466    
# Line 490  static SLJIT_INLINE void set_label(struc Line 503  static SLJIT_INLINE void set_label(struc
503          compiler->last_label = label;          compiler->last_label = label;
504  }  }
505    
506  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)
507  {  {
508          jump->next = NULL;          jump->next = NULL;
509          jump->flags = flags;          jump->flags = flags;
# Line 535  static SLJIT_INLINE void set_const(struc Line 548  static SLJIT_INLINE void set_const(struc
548          case SLJIT_MUL: \          case SLJIT_MUL: \
549                  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))); \
550                  break; \                  break; \
551          case SLJIT_FCMP: \          case SLJIT_CMPD: \
552                  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))); \
553                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
554                  break; \                  break; \
555          case SLJIT_ADD: \          case SLJIT_ADD: \
# Line 548  static SLJIT_INLINE void set_const(struc Line 561  static SLJIT_INLINE void set_const(struc
561          case SLJIT_SUBC: \          case SLJIT_SUBC: \
562                  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))); \
563                  break; \                  break; \
564          default: \          case SLJIT_BREAKPOINT: \
565            case SLJIT_NOP: \
566            case SLJIT_UMUL: \
567            case SLJIT_SMUL: \
568            case SLJIT_MOV: \
569            case SLJIT_MOV_P: \
570            case SLJIT_MOVU: \
571            case SLJIT_MOVU_P: \
572                  /* Nothing allowed */ \                  /* Nothing allowed */ \
573                  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))); \
574                  break; \                  break; \
575            default: \
576                    /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
577                    SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
578                    break; \
579          }          }
580    
581  #define FUNCTION_CHECK_IS_REG(r) \  #define FUNCTION_CHECK_IS_REG(r) \
582          ((r) == SLJIT_UNUSED || \          ((r) == SLJIT_UNUSED || \
583          ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          ((r) >= SLJIT_SCRATCH_REG1 && (r) <= SLJIT_SCRATCH_REG1 - 1 + compiler->scratches) || \
584          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))
585    
586  #define FUNCTION_CHECK_SRC(p, i) \  #define FUNCTION_CHECK_SRC(p, i) \
587          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
588          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
589                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \
590          else if ((p) == SLJIT_IMM) \          else if ((p) == SLJIT_IMM) \
# Line 579  static SLJIT_INLINE void set_const(struc Line 603  static SLJIT_INLINE void set_const(struc
603                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
604    
605  #define FUNCTION_CHECK_DST(p, i) \  #define FUNCTION_CHECK_DST(p, i) \
606          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
607          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
608                  SLJIT_ASSERT((i) == 0); \                  SLJIT_ASSERT((i) == 0); \
609          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 620  static SLJIT_INLINE void set_const(struc
620                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
621    
622  #define FUNCTION_FCHECK(p, i) \  #define FUNCTION_FCHECK(p, i) \
623          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG4) \          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG6) \
624                  SLJIT_ASSERT(i == 0); \                  SLJIT_ASSERT(i == 0); \
625          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
626                  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 635  static SLJIT_INLINE void set_const(struc
635                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
636    
637  #define FUNCTION_CHECK_OP1() \  #define FUNCTION_CHECK_OP1() \
638          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) { \  
639                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \
640                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \
641                  if ((src & SLJIT_MEM) && (src & 0xf)) \                  if ((src & SLJIT_MEM) && (src & 0xf)) \
# Line 637  static char* reg_names[] = { Line 658  static char* reg_names[] = {
658  };  };
659    
660  static char* freg_names[] = {  static char* freg_names[] = {
661          (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",
662            (char*)"float_r4", (char*)"float_r5", (char*)"float_r6"
663  };  };
664    
665  #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)
666  #ifdef _WIN64  #ifdef _WIN64
667          #define SLJIT_PRINT_D   "I64"  #       define SLJIT_PRINT_D    "I64"
668  #else  #else
669          #define SLJIT_PRINT_D   "l"  #       define SLJIT_PRINT_D    "l"
670  #endif  #endif
671  #else  #else
672          #define SLJIT_PRINT_D   ""  #       define SLJIT_PRINT_D    ""
673  #endif  #endif
674    
675  #define sljit_verbose_param(p, i) \  #define sljit_verbose_param(p, i) \
# Line 708  static SLJIT_CONST char* op_names[] = { Line 730  static SLJIT_CONST char* op_names[] = {
730          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
731          (char*)"shl", (char*)"lshr", (char*)"ashr",          (char*)"shl", (char*)"lshr", (char*)"ashr",
732          /* fop1 */          /* fop1 */
733          (char*)"fcmp", (char*)"fmov", (char*)"fneg", (char*)"fabs",          (char*)"cmp", (char*)"mov", (char*)"neg", (char*)"abs",
734          /* fop2 */          /* fop2 */
735          (char*)"fadd", (char*)"fsub", (char*)"fmul", (char*)"fdiv"          (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
736  };  };
737    
738  static char* jump_names[] = {  static char* jump_names[] = {
# Line 724  static char* jump_names[] = { Line 746  static char* jump_names[] = {
746          (char*)"c_float_equal", (char*)"c_float_not_equal",          (char*)"c_float_equal", (char*)"c_float_not_equal",
747          (char*)"c_float_less", (char*)"c_float_greater_equal",          (char*)"c_float_less", (char*)"c_float_greater_equal",
748          (char*)"c_float_greater", (char*)"c_float_less_equal",          (char*)"c_float_greater", (char*)"c_float_less_equal",
749          (char*)"c_float_nan", (char*)"c_float_not_nan",          (char*)"c_float_unordered", (char*)"c_float_ordered",
750          (char*)"jump", (char*)"fast_call",          (char*)"jump", (char*)"fast_call",
751          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
752  };  };
# Line 754  static SLJIT_INLINE void check_sljit_gen Line 776  static SLJIT_INLINE void check_sljit_gen
776  #endif  #endif
777  }  }
778    
779  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)
780  {  {
781          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
782          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
783          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
784          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
785          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
786          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
787    
788          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
789          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NO_TMP_REGISTERS);
790          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
791          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
792          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
793  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
794          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
795                  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);
796  #endif  #endif
797  }  }
798    
799  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)
800  {  {
801          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
802          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
803          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
804          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
805          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
806          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
807    
# Line 791  static SLJIT_INLINE void check_sljit_set Line 813  static SLJIT_INLINE void check_sljit_set
813  #endif  #endif
814    
815          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
816          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NO_TMP_REGISTERS);
817          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
818          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
819          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
820  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
821          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
822                  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);
823  #endif  #endif
824  }  }
825    
826  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)
827  {  {
828          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
829          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 830  static SLJIT_INLINE void check_sljit_emi Line 852  static SLJIT_INLINE void check_sljit_emi
852  #endif  #endif
853  }  }
854    
855  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)
856  {  {
857          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
858          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 849  static SLJIT_INLINE void check_sljit_emi Line 871  static SLJIT_INLINE void check_sljit_emi
871  #endif  #endif
872  }  }
873    
874  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)
875  {  {
876          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
877          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 868  static SLJIT_INLINE void check_sljit_emi Line 890  static SLJIT_INLINE void check_sljit_emi
890  #endif  #endif
891  }  }
892    
893  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)
894  {  {
895          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
896          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 882  static SLJIT_INLINE void check_sljit_emi Line 904  static SLJIT_INLINE void check_sljit_emi
904  #endif  #endif
905  }  }
906    
907  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,
908          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
909          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
910  {  {
911          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
912          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 911  static SLJIT_INLINE void check_sljit_emi Line 933  static SLJIT_INLINE void check_sljit_emi
933  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
934          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
935                  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)],
936                          !(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",
937                            !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
938                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
939                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
940                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(src, srcw);
# Line 920  static SLJIT_INLINE void check_sljit_emi Line 943  static SLJIT_INLINE void check_sljit_emi
943  #endif  #endif
944  }  }
945    
946  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,
947          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
948          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
949          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
950  {  {
951          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
952          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 952  static SLJIT_INLINE void check_sljit_emi Line 975  static SLJIT_INLINE void check_sljit_emi
975  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
976          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
977                  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)],
978                          !(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",
979                            !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
980                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
981                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
982                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(src1, src1w);
# Line 963  static SLJIT_INLINE void check_sljit_emi Line 987  static SLJIT_INLINE void check_sljit_emi
987  #endif  #endif
988  }  }
989    
990  static SLJIT_INLINE void check_sljit_get_register_index(int reg)  static SLJIT_INLINE void check_sljit_get_register_index(sljit_si reg)
991  {  {
992          SLJIT_UNUSED_ARG(reg);          SLJIT_UNUSED_ARG(reg);
993          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);
994  }  }
995    
996  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,
997          void *instruction, int size)          void *instruction, sljit_si size)
998  {  {
999          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1000          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 978  static SLJIT_INLINE void check_sljit_emi Line 1002  static SLJIT_INLINE void check_sljit_emi
1002          SLJIT_ASSERT(instruction);          SLJIT_ASSERT(instruction);
1003  }  }
1004    
1005  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,
1006          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1007          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1008  {  {
1009          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1010          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 998  static SLJIT_INLINE void check_sljit_emi Line 1022  static SLJIT_INLINE void check_sljit_emi
1022  #endif  #endif
1023    
1024          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1025          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FCMP && GET_OPCODE(op) <= SLJIT_FABS);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_CMPD && GET_OPCODE(op) <= SLJIT_ABSD);
1026  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1027          FUNCTION_CHECK_OP();          FUNCTION_CHECK_OP();
1028          FUNCTION_FCHECK(src, srcw);          FUNCTION_FCHECK(src, srcw);
# Line 1006  static SLJIT_INLINE void check_sljit_emi Line 1030  static SLJIT_INLINE void check_sljit_emi
1030  #endif  #endif
1031  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1032          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1033                  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",
1034                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s");
1035                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(dst, dstw);
1036                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1037                  sljit_verbose_fparam(src, srcw);                  sljit_verbose_fparam(src, srcw);
# Line 1016  static SLJIT_INLINE void check_sljit_emi Line 1040  static SLJIT_INLINE void check_sljit_emi
1040  #endif  #endif
1041  }  }
1042    
1043  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,
1044          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1045          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1046          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1047  {  {
1048          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1049          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1032  static SLJIT_INLINE void check_sljit_emi Line 1056  static SLJIT_INLINE void check_sljit_emi
1056          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1057    
1058          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1059          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FADD && GET_OPCODE(op) <= SLJIT_FDIV);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_ADDD && GET_OPCODE(op) <= SLJIT_DIVD);
1060  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1061          FUNCTION_CHECK_OP();          FUNCTION_CHECK_OP();
1062          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1041  static SLJIT_INLINE void check_sljit_emi Line 1065  static SLJIT_INLINE void check_sljit_emi
1065  #endif  #endif
1066  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1067          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1068                  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");
1069                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(dst, dstw);
1070                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1071                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(src1, src1w);
# Line 1063  static SLJIT_INLINE void check_sljit_emi Line 1087  static SLJIT_INLINE void check_sljit_emi
1087  #endif  #endif
1088  }  }
1089    
1090  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)
1091  {  {
1092          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1093          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1080  static SLJIT_INLINE void check_sljit_emi Line 1104  static SLJIT_INLINE void check_sljit_emi
1104          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);
1105  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1106          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
1107                  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]);
1108  #endif  #endif
1109  }  }
1110    
1111  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,
1112          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1113          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1114  {  {
1115          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1116          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1095  static SLJIT_INLINE void check_sljit_emi Line 1119  static SLJIT_INLINE void check_sljit_emi
1119          SLJIT_UNUSED_ARG(src2);          SLJIT_UNUSED_ARG(src2);
1120          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1121    
1122          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_INT_OP)));
1123          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);
1124  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1125          FUNCTION_CHECK_SRC(src1, src1w);          FUNCTION_CHECK_SRC(src1, src1w);
# Line 1103  static SLJIT_INLINE void check_sljit_emi Line 1127  static SLJIT_INLINE void check_sljit_emi
1127  #endif  #endif
1128  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1129          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1130                  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]);
1131                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(src1, src1w);
1132                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1133                  sljit_verbose_param(src2, src2w);                  sljit_verbose_param(src2, src2w);
# Line 1112  static SLJIT_INLINE void check_sljit_emi Line 1136  static SLJIT_INLINE void check_sljit_emi
1136  #endif  #endif
1137  }  }
1138    
1139  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,
1140          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1141          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1142  {  {
1143          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1144          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1124  static SLJIT_INLINE void check_sljit_emi Line 1148  static SLJIT_INLINE void check_sljit_emi
1148          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1149    
1150          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1151          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_SINGLE_OP)));
1152          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);
1153  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1154          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1132  static SLJIT_INLINE void check_sljit_emi Line 1156  static SLJIT_INLINE void check_sljit_emi
1156  #endif  #endif
1157  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1158          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1159                  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",
1160                            !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1161                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(src1, src1w);
1162                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1163                  sljit_verbose_fparam(src2, src2w);                  sljit_verbose_fparam(src2, src2w);
# Line 1141  static SLJIT_INLINE void check_sljit_emi Line 1166  static SLJIT_INLINE void check_sljit_emi
1166  #endif  #endif
1167  }  }
1168    
1169  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)
1170  {  {
1171          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1172          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1149  static SLJIT_INLINE void check_sljit_emi Line 1174  static SLJIT_INLINE void check_sljit_emi
1174          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
1175          SLJIT_UNUSED_ARG(srcw);          SLJIT_UNUSED_ARG(srcw);
1176    
1177    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1178            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1179                    compiler->skip_checks = 0;
1180                    return;
1181            }
1182    #endif
1183    
1184          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
1185  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1186          FUNCTION_CHECK_SRC(src, srcw);          FUNCTION_CHECK_SRC(src, srcw);
1187  #endif  #endif
1188  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1189          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1190                  fprintf(compiler->verbose, "  ijump <%s> ", jump_names[type]);                  fprintf(compiler->verbose, "  ijump<%s> ", jump_names[type]);
1191                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(src, srcw);
1192                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1193          }          }
1194  #endif  #endif
1195  }  }
1196    
1197  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,
1198            sljit_si dst, sljit_sw dstw,
1199            sljit_si src, sljit_sw srcw,
1200            sljit_si type)
1201  {  {
1202          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1203          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1204          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1205          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1206          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1207            SLJIT_UNUSED_ARG(src);
1208            SLJIT_UNUSED_ARG(srcw);
1209          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1210    
1211          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);
1212          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
1213          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));
1214            SLJIT_ASSERT((op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C)) == 0);
1215            SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
1216  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1217            if (GET_OPCODE(op) < SLJIT_ADD) {
1218                    SLJIT_ASSERT(src == SLJIT_UNUSED && srcw == 0);
1219            } else {
1220                    SLJIT_ASSERT(src == dst && srcw == dstw);
1221            }
1222          FUNCTION_CHECK_DST(dst, dstw);          FUNCTION_CHECK_DST(dst, dstw);
1223  #endif  #endif
1224  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1225          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1226                  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",
1227                          !(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");
1228                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
1229                    if (src != SLJIT_UNUSED) {
1230                            fprintf(compiler->verbose, ", ");
1231                            sljit_verbose_param(src, srcw);
1232                    }
1233                  fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);                  fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);
1234          }          }
1235  #endif  #endif
1236  }  }
1237    
1238  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)
1239  {  {
1240          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1241          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1206  static SLJIT_INLINE void check_sljit_get Line 1254  static SLJIT_INLINE void check_sljit_get
1254  #endif  #endif
1255  }  }
1256    
1257  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)
1258  {  {
1259          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1260          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1226  static SLJIT_INLINE void check_sljit_emi Line 1274  static SLJIT_INLINE void check_sljit_emi
1274  #endif  #endif
1275  }  }
1276    
1277  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)
1278  {  {
1279          /* Return if don't need to do anything. */          /* Return if don't need to do anything. */
1280          if (op == SLJIT_UNUSED)          if (op == SLJIT_UNUSED)
1281                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1282    
1283  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1284          /* 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. */
1285          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
1286                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1287  #else  #else
# Line 1274  static SLJIT_INLINE int emit_mov_before_ Line 1322  static SLJIT_INLINE int emit_mov_before_
1322  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
1323    
1324  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
1325          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
1326  #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
1327          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
1328  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
1329          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_v5.c"
1330  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
1331          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_v5.c"
1332  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1333          #include "sljitNativeARM_Thumb2.c"  #       include "sljitNativeARM_Thumb2.c"
1334  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
1335          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1336  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
1337          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1338  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1339          #include "sljitNativeMIPS_common.c"  #       include "sljitNativeMIPS_common.c"
1340  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
1341          #include "sljitNativeSPARC_common.c"  #       include "sljitNativeSPARC_common.c"
1342  #endif  #endif
1343    
1344  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1345    
1346  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,
1347          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1348          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1349  {  {
1350          /* Default compare for most architectures. */          /* Default compare for most architectures. */
1351          int flags, tmp_src, condition;          sljit_si flags, tmp_src, condition;
1352          sljit_w tmp_srcw;          sljit_sw tmp_srcw;
1353    
1354          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
1355          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 1410  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1410          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
1411  }  }
1412    
1413  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,
1414          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1415          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1416  {  {
1417          int flags, condition;          sljit_si flags, condition;
1418    
1419          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);
1420    
1421          condition = type & 0xff;          condition = type & 0xff;
1422          if (condition <= SLJIT_C_FLOAT_NOT_EQUAL)          flags = (condition <= SLJIT_C_FLOAT_NOT_EQUAL) ? SLJIT_SET_E : SLJIT_SET_S;
1423                  flags = SLJIT_SET_E;          if (type & SLJIT_SINGLE_OP)
1424          else                  flags |= SLJIT_SINGLE_OP;
                 flags = SLJIT_SET_S;  
1425    
1426  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1427          compiler->skip_checks = 1;          compiler->skip_checks = 1;
1428  #endif  #endif
1429          sljit_emit_fop1(compiler, SLJIT_FCMP | flags, src1, src1w, src2, src2w);          sljit_emit_fop1(compiler, SLJIT_CMPD | flags, src1, src1w, src2, src2w);
1430    
1431  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1432          compiler->skip_checks = 1;          compiler->skip_checks = 1;
# Line 1391  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1438  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1438    
1439  #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)
1440    
1441  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)
1442  {  {
1443          CHECK_ERROR();          CHECK_ERROR();
1444          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 1475  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1475          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1476  }  }
1477    
1478  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)
1479  {  {
1480          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1481          SLJIT_UNUSED_ARG(size);          SLJIT_UNUSED_ARG(size);
# Line 1458  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1505  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1505          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1506  }  }
1507    
1508  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)
1509  {  {
1510          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1511          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1512          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1513          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1514          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1515          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1516          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1517  }  }
1518    
1519  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)
1520  {  {
1521          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1522          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1523          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1524          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1525          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1526          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1527  }  }
1528    
1529  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)
1530  {  {
1531          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1532          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1489  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1536  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1536          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1537  }  }
1538    
1539  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)
1540  {  {
1541          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1542          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1543          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);  
1544          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1545          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1546  }  }
1547    
1548  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)
1549  {  {
1550          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1551          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
# Line 1511  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1554  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1554          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1555  }  }
1556    
1557  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)
1558  {  {
1559          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1560          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1519  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1562  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1562          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1563  }  }
1564    
1565  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,
1566          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1567          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1568  {  {
1569          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1570          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1533  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1576  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1576          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1577  }  }
1578    
1579  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,
1580          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1581          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1582          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1583  {  {
1584          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1585          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1550  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1593  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1593          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1594  }  }
1595    
1596  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
1597  {  {
1598          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1599          return reg;          return reg;
1600  }  }
1601    
1602  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,
1603          void *instruction, int size)          void *instruction, sljit_si size)
1604  {  {
1605          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1606          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 1566  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1609  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1609          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1610  }  }
1611    
1612  SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
1613  {  {
1614          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1615          return 0;          return 0;
1616  }  }
1617    
1618  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,
1619          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1620          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1621  {  {
1622          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1623          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1586  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1629  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1629          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1630  }  }
1631    
1632  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,
1633          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1634          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1635          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1636  {  {
1637          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1638          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1610  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la Line 1653  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la
1653          return NULL;          return NULL;
1654  }  }
1655    
1656  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)
1657  {  {
1658          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1659          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1618  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1661  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1661          return NULL;          return NULL;
1662  }  }
1663    
1664  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,
1665          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1666          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1667  {  {
1668          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1669          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1632  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1675  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1675          return NULL;          return NULL;
1676  }  }
1677    
1678  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,
1679          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1680          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1681  {  {
1682          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1683          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1660  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1703  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1703          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1704  }  }
1705    
1706  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)
1707  {  {
1708          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1709          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1670  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1713  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1713          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1714  }  }
1715    
1716  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,
1717            sljit_si dst, sljit_sw dstw,
1718            sljit_si src, sljit_sw srcw,
1719            sljit_si type)
1720  {  {
1721          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1722          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1723          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1724          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1725            SLJIT_UNUSED_ARG(src);
1726            SLJIT_UNUSED_ARG(srcw);
1727          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1728          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1729          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1730  }  }
1731    
1732  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)
1733  {  {
1734          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1735          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1691  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l Line 1739  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l
1739          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1740  }  }
1741    
1742  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)
1743  {  {
1744          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1745          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1708  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1756  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1756          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1757  }  }
1758    
1759  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)
1760  {  {
1761          SLJIT_UNUSED_ARG(addr);          SLJIT_UNUSED_ARG(addr);
1762          SLJIT_UNUSED_ARG(new_constant);          SLJIT_UNUSED_ARG(new_constant);

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

  ViewVC Help
Powered by ViewVC 1.1.5