/[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 1084 by chpe, Tue Oct 16 15:55:28 2012 UTC revision 1176 by ph10, Sat Oct 27 15:46:35 2012 UTC
# Line 591  switch(*cc) Line 591  switch(*cc)
591    case OP_NOTPOSPLUSI:    case OP_NOTPOSPLUSI:
592    case OP_NOTPOSQUERYI:    case OP_NOTPOSQUERYI:
593    cc += 2;    cc += 2;
594  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
595    if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);    if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
596  #endif  #endif
597    return cc;    return cc;
# Line 613  switch(*cc) Line 613  switch(*cc)
613    case OP_NOTEXACTI:    case OP_NOTEXACTI:
614    case OP_NOTPOSUPTOI:    case OP_NOTPOSUPTOI:
615    cc += 2 + IMM2_SIZE;    cc += 2 + IMM2_SIZE;
616  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
617    if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);    if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
618  #endif  #endif
619    return cc;    return cc;
# Line 767  int private_data_length = 0; Line 767  int private_data_length = 0;
767  pcre_uchar *alternative;  pcre_uchar *alternative;
768  pcre_uchar *name;  pcre_uchar *name;
769  pcre_uchar *end = NULL;  pcre_uchar *end = NULL;
770  int space, size, bracketlen, i;  int space, size, i;
771    pcre_uint32 bracketlen;
772    
773  /* 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. */
774  while (cc < ccend)  while (cc < ccend)
# Line 936  while (cc < ccend) Line 937  while (cc < ccend)
937      if (size < 0)      if (size < 0)
938        {        {
939        cc += -size;        cc += -size;
940  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
941        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
942  #endif  #endif
943        }        }
# Line 944  while (cc < ccend) Line 945  while (cc < ccend)
945        cc += size;        cc += size;
946      }      }
947    
948    if (bracketlen > 0)    if (bracketlen != 0)
949      {      {
950      if (cc >= end)      if (cc >= end)
951        {        {
# Line 1076  while (cc < ccend) Line 1077  while (cc < ccend)
1077      if (size < 0)      if (size < 0)
1078        {        {
1079        cc += -size;        cc += -size;
1080  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1081        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1082  #endif  #endif
1083        }        }
# Line 1320  while (cc < ccend) Line 1321  while (cc < ccend)
1321      if (PRIVATE_DATA(cc))      if (PRIVATE_DATA(cc))
1322        private_data_length++;        private_data_length++;
1323      cc += 2;      cc += 2;
1324  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1325      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1326  #endif  #endif
1327      break;      break;
# Line 1329  while (cc < ccend) Line 1330  while (cc < ccend)
1330      if (PRIVATE_DATA(cc))      if (PRIVATE_DATA(cc))
1331        private_data_length += 2;        private_data_length += 2;
1332      cc += 2;      cc += 2;
1333  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1334      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1335  #endif  #endif
1336      break;      break;
# Line 1338  while (cc < ccend) Line 1339  while (cc < ccend)
1339      if (PRIVATE_DATA(cc))      if (PRIVATE_DATA(cc))
1340        private_data_length += 2;        private_data_length += 2;
1341      cc += 2 + IMM2_SIZE;      cc += 2 + IMM2_SIZE;
1342  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1343      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1344  #endif  #endif
1345      break;      break;
# Line 1497  while (status != end) Line 1498  while (status != end)
1498          srcw[0] = PRIVATE_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1499          }          }
1500        cc += 2;        cc += 2;
1501  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1502        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1503  #endif  #endif
1504        break;        break;
# Line 1510  while (status != end) Line 1511  while (status != end)
1511          srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);          srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);
1512          }          }
1513        cc += 2;        cc += 2;
1514  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1515        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1516  #endif  #endif
1517        break;        break;
# Line 1523  while (status != end) Line 1524  while (status != end)
1524          srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);          srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);
1525          }          }
1526        cc += 2 + IMM2_SIZE;        cc += 2 + IMM2_SIZE;
1527  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1528        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1529  #endif  #endif
1530        break;        break;
# Line 2452  struct sljit_label *newlinelabel = NULL; Line 2453  struct sljit_label *newlinelabel = NULL;
2453  struct sljit_jump *start;  struct sljit_jump *start;
2454  struct sljit_jump *end = NULL;  struct sljit_jump *end = NULL;
2455  struct sljit_jump *nl = NULL;  struct sljit_jump *nl = NULL;
2456  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2457  struct sljit_jump *singlechar;  struct sljit_jump *singlechar;
2458  #endif  #endif
2459  jump_list *newline = NULL;  jump_list *newline = NULL;
# Line 2643  while (TRUE) Line 2644  while (TRUE)
2644        break;        break;
2645    
2646    len = 1;    len = 1;
2647  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
2648    if (common->utf && HAS_EXTRALEN(cc[0])) len += GET_EXTRALEN(cc[0]);    if (common->utf && HAS_EXTRALEN(cc[0])) len += GET_EXTRALEN(cc[0]);
2649  #endif  #endif
2650    
# Line 3529  if (caseless && char_has_othercase(commo Line 3530  if (caseless && char_has_othercase(commo
3530    othercasechar = cc + (othercasebit >> 8);    othercasechar = cc + (othercasebit >> 8);
3531    othercasebit &= 0xff;    othercasebit &= 0xff;
3532  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
3533      /* Note that this code only handles characters in the BMP. If there
3534      ever are characters outside the BMP whose othercase differs in only one
3535      bit from itself (there currently are none), this code will need to be
3536      revised for COMPILE_PCRE32. */
3537    othercasechar = cc + (othercasebit >> 9);    othercasechar = cc + (othercasebit >> 9);
3538    if ((othercasebit & 0x100) != 0)    if ((othercasebit & 0x100) != 0)
3539      othercasebit = (othercasebit & 0xff) << 8;      othercasebit = (othercasebit & 0xff) << 8;
# Line 3563  if (context->sourcereg == -1) Line 3568  if (context->sourcereg == -1)
3568    
3569  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3570  utflength = 1;  utflength = 1;
 #ifndef COMPILE_PCRE32  
3571  if (common->utf && HAS_EXTRALEN(*cc))  if (common->utf && HAS_EXTRALEN(*cc))
3572    utflength += GET_EXTRALEN(*cc);    utflength += GET_EXTRALEN(*cc);
 #endif  
3573    
3574  do  do
3575    {    {
# Line 3759  while (*cc != XCL_END) Line 3762  while (*cc != XCL_END)
3762    if (*cc == XCL_SINGLE)    if (*cc == XCL_SINGLE)
3763      {      {
3764      cc += 2;      cc += 2;
3765  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
3766      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
3767  #endif  #endif
3768  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 3769  while (*cc != XCL_END) Line 3772  while (*cc != XCL_END)
3772    else if (*cc == XCL_RANGE)    else if (*cc == XCL_RANGE)
3773      {      {
3774      cc += 2;      cc += 2;
3775  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
3776      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
3777  #endif  #endif
3778      cc++;      cc++;
3779  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
3780      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
3781  #endif  #endif
3782  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 4467  switch(type) Line 4470  switch(type)
4470    case OP_CHAR:    case OP_CHAR:
4471    case OP_CHARI:    case OP_CHARI:
4472    length = 1;    length = 1;
4473  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
4474    if (common->utf && HAS_EXTRALEN(*cc)) length += GET_EXTRALEN(*cc);    if (common->utf && HAS_EXTRALEN(*cc)) length += GET_EXTRALEN(*cc);
4475  #endif  #endif
4476    if (common->mode == JIT_COMPILE && (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0))    if (common->mode == JIT_COMPILE && (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0))
# Line 4662  do Line 4665  do
4665    if (*cc == OP_CHAR)    if (*cc == OP_CHAR)
4666      {      {
4667      size = 1;      size = 1;
4668  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
4669      if (common->utf && HAS_EXTRALEN(cc[1]))      if (common->utf && HAS_EXTRALEN(cc[1]))
4670        size += GET_EXTRALEN(cc[1]);        size += GET_EXTRALEN(cc[1]);
4671  #endif  #endif
# Line 4675  do Line 4678  do
4678        {        {
4679        if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)        if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
4680          size = 0;          size = 0;
 #ifndef COMPILE_PCRE32  
4681        else if (HAS_EXTRALEN(cc[1]))        else if (HAS_EXTRALEN(cc[1]))
4682          size += GET_EXTRALEN(cc[1]);          size += GET_EXTRALEN(cc[1]);
 #endif  
4683        }        }
4684      else      else
4685  #endif  #endif
# Line 5331  common->accept = save_accept; Line 5332  common->accept = save_accept;
5332  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
5333  }  }
5334    
5335  static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, pcre_uchar *name_table)  static sljit_w SLJIT_CALL do_searchovector(sljit_uw refno, sljit_w* locals, pcre_uchar *name_table)
5336  {  {
5337  int condition = FALSE;  int condition = FALSE;
5338  pcre_uchar *slotA = name_table;  pcre_uchar *slotA = name_table;
# Line 5388  if (i < name_count) Line 5389  if (i < name_count)
5389  return condition;  return condition;
5390  }  }
5391    
5392  static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, pcre_uchar *name_table)  static sljit_w SLJIT_CALL do_searchgroups(sljit_uw recno, sljit_uw* locals, pcre_uchar *name_table)
5393  {  {
5394  int condition = FALSE;  int condition = FALSE;
5395  pcre_uchar *slotA = name_table;  pcre_uchar *slotA = name_table;
5396  pcre_uchar *slotB;  pcre_uchar *slotB;
5397  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];  sljit_uw name_count = locals[LOCALS0 / sizeof(sljit_w)];
5398  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];  sljit_uw name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];
5399  sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];  sljit_uw group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];
5400  int i;  sljit_uw i;
5401    
5402  for (i = 0; i < name_count; i++)  for (i = 0; i < name_count; i++)
5403    {    {
# Line 5551  if (SLJIT_UNLIKELY(opcode == OP_COND) || Line 5552  if (SLJIT_UNLIKELY(opcode == OP_COND) ||
5552      else if (common->currententry->start == 0)      else if (common->currententry->start == 0)
5553        has_alternatives = stacksize != 0;        has_alternatives = stacksize != 0;
5554      else      else
5555        has_alternatives = stacksize != GET2(common->start, common->currententry->start + 1 + LINK_SIZE);        has_alternatives = stacksize != (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
5556      }      }
5557    }    }
5558    
# Line 5786  if (opcode == OP_COND || opcode == OP_SC Line 5787  if (opcode == OP_COND || opcode == OP_SC
5787      else if (common->currententry->start == 0)      else if (common->currententry->start == 0)
5788        stacksize = stacksize == 0;        stacksize = stacksize == 0;
5789      else      else
5790        stacksize = stacksize == GET2(common->start, common->currententry->start + 1 + LINK_SIZE);        stacksize = stacksize == (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
5791    
5792      if (*matchingpath == OP_RREF || stacksize || common->currententry == NULL)      if (*matchingpath == OP_RREF || stacksize || common->currententry == NULL)
5793        {        {
# Line 6266  if (*type == 0) Line 6267  if (*type == 0)
6267  if (end != NULL)  if (end != NULL)
6268    {    {
6269    *end = cc + 1;    *end = cc + 1;
6270  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
6271    if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc);    if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc);
6272  #endif  #endif
6273    }    }

Legend:
Removed from v.1084  
changed lines
  Added in v.1176

  ViewVC Help
Powered by ViewVC 1.1.5