/[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 977 by zherczeg, Sun Jun 17 06:20:52 2012 UTC revision 986 by zherczeg, Sat Jul 7 03:33:54 2012 UTC
# Line 667  switch(*cc) Line 667  switch(*cc)
667    }    }
668  }  }
669    
670    #define CASE_ITERATOR_LOCAL1 \
671        case OP_MINSTAR: \
672        case OP_MINPLUS: \
673        case OP_QUERY: \
674        case OP_MINQUERY: \
675        case OP_MINSTARI: \
676        case OP_MINPLUSI: \
677        case OP_QUERYI: \
678        case OP_MINQUERYI: \
679        case OP_NOTMINSTAR: \
680        case OP_NOTMINPLUS: \
681        case OP_NOTQUERY: \
682        case OP_NOTMINQUERY: \
683        case OP_NOTMINSTARI: \
684        case OP_NOTMINPLUSI: \
685        case OP_NOTQUERYI: \
686        case OP_NOTMINQUERYI:
687    
688    #define CASE_ITERATOR_LOCAL2A \
689        case OP_STAR: \
690        case OP_PLUS: \
691        case OP_STARI: \
692        case OP_PLUSI: \
693        case OP_NOTSTAR: \
694        case OP_NOTPLUS: \
695        case OP_NOTSTARI: \
696        case OP_NOTPLUSI:
697    
698    #define CASE_ITERATOR_LOCAL2B \
699        case OP_UPTO: \
700        case OP_MINUPTO: \
701        case OP_UPTOI: \
702        case OP_MINUPTOI: \
703        case OP_NOTUPTO: \
704        case OP_NOTMINUPTO: \
705        case OP_NOTUPTOI: \
706        case OP_NOTMINUPTOI:
707    
708    #define CASE_ITERATOR_TYPE_LOCAL1 \
709        case OP_TYPEMINSTAR: \
710        case OP_TYPEMINPLUS: \
711        case OP_TYPEQUERY: \
712        case OP_TYPEMINQUERY:
713    
714    #define CASE_ITERATOR_TYPE_LOCAL2A \
715        case OP_TYPESTAR: \
716        case OP_TYPEPLUS:
717    
718    #define CASE_ITERATOR_TYPE_LOCAL2B \
719        case OP_TYPEUPTO: \
720        case OP_TYPEMINUPTO:
721    
722    static int get_class_iterator_size(pcre_uchar *cc)
723    {
724    switch(*cc)
725      {
726      case OP_CRSTAR:
727      case OP_CRPLUS:
728      return 2;
729    
730      case OP_CRMINSTAR:
731      case OP_CRMINPLUS:
732      case OP_CRQUERY:
733      case OP_CRMINQUERY:
734      return 1;
735    
736      case OP_CRRANGE:
737      case OP_CRMINRANGE:
738      if (GET2(cc, 1) == GET2(cc, 1 + IMM2_SIZE))
739        return 0;
740      return 2;
741    
742      default:
743      return 0;
744      }
745    }
746    
747  static int get_localspace(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)  static int get_localspace(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
748  {  {
749  int localspace = 0;  int localspace = 0;
750  pcre_uchar *alternative;  pcre_uchar *alternative;
751    pcre_uchar *end = NULL;
752    int space, size, bracketlen;
753    
754  /* 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. */
755  while (cc < ccend)  while (cc < ccend)
756    {    {
757      space = 0;
758      size = 0;
759      bracketlen = 0;
760    switch(*cc)    switch(*cc)
761      {      {
762      case OP_SET_SOM:      case OP_SET_SOM:
# Line 692  while (cc < ccend) Line 775  while (cc < ccend)
775      case OP_SBRAPOS:      case OP_SBRAPOS:
776      case OP_SCOND:      case OP_SCOND:
777      localspace += sizeof(sljit_w);      localspace += sizeof(sljit_w);
778      cc += 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
779      break;      break;
780    
781      case OP_CBRAPOS:      case OP_CBRAPOS:
782      case OP_SCBRAPOS:      case OP_SCBRAPOS:
783      localspace += sizeof(sljit_w);      localspace += sizeof(sljit_w);
784      cc += 1 + LINK_SIZE + IMM2_SIZE;      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
785      break;      break;
786    
787      case OP_COND:      case OP_COND:
# Line 706  while (cc < ccend) Line 789  while (cc < ccend)
789      alternative = cc + GET(cc, 1);      alternative = cc + GET(cc, 1);
790      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
791        localspace += sizeof(sljit_w);        localspace += sizeof(sljit_w);
792      cc += 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
793        break;
794    
795        case OP_BRA:
796        bracketlen = 1 + LINK_SIZE;
797        break;
798    
799        case OP_CBRA:
800        case OP_SCBRA:
801        bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
802        break;
803    
804        CASE_ITERATOR_LOCAL1
805        space = 1;
806        size = -2;
807        break;
808    
809        CASE_ITERATOR_LOCAL2A
810        space = 2;
811        size = -2;
812        break;
813    
814        CASE_ITERATOR_LOCAL2B
815        space = 2;
816        size = -(2 + IMM2_SIZE);
817        break;
818    
819        CASE_ITERATOR_TYPE_LOCAL1
820        space = 1;
821        size = 1;
822      break;      break;
823    
824        CASE_ITERATOR_TYPE_LOCAL2A
825        if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)
826          space = 2;
827        size = 1;
828        break;
829    
830        CASE_ITERATOR_TYPE_LOCAL2B
831        if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)
832          space = 2;
833        size = 1 + IMM2_SIZE;
834        break;
835    
836        case OP_CLASS:
837        case OP_NCLASS:
838        size += 1 + 32 / sizeof(pcre_uchar);
839        space = get_class_iterator_size(cc + size);
840        break;
841    
842    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
843        case OP_XCLASS:
844        size = GET(cc, 1);
845        space = get_class_iterator_size(cc + size);
846        break;
847    #endif
848    
849      case OP_RECURSE:      case OP_RECURSE:
850      /* Set its value only once. */      /* Set its value only once. */
851      if (common->recursive_head == 0)      if (common->recursive_head == 0)
# Line 734  while (cc < ccend) Line 871  while (cc < ccend)
871        return -1;        return -1;
872      break;      break;
873      }      }
874    
875      if (space > 0 && cc >= end)
876        localspace += sizeof(sljit_w) * space;
877    
878      if (size != 0)
879        {
880        if (size < 0)
881          {
882          cc += -size;
883    #ifdef SUPPORT_UTF
884          if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
885    #endif
886          }
887        else
888          cc += size;
889        }
890    
891      if (bracketlen > 0)
892        {
893        if (cc >= end)
894          {
895          end = bracketend(cc);
896          if (end[-1 - LINK_SIZE] == OP_KET)
897            end = NULL;
898          }
899        cc += bracketlen;
900        }
901    }    }
902  return localspace;  return localspace;
903  }  }
# Line 742  static void set_localptrs(compiler_commo Line 906  static void set_localptrs(compiler_commo
906  {  {
907  pcre_uchar *cc = common->start;  pcre_uchar *cc = common->start;
908  pcre_uchar *alternative;  pcre_uchar *alternative;
909    pcre_uchar *end = NULL;
910    int space, size, bracketlen;
911    
912  while (cc < ccend)  while (cc < ccend)
913    {    {
914      space = 0;
915      size = 0;
916      bracketlen = 0;
917    switch(*cc)    switch(*cc)
918      {      {
919      case OP_ASSERT:      case OP_ASSERT:
# Line 758  while (cc < ccend) Line 928  while (cc < ccend)
928      case OP_SCOND:      case OP_SCOND:
929      common->localptrs[cc - common->start] = localptr;      common->localptrs[cc - common->start] = localptr;
930      localptr += sizeof(sljit_w);      localptr += sizeof(sljit_w);
931      cc += 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
932      break;      break;
933    
934      case OP_CBRAPOS:      case OP_CBRAPOS:
935      case OP_SCBRAPOS:      case OP_SCBRAPOS:
936      common->localptrs[cc - common->start] = localptr;      common->localptrs[cc - common->start] = localptr;
937      localptr += sizeof(sljit_w);      localptr += sizeof(sljit_w);
938      cc += 1 + LINK_SIZE + IMM2_SIZE;      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
939      break;      break;
940    
941      case OP_COND:      case OP_COND:
# Line 776  while (cc < ccend) Line 946  while (cc < ccend)
946        common->localptrs[cc - common->start] = localptr;        common->localptrs[cc - common->start] = localptr;
947        localptr += sizeof(sljit_w);        localptr += sizeof(sljit_w);
948        }        }
949      cc += 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
950      break;      break;
951    
952        case OP_BRA:
953        bracketlen = 1 + LINK_SIZE;
954        break;
955    
956        case OP_CBRA:
957        case OP_SCBRA:
958        bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
959        break;
960    
961        CASE_ITERATOR_LOCAL1
962        space = 1;
963        size = -2;
964        break;
965    
966        CASE_ITERATOR_LOCAL2A
967        space = 2;
968        size = -2;
969        break;
970    
971        CASE_ITERATOR_LOCAL2B
972        space = 2;
973        size = -(2 + IMM2_SIZE);
974        break;
975    
976        CASE_ITERATOR_TYPE_LOCAL1
977        space = 1;
978        size = 1;
979        break;
980    
981        CASE_ITERATOR_TYPE_LOCAL2A
982        if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)
983          space = 2;
984        size = 1;
985        break;
986    
987        CASE_ITERATOR_TYPE_LOCAL2B
988        if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)
989          space = 2;
990        size = 1 + IMM2_SIZE;
991        break;
992    
993        case OP_CLASS:
994        case OP_NCLASS:
995        size += 1 + 32 / sizeof(pcre_uchar);
996        space = get_class_iterator_size(cc + size);
997        break;
998    
999    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
1000        case OP_XCLASS:
1001        size = GET(cc, 1);
1002        space = get_class_iterator_size(cc + size);
1003        break;
1004    #endif
1005    
1006      default:      default:
1007      cc = next_opcode(common, cc);      cc = next_opcode(common, cc);
1008      SLJIT_ASSERT(cc != NULL);      SLJIT_ASSERT(cc != NULL);
1009      break;      break;
1010      }      }
1011    
1012      if (space > 0 && cc >= end)
1013        {
1014        common->localptrs[cc - common->start] = localptr;
1015        localptr += sizeof(sljit_w) * space;
1016        }
1017    
1018      if (size != 0)
1019        {
1020        if (size < 0)
1021          {
1022          cc += -size;
1023    #ifdef SUPPORT_UTF
1024          if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1025    #endif
1026          }
1027        else
1028          cc += size;
1029        }
1030    
1031      if (bracketlen > 0)
1032        {
1033        if (cc >= end)
1034          {
1035          end = bracketend(cc);
1036          if (end[-1 - LINK_SIZE] == OP_KET)
1037            end = NULL;
1038          }
1039        cc += bracketlen;
1040        }
1041    }    }
1042  }  }
1043    
# Line 963  SLJIT_ASSERT(stackpos == STACK(stacktop) Line 1217  SLJIT_ASSERT(stackpos == STACK(stacktop)
1217  static SLJIT_INLINE int get_localsize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)  static SLJIT_INLINE int get_localsize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
1218  {  {
1219  int localsize = 2;  int localsize = 2;
1220    int size;
1221  pcre_uchar *alternative;  pcre_uchar *alternative;
1222  /* Calculate the sum of the local variables. */  /* Calculate the sum of the local variables. */
1223  while (cc < ccend)  while (cc < ccend)
1224    {    {
1225      size = 0;
1226    switch(*cc)    switch(*cc)
1227      {      {
1228      case OP_ASSERT:      case OP_ASSERT:
# Line 1003  while (cc < ccend) Line 1259  while (cc < ccend)
1259      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
1260      break;      break;
1261    
1262        CASE_ITERATOR_LOCAL1
1263        if (PRIV_DATA(cc))
1264          localsize++;
1265        cc += 2;
1266    #ifdef SUPPORT_UTF
1267        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1268    #endif
1269        break;
1270    
1271        CASE_ITERATOR_LOCAL2A
1272        if (PRIV_DATA(cc))
1273          localsize += 2;
1274        cc += 2;
1275    #ifdef SUPPORT_UTF
1276        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1277    #endif
1278        break;
1279    
1280        CASE_ITERATOR_LOCAL2B
1281        if (PRIV_DATA(cc))
1282          localsize += 2;
1283        cc += 2 + IMM2_SIZE;
1284    #ifdef SUPPORT_UTF
1285        if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1286    #endif
1287        break;
1288    
1289        CASE_ITERATOR_TYPE_LOCAL1
1290        if (PRIV_DATA(cc))
1291          localsize++;
1292        cc += 1;
1293        break;
1294    
1295        CASE_ITERATOR_TYPE_LOCAL2A
1296        if (PRIV_DATA(cc))
1297          localsize += 2;
1298        cc += 1;
1299        break;
1300    
1301        CASE_ITERATOR_TYPE_LOCAL2B
1302        if (PRIV_DATA(cc))
1303          localsize += 2;
1304        cc += 1 + IMM2_SIZE;
1305        break;
1306    
1307        case OP_CLASS:
1308        case OP_NCLASS:
1309    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
1310        case OP_XCLASS:
1311        size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / sizeof(pcre_uchar);
1312    #else
1313        size = 1 + 32 / sizeof(pcre_uchar);
1314    #endif
1315        if (PRIV_DATA(cc))
1316          localsize += get_class_iterator_size(cc + size);
1317        cc += size;
1318        break;
1319    
1320      default:      default:
1321      cc = next_opcode(common, cc);      cc = next_opcode(common, cc);
1322      SLJIT_ASSERT(cc != NULL);      SLJIT_ASSERT(cc != NULL);
# Line 1018  static void copy_locals(compiler_common Line 1332  static void copy_locals(compiler_common
1332  {  {
1333  DEFINE_COMPILER;  DEFINE_COMPILER;
1334  int srcw[2];  int srcw[2];
1335  int count;  int count, size;
1336  BOOL tmp1next = TRUE;  BOOL tmp1next = TRUE;
1337  BOOL tmp1empty = TRUE;  BOOL tmp1empty = TRUE;
1338  BOOL tmp2empty = TRUE;  BOOL tmp2empty = TRUE;
# Line 1098  while (status != end) Line 1412  while (status != end)
1412        case OP_CBRAPOS:        case OP_CBRAPOS:
1413        case OP_SCBRAPOS:        case OP_SCBRAPOS:
1414        count = 2;        count = 2;
1415        srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));        srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
1416        srcw[0] = PRIV_DATA(cc);        srcw[1] = PRIV_DATA(cc);
1417        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0);
1418        cc += 1 + LINK_SIZE + IMM2_SIZE;        cc += 1 + LINK_SIZE + IMM2_SIZE;
1419        break;        break;
# Line 1116  while (status != end) Line 1430  while (status != end)
1430        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
1431        break;        break;
1432    
1433          CASE_ITERATOR_LOCAL1
1434          if (PRIV_DATA(cc))
1435            {
1436            count = 1;
1437            srcw[0] = PRIV_DATA(cc);
1438            }
1439          cc += 2;
1440    #ifdef SUPPORT_UTF
1441          if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1442    #endif
1443          break;
1444    
1445          CASE_ITERATOR_LOCAL2A
1446          if (PRIV_DATA(cc))
1447            {
1448            count = 2;
1449            srcw[0] = PRIV_DATA(cc);
1450            srcw[1] = PRIV_DATA(cc) + sizeof(sljit_w);
1451            }
1452          cc += 2;
1453    #ifdef SUPPORT_UTF
1454          if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1455    #endif
1456          break;
1457    
1458          CASE_ITERATOR_LOCAL2B
1459          if (PRIV_DATA(cc))
1460            {
1461            count = 2;
1462            srcw[0] = PRIV_DATA(cc);
1463            srcw[1] = PRIV_DATA(cc) + sizeof(sljit_w);
1464            }
1465          cc += 2 + IMM2_SIZE;
1466    #ifdef SUPPORT_UTF
1467          if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1468    #endif
1469          break;
1470    
1471          CASE_ITERATOR_TYPE_LOCAL1
1472          if (PRIV_DATA(cc))
1473            {
1474            count = 1;
1475            srcw[0] = PRIV_DATA(cc);
1476            }
1477          cc += 1;
1478          break;
1479    
1480          CASE_ITERATOR_TYPE_LOCAL2A
1481          if (PRIV_DATA(cc))
1482            {
1483            count = 2;
1484            srcw[0] = PRIV_DATA(cc);
1485            srcw[1] = srcw[0] + sizeof(sljit_w);
1486            }
1487          cc += 1;
1488          break;
1489    
1490          CASE_ITERATOR_TYPE_LOCAL2B
1491          if (PRIV_DATA(cc))
1492            {
1493            count = 2;
1494            srcw[0] = PRIV_DATA(cc);
1495            srcw[1] = srcw[0] + sizeof(sljit_w);
1496            }
1497          cc += 1 + IMM2_SIZE;
1498          break;
1499    
1500          case OP_CLASS:
1501          case OP_NCLASS:
1502    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
1503          case OP_XCLASS:
1504          size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / sizeof(pcre_uchar);
1505    #else
1506          size = 1 + 32 / sizeof(pcre_uchar);
1507    #endif
1508          if (PRIV_DATA(cc))
1509            switch(get_class_iterator_size(cc + size))
1510              {
1511              case 1:
1512              count = 1;
1513              srcw[0] = PRIV_DATA(cc);
1514              break;
1515    
1516              case 2:
1517              count = 2;
1518              srcw[0] = PRIV_DATA(cc);
1519              srcw[1] = srcw[0] + sizeof(sljit_w);
1520              break;
1521    
1522              default:
1523              SLJIT_ASSERT_STOP();
1524              break;
1525              }
1526          cc += size;
1527          break;
1528    
1529        default:        default:
1530        cc = next_opcode(common, cc);        cc = next_opcode(common, cc);
1531        SLJIT_ASSERT(cc != NULL);        SLJIT_ASSERT(cc != NULL);
# Line 1218  if (save) Line 1628  if (save)
1628  SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));  SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));
1629  }  }
1630    
1631    #undef CASE_ITERATOR_LOCAL1
1632    #undef CASE_ITERATOR_LOCAL2A
1633    #undef CASE_ITERATOR_LOCAL2B
1634    #undef CASE_ITERATOR_TYPE_LOCAL1
1635    #undef CASE_ITERATOR_TYPE_LOCAL2A
1636    #undef CASE_ITERATOR_TYPE_LOCAL2B
1637    
1638  static SLJIT_INLINE BOOL ispowerof2(unsigned int value)  static SLJIT_INLINE BOOL ispowerof2(unsigned int value)
1639  {  {
1640  return (value & (value - 1)) == 0;  return (value & (value - 1)) == 0;
# Line 2089  if (newlinecheck) Line 2506  if (newlinecheck)
2506  return mainloop;  return mainloop;
2507  }  }
2508    
2509    static SLJIT_INLINE BOOL fast_forward_first_two_chars(compiler_common *common, BOOL firstline)
2510    {
2511    DEFINE_COMPILER;
2512    struct sljit_label *start;
2513    struct sljit_jump *leave;
2514    struct sljit_jump *found;
2515    pcre_int32 chars[4];
2516    pcre_uchar *cc = common->start + 1 + IMM2_SIZE;
2517    int index = 0;
2518    pcre_int32 len, c, bit;
2519    unsigned int caseless;
2520    BOOL must_end;
2521    
2522    #ifdef COMPILE_PCRE8
2523    union {
2524        sljit_uh ascombined;
2525        sljit_ub asuchars[2];
2526    } pair;
2527    #else
2528    union {
2529        sljit_ui ascombined;
2530        sljit_uh asuchars[2];
2531    } pair;
2532    #endif
2533    
2534    if (*(common->start + GET(common->start, 1)) == OP_ALT)
2535      return FALSE;
2536    
2537    while (TRUE)
2538      {
2539      caseless = 0;
2540      must_end = TRUE;
2541      switch(*cc)
2542        {
2543        case OP_CHAR:
2544        must_end = FALSE;
2545        cc++;
2546        break;
2547    
2548        case OP_CHARI:
2549        caseless = 1;
2550        must_end = FALSE;
2551        cc++;
2552        break;
2553    
2554        case OP_SOD:
2555        case OP_SOM:
2556        case OP_SET_SOM:
2557        case OP_NOT_WORD_BOUNDARY:
2558        case OP_WORD_BOUNDARY:
2559        case OP_EODN:
2560        case OP_EOD:
2561        case OP_CIRC:
2562        case OP_CIRCM:
2563        case OP_DOLL:
2564        case OP_DOLLM:
2565        /* Zero width assertions. */
2566        cc++;
2567        continue;
2568    
2569        case OP_PLUS:
2570        case OP_MINPLUS:
2571        case OP_POSPLUS:
2572        cc++;
2573        break;
2574    
2575        case OP_EXACT:
2576        cc += 1 + IMM2_SIZE;
2577        break;
2578    
2579        case OP_PLUSI:
2580        case OP_MINPLUSI:
2581        case OP_POSPLUSI:
2582        caseless = 1;
2583        cc++;
2584        break;
2585    
2586        case OP_EXACTI:
2587        caseless = 1;
2588        cc += 1 + IMM2_SIZE;
2589        break;
2590    
2591        default:
2592        return FALSE;
2593        }
2594    
2595      len = 1;
2596    #ifdef SUPPORT_UTF
2597      if (common->utf && HAS_EXTRALEN(cc[0])) len += GET_EXTRALEN(cc[0]);
2598    #endif
2599    
2600      if (caseless && char_has_othercase(common, cc))
2601        {
2602        caseless = char_get_othercase_bit(common, cc);
2603        if (caseless == 0)
2604          return FALSE;
2605    #ifdef COMPILE_PCRE8
2606        caseless = ((caseless & 0xff) << 8) | (len - (caseless >> 8));
2607    #else
2608        if ((caseless & 0x100) != 0)
2609          caseless = ((caseless & 0xff) << 16) | (len - (caseless >> 9));
2610        else
2611          caseless = ((caseless & 0xff) << 8) | (len - (caseless >> 9));
2612    #endif
2613        }
2614      else
2615        caseless = 0;
2616    
2617      while (len > 0 && index < 2 * 2)
2618        {
2619        c = *cc;
2620        bit = 0;
2621        if (len == (caseless & 0xff))
2622          {
2623          bit = caseless >> 8;
2624          c |= bit;
2625          }
2626    
2627        chars[index] = c;
2628        chars[index + 1] = bit;
2629    
2630        len--;
2631        index += 2;
2632        cc++;
2633        }
2634    
2635      if (index == 2 * 2)
2636        break;
2637      else if (must_end)
2638        return FALSE;
2639      }
2640    
2641    if (firstline)
2642      {
2643      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, STR_END, 0);
2644      OP2(SLJIT_SUB, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, SLJIT_IMM, 1);
2645      }
2646    else
2647      OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, 1);
2648    
2649    start = LABEL();
2650    leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
2651    #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2652    #ifdef COMPILE_PCRE8
2653    OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2654    #else /* COMPILE_PCRE8 */
2655    OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2656    #endif
2657    
2658    #else /* SLJIT_UNALIGNED */
2659    
2660    #if defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN
2661    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
2662    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2663    #else /* SLJIT_BIG_ENDIAN */
2664    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2665    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2666    #endif /* SLJIT_BIG_ENDIAN */
2667    
2668    #ifdef COMPILE_PCRE8
2669    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 8);
2670    #else /* COMPILE_PCRE8 */
2671    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 16);
2672    #endif
2673    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2674    
2675    #endif
2676    
2677    if (chars[1] != 0 || chars[3] != 0)
2678      {
2679      pair.asuchars[0] = chars[1];
2680      pair.asuchars[1] = chars[3];
2681      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, pair.ascombined);
2682      }
2683    
2684    pair.asuchars[0] = chars[0];
2685    pair.asuchars[1] = chars[2];
2686    found = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, pair.ascombined);
2687    
2688    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2689    JUMPTO(SLJIT_JUMP, start);
2690    JUMPHERE(found);
2691    JUMPHERE(leave);
2692    
2693    if (firstline)
2694      OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0);
2695    OP2(SLJIT_ADD, STR_END, 0, STR_END, 0, SLJIT_IMM, 1);
2696    return TRUE;
2697    }
2698    
2699  static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, pcre_uchar first_char, BOOL caseless, BOOL firstline)  static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, pcre_uchar first_char, BOOL caseless, BOOL firstline)
2700  {  {
2701  DEFINE_COMPILER;  DEFINE_COMPILER;
# Line 2137  else Line 2744  else
2744    }    }
2745    
2746  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
 #if defined SUPPORT_UTF && defined COMPILE_PCRE8  
 if (common->utf)  
   {  
   CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);  
   OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);  
   OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);  
   }  
 #endif  
 #if defined SUPPORT_UTF && defined COMPILE_PCRE16  
 if (common->utf)  
   {  
   CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);  
   OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);  
   OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);  
   COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);  
   OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);  
   OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);  
   }  
 #endif  
2747  JUMPTO(SLJIT_JUMP, start);  JUMPTO(SLJIT_JUMP, start);
2748  JUMPHERE(found);  JUMPHERE(found);
2749  JUMPHERE(leave);  JUMPHERE(leave);
# Line 5390  pcre_uchar* end; Line 5978  pcre_uchar* end;
5978  jump_list *nomatch = NULL;  jump_list *nomatch = NULL;
5979  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
5980  struct sljit_label *label;  struct sljit_label *label;
5981    int localptr = PRIV_DATA(cc);
5982    int base = (localptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG);
5983    int offset0 = (localptr == 0) ? STACK(0) : localptr;
5984    int offset1 = (localptr == 0) ? STACK(1) : localptr + sizeof(sljit_w);
5985    
5986  PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);  PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
5987    
# Line 5403  switch(opcode) Line 5995  switch(opcode)
5995    case OP_CRRANGE:    case OP_CRRANGE:
5996    if (type == OP_ANYNL || type == OP_EXTUNI)    if (type == OP_ANYNL || type == OP_EXTUNI)
5997      {      {
5998        SLJIT_ASSERT(localptr == 0);
5999      if (opcode == OP_STAR || opcode == OP_UPTO)      if (opcode == OP_STAR || opcode == OP_UPTO)
6000        {        {
6001        allocate_stack(common, 2);        allocate_stack(common, 2);
# Line 5440  switch(opcode) Line 6033  switch(opcode)
6033      {      {
6034      if (opcode == OP_PLUS)      if (opcode == OP_PLUS)
6035        compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);        compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);
6036      allocate_stack(common, 2);      if (localptr == 0)
6037      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);        allocate_stack(common, 2);
6038      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6039        OP1(SLJIT_MOV, base, offset1, SLJIT_IMM, 1);
6040      label = LABEL();      label = LABEL();
6041      compile_char1_trypath(common, type, cc, &nomatch);      compile_char1_trypath(common, type, cc, &nomatch);
6042      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6043      if (opcode <= OP_PLUS || (opcode == OP_CRRANGE && arg1 == 0))      if (opcode <= OP_PLUS || (opcode == OP_CRRANGE && arg1 == 0))
6044        {        {
6045        OP2(SLJIT_ADD, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);        OP2(SLJIT_ADD, base, offset1, base, offset1, SLJIT_IMM, 1);
6046        JUMPTO(SLJIT_JUMP, label);        JUMPTO(SLJIT_JUMP, label);
6047        }        }
6048      else      else
6049        {        {
6050        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));        OP1(SLJIT_MOV, TMP1, 0, base, offset1);
6051        OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);        OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
6052        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);        OP1(SLJIT_MOV, base, offset1, TMP1, 0);
6053        CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 1, label);        CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 1, label);
6054        }        }
6055      set_jumps(nomatch, LABEL());      set_jumps(nomatch, LABEL());
6056      if (opcode == OP_CRRANGE)      if (opcode == OP_CRRANGE)
6057        add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_LESS, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, arg2 + 1));        add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_LESS, base, offset1, SLJIT_IMM, arg2 + 1));
6058      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6059      }      }
6060    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();
6061    break;    break;
# Line 5470  switch(opcode) Line 6064  switch(opcode)
6064    case OP_MINPLUS:    case OP_MINPLUS:
6065    if (opcode == OP_MINPLUS)    if (opcode == OP_MINPLUS)
6066      compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);      compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);
6067    allocate_stack(common, 1);    if (localptr == 0)
6068    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      allocate_stack(common, 1);
6069      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6070    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();
6071    break;    break;
6072    
6073    case OP_MINUPTO:    case OP_MINUPTO:
6074    case OP_CRMINRANGE:    case OP_CRMINRANGE:
6075    allocate_stack(common, 2);    if (localptr == 0)
6076    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      allocate_stack(common, 2);
6077    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6078      OP1(SLJIT_MOV, base, offset1, SLJIT_IMM, 1);
6079    if (opcode == OP_CRMINRANGE)    if (opcode == OP_CRMINRANGE)
6080      add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_JUMP));      add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_JUMP));
6081    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();
# Line 5487  switch(opcode) Line 6083  switch(opcode)
6083    
6084    case OP_QUERY:    case OP_QUERY:
6085    case OP_MINQUERY:    case OP_MINQUERY:
6086    allocate_stack(common, 1);    if (localptr == 0)
6087    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      allocate_stack(common, 1);
6088      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6089    if (opcode == OP_QUERY)    if (opcode == OP_QUERY)
6090      compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);      compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);
6091    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();
# Line 5888  int arg1 = -1, arg2 = -1; Line 6485  int arg1 = -1, arg2 = -1;
6485  struct sljit_label *label = NULL;  struct sljit_label *label = NULL;
6486  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
6487  jump_list *jumplist = NULL;  jump_list *jumplist = NULL;
6488    int localptr = PRIV_DATA(cc);
6489    int base = (localptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG);
6490    int offset0 = (localptr == 0) ? STACK(0) : localptr;
6491    int offset1 = (localptr == 0) ? STACK(1) : localptr + sizeof(sljit_w);
6492    
6493  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);
6494    
# Line 5899  switch(opcode) Line 6500  switch(opcode)
6500    case OP_CRRANGE:    case OP_CRRANGE:
6501    if (type == OP_ANYNL || type == OP_EXTUNI)    if (type == OP_ANYNL || type == OP_EXTUNI)
6502      {      {
6503        SLJIT_ASSERT(localptr == 0);
6504      set_jumps(current->topbacktracks, LABEL());      set_jumps(current->topbacktracks, LABEL());
6505      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6506      free_stack(common, 1);      free_stack(common, 1);
# Line 5908  switch(opcode) Line 6510  switch(opcode)
6510      {      {
6511      if (opcode <= OP_PLUS || opcode == OP_UPTO)      if (opcode <= OP_PLUS || opcode == OP_UPTO)
6512        arg2 = 0;        arg2 = 0;
6513      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));      OP1(SLJIT_MOV, TMP1, 0, base, offset1);
6514      jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, arg2 + 1);      jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, arg2 + 1);
6515      OP2(SLJIT_SUB, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0, SLJIT_IMM, 1);      OP2(SLJIT_SUB, base, offset1, TMP1, 0, SLJIT_IMM, 1);
6516      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6517      skip_char_back(common);      skip_char_back(common);
6518      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6519      JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);      JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
6520      if (opcode == OP_CRRANGE)      if (opcode == OP_CRRANGE)
6521        set_jumps(current->topbacktracks, LABEL());        set_jumps(current->topbacktracks, LABEL());
6522      JUMPHERE(jump);      JUMPHERE(jump);
6523      free_stack(common, 2);      if (localptr == 0)
6524          free_stack(common, 2);
6525      if (opcode == OP_PLUS)      if (opcode == OP_PLUS)
6526        set_jumps(current->topbacktracks, LABEL());        set_jumps(current->topbacktracks, LABEL());
6527      }      }
# Line 5926  switch(opcode) Line 6529  switch(opcode)
6529    
6530    case OP_MINSTAR:    case OP_MINSTAR:
6531    case OP_MINPLUS:    case OP_MINPLUS:
6532    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6533    compile_char1_trypath(common, type, cc, &jumplist);    compile_char1_trypath(common, type, cc, &jumplist);
6534    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6535    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
6536    set_jumps(jumplist, LABEL());    set_jumps(jumplist, LABEL());
6537    free_stack(common, 1);    if (localptr == 0)
6538        free_stack(common, 1);
6539    if (opcode == OP_MINPLUS)    if (opcode == OP_MINPLUS)
6540      set_jumps(current->topbacktracks, LABEL());      set_jumps(current->topbacktracks, LABEL());
6541    break;    break;
# Line 5943  switch(opcode) Line 6547  switch(opcode)
6547      label = LABEL();      label = LABEL();
6548      set_jumps(current->topbacktracks, label);      set_jumps(current->topbacktracks, label);
6549      }      }
6550    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6551    compile_char1_trypath(common, type, cc, &jumplist);    compile_char1_trypath(common, type, cc, &jumplist);
6552    
6553    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));    OP1(SLJIT_MOV, TMP1, 0, base, offset1);
6554    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6555    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
6556    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);    OP1(SLJIT_MOV, base, offset1, TMP1, 0);
6557    
6558    if (opcode == OP_CRMINRANGE)    if (opcode == OP_CRMINRANGE)
6559      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg2 + 1, label);      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg2 + 1, label);
# Line 5960  switch(opcode) Line 6564  switch(opcode)
6564      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->trypath);      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->trypath);
6565    
6566    set_jumps(jumplist, LABEL());    set_jumps(jumplist, LABEL());
6567    free_stack(common, 2);    if (localptr == 0)
6568        free_stack(common, 2);
6569    break;    break;
6570    
6571    case OP_QUERY:    case OP_QUERY:
6572    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6573    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);    OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);
6574    CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->trypath);    CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->trypath);
6575    jump = JUMP(SLJIT_JUMP);    jump = JUMP(SLJIT_JUMP);
6576    set_jumps(current->topbacktracks, LABEL());    set_jumps(current->topbacktracks, LABEL());
6577    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6578    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);    OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);
6579    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
6580    JUMPHERE(jump);    JUMPHERE(jump);
6581    free_stack(common, 1);    if (localptr == 0)
6582        free_stack(common, 1);
6583    break;    break;
6584    
6585    case OP_MINQUERY:    case OP_MINQUERY:
6586    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
6587    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);    OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);
6588    jump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);    jump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
6589    compile_char1_trypath(common, type, cc, &jumplist);    compile_char1_trypath(common, type, cc, &jumplist);
6590    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
6591    set_jumps(jumplist, LABEL());    set_jumps(jumplist, LABEL());
6592    JUMPHERE(jump);    JUMPHERE(jump);
6593    free_stack(common, 1);    if (localptr == 0)
6594        free_stack(common, 1);
6595    break;    break;
6596    
6597    case OP_EXACT:    case OP_EXACT:
# Line 6856  switch(re->options & PCRE_NEWLINE_BITS) Line 7463  switch(re->options & PCRE_NEWLINE_BITS)
7463    {    {
7464    case 0:    case 0:
7465    /* Compile-time default */    /* Compile-time default */
7466    switch (NEWLINE)    switch(NEWLINE)
7467      {      {
7468      case -1: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANY; break;      case -1: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANY; break;
7469      case -2: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANYCRLF; break;      case -2: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANYCRLF; break;
# Line 6979  if ((re->options & PCRE_ANCHORED) == 0) Line 7586  if ((re->options & PCRE_ANCHORED) == 0)
7586    /* Forward search if possible. */    /* Forward search if possible. */
7587    if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)    if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)
7588      {      {
7589        if (mode == JIT_COMPILE && fast_forward_first_two_chars(common, (re->options & PCRE_FIRSTLINE) != 0))
7590          /* Do nothing */;
7591      if ((re->flags & PCRE_FIRSTSET) != 0)      if ((re->flags & PCRE_FIRSTSET) != 0)
7592        fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);        fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
7593      else if ((re->flags & PCRE_STARTLINE) != 0)      else if ((re->flags & PCRE_STARTLINE) != 0)

Legend:
Removed from v.977  
changed lines
  Added in v.986

  ViewVC Help
Powered by ViewVC 1.1.5