/[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 1306 by zherczeg, Mon Apr 1 17:04:17 2013 UTC revision 1307 by zherczeg, Mon Apr 1 17:13:00 2013 UTC
# Line 6139  BOOL has_alternatives; Line 6139  BOOL has_alternatives;
6139  BOOL needs_control_head = FALSE;  BOOL needs_control_head = FALSE;
6140  struct sljit_jump *jump;  struct sljit_jump *jump;
6141  struct sljit_jump *skip;  struct sljit_jump *skip;
6142  struct sljit_label *rmaxlabel = NULL;  struct sljit_label *rmax_label = NULL;
6143  struct sljit_jump *braminzerojump = NULL;  struct sljit_jump *braminzero = NULL;
6144    
6145  PUSH_BACKTRACK(sizeof(bracket_backtrack), cc, NULL);  PUSH_BACKTRACK(sizeof(bracket_backtrack), cc, NULL);
6146    
# Line 6255  if (bra == OP_BRAMINZERO) Line 6255  if (bra == OP_BRAMINZERO)
6255    if (ket != OP_KETRMIN)    if (ket != OP_KETRMIN)
6256      {      {
6257      free_stack(common, 1);      free_stack(common, 1);
6258      braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);      braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
6259      }      }
6260    else    else
6261      {      {
# Line 6270  if (bra == OP_BRAMINZERO) Line 6270  if (bra == OP_BRAMINZERO)
6270        if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)        if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)
6271          {          {
6272          /* When we come from outside, private_data_ptr contains the previous STR_PTR. */          /* When we come from outside, private_data_ptr contains the previous STR_PTR. */
6273          braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);          braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6274          }          }
6275        else        else
6276          {          {
6277          /* Except when the whole stack frame must be saved. */          /* Except when the whole stack frame must be saved. */
6278          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6279          braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw));          braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw));
6280          }          }
6281        JUMPHERE(skip);        JUMPHERE(skip);
6282        }        }
# Line 6293  if (repeat_type != 0) Line 6293  if (repeat_type != 0)
6293    {    {
6294    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, repeat_count);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, repeat_count);
6295    if (repeat_type == OP_EXACT)    if (repeat_type == OP_EXACT)
6296      rmaxlabel = LABEL();      rmax_label = LABEL();
6297    }    }
6298    
6299  if (ket == OP_KETRMIN)  if (ket == OP_KETRMIN)
# Line 6301  if (ket == OP_KETRMIN) Line 6301  if (ket == OP_KETRMIN)
6301    
6302  if (ket == OP_KETRMAX)  if (ket == OP_KETRMAX)
6303    {    {
6304    rmaxlabel = LABEL();    rmax_label = LABEL();
6305    if (has_alternatives && opcode != OP_ONCE && opcode < OP_SBRA && repeat_type == 0)    if (has_alternatives && opcode != OP_ONCE && opcode < OP_SBRA && repeat_type == 0)
6306      BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = rmaxlabel;      BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = rmax_label;
6307    }    }
6308    
6309  /* Handling capturing brackets and alternatives. */  /* Handling capturing brackets and alternatives. */
# Line 6584  if (ket == OP_KETRMAX) Line 6584  if (ket == OP_KETRMAX)
6584      if (has_alternatives)      if (has_alternatives)
6585        BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();        BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
6586      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1);      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1);
6587      JUMPTO(SLJIT_C_NOT_ZERO, rmaxlabel);      JUMPTO(SLJIT_C_NOT_ZERO, rmax_label);
6588      /* Drop STR_PTR for greedy plus quantifier. */      /* Drop STR_PTR for greedy plus quantifier. */
6589      if (opcode != OP_ONCE)      if (opcode != OP_ONCE)
6590        free_stack(common, 1);        free_stack(common, 1);
# Line 6596  if (ket == OP_KETRMAX) Line 6596  if (ket == OP_KETRMAX)
6596      /* Checking zero-length iteration. */      /* Checking zero-length iteration. */
6597      if (opcode != OP_ONCE)      if (opcode != OP_ONCE)
6598        {        {
6599        CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0, rmaxlabel);        CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0, rmax_label);
6600        /* Drop STR_PTR for greedy plus quantifier. */        /* Drop STR_PTR for greedy plus quantifier. */
6601        if (bra != OP_BRAZERO)        if (bra != OP_BRAZERO)
6602          free_stack(common, 1);          free_stack(common, 1);
6603        }        }
6604      else      else
6605        /* TMP2 must contain the starting STR_PTR. */        /* TMP2 must contain the starting STR_PTR. */
6606        CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, rmaxlabel);        CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, rmax_label);
6607      }      }
6608    else    else
6609      JUMPTO(SLJIT_JUMP, rmaxlabel);      JUMPTO(SLJIT_JUMP, rmax_label);
6610    BACKTRACK_AS(bracket_backtrack)->recursive_matchingpath = LABEL();    BACKTRACK_AS(bracket_backtrack)->recursive_matchingpath = LABEL();
6611    }    }
6612    
6613  if (repeat_type == OP_EXACT)  if (repeat_type == OP_EXACT)
6614    {    {
6615    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1);
6616    JUMPTO(SLJIT_C_NOT_ZERO, rmaxlabel);    JUMPTO(SLJIT_C_NOT_ZERO, rmax_label);
6617    }    }
6618  else if (repeat_type == OP_UPTO)  else if (repeat_type == OP_UPTO)
6619    {    {
# Line 6630  if (bra == OP_BRAMINZERO) Line 6630  if (bra == OP_BRAMINZERO)
6630    {    {
6631    /* This is a backtrack path! (From the viewpoint of OP_BRAMINZERO) */    /* This is a backtrack path! (From the viewpoint of OP_BRAMINZERO) */
6632    JUMPTO(SLJIT_JUMP, ((braminzero_backtrack *)parent)->matchingpath);    JUMPTO(SLJIT_JUMP, ((braminzero_backtrack *)parent)->matchingpath);
6633    if (braminzerojump != NULL)    if (braminzero != NULL)
6634      {      {
6635      JUMPHERE(braminzerojump);      JUMPHERE(braminzero);
6636      /* We need to release the end pointer to perform the      /* We need to release the end pointer to perform the
6637      backtrack for the zero-length iteration. When      backtrack for the zero-length iteration. When
6638      framesize is < 0, OP_ONCE will do the release itself. */      framesize is < 0, OP_ONCE will do the release itself. */
# Line 7962  BOOL needs_control_head = FALSE; Line 7962  BOOL needs_control_head = FALSE;
7962  struct sljit_jump *brazero = NULL;  struct sljit_jump *brazero = NULL;
7963  struct sljit_jump *once = NULL;  struct sljit_jump *once = NULL;
7964  struct sljit_jump *cond = NULL;  struct sljit_jump *cond = NULL;
7965  struct sljit_label *rminlabel = NULL;  struct sljit_label *rmin_label = NULL;
7966  struct sljit_label *exact_label = NULL;  struct sljit_label *exact_label = NULL;
7967    
7968  if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)  if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
# Line 8054  else if (ket == OP_KETRMIN) Line 8054  else if (ket == OP_KETRMIN)
8054      else      else
8055        JUMPTO(SLJIT_JUMP, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);        JUMPTO(SLJIT_JUMP, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
8056      }      }
8057    rminlabel = LABEL();    rmin_label = LABEL();
8058    if (repeat_type != 0)    if (repeat_type != 0)
8059      OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1);      OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1);
8060    }    }
# Line 8385  else if (ket == OP_KETRMIN) Line 8385  else if (ket == OP_KETRMIN)
8385    affect badly the free_stack(2) above. */    affect badly the free_stack(2) above. */
8386    if (opcode != OP_ONCE)    if (opcode != OP_ONCE)
8387      free_stack(common, 1);      free_stack(common, 1);
8388    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, rminlabel);    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, rmin_label);
8389    if (opcode == OP_ONCE)    if (opcode == OP_ONCE)
8390      free_stack(common, bra == OP_BRAMINZERO ? 2 : 1);      free_stack(common, bra == OP_BRAMINZERO ? 2 : 1);
8391    else if (bra == OP_BRAMINZERO)    else if (bra == OP_BRAMINZERO)

Legend:
Removed from v.1306  
changed lines
  Added in v.1307

  ViewVC Help
Powered by ViewVC 1.1.5