/[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 1246 by zherczeg, Sun Feb 10 08:44:53 2013 UTC revision 1247 by zherczeg, Mon Feb 11 21:37:46 2013 UTC
# Line 65  system files. */ Line 65  system files. */
65  #error Unsupported architecture  #error Unsupported architecture
66  #endif  #endif
67    
68    /* Defines for debugging purposes. */
69    
70    /* 1 - Use unoptimized capturing brackets.
71       2 - Enable capture_last_ptr (includes option 1). */
72    /* #define DEBUG_FORCE_UNOPTIMIZED_CBRAS 2 */
73    
74  /* Allocate memory for the regex stack on the real machine stack.  /* Allocate memory for the regex stack on the real machine stack.
75  Fast, but limited size. */  Fast, but limited size. */
76  #define MACHINE_STACK_SIZE 32768  #define MACHINE_STACK_SIZE 32768
# Line 1126  int length = 0; Line 1132  int length = 0;
1132  int possessive = 0;  int possessive = 0;
1133  BOOL setsom_found = recursive;  BOOL setsom_found = recursive;
1134  BOOL setmark_found = recursive;  BOOL setmark_found = recursive;
1135  BOOL capture_last_found = recursive;  /* The last capture is a local variable even for recursions. */
1136    BOOL capture_last_found = FALSE;
1137    
1138  if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))  if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))
1139    {    {
# Line 1213  DEFINE_COMPILER; Line 1220  DEFINE_COMPILER;
1220  pcre_uchar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
1221  BOOL setsom_found = recursive;  BOOL setsom_found = recursive;
1222  BOOL setmark_found = recursive;  BOOL setmark_found = recursive;
1223  BOOL capture_last_found = recursive;  /* The last capture is a local variable even for recursions. */
1224    BOOL capture_last_found = FALSE;
1225  int offset;  int offset;
1226    
1227  /* >= 1 + shortest item size (2) */  /* >= 1 + shortest item size (2) */
# Line 8116  common->ovector_start = CALL_LIMIT + siz Line 8124  common->ovector_start = CALL_LIMIT + siz
8124  common->optimized_cbracket = (pcre_uint8 *)SLJIT_MALLOC(re->top_bracket + 1);  common->optimized_cbracket = (pcre_uint8 *)SLJIT_MALLOC(re->top_bracket + 1);
8125  if (!common->optimized_cbracket)  if (!common->optimized_cbracket)
8126    return;    return;
8127    #if defined DEBUG_FORCE_UNOPTIMIZED_CBRAS && DEBUG_FORCE_UNOPTIMIZED_CBRAS == 1
8128    memset(common->optimized_cbracket, 0, re->top_bracket + 1);
8129    #else
8130  memset(common->optimized_cbracket, 1, re->top_bracket + 1);  memset(common->optimized_cbracket, 1, re->top_bracket + 1);
8131    #endif
8132    
8133  SLJIT_ASSERT(*rootbacktrack.cc == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);  SLJIT_ASSERT(*rootbacktrack.cc == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);
8134    #if defined DEBUG_FORCE_UNOPTIMIZED_CBRAS && DEBUG_FORCE_UNOPTIMIZED_CBRAS == 2
8135    common->capture_last_ptr = common->ovector_start;
8136    common->ovector_start += sizeof(sljit_sw);
8137    #endif
8138  private_data_size = get_private_data_length(common, rootbacktrack.cc, ccend);  private_data_size = get_private_data_length(common, rootbacktrack.cc, ccend);
8139  if (private_data_size < 0)  if (private_data_size < 0)
8140    {    {
# Line 8304  if (mode == JIT_PARTIAL_SOFT_COMPILE) Line 8320  if (mode == JIT_PARTIAL_SOFT_COMPILE)
8320    }    }
8321    
8322  /* Check we have remaining characters. */  /* Check we have remaining characters. */
8323    if ((re->options & PCRE_ANCHORED) == 0 && (re->options & PCRE_FIRSTLINE) != 0)
8324      {
8325      SLJIT_ASSERT(common->first_line_end != 0);
8326      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end);
8327      }
8328  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
8329    
8330  if ((re->options & PCRE_ANCHORED) == 0)  if ((re->options & PCRE_ANCHORED) == 0)
8331    {    {
8332    if ((re->options & PCRE_FIRSTLINE) == 0)    if ((re->options & PCRE_FIRSTLINE) == 0)
8333      {      CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, mainloop);
     if (mode == JIT_COMPILE && study != NULL && study->minlength > 1 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)  
       {  
       OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));  
       CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);  
       }  
     else  
       CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, mainloop);  
     }  
8334    else    else
8335      {      CMPTO(SLJIT_C_LESS, STR_PTR, 0, TMP1, 0, mainloop);
     SLJIT_ASSERT(common->first_line_end != 0);  
     if (mode == JIT_COMPILE && study != NULL && study->minlength > 1 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)  
       {  
       OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));  
       OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);  
       OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);  
       OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end);  
       OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_GREATER_EQUAL);  
       JUMPTO(SLJIT_C_ZERO, mainloop);  
       }  
     else  
       CMPTO(SLJIT_C_LESS, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, mainloop);  
     }  
8336    }    }
8337    
8338  /* No more remaining characters. */  /* No more remaining characters. */

Legend:
Removed from v.1246  
changed lines
  Added in v.1247

  ViewVC Help
Powered by ViewVC 1.1.5