Lines Matching refs:cc

231   pcre_uchar *cc;
505 #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
548 static pcre_uchar* bracketend(pcre_uchar* cc)
550 SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
551 do cc += GET(cc, 1); while (*cc == OP_ALT);
552 SLJIT_ASSERT(*cc >= OP_KET && *cc <= OP_KETRPOS);
553 cc += 1 + LINK_SIZE;
554 return cc;
557 static int no_alternatives(pcre_uchar* cc)
560 SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
563 cc += GET(cc, 1);
566 while (*cc == OP_ALT);
567 SLJIT_ASSERT(*cc >= OP_KET && *cc <= OP_KETRPOS);
588 static pcre_uchar *next_opcode(compiler_common *common, pcre_uchar *cc)
591 switch(*cc)
679 return cc + PRIV(OP_lengths)[*cc];
737 cc += PRIV(OP_lengths)[*cc];
739 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
741 return cc;
757 return cc + PRIV(OP_lengths)[*cc] - 1;
763 return cc + 1;
767 return cc + GET(cc, 1);
774 return cc + 1 + 2 + cc[1];
783 static BOOL check_opcode_types(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
789 while (cc < ccend)
791 switch(*cc)
796 cc += 1;
801 common->optimized_cbracket[GET2(cc, 1)] = 0;
802 cc += 1 + IMM2_SIZE;
809 count = no_alternatives(cc);
812 cc += 1 + LINK_SIZE + (*cc == OP_CBRA || *cc == OP_SCBRA ? IMM2_SIZE : 0);
817 common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0;
818 cc += 1 + LINK_SIZE + IMM2_SIZE;
825 if (cc[1 + LINK_SIZE] == OP_CALLOUT)
827 cc += 1 + LINK_SIZE;
831 common->optimized_cbracket[GET2(cc, 1)] = 0;
832 cc += 1 + IMM2_SIZE;
838 count = GET2(cc, 1 + IMM2_SIZE);
839 slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
845 cc += 1 + 2 * IMM2_SIZE;
855 cc += 1 + LINK_SIZE;
864 cc += 2 + 2 * LINK_SIZE;
882 cc += 1 + 2 + cc[1];
893 cc += 1;
899 cc += 1 + 2 + cc[1];
903 cc = next_opcode(common, cc);
904 if (cc == NULL)
912 static int get_class_iterator_size(pcre_uchar *cc)
914 switch(*cc)
928 if (GET2(cc, 1) == GET2(cc, 1 + IMM2_SIZE))
1076 pcre_uchar *cc = common->start;
1082 while (cc < ccend)
1090 if (*cc == OP_ONCE || *cc == OP_ONCE_NC || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND)
1091 if (detect_repeat(common, cc))
1095 if (cc >= end)
1096 end = bracketend(cc);
1099 switch(*cc)
1102 if (common->private_data_ptrs[cc + 1 - common->start] != 0)
1104 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1106 cc += common->private_data_ptrs[cc + 1 - common->start];
1108 cc += 1 + LINK_SIZE;
1121 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1128 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1135 alternative = cc + GET(cc, 1);
1138 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1174 if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)
1180 if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)
1188 space = get_class_iterator_size(cc + size);
1193 size = GET(cc, 1);
1194 space = get_class_iterator_size(cc + size);
1199 cc = next_opcode(common, cc);
1200 SLJIT_ASSERT(cc != NULL);
1206 if (space > 0 && cc >= end)
1208 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1216 cc += -size;
1218 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1222 cc += size;
1227 if (cc >= end)
1229 end = bracketend(cc);
1233 cc += bracketlen;
1240 static int get_framesize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL recursive, BOOL* needs_control_head)
1259 ccend = bracketend(cc) - (1 + LINK_SIZE);
1260 if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))
1266 cc = next_opcode(common, cc);
1269 SLJIT_ASSERT(cc != NULL);
1270 while (cc < ccend)
1271 switch(*cc)
1281 cc += 1;
1296 cc += 1 + 2 + cc[1];
1316 cc += 1 + LINK_SIZE;
1330 cc += 1 + LINK_SIZE + IMM2_SIZE;
1401 cc = next_opcode(common, cc);
1402 SLJIT_ASSERT(cc != NULL);
1415 static void init_frame(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, int stackpos, int stacktop, BOOL recursive)
1431 ccend = bracketend(cc) - (1 + LINK_SIZE);
1432 if (recursive || (*cc != OP_CBRAPOS && *cc != OP_SCBRAPOS))
1433 cc = next_opcode(common, cc);
1436 SLJIT_ASSERT(cc != NULL);
1437 while (cc < ccend)
1438 switch(*cc)
1451 cc += 1;
1467 cc += 1 + 2 + cc[1];
1498 cc += 1 + LINK_SIZE;
1514 offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
1524 cc += 1 + LINK_SIZE + IMM2_SIZE;
1528 cc = next_opcode(common, cc);
1529 SLJIT_ASSERT(cc != NULL);
1537 static SLJIT_INLINE int get_private_data_copy_length(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL needs_control_head)
1543 while (cc < ccend)
1546 switch(*cc)
1549 if (PRIVATE_DATA(cc) != 0)
1551 cc += 1 + LINK_SIZE;
1565 cc += 1 + LINK_SIZE;
1570 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
1572 cc += 1 + LINK_SIZE + IMM2_SIZE;
1578 cc += 1 + LINK_SIZE + IMM2_SIZE;
1583 alternative = cc + GET(cc, 1);
1586 cc += 1 + LINK_SIZE;
1590 if (PRIVATE_DATA(cc))
1592 cc += 2;
1594 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1599 if (PRIVATE_DATA(cc))
1601 cc += 2;
1603 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1608 if (PRIVATE_DATA(cc))
1610 cc += 2 + IMM2_SIZE;
1612 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1617 if (PRIVATE_DATA(cc))
1619 cc += 1;
1623 if (PRIVATE_DATA(cc))
1625 cc += 1;
1629 if (PRIVATE_DATA(cc))
1631 cc += 1 + IMM2_SIZE;
1638 size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(pcre_uchar);
1642 if (PRIVATE_DATA(cc))
1643 private_data_length += get_class_iterator_size(cc + size);
1644 cc += size;
1648 cc = next_opcode(common, cc);
1649 SLJIT_ASSERT(cc != NULL);
1653 SLJIT_ASSERT(cc == ccend);
1657 static void copy_private_data(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend,
1714 if (cc >= ccend)
1720 switch(*cc)
1723 if (PRIVATE_DATA(cc) != 0)
1726 srcw[0] = PRIVATE_DATA(cc);
1728 cc += 1 + LINK_SIZE;
1742 srcw[0] = PRIVATE_DATA(cc);
1744 cc += 1 + LINK_SIZE;
1749 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
1752 srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
1754 cc += 1 + LINK_SIZE + IMM2_SIZE;
1760 srcw[0] = PRIVATE_DATA(cc);
1761 srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
1763 cc += 1 + LINK_SIZE + IMM2_SIZE;
1768 alternative = cc + GET(cc, 1);
1772 srcw[0] = PRIVATE_DATA(cc);
1775 cc += 1 + LINK_SIZE;
1779 if (PRIVATE_DATA(cc))
1782 srcw[0] = PRIVATE_DATA(cc);
1784 cc += 2;
1786 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1791 if (PRIVATE_DATA(cc))
1794 srcw[0] = PRIVATE_DATA(cc);
1795 srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
1797 cc += 2;
1799 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1804 if (PRIVATE_DATA(cc))
1807 srcw[0] = PRIVATE_DATA(cc);
1808 srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
1810 cc += 2 + IMM2_SIZE;
1812 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1817 if (PRIVATE_DATA(cc))
1820 srcw[0] = PRIVATE_DATA(cc);
1822 cc += 1;
1826 if (PRIVATE_DATA(cc))
1829 srcw[0] = PRIVATE_DATA(cc);
1832 cc += 1;
1836 if (PRIVATE_DATA(cc))
1839 srcw[0] = PRIVATE_DATA(cc);
1842 cc += 1 + IMM2_SIZE;
1849 size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(pcre_uchar);
1853 if (PRIVATE_DATA(cc))
1854 switch(get_class_iterator_size(cc + size))
1858 srcw[0] = PRIVATE_DATA(cc);
1863 srcw[0] = PRIVATE_DATA(cc);
1871 cc += size;
1875 cc = next_opcode(common, cc);
1876 SLJIT_ASSERT(cc != NULL);
1974 SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));
1977 static SLJIT_INLINE pcre_uchar *set_then_offsets(compiler_common *common, pcre_uchar *cc, pcre_uint8 *current_offset)
1979 pcre_uchar *end = bracketend(cc);
1980 BOOL has_alternatives = cc[GET(cc, 1)] == OP_ALT;
1983 if (*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT)
1986 if (*cc == OP_COND || *cc == OP_SCOND)
1989 cc = next_opcode(common, cc);
1991 current_offset = common->then_offsets + (cc - common->start);
1993 while (cc < end)
1995 if ((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND))
1996 cc = set_then_offsets(common, cc, current_offset);
1999 if (*cc == OP_ALT && has_alternatives)
2000 current_offset = common->then_offsets + (cc + 1 + LINK_SIZE - common->start);
2001 if (*cc >= OP_THEN && *cc <= OP_THEN_ARG && current_offset != NULL)
2003 cc = next_opcode(common, cc);
2317 static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc)
2325 GETCHAR(c, cc);
2340 c = *cc;
2360 static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc)
2371 GETCHAR(c, cc);
2385 c = *cc;
2389 c = *cc;
2409 n = GET_EXTRALEN(*cc);
3185 static int scan_prefix(compiler_common *common, pcre_uchar *cc, pcre_uint32 *chars, pcre_uint8 *bytes, int max_chars)
3206 switch (*cc)
3212 cc++;
3227 cc++;
3234 cc = bracketend(cc);
3244 cc++;
3250 repeat = GET2(cc, 1);
3252 cc += 1 + IMM2_SIZE;
3263 cc++;
3265 if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc);
3267 max_chars = scan_prefix(common, cc + len, chars, bytes, max_chars);
3274 cc += 1 + LINK_SIZE;
3278 cc += GET(cc, 1);
3287 alternative = cc + GET(cc, 1);
3296 if (*cc == OP_CBRA || *cc == OP_CBRAPOS)
3297 cc += IMM2_SIZE;
3298 cc += 1 + LINK_SIZE;
3303 if (common->utf && !is_char7_bitset((const pcre_uint8 *)(cc + 1), FALSE)) return consumed;
3306 cc += 1 + 32 / sizeof(pcre_uchar);
3314 cc += 1 + 32 / sizeof(pcre_uchar);
3323 cc += GET(cc, 1);
3333 cc++;
3342 cc++;
3351 cc++;
3356 cc++;
3367 cc++;
3377 cc += 1 + 2;
3382 repeat = GET2(cc, 1);
3383 cc += 1 + IMM2_SIZE;
3392 repeat = GET2(cc, 1);
3393 cc += 1 + IMM2_SIZE + 1;
3432 if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc);
3435 if (caseless && char_has_othercase(common, cc))
3440 GETCHAR(chr, cc);
3447 chr = *cc;
3455 cc_save = cc;
3461 chr = *cc;
3472 mask = *cc ^ *oc;
3499 cc++;
3508 cc = cc_save;
4557 static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc,
4567 if (caseless && char_has_othercase(common, cc))
4569 othercasebit = char_get_othercase_bit(common, cc);
4573 othercasechar = cc + (othercasebit >> 8);
4580 othercasechar = cc + (othercasebit >> 9);
4614 if (common->utf && HAS_EXTRALEN(*cc))
4615 utflength += GET_EXTRALEN(*cc);
4625 if (othercasebit != 0 && othercasechar == cc)
4627 context->c.asuchars[context->ucharptr] = *cc | othercasebit;
4632 context->c.asuchars[context->ucharptr] = *cc;
4690 if (othercasebit != 0 && othercasechar == cc)
4693 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc | othercasebit));
4696 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc));
4700 cc++;
4707 return cc;
4732 static void compile_xclass_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
4736 jump_list **list = (cc[0] & XCL_NOT) == 0 ? &found : backtracks;
4754 cc++;
4755 ccbegin = cc;
4757 if (cc[-1] & XCL_MAP)
4760 cc += 32 / sizeof(pcre_uchar);
4763 while (*cc != XCL_END)
4766 if (*cc == XCL_SINGLE)
4768 cc ++;
4769 GETCHARINCTEST(c, cc);
4776 else if (*cc == XCL_RANGE)
4778 cc ++;
4779 GETCHARINCTEST(c, cc);
4781 GETCHARINCTEST(c, cc);
4790 SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);
4791 cc++;
4792 if (*cc == PT_CLIST)
4794 other_cases = PRIV(ucd_caseless_sets) + cc[1];
4808 switch(*cc)
4843 cc += 2;
4849 cc = ccbegin;
4851 read_char_range(common, min, max, (cc[-1] & XCL_NOT) != 0);
4853 if ((cc[-1] & XCL_HASPROP) == 0)
4855 if ((cc[-1] & XCL_MAP) != 0)
4858 if (!check_class_ranges(common, (const pcre_uint8 *)cc, (((const pcre_uint8 *)cc)[31] & 0x80) != 0, TRUE, &found))
4862 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
4871 cc += 32 / sizeof(pcre_uchar);
4876 add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, max - min));
4879 else if ((cc[-1] & XCL_MAP) != 0)
4885 if (!check_class_ranges(common, (const pcre_uint8 *)cc, FALSE, TRUE, list))
4894 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
4903 cc += 32 / sizeof(pcre_uchar);
4953 while (*cc != XCL_END)
4959 if (*cc == XCL_SINGLE)
4961 cc ++;
4962 GETCHARINCTEST(c, cc);
4964 if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
4983 else if (*cc == XCL_RANGE)
4985 cc ++;
4986 GETCHARINCTEST(c, cc);
4988 GETCHARINCTEST(c, cc);
4990 if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
5012 if (*cc == XCL_NOTPROP)
5014 cc++;
5015 switch(*cc)
5020 if ((cc[-1] == XCL_NOTPROP && compares > 0) || (cc[-1] == XCL_PROP && compares == 0))
5023 else if (cc[-1] == XCL_NOTPROP)
5039 c = PRIV(ucp_typerange)[(int)cc[1] * 2];
5041 jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, PRIV(ucp_typerange)[(int)cc[1] * 2 + 1] - c);
5045 jump = CMP(SLJIT_C_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, (int)cc[1] - typeoffset);
5049 jump = CMP(SLJIT_C_EQUAL ^ invertcmp, scriptreg, 0, SLJIT_IMM, (int)cc[1]);
5078 OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, (*cc == PT_ALNUM) ? SLJIT_UNUSED : TMP2, 0, SLJIT_C_LESS_EQUAL);
5086 other_cases = PRIV(ucd_caseless_sets) + cc[1];
5216 cc += 2;
5233 static pcre_uchar *compile_char1_matchingpath(compiler_common *common, pcre_uchar type, pcre_uchar *cc, jump_list **backtracks)
5254 return cc;
5260 return cc;
5266 return cc;
5281 return cc;
5294 return cc;
5307 return cc;
5328 return cc;
5352 return cc;
5356 return cc;
5361 return cc;
5369 propdata[2] = cc[0];
5370 propdata[3] = cc[1];
5373 return cc + 2;
5396 return cc;
5404 return cc;
5412 return cc;
5450 return cc;
5519 return cc;
5524 return cc;
5532 return cc;
5560 return cc;
5568 compile_char1_matchingpath(common, OP_EODN, cc, backtracks);
5574 return cc;
5611 return cc;
5617 if (common->utf && HAS_EXTRALEN(*cc)) length += GET_EXTRALEN(*cc);
5619 if (common->mode == JIT_COMPILE && (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0))
5629 return byte_sequence_compare(common, type == OP_CHARI, cc, &context, backtracks);
5636 GETCHAR(c, cc);
5640 c = *cc;
5642 if (type == OP_CHAR || !char_has_othercase(common, cc))
5646 return cc + length;
5655 return cc + length;
5660 return cc + length;
5670 c = *cc;
5674 if (type == OP_NOT || !char_has_othercase(common, cc))
5688 return cc + 1;
5693 GETCHARLEN(c, cc, length);
5698 c = *cc;
5700 if (type == OP_NOT || !char_has_othercase(common, cc))
5721 return cc + length;
5728 bit = (common->utf && is_char7_bitset((const pcre_uint8 *)cc, type == OP_NCLASS)) ? 127 : 255;
5734 if (check_class_ranges(common, (const pcre_uint8 *)cc, type == OP_NCLASS, FALSE, backtracks))
5735 return cc + 32 / sizeof(pcre_uchar);
5759 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
5769 return cc + 32 / sizeof(pcre_uchar);
5773 compile_xclass_matchingpath(common, cc + LINK_SIZE, backtracks);
5774 return cc + GET(cc, 0) - 1;
5778 length = GET(cc, 0);
5780 return cc + LINK_SIZE;
5801 return cc + LINK_SIZE;
5804 return cc;
5807 static SLJIT_INLINE pcre_uchar *compile_charn_matchingpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, jump_list **backtracks)
5812 pcre_uchar *ccbegin = cc;
5819 if (cc >= ccend)
5822 if (*cc == OP_CHAR)
5826 if (common->utf && HAS_EXTRALEN(cc[1]))
5827 size += GET_EXTRALEN(cc[1]);
5830 else if (*cc == OP_CHARI)
5836 if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
5838 else if (HAS_EXTRALEN(cc[1]))
5839 size += GET_EXTRALEN(cc[1]);
5843 if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
5849 cc += 1 + size;
5854 cc = ccbegin;
5865 do cc = byte_sequence_compare(common, *cc == OP_CHARI, cc + 1, &context, backtracks); while (context.length > 0);
5866 return cc;
5870 return compile_char1_matchingpath(common, *cc, cc + 1, backtracks);
5885 backtrack->cc = (ccstart); \
5898 backtrack->cc = (ccstart); \
5905 static void compile_dnref_search(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
5909 int count = GET2(cc, 1 + IMM2_SIZE);
5910 pcre_uchar *slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
5914 SLJIT_ASSERT(*cc == OP_DNREF || *cc == OP_DNREFI);
5935 static void compile_ref_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks, BOOL withchecks, BOOL emptyfail)
5938 BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
5946 offset = GET2(cc, 1) << 1;
5956 if (common->utf && *cc == OP_REFI)
6001 add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CALL));
6013 add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CALL));
6031 static SLJIT_INLINE pcre_uchar *compile_ref_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6034 BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
6041 pcre_uchar *ccbegin = cc;
6045 PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
6048 offset = GET2(cc, 1) << 1;
6050 cc += IMM2_SIZE;
6051 type = cc[1 + IMM2_SIZE];
6061 cc += 1 + IMM2_SIZE + 1;
6067 cc += 1 + IMM2_SIZE + 1;
6073 cc += 1 + IMM2_SIZE + 1;
6077 min = GET2(cc, 1 + IMM2_SIZE + 1);
6078 max = GET2(cc, 1 + IMM2_SIZE + 1 + IMM2_SIZE);
6079 cc += 1 + IMM2_SIZE + 1 + 2 * IMM2_SIZE;
6168 return cc;
6235 return cc;
6238 static SLJIT_INLINE pcre_uchar *compile_recurse_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6244 sljit_sw start = GET(cc, 1);
6248 PUSH_BACKTRACK(sizeof(recurse_backtrack), cc, NULL);
6256 return cc + 1 + LINK_SIZE;
6304 return cc + 1 + LINK_SIZE;
6358 static SLJIT_INLINE pcre_uchar *compile_callout_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6363 PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL);
6370 OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, cc[1]);
6380 OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(pattern_position), SLJIT_IMM, GET(cc, 2));
6381 OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(next_item_length), SLJIT_IMM, GET(cc, 2 + LINK_SIZE));
6400 return cc + 2 + 2 * LINK_SIZE;
6406 static pcre_uchar *compile_assert_matchingpath(compiler_common *common, pcre_uchar *cc, assert_backtrack *backtrack, BOOL conditional)
6435 if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
6438 bra = *cc;
6439 cc++;
6441 private_data_ptr = PRIVATE_DATA(cc);
6443 framesize = get_framesize(common, cc, NULL, FALSE, &needs_control_head);
6446 opcode = *cc;
6449 ccbegin = cc;
6450 cc += GET(cc, 1);
6519 altbacktrack.cc = ccbegin;
6520 compile_matchingpath(common, ccbegin + 1 + LINK_SIZE, cc, &altbacktrack);
6612 if (*cc != OP_ALT)
6615 ccbegin = cc;
6616 cc += GET(cc, 1);
6801 return cc + 1 + LINK_SIZE;
6929 static pcre_uchar *compile_bracket_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6952 PUSH_BACKTRACK(sizeof(bracket_backtrack), cc, NULL);
6954 if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
6956 bra = *cc;
6957 cc++;
6958 opcode = *cc;
6961 opcode = *cc;
6962 ccbegin = cc;
6963 matchingpath = bracketend(cc) - 1 - LINK_SIZE;
6978 if ((opcode == OP_COND || opcode == OP_SCOND) && cc[1 + LINK_SIZE] == OP_DEF)
6988 cc += GET(cc, 1);
6990 has_alternatives = *cc == OP_ALT;
6994 if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
7296 if (*cc == OP_ALT)
7298 matchingpath = cc + 1 + LINK_SIZE;
7299 cc += GET(cc, 1);
7302 matchingpath = cc;
7313 assert->common.cc = matchingpath;
7319 compile_matchingpath(common, matchingpath, cc, backtrack);
7458 while (*cc == OP_ALT)
7459 cc += GET(cc, 1);
7460 cc += 1 + LINK_SIZE;
7465 return cc + repeat_length;
7468 static pcre_uchar *compile_bracketpos_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
7485 PUSH_BACKTRACK(sizeof(bracketpos_backtrack), cc, NULL);
7486 if (*cc == OP_BRAPOSZERO)
7489 cc++;
7492 opcode = *cc;
7493 private_data_ptr = PRIVATE_DATA(cc);
7500 ccbegin = cc + 1 + LINK_SIZE;
7505 offset = GET2(cc, 1 + LINK_SIZE);
7511 ccbegin = cc + 1 + LINK_SIZE + IMM2_SIZE;
7519 framesize = get_framesize(common, cc, NULL, FALSE, &needs_control_head);
7612 init_frame(common, cc, NULL, stacksize - 1, stacksize - framesize, FALSE);
7620 while (*cc != OP_KETRPOS)
7624 cc += GET(cc, 1);
7626 compile_matchingpath(common, ccbegin, cc, backtrack);
7713 if (*cc == OP_KETRPOS)
7724 if (*cc == OP_KETRPOS)
7726 ccbegin = cc + 1 + LINK_SIZE;
7743 return cc + 1 + LINK_SIZE;
7746 static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, int *max, int *min, pcre_uchar **end)
7750 *opcode = *cc;
7753 cc++;
7758 cc++;
7764 cc++;
7770 cc++;
7776 cc++;
7784 cc++;
7785 class_len = (*type < OP_XCLASS) ? (int)(1 + (32 / sizeof(pcre_uchar))) : GET(cc, 0);
7786 *opcode = cc[class_len - 1];
7791 *end = cc + class_len;
7797 *end = cc + class_len;
7802 *max = GET2(cc, (class_len + IMM2_SIZE));
7803 *min = GET2(cc, class_len);
7814 *end = cc + class_len + 2 * IMM2_SIZE;
7816 return cc;
7821 *max = GET2(cc, 0);
7822 cc += IMM2_SIZE;
7827 *type = *cc;
7829 *end = next_opcode(common, cc);
7830 cc++;
7831 return cc;
7836 *end = cc + 1;
7838 if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc);
7841 return cc;
7844 static pcre_uchar *compile_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
7855 int private_data_ptr = PRIVATE_DATA(cc);
7861 PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
7863 cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &min, &end);
7929 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
7951 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
7960 compile_char1_matchingpath(common, type, cc, &nomatch);
7987 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
8011 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
8018 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
8027 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
8032 compile_char1_matchingpath(common, type, cc, &nomatch);
8047 compile_char1_matchingpath(common, type, cc, &nomatch);
8057 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
8068 compile_char1_matchingpath(common, type, cc, &nomatch);
8090 static SLJIT_INLINE pcre_uchar *compile_fail_accept_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
8095 PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL);
8097 if (*cc == OP_FAIL)
8100 return cc + 1;
8103 if (*cc == OP_ASSERT_ACCEPT || common->currententry != NULL || !common->might_be_empty)
8110 return cc + 1;
8131 return cc + 1;
8134 static SLJIT_INLINE pcre_uchar *compile_close_matchingpath(compiler_common *common, pcre_uchar *cc)
8137 int offset = GET2(cc, 1);
8142 return cc + 1 + IMM2_SIZE;
8150 return cc + 1 + IMM2_SIZE;
8153 static SLJIT_INLINE pcre_uchar *compile_control_verb_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
8157 pcre_uchar opcode = *cc;
8158 pcre_uchar *ccend = cc + 1;
8161 ccend += 2 + cc[1];
8163 PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL);
8175 OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2));
8185 static SLJIT_INLINE void compile_then_trap_matchingpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, backtrack_common *parent)
8192 PUSH_BACKTRACK_NOVALUE(sizeof(then_trap_backtrack), cc);
8194 BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode;
8195 BACKTRACK_AS(then_trap_backtrack)->start = (sljit_sw)(cc - common->start);
8196 BACKTRACK_AS(then_trap_backtrack)->framesize = get_framesize(common, cc, ccend, FALSE, &needs_control_head);
8213 init_frame(common, cc, ccend, size - 1, 0, FALSE);
8216 static void compile_matchingpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, backtrack_common *parent)
8225 if (common->has_then && common->then_offsets[cc - common->start] != 0)
8231 compile_then_trap_matchingpath(common, cc, ccend, parent);
8234 while (cc < ccend)
8236 switch(*cc)
8268 cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8272 PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc);
8277 cc++;
8283 cc = compile_charn_matchingpath(common, cc, ccend, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8285 cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8353 cc = compile_iterator_matchingpath(common, cc, parent);
8358 if (cc[1 + (32 / sizeof(pcre_uchar))] >= OP_CRSTAR && cc[1 + (32 / sizeof(pcre_uchar))] <= OP_CRPOSRANGE)
8359 cc = compile_iterator_matchingpath(common, cc, parent);
8361 cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8366 if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRPOSRANGE)
8367 cc = compile_iterator_matchingpath(common, cc, parent);
8369 cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8375 if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRPOSRANGE)
8376 cc = compile_ref_iterator_matchingpath(common, cc, parent);
8379 compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
8380 cc += 1 + IMM2_SIZE;
8386 if (cc[1 + 2 * IMM2_SIZE] >= OP_CRSTAR && cc[1 + 2 * IMM2_SIZE] <= OP_CRPOSRANGE)
8387 cc = compile_ref_iterator_matchingpath(common, cc, parent);
8390 compile_dnref_search(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8391 compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
8392 cc += 1 + 2 * IMM2_SIZE;
8397 cc = compile_recurse_matchingpath(common, cc, parent);
8401 cc = compile_callout_matchingpath(common, cc, parent);
8408 PUSH_BACKTRACK_NOVALUE(sizeof(assert_backtrack), cc);
8409 cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE);
8413 PUSH_BACKTRACK_NOVALUE(sizeof(braminzero_backtrack), cc);
8414 cc = bracketend(cc + 1);
8415 if (*(cc - 1 - LINK_SIZE) != OP_KETRMIN)
8427 if (cc[1] > OP_ASSERTBACK_NOT)
8439 cc = compile_bracket_matchingpath(common, cc, parent);
8443 if (cc[1] > OP_ASSERTBACK_NOT)
8444 cc = compile_bracket_matchingpath(common, cc, parent);
8447 PUSH_BACKTRACK_NOVALUE(sizeof(assert_backtrack), cc);
8448 cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE);
8457 cc = compile_bracketpos_matchingpath(common, cc, parent);
8461 PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc);
8467 OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2));
8475 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), SLJIT_IMM, (sljit_sw)(cc + 2));
8479 cc += 1 + 2 + cc[1];
8489 cc = compile_control_verb_matchingpath(common, cc, parent);
8495 cc = compile_fail_accept_matchingpath(common, cc, parent);
8499 cc = compile_close_matchingpath(common, cc);
8503 cc = bracketend(cc + 1);
8510 if (cc == NULL)
8517 PUSH_BACKTRACK_NOVALUE(sizeof(then_trap_backtrack), cc);
8518 BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode;
8522 SLJIT_ASSERT(cc == ccend);
8543 pcre_uchar *cc = current->cc;
8550 int private_data_ptr = PRIVATE_DATA(cc);
8555 cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &min, NULL);
8603 compile_char1_matchingpath(common, type, cc, &jumplist);
8621 compile_char1_matchingpath(common, type, cc, &jumplist);
8659 compile_char1_matchingpath(common, type, cc, &jumplist);
8687 pcre_uchar *cc = current->cc;
8688 BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
8691 type = cc[ref ? 1 + IMM2_SIZE : 1 + 2 * IMM2_SIZE];
8738 pcre_uchar *cc = current->cc;
8742 SLJIT_ASSERT(*cc != OP_BRAMINZERO);
8743 if (*cc == OP_BRAZERO)
8745 bra = *cc;
8746 cc++;
8770 if (*cc == OP_ASSERT_NOT || *cc == OP_ASSERTBACK_NOT)
8781 if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK)
8809 pcre_uchar *cc = current->cc;
8826 if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
8828 bra = *cc;
8829 cc++;
8832 opcode = *cc;
8833 ccbegin = bracketend(cc) - 1 - LINK_SIZE;
8846 ccbegin = cc;
8847 cc += GET(cc, 1);
8848 has_alternatives = *cc == OP_ALT;
8853 if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
9037 if (*cc == OP_ALT)
9039 ccprev = cc + 1 + LINK_SIZE;
9040 cc += GET(cc, 1);
9053 compile_matchingpath(common, ccprev, cc, current);
9144 while (*cc == OP_ALT);
9189 cc = ccbegin + GET(ccbegin, 1);
9195 stacksize += CURRENT_AS(bracket_backtrack)->u.framesize + ((ket != OP_KET || *cc == OP_ALT) ? 2 : 1);
9197 else if (ket == OP_KETRMAX || (*cc == OP_ALT && ket != OP_KETRMIN))
9269 if (*current->cc == OP_CBRAPOS || *current->cc == OP_SCBRAPOS)
9271 offset = (GET2(current->cc, 1 + LINK_SIZE)) << 1;
9307 if (current->cc[1] > OP_ASSERTBACK_NOT)
9310 compile_bracket_matchingpath(common, current->cc, current);
9316 backtrack.common.cc = current->cc;
9319 compile_assert_matchingpath(common, current->cc, &backtrack, FALSE);
9327 pcre_uchar opcode = *current->cc;
9371 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, (sljit_sw)(current->cc + 2));
9426 switch(*current->cc)
9537 if (current->cc[1] > OP_ASSERTBACK_NOT)
9607 pcre_uchar *cc = common->start + common->currententry->start;
9608 pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE);
9609 pcre_uchar *ccend = bracketend(cc);
9611 int framesize = get_framesize(common, cc, NULL, TRUE, &needs_control_head);
9621 SLJIT_ASSERT(*cc == OP_BRA || *cc == OP_CBRA || *cc == OP_CBRAPOS || *cc == OP_SCBRA || *cc == OP_SCBRAPOS);
9625 alternativesize = *(cc + GET(cc, 1)) == OP_ALT ? 1 : 0;
9639 init_frame(common, cc, NULL, framesize + alternativesize - 1, alternativesize, TRUE);
9649 altbacktrack.cc = ccbegin;
9650 cc += GET(cc, 1);
9656 if (altbacktrack.cc != ccbegin)
9659 compile_matchingpath(common, altbacktrack.cc, cc, &altbacktrack);
9670 if (*cc != OP_ALT)
9673 altbacktrack.cc = cc + 1 + LINK_SIZE;
9674 cc += GET(cc, 1);
9766 rootbacktrack.cc = (pcre_uchar *)re + re->name_table_offset + re->name_count * re->name_entry_size;
9768 common->start = rootbacktrack.cc;