/[pcre]/code/tags/pcre-8.38/pcre_jit_compile.c
ViewVC logotype

Diff of /code/tags/pcre-8.38/pcre_jit_compile.c

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

revision 1424 by zherczeg, Tue Dec 31 11:22:31 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 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) \
       OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)((value) - charoffset)); \  
     else \  
4380        OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(charoffset - (value))); \        OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(charoffset - (value))); \
4381        else \
4382          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  sljit_uw c, charoffset, max = 0;  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;
# Line 4395  BOOL needstype = FALSE, needsscript = FA Line 4401  BOOL needstype = FALSE, needsscript = FA
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  /* Scanning the necessary info. */  /* Scanning the necessary info. */
4408  cc++;  cc++;
4409  ccbegin = cc;  ccbegin = cc;
4410  compares = 0;  compares = 0;
4411  if (cc[-1] & XCL_MAP) cc += 32 / sizeof(pcre_uchar);  if (cc[-1] & XCL_MAP)
4412      {
4413      min = 0;
4414      cc += 32 / sizeof(pcre_uchar);
4415      }
4416    
4417  while (*cc != XCL_END)  while (*cc != XCL_END)
4418    {    {
# Line 4412  while (*cc != XCL_END) Line 4422  while (*cc != XCL_END)
4422      cc ++;      cc ++;
4423      GETCHARINCTEST(c, cc);      GETCHARINCTEST(c, cc);
4424      if (c > max) max = c;      if (c > max) max = c;
4425        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;
 #endif  
4435      GETCHARINCTEST(c, cc);      GETCHARINCTEST(c, cc);
4436      if (c > max) max = c;      if (c > max) max = c;
4437  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 4439  while (*cc != XCL_END) Line 4449  while (*cc != XCL_END)
4449        while (*other_cases != NOTACHAR)        while (*other_cases != NOTACHAR)
4450          {          {
4451          if (*other_cases > max) max = *other_cases;          if (*other_cases > max) max = *other_cases;
4452            if (*other_cases < min) min = *other_cases;
4453          other_cases++;          other_cases++;
4454          }          }
4455        }        }
4456      else      else
4457        max = READ_CHAR_ANY;        {
4458          max = READ_CHAR_MAX;
4459          min = 0;
4460          }
4461    
4462      switch(*cc)      switch(*cc)
4463        {        {
# Line 4488  while (*cc != XCL_END) Line 4502  while (*cc != XCL_END)
4502  /* We are not necessary in utf mode even in 8 bit mode. */  /* We are not necessary in utf mode even in 8 bit mode. */
4503  cc = ccbegin;  cc = ccbegin;
4504  detect_partial_match(common, backtracks);  detect_partial_match(common, backtracks);
4505  read_char_max(common, max, (cc[0] & XCL_NOT) != 0);  read_char_range(common, min, max, (cc[0] & XCL_NOT) != 0);
4506    
4507  if ((cc[-1] & XCL_HASPROP) == 0)  if ((cc[-1] & XCL_HASPROP) == 0)
4508    {    {
# Line 4945  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 5013  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 5035  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 5043  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 5142  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 5190  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 5241  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 5278  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 5336  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 5363  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 9421  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 9434  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 9459  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.1424  
changed lines
  Added in v.1426

  ViewVC Help
Powered by ViewVC 1.1.5