/[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 1370 by zherczeg, Mon Oct 7 07:41:44 2013 UTC revision 1371 by zherczeg, Fri Oct 11 10:59:41 2013 UTC
# Line 589  switch(*cc) Line 589  switch(*cc)
589    case OP_NCLASS:    case OP_NCLASS:
590    case OP_REF:    case OP_REF:
591    case OP_REFI:    case OP_REFI:
592      case OP_DNREF:
593      case OP_DNREFI:
594    case OP_RECURSE:    case OP_RECURSE:
595    case OP_CALLOUT:    case OP_CALLOUT:
596    case OP_ALT:    case OP_ALT:
# Line 736  switch(*cc) Line 738  switch(*cc)
738    
739  static BOOL check_opcode_types(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)  static BOOL check_opcode_types(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
740  {  {
741    int count;
742  pcre_uchar *slot;  pcre_uchar *slot;
 int i;  
743    
744  /* Calculate important variables (like stack size) and checks whether all opcodes are supported. */  /* Calculate important variables (like stack size) and checks whether all opcodes are supported. */
745  while (cc < ccend)  while (cc < ccend)
# Line 771  while (cc < ccend) Line 773  while (cc < ccend)
773      break;      break;
774    
775      case OP_CREF:      case OP_CREF:
776      i = GET2(cc, 1);      common->optimized_cbracket[GET2(cc, 1)] = 0;
     common->optimized_cbracket[i] = 0;  
777      cc += 1 + IMM2_SIZE;      cc += 1 + IMM2_SIZE;
778      break;      break;
779    
780        case OP_DNREF:
781        case OP_DNREFI:
782      case OP_DNCREF:      case OP_DNCREF:
783      i = GET2(cc, 1 + IMM2_SIZE);      count = GET2(cc, 1 + IMM2_SIZE);
784      slot = common->name_table + GET2(cc, 1) * common->name_entry_size;      slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
785      while (i-- > 0)      while (count-- > 0)
786        {        {
787        common->optimized_cbracket[GET2(slot, 0)] = 0;        common->optimized_cbracket[GET2(slot, 0)] = 0;
788        slot += common->name_entry_size;        slot += common->name_entry_size;
# Line 5038  if (context.length > 0) Line 5041  if (context.length > 0)
5041  return compile_char1_matchingpath(common, *cc, cc + 1, backtracks);  return compile_char1_matchingpath(common, *cc, cc + 1, backtracks);
5042  }  }
5043    
 static struct sljit_jump *compile_ref_checks(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)  
 {  
 DEFINE_COMPILER;  
 int offset = GET2(cc, 1) << 1;  
   
 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));  
 if (!common->jscript_compat)  
   {  
   if (backtracks == NULL)  
     {  
     /* OVECTOR(1) contains the "string begin - 1" constant. */  
     OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));  
     OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);  
     OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));  
     OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);  
     return JUMP(SLJIT_C_NOT_ZERO);  
     }  
   add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));  
   }  
 return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));  
 }  
   
5044  /* Forward definitions. */  /* Forward definitions. */
5045  static void compile_matchingpath(compiler_common *, pcre_uchar *, pcre_uchar *, backtrack_common *);  static void compile_matchingpath(compiler_common *, pcre_uchar *, pcre_uchar *, backtrack_common *);
5046  static void compile_backtrackingpath(compiler_common *, struct backtrack_common *);  static void compile_backtrackingpath(compiler_common *, struct backtrack_common *);
# Line 5092  static void compile_backtrackingpath(com Line 5073  static void compile_backtrackingpath(com
5073    
5074  #define BACKTRACK_AS(type) ((type *)backtrack)  #define BACKTRACK_AS(type) ((type *)backtrack)
5075    
5076  static pcre_uchar *compile_ref_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks, BOOL withchecks, BOOL emptyfail)  static void compile_dnref_search(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
5077  {  {
5078    /* The OVECTOR offset goes to TMP2. */
5079  DEFINE_COMPILER;  DEFINE_COMPILER;
5080  int offset = GET2(cc, 1) << 1;  int count = GET2(cc, 1 + IMM2_SIZE);
5081    pcre_uchar *slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
5082    unsigned int offset;
5083    jump_list *found = NULL;
5084    
5085    SLJIT_ASSERT(*cc == OP_DNREF || *cc == OP_DNREFI);
5086    
5087    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));
5088    
5089    count--;
5090    while (count-- > 0)
5091      {
5092      offset = GET2(slot, 0) << 1;
5093      GET_LOCAL_BASE(TMP2, 0, OVECTOR(offset));
5094      add_jump(compiler, &found, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0));
5095      slot += common->name_entry_size;
5096      }
5097    
5098    offset = GET2(slot, 0) << 1;
5099    GET_LOCAL_BASE(TMP2, 0, OVECTOR(offset));
5100    if (backtracks != NULL && !common->jscript_compat)
5101      add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0));
5102    
5103    set_jumps(found, LABEL());
5104    }
5105    
5106    static void compile_ref_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks, BOOL withchecks, BOOL emptyfail)
5107    {
5108    DEFINE_COMPILER;
5109    BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
5110    int offset = 0;
5111  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
5112  struct sljit_jump *partial;  struct sljit_jump *partial;
5113  struct sljit_jump *nopartial;  struct sljit_jump *nopartial;
5114    
5115  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));  if (ref)
5116  /* OVECTOR(1) contains the "string begin - 1" constant. */    {
5117  if (withchecks && !common->jscript_compat)    offset = GET2(cc, 1) << 1;
5118    add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
5119      /* OVECTOR(1) contains the "string begin - 1" constant. */
5120      if (withchecks && !common->jscript_compat)
5121        add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
5122      }
5123    else
5124      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
5125    
5126  #if defined SUPPORT_UTF && defined SUPPORT_UCP  #if defined SUPPORT_UTF && defined SUPPORT_UCP
5127  if (common->utf && *cc == OP_REFI)  if (common->utf && *cc == OP_REFI)
5128    {    {
5129    SLJIT_ASSERT(TMP1 == SLJIT_SCRATCH_REG1 && STACK_TOP == SLJIT_SCRATCH_REG2 && TMP2 == SLJIT_SCRATCH_REG3);    SLJIT_ASSERT(TMP1 == SLJIT_SCRATCH_REG1 && STACK_TOP == SLJIT_SCRATCH_REG2 && TMP2 == SLJIT_SCRATCH_REG3);
5130    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));    if (ref)
5131        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
5132      else
5133        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
5134    
5135    if (withchecks)    if (withchecks)
5136      jump = CMP(SLJIT_C_EQUAL, TMP1, 0, TMP2, 0);      jump = CMP(SLJIT_C_EQUAL, TMP1, 0, TMP2, 0);
5137    
# Line 5134  if (common->utf && *cc == OP_REFI) Line 5156  if (common->utf && *cc == OP_REFI)
5156  else  else
5157  #endif /* SUPPORT_UTF && SUPPORT_UCP */  #endif /* SUPPORT_UTF && SUPPORT_UCP */
5158    {    {
5159    OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);    if (ref)
5160        OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);
5161      else
5162        OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
5163    
5164    if (withchecks)    if (withchecks)
5165      jump = JUMP(SLJIT_C_ZERO);      jump = JUMP(SLJIT_C_ZERO);
5166    
# Line 5171  if (jump != NULL) Line 5197  if (jump != NULL)
5197    else    else
5198      JUMPHERE(jump);      JUMPHERE(jump);
5199    }    }
 return cc + 1 + IMM2_SIZE;  
5200  }  }
5201    
5202  static SLJIT_INLINE pcre_uchar *compile_ref_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)  static SLJIT_INLINE pcre_uchar *compile_ref_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
5203  {  {
5204  DEFINE_COMPILER;  DEFINE_COMPILER;
5205    BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
5206  backtrack_common *backtrack;  backtrack_common *backtrack;
5207  pcre_uchar type;  pcre_uchar type;
5208    int offset = 0;
5209  struct sljit_label *label;  struct sljit_label *label;
5210  struct sljit_jump *zerolength;  struct sljit_jump *zerolength;
5211  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
# Line 5188  BOOL minimize; Line 5215  BOOL minimize;
5215    
5216  PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);  PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
5217    
5218    if (ref)
5219      offset = GET2(cc, 1) << 1;
5220    else
5221      cc += IMM2_SIZE;
5222  type = cc[1 + IMM2_SIZE];  type = cc[1 + IMM2_SIZE];
5223    
5224    SLJIT_COMPILE_ASSERT((OP_CRSTAR & 0x1) == 0, crstar_opcode_must_be_even);
5225  minimize = (type & 0x1) != 0;  minimize = (type & 0x1) != 0;
5226  switch(type)  switch(type)
5227    {    {
# Line 5226  if (!minimize) Line 5259  if (!minimize)
5259    if (min == 0)    if (min == 0)
5260      {      {
5261      allocate_stack(common, 2);      allocate_stack(common, 2);
5262        if (ref)
5263          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
5264      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5265      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
5266      /* Temporary release of STR_PTR. */      /* Temporary release of STR_PTR. */
5267      OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));      OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
5268      zerolength = compile_ref_checks(common, ccbegin, NULL);      /* Handles both invalid and empty cases. Since the minimum repeat,
5269        is zero the invalid case is basically the same as an empty case. */
5270        if (ref)
5271          zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
5272        else
5273          {
5274          compile_dnref_search(common, ccbegin, NULL);
5275          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
5276          OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, TMP2, 0);
5277          zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
5278          }
5279      /* Restore if not zero length. */      /* Restore if not zero length. */
5280      OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));      OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
5281      }      }
5282    else    else
5283      {      {
5284      allocate_stack(common, 1);      allocate_stack(common, 1);
5285        if (ref)
5286          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
5287      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
5288      zerolength = compile_ref_checks(common, ccbegin, &backtrack->topbacktracks);      if (ref)
5289          {
5290          add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
5291          zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
5292          }
5293        else
5294          {
5295          compile_dnref_search(common, ccbegin, &backtrack->topbacktracks);
5296          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
5297          OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, TMP2, 0);
5298          zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
5299          }
5300      }      }
5301    
5302    if (min > 1 || max > 1)    if (min > 1 || max > 1)
5303      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, 0);
5304    
5305    label = LABEL();    label = LABEL();
5306      if (!ref)
5307        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
5308    compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, FALSE, FALSE);    compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, FALSE, FALSE);
5309    
5310    if (min > 1 || max > 1)    if (min > 1 || max > 1)
# Line 5279  if (!minimize) Line 5339  if (!minimize)
5339    return cc;    return cc;
5340    }    }
5341    
5342  allocate_stack(common, 2);  allocate_stack(common, ref ? 2 : 3);
5343    if (ref)
5344      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
5345  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
5346  if (type != OP_CRMINSTAR)  if (type != OP_CRMINSTAR)
5347    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
5348    
5349  if (min == 0)  if (min == 0)
5350    {    {
5351    zerolength = compile_ref_checks(common, ccbegin, NULL);    /* Handles both invalid and empty cases. Since the minimum repeat,
5352      is zero the invalid case is basically the same as an empty case. */
5353      if (ref)
5354        zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
5355      else
5356        {
5357        compile_dnref_search(common, ccbegin, NULL);
5358        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
5359        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0);
5360        zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
5361        }
5362      /* Length is non-zero, we can match real repeats. */
5363    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5364    jump = JUMP(SLJIT_JUMP);    jump = JUMP(SLJIT_JUMP);
5365    }    }
5366  else  else
5367    zerolength = compile_ref_checks(common, ccbegin, &backtrack->topbacktracks);    {
5368      if (ref)
5369        {
5370        add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
5371        zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
5372        }
5373      else
5374        {
5375        compile_dnref_search(common, ccbegin, &backtrack->topbacktracks);
5376        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
5377        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0);
5378        zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
5379        }
5380      }
5381    
5382  BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();  BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();
5383  if (max > 0)  if (max > 0)
5384    add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, max));    add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, max));
5385    
5386    if (!ref)
5387      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(2));
5388  compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, TRUE, TRUE);  compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, TRUE, TRUE);
5389  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5390    
# Line 6362  if (opcode == OP_COND || opcode == OP_SC Line 6450  if (opcode == OP_COND || opcode == OP_SC
6450          i = (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);          i = (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
6451          while (stacksize > 0)          while (stacksize > 0)
6452            {            {
6453            if (GET2(slot, 0) == i)            if ((int)GET2(slot, 0) == i)
6454              break;              break;
6455            slot += common->name_entry_size;            slot += common->name_entry_size;
6456            stacksize--;            stacksize--;
# Line 7423  while (cc < ccend) Line 7511  while (cc < ccend)
7511      if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRMINRANGE)      if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRMINRANGE)
7512        cc = compile_ref_iterator_matchingpath(common, cc, parent);        cc = compile_ref_iterator_matchingpath(common, cc, parent);
7513      else      else
7514        cc = compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);        {
7515          compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
7516          cc += 1 + IMM2_SIZE;
7517          }
7518        break;
7519    
7520        case OP_DNREF:
7521        case OP_DNREFI:
7522        if (cc[1 + 2 * IMM2_SIZE] >= OP_CRSTAR && cc[1 + 2 * IMM2_SIZE] <= OP_CRMINRANGE)
7523          cc = compile_ref_iterator_matchingpath(common, cc, parent);
7524        else
7525          {
7526          compile_dnref_search(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
7527          compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
7528          cc += 1 + 2 * IMM2_SIZE;
7529          }
7530      break;      break;
7531    
7532      case OP_RECURSE:      case OP_RECURSE:
# Line 7717  static SLJIT_INLINE void compile_ref_ite Line 7820  static SLJIT_INLINE void compile_ref_ite
7820  {  {
7821  DEFINE_COMPILER;  DEFINE_COMPILER;
7822  pcre_uchar *cc = current->cc;  pcre_uchar *cc = current->cc;
7823    BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
7824  pcre_uchar type;  pcre_uchar type;
7825    
7826  type = cc[1 + IMM2_SIZE];  type = cc[ref ? 1 + IMM2_SIZE : 1 + 2 * IMM2_SIZE];
7827    
7828  if ((type & 0x1) == 0)  if ((type & 0x1) == 0)
7829    {    {
7830      /* Maximize case. */
7831    set_jumps(current->topbacktracks, LABEL());    set_jumps(current->topbacktracks, LABEL());
7832    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7833    free_stack(common, 1);    free_stack(common, 1);
# Line 7732  if ((type & 0x1) == 0) Line 7838  if ((type & 0x1) == 0)
7838  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7839  CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);  CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
7840  set_jumps(current->topbacktracks, LABEL());  set_jumps(current->topbacktracks, LABEL());
7841  free_stack(common, 2);  free_stack(common, ref ? 2 : 3);
7842  }  }
7843    
7844  static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_common *common, struct backtrack_common *current)  static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_common *common, struct backtrack_common *current)
# Line 8533  while (current) Line 8639  while (current)
8639    
8640      case OP_REF:      case OP_REF:
8641      case OP_REFI:      case OP_REFI:
8642        case OP_DNREF:
8643        case OP_DNREFI:
8644      compile_ref_iterator_backtrackingpath(common, current);      compile_ref_iterator_backtrackingpath(common, current);
8645      break;      break;
8646    

Legend:
Removed from v.1370  
changed lines
  Added in v.1371

  ViewVC Help
Powered by ViewVC 1.1.5