/[pcre]/code/trunk/pcre_jit_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_jit_compile.c

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

revision 1634 by zherczeg, Fri Feb 19 08:10:18 2016 UTC revision 1640 by zherczeg, Mon Feb 29 09:21:21 2016 UTC
# Line 183  typedef struct executable_functions { Line 183  typedef struct executable_functions {
183    sljit_uw executable_sizes[JIT_NUMBER_OF_COMPILE_MODES];    sljit_uw executable_sizes[JIT_NUMBER_OF_COMPILE_MODES];
184    PUBL(jit_callback) callback;    PUBL(jit_callback) callback;
185    void *userdata;    void *userdata;
186    sljit_ui top_bracket;    sljit_u32 top_bracket;
187    sljit_ui limit_match;    sljit_u32 limit_match;
188  } executable_functions;  } executable_functions;
189    
190  typedef struct jump_list {  typedef struct jump_list {
# Line 335  typedef struct compiler_common { Line 335  typedef struct compiler_common {
335    /* First byte code. */    /* First byte code. */
336    pcre_uchar *start;    pcre_uchar *start;
337    /* Maps private data offset to each opcode. */    /* Maps private data offset to each opcode. */
338    sljit_si *private_data_ptrs;    sljit_s32 *private_data_ptrs;
339    /* Chain list of read-only data ptrs. */    /* Chain list of read-only data ptrs. */
340    void *read_only_data_head;    void *read_only_data_head;
341    /* Tells whether the capturing bracket is optimized. */    /* Tells whether the capturing bracket is optimized. */
342    sljit_ub *optimized_cbracket;    sljit_u8 *optimized_cbracket;
343    /* Tells whether the starting offset is a target of then. */    /* Tells whether the starting offset is a target of then. */
344    sljit_ub *then_offsets;    sljit_u8 *then_offsets;
345    /* Current position where a THEN must jump. */    /* Current position where a THEN must jump. */
346    then_trap_backtrack *then_trap;    then_trap_backtrack *then_trap;
347    /* Starting offset of private data for capturing brackets. */    /* Starting offset of private data for capturing brackets. */
348    sljit_si cbra_ptr;    sljit_s32 cbra_ptr;
349    /* Output vector starting point. Must be divisible by 2. */    /* Output vector starting point. Must be divisible by 2. */
350    sljit_si ovector_start;    sljit_s32 ovector_start;
351    /* Points to the starting character of the current match. */    /* Points to the starting character of the current match. */
352    sljit_si start_ptr;    sljit_s32 start_ptr;
353    /* Last known position of the requested byte. */    /* Last known position of the requested byte. */
354    sljit_si req_char_ptr;    sljit_s32 req_char_ptr;
355    /* Head of the last recursion. */    /* Head of the last recursion. */
356    sljit_si recursive_head_ptr;    sljit_s32 recursive_head_ptr;
357    /* First inspected character for partial matching.    /* First inspected character for partial matching.
358       (Needed for avoiding zero length partial matches.) */       (Needed for avoiding zero length partial matches.) */
359    sljit_si start_used_ptr;    sljit_s32 start_used_ptr;
360    /* Starting pointer for partial soft matches. */    /* Starting pointer for partial soft matches. */
361    sljit_si hit_start;    sljit_s32 hit_start;
362    /* Pointer of the match end position. */    /* Pointer of the match end position. */
363    sljit_si match_end_ptr;    sljit_s32 match_end_ptr;
364    /* Points to the marked string. */    /* Points to the marked string. */
365    sljit_si mark_ptr;    sljit_s32 mark_ptr;
366    /* Recursive control verb management chain. */    /* Recursive control verb management chain. */
367    sljit_si control_head_ptr;    sljit_s32 control_head_ptr;
368    /* Points to the last matched capture block index. */    /* Points to the last matched capture block index. */
369    sljit_si capture_last_ptr;    sljit_s32 capture_last_ptr;
370    /* Fast forward skipping byte code pointer. */    /* Fast forward skipping byte code pointer. */
371    pcre_uchar *fast_forward_bc_ptr;    pcre_uchar *fast_forward_bc_ptr;
372    /* Locals used by fast fail optimization. */    /* Locals used by fast fail optimization. */
373    sljit_si fast_fail_start_ptr;    sljit_s32 fast_fail_start_ptr;
374    sljit_si fast_fail_end_ptr;    sljit_s32 fast_fail_end_ptr;
375    
376    /* Flipped and lower case tables. */    /* Flipped and lower case tables. */
377    const sljit_ub *fcc;    const sljit_u8 *fcc;
378    sljit_sw lcc;    sljit_sw lcc;
379    /* Mode can be PCRE_STUDY_JIT_COMPILE and others. */    /* Mode can be PCRE_STUDY_JIT_COMPILE and others. */
380    int mode;    int mode;
# Line 394  typedef struct compiler_common { Line 394  typedef struct compiler_common {
394    BOOL positive_assert;    BOOL positive_assert;
395    /* Newline control. */    /* Newline control. */
396    int nltype;    int nltype;
397    sljit_ui nlmax;    sljit_u32 nlmax;
398    sljit_ui nlmin;    sljit_u32 nlmin;
399    int newline;    int newline;
400    int bsr_nltype;    int bsr_nltype;
401    sljit_ui bsr_nlmax;    sljit_u32 bsr_nlmax;
402    sljit_ui bsr_nlmin;    sljit_u32 bsr_nlmin;
403    /* Dollar endonly. */    /* Dollar endonly. */
404    int endonly;    int endonly;
405    /* Tables. */    /* Tables. */
# Line 457  typedef struct compare_context { Line 457  typedef struct compare_context {
457  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
458    int ucharptr;    int ucharptr;
459    union {    union {
460      sljit_si asint;      sljit_s32 asint;
461      sljit_uh asushort;      sljit_u16 asushort;
462  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
463      sljit_ub asbyte;      sljit_u8 asbyte;
464      sljit_ub asuchars[4];      sljit_u8 asuchars[4];
465  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
466      sljit_uh asuchars[2];      sljit_u16 asuchars[2];
467  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
468      sljit_ui asuchars[1];      sljit_u32 asuchars[1];
469  #endif  #endif
470    } c;    } c;
471    union {    union {
472      sljit_si asint;      sljit_s32 asint;
473      sljit_uh asushort;      sljit_u16 asushort;
474  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
475      sljit_ub asbyte;      sljit_u8 asbyte;
476      sljit_ub asuchars[4];      sljit_u8 asuchars[4];
477  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
478      sljit_uh asuchars[2];      sljit_u16 asuchars[2];
479  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
480      sljit_ui asuchars[1];      sljit_u32 asuchars[1];
481  #endif  #endif
482    } oc;    } oc;
483  #endif  #endif
# Line 519  the start pointers when the end of the c Line 519  the start pointers when the end of the c
519  #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])  #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
520    
521  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
522  #define MOV_UCHAR  SLJIT_MOV_UB  #define MOV_UCHAR  SLJIT_MOV_U8
523  #define MOVU_UCHAR SLJIT_MOVU_UB  #define MOVU_UCHAR SLJIT_MOVU_U8
524  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
525  #define MOV_UCHAR  SLJIT_MOV_UH  #define MOV_UCHAR  SLJIT_MOV_U16
526  #define MOVU_UCHAR SLJIT_MOVU_UH  #define MOVU_UCHAR SLJIT_MOVU_U16
527  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
528  #define MOV_UCHAR  SLJIT_MOV_UI  #define MOV_UCHAR  SLJIT_MOV_U32
529  #define MOVU_UCHAR SLJIT_MOVU_UI  #define MOVU_UCHAR SLJIT_MOVU_U32
530  #else  #else
531  #error Unsupported compiling mode  #error Unsupported compiling mode
532  #endif  #endif
# Line 1032  if (is_accelerated_repeat(cc)) Line 1032  if (is_accelerated_repeat(cc))
1032  return FALSE;  return FALSE;
1033  }  }
1034    
1035  static SLJIT_INLINE void detect_fast_fail(compiler_common *common, pcre_uchar *cc, int *private_data_start, sljit_si depth)  static SLJIT_INLINE void detect_fast_fail(compiler_common *common, pcre_uchar *cc, int *private_data_start, sljit_s32 depth)
1036  {  {
1037    pcre_uchar *next_alt;    pcre_uchar *next_alt;
1038    
# Line 1097  static SLJIT_INLINE void detect_fast_fai Line 1097  static SLJIT_INLINE void detect_fast_fai
1097    
1098  static int get_class_iterator_size(pcre_uchar *cc)  static int get_class_iterator_size(pcre_uchar *cc)
1099  {  {
1100  sljit_ui min;  sljit_u32 min;
1101  sljit_ui max;  sljit_u32 max;
1102  switch(*cc)  switch(*cc)
1103    {    {
1104    case OP_CRSTAR:    case OP_CRSTAR:
# Line 2404  else Line 2404  else
2404  static SLJIT_INLINE void reset_fast_fail(compiler_common *common)  static SLJIT_INLINE void reset_fast_fail(compiler_common *common)
2405  {  {
2406  DEFINE_COMPILER;  DEFINE_COMPILER;
2407  sljit_si i;  sljit_s32 i;
2408    
2409  SLJIT_ASSERT(common->fast_fail_start_ptr < common->fast_fail_end_ptr);  SLJIT_ASSERT(common->fast_fail_start_ptr < common->fast_fail_end_ptr);
2410    
# Line 2485  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVE Line 2485  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVE
2485  OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
2486  if (common->mark_ptr != 0)  if (common->mark_ptr != 0)
2487    OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);    OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
2488  OP1(SLJIT_MOV_SI, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offset_count));  OP1(SLJIT_MOV_S32, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offset_count));
2489  if (common->mark_ptr != 0)  if (common->mark_ptr != 0)
2490    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);
2491  OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int));  OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int));
# Line 2500  OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, Line 2500  OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0,
2500  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2501  OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);  OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
2502  #endif  #endif
2503  OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_R2), sizeof(int), SLJIT_S1, 0);  OP1(SLJIT_MOVU_S32, SLJIT_MEM1(SLJIT_R2), sizeof(int), SLJIT_S1, 0);
2504  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
2505  JUMPTO(SLJIT_NOT_ZERO, loop);  JUMPTO(SLJIT_NOT_ZERO, loop);
2506  JUMPHERE(early_quit);  JUMPHERE(early_quit);
# Line 2533  SLJIT_ASSERT(common->start_used_ptr != 0 Line 2533  SLJIT_ASSERT(common->start_used_ptr != 0
2533    
2534  OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0);
2535  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_PARTIAL);  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_PARTIAL);
2536  OP1(SLJIT_MOV_SI, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, real_offset_count));  OP1(SLJIT_MOV_S32, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, real_offset_count));
2537  CMPTO(SLJIT_SIG_LESS, SLJIT_R2, 0, SLJIT_IMM, 2, quit);  CMPTO(SLJIT_SIG_LESS, SLJIT_R2, 0, SLJIT_IMM, 2, quit);
2538    
2539  /* Store match begin and end. */  /* Store match begin and end. */
# Line 2545  OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(S Line 2545  OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(S
2545  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2546  OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT);  OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT);
2547  #endif  #endif
2548  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_R1), 2 * sizeof(int), SLJIT_R2, 0);  OP1(SLJIT_MOV_S32, SLJIT_MEM1(SLJIT_R1), 2 * sizeof(int), SLJIT_R2, 0);
2549  JUMPHERE(jump);  JUMPHERE(jump);
2550    
2551  OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start);  OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start);
# Line 2553  OP2(SLJIT_SUB, SLJIT_S1, 0, STR_END, 0, Line 2553  OP2(SLJIT_SUB, SLJIT_S1, 0, STR_END, 0,
2553  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2554  OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);  OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
2555  #endif  #endif
2556  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_R1), sizeof(int), SLJIT_S1, 0);  OP1(SLJIT_MOV_S32, SLJIT_MEM1(SLJIT_R1), sizeof(int), SLJIT_S1, 0);
2557    
2558  OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_S0, 0);  OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_S0, 0);
2559  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2560  OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT);  OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT);
2561  #endif  #endif
2562  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_R1), 0, SLJIT_R2, 0);  OP1(SLJIT_MOV_S32, SLJIT_MEM1(SLJIT_R1), 0, SLJIT_R2, 0);
2563    
2564  JUMPTO(SLJIT_JUMP, quit);  JUMPTO(SLJIT_JUMP, quit);
2565  }  }
# Line 2796  else Line 2796  else
2796  JUMPHERE(jump);  JUMPHERE(jump);
2797  }  }
2798    
2799  static void peek_char(compiler_common *common, sljit_ui max)  static void peek_char(compiler_common *common, sljit_u32 max)
2800  {  {
2801  /* Reads the character into TMP1, keeps STR_PTR.  /* Reads the character into TMP1, keeps STR_PTR.
2802  Does not check STR_END. TMP2 Destroyed. */  Does not check STR_END. TMP2 Destroyed. */
# Line 2841  if (common->utf) Line 2841  if (common->utf)
2841    
2842  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
2843    
2844  static BOOL is_char7_bitset(const sljit_ub *bitset, BOOL nclass)  static BOOL is_char7_bitset(const sljit_u8 *bitset, BOOL nclass)
2845  {  {
2846  /* Tells whether the character codes below 128 are enough  /* Tells whether the character codes below 128 are enough
2847  to determine a match. */  to determine a match. */
2848  const sljit_ub value = nclass ? 0xff : 0;  const sljit_u8 value = nclass ? 0xff : 0;
2849  const sljit_ub *end = bitset + 32;  const sljit_u8 *end = bitset + 32;
2850    
2851  bitset += 16;  bitset += 16;
2852  do  do
# Line 2871  SLJIT_ASSERT(common->utf); Line 2871  SLJIT_ASSERT(common->utf);
2871  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
2872  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2873    
2874  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2875    
2876  if (full_read)  if (full_read)
2877    {    {
2878    jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
2879    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2880    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2881    JUMPHERE(jump);    JUMPHERE(jump);
2882    }    }
# Line 2884  if (full_read) Line 2884  if (full_read)
2884    
2885  #endif /* SUPPORT_UTF && COMPILE_PCRE8 */  #endif /* SUPPORT_UTF && COMPILE_PCRE8 */
2886    
2887  static void read_char_range(compiler_common *common, sljit_ui min, sljit_ui max, BOOL update_str_ptr)  static void read_char_range(compiler_common *common, sljit_u32 min, sljit_u32 max, BOOL update_str_ptr)
2888  {  {
2889  /* Reads the precise value of a character into TMP1, if the character is  /* Reads the precise value of a character into TMP1, if the character is
2890  between min and max (c >= min && c <= max). Otherwise it returns with a value  between min and max (c >= min && c <= max). Otherwise it returns with a value
# Line 2915  if (common->utf) Line 2915  if (common->utf)
2915      {      {
2916      OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xf0);      OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xf0);
2917      if (update_str_ptr)      if (update_str_ptr)
2918        OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);        OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2919      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2920      jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0x7);      jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0x7);
2921      OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);      OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
# Line 2939  if (common->utf) Line 2939  if (common->utf)
2939      {      {
2940      OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xe0);      OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xe0);
2941      if (update_str_ptr)      if (update_str_ptr)
2942        OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);        OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2943      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2944      jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xf);      jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xf);
2945      OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);      OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
# Line 2959  if (common->utf) Line 2959  if (common->utf)
2959      add_jump(compiler, (max < 0x10000) ? &common->utfreadchar16 : &common->utfreadchar, JUMP(SLJIT_FAST_CALL));      add_jump(compiler, (max < 0x10000) ? &common->utfreadchar16 : &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
2960    else if (max < 128)    else if (max < 128)
2961      {      {
2962      OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);      OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2963      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2964      }      }
2965    else    else
# Line 2968  if (common->utf) Line 2968  if (common->utf)
2968      if (!update_str_ptr)      if (!update_str_ptr)
2969        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2970      else      else
2971        OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);        OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2972      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
2973      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
2974      OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);      OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
# Line 3038  if (common->utf) Line 3038  if (common->utf)
3038    {    {
3039    /* This can be an extra read in some situations, but hopefully    /* This can be an extra read in some situations, but hopefully
3040    it is needed in most cases. */    it is needed in most cases. */
3041    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
3042    jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
3043    if (!update_str_ptr)    if (!update_str_ptr)
3044      {      {
# Line 3050  if (common->utf) Line 3050  if (common->utf)
3050      OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);      OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);
3051      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
3052      jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);      jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);
3053      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
3054      JUMPHERE(jump2);      JUMPHERE(jump2);
3055      }      }
3056    else    else
# Line 3065  if (common->utf) Line 3065  if (common->utf)
3065  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
3066  jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);  jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);
3067  #endif  #endif
3068  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
3069  #if !defined COMPILE_PCRE8  #if !defined COMPILE_PCRE8
3070  JUMPHERE(jump);  JUMPHERE(jump);
3071  #endif  #endif
# Line 3257  compare = CMP(SLJIT_GREATER, TMP2, 0, SL Line 3257  compare = CMP(SLJIT_GREATER, TMP2, 0, SL
3257  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
3258  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
3259  OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);  OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);
3260  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
3261  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
3262    
3263  JUMPHERE(compare);  JUMPHERE(compare);
# Line 3266  sljit_emit_fast_return(compiler, RETURN_ Line 3266  sljit_emit_fast_return(compiler, RETURN_
3266    
3267  /* We only have types for characters less than 256. */  /* We only have types for characters less than 256. */
3268  JUMPHERE(jump);  JUMPHERE(jump);
3269  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
3270  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
3271  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
3272  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 3292  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && si Line 3292  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && si
3292    
3293  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
3294  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
3295  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
3296  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
3297  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
3298  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
3299  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));
3300  OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);  OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
3301  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
3302  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
3303  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
3304  }  }
3305  #endif  #endif
# Line 3394  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 3394  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
3394  if (common->utf)  if (common->utf)
3395    {    {
3396    singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
3397    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
3398    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
3399    JUMPHERE(singlechar);    JUMPHERE(singlechar);
3400    }    }
# Line 3460  static int scan_prefix(compiler_common * Line 3460  static int scan_prefix(compiler_common *
3460  /* Recursive function, which scans prefix literals. */  /* Recursive function, which scans prefix literals. */
3461  BOOL last, any, class, caseless;  BOOL last, any, class, caseless;
3462  int len, repeat, len_save, consumed = 0;  int len, repeat, len_save, consumed = 0;
3463  sljit_ui chr;  sljit_u32 chr;
3464  sljit_ub *bytes, *bytes_end, byte;  sljit_u8 *bytes, *bytes_end, byte;
3465  pcre_uchar *alternative, *cc_save, *oc;  pcre_uchar *alternative, *cc_save, *oc;
3466  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
3467  pcre_uchar othercase[8];  pcre_uchar othercase[8];
# Line 3580  while (TRUE) Line 3580  while (TRUE)
3580    
3581      case OP_CLASS:      case OP_CLASS:
3582  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
3583      if (common->utf && !is_char7_bitset((const sljit_ub *)(cc + 1), FALSE))      if (common->utf && !is_char7_bitset((const sljit_u8 *)(cc + 1), FALSE))
3584        return consumed;        return consumed;
3585  #endif  #endif
3586      class = TRUE;      class = TRUE;
# Line 3605  while (TRUE) Line 3605  while (TRUE)
3605    
3606      case OP_DIGIT:      case OP_DIGIT:
3607  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
3608      if (common->utf && !is_char7_bitset((const sljit_ub *)common->ctypes - cbit_length + cbit_digit, FALSE))      if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_digit, FALSE))
3609        return consumed;        return consumed;
3610  #endif  #endif
3611      any = TRUE;      any = TRUE;
# Line 3614  while (TRUE) Line 3614  while (TRUE)
3614    
3615      case OP_WHITESPACE:      case OP_WHITESPACE:
3616  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
3617      if (common->utf && !is_char7_bitset((const sljit_ub *)common->ctypes - cbit_length + cbit_space, FALSE))      if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_space, FALSE))
3618        return consumed;        return consumed;
3619  #endif  #endif
3620      any = TRUE;      any = TRUE;
# Line 3623  while (TRUE) Line 3623  while (TRUE)
3623    
3624      case OP_WORDCHAR:      case OP_WORDCHAR:
3625  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
3626      if (common->utf && !is_char7_bitset((const sljit_ub *)common->ctypes - cbit_length + cbit_word, FALSE))      if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_word, FALSE))
3627        return consumed;        return consumed;
3628  #endif  #endif
3629      any = TRUE;      any = TRUE;
# Line 3695  while (TRUE) Line 3695  while (TRUE)
3695    
3696    if (class)    if (class)
3697      {      {
3698      bytes = (sljit_ub*) (cc + 1);      bytes = (sljit_u8*) (cc + 1);
3699      cc += 1 + 32 / sizeof(pcre_uchar);      cc += 1 + 32 / sizeof(pcre_uchar);
3700    
3701      switch (*cc)      switch (*cc)
# Line 3855  while (TRUE) Line 3855  while (TRUE)
3855    
3856  #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)  #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
3857    
3858  static sljit_si character_to_int32(pcre_uchar chr)  static sljit_s32 character_to_int32(pcre_uchar chr)
3859  {  {
3860  sljit_si value = (sljit_si)chr;  sljit_s32 value = (sljit_s32)chr;
3861  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
3862  #define SSE2_COMPARE_TYPE_INDEX 0  #define SSE2_COMPARE_TYPE_INDEX 0
3863  return (value << 24) | (value << 16) | (value << 8) | value;  return (value << 24) | (value << 16) | (value << 8) | value;
# Line 3878  DEFINE_COMPILER; Line 3878  DEFINE_COMPILER;
3878  struct sljit_label *start;  struct sljit_label *start;
3879  struct sljit_jump *quit[3];  struct sljit_jump *quit[3];
3880  struct sljit_jump *nomatch;  struct sljit_jump *nomatch;
3881  sljit_ub instruction[8];  sljit_u8 instruction[8];
3882  sljit_si tmp1_ind = sljit_get_register_index(TMP1);  sljit_s32 tmp1_ind = sljit_get_register_index(TMP1);
3883  sljit_si tmp2_ind = sljit_get_register_index(TMP2);  sljit_s32 tmp2_ind = sljit_get_register_index(TMP2);
3884  sljit_si str_ptr_ind = sljit_get_register_index(STR_PTR);  sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR);
3885  BOOL load_twice = FALSE;  BOOL load_twice = FALSE;
3886  pcre_uchar bit;  pcre_uchar bit;
3887    
# Line 4134  SET_LABEL(quit[2], start); Line 4134  SET_LABEL(quit[2], start);
4134    
4135  #endif  #endif
4136    
4137  static void fast_forward_first_char2(compiler_common *common, pcre_uchar char1, pcre_uchar char2, sljit_si offset)  static void fast_forward_first_char2(compiler_common *common, pcre_uchar char1, pcre_uchar char2, sljit_s32 offset)
4138  {  {
4139  DEFINE_COMPILER;  DEFINE_COMPILER;
4140  struct sljit_label *start;  struct sljit_label *start;
# Line 4311  struct sljit_jump *match; Line 4311  struct sljit_jump *match;
4311  /* bytes[0] represent the number of characters between 0  /* bytes[0] represent the number of characters between 0
4312  and MAX_N_BYTES - 1, 255 represents any character. */  and MAX_N_BYTES - 1, 255 represents any character. */
4313  pcre_uchar chars[MAX_N_CHARS * MAX_DIFF_CHARS];  pcre_uchar chars[MAX_N_CHARS * MAX_DIFF_CHARS];
4314  sljit_si offset;  sljit_s32 offset;
4315  pcre_uchar mask;  pcre_uchar mask;
4316  pcre_uchar *char_set, *char_set_end;  pcre_uchar *char_set, *char_set_end;
4317  int i, max, from;  int i, max, from;
4318  int range_right = -1, range_len;  int range_right = -1, range_len;
4319  sljit_ub *update_table = NULL;  sljit_u8 *update_table = NULL;
4320  BOOL in_range;  BOOL in_range;
4321  sljit_ui rec_count;  sljit_u32 rec_count;
4322    
4323  for (i = 0; i < MAX_N_CHARS; i++)  for (i = 0; i < MAX_N_CHARS; i++)
4324    chars[i * MAX_DIFF_CHARS] = 0;    chars[i * MAX_DIFF_CHARS] = 0;
# Line 4356  for (i = 0; i <= max; i++) Line 4356  for (i = 0; i <= max; i++)
4356    
4357  if (range_right >= 0)  if (range_right >= 0)
4358    {    {
4359    update_table = (sljit_ub *)allocate_read_only_data(common, 256);    update_table = (sljit_u8 *)allocate_read_only_data(common, 256);
4360    if (update_table == NULL)    if (update_table == NULL)
4361      return TRUE;      return TRUE;
4362    memset(update_table, IN_UCHARS(range_len), 256);    memset(update_table, IN_UCHARS(range_len), 256);
# Line 4442  start = LABEL(); Line 4442  start = LABEL();
4442  quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);  quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
4443    
4444  #if defined COMPILE_PCRE8 || (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)  #if defined COMPILE_PCRE8 || (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
4445  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right));  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right));
4446  #else  #else
4447  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1);
4448  #endif  #endif
4449    
4450  #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
4451  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0);
4452  #else  #else
4453  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);
4454  #endif  #endif
4455  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
4456  CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start);  CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start);
# Line 4634  if (common->match_end_ptr != 0) Line 4634  if (common->match_end_ptr != 0)
4634    
4635  static BOOL check_class_ranges(compiler_common *common, const pcre_uint8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks);  static BOOL check_class_ranges(compiler_common *common, const pcre_uint8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks);
4636    
4637  static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common, sljit_ub *start_bits)  static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common, sljit_u8 *start_bits)
4638  {  {
4639  DEFINE_COMPILER;  DEFINE_COMPILER;
4640  struct sljit_label *start;  struct sljit_label *start;
# Line 4668  if (!check_class_ranges(common, start_bi Line 4668  if (!check_class_ranges(common, start_bi
4668  #endif  #endif
4669    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
4670    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
4671    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
4672    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
4673    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
4674    found = JUMP(SLJIT_NOT_ZERO);    found = JUMP(SLJIT_NOT_ZERO);
# Line 4684  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 4684  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
4684  if (common->utf)  if (common->utf)
4685    {    {
4686    CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
4687    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
4688    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
4689    }    }
4690  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
# Line 4856  else Line 4856  else
4856    if (common->utf)    if (common->utf)
4857      jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
4858  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE8 */
4859    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);
4860    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */);
4861    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
4862    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0);
# Line 4901  else Line 4901  else
4901    if (common->utf)    if (common->utf)
4902      jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
4903  #endif  #endif
4904    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);
4905    OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);    OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);
4906    OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);    OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
4907  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
# Line 5216  OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR Line 5216  OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR
5216  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
5217  jump = CMP(SLJIT_GREATER, CHAR1, 0, SLJIT_IMM, 255);  jump = CMP(SLJIT_GREATER, CHAR1, 0, SLJIT_IMM, 255);
5218  #endif  #endif
5219  OP1(SLJIT_MOV_UB, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);  OP1(SLJIT_MOV_U8, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
5220  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
5221  JUMPHERE(jump);  JUMPHERE(jump);
5222  jump = CMP(SLJIT_GREATER, CHAR2, 0, SLJIT_IMM, 255);  jump = CMP(SLJIT_GREATER, CHAR2, 0, SLJIT_IMM, 255);
5223  #endif  #endif
5224  OP1(SLJIT_MOV_UB, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);  OP1(SLJIT_MOV_U8, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
5225  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
5226  JUMPHERE(jump);  JUMPHERE(jump);
5227  #endif  #endif
# Line 5310  if (context->sourcereg == -1) Line 5310  if (context->sourcereg == -1)
5310  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
5311  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
5312    if (context->length >= 4)    if (context->length >= 4)
5313      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_S32, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
5314    else if (context->length >= 2)    else if (context->length >= 2)
5315      OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_U16, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
5316    else    else
5317  #endif  #endif
5318      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
5319  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
5320  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
5321    if (context->length >= 4)    if (context->length >= 4)
5322      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_S32, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
5323    else    else
5324  #endif  #endif
5325      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
# Line 5361  do Line 5361  do
5361  #endif  #endif
5362      {      {
5363      if (context->length >= 4)      if (context->length >= 4)
5364        OP1(SLJIT_MOV_SI, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_S32, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
5365      else if (context->length >= 2)      else if (context->length >= 2)
5366        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_U16, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
5367  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
5368      else if (context->length >= 1)      else if (context->length >= 1)
5369        OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_U8, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
5370  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE8 */
5371      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
5372    
# Line 5468  BOOL utf = common->utf; Line 5468  BOOL utf = common->utf;
5468  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
5469  BOOL charsaved = FALSE;  BOOL charsaved = FALSE;
5470  int typereg = TMP1;  int typereg = TMP1;
5471  const sljit_ui *other_cases;  const sljit_u32 *other_cases;
5472  sljit_uw typeoffset;  sljit_uw typeoffset;
5473  #endif  #endif
5474    
# Line 5585  if ((cc[-1] & XCL_HASPROP) == 0) Line 5585  if ((cc[-1] & XCL_HASPROP) == 0)
5585    if ((cc[-1] & XCL_MAP) != 0)    if ((cc[-1] & XCL_MAP) != 0)
5586      {      {
5587      jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
5588      if (!check_class_ranges(common, (const sljit_ub *)cc, (((const sljit_ub *)cc)[31] & 0x80) != 0, TRUE, &found))      if (!check_class_ranges(common, (const sljit_u8 *)cc, (((const sljit_u8 *)cc)[31] & 0x80) != 0, TRUE, &found))
5589        {        {
5590        OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);        OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
5591        OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);        OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
5592        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);        OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
5593        OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);        OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
5594        OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);        OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
5595        add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));        add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));
# Line 5622  else if ((cc[-1] & XCL_MAP) != 0) Line 5622  else if ((cc[-1] & XCL_MAP) != 0)
5622    
5623      OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);      OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
5624      OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);      OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
5625      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
5626      OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);      OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
5627      OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);      OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
5628      add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));      add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
# Line 5644  if (needstype || needsscript) Line 5644  if (needstype || needsscript)
5644      OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);      OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
5645    
5646    OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);    OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
5647    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
5648    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
5649    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
5650    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
5651    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));
5652    OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);    OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
5653    
5654    /* Before anything else, we deal with scripts. */    /* Before anything else, we deal with scripts. */
5655    if (needsscript)    if (needsscript)
5656      {      {
5657      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, script));      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, script));
5658      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
5659    
5660      ccbegin = cc;      ccbegin = cc;
5661    
# Line 5702  if (needstype || needsscript) Line 5702  if (needstype || needsscript)
5702      if (!needschar)      if (!needschar)
5703        {        {
5704        OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));        OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
5705        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);        OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
5706        }        }
5707      else      else
5708        {        {
5709        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
5710        OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));        OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
5711        typereg = RETURN_ADDR;        typereg = RETURN_ADDR;
5712        }        }
5713      }      }
# Line 6104  switch(type) Line 6104  switch(type)
6104    
6105    case OP_DOLL:    case OP_DOLL:
6106    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
6107    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, noteol));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, noteol));
6108    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
6109    
6110    if (!common->endonly)    if (!common->endonly)
# Line 6119  switch(type) Line 6119  switch(type)
6119    case OP_DOLLM:    case OP_DOLLM:
6120    jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);    jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
6121    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
6122    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, noteol));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, noteol));
6123    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
6124    check_partial(common, FALSE);    check_partial(common, FALSE);
6125    jump[0] = JUMP(SLJIT_JUMP);    jump[0] = JUMP(SLJIT_JUMP);
# Line 6157  switch(type) Line 6157  switch(type)
6157    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
6158    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
6159    add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));    add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
6160    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, notbol));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, notbol));
6161    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
6162    return cc;    return cc;
6163    
# Line 6165  switch(type) Line 6165  switch(type)
6165    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
6166    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
6167    jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0);    jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0);
6168    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, notbol));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, notbol));
6169    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
6170    jump[0] = JUMP(SLJIT_JUMP);    jump[0] = JUMP(SLJIT_JUMP);
6171    JUMPHERE(jump[1]);    JUMPHERE(jump[1]);
# Line 6313  switch(type) Line 6313  switch(type)
6313  #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16  #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
6314  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
6315      jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);      jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
6316      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
6317      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
6318  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
6319      jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);      jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
# Line 6402  switch(type) Line 6402  switch(type)
6402    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
6403    /* Optimize register allocation: use a real register. */    /* Optimize register allocation: use a real register. */
6404    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
6405    OP1(SLJIT_MOV_UB, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);    OP1(SLJIT_MOV_U8, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);
6406    
6407    label = LABEL();    label = LABEL();
6408    jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
# Line 6410  switch(type) Line 6410  switch(type)
6410    read_char(common);    read_char(common);
6411    add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
6412    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
6413    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM2(TMP1, TMP2), 3);    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM2(TMP1, TMP2), 3);
6414    
6415    OP2(SLJIT_SHL, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2);    OP2(SLJIT_SHL, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2);
6416    OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));    OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));
6417    OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);    OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
6418    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
6419    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
# Line 6495  switch(type) Line 6495  switch(type)
6495      c = *cc;      c = *cc;
6496      if (c < 128)      if (c < 128)
6497        {        {
6498        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);        OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
6499        if (type == OP_NOT || !char_has_othercase(common, cc))        if (type == OP_NOT || !char_has_othercase(common, cc))
6500          add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c));          add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c));
6501        else        else
# Line 6551  switch(type) Line 6551  switch(type)
6551      detect_partial_match(common, backtracks);      detect_partial_match(common, backtracks);
6552    
6553  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
6554    bit = (common->utf && is_char7_bitset((const sljit_ub *)cc, type == OP_NCLASS)) ? 127 : 255;    bit = (common->utf && is_char7_bitset((const sljit_u8 *)cc, type == OP_NCLASS)) ? 127 : 255;
6555    read_char_range(common, 0, bit, type == OP_NCLASS);    read_char_range(common, 0, bit, type == OP_NCLASS);
6556  #else  #else
6557    read_char_range(common, 0, 255, type == OP_NCLASS);    read_char_range(common, 0, 255, type == OP_NCLASS);
6558  #endif  #endif
6559    
6560    if (check_class_ranges(common, (const sljit_ub *)cc, type == OP_NCLASS, FALSE, backtracks))    if (check_class_ranges(common, (const sljit_u8 *)cc, type == OP_NCLASS, FALSE, backtracks))
6561      return cc + 32 / sizeof(pcre_uchar);      return cc + 32 / sizeof(pcre_uchar);
6562    
6563  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
# Line 6582  switch(type) Line 6582  switch(type)
6582    
6583    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
6584    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
6585    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
6586    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
6587    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
6588    add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));    add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
# Line 7168  allocate_stack(common, CALLOUT_ARG_SIZE Line 7168  allocate_stack(common, CALLOUT_ARG_SIZE
7168  SLJIT_ASSERT(common->capture_last_ptr != 0);  SLJIT_ASSERT(common->capture_last_ptr != 0);
7169  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
7170  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
7171  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, cc[1]);  OP1(SLJIT_MOV_S32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, cc[1]);
7172  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);  OP1(SLJIT_MOV_S32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);
7173    
7174  /* These pointer sized fields temporarly stores internal variables. */  /* These pointer sized fields temporarly stores internal variables. */
7175  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
# Line 7178  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CA Line 7178  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CA
7178    
7179  if (common->mark_ptr != 0)  if (common->mark_ptr != 0)
7180    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr));    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr));
7181  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(pattern_position), SLJIT_IMM, GET(cc, 2));  OP1(SLJIT_MOV_S32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(pattern_position), SLJIT_IMM, GET(cc, 2));
7182  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(next_item_length), SLJIT_IMM, GET(cc, 2 + LINK_SIZE));  OP1(SLJIT_MOV_S32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(next_item_length), SLJIT_IMM, GET(cc, 2 + LINK_SIZE));
7183  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_ptr != 0) ? TMP2 : SLJIT_IMM, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_ptr != 0) ? TMP2 : SLJIT_IMM, 0);
7184    
7185  /* Needed to save important temporary registers. */  /* Needed to save important temporary registers. */
# Line 7187  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOC Line 7187  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOC
7187  OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE);  OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE);
7188  GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);  GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
7189  sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));  sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
7190  OP1(SLJIT_MOV_SI, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);  OP1(SLJIT_MOV_S32, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
7191  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
7192  free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));  free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
7193    
# Line 8606  count_match(common); Line 8606  count_match(common);
8606  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
8607  }  }
8608    
8609  static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, sljit_ui *max, sljit_ui *exact, pcre_uchar **end)  static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, sljit_u32 *max, sljit_u32 *exact, pcre_uchar **end)
8610  {  {
8611  int class_len;  int class_len;
8612    
# Line 8757  DEFINE_COMPILER; Line 8757  DEFINE_COMPILER;
8757  backtrack_common *backtrack;  backtrack_common *backtrack;
8758  pcre_uchar opcode;  pcre_uchar opcode;
8759  pcre_uchar type;  pcre_uchar type;
8760  sljit_ui max = 0, exact;  sljit_u32 max = 0, exact;
8761  BOOL fast_fail;  BOOL fast_fail;
8762  sljit_si fast_str_ptr;  sljit_s32 fast_str_ptr;
8763  BOOL charpos_enabled;  BOOL charpos_enabled;
8764  pcre_uchar charpos_char;  pcre_uchar charpos_char;
8765  unsigned int charpos_othercasebit;  unsigned int charpos_othercasebit;
# Line 9174  if (common->accept_label == NULL) Line 9174  if (common->accept_label == NULL)
9174  else  else
9175    CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);    CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);
9176  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
9177  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty));  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty));
9178  add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));  add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
9179  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty_atstart));  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty_atstart));
9180  if (common->accept_label == NULL)  if (common->accept_label == NULL)
9181    add_jump(compiler, &common->accept, CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0));    add_jump(compiler, &common->accept, CMP(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0));
9182  else  else
# Line 9604  DEFINE_COMPILER; Line 9604  DEFINE_COMPILER;
9604  pcre_uchar *cc = current->cc;  pcre_uchar *cc = current->cc;
9605  pcre_uchar opcode;  pcre_uchar opcode;
9606  pcre_uchar type;  pcre_uchar type;
9607  sljit_ui max = 0, exact;  sljit_u32 max = 0, exact;
9608  struct sljit_label *label = NULL;  struct sljit_label *label = NULL;
9609  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
9610  jump_list *jumplist = NULL;  jump_list *jumplist = NULL;
# Line 10965  SLJIT_ASSERT(!(common->req_char_ptr != 0 Line 10965  SLJIT_ASSERT(!(common->req_char_ptr != 0
10965  common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);  common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);
10966    
10967  total_length = ccend - common->start;  total_length = ccend - common->start;
10968  common->private_data_ptrs = (sljit_si *)SLJIT_MALLOC(total_length * (sizeof(sljit_si) + (common->has_then ? 1 : 0)), compiler->allocator_data);  common->private_data_ptrs = (sljit_s32 *)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), compiler->allocator_data);
10969  if (!common->private_data_ptrs)  if (!common->private_data_ptrs)
10970    {    {
10971    SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);    SLJIT_FREE(common->optimized_cbracket, compiler->allocator_data);
10972    return;    return;
10973    }    }
10974  memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_si));  memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_s32));
10975    
10976  private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw);  private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw);
10977  set_private_data_ptrs(common, &private_data_size, ccend);  set_private_data_ptrs(common, &private_data_size, ccend);
# Line 11019  OP1(SLJIT_MOV, TMP1, 0, SLJIT_S0, 0); Line 11019  OP1(SLJIT_MOV, TMP1, 0, SLJIT_S0, 0);
11019  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
11020  OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));  OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));
11021  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
11022  OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));  OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
11023  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base));  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base));
11024  OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit));  OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit));
11025  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
# Line 11189  if (common->might_be_empty) Line 11189  if (common->might_be_empty)
11189    {    {
11190    JUMPHERE(empty_match);    JUMPHERE(empty_match);
11191    OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
11192    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty));
11193    CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_backtrack_label);    CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_backtrack_label);
11194    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty_atstart));    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty_atstart));
11195    CMPTO(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_found_label);    CMPTO(SLJIT_EQUAL, TMP2, 0, SLJIT_IMM, 0, empty_match_found_label);
11196    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
11197    CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, empty_match_found_label);    CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, empty_match_found_label);

Legend:
Removed from v.1634  
changed lines
  Added in v.1640

  ViewVC Help
Powered by ViewVC 1.1.5