/[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 1308 by zherczeg, Tue Apr 2 06:58:55 2013 UTC
# Line 1038  while (cc < ccend) Line 1038  while (cc < ccend)
1038    if (private_data_ptr > SLJIT_MAX_LOCAL_SIZE)    if (private_data_ptr > SLJIT_MAX_LOCAL_SIZE)
1039      return;      return;
1040    
1041    if (*cc == OP_BRA || *cc == OP_CBRA || *cc == OP_ONCE || *cc == OP_ONCE_NC)    if (*cc == OP_ONCE || *cc == OP_ONCE_NC || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND)
1042      if (detect_repeat(common, cc))      if (detect_repeat(common, cc))
1043        {        {
1044        /* These brackets are converted to repeats, so no global        /* These brackets are converted to repeats, so no global
# Line 1496  while (cc < ccend) Line 1496  while (cc < ccend)
1496    size = 0;    size = 0;
1497    switch(*cc)    switch(*cc)
1498      {      {
1499        case OP_KET:
1500        if (PRIVATE_DATA(cc) != 0)
1501          private_data_length++;
1502        cc += 1 + LINK_SIZE;
1503        break;
1504    
1505      case OP_ASSERT:      case OP_ASSERT:
1506      case OP_ASSERT_NOT:      case OP_ASSERT_NOT:
1507      case OP_ASSERTBACK:      case OP_ASSERTBACK:
# Line 1664  do Line 1670  do
1670    
1671      switch(*cc)      switch(*cc)
1672        {        {
1673          case OP_KET:
1674          if (PRIVATE_DATA(cc) != 0)
1675            {
1676            count = 1;
1677            srcw[0] = PRIVATE_DATA(cc);
1678            }
1679          cc += 1 + LINK_SIZE;
1680          break;
1681    
1682        case OP_ASSERT:        case OP_ASSERT:
1683        case OP_ASSERT_NOT:        case OP_ASSERT_NOT:
1684        case OP_ASSERTBACK:        case OP_ASSERTBACK:
# Line 6139  BOOL has_alternatives; Line 6154  BOOL has_alternatives;
6154  BOOL needs_control_head = FALSE;  BOOL needs_control_head = FALSE;
6155  struct sljit_jump *jump;  struct sljit_jump *jump;
6156  struct sljit_jump *skip;  struct sljit_jump *skip;
6157  struct sljit_label *rmaxlabel = NULL;  struct sljit_label *rmax_label = NULL;
6158  struct sljit_jump *braminzerojump = NULL;  struct sljit_jump *braminzero = NULL;
6159    
6160  PUSH_BACKTRACK(sizeof(bracket_backtrack), cc, NULL);  PUSH_BACKTRACK(sizeof(bracket_backtrack), cc, NULL);
6161    
# Line 6255  if (bra == OP_BRAMINZERO) Line 6270  if (bra == OP_BRAMINZERO)
6270    if (ket != OP_KETRMIN)    if (ket != OP_KETRMIN)
6271      {      {
6272      free_stack(common, 1);      free_stack(common, 1);
6273      braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);      braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
6274      }      }
6275    else    else
6276      {      {
# Line 6270  if (bra == OP_BRAMINZERO) Line 6285  if (bra == OP_BRAMINZERO)
6285        if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)        if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)
6286          {          {
6287          /* 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. */
6288          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);
6289          }          }
6290        else        else
6291          {          {
6292          /* Except when the whole stack frame must be saved. */          /* Except when the whole stack frame must be saved. */
6293          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);
6294          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));
6295          }          }
6296        JUMPHERE(skip);        JUMPHERE(skip);
6297        }        }
# Line 6293  if (repeat_type != 0) Line 6308  if (repeat_type != 0)
6308    {    {
6309    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);
6310    if (repeat_type == OP_EXACT)    if (repeat_type == OP_EXACT)
6311      rmaxlabel = LABEL();      rmax_label = LABEL();
6312    }    }
6313    
6314  if (ket == OP_KETRMIN)  if (ket == OP_KETRMIN)
# Line 6301  if (ket == OP_KETRMIN) Line 6316  if (ket == OP_KETRMIN)
6316    
6317  if (ket == OP_KETRMAX)  if (ket == OP_KETRMAX)
6318    {    {
6319    rmaxlabel = LABEL();    rmax_label = LABEL();
6320    if (has_alternatives && opcode != OP_ONCE && opcode < OP_SBRA && repeat_type == 0)    if (has_alternatives && opcode != OP_ONCE && opcode < OP_SBRA && repeat_type == 0)
6321      BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = rmaxlabel;      BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = rmax_label;
6322    }    }
6323    
6324  /* Handling capturing brackets and alternatives. */  /* Handling capturing brackets and alternatives. */
# Line 6584  if (ket == OP_KETRMAX) Line 6599  if (ket == OP_KETRMAX)
6599      if (has_alternatives)      if (has_alternatives)
6600        BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();        BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
6601      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);
6602      JUMPTO(SLJIT_C_NOT_ZERO, rmaxlabel);      JUMPTO(SLJIT_C_NOT_ZERO, rmax_label);
6603      /* Drop STR_PTR for greedy plus quantifier. */      /* Drop STR_PTR for greedy plus quantifier. */
6604      if (opcode != OP_ONCE)      if (opcode != OP_ONCE)
6605        free_stack(common, 1);        free_stack(common, 1);
# Line 6596  if (ket == OP_KETRMAX) Line 6611  if (ket == OP_KETRMAX)
6611      /* Checking zero-length iteration. */      /* Checking zero-length iteration. */
6612      if (opcode != OP_ONCE)      if (opcode != OP_ONCE)
6613        {        {
6614        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);
6615        /* Drop STR_PTR for greedy plus quantifier. */        /* Drop STR_PTR for greedy plus quantifier. */
6616        if (bra != OP_BRAZERO)        if (bra != OP_BRAZERO)
6617          free_stack(common, 1);          free_stack(common, 1);
6618        }        }
6619      else      else
6620        /* TMP2 must contain the starting STR_PTR. */        /* TMP2 must contain the starting STR_PTR. */
6621        CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, rmaxlabel);        CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, rmax_label);
6622      }      }
6623    else    else
6624      JUMPTO(SLJIT_JUMP, rmaxlabel);      JUMPTO(SLJIT_JUMP, rmax_label);
6625    BACKTRACK_AS(bracket_backtrack)->recursive_matchingpath = LABEL();    BACKTRACK_AS(bracket_backtrack)->recursive_matchingpath = LABEL();
6626    }    }
6627    
6628  if (repeat_type == OP_EXACT)  if (repeat_type == OP_EXACT)
6629    {    {
6630    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);
6631    JUMPTO(SLJIT_C_NOT_ZERO, rmaxlabel);    JUMPTO(SLJIT_C_NOT_ZERO, rmax_label);
6632    }    }
6633  else if (repeat_type == OP_UPTO)  else if (repeat_type == OP_UPTO)
6634    {    {
# Line 6630  if (bra == OP_BRAMINZERO) Line 6645  if (bra == OP_BRAMINZERO)
6645    {    {
6646    /* This is a backtrack path! (From the viewpoint of OP_BRAMINZERO) */    /* This is a backtrack path! (From the viewpoint of OP_BRAMINZERO) */
6647    JUMPTO(SLJIT_JUMP, ((braminzero_backtrack *)parent)->matchingpath);    JUMPTO(SLJIT_JUMP, ((braminzero_backtrack *)parent)->matchingpath);
6648    if (braminzerojump != NULL)    if (braminzero != NULL)
6649      {      {
6650      JUMPHERE(braminzerojump);      JUMPHERE(braminzero);
6651      /* We need to release the end pointer to perform the      /* We need to release the end pointer to perform the
6652      backtrack for the zero-length iteration. When      backtrack for the zero-length iteration. When
6653      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 7977  BOOL needs_control_head = FALSE;
7977  struct sljit_jump *brazero = NULL;  struct sljit_jump *brazero = NULL;
7978  struct sljit_jump *once = NULL;  struct sljit_jump *once = NULL;
7979  struct sljit_jump *cond = NULL;  struct sljit_jump *cond = NULL;
7980  struct sljit_label *rminlabel = NULL;  struct sljit_label *rmin_label = NULL;
7981  struct sljit_label *exact_label = NULL;  struct sljit_label *exact_label = NULL;
7982    
7983  if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)  if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
# Line 8054  else if (ket == OP_KETRMIN) Line 8069  else if (ket == OP_KETRMIN)
8069      else      else
8070        JUMPTO(SLJIT_JUMP, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);        JUMPTO(SLJIT_JUMP, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
8071      }      }
8072    rminlabel = LABEL();    rmin_label = LABEL();
8073    if (repeat_type != 0)    if (repeat_type != 0)
8074      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);
8075    }    }
# Line 8385  else if (ket == OP_KETRMIN) Line 8400  else if (ket == OP_KETRMIN)
8400    affect badly the free_stack(2) above. */    affect badly the free_stack(2) above. */
8401    if (opcode != OP_ONCE)    if (opcode != OP_ONCE)
8402      free_stack(common, 1);      free_stack(common, 1);
8403    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, rminlabel);    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, rmin_label);
8404    if (opcode == OP_ONCE)    if (opcode == OP_ONCE)
8405      free_stack(common, bra == OP_BRAMINZERO ? 2 : 1);      free_stack(common, bra == OP_BRAMINZERO ? 2 : 1);
8406    else if (bra == OP_BRAMINZERO)    else if (bra == OP_BRAMINZERO)

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

  ViewVC Help
Powered by ViewVC 1.1.5