/[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 1423 by zherczeg, Tue Dec 31 07:57:56 2013 UTC revision 1426 by zherczeg, Wed Jan 1 13:14:19 2014 UTC
# Line 364  typedef struct compiler_common { Line 364  typedef struct compiler_common {
364    /* Newline control. */    /* Newline control. */
365    int nltype;    int nltype;
366    pcre_uint32 nlmax;    pcre_uint32 nlmax;
367      pcre_uint32 nlmin;
368    int newline;    int newline;
369    int bsr_nltype;    int bsr_nltype;
370    pcre_uint32 bsr_nlmax;    pcre_uint32 bsr_nlmax;
371      pcre_uint32 bsr_nlmin;
372    /* Dollar endonly. */    /* Dollar endonly. */
373    int endonly;    int endonly;
374    /* Tables. */    /* Tables. */
# Line 524  the start pointers when the end of the c Line 526  the start pointers when the end of the c
526  #define GET_LOCAL_BASE(dst, dstw, offset) \  #define GET_LOCAL_BASE(dst, dstw, offset) \
527    sljit_get_local_base(compiler, (dst), (dstw), (offset))    sljit_get_local_base(compiler, (dst), (dstw), (offset))
528    
529  #define READ_CHAR_ANY 0x7fffffff  #define READ_CHAR_MAX 0x7fffffff
530    
531  static pcre_uchar* bracketend(pcre_uchar* cc)  static pcre_uchar* bracketend(pcre_uchar* cc)
532  {  {
# Line 2464  else Line 2466  else
2466  JUMPHERE(jump);  JUMPHERE(jump);
2467  }  }
2468    
2469  static void peek_char(compiler_common *common)  static void peek_char(compiler_common *common, pcre_uint32 max)
2470  {  {
2471  /* Reads the character into TMP1, keeps STR_PTR.  /* Reads the character into TMP1, keeps STR_PTR.
2472  Does not check STR_END. TMP2 Destroyed. */  Does not check STR_END. TMP2 Destroyed. */
# Line 2473  DEFINE_COMPILER; Line 2475  DEFINE_COMPILER;
2475  struct sljit_jump *jump;  struct sljit_jump *jump;
2476  #endif  #endif
2477    
2478    SLJIT_UNUSED_ARG(max);
2479    
2480  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2481  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
2482  if (common->utf)  if (common->utf)
2483    {    {
2484      if (max < 128) return;
2485    
2486    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2487    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));
2488    add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
# Line 2488  if (common->utf) Line 2494  if (common->utf)
2494  #if defined SUPPORT_UTF && defined COMPILE_PCRE16  #if defined SUPPORT_UTF && defined COMPILE_PCRE16
2495  if (common->utf)  if (common->utf)
2496    {    {
2497      if (max < 0xd800) return;
2498    
2499    OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);    OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
2500    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
2501    /* TMP2 contains the high surrogate. */    /* TMP2 contains the high surrogate. */
# Line 2546  if (full_read) Line 2554  if (full_read)
2554    
2555  #endif /* SUPPORT_UTF && COMPILE_PCRE8 */  #endif /* SUPPORT_UTF && COMPILE_PCRE8 */
2556    
2557  static void read_char_max(compiler_common *common, pcre_uint32 max, BOOL full_read)  static void read_char_range(compiler_common *common, pcre_uint32 min, pcre_uint32 max, BOOL update_str_ptr)
2558  {  {
2559  /* 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
2560  less than or equal to max. Otherwise it returns with a value greater than max.  between min and max (c >= min && c <= max). Otherwise it returns with a value
2561  Does not check STR_END. The full_read argument tells whether characters above  outside the range. Does not check STR_END. */
 max are accepted or not. */  
2562  DEFINE_COMPILER;  DEFINE_COMPILER;
2563  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2564  struct sljit_jump *jump;  struct sljit_jump *jump;
2565  #endif  #endif
2566    
2567  SLJIT_UNUSED_ARG(full_read);  SLJIT_UNUSED_ARG(update_str_ptr);
2568    SLJIT_UNUSED_ARG(min);
2569  SLJIT_UNUSED_ARG(max);  SLJIT_UNUSED_ARG(max);
2570    SLJIT_ASSERT(min <= max);
2571    
2572  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2573  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));
# Line 2566  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 2575  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
2575  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
2576  if (common->utf)  if (common->utf)
2577    {    {
2578    if (max < 128 && !full_read)    if (max < 128 && !update_str_ptr) return;
     return;  
2579    
2580    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2581    if (max >= 0x800)    if (max >= 0x800)
# Line 2580  if (common->utf) Line 2588  if (common->utf)
2588    else    else
2589      {      {
2590      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2591      if (!full_read)      if (!update_str_ptr)
2592        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));
2593      else      else
2594        OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);        OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
# Line 2588  if (common->utf) Line 2596  if (common->utf)
2596      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
2597      OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);      OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
2598      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2599      if (full_read)      if (update_str_ptr)
2600        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, RETURN_ADDR, 0);        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, RETURN_ADDR, 0);
2601      }      }
2602    JUMPHERE(jump);    JUMPHERE(jump);
# Line 2613  if (common->utf) Line 2621  if (common->utf)
2621      return;      return;
2622      }      }
2623    
2624    if (max < 0xd800 && !full_read)    if (max < 0xd800 && !update_str_ptr) return;
     return;  
2625    
2626    /* Skip low surrogate if necessary. */    /* Skip low surrogate if necessary. */
2627    OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);    OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
2628    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xdc00 - 0xd800 - 1);
2629    if (full_read)    if (update_str_ptr)
2630      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));
2631    if (max >= 0xd800)    if (max >= 0xd800)
2632      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0x10000);      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0x10000);
# Line 2630  if (common->utf) Line 2637  if (common->utf)
2637    
2638  static SLJIT_INLINE void read_char(compiler_common *common)  static SLJIT_INLINE void read_char(compiler_common *common)
2639  {  {
2640  read_char_max(common, READ_CHAR_ANY, TRUE);  read_char_range(common, 0, READ_CHAR_MAX, TRUE);
2641  }  }
2642    
2643  static void read_char8_type(compiler_common *common, BOOL full_read)  static void read_char8_type(compiler_common *common, BOOL update_str_ptr)
2644  {  {
2645  /* Reads the character type into TMP1, updates STR_PTR. Does not check STR_END.  /* Reads the character type into TMP1, updates STR_PTR. Does not check STR_END. */
 The full_read argument tells whether characters above max are accepted or not. */  
2646  DEFINE_COMPILER;  DEFINE_COMPILER;
2647  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
2648  struct sljit_jump *jump;  struct sljit_jump *jump;
# Line 2645  struct sljit_jump *jump; Line 2651  struct sljit_jump *jump;
2651  struct sljit_jump *jump2;  struct sljit_jump *jump2;
2652  #endif  #endif
2653    
2654  SLJIT_UNUSED_ARG(full_read);  SLJIT_UNUSED_ARG(update_str_ptr);
2655    
2656  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
2657  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));
# Line 2657  if (common->utf) Line 2663  if (common->utf)
2663    it is needed in most cases. */    it is needed in most cases. */
2664    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2665    jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
2666    if (!full_read)    if (!update_str_ptr)
2667      {      {
2668      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2669      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));
# Line 2688  JUMPHERE(jump); Line 2694  JUMPHERE(jump);
2694  #endif  #endif
2695    
2696  #if defined SUPPORT_UTF && defined COMPILE_PCRE16  #if defined SUPPORT_UTF && defined COMPILE_PCRE16
2697  if (common->utf && full_read)  if (common->utf && update_str_ptr)
2698    {    {
2699    /* Skip low surrogate if necessary. */    /* Skip low surrogate if necessary. */
2700    OP2(SLJIT_SUB, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xd800);    OP2(SLJIT_SUB, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xd800);
# Line 2964  if (firstline) Line 2970  if (firstline)
2970      mainloop = LABEL();      mainloop = LABEL();
2971      /* Continual stores does not cause data dependency. */      /* Continual stores does not cause data dependency. */
2972      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, STR_PTR, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, STR_PTR, 0);
2973      read_char_max(common, common->nlmax, TRUE);      read_char_range(common, common->nlmin, common->nlmax, TRUE);
2974      check_newlinechar(common, common->nltype, &newline, TRUE);      check_newlinechar(common, common->nltype, &newline, TRUE);
2975      CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, mainloop);      CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, mainloop);
2976      JUMPHERE(end);      JUMPHERE(end);
# Line 3234  while (TRUE) Line 3240  while (TRUE)
3240          return consumed;          return consumed;
3241  #endif  #endif
3242        mask = 0;        mask = 0;
3243        if (len == (caseless & 0xff))        if ((pcre_uint32)len == (caseless & 0xff))
3244          {          {
3245          mask = caseless >> 8;          mask = caseless >> 8;
3246          chr |= mask;          chr |= mask;
# Line 3532  firstchar = CMP(SLJIT_C_LESS_EQUAL, STR_ Line 3538  firstchar = CMP(SLJIT_C_LESS_EQUAL, STR_
3538  skip_char_back(common);  skip_char_back(common);
3539    
3540  loop = LABEL();  loop = LABEL();
3541  read_char_max(common, common->nlmax, TRUE);  read_char_range(common, common->nlmin, common->nlmax, TRUE);
3542  lastchar = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);  lastchar = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
3543  if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)  if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
3544    foundcr = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);    foundcr = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
# Line 3801  JUMPHERE(skipread); Line 3807  JUMPHERE(skipread);
3807    
3808  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
3809  check_str_end(common, &skipread_list);  check_str_end(common, &skipread_list);
3810  peek_char(common);  peek_char(common, READ_CHAR_MAX);
3811    
3812  /* Testing char type. This is a code duplication. */  /* Testing char type. This is a code duplication. */
3813  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 4360  return cc; Line 4366  return cc;
4366  #define SET_TYPE_OFFSET(value) \  #define SET_TYPE_OFFSET(value) \
4367    if ((value) != typeoffset) \    if ((value) != typeoffset) \
4368      { \      { \
4369      if ((value) > typeoffset) \      if ((value) < typeoffset) \
       OP2(SLJIT_SUB, typereg, 0, typereg, 0, SLJIT_IMM, (value) - typeoffset); \  
     else \  
4370        OP2(SLJIT_ADD, typereg, 0, typereg, 0, SLJIT_IMM, typeoffset - (value)); \        OP2(SLJIT_ADD, typereg, 0, typereg, 0, SLJIT_IMM, typeoffset - (value)); \
4371        else \
4372          OP2(SLJIT_SUB, typereg, 0, typereg, 0, SLJIT_IMM, (value) - typeoffset); \
4373      } \      } \
4374    typeoffset = (value);    typeoffset = (value);
4375    
4376  #define SET_CHAR_OFFSET(value) \  #define SET_CHAR_OFFSET(value) \
4377    if ((value) != charoffset) \    if ((value) != charoffset) \
4378      { \      { \
4379      if ((value) > charoffset) \      if ((value) < charoffset) \
4380        OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, (value) - charoffset); \        OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(charoffset - (value))); \
4381      else \      else \
4382        OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, charoffset - (value)); \        OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)((value) - charoffset)); \
4383      } \      } \
4384    charoffset = (value);    charoffset = (value);
4385    
# Line 4382  static void compile_xclass_matchingpath( Line 4388  static void compile_xclass_matchingpath(
4388  DEFINE_COMPILER;  DEFINE_COMPILER;
4389  jump_list *found = NULL;  jump_list *found = NULL;
4390  jump_list **list = (cc[0] & XCL_NOT) == 0 ? &found : backtracks;  jump_list **list = (cc[0] & XCL_NOT) == 0 ? &found : backtracks;
4391  pcre_int32 c, charoffset;  sljit_uw c, charoffset, max = 256, min = READ_CHAR_MAX;
4392  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
4393  pcre_uchar *ccbegin;  pcre_uchar *ccbegin;
4394  int compares, invertcmp, numberofcmps;  int compares, invertcmp, numberofcmps;
4395    #if defined SUPPORT_UTF && (defined COMPILE_PCRE8 || defined COMPILE_PCRE16)
4396    BOOL utf = common->utf;
4397    #endif
4398    
4399  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4400  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
4401  BOOL charsaved = FALSE;  BOOL charsaved = FALSE;
4402  int typereg = TMP1, scriptreg = TMP1;  int typereg = TMP1, scriptreg = TMP1;
4403  const pcre_uint32 *other_cases;  const pcre_uint32 *other_cases;
4404  pcre_int32 typeoffset;  sljit_uw typeoffset;
4405  #endif  #endif
4406    
4407  /* Although SUPPORT_UTF must be defined, we are  /* Scanning the necessary info. */
    not necessary in utf mode even in 8 bit mode. */  
 detect_partial_match(common, backtracks);  
 read_char(common);  
   
4408  cc++;  cc++;
4409  if ((cc[-1] & XCL_HASPROP) == 0)  ccbegin = cc;
4410    {  compares = 0;
4411    if ((cc[-1] & XCL_MAP) != 0)  if (cc[-1] & XCL_MAP)
     {  
     OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);  
 #ifdef SUPPORT_UCP  
     charsaved = TRUE;  
 #endif  
     if (!check_class_ranges(common, (const pcre_uint8 *)cc, TRUE, FALSE, backtracks))  
       {  
       jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);  
   
       OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);  
       OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);  
       OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);  
       OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);  
       OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);  
       add_jump(compiler, &found, JUMP(SLJIT_C_NOT_ZERO));  
       add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));  
   
       JUMPHERE(jump);  
       }  
     else  
       add_jump(compiler, &found, CMP(SLJIT_C_LESS_EQUAL, TMP3, 0, SLJIT_IMM, 0xff));  
   
     OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);  
     cc += 32 / sizeof(pcre_uchar);  
     }  
   else  
     add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, 0xff));  
   }  
 else if ((cc[-1] & XCL_MAP) != 0)  
4412    {    {
4413    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);    min = 0;
 #ifdef SUPPORT_UCP  
   charsaved = TRUE;  
 #endif  
   if (!check_class_ranges(common, (const pcre_uint8 *)cc, FALSE, TRUE, list))  
     {  
 #ifdef COMPILE_PCRE8  
     SLJIT_ASSERT(common->utf);  
 #endif  
     jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);  
   
     OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);  
     OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);  
     OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);  
     OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);  
     OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);  
     add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));  
   
     JUMPHERE(jump);  
     }  
   
   OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);  
4414    cc += 32 / sizeof(pcre_uchar);    cc += 32 / sizeof(pcre_uchar);
4415    }    }
4416    
 /* Scanning the necessary info. */  
 ccbegin = cc;  
 compares = 0;  
4417  while (*cc != XCL_END)  while (*cc != XCL_END)
4418    {    {
4419    compares++;    compares++;
4420    if (*cc == XCL_SINGLE)    if (*cc == XCL_SINGLE)
4421      {      {
4422      cc += 2;      cc ++;
4423  #ifdef SUPPORT_UTF      GETCHARINCTEST(c, cc);
4424      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (c > max) max = c;
4425  #endif      if (c < min) min = c;
4426  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4427      needschar = TRUE;      needschar = TRUE;
4428  #endif  #endif
4429      }      }
4430    else if (*cc == XCL_RANGE)    else if (*cc == XCL_RANGE)
4431      {      {
4432      cc += 2;      cc ++;
4433  #ifdef SUPPORT_UTF      GETCHARINCTEST(c, cc);
4434      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (c < min) min = c;
4435  #endif      GETCHARINCTEST(c, cc);
4436      cc++;      if (c > max) max = c;
 #ifdef SUPPORT_UTF  
     if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);  
 #endif  
4437  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4438      needschar = TRUE;      needschar = TRUE;
4439  #endif  #endif
# Line 4494  while (*cc != XCL_END) Line 4443  while (*cc != XCL_END)
4443      {      {
4444      SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);      SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);
4445      cc++;      cc++;
4446        if (*cc == PT_CLIST)
4447          {
4448          other_cases = PRIV(ucd_caseless_sets) + cc[1];
4449          while (*other_cases != NOTACHAR)
4450            {
4451            if (*other_cases > max) max = *other_cases;
4452            if (*other_cases < min) min = *other_cases;
4453            other_cases++;
4454            }
4455          }
4456        else
4457          {
4458          max = READ_CHAR_MAX;
4459          min = 0;
4460          }
4461    
4462      switch(*cc)      switch(*cc)
4463        {        {
4464        case PT_ANY:        case PT_ANY:
# Line 4534  while (*cc != XCL_END) Line 4499  while (*cc != XCL_END)
4499  #endif  #endif
4500    }    }
4501    
4502    /* We are not necessary in utf mode even in 8 bit mode. */
4503    cc = ccbegin;
4504    detect_partial_match(common, backtracks);
4505    read_char_range(common, min, max, (cc[0] & XCL_NOT) != 0);
4506    
4507    if ((cc[-1] & XCL_HASPROP) == 0)
4508      {
4509      if ((cc[-1] & XCL_MAP) != 0)
4510        {
4511        jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
4512        if (!check_class_ranges(common, (const pcre_uint8 *)cc, (((const pcre_uint8 *)cc)[31] & 0x80) != 0, TRUE, &found))
4513          {
4514          OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
4515          OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
4516          OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
4517          OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
4518          OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
4519          add_jump(compiler, &found, JUMP(SLJIT_C_NOT_ZERO));
4520          }
4521    
4522        add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
4523        JUMPHERE(jump);
4524    
4525        cc += 32 / sizeof(pcre_uchar);
4526        }
4527      else
4528        add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, 0xff));
4529      }
4530    else if ((cc[-1] & XCL_MAP) != 0)
4531      {
4532      OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
4533    #ifdef SUPPORT_UCP
4534      charsaved = TRUE;
4535    #endif
4536      if (!check_class_ranges(common, (const pcre_uint8 *)cc, FALSE, TRUE, list))
4537        {
4538    #ifdef COMPILE_PCRE8
4539        SLJIT_ASSERT(common->utf);
4540    #endif
4541        jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
4542    
4543        OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
4544        OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
4545        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
4546        OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
4547        OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
4548        add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));
4549    
4550        JUMPHERE(jump);
4551        }
4552    
4553      OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
4554      cc += 32 / sizeof(pcre_uchar);
4555      }
4556    
4557  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4558  /* Simple register allocation. TMP1 is preferred if possible. */  /* Simple register allocation. TMP1 is preferred if possible. */
4559  if (needstype || needsscript)  if (needstype || needsscript)
# Line 4575  if (needstype || needsscript) Line 4595  if (needstype || needsscript)
4595  #endif  #endif
4596    
4597  /* Generating code. */  /* Generating code. */
 cc = ccbegin;  
4598  charoffset = 0;  charoffset = 0;
4599  numberofcmps = 0;  numberofcmps = 0;
4600  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 4591  while (*cc != XCL_END) Line 4610  while (*cc != XCL_END)
4610    if (*cc == XCL_SINGLE)    if (*cc == XCL_SINGLE)
4611      {      {
4612      cc ++;      cc ++;
4613  #ifdef SUPPORT_UTF      GETCHARINCTEST(c, cc);
     if (common->utf)  
       {  
       GETCHARINC(c, cc);  
       }  
     else  
 #endif  
       c = *cc++;  
4614    
4615      if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))      if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
4616        {        {
4617        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, c - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
4618        OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_EQUAL);        OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_EQUAL);
4619        numberofcmps++;        numberofcmps++;
4620        }        }
4621      else if (numberofcmps > 0)      else if (numberofcmps > 0)
4622        {        {
4623        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, c - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
4624        OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);        OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
4625        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
4626        numberofcmps = 0;        numberofcmps = 0;
4627        }        }
4628      else      else
4629        {        {
4630        jump = CMP(SLJIT_C_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, c - charoffset);        jump = CMP(SLJIT_C_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
4631        numberofcmps = 0;        numberofcmps = 0;
4632        }        }
4633      }      }
4634    else if (*cc == XCL_RANGE)    else if (*cc == XCL_RANGE)
4635      {      {
4636      cc ++;      cc ++;
4637  #ifdef SUPPORT_UTF      GETCHARINCTEST(c, cc);
     if (common->utf)  
       {  
       GETCHARINC(c, cc);  
       }  
     else  
 #endif  
       c = *cc++;  
4638      SET_CHAR_OFFSET(c);      SET_CHAR_OFFSET(c);
4639  #ifdef SUPPORT_UTF      GETCHARINCTEST(c, cc);
4640      if (common->utf)  
       {  
       GETCHARINC(c, cc);  
       }  
     else  
 #endif  
       c = *cc++;  
4641      if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))      if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
4642        {        {
4643        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, c - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
4644        OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_LESS_EQUAL);        OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_LESS_EQUAL);
4645        numberofcmps++;        numberofcmps++;
4646        }        }
4647      else if (numberofcmps > 0)      else if (numberofcmps > 0)
4648        {        {
4649        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, c - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
4650        OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);        OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
4651        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
4652        numberofcmps = 0;        numberofcmps = 0;
4653        }        }
4654      else      else
4655        {        {
4656        jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, c - charoffset);        jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
4657        numberofcmps = 0;        numberofcmps = 0;
4658        }        }
4659      }      }
# Line 4720  while (*cc != XCL_END) Line 4719  while (*cc != XCL_END)
4719        break;        break;
4720    
4721        case PT_WORD:        case PT_WORD:
4722        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
4723        OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);        OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
4724        /* Fall through. */        /* Fall through. */
4725    
# Line 4768  while (*cc != XCL_END) Line 4767  while (*cc != XCL_END)
4767          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
4768          OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);          OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
4769    
4770          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, other_cases[0] - charoffset);          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
4771          OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);          OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
4772    
4773          other_cases += 3;          other_cases += 3;
4774          }          }
4775        else        else
4776          {          {
4777          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, *other_cases++ - charoffset);          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
4778          OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);          OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
4779          }          }
4780    
4781        while (*other_cases != NOTACHAR)        while (*other_cases != NOTACHAR)
4782          {          {
4783          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, *other_cases++ - charoffset);          OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
4784          OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);          OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
4785          }          }
4786        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
4787        break;        break;
4788    
4789        case PT_UCNC:        case PT_UCNC:
4790        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_DOLLAR_SIGN - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
4791        OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);        OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
4792        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_COMMERCIAL_AT - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
4793        OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);        OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
4794        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_GRAVE_ACCENT - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
4795        OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);        OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
4796    
4797        SET_CHAR_OFFSET(0xa0);        SET_CHAR_OFFSET(0xa0);
4798        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd7ff - charoffset);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
4799        OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);        OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
4800        SET_CHAR_OFFSET(0);        SET_CHAR_OFFSET(0);
4801        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
# Line 4960  switch(type) Line 4959  switch(type)
4959    
4960    case OP_ANY:    case OP_ANY:
4961    detect_partial_match(common, backtracks);    detect_partial_match(common, backtracks);
4962    read_char_max(common, common->nlmax, TRUE);    read_char_range(common, common->nlmin, common->nlmax, TRUE);
4963    if (common->nltype == NLTYPE_FIXED && common->newline > 255)    if (common->nltype == NLTYPE_FIXED && common->newline > 255)
4964      {      {
4965      jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);      jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
# Line 5028  switch(type) Line 5027  switch(type)
5027    
5028    case OP_ANYNL:    case OP_ANYNL:
5029    detect_partial_match(common, backtracks);    detect_partial_match(common, backtracks);
5030    read_char_max(common, common->bsr_nlmax, FALSE);    read_char_range(common, common->bsr_nlmin, common->bsr_nlmax, FALSE);
5031    jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);    jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
5032    /* We don't need to handle soft partial matching case. */    /* We don't need to handle soft partial matching case. */
5033    end_list = NULL;    end_list = NULL;
# Line 5050  switch(type) Line 5049  switch(type)
5049    case OP_NOT_HSPACE:    case OP_NOT_HSPACE:
5050    case OP_HSPACE:    case OP_HSPACE:
5051    detect_partial_match(common, backtracks);    detect_partial_match(common, backtracks);
5052    read_char_max(common, 0x3000, type == OP_NOT_HSPACE);    read_char_range(common, 0x9, 0x3000, type == OP_NOT_HSPACE);
5053    add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));
5054    add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));    add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));
5055    return cc;    return cc;
# Line 5058  switch(type) Line 5057  switch(type)
5057    case OP_NOT_VSPACE:    case OP_NOT_VSPACE:
5058    case OP_VSPACE:    case OP_VSPACE:
5059    detect_partial_match(common, backtracks);    detect_partial_match(common, backtracks);
5060    read_char_max(common, 0x2029, type == OP_NOT_VSPACE);    read_char_range(common, 0xa, 0x2029, type == OP_NOT_VSPACE);
5061    add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));
5062    add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));    add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_C_NOT_ZERO : SLJIT_C_ZERO));
5063    return cc;    return cc;
# Line 5157  switch(type) Line 5156  switch(type)
5156      else      else
5157        {        {
5158        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, STR_PTR, 0);
5159        read_char_max(common, common->nlmax, TRUE);        read_char_range(common, common->nlmin, common->nlmax, TRUE);
5160        add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, STR_END, 0));        add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, STR_END, 0));
5161        add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
5162        add_jump(compiler, backtracks, JUMP(SLJIT_C_ZERO));        add_jump(compiler, backtracks, JUMP(SLJIT_C_ZERO));
# Line 5205  switch(type) Line 5204  switch(type)
5204    else    else
5205      {      {
5206      skip_char_back(common);      skip_char_back(common);
5207      read_char_max(common, common->nlmax, TRUE);      read_char_range(common, common->nlmin, common->nlmax, TRUE);
5208      check_newlinechar(common, common->nltype, backtracks, FALSE);      check_newlinechar(common, common->nltype, backtracks, FALSE);
5209      }      }
5210    JUMPHERE(jump[0]);    JUMPHERE(jump[0]);
# Line 5256  switch(type) Line 5255  switch(type)
5255      }      }
5256    else    else
5257      {      {
5258      peek_char(common);      peek_char(common, common->nlmax);
5259      check_newlinechar(common, common->nltype, backtracks, FALSE);      check_newlinechar(common, common->nltype, backtracks, FALSE);
5260      }      }
5261    JUMPHERE(jump[0]);    JUMPHERE(jump[0]);
# Line 5293  switch(type) Line 5292  switch(type)
5292    
5293    if (type == OP_CHAR || !char_has_othercase(common, cc))    if (type == OP_CHAR || !char_has_othercase(common, cc))
5294      {      {
5295      read_char_max(common, c, FALSE);      read_char_range(common, c, c, FALSE);
5296      add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c));      add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c));
5297      return cc + length;      return cc + length;
5298      }      }
5299    oc = char_othercase(common, c);    oc = char_othercase(common, c);
5300    read_char_max(common, c > oc ? c : oc, FALSE);    read_char_range(common, c < oc ? c : oc, c > oc ? c : oc, FALSE);
5301    bit = c ^ oc;    bit = c ^ oc;
5302    if (is_powerof2(bit))    if (is_powerof2(bit))
5303      {      {
# Line 5351  switch(type) Line 5350  switch(type)
5350    
5351    if (type == OP_NOT || !char_has_othercase(common, cc))    if (type == OP_NOT || !char_has_othercase(common, cc))
5352      {      {
5353      read_char_max(common, c, TRUE);      read_char_range(common, c, c, TRUE);
5354      add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c));      add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c));
5355      }      }
5356    else    else
5357      {      {
5358      oc = char_othercase(common, c);      oc = char_othercase(common, c);
5359      read_char_max(common, c > oc ? c : oc, TRUE);      read_char_range(common, c < oc ? c : oc, c > oc ? c : oc, TRUE);
5360      bit = c ^ oc;      bit = c ^ oc;
5361      if (is_powerof2(bit))      if (is_powerof2(bit))
5362        {        {
# Line 5378  switch(type) Line 5377  switch(type)
5377    
5378  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
5379    bit = (common->utf && is_char7_bitset((const pcre_uint8 *)cc, type == OP_NCLASS)) ? 127 : 255;    bit = (common->utf && is_char7_bitset((const pcre_uint8 *)cc, type == OP_NCLASS)) ? 127 : 255;
5380    read_char_max(common, bit, type == OP_NCLASS);    read_char_range(common, 0, bit, type == OP_NCLASS);
5381  #else  #else
5382    read_char_max(common, 255, type == OP_NCLASS);    read_char_range(common, 0, 255, type == OP_NCLASS);
5383  #endif  #endif
5384    
5385    if (check_class_ranges(common, (const pcre_uint8 *)cc, type == OP_NCLASS, FALSE, backtracks))    if (check_class_ranges(common, (const pcre_uint8 *)cc, type == OP_NCLASS, FALSE, backtracks))
# Line 9436  switch(re->options & PCRE_NEWLINE_BITS) Line 9435  switch(re->options & PCRE_NEWLINE_BITS)
9435    case PCRE_NEWLINE_ANYCRLF: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANYCRLF; break;    case PCRE_NEWLINE_ANYCRLF: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANYCRLF; break;
9436    default: return;    default: return;
9437    }    }
9438  common->nlmax = READ_CHAR_ANY;  common->nlmax = READ_CHAR_MAX;
9439    common->nlmin = 0;
9440  if ((re->options & PCRE_BSR_ANYCRLF) != 0)  if ((re->options & PCRE_BSR_ANYCRLF) != 0)
9441    common->bsr_nltype = NLTYPE_ANYCRLF;    common->bsr_nltype = NLTYPE_ANYCRLF;
9442  else if ((re->options & PCRE_BSR_UNICODE) != 0)  else if ((re->options & PCRE_BSR_UNICODE) != 0)
# Line 9449  else Line 9449  else
9449    common->bsr_nltype = NLTYPE_ANY;    common->bsr_nltype = NLTYPE_ANY;
9450  #endif  #endif
9451    }    }
9452  common->bsr_nlmax = READ_CHAR_ANY;  common->bsr_nlmax = READ_CHAR_MAX;
9453    common->bsr_nlmin = 0;
9454  common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;  common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
9455  common->ctypes = (sljit_sw)(tables + ctypes_offset);  common->ctypes = (sljit_sw)(tables + ctypes_offset);
9456  common->name_table = ((pcre_uchar *)re) + re->name_table_offset;  common->name_table = ((pcre_uchar *)re) + re->name_table_offset;
# Line 9474  if (common->utf) Line 9475  if (common->utf)
9475      common->nlmax = common->newline & 0xff;      common->nlmax = common->newline & 0xff;
9476      }      }
9477    
9478      if (common->nltype == NLTYPE_FIXED)
9479        common->nlmin = common->newline & 0xff;
9480      else
9481        common->nlmin = (CHAR_CR < CHAR_NL) ? CHAR_CR : CHAR_NL;
9482    
9483    if (common->bsr_nltype == NLTYPE_ANY)    if (common->bsr_nltype == NLTYPE_ANY)
9484      common->bsr_nlmax = 0x2029;      common->bsr_nlmax = 0x2029;
9485    else    else
9486      common->bsr_nlmax = (CHAR_CR > CHAR_NL) ? CHAR_CR : CHAR_NL;      common->bsr_nlmax = (CHAR_CR > CHAR_NL) ? CHAR_CR : CHAR_NL;
9487      common->bsr_nlmin = (CHAR_CR < CHAR_NL) ? CHAR_CR : CHAR_NL;
9488    }    }
9489  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
9490  ccend = bracketend(rootbacktrack.cc);  ccend = bracketend(rootbacktrack.cc);

Legend:
Removed from v.1423  
changed lines
  Added in v.1426

  ViewVC Help
Powered by ViewVC 1.1.5