/[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 1461 by zherczeg, Fri Mar 7 11:54:31 2014 UTC
# Line 83  Line 83 
83  #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)  #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
84    
85  #define GET_OPCODE(op) \  #define GET_OPCODE(op) \
86          ((op) & ~(SLJIT_INT_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_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
87    
88  #define GET_FLAGS(op) \  #define GET_FLAGS(op) \
89          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))          ((op) & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | 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_U | SLJIT_SET_S | 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 99  Line 102 
102  #define ABUF_SIZE       4096  #define ABUF_SIZE       4096
103  #endif  #endif
104    
105    /* Parameter parsing. */
106    #define REG_MASK                0x3f
107    #define OFFS_REG(reg)           (((reg) >> 8) & REG_MASK)
108    #define OFFS_REG_MASK           (REG_MASK << 8)
109    #define TO_OFFS_REG(reg)        ((reg) << 8)
110    /* When reg cannot be unused. */
111    #define FAST_IS_REG(reg)        ((reg) <= REG_MASK)
112    /* When reg can be unused. */
113    #define SLOW_IS_REG(reg)        ((reg) > 0 && (reg) <= REG_MASK)
114    
115  /* Jump flags. */  /* Jump flags. */
116  #define JUMP_LABEL      0x1  #define JUMP_LABEL      0x1
117  #define JUMP_ADDR       0x2  #define JUMP_ADDR       0x2
118  /* SLJIT_REWRITABLE_JUMP is 0x1000. */  /* SLJIT_REWRITABLE_JUMP is 0x1000. */
119    
120  #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)
121          #define PATCH_MB        0x4  #       define PATCH_MB 0x4
122          #define PATCH_MW        0x8  #       define PATCH_MW 0x8
123  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
124          #define PATCH_MD        0x10  #       define PATCH_MD 0x10
125  #endif  #endif
126  #endif  #endif
127    
128  #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)
129          #define IS_BL           0x4  #       define IS_BL            0x4
130          #define PATCH_B         0x8  #       define PATCH_B          0x8
131  #endif  #endif
132    
133  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
134          #define CPOOL_SIZE      512  #       define CPOOL_SIZE       512
135  #endif  #endif
136    
137  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
138          #define IS_COND         0x04  #       define IS_COND          0x04
139          #define IS_BL           0x08  #       define IS_BL            0x08
         /* cannot be encoded as branch */  
         #define B_TYPE0         0x00  
140          /* conditional + imm8 */          /* conditional + imm8 */
141          #define B_TYPE1         0x10  #       define PATCH_TYPE1      0x10
142          /* conditional + imm20 */          /* conditional + imm20 */
143          #define B_TYPE2         0x20  #       define PATCH_TYPE2      0x20
144          /* IT + imm24 */          /* IT + imm24 */
145          #define B_TYPE3         0x30  #       define PATCH_TYPE3      0x30
146          /* imm11 */          /* imm11 */
147          #define B_TYPE4         0x40  #       define PATCH_TYPE4      0x40
148          /* imm24 */          /* imm24 */
149          #define B_TYPE5         0x50  #       define PATCH_TYPE5      0x50
150          /* BL + imm24 */          /* BL + imm24 */
151          #define BL_TYPE6        0x60  #       define PATCH_BL         0x60
152          /* 0xf00 cc code for branches */          /* 0xf00 cc code for branches */
153  #endif  #endif
154    
155    #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
156    #       define IS_COND          0x004
157    #       define IS_CBZ           0x008
158    #       define IS_BL            0x010
159    #       define PATCH_B          0x020
160    #       define PATCH_COND       0x040
161    #       define PATCH_ABS48      0x080
162    #       define PATCH_ABS64      0x100
163    #endif
164    
165  #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)
166          #define UNCOND_B        0x04  #       define COND_B           0x04
167          #define PATCH_B         0x08  #       define PATCH_B          0x08
168          #define ABSOLUTE_B      0x10  #       define ABSOLUTE_B       0x10
169    #       define REMOVE_COND      0x20
170    #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
171    #       define PATCH_ABS32      0x40
172    #       define PATCH_ABS48      0x80
173    #endif
174  #endif  #endif
175    
176  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
177          #define IS_MOVABLE      0x04  #       define IS_MOVABLE       0x004
178          #define IS_JAL          0x08  #       define IS_JAL           0x008
179          #define IS_BIT26_COND   0x10  #       define IS_CALL          0x010
180          #define IS_BIT16_COND   0x20  #       define IS_BIT26_COND    0x020
181    #       define IS_BIT16_COND    0x040
182    
183          #define IS_COND         (IS_BIT26_COND | IS_BIT16_COND)  #       define IS_COND          (IS_BIT26_COND | IS_BIT16_COND)
184    
185          #define PATCH_B         0x40  #       define PATCH_B          0x080
186          #define PATCH_J         0x80  #       define PATCH_J          0x100
187    
188    #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
189    #       define PATCH_ABS32      0x200
190    #       define PATCH_ABS48      0x400
191    #endif
192    
193          /* instruction types */          /* instruction types */
194          #define MOVABLE_INS     0  #       define MOVABLE_INS      0
195          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
196          /* no destination (i.e: store) */          /* no destination (i.e: store) */
197          #define UNMOVABLE_INS   32  #       define UNMOVABLE_INS    32
198          /* FPU status register */          /* FPU status register */
199          #define FCSR_FCC        33  #       define FCSR_FCC         33
200    #endif
201    
202    #if (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
203    #       define IS_JAL           0x04
204    #       define IS_COND          0x08
205    
206    #       define PATCH_B          0x10
207    #       define PATCH_J          0x20
208  #endif  #endif
209    
210  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
211          #define IS_MOVABLE      0x04  #       define IS_MOVABLE       0x04
212          #define IS_COND         0x08  #       define IS_COND          0x08
213          #define IS_CALL         0x10  #       define IS_CALL          0x10
214    
215          #define PATCH_B         0x20  #       define PATCH_B          0x20
216          #define PATCH_CALL      0x40  #       define PATCH_CALL       0x40
217    
218          /* instruction types */          /* instruction types */
219          #define MOVABLE_INS     0  #       define MOVABLE_INS      0
220          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
221          /* no destination (i.e: store) */          /* no destination (i.e: store) */
222          #define UNMOVABLE_INS   32  #       define UNMOVABLE_INS    32
223    
224          #define DST_INS_MASK    0xff  #       define DST_INS_MASK     0xff
225    
226          /* ICC_SET is the same as SET_FLAGS. */          /* ICC_SET is the same as SET_FLAGS. */
227          #define ICC_IS_SET      (1 << 23)  #       define ICC_IS_SET       (1 << 23)
228          #define FCC_IS_SET      (1 << 24)  #       define FCC_IS_SET       (1 << 24)
229  #endif  #endif
230    
231  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
232  #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1  #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1
233    #if !(defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
234    #define FIXED_LOCALS_OFFSET (3 * sizeof(sljit_sw))
235    #endif
236  #endif  #endif
237    
238  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
239  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
240  #ifdef _WIN64  #ifdef _WIN64
241  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((4 + 2) * sizeof(sljit_sw))
242  #else  #else
243  #define FIXED_LOCALS_OFFSET (sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (sizeof(sljit_sw))
244    #endif
245  #endif  #endif
246    
247    #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
248    #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1
249  #endif  #endif
250    
251  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
252  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
253  #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)  #ifdef _AIX
254  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
255  #else  #else
256  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_sw))
257  #endif  #endif
258  #endif  #endif
259    
260  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
261  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
262  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
263  #endif  #endif
264    
265  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
266  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
267  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_sw))
268    #endif
269    
270    #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
271    #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
272    #define FIXED_LOCALS_OFFSET 0
273  #endif  #endif
274    
275  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
276  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
277  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_sw))
278  #endif  #endif
279    
280  #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 316 
316    
317  #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)))
318  #define SLJIT_NEEDS_COMPILER_INIT 1  #define SLJIT_NEEDS_COMPILER_INIT 1
319  static int compiler_initialized = 0;  static sljit_si compiler_initialized = 0;
320  /* A thread safe initialization. */  /* A thread safe initialization. */
321  static void init_compiler(void);  static void init_compiler(void);
322  #endif  #endif
# Line 277  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 329  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
329          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
330    
331          SLJIT_COMPILE_ASSERT(          SLJIT_COMPILE_ASSERT(
332                  sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1                  sizeof(sljit_sb) == 1 && sizeof(sljit_ub) == 1
333                  && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2                  && sizeof(sljit_sh) == 2 && sizeof(sljit_uh) == 2
334                  && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4                  && sizeof(sljit_si) == 4 && sizeof(sljit_ui) == 4
335                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
336                  && (sizeof(sljit_w) == 4 || sizeof(sljit_w) == 8)                  && sizeof(sljit_p) <= sizeof(sljit_sw)
337                    && (sizeof(sljit_sw) == 4 || sizeof(sljit_sw) == 8)
338                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
339                  invalid_integer_types);                  invalid_integer_types);
340            SLJIT_COMPILE_ASSERT(SLJIT_INT_OP == SLJIT_SINGLE_OP,
341                    int_op_and_single_op_must_be_the_same);
342            SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_SINGLE_OP,
343                    rewritable_jump_and_single_op_must_not_be_the_same);
344    
345          /* Only the non-zero members must be set. */          /* Only the non-zero members must be set. */
346          compiler->error = SLJIT_SUCCESS;          compiler->error = SLJIT_SUCCESS;
# Line 305  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 362  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
362          compiler->abuf->next = NULL;          compiler->abuf->next = NULL;
363          compiler->abuf->used_size = 0;          compiler->abuf->used_size = 0;
364    
365          compiler->temporaries = -1;          compiler->scratches = -1;
366          compiler->saveds = -1;          compiler->saveds = -1;
367    
368  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
# Line 324  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 381  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
381          compiler->cpool_diff = 0xffffffff;          compiler->cpool_diff = 0xffffffff;
382  #endif  #endif
383    
384  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
385          compiler->delay_slot = UNMOVABLE_INS;          compiler->delay_slot = UNMOVABLE_INS;
386  #endif  #endif
387    
# Line 399  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 456  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
456  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
457  {  {
458          if (SLJIT_LIKELY(!!jump)) {          if (SLJIT_LIKELY(!!jump)) {
                 SLJIT_ASSERT(jump->flags & SLJIT_REWRITABLE_JUMP);  
   
459                  jump->flags &= ~JUMP_LABEL;                  jump->flags &= ~JUMP_LABEL;
460                  jump->flags |= JUMP_ADDR;                  jump->flags |= JUMP_ADDR;
461                  jump->u.target = target;                  jump->u.target = target;
# Line 411  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 466  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
466  /*  Private functions                                                    */  /*  Private functions                                                    */
467  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
468    
469  static void* ensure_buf(struct sljit_compiler *compiler, int size)  static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
470  {  {
471          sljit_ub *ret;          sljit_ub *ret;
472          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
473    
474          if (compiler->buf->used_size + size <= (int)(BUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
475            if (compiler->buf->used_size + size <= (BUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
476                  ret = compiler->buf->memory + compiler->buf->used_size;                  ret = compiler->buf->memory + compiler->buf->used_size;
477                  compiler->buf->used_size += size;                  compiler->buf->used_size += size;
478                  return ret;                  return ret;
# Line 429  static void* ensure_buf(struct sljit_com Line 485  static void* ensure_buf(struct sljit_com
485          return new_frag->memory;          return new_frag->memory;
486  }  }
487    
488  static void* ensure_abuf(struct sljit_compiler *compiler, int size)  static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
489  {  {
490          sljit_ub *ret;          sljit_ub *ret;
491          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
492    
493          if (compiler->abuf->used_size + size <= (int)(ABUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
494            if (compiler->abuf->used_size + size <= (ABUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
495                  ret = compiler->abuf->memory + compiler->abuf->used_size;                  ret = compiler->abuf->memory + compiler->abuf->used_size;
496                  compiler->abuf->used_size += size;                  compiler->abuf->used_size += size;
497                  return ret;                  return ret;
# Line 447  static void* ensure_abuf(struct sljit_co Line 504  static void* ensure_abuf(struct sljit_co
504          return new_frag->memory;          return new_frag->memory;
505  }  }
506    
507  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)
508  {  {
509          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
510    
# Line 490  static SLJIT_INLINE void set_label(struc Line 547  static SLJIT_INLINE void set_label(struc
547          compiler->last_label = label;          compiler->last_label = label;
548  }  }
549    
550  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)
551  {  {
552          jump->next = NULL;          jump->next = NULL;
553          jump->flags = flags;          jump->flags = flags;
# Line 513  static SLJIT_INLINE void set_const(struc Line 570  static SLJIT_INLINE void set_const(struc
570  }  }
571    
572  #define ADDRESSING_DEPENDS_ON(exp, reg) \  #define ADDRESSING_DEPENDS_ON(exp, reg) \
573          (((exp) & SLJIT_MEM) && (((exp) & 0xf) == reg || (((exp) >> 4) & 0xf) == reg))          (((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg))
574    
575  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
576  #define FUNCTION_CHECK_OP() \  #define FUNCTION_CHECK_OP() \
# Line 527  static SLJIT_INLINE void set_const(struc Line 584  static SLJIT_INLINE void set_const(struc
584          case SLJIT_SHL: \          case SLJIT_SHL: \
585          case SLJIT_LSHR: \          case SLJIT_LSHR: \
586          case SLJIT_ASHR: \          case SLJIT_ASHR: \
587                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))); \
588                  break; \                  break; \
589          case SLJIT_NEG: \          case SLJIT_NEG: \
590                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
591                  break; \                  break; \
592          case SLJIT_MUL: \          case SLJIT_MUL: \
593                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
594                  break; \                  break; \
595          case SLJIT_FCMP: \          case SLJIT_CMPD: \
596                  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))); \
597                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
598                  break; \                  break; \
599          case SLJIT_ADD: \          case SLJIT_ADD: \
600                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S))); \
601                  break; \                  break; \
602          case SLJIT_SUB: \          case SLJIT_SUB: \
603                  break; \                  break; \
604          case SLJIT_ADDC: \          case SLJIT_ADDC: \
605          case SLJIT_SUBC: \          case SLJIT_SUBC: \
606                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O))); \
607                  break; \                  break; \
608          default: \          case SLJIT_BREAKPOINT: \
609            case SLJIT_NOP: \
610            case SLJIT_UMUL: \
611            case SLJIT_SMUL: \
612            case SLJIT_MOV: \
613            case SLJIT_MOV_UI: \
614            case SLJIT_MOV_P: \
615            case SLJIT_MOVU: \
616            case SLJIT_MOVU_UI: \
617            case SLJIT_MOVU_P: \
618                  /* Nothing allowed */ \                  /* Nothing allowed */ \
619                  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_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
620                    break; \
621            default: \
622                    /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
623                    SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
624                  break; \                  break; \
625          }          }
626    
627  #define FUNCTION_CHECK_IS_REG(r) \  #define FUNCTION_CHECK_IS_REG(r) \
628          ((r) == SLJIT_UNUSED || \          ((r) == SLJIT_UNUSED || \
629          ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          ((r) >= SLJIT_SCRATCH_REG1 && (r) <= SLJIT_SCRATCH_REG1 - 1 + compiler->scratches) || \
630          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))
631    
632  #define FUNCTION_CHECK_SRC(p, i) \  #define FUNCTION_CHECK_SRC(p, i) \
633          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
634          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
635                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \
636          else if ((p) == SLJIT_IMM) \          else if ((p) == SLJIT_IMM) \
# Line 568  static SLJIT_INLINE void set_const(struc Line 638  static SLJIT_INLINE void set_const(struc
638          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
639                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
640          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
641                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & REG_MASK)); \
642                  if ((p) & 0xf0) { \                  if ((p) & OFFS_REG_MASK) { \
643                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
644                          SLJIT_ASSERT(!((i) & ~0x3)); \                          SLJIT_ASSERT(!((i) & ~0x3)); \
645                  } \                  } \
646                  SLJIT_ASSERT(((p) >> 9) == 0); \                  SLJIT_ASSERT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
647          } \          } \
648          else \          else \
649                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
650    
651  #define FUNCTION_CHECK_DST(p, i) \  #define FUNCTION_CHECK_DST(p, i) \
652          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
653          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
654                  SLJIT_ASSERT((i) == 0); \                  SLJIT_ASSERT((i) == 0); \
655          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
656                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
657          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
658                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & REG_MASK)); \
659                  if ((p) & 0xf0) { \                  if ((p) & OFFS_REG_MASK) { \
660                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
661                          SLJIT_ASSERT(!((i) & ~0x3)); \                          SLJIT_ASSERT(!((i) & ~0x3)); \
662                  } \                  } \
663                  SLJIT_ASSERT(((p) >> 9) == 0); \                  SLJIT_ASSERT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
664          } \          } \
665          else \          else \
666                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
667    
668  #define FUNCTION_FCHECK(p, i) \  #define FUNCTION_FCHECK(p, i) \
669          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG4) \          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG6) \
670                  SLJIT_ASSERT(i == 0); \                  SLJIT_ASSERT(i == 0); \
671          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
672                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & REG_MASK)); \
673                  if ((p) & 0xf0) { \                  if ((p) & OFFS_REG_MASK) { \
674                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
675                          SLJIT_ASSERT(((p) & 0xf0) != (SLJIT_LOCALS_REG << 4) && !(i & ~0x3)); \                          SLJIT_ASSERT(((p) & OFFS_REG_MASK) != TO_OFFS_REG(SLJIT_LOCALS_REG) && !(i & ~0x3)); \
676                  } else \                  } else \
677                          SLJIT_ASSERT((((p) >> 4) & 0xf) == 0); \                          SLJIT_ASSERT(OFFS_REG(p) == 0); \
678                  SLJIT_ASSERT(((p) >> 9) == 0); \                  SLJIT_ASSERT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
679          } \          } \
680          else \          else \
681                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
682    
683  #define FUNCTION_CHECK_OP1() \  #define FUNCTION_CHECK_OP1() \
684          if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_P) { \          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
685                  SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & REG_MASK) != SLJIT_LOCALS_REG); \
686          } \                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & REG_MASK) != SLJIT_LOCALS_REG); \
687          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \                  if ((src & SLJIT_MEM) && (src & REG_MASK)) \
688                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \                          SLJIT_ASSERT((dst & REG_MASK) != (src & REG_MASK) && OFFS_REG(dst) != (src & REG_MASK)); \
                 SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \  
                 if ((src & SLJIT_MEM) && (src & 0xf)) \  
                         SLJIT_ASSERT((dst & 0xf) != (src & 0xf) && ((dst >> 4) & 0xf) != (src & 0xf)); \  
689          }          }
690    
691  #endif  #endif
# Line 631  SLJIT_API_FUNC_ATTRIBUTE void sljit_comp Line 698  SLJIT_API_FUNC_ATTRIBUTE void sljit_comp
698  }  }
699    
700  static char* reg_names[] = {  static char* reg_names[] = {
701          (char*)"<noreg>", (char*)"t1", (char*)"t2", (char*)"t3",          (char*)"unused", (char*)"s1", (char*)"s2", (char*)"s3",
702          (char*)"te1", (char*)"te2", (char*)"s1", (char*)"s2",          (char*)"se1", (char*)"se2", (char*)"p1", (char*)"p2",
703          (char*)"s3", (char*)"se1", (char*)"se2", (char*)"lcr"          (char*)"p3", (char*)"pe1", (char*)"pe2", (char*)"lc"
704  };  };
705    
706  static char* freg_names[] = {  static char* freg_names[] = {
707          (char*)"<noreg>", (char*)"float_r1", (char*)"float_r2", (char*)"float_r3", (char*)"float_r4"          (char*)"unused", (char*)"f1", (char*)"f2", (char*)"f3",
708            (char*)"f4", (char*)"f5", (char*)"f6"
709  };  };
710    
711  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
712  #ifdef _WIN64  #ifdef _WIN64
713          #define SLJIT_PRINT_D   "I64"  #       define SLJIT_PRINT_D    "I64"
714  #else  #else
715          #define SLJIT_PRINT_D   "l"  #       define SLJIT_PRINT_D    "l"
716  #endif  #endif
717  #else  #else
718          #define SLJIT_PRINT_D   ""  #       define SLJIT_PRINT_D    ""
719  #endif  #endif
720    
721  #define sljit_verbose_param(p, i) \  #define sljit_verbose_param(p, i) \
722          if ((p) & SLJIT_IMM) \          if ((p) & SLJIT_IMM) \
723                  fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \                  fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \
724          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
725                  if ((p) & 0xf) { \                  if ((p) & REG_MASK) { \
726                          if (i) { \                          if (i) { \
727                                  if (((p) >> 4) & 0xf) \                                  if ((p) & OFFS_REG_MASK) \
728                                          fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF], 1 << (i)); \                                          fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & REG_MASK], reg_names[OFFS_REG(p)], 1 << (i)); \
729                                  else \                                  else \
730                                          fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & 0xF], (i)); \                                          fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & REG_MASK], (i)); \
731                          } \                          } \
732                          else { \                          else { \
733                                  if (((p) >> 4) & 0xf) \                                  if ((p) & OFFS_REG_MASK) \
734                                          fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF]); \                                          fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & REG_MASK], reg_names[OFFS_REG(p)]); \
735                                  else \                                  else \
736                                          fprintf(compiler->verbose, "[%s]", reg_names[(p) & 0xF]); \                                          fprintf(compiler->verbose, "[%s]", reg_names[(p) & REG_MASK]); \
737                          } \                          } \
738                  } \                  } \
739                  else \                  else \
# Line 674  static char* freg_names[] = { Line 742  static char* freg_names[] = {
742                  fprintf(compiler->verbose, "%s", reg_names[p]);                  fprintf(compiler->verbose, "%s", reg_names[p]);
743  #define sljit_verbose_fparam(p, i) \  #define sljit_verbose_fparam(p, i) \
744          if ((p) & SLJIT_MEM) { \          if ((p) & SLJIT_MEM) { \
745                  if ((p) & 0xf) { \                  if ((p) & REG_MASK) { \
746                          if (i) { \                          if (i) { \
747                                  if (((p) >> 4) & 0xf) \                                  if ((p) & OFFS_REG_MASK) \
748                                          fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF], 1 << (i)); \                                          fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & REG_MASK], reg_names[OFFS_REG(p)], 1 << (i)); \
749                                  else \                                  else \
750                                          fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & 0xF], (i)); \                                          fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & REG_MASK], (i)); \
751                          } \                          } \
752                          else { \                          else { \
753                                  if (((p) >> 4) & 0xF) \                                  if ((p) & OFFS_REG_MASK) \
754                                          fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF]); \                                          fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & REG_MASK], reg_names[OFFS_REG(p)]); \
755                                  else \                                  else \
756                                          fprintf(compiler->verbose, "[%s]", reg_names[(p) & 0xF]); \                                          fprintf(compiler->verbose, "[%s]", reg_names[(p) & REG_MASK]); \
757                          } \                          } \
758                  } \                  } \
759                  else \                  else \
# Line 708  static SLJIT_CONST char* op_names[] = { Line 776  static SLJIT_CONST char* op_names[] = {
776          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
777          (char*)"shl", (char*)"lshr", (char*)"ashr",          (char*)"shl", (char*)"lshr", (char*)"ashr",
778          /* fop1 */          /* fop1 */
779          (char*)"fcmp", (char*)"fmov", (char*)"fneg", (char*)"fabs",          (char*)"cmp", (char*)"mov", (char*)"neg", (char*)"abs",
780          /* fop2 */          /* fop2 */
781          (char*)"fadd", (char*)"fsub", (char*)"fmul", (char*)"fdiv"          (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
782  };  };
783    
784  static char* jump_names[] = {  static char* jump_names[] = {
785          (char*)"c_equal", (char*)"c_not_equal",          (char*)"equal", (char*)"not_equal",
786          (char*)"c_less", (char*)"c_greater_equal",          (char*)"less", (char*)"greater_equal",
787          (char*)"c_greater", (char*)"c_less_equal",          (char*)"greater", (char*)"less_equal",
788          (char*)"c_sig_less", (char*)"c_sig_greater_equal",          (char*)"sig_less", (char*)"sig_greater_equal",
789          (char*)"c_sig_greater", (char*)"c_sig_less_equal",          (char*)"sig_greater", (char*)"sig_less_equal",
790          (char*)"c_overflow", (char*)"c_not_overflow",          (char*)"overflow", (char*)"not_overflow",
791          (char*)"c_mul_overflow", (char*)"c_mul_not_overflow",          (char*)"mul_overflow", (char*)"mul_not_overflow",
792          (char*)"c_float_equal", (char*)"c_float_not_equal",          (char*)"float_equal", (char*)"float_not_equal",
793          (char*)"c_float_less", (char*)"c_float_greater_equal",          (char*)"float_less", (char*)"float_greater_equal",
794          (char*)"c_float_greater", (char*)"c_float_less_equal",          (char*)"float_greater", (char*)"float_less_equal",
795          (char*)"c_float_nan", (char*)"c_float_not_nan",          (char*)"float_unordered", (char*)"float_ordered",
796          (char*)"jump", (char*)"fast_call",          (char*)"jump", (char*)"fast_call",
797          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
798  };  };
# Line 754  static SLJIT_INLINE void check_sljit_gen Line 822  static SLJIT_INLINE void check_sljit_gen
822  #endif  #endif
823  }  }
824    
825  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)
826  {  {
827          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
828          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
829          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
830          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
831          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
832          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
833    
834          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
835          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NO_TMP_REGISTERS);
836          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
837          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
838          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
839  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
840          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
841                  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);
842  #endif  #endif
843  }  }
844    
845  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)
846  {  {
847          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
848          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
849          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
850          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
851          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
852          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
853    
# Line 791  static SLJIT_INLINE void check_sljit_set Line 859  static SLJIT_INLINE void check_sljit_set
859  #endif  #endif
860    
861          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
862          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NO_TMP_REGISTERS);
863          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
864          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
865          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
866  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
867          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
868                  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);
869  #endif  #endif
870  }  }
871    
872  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)
873  {  {
874          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
875          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 830  static SLJIT_INLINE void check_sljit_emi Line 898  static SLJIT_INLINE void check_sljit_emi
898  #endif  #endif
899  }  }
900    
901  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)
902  {  {
903          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
904          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 849  static SLJIT_INLINE void check_sljit_emi Line 917  static SLJIT_INLINE void check_sljit_emi
917  #endif  #endif
918  }  }
919    
920  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)
921  {  {
922          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
923          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 868  static SLJIT_INLINE void check_sljit_emi Line 936  static SLJIT_INLINE void check_sljit_emi
936  #endif  #endif
937  }  }
938    
939  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)
940  {  {
941          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
942          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 882  static SLJIT_INLINE void check_sljit_emi Line 950  static SLJIT_INLINE void check_sljit_emi
950  #endif  #endif
951  }  }
952    
953  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,
954          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
955          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
956  {  {
957          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
958          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 911  static SLJIT_INLINE void check_sljit_emi Line 979  static SLJIT_INLINE void check_sljit_emi
979  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
980          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
981                  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)],
982                          !(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_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
983                            !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
984                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
985                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
986                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(src, srcw);
# Line 920  static SLJIT_INLINE void check_sljit_emi Line 989  static SLJIT_INLINE void check_sljit_emi
989  #endif  #endif
990  }  }
991    
992  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,
993          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
994          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
995          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
996  {  {
997          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
998          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 952  static SLJIT_INLINE void check_sljit_emi Line 1021  static SLJIT_INLINE void check_sljit_emi
1021  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1022          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1023                  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)],
1024                          !(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_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
1025                            !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
1026                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
1027                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1028                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(src1, src1w);
# Line 963  static SLJIT_INLINE void check_sljit_emi Line 1033  static SLJIT_INLINE void check_sljit_emi
1033  #endif  #endif
1034  }  }
1035    
1036  static SLJIT_INLINE void check_sljit_get_register_index(int reg)  static SLJIT_INLINE void check_sljit_get_register_index(sljit_si reg)
1037  {  {
1038          SLJIT_UNUSED_ARG(reg);          SLJIT_UNUSED_ARG(reg);
1039          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);
1040  }  }
1041    
1042    static SLJIT_INLINE void check_sljit_get_float_register_index(sljit_si reg)
1043    {
1044            SLJIT_UNUSED_ARG(reg);
1045            SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_FLOAT_REGISTERS);
1046    }
1047    
1048  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,
1049          void *instruction, int size)          void *instruction, sljit_si size)
1050  {  {
1051          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1052          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 978  static SLJIT_INLINE void check_sljit_emi Line 1054  static SLJIT_INLINE void check_sljit_emi
1054          SLJIT_ASSERT(instruction);          SLJIT_ASSERT(instruction);
1055  }  }
1056    
1057  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,
1058          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1059          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1060  {  {
1061          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1062          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 998  static SLJIT_INLINE void check_sljit_emi Line 1074  static SLJIT_INLINE void check_sljit_emi
1074  #endif  #endif
1075    
1076          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1077          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FCMP && GET_OPCODE(op) <= SLJIT_FABS);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_CMPD && GET_OPCODE(op) <= SLJIT_ABSD);
1078  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1079          FUNCTION_CHECK_OP();          FUNCTION_CHECK_OP();
1080          FUNCTION_FCHECK(src, srcw);          FUNCTION_FCHECK(src, srcw);
# Line 1006  static SLJIT_INLINE void check_sljit_emi Line 1082  static SLJIT_INLINE void check_sljit_emi
1082  #endif  #endif
1083  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1084          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1085                  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",
1086                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s");
1087                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(dst, dstw);
1088                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1089                  sljit_verbose_fparam(src, srcw);                  sljit_verbose_fparam(src, srcw);
# Line 1016  static SLJIT_INLINE void check_sljit_emi Line 1092  static SLJIT_INLINE void check_sljit_emi
1092  #endif  #endif
1093  }  }
1094    
1095  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,
1096          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1097          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1098          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1099  {  {
1100          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1101          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1032  static SLJIT_INLINE void check_sljit_emi Line 1108  static SLJIT_INLINE void check_sljit_emi
1108          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1109    
1110          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1111          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FADD && GET_OPCODE(op) <= SLJIT_FDIV);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_ADDD && GET_OPCODE(op) <= SLJIT_DIVD);
1112  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1113          FUNCTION_CHECK_OP();          FUNCTION_CHECK_OP();
1114          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1041  static SLJIT_INLINE void check_sljit_emi Line 1117  static SLJIT_INLINE void check_sljit_emi
1117  #endif  #endif
1118  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1119          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1120                  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");
1121                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(dst, dstw);
1122                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1123                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(src1, src1w);
# Line 1063  static SLJIT_INLINE void check_sljit_emi Line 1139  static SLJIT_INLINE void check_sljit_emi
1139  #endif  #endif
1140  }  }
1141    
1142  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)
1143  {  {
1144          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1145          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1080  static SLJIT_INLINE void check_sljit_emi Line 1156  static SLJIT_INLINE void check_sljit_emi
1156          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);
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, "  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]);
1160  #endif  #endif
1161  }  }
1162    
1163  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,
1164          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1165          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1166  {  {
1167          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1168          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1095  static SLJIT_INLINE void check_sljit_emi Line 1171  static SLJIT_INLINE void check_sljit_emi
1171          SLJIT_UNUSED_ARG(src2);          SLJIT_UNUSED_ARG(src2);
1172          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1173    
1174          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_INT_OP)));
1175          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);
1176  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1177          FUNCTION_CHECK_SRC(src1, src1w);          FUNCTION_CHECK_SRC(src1, src1w);
# Line 1103  static SLJIT_INLINE void check_sljit_emi Line 1179  static SLJIT_INLINE void check_sljit_emi
1179  #endif  #endif
1180  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1181          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1182                  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]);
1183                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(src1, src1w);
1184                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1185                  sljit_verbose_param(src2, src2w);                  sljit_verbose_param(src2, src2w);
# Line 1112  static SLJIT_INLINE void check_sljit_emi Line 1188  static SLJIT_INLINE void check_sljit_emi
1188  #endif  #endif
1189  }  }
1190    
1191  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,
1192          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1193          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1194  {  {
1195          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1196          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1124  static SLJIT_INLINE void check_sljit_emi Line 1200  static SLJIT_INLINE void check_sljit_emi
1200          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1201    
1202          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1203          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_SINGLE_OP)));
1204          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);
1205  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1206          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1132  static SLJIT_INLINE void check_sljit_emi Line 1208  static SLJIT_INLINE void check_sljit_emi
1208  #endif  #endif
1209  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1210          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1211                  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",
1212                            !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1213                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(src1, src1w);
1214                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1215                  sljit_verbose_fparam(src2, src2w);                  sljit_verbose_fparam(src2, src2w);
# Line 1141  static SLJIT_INLINE void check_sljit_emi Line 1218  static SLJIT_INLINE void check_sljit_emi
1218  #endif  #endif
1219  }  }
1220    
1221  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)
1222  {  {
1223          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1224          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1149  static SLJIT_INLINE void check_sljit_emi Line 1226  static SLJIT_INLINE void check_sljit_emi
1226          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
1227          SLJIT_UNUSED_ARG(srcw);          SLJIT_UNUSED_ARG(srcw);
1228    
1229    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1230            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1231                    compiler->skip_checks = 0;
1232                    return;
1233            }
1234    #endif
1235    
1236          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
1237  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1238          FUNCTION_CHECK_SRC(src, srcw);          FUNCTION_CHECK_SRC(src, srcw);
1239  #endif  #endif
1240  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1241          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1242                  fprintf(compiler->verbose, "  ijump <%s> ", jump_names[type]);                  fprintf(compiler->verbose, "  ijump.%s ", jump_names[type]);
1243                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(src, srcw);
1244                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1245          }          }
1246  #endif  #endif
1247  }  }
1248    
1249  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,
1250            sljit_si dst, sljit_sw dstw,
1251            sljit_si src, sljit_sw srcw,
1252            sljit_si type)
1253  {  {
1254          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1255          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1256          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1257          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1258          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1259            SLJIT_UNUSED_ARG(src);
1260            SLJIT_UNUSED_ARG(srcw);
1261          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1262    
1263          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);
1264          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
1265          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));
1266            SLJIT_ASSERT((op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C)) == 0);
1267            SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
1268  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1269            if (GET_OPCODE(op) < SLJIT_ADD) {
1270                    SLJIT_ASSERT(src == SLJIT_UNUSED && srcw == 0);
1271            } else {
1272                    SLJIT_ASSERT(src == dst && srcw == dstw);
1273            }
1274          FUNCTION_CHECK_DST(dst, dstw);          FUNCTION_CHECK_DST(dst, dstw);
1275  #endif  #endif
1276  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1277          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1278                  fprintf(compiler->verbose, "  cond_set%s%s <%s> ", !(op & SLJIT_SET_E) ? "" : "E",                  fprintf(compiler->verbose, "  %sflags.%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i",
1279                          !(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");
1280                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
1281                  fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);                  if (src != SLJIT_UNUSED) {
1282                            fprintf(compiler->verbose, ", ");
1283                            sljit_verbose_param(src, srcw);
1284                    }
1285                    fprintf(compiler->verbose, ", %s\n", jump_names[type]);
1286          }          }
1287  #endif  #endif
1288  }  }
1289    
1290  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)
1291  {  {
1292          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1293          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1206  static SLJIT_INLINE void check_sljit_get Line 1306  static SLJIT_INLINE void check_sljit_get
1306  #endif  #endif
1307  }  }
1308    
1309  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)
1310  {  {
1311          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1312          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1226  static SLJIT_INLINE void check_sljit_emi Line 1326  static SLJIT_INLINE void check_sljit_emi
1326  #endif  #endif
1327  }  }
1328    
1329  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)
1330  {  {
1331          /* Return if don't need to do anything. */          /* Return if don't need to do anything. */
1332          if (op == SLJIT_UNUSED)          if (op == SLJIT_UNUSED)
1333                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1334    
1335  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1336          /* 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. */
1337          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
1338                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1339  #else  #else
# Line 1274  static SLJIT_INLINE int emit_mov_before_ Line 1374  static SLJIT_INLINE int emit_mov_before_
1374  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
1375    
1376  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
1377          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
1378  #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
1379          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
1380  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
1381          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_32.c"
1382  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
1383          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_32.c"
1384  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1385          #include "sljitNativeARM_Thumb2.c"  #       include "sljitNativeARM_T2_32.c"
1386    #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
1387    #       include "sljitNativeARM_64.c"
1388  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
1389          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1390  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
1391          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1392  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1393          #include "sljitNativeMIPS_common.c"  #       include "sljitNativeMIPS_common.c"
1394    #elif (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
1395    #       include "sljitNativeMIPS_common.c"
1396  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
1397          #include "sljitNativeSPARC_common.c"  #       include "sljitNativeSPARC_common.c"
1398    #elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
1399    #       include "sljitNativeTILEGX_64.c"
1400  #endif  #endif
1401    
1402  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) && !(defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
1403    
1404  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,
1405          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1406          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1407  {  {
1408          /* Default compare for most architectures. */          /* Default compare for most architectures. */
1409          int flags, tmp_src, condition;          sljit_si flags, tmp_src, condition;
1410          sljit_w tmp_srcw;          sljit_sw tmp_srcw;
1411    
1412          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
1413          check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);
1414    
1415          condition = type & 0xff;          condition = type & 0xff;
1416    #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
1417            if ((condition == SLJIT_C_EQUAL || condition == SLJIT_C_NOT_EQUAL)) {
1418                    if ((src1 & SLJIT_IMM) && !src1w) {
1419                            src1 = src2;
1420                            src1w = src2w;
1421                            src2 = SLJIT_IMM;
1422                            src2w = 0;
1423                    }
1424                    if ((src2 & SLJIT_IMM) && !src2w)
1425                            return emit_cmp_to0(compiler, type, src1, src1w);
1426            }
1427    #endif
1428    
1429          if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {          if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {
1430                  /* Immediate is prefered as second argument by most architectures. */                  /* Immediate is prefered as second argument by most architectures. */
1431                  switch (condition) {                  switch (condition) {
# Line 1362  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1481  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1481          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
1482  }  }
1483    
1484  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,
1485          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1486          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1487  {  {
1488          int flags, condition;          sljit_si flags, condition;
1489    
1490          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);
1491    
1492          condition = type & 0xff;          condition = type & 0xff;
1493          if (condition <= SLJIT_C_FLOAT_NOT_EQUAL)          flags = (condition <= SLJIT_C_FLOAT_NOT_EQUAL) ? SLJIT_SET_E : SLJIT_SET_S;
1494                  flags = SLJIT_SET_E;          if (type & SLJIT_SINGLE_OP)
1495          else                  flags |= SLJIT_SINGLE_OP;
                 flags = SLJIT_SET_S;  
1496    
1497  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1498          compiler->skip_checks = 1;          compiler->skip_checks = 1;
1499  #endif  #endif
1500          sljit_emit_fop1(compiler, SLJIT_FCMP | flags, src1, src1w, src2, src2w);          sljit_emit_fop1(compiler, SLJIT_CMPD | flags, src1, src1w, src2, src2w);
1501    
1502  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1503          compiler->skip_checks = 1;          compiler->skip_checks = 1;
# Line 1391  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1509  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1509    
1510  #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)
1511    
1512  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)
1513  {  {
1514          CHECK_ERROR();          CHECK_ERROR();
1515          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 1546  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1546          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1547  }  }
1548    
1549  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)
1550  {  {
1551          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1552          SLJIT_UNUSED_ARG(size);          SLJIT_UNUSED_ARG(size);
# Line 1458  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1576  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1576          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1577  }  }
1578    
1579  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)
1580  {  {
1581          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1582          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1583          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1584          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1585          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1586          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1587          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1588  }  }
1589    
1590  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)
1591  {  {
1592          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1593          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1594          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1595          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1596          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1597          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1598  }  }
1599    
1600  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)
1601  {  {
1602          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1603          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1489  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1607  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1607          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1608  }  }
1609    
1610  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)
1611  {  {
1612          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1613          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1614          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);  
1615          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1616          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1617  }  }
1618    
1619  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)
1620  {  {
1621          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1622          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
# Line 1511  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1625  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1625          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1626  }  }
1627    
1628  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)
1629  {  {
1630          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1631          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1519  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1633  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1633          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1634  }  }
1635    
1636  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,
1637          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1638          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1639  {  {
1640          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1641          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1533  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1647  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1647          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1648  }  }
1649    
1650  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,
1651          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1652          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1653          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1654  {  {
1655          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1656          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1550  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1664  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1664          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1665  }  }
1666    
1667  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
1668  {  {
1669          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1670          return reg;          return reg;
1671  }  }
1672    
1673  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,
1674          void *instruction, int size)          void *instruction, sljit_si size)
1675  {  {
1676          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1677          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 1566  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1680  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1680          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1681  }  }
1682    
1683  SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
1684  {  {
1685          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1686          return 0;          return 0;
1687  }  }
1688    
1689  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,
1690          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1691          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1692  {  {
1693          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1694          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1586  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1700  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1700          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1701  }  }
1702    
1703  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,
1704          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1705          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1706          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1707  {  {
1708          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1709          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1610  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la Line 1724  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la
1724          return NULL;          return NULL;
1725  }  }
1726    
1727  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)
1728  {  {
1729          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1730          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1618  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1732  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1732          return NULL;          return NULL;
1733  }  }
1734    
1735  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,
1736          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1737          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1738  {  {
1739          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1740          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1632  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1746  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1746          return NULL;          return NULL;
1747  }  }
1748    
1749  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,
1750          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1751          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1752  {  {
1753          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1754          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1660  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1774  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1774          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1775  }  }
1776    
1777  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)
1778  {  {
1779          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1780          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1670  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1784  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1784          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1785  }  }
1786    
1787  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,
1788            sljit_si dst, sljit_sw dstw,
1789            sljit_si src, sljit_sw srcw,
1790            sljit_si type)
1791  {  {
1792          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1793          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1794          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1795          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1796            SLJIT_UNUSED_ARG(src);
1797            SLJIT_UNUSED_ARG(srcw);
1798          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1799          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1800          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1801  }  }
1802    
1803  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)
1804  {  {
1805          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1806          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1691  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l Line 1810  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l
1810          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1811  }  }
1812    
1813  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)
1814  {  {
1815          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1816          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1708  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1827  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1827          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1828  }  }
1829    
1830  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)
1831  {  {
1832          SLJIT_UNUSED_ARG(addr);          SLJIT_UNUSED_ARG(addr);
1833          SLJIT_UNUSED_ARG(new_constant);          SLJIT_UNUSED_ARG(new_constant);

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

  ViewVC Help
Powered by ViewVC 1.1.5