/[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 1625 by zherczeg, Fri Feb 5 13:47:43 2016 UTC revision 1626 by zherczeg, Mon Feb 8 09:29:08 2016 UTC
# Line 325  typedef struct compiler_common { Line 325  typedef struct compiler_common {
325    /* Chain list of read-only data ptrs. */    /* Chain list of read-only data ptrs. */
326    void *read_only_data_head;    void *read_only_data_head;
327    /* Tells whether the capturing bracket is optimized. */    /* Tells whether the capturing bracket is optimized. */
328    pcre_uint8 *optimized_cbracket;    sljit_ub *optimized_cbracket;
329    /* Tells whether the starting offset is a target of then. */    /* Tells whether the starting offset is a target of then. */
330    pcre_uint8 *then_offsets;    sljit_ub *then_offsets;
331    /* Current position where a THEN must jump. */    /* Current position where a THEN must jump. */
332    then_trap_backtrack *then_trap;    then_trap_backtrack *then_trap;
333    /* Starting offset of private data for capturing brackets. */    /* Starting offset of private data for capturing brackets. */
334    int cbra_ptr;    sljit_si cbra_ptr;
335    /* Output vector starting point. Must be divisible by 2. */    /* Output vector starting point. Must be divisible by 2. */
336    int ovector_start;    sljit_si ovector_start;
337      /* Points to the starting character of the current match. */
338      sljit_si start_ptr;
339    /* Last known position of the requested byte. */    /* Last known position of the requested byte. */
340    int req_char_ptr;    sljit_si req_char_ptr;
341    /* Head of the last recursion. */    /* Head of the last recursion. */
342    int recursive_head_ptr;    sljit_si recursive_head_ptr;
343    /* First inspected character for partial matching. */    /* First inspected character for partial matching.
344    int start_used_ptr;       (Needed for avoiding zero length partial matches.) */
345      sljit_si start_used_ptr;
346    /* Starting pointer for partial soft matches. */    /* Starting pointer for partial soft matches. */
347    int hit_start;    sljit_si hit_start;
348    /* End pointer of the first line. */    /* End pointer of the first line. */
349    int first_line_end;    sljit_si first_line_end;
350    /* Points to the marked string. */    /* Points to the marked string. */
351    int mark_ptr;    sljit_si mark_ptr;
352    /* Recursive control verb management chain. */    /* Recursive control verb management chain. */
353    int control_head_ptr;    sljit_si control_head_ptr;
354    /* Points to the last matched capture block index. */    /* Points to the last matched capture block index. */
355    int capture_last_ptr;    sljit_si capture_last_ptr;
   /* Points to the starting position of the current match. */  
   int start_ptr;  
356    
357    /* Flipped and lower case tables. */    /* Flipped and lower case tables. */
358    const pcre_uint8 *fcc;    const sljit_ub *fcc;
359    sljit_sw lcc;    sljit_sw lcc;
360    /* Mode can be PCRE_STUDY_JIT_COMPILE and others. */    /* Mode can be PCRE_STUDY_JIT_COMPILE and others. */
361    int mode;    int mode;
# Line 366  typedef struct compiler_common { Line 367  typedef struct compiler_common {
367    BOOL has_skip_arg;    BOOL has_skip_arg;
368    /* (*THEN) is found in the pattern. */    /* (*THEN) is found in the pattern. */
369    BOOL has_then;    BOOL has_then;
   /* Needs to know the start position anytime. */  
   BOOL needs_start_ptr;  
370    /* Currently in recurse or negative assert. */    /* Currently in recurse or negative assert. */
371    BOOL local_exit;    BOOL local_exit;
372    /* Currently in a positive assert. */    /* Currently in a positive assert. */
373    BOOL positive_assert;    BOOL positive_assert;
374    /* Newline control. */    /* Newline control. */
375    int nltype;    int nltype;
376    pcre_uint32 nlmax;    sljit_ui nlmax;
377    pcre_uint32 nlmin;    sljit_ui nlmin;
378    int newline;    int newline;
379    int bsr_nltype;    int bsr_nltype;
380    pcre_uint32 bsr_nlmax;    sljit_ui bsr_nlmax;
381    pcre_uint32 bsr_nlmin;    sljit_ui bsr_nlmin;
382    /* Dollar endonly. */    /* Dollar endonly. */
383    int endonly;    int endonly;
384    /* Tables. */    /* Tables. */
# Line 856  while (cc < ccend) Line 855  while (cc < ccend)
855      /* Fall through. */      /* Fall through. */
856    
857      case OP_PRUNE_ARG:      case OP_PRUNE_ARG:
     common->needs_start_ptr = TRUE;  
     /* Fall through. */  
   
858      case OP_MARK:      case OP_MARK:
859      if (common->mark_ptr == 0)      if (common->mark_ptr == 0)
860        {        {
# Line 875  while (cc < ccend) Line 871  while (cc < ccend)
871    
872      case OP_PRUNE:      case OP_PRUNE:
873      case OP_SKIP:      case OP_SKIP:
     common->needs_start_ptr = TRUE;  
874      cc += 1;      cc += 1;
875      break;      break;
876    
# Line 2626  static BOOL is_char7_bitset(const pcre_u Line 2621  static BOOL is_char7_bitset(const pcre_u
2621  {  {
2622  /* Tells whether the character codes below 128 are enough  /* Tells whether the character codes below 128 are enough
2623  to determine a match. */  to determine a match. */
2624  const pcre_uint8 value = nclass ? 0xff : 0;  const sljit_ub value = nclass ? 0xff : 0;
2625  const pcre_uint8 *end = bitset + 32;  const sljit_ub *end = bitset + 32;
2626    
2627  bitset += 16;  bitset += 16;
2628  do  do
# Line 10030  if (mode != JIT_COMPILE) Line 10025  if (mode != JIT_COMPILE)
10025      common->hit_start = common->ovector_start;      common->hit_start = common->ovector_start;
10026      common->ovector_start += 2 * sizeof(sljit_sw);      common->ovector_start += 2 * sizeof(sljit_sw);
10027      }      }
   else  
     {  
     SLJIT_ASSERT(mode == JIT_PARTIAL_HARD_COMPILE);  
     common->needs_start_ptr = TRUE;  
     }  
10028    }    }
10029  if ((re->options & PCRE_FIRSTLINE) != 0)  if ((re->options & PCRE_FIRSTLINE) != 0)
10030    {    {
# Line 10049  if (common->control_head_ptr != 0) Line 10039  if (common->control_head_ptr != 0)
10039    common->control_head_ptr = common->ovector_start;    common->control_head_ptr = common->ovector_start;
10040    common->ovector_start += sizeof(sljit_sw);    common->ovector_start += sizeof(sljit_sw);
10041    }    }
10042  if (common->needs_start_ptr && common->has_set_som)  if (common->has_set_som)
10043    {    {
10044    /* Saving the real start pointer is necessary. */    /* Saving the real start pointer is necessary. */
10045    common->start_ptr = common->ovector_start;    common->start_ptr = common->ovector_start;
10046    common->ovector_start += sizeof(sljit_sw);    common->ovector_start += sizeof(sljit_sw);
10047    }    }
 else  
   common->needs_start_ptr = FALSE;  
10048    
10049  /* Aligning ovector to even number of sljit words. */  /* Aligning ovector to even number of sljit words. */
10050  if ((common->ovector_start & sizeof(sljit_sw)) != 0)  if ((common->ovector_start & sizeof(sljit_sw)) != 0)
# Line 10169  OP1(SLJIT_MOV, COUNT_MATCH, 0, SLJIT_MEM Line 10157  OP1(SLJIT_MOV, COUNT_MATCH, 0, SLJIT_MEM
10157  if (common->capture_last_ptr != 0)  if (common->capture_last_ptr != 0)
10158    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, -1);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, -1);
10159    
10160  if (common->needs_start_ptr)  if (common->start_ptr != OVECTOR(0))
   {  
   SLJIT_ASSERT(common->start_ptr != OVECTOR(0));  
10161    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_ptr, STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_ptr, STR_PTR, 0);
   }  
 else  
   SLJIT_ASSERT(common->start_ptr == OVECTOR(0));  
10162    
10163  /* Copy the beginning of the string. */  /* Copy the beginning of the string. */
10164  if (mode == JIT_PARTIAL_SOFT_COMPILE)  if (mode == JIT_PARTIAL_SOFT_COMPILE)

Legend:
Removed from v.1625  
changed lines
  Added in v.1626

  ViewVC Help
Powered by ViewVC 1.1.5