Lines Matching refs:common
235 backtrack_common common;
246 backtrack_common common;
266 backtrack_common common;
276 backtrack_common common;
281 backtrack_common common;
297 backtrack_common common;
304 backtrack_common common;
502 #define OVECTOR_START (common->ovector_start)
504 #define OVECTOR_PRIV(i) (common->cbra_ptr + (i) * (sljit_sw)sizeof(sljit_sw))
505 #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
522 struct sljit_compiler *compiler = common->compiler
588 static pcre_uchar *next_opcode(compiler_common *common, pcre_uchar *cc)
590 SLJIT_UNUSED_ARG(common);
739 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
761 if (common->utf) return NULL;
783 static BOOL check_opcode_types(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
794 common->has_set_som = TRUE;
795 common->might_be_empty = TRUE;
801 common->optimized_cbracket[GET2(cc, 1)] = 0;
811 common->read_only_data_size += count * sizeof(sljit_uw);
817 common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0;
831 common->optimized_cbracket[GET2(cc, 1)] = 0;
839 slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
842 common->optimized_cbracket[GET2(slot, 0)] = 0;
843 slot += common->name_entry_size;
850 if (common->recursive_head_ptr == 0)
852 common->recursive_head_ptr = common->ovector_start;
853 common->ovector_start += sizeof(sljit_sw);
859 if (common->capture_last_ptr == 0)
861 common->capture_last_ptr = common->ovector_start;
862 common->ovector_start += sizeof(sljit_sw);
868 common->has_then = TRUE;
869 common->control_head_ptr = 1;
873 common->needs_start_ptr = TRUE;
877 if (common->mark_ptr == 0)
879 common->mark_ptr = common->ovector_start;
880 common->ovector_start += sizeof(sljit_sw);
886 common->has_then = TRUE;
887 common->control_head_ptr = 1;
892 common->needs_start_ptr = TRUE;
897 common->control_head_ptr = 1;
898 common->has_skip_arg = TRUE;
903 cc = next_opcode(common, cc);
937 static BOOL detect_repeat(compiler_common *common, pcre_uchar *begin)
952 if (common->private_data_ptrs[end - common->start - LINK_SIZE] != 0)
998 common->private_data_ptrs[max_end - common->start - LINK_SIZE] = next_end - max_end;
999 common->private_data_ptrs[max_end - common->start - LINK_SIZE + 1] = (type == OP_BRAZERO) ? OP_UPTO : OP_MINUPTO;
1001 common->private_data_ptrs[max_end - common->start - LINK_SIZE + 2] = max + 2;
1013 common->private_data_ptrs[end - common->start - LINK_SIZE] = max_end - end;
1014 common->private_data_ptrs[end - common->start - LINK_SIZE + 1] = OP_EXACT;
1015 common->private_data_ptrs[end - common->start - LINK_SIZE + 2] = min;
1074 static void set_private_data_ptrs(compiler_common *common, int *private_data_start, pcre_uchar *ccend)
1076 pcre_uchar *cc = common->start;
1091 if (detect_repeat(common, 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];
1121 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1128 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1138 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1199 cc = next_opcode(common, cc);
1208 common->private_data_ptrs[cc - common->start] = private_data_ptr;
1218 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1240 static int get_framesize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL recursive, BOOL* needs_control_head)
1251 SLJIT_ASSERT(common->control_head_ptr != 0);
1262 possessive = length = (common->capture_last_ptr != 0) ? 5 : 3;
1263 /* This is correct regardless of common->capture_last_ptr. */
1266 cc = next_opcode(common, cc);
1274 SLJIT_ASSERT(common->has_set_som);
1287 SLJIT_ASSERT(common->mark_ptr != 0);
1294 if (common->control_head_ptr != 0)
1301 if (common->has_set_som && !setsom_found)
1306 if (common->mark_ptr != 0 && !setmark_found)
1311 if (common->capture_last_ptr != 0 && !capture_last_found)
1324 if (common->capture_last_ptr != 0 && !capture_last_found)
1401 cc = next_opcode(common, cc);
1415 static void init_frame(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, int stackpos, int stacktop, BOOL recursive)
1433 cc = next_opcode(common, cc);
1441 SLJIT_ASSERT(common->has_set_som);
1457 SLJIT_ASSERT(common->mark_ptr != 0);
1460 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
1461 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
1471 if (common->has_set_som && !setsom_found)
1480 if (common->mark_ptr != 0 && !setmark_found)
1482 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
1483 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
1489 if (common->capture_last_ptr != 0 && !capture_last_found)
1491 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
1492 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
1505 if (common->capture_last_ptr != 0 && !capture_last_found)
1507 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
1508 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
1528 cc = next_opcode(common, cc);
1537 static SLJIT_INLINE int get_private_data_copy_length(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL needs_control_head)
1570 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
1594 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1603 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1612 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1648 cc = next_opcode(common, cc);
1657 static void copy_private_data(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend,
1701 SLJIT_ASSERT(save && common->recursive_head_ptr != 0);
1703 srcw[0] = common->recursive_head_ptr;
1706 SLJIT_ASSERT(common->control_head_ptr != 0);
1708 srcw[1] = common->control_head_ptr;
1749 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
1786 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1799 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1812 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1875 cc = next_opcode(common, cc);
1977 static SLJIT_INLINE pcre_uchar *set_then_offsets(compiler_common *common, pcre_uchar *cc, pcre_uint8 *current_offset)
1989 cc = next_opcode(common, cc);
1991 current_offset = common->then_offsets + (cc - common->start);
1996 cc = set_then_offsets(common, cc, current_offset);
2000 current_offset = common->then_offsets + (cc + 1 + LINK_SIZE - common->start);
2003 cc = next_opcode(common, cc);
2044 static void add_stub(compiler_common *common, struct sljit_jump *start)
2053 list_item->next = common->stubs;
2054 common->stubs = list_item;
2058 static void flush_stubs(compiler_common *common)
2061 stub_list* list_item = common->stubs;
2066 add_jump(compiler, &common->stackalloc, JUMP(SLJIT_FAST_CALL));
2070 common->stubs = NULL;
2073 static void add_label_addr(compiler_common *common, sljit_uw *update_addr)
2083 label_addr->next = common->label_addrs;
2084 common->label_addrs = label_addr;
2087 static SLJIT_INLINE void count_match(compiler_common *common)
2092 add_jump(compiler, &common->calllimit, JUMP(SLJIT_C_ZERO));
2095 static SLJIT_INLINE void allocate_stack(compiler_common *common, int size)
2108 add_stub(common, CMP(SLJIT_C_GREATER, STACK_TOP, 0, STACK_LIMIT, 0));
2111 static SLJIT_INLINE void free_stack(compiler_common *common, int size)
2117 static SLJIT_INLINE void reset_ovector(compiler_common *common, int length)
2143 static SLJIT_INLINE void do_reset_match(compiler_common *common, int length)
2169 if (common->mark_ptr != 0)
2170 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0);
2171 if (common->control_head_ptr != 0)
2172 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
2174 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
2201 static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbracket)
2212 if (common->mark_ptr != 0)
2213 OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
2215 if (common->mark_ptr != 0)
2251 static SLJIT_INLINE void return_with_partial_match(compiler_common *common, struct sljit_label *quit)
2257 SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0
2258 && (common->mode == JIT_PARTIAL_SOFT_COMPILE ? common->hit_start != 0 : common->hit_start == 0));
2270 OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_ptr : (common->hit_start + (int)sizeof(sljit_sw)), SLJIT_S0, 0);
2277 OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start);
2293 static SLJIT_INLINE void check_start_used_ptr(compiler_common *common)
2299 if (common->mode == JIT_PARTIAL_SOFT_COMPILE)
2302 OP2(SLJIT_ADD, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, 1);
2306 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
2309 else if (common->mode == JIT_PARTIAL_HARD_COMPILE)
2311 jump = CMP(SLJIT_C_LESS_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
2312 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
2317 static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc)
2323 if (common->utf)
2335 return common->fcc[c] != c;
2341 return MAX_255(c) ? common->fcc[c] != c : FALSE;
2344 static SLJIT_INLINE unsigned int char_othercase(compiler_common *common, unsigned int c)
2348 if (common->utf && c > 127)
2357 return TABLE_GET(c, common->fcc, c);
2360 static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc)
2369 if (common->utf)
2373 oc = common->fcc[c];
2386 oc = TABLE_GET(c, common->fcc, c);
2390 oc = TABLE_GET(c, common->fcc, c);
2407 if (common->utf && c > 127)
2423 if (common->utf && c > 65535)
2436 static void check_partial(compiler_common *common, BOOL force)
2442 SLJIT_ASSERT(!force || common->mode != JIT_COMPILE);
2444 if (common->mode == JIT_COMPILE)
2448 jump = CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
2449 else if (common->mode == JIT_PARTIAL_SOFT_COMPILE)
2450 jump = CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1);
2452 if (common->mode == JIT_PARTIAL_SOFT_COMPILE)
2453 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0);
2456 if (common->partialmatchlabel != NULL)
2457 JUMPTO(SLJIT_JUMP, common->partialmatchlabel);
2459 add_jump(compiler, &common->partialmatch, JUMP(SLJIT_JUMP));
2466 static void check_str_end(compiler_common *common, jump_list **end_reached)
2472 if (common->mode == JIT_COMPILE)
2479 if (common->mode == JIT_PARTIAL_SOFT_COMPILE)
2481 add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
2482 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0);
2487 add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
2488 if (common->partialmatchlabel != NULL)
2489 JUMPTO(SLJIT_JUMP, common->partialmatchlabel);
2491 add_jump(compiler, &common->partialmatch, JUMP(SLJIT_JUMP));
2496 static void detect_partial_match(compiler_common *common, jump_list **backtracks)
2501 if (common->mode == JIT_COMPILE)
2509 add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
2510 if (common->mode == JIT_PARTIAL_SOFT_COMPILE)
2512 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0);
2517 if (common->partialmatchlabel != NULL)
2518 JUMPTO(SLJIT_JUMP, common->partialmatchlabel);
2520 add_jump(compiler, &common->partialmatch, JUMP(SLJIT_JUMP));
2525 static void peek_char(compiler_common *common, pcre_uint32 max)
2538 if (common->utf)
2544 add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
2551 if (common->utf)
2587 static void read_char7_type(compiler_common *common, BOOL full_read)
2595 SLJIT_ASSERT(common->utf);
2600 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2613 static void read_char_range(compiler_common *common, pcre_uint32 min, pcre_uint32 max, BOOL update_str_ptr)
2635 if (common->utf)
2685 add_jump(compiler, (max < 0x10000) ? &common->utfreadchar16 : &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
2710 if (common->utf)
2741 static SLJIT_INLINE void read_char(compiler_common *common)
2743 read_char_range(common, 0, READ_CHAR_MAX, TRUE);
2746 static void read_char8_type(compiler_common *common, BOOL update_str_ptr)
2763 if (common->utf)
2767 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2779 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2783 add_jump(compiler, &common->utfreadtype8, JUMP(SLJIT_FAST_CALL));
2794 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2800 if (common->utf && update_str_ptr)
2811 static void skip_char_back(compiler_common *common)
2819 if (common->utf)
2829 if (common->utf)
2846 static void check_newlinechar(compiler_common *common, int nltype, jump_list **backtracks, BOOL jumpifmatch)
2854 add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
2873 SLJIT_ASSERT(nltype == NLTYPE_FIXED && common->newline < 256);
2874 add_jump(compiler, backtracks, CMP(jumpifmatch ? SLJIT_C_EQUAL : SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
2881 static void do_utfreadchar(compiler_common *common)
2929 static void do_utfreadchar16(compiler_common *common)
2965 static void do_utfreadtype8(compiler_common *common)
2986 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
3011 static void do_getucd(compiler_common *common)
3033 static SLJIT_INLINE struct sljit_label *mainloop_entry(compiler_common *common, BOOL hascrorlf, BOOL firstline)
3048 if (!(hascrorlf || firstline) && (common->nltype == NLTYPE_ANY ||
3049 common->nltype == NLTYPE_ANYCRLF || common->newline > 255))
3055 SLJIT_ASSERT(common->first_line_end != 0);
3058 if (common->nltype == NLTYPE_FIXED && common->newline > 255)
3065 CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, mainloop);
3066 CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, mainloop);
3068 OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
3075 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0);
3076 read_char_range(common, common->nlmin, common->nlmax, TRUE);
3077 check_newlinechar(common, common->nltype, &newline, TRUE);
3080 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0);
3095 OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
3106 /* Increasing the STR_PTR here requires one less jump in the most common case. */
3108 if (common->utf) readuchar = TRUE;
3116 CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, newlinelabel);
3121 if (common->utf)
3129 if (common->utf)
3185 static int scan_prefix(compiler_common *common, pcre_uchar *cc, pcre_uint32 *chars, pcre_uint8 *bytes, int max_chars)
3265 if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc);
3267 max_chars = scan_prefix(common, cc + len, chars, bytes, max_chars);
3290 max_chars = scan_prefix(common, alternative + 1 + LINK_SIZE, chars, bytes, max_chars);
3303 if (common->utf && !is_char7_bitset((const pcre_uint8 *)(cc + 1), FALSE)) return consumed;
3311 if (common->utf) return consumed;
3320 if (common->utf) return consumed;
3329 if (common->utf && !is_char7_bitset((const pcre_uint8 *)common->ctypes - cbit_length + cbit_digit, FALSE))
3338 if (common->utf && !is_char7_bitset((const pcre_uint8 *)common->ctypes - cbit_length + cbit_space, FALSE))
3347 if (common->utf && !is_char7_bitset((const pcre_uint8 *)common->ctypes - cbit_length + cbit_word, FALSE))
3364 if (common->utf) return consumed;
3374 if (common->utf) return consumed;
3389 if (common->utf) return consumed;
3432 if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc);
3435 if (caseless && char_has_othercase(common, cc))
3438 if (common->utf)
3441 if ((int)PRIV(ord2utf)(char_othercase(common, chr), othercase) != len)
3448 othercase[0] = TABLE_GET(chr, common->fcc, chr);
3517 static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common, BOOL firstline)
3534 SLJIT_ASSERT(common->read_only_data_ptr == common->read_only_data);
3543 max = scan_prefix(common, common->start, chars, bytes, MAX_N_CHARS);
3586 if (common->read_only_data)
3587 SLJIT_FREE(common->read_only_data);
3589 common->read_only_data_size += 256;
3590 common->read_only_data = (sljit_uw *)SLJIT_MALLOC(common->read_only_data_size);
3591 if (common->read_only_data == NULL)
3594 update_table = (sljit_ub *)common->read_only_data;
3595 common->read_only_data_ptr = (sljit_uw *)(update_table + 256);
3682 SLJIT_ASSERT(common->first_line_end != 0);
3683 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end);
3754 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end);
3771 static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, pcre_uchar first_char, BOOL caseless, BOOL firstline)
3781 SLJIT_ASSERT(common->first_line_end != 0);
3783 OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end);
3793 oc = TABLE_GET(first_char, common->fcc, first_char);
3795 if (first_char > 127 && common->utf)
3828 static SLJIT_INLINE void fast_forward_newline(compiler_common *common, BOOL firstline)
3841 SLJIT_ASSERT(common->first_line_end != 0);
3843 OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end);
3846 if (common->nltype == NLTYPE_FIXED && common->newline > 255)
3867 CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, loop);
3868 CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, loop);
3882 skip_char_back(common);
3885 common->ff_newline_shortcut = loop;
3887 read_char_range(common, common->nlmin, common->nlmax, TRUE);
3889 if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
3891 check_newlinechar(common, common->nltype, &newline, FALSE);
3894 if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
3916 static BOOL check_class_ranges(compiler_common *common, const pcre_uint8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks);
3918 static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common, pcre_uint8 *start_bits, BOOL firstline)
3931 SLJIT_ASSERT(common->first_line_end != 0);
3933 OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end);
3940 if (common->utf)
3944 if (!check_class_ranges(common, start_bits, (start_bits[31] & 0x80) != 0, TRUE, &matches))
3960 if (common->utf)
3966 if (common->utf)
3973 if (common->utf)
3995 static SLJIT_INLINE struct sljit_jump *search_requested_char(compiler_common *common, pcre_uchar req_char, BOOL caseless, BOOL has_firstchar)
4006 SLJIT_ASSERT(common->req_char_ptr != 0);
4007 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr);
4024 oc = TABLE_GET(req_char, common->fcc, req_char);
4026 if (req_char > 127 && common->utf)
4052 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr, TMP1, 0);
4058 static void do_revertframes(compiler_common *common)
4093 static void check_wordboundary(compiler_common *common)
4110 skip_char_back(common);
4111 check_start_used_ptr(common);
4112 read_char(common);
4116 if (common->use_ucp)
4120 add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
4138 if (common->utf)
4141 OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);
4155 check_str_end(common, &skipread_list);
4156 peek_char(common, READ_CHAR_MAX);
4160 if (common->use_ucp)
4164 add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
4183 if (common->utf)
4186 OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);
4202 static BOOL check_class_ranges(compiler_common *common, const pcre_uint8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
4351 static void check_anynewline(compiler_common *common)
4364 if (common->utf)
4378 static void check_hspace(compiler_common *common)
4392 if (common->utf)
4417 static void check_vspace(compiler_common *common)
4430 if (common->utf)
4448 static void do_casefulcmp(compiler_common *common)
4477 static void do_caselesscmp(compiler_common *common)
4489 OP1(SLJIT_MOV, LCC_TABLE, 0, SLJIT_IMM, common->lcc);
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);
4614 if (common->utf && HAS_EXTRALEN(*cc))
4732 static void compile_xclass_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
4742 BOOL utf = common->utf;
4850 detect_partial_match(common, backtracks);
4851 read_char_range(common, min, max, (cc[-1] & XCL_NOT) != 0);
4858 if (!check_class_ranges(common, (const pcre_uint8 *)cc, (((const pcre_uint8 *)cc)[31] & 0x80) != 0, TRUE, &found))
4885 if (!check_class_ranges(common, (const pcre_uint8 *)cc, FALSE, TRUE, list))
4888 SLJIT_ASSERT(common->utf);
4912 add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
5233 static pcre_uchar *compile_char1_matchingpath(compiler_common *common, pcre_uchar type, pcre_uchar *cc, jump_list **backtracks)
5264 add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL));
5271 detect_partial_match(common, backtracks);
5273 if (common->utf && is_char7_bitset((const pcre_uint8*)common->ctypes - cbit_length + cbit_digit, FALSE))
5274 read_char7_type(common, type == OP_NOT_DIGIT);
5277 read_char8_type(common, type == OP_NOT_DIGIT);
5285 detect_partial_match(common, backtracks);
5287 if (common->utf && is_char7_bitset((const pcre_uint8*)common->ctypes - cbit_length + cbit_space, FALSE))
5288 read_char7_type(common, type == OP_NOT_WHITESPACE);
5291 read_char8_type(common, type == OP_NOT_WHITESPACE);
5298 detect_partial_match(common, backtracks);
5300 if (common->utf && is_char7_bitset((const pcre_uint8*)common->ctypes - cbit_length + cbit_word, FALSE))
5301 read_char7_type(common, type == OP_NOT_WORDCHAR);
5304 read_char8_type(common, type == OP_NOT_WORDCHAR);
5310 detect_partial_match(common, backtracks);
5311 read_char_range(common, common->nlmin, common->nlmax, TRUE);
5312 if (common->nltype == NLTYPE_FIXED && common->newline > 255)
5314 jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
5316 if (common->mode != JIT_PARTIAL_HARD_COMPILE)
5319 check_str_end(common, &end_list);
5322 add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, common->newline & 0xff));
5327 check_newlinechar(common, common->nltype, backtracks, TRUE);
5331 detect_partial_match(common, backtracks);
5333 if (common->utf)
5359 detect_partial_match(common, backtracks);
5372 compile_xclass_matchingpath(common, propdata, backtracks);
5378 detect_partial_match(common, backtracks);
5379 read_char_range(common, common->bsr_nlmin, common->bsr_nlmax, FALSE);
5383 if (common->mode != JIT_PARTIAL_HARD_COMPILE)
5386 check_str_end(common, &end_list);
5392 check_newlinechar(common, common->bsr_nltype, backtracks, FALSE);
5400 detect_partial_match(common, backtracks);
5401 read_char_range(common, 0x9, 0x3000, type == OP_NOT_HSPACE);
5402 add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));
5408 detect_partial_match(common, backtracks);
5409 read_char_range(common, 0xa, 0x2029, type == OP_NOT_VSPACE);
5410 add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));
5416 detect_partial_match(common, backtracks);
5417 read_char(common);
5418 add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
5427 read_char(common);
5428 add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
5443 if (common->mode == JIT_PARTIAL_HARD_COMPILE)
5447 check_partial(common, TRUE);
5456 if (common->nltype == NLTYPE_FIXED && common->newline > 255)
5460 if (common->mode == JIT_COMPILE)
5467 OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
5470 check_partial(common, TRUE);
5475 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
5476 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
5478 else if (common->nltype == NLTYPE_FIXED)
5483 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
5499 if (common->nltype == NLTYPE_ANYCRLF)
5508 read_char_range(common, common->nlmin, common->nlmax, TRUE);
5510 add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
5518 check_partial(common, FALSE);
5523 check_partial(common, FALSE);
5544 if (common->nltype == NLTYPE_FIXED && common->newline > 255)
5550 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
5551 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
5555 common);
5556 read_char_range(common, common->nlmin, common->nlmax, TRUE);
5557 check_newlinechar(common, common->nltype, backtracks, FALSE);
5567 if (!common->endonly)
5568 compile_char1_matchingpath(common, OP_EODN, cc, backtracks);
5572 check_partial(common, FALSE);
5581 check_partial(common, FALSE);
5585 if (common->nltype == NLTYPE_FIXED && common->newline > 255)
5589 if (common->mode == JIT_COMPILE)
5595 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
5596 check_partial(common, TRUE);
5602 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
5603 add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
5607 peek_char(common, common->nlmax);
5608 check_newlinechar(common, common->nltype, backtracks, FALSE);
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);
5632 detect_partial_match(common, backtracks);
5634 if (common->utf)
5642 if (type == OP_CHAR || !char_has_othercase(common, cc))
5644 read_char_range(common, c, c, FALSE);
5648 oc = char_othercase(common, c);
5649 read_char_range(common, c < oc ? c : oc, c > oc ? c : oc, FALSE);
5664 detect_partial_match(common, backtracks);
5667 if (common->utf)
5674 if (type == OP_NOT || !char_has_othercase(common, cc))
5700 if (type == OP_NOT || !char_has_othercase(common, cc))
5702 read_char_range(common, c, c, TRUE);
5707 oc = char_othercase(common, c);
5708 read_char_range(common, c < oc ? c : oc, c > oc ? c : oc, TRUE);
5725 detect_partial_match(common, backtracks);
5728 bit = (common->utf && is_char7_bitset((const pcre_uint8 *)cc, type == OP_NCLASS)) ? 127 : 255;
5729 read_char_range(common, 0, bit, type == OP_NCLASS);
5731 read_char_range(common, 0, 255, type == OP_NCLASS);
5734 if (check_class_ranges(common, (const pcre_uint8 *)cc, type == OP_NCLASS, FALSE, backtracks))
5739 if (common->utf)
5773 compile_xclass_matchingpath(common, cc + LINK_SIZE, backtracks);
5783 if (common->utf)
5789 skip_char_back(common);
5800 check_start_used_ptr(common);
5807 static SLJIT_INLINE pcre_uchar *compile_charn_matchingpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, jump_list **backtracks)
5826 if (common->utf && HAS_EXTRALEN(cc[1]))
5834 if (common->utf)
5836 if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
5843 if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
5865 do cc = byte_sequence_compare(common, *cc == OP_CHARI, cc + 1, &context, backtracks); while (context.length > 0);
5870 return compile_char1_matchingpath(common, *cc, cc + 1, backtracks);
5905 static void compile_dnref_search(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
5910 pcre_uchar *slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
5924 slot += common->name_entry_size;
5929 if (backtracks != NULL && !common->jscript_compat)
5935 static void compile_ref_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks, BOOL withchecks, BOOL emptyfail)
5949 if (withchecks && !common->jscript_compat)
5956 if (common->utf && *cc == OP_REFI)
5973 if (common->mode == JIT_COMPILE)
5979 check_partial(common, FALSE);
5998 if (common->mode == JIT_COMPILE)
6001 add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CALL));
6004 if (common->mode != JIT_COMPILE)
6013 add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CALL));
6016 check_partial(common, FALSE);
6031 static SLJIT_INLINE pcre_uchar *compile_ref_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6090 allocate_stack(common, 2);
6103 compile_dnref_search(common, ccbegin, NULL);
6113 allocate_stack(common, 1);
6124 compile_dnref_search(common, ccbegin, &backtrack->topbacktracks);
6137 compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, FALSE, FALSE);
6149 allocate_stack(common, 1);
6159 allocate_stack(common, 1);
6167 count_match(common);
6171 allocate_stack(common, ref ? 2 : 3);
6186 compile_dnref_search(common, ccbegin, NULL);
6204 compile_dnref_search(common, ccbegin, &backtrack->topbacktracks);
6217 compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, TRUE, TRUE);
6234 count_match(common);
6238 static SLJIT_INLINE pcre_uchar *compile_recurse_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6242 recurse_entry *entry = common->entries;
6251 if (get_framesize(common, common->start + start, NULL, TRUE, &needs_control_head) == no_stack)
6253 start_cc = common->start + start;
6254 compile_matchingpath(common, next_opcode(common, start_cc), bracketend(start_cc) - (1 + LINK_SIZE), backtrack);
6280 common->entries = entry;
6283 if (common->has_set_som && common->mark_ptr != 0)
6286 allocate_stack(common, 2);
6287 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
6291 else if (common->has_set_som || common->mark_ptr != 0)
6293 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr);
6294 allocate_stack(common, 1);
6358 static SLJIT_INLINE pcre_uchar *compile_callout_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
6365 allocate_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
6367 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
6369 SLJIT_ASSERT(common->capture_last_ptr != 0);
6378 if (common->mark_ptr != 0)
6382 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_ptr != 0) ? TMP2 : SLJIT_IMM, 0);
6391 free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
6396 if (common->forced_quit_label == NULL)
6397 add_jump(compiler, &common->forced_quit, JUMP(SLJIT_C_SIG_LESS));
6399 JUMPTO(SLJIT_C_SIG_LESS, common->forced_quit_label);
6406 static pcre_uchar *compile_assert_matchingpath(compiler_common *common, pcre_uchar *cc, assert_backtrack *backtrack, BOOL conditional)
6418 jump_list **target = (conditional) ? &backtrack->condfailed : &backtrack->common.topbacktracks;
6421 BOOL save_local_exit = common->local_exit;
6422 BOOL save_positive_assert = common->positive_assert;
6423 then_trap_backtrack *save_then_trap = common->then_trap;
6424 struct sljit_label *save_quit_label = common->quit_label;
6425 struct sljit_label *save_accept_label = common->accept_label;
6426 jump_list *save_quit = common->quit;
6427 jump_list *save_positive_assert_quit = common->positive_assert_quit;
6428 jump_list *save_accept = common->accept;
6433 common->then_trap = NULL;
6443 framesize = get_framesize(common, cc, NULL, FALSE, &needs_control_head);
6456 free_stack(common, 1);
6465 allocate_stack(common, extrasize);
6467 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
6471 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
6478 allocate_stack(common, framesize + extrasize);
6483 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
6489 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
6493 init_frame(common, ccbegin, NULL, framesize + extrasize - 1, extrasize, FALSE);
6500 common->local_exit = TRUE;
6501 common->quit_label = NULL;
6502 common->quit = NULL;
6503 common->positive_assert = FALSE;
6506 common->positive_assert = TRUE;
6507 common->positive_assert_quit = NULL;
6511 common->accept_label = NULL;
6512 common->accept = NULL;
6520 compile_matchingpath(common, ccbegin + 1 + LINK_SIZE, cc, &altbacktrack);
6525 common->local_exit = save_local_exit;
6526 common->quit_label = save_quit_label;
6527 common->quit = save_quit;
6529 common->positive_assert = save_positive_assert;
6530 common->then_trap = save_then_trap;
6531 common->accept_label = save_accept_label;
6532 common->positive_assert_quit = save_positive_assert_quit;
6533 common->accept = save_accept;
6536 common->accept_label = LABEL();
6537 if (common->accept != NULL)
6538 set_jumps(common->accept, common->accept_label);
6546 free_stack(common, extrasize);
6548 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
6557 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
6563 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_sw));
6564 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
6594 compile_backtrackingpath(common, altbacktrack.top);
6599 common->local_exit = save_local_exit;
6600 common->quit_label = save_quit_label;
6601 common->quit = save_quit;
6603 common->positive_assert = save_positive_assert;
6604 common->then_trap = save_then_trap;
6605 common->accept_label = save_accept_label;
6606 common->positive_assert_quit = save_positive_assert_quit;
6607 common->accept = save_accept;
6621 SLJIT_ASSERT(common->positive_assert_quit == NULL);
6623 common->positive_assert_quit = common->quit;
6627 if (common->positive_assert_quit != NULL)
6630 set_jumps(common->positive_assert_quit, LABEL());
6637 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
6644 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(1));
6658 free_stack(common, 1);
6662 free_stack(common, extrasize);
6670 free_stack(common, framesize + extrasize - 1);
6674 free_stack(common, framesize + extrasize);
6738 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
6741 set_jumps(backtrack->common.topbacktracks, LABEL());
6753 free_stack(common, 1);
6757 free_stack(common, extrasize);
6766 free_stack(common, framesize + extrasize - 1);
6770 free_stack(common, framesize + extrasize);
6784 SLJIT_ASSERT(found == &backtrack->common.topbacktracks);
6785 set_jumps(backtrack->common.topbacktracks, LABEL());
6786 backtrack->common.topbacktracks = NULL;
6792 common->local_exit = save_local_exit;
6793 common->quit_label = save_quit_label;
6794 common->quit = save_quit;
6796 common->positive_assert = save_positive_assert;
6797 common->then_trap = save_then_trap;
6798 common->accept_label = save_accept_label;
6799 common->positive_assert_quit = save_positive_assert_quit;
6800 common->accept = save_accept;
6804 static SLJIT_INLINE void match_once_common(compiler_common *common, pcre_uchar ket, int framesize, int private_data_ptr, BOOL has_alternatives, BOOL needs_control_head)
6818 free_stack(common, stacksize);
6847 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0);
6850 static SLJIT_INLINE int match_capture_common(compiler_common *common, int stacksize, int offset, int private_data_ptr)
6854 if (common->capture_last_ptr != 0)
6856 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
6857 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1);
6861 if (common->optimized_cbracket[offset >> 1] == 0)
6929 static pcre_uchar *compile_bracket_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
7003 if (common->optimized_cbracket[offset] == 0)
7023 BACKTRACK_AS(bracket_backtrack)->u.framesize = get_framesize(common, ccbegin, NULL, FALSE, &needs_control_head);
7034 allocate_stack(common, stacksize);
7052 free_stack(common, 1);
7110 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
7132 allocate_stack(common, stacksize);
7159 allocate_stack(common, stacksize);
7180 init_frame(common, ccbegin, NULL, BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize, stacksize + 1, FALSE);
7186 if (common->optimized_cbracket[offset >> 1] != 0)
7189 allocate_stack(common, 2);
7199 allocate_stack(common, 1);
7208 allocate_stack(common, 1);
7215 allocate_stack(common, 1);
7234 slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
7238 slot += common->name_entry_size;
7244 slot += common->name_entry_size;
7259 if (common->currententry == NULL)
7263 else if (common->currententry->start == 0)
7266 stacksize = stacksize == (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
7273 if (common->currententry == NULL || common->currententry->start == 0)
7278 slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
7279 i = (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
7284 slot += common->name_entry_size;
7293 /* The stacksize == 0 is a common "else" case. */
7313 assert->common.cc = matchingpath;
7315 matchingpath = compile_assert_matchingpath(common, matchingpath, assert, TRUE);
7319 compile_matchingpath(common, matchingpath, cc, backtrack);
7324 match_once_common(common, ket, BACKTRACK_AS(bracket_backtrack)->u.framesize, private_data_ptr, has_alternatives, needs_control_head);
7337 if (common->capture_last_ptr != 0)
7339 if (common->optimized_cbracket[offset >> 1] == 0)
7346 allocate_stack(common, stacksize);
7366 stacksize = match_capture_common(common, stacksize, offset, private_data_ptr);
7377 if (offset != 0 && common->optimized_cbracket[offset >> 1] != 0)
7393 free_stack(common, 1);
7405 free_stack(common, 1);
7418 count_match(common);
7426 allocate_stack(common, 1);
7446 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
7449 free_stack(common, 1);
7455 count_match(common);
7468 static pcre_uchar *compile_bracketpos_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
7508 SLJIT_ASSERT(common->optimized_cbracket[offset] == 0);
7519 framesize = get_framesize(common, cc, NULL, FALSE, &needs_control_head);
7526 if (common->capture_last_ptr != 0)
7538 allocate_stack(common, stacksize);
7549 if (common->capture_last_ptr != 0)
7550 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
7553 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
7554 if (common->capture_last_ptr != 0)
7563 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
7589 allocate_stack(common, stacksize);
7592 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
7612 init_frame(common, cc, NULL, stacksize - 1, stacksize - framesize, FALSE);
7626 compile_matchingpath(common, ccbegin, cc, backtrack);
7640 if (common->capture_last_ptr != 0)
7641 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1);
7665 if (common->capture_last_ptr != 0)
7666 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1);
7691 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack));
7694 flush_stubs(common);
7696 compile_backtrackingpath(common, backtrack->top);
7742 count_match(common);
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)
7829 *end = next_opcode(common, cc);
7838 if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc);
7844 static pcre_uchar *compile_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
7863 cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &min, &end);
7915 allocate_stack(common, 2);
7921 allocate_stack(common, 1);
7929 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
7942 allocate_stack(common, 1);
7951 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
7953 allocate_stack(common, 2);
7960 compile_char1_matchingpath(common, type, cc, &nomatch);
7987 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
7989 allocate_stack(common, 1);
7997 allocate_stack(common, 2);
8008 allocate_stack(common, 1);
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);
8086 count_match(common);
8090 static SLJIT_INLINE pcre_uchar *compile_fail_accept_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
8103 if (*cc == OP_ASSERT_ACCEPT || common->currententry != NULL || !common->might_be_empty)
8106 if (common->accept_label == NULL)
8107 add_jump(compiler, &common->accept, JUMP(SLJIT_JUMP));
8109 JUMPTO(SLJIT_JUMP, common->accept_label);
8113 if (common->accept_label == NULL)
8114 add_jump(compiler, &common->accept, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)));
8116 CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);
8121 if (common->accept_label == NULL)
8122 add_jump(compiler, &common->accept, CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, 0));
8124 CMPTO(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, 0, common->accept_label);
8126 if (common->accept_label == NULL)
8127 add_jump(compiler, &common->accept, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0));
8129 CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_PTR, 0, common->accept_label);
8134 static SLJIT_INLINE pcre_uchar *compile_close_matchingpath(compiler_common *common, pcre_uchar *cc)
8138 BOOL optimized_cbracket = common->optimized_cbracket[offset] != 0;
8141 if (common->currententry != NULL)
8153 static SLJIT_INLINE pcre_uchar *compile_control_verb_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
8167 allocate_stack(common, 1);
8176 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0);
8185 static SLJIT_INLINE void compile_then_trap_matchingpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, backtrack_common *parent)
8193 common->then_trap = BACKTRACK_AS(then_trap_backtrack);
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);
8201 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
8202 allocate_stack(common, size);
8204 OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
8206 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0);
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)
8227 SLJIT_ASSERT(*ccend != OP_END && common->control_head_ptr != 0);
8229 save_then_trap = common->then_trap;
8231 compile_then_trap_matchingpath(common, cc, ccend, parent);
8268 cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
8274 allocate_stack(common, 1);
8282 if (common->mode == JIT_COMPILE)
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);
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);
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);
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);
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);
8397 cc = compile_recurse_matchingpath(common, cc, parent);
8401 cc = compile_callout_matchingpath(common, cc, parent);
8409 cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE);
8417 allocate_stack(common, 1);
8422 allocate_stack(common, 2);
8428 count_match(common);
8439 cc = compile_bracket_matchingpath(common, cc, parent);
8444 cc = compile_bracket_matchingpath(common, cc, parent);
8448 cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE);
8457 cc = compile_bracketpos_matchingpath(common, cc, parent);
8462 SLJIT_ASSERT(common->mark_ptr != 0);
8463 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
8464 allocate_stack(common, common->has_skip_arg ? 5 : 1);
8466 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0);
8468 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0);
8470 if (common->has_skip_arg)
8472 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
8473 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0);
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);
8518 BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode;
8519 BACKTRACK_AS(then_trap_backtrack)->then_trap = common->then_trap;
8520 common->then_trap = save_then_trap;
8532 compile_backtrackingpath(common, (current)); \
8540 static void compile_iterator_backtrackingpath(compiler_common *common, struct backtrack_common *current)
8555 cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &min, NULL);
8568 free_stack(common, 1);
8587 skip_char_back(common);
8594 free_stack(common, 2);
8603 compile_char1_matchingpath(common, type, cc, &jumplist);
8608 free_stack(common, 1);
8621 compile_char1_matchingpath(common, type, cc, &jumplist);
8638 free_stack(common, 2);
8652 free_stack(common, 1);
8659 compile_char1_matchingpath(common, type, cc, &jumplist);
8664 free_stack(common, 1);
8684 static SLJIT_INLINE void compile_ref_iterator_backtrackingpath(compiler_common *common, struct backtrack_common *current)
8698 free_stack(common, 1);
8706 free_stack(common, ref ? 2 : 3);
8709 static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_common *common, struct backtrack_common *current)
8714 compile_backtrackingpath(common, current->top);
8719 if (common->has_set_som && common->mark_ptr != 0)
8723 free_stack(common, 2);
8725 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP1, 0);
8727 else if (common->has_set_som || common->mark_ptr != 0)
8730 free_stack(common, 1);
8731 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr, TMP2, 0);
8735 static void compile_assert_backtrackingpath(compiler_common *common, struct backtrack_common *current)
8763 free_stack(common, 1);
8774 free_stack(common, 1);
8777 free_stack(common, 1);
8784 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
8802 static void compile_bracket_backtrackingpath(compiler_common *common, struct backtrack_common *current)
8871 free_stack(common, 1);
8883 free_stack(common, 1);
8898 free_stack(common, 1);
8912 free_stack(common, 1);
8924 free_stack(common, 1);
8935 if (common->capture_last_ptr != 0)
8937 SLJIT_ASSERT(common->optimized_cbracket[offset >> 1] == 0);
8940 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, TMP1, 0);
8942 free_stack(common, 3);
8946 else if (common->optimized_cbracket[offset >> 1] == 0)
8950 free_stack(common, 2);
8961 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
8971 free_stack(common, 1);
8980 free_stack(common, 1);
8985 next_update_addr = common->read_only_data_ptr;
8986 common->read_only_data_ptr += alt_max;
8988 add_label_addr(common, next_update_addr++);
9012 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
9053 compile_matchingpath(common, ccprev, cc, current);
9061 match_once_common(common, ket, CURRENT_AS(bracket_backtrack)->u.framesize, private_data_ptr, has_alternatives, needs_control_head);
9074 if (common->capture_last_ptr != 0)
9076 if (common->optimized_cbracket[offset >> 1] == 0)
9083 allocate_stack(common, stacksize);
9103 stacksize = match_capture_common(common, stacksize, offset, private_data_ptr);
9108 if (offset != 0 && ket == OP_KETRMAX && common->optimized_cbracket[offset >> 1] != 0)
9120 add_label_addr(common, next_update_addr++);
9153 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
9161 free_stack(common, 1);
9167 if (common->optimized_cbracket[offset >> 1] != 0)
9171 free_stack(common, 2);
9178 free_stack(common, 1);
9185 free_stack(common, 1);
9202 free_stack(common, stacksize);
9212 free_stack(common, 2);
9227 free_stack(common, 1);
9235 free_stack(common, 1);
9246 free_stack(common, 1);
9249 free_stack(common, bra == OP_BRAMINZERO ? 2 : 1);
9251 free_stack(common, 1);
9261 static SLJIT_INLINE void compile_bracketpos_backtrackingpath(compiler_common *common, struct backtrack_common *current)
9275 if (common->capture_last_ptr != 0)
9278 if (common->capture_last_ptr != 0)
9279 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, TMP1, 0);
9282 free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
9287 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
9294 free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
9300 static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current)
9310 compile_bracket_matchingpath(common, current->cc, current);
9311 compile_bracket_backtrackingpath(common, current->top);
9316 backtrack.common.cc = current->cc;
9319 compile_assert_matchingpath(common, current->cc, &backtrack, FALSE);
9324 static SLJIT_INLINE void compile_control_verb_backtrackingpath(compiler_common *common, struct backtrack_common *current)
9333 if (common->then_trap != NULL)
9335 SLJIT_ASSERT(common->control_head_ptr != 0);
9337 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
9339 OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, common->then_trap->start);
9347 add_jump(compiler, &common->then_trap->quit, JUMP(SLJIT_JUMP));
9350 else if (common->positive_assert)
9352 add_jump(compiler, &common->positive_assert_quit, JUMP(SLJIT_JUMP));
9357 if (common->local_exit)
9359 if (common->quit_label == NULL)
9360 add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP));
9362 JUMPTO(SLJIT_JUMP, common->quit_label);
9368 SLJIT_ASSERT(common->control_head_ptr != 0);
9369 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
9376 add_jump(compiler, &common->reset_match, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, -1));
9384 add_jump(compiler, &common->reset_match, JUMP(SLJIT_JUMP));
9387 static SLJIT_INLINE void compile_then_trap_backtrackingpath(compiler_common *common, struct backtrack_common *current)
9395 common->then_trap = CURRENT_AS(then_trap_backtrack)->then_trap;
9403 free_stack(common, size);
9409 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
9411 free_stack(common, 3);
9414 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0);
9417 static void compile_backtrackingpath(compiler_common *common, struct backtrack_common *current)
9420 then_trap_backtrack *save_then_trap = common->then_trap;
9430 free_stack(common, 1);
9504 compile_iterator_backtrackingpath(common, current);
9511 compile_ref_iterator_backtrackingpath(common, current);
9515 compile_recurse_backtrackingpath(common, current);
9522 compile_assert_backtrackingpath(common, current);
9533 compile_bracket_backtrackingpath(common, current);
9538 compile_bracket_backtrackingpath(common, current);
9540 compile_assert_backtrackingpath(common, current);
9548 compile_bracketpos_backtrackingpath(common, current);
9552 compile_braminzero_backtrackingpath(common, current);
9556 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0));
9557 if (common->has_skip_arg)
9559 free_stack(common, common->has_skip_arg ? 5 : 1);
9560 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP1, 0);
9561 if (common->has_skip_arg)
9562 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0);
9571 compile_control_verb_backtrackingpath(common, current);
9575 if (!common->local_exit)
9577 if (common->quit_label == NULL)
9578 add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP));
9580 JUMPTO(SLJIT_JUMP, common->quit_label);
9592 compile_then_trap_backtrackingpath(common, current);
9601 common->then_trap = save_then_trap;
9604 static SLJIT_INLINE void compile_recurse(compiler_common *common)
9607 pcre_uchar *cc = common->start + common->currententry->start;
9611 int framesize = get_framesize(common, cc, NULL, TRUE, &needs_control_head);
9612 int private_data_size = get_private_data_copy_length(common, ccbegin, ccend, needs_control_head);
9619 common->then_trap = NULL;
9627 SLJIT_ASSERT(common->currententry->entry == NULL && common->recursive_head_ptr != 0);
9628 common->currententry->entry = LABEL();
9629 set_jumps(common->currententry->calls, common->currententry->entry);
9632 allocate_stack(common, private_data_size + framesize + alternativesize);
9634 copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
9636 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
9637 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0);
9639 init_frame(common, cc, NULL, framesize + alternativesize - 1, alternativesize, TRUE);
9645 common->quit_label = NULL;
9646 common->accept_label = NULL;
9647 common->quit = NULL;
9648 common->accept = NULL;
9659 compile_matchingpath(common, altbacktrack.cc, cc, &altbacktrack);
9663 add_jump(compiler, &common->accept, JUMP(SLJIT_JUMP));
9665 compile_backtrackingpath(common, altbacktrack.top);
9681 if (common->quit != NULL)
9683 set_jumps(common->quit, LABEL());
9684 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
9688 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
9692 common->quit = NULL;
9693 add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP));
9696 set_jumps(common->accept, LABEL());
9697 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
9701 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
9707 if (common->quit != NULL)
9708 set_jumps(common->quit, LABEL());
9709 copy_private_data(common, ccbegin, ccend, FALSE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
9710 free_stack(common, private_data_size + framesize + alternativesize);
9715 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP1, 0);
9717 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0);
9723 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP2, 0);
9737 compiler_common *common = &common_data;
9765 memset(common, 0, sizeof(compiler_common));
9768 common->start = rootbacktrack.cc;
9769 common->read_only_data = NULL;
9770 common->read_only_data_size = 0;
9771 common->read_only_data_ptr = NULL;
9772 common->fcc = tables + fcc_offset;
9773 common->lcc = (sljit_sw)(tables + lcc_offset);
9774 common->mode = mode;
9775 common->might_be_empty = study->minlength == 0;
9776 common->nltype = NLTYPE_FIXED;
9783 case -1: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANY; break;
9784 case -2: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANYCRLF; break;
9785 default: common->newline = NEWLINE; break;
9788 case PCRE_NEWLINE_CR: common->newline = CHAR_CR; break;
9789 case PCRE_NEWLINE_LF: common->newline = CHAR_NL; break;
9791 PCRE_NEWLINE_LF: common->newline = (CHAR_CR << 8) | CHAR_NL; break;
9792 case PCRE_NEWLINE_ANY: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANY; break;
9793 case PCRE_NEWLINE_ANYCRLF: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANYCRLF; break;
9796 common->nlmax = READ_CHAR_MAX;
9797 common->nlmin = 0;
9799 common->bsr_nltype = NLTYPE_ANYCRLF;
9801 common->bsr_nltype = NLTYPE_ANY;
9805 common->bsr_nltype = NLTYPE_ANYCRLF;
9807 common->bsr_nltype = NLTYPE_ANY;
9810 common->bsr_nlmax = READ_CHAR_MAX;
9811 common->bsr_nlmin = 0;
9812 common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
9813 common->ctypes = (sljit_sw)(tables + ctypes_offset);
9814 common->name_table = ((pcre_uchar *)re) + re->name_table_offset;
9815 common->name_count = re->name_count;
9816 common->name_entry_size = re->name_entry_size;
9817 common->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
9820 common->utf = (re->options & PCRE_UTF8) != 0;
9822 common->use_ucp = (re->options & PCRE_UCP) != 0;
9824 if (common->utf)
9826 if (common->nltype == NLTYPE_ANY)
9827 common->nlmax = 0x2029;
9828 else if (common->nltype == NLTYPE_ANYCRLF)
9829 common->nlmax = (CHAR_CR > CHAR_NL) ? CHAR_CR : CHAR_NL;
9833 common->nlmax = common->newline & 0xff;
9836 if (common->nltype == NLTYPE_FIXED)
9837 common->nlmin = common->newline & 0xff;
9839 common->nlmin = (CHAR_CR < CHAR_NL) ? CHAR_CR : CHAR_NL;
9841 if (common->bsr_nltype == NLTYPE_ANY)
9842 common->bsr_nlmax = 0x2029;
9844 common->bsr_nlmax = (CHAR_CR > CHAR_NL) ? CHAR_CR : CHAR_NL;
9845 common->bsr_nlmin = (CHAR_CR < CHAR_NL) ? CHAR_CR : CHAR_NL;
9848 ccend = bracketend(common->start);
9851 common->ovector_start = LIMIT_MATCH + sizeof(sljit_sw);
9852 common->optimized_cbracket = (pcre_uint8 *)SLJIT_MALLOC(re->top_bracket + 1);
9853 if (!common->optimized_cbracket)
9856 memset(common->optimized_cbracket, 0, re->top_bracket + 1);
9858 memset(common->optimized_cbracket, 1, re->top_bracket + 1);
9861 SLJIT_ASSERT(*common->start == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);
9863 common->capture_last_ptr = common->ovector_start;
9864 common->ovector_start += sizeof(sljit_sw);
9866 if (!check_opcode_types(common, common->start, ccend))
9868 SLJIT_FREE(common->optimized_cbracket);
9875 common->req_char_ptr = common->ovector_start;
9876 common->ovector_start += sizeof(sljit_sw);
9880 common->start_used_ptr = common->ovector_start;
9881 common->ovector_start += sizeof(sljit_sw);
9884 common->hit_start = common->ovector_start;
9885 common->ovector_start += 2 * sizeof(sljit_sw);
9890 common->needs_start_ptr = TRUE;
9895 common->first_line_end = common->ovector_start;
9896 common->ovector_start += sizeof(sljit_sw);
9899 common->control_head_ptr = 1;
9901 if (common->control_head_ptr != 0)
9903 common->control_head_ptr = common->ovector_start;
9904 common->ovector_start += sizeof(sljit_sw);
9906 if (common->needs_start_ptr && common->has_set_som)
9909 common->start_ptr = common->ovector_start;
9910 common->ovector_start += sizeof(sljit_sw);
9913 common->needs_start_ptr = FALSE;
9916 if ((common->ovector_start & sizeof(sljit_sw)) != 0)
9917 common->ovector_start += sizeof(sljit_sw);
9919 if (common->start_ptr == 0)
9920 common->start_ptr = OVECTOR(0);
9923 if (common->capture_last_ptr != 0)
9924 memset(common->optimized_cbracket, 0, re->top_bracket + 1);
9926 SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
9927 common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);
9929 total_length = ccend - common->start;
9930 common->private_data_ptrs = (sljit_si *)SLJIT_MALLOC(total_length * (sizeof(sljit_si) + (common->has_then ? 1 : 0)));
9931 if (!common->private_data_ptrs)
9933 SLJIT_FREE(common->optimized_cbracket);
9936 memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_si));
9938 private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw);
9939 set_private_data_ptrs(common, &private_data_size, ccend);
9942 SLJIT_FREE(common->private_data_ptrs);
9943 SLJIT_FREE(common->optimized_cbracket);
9947 if (common->has_then)
9949 common->then_offsets = (pcre_uint8 *)(common->private_data_ptrs + total_length);
9950 memset(common->then_offsets, 0, total_length);
9951 set_then_offsets(common, common->start, NULL);
9954 if (common->read_only_data_size > 0)
9956 common->read_only_data = (sljit_uw *)SLJIT_MALLOC(common->read_only_data_size);
9957 if (common->read_only_data == NULL)
9959 SLJIT_FREE(common->optimized_cbracket);
9960 SLJIT_FREE(common->private_data_ptrs);
9963 common->read_only_data_ptr = common->read_only_data;
9969 SLJIT_FREE(common->optimized_cbracket);
9970 SLJIT_FREE(common->private_data_ptrs);
9971 if (common->read_only_data)
9972 SLJIT_FREE(common->read_only_data);
9975 common->compiler = compiler;
9981 reset_ovector(common, (re->top_bracket + 1) * 2);
9982 if (common->req_char_ptr != 0)
9983 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr, SLJIT_R0, 0);
9996 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1);
9997 if (common->mark_ptr != 0)
9998 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0);
9999 if (common->control_head_ptr != 0)
10000 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
10005 mainloop_label = mainloop_entry(common, (re->flags & PCRE_HASCRORLF) != 0, (re->options & PCRE_FIRSTLINE) != 0);
10010 if (mode == JIT_COMPILE && fast_forward_first_n_chars(common, (re->options & PCRE_FIRSTLINE) != 0))
10013 if (common->read_only_data_size > 0 && common->read_only_data == NULL)
10016 SLJIT_FREE(common->optimized_cbracket);
10017 SLJIT_FREE(common->private_data_ptrs);
10022 fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
10024 fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
10026 fast_forward_start_bits(common, study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
10038 if (common->req_char_ptr != 0)
10039 reqbyte_notfound = search_requested_char(common, (pcre_uchar)re->req_char, (re->flags & PCRE_RCH_CASELESS) != 0, (re->flags & PCRE_FIRSTSET) != 0);
10045 if (common->capture_last_ptr != 0)
10046 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, -1);
10048 if (common->needs_start_ptr)
10050 SLJIT_ASSERT(common->start_ptr != OVECTOR(0));
10051 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_ptr, STR_PTR, 0);
10054 SLJIT_ASSERT(common->start_ptr == OVECTOR(0));
10059 jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1);
10060 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
10061 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start + sizeof(sljit_sw), STR_PTR, 0);
10065 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
10067 compile_matchingpath(common, common->start, ccend, &rootbacktrack);
10071 SLJIT_FREE(common->optimized_cbracket);
10072 common->private_data_ptrs);
10073 if (common->read_only_data)
10074 SLJIT_FREE(common->read_only_data);
10078 if (common->might_be_empty)
10084 common->accept_label = LABEL();
10085 if (common->accept != NULL)
10086 set_jumps(common->accept, common->accept_label);
10089 copy_ovector(common, re->top_bracket + 1);
10090 common->quit_label = common->forced_quit_label = LABEL();
10091 if (common->quit != NULL)
10092 set_jumps(common->quit, common->quit_label);
10093 if (common->forced_quit != NULL)
10094 set_jumps(common->forced_quit, common->forced_quit_label);
10096 SET_LABEL(minlength_check_failed, common->forced_quit_label);
10101 common->partialmatchlabel = LABEL();
10102 set_jumps(common->partialmatch, common->partialmatchlabel);
10103 return_with_partial_match(common, common->quit_label);
10106 if (common->might_be_empty)
10108 compile_backtrackingpath(common, rootbacktrack.top);
10112 SLJIT_FREE(common->optimized_cbracket);
10113 SLJIT_FREE(common->private_data_ptrs);
10114 if (common->read_only_data)
10115 SLJIT_FREE(common->read_only_data);
10125 jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0);
10126 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr);
10127 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1);
10128 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, TMP1, 0);
10135 SLJIT_ASSERT(common->first_line_end != 0);
10136 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end);
10139 OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
10143 if (common->ff_newline_shortcut != NULL)
10146 CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, common->ff_newline_shortcut);
10163 CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1, common->partialmatchlabel);
10166 JUMPTO(SLJIT_JUMP, common->quit_label);
10168 flush_stubs(common);
10170 if (common->might_be_empty)
10183 common->currententry = common->entries;
10184 common->local_exit = TRUE;
10185 quit_label = common->quit_label;
10186 while (common->currententry != NULL)
10189 compile_recurse(common);
10193 SLJIT_FREE(common->optimized_cbracket);
10194 SLJIT_FREE(common->private_data_ptrs);
10195 if (common->read_only_data)
10196 SLJIT_FREE(common->read_only_data);
10199 flush_stubs(common);
10200 common->currententry = common->currententry->next;
10202 common->local_exit = FALSE;
10203 common->quit_label = quit_label;
10207 set_jumps(common->stackalloc, LABEL());
10229 JUMPTO(SLJIT_JUMP, common->quit_label);
10232 set_jumps(common->calllimit, LABEL());
10234 JUMPTO(SLJIT_JUMP, common->quit_label);
10236 if (common->revertframes != NULL)
10238 set_jumps(common->revertframes, LABEL());
10239 do_revertframes(common);
10241 if (common->wordboundary != NULL)
10243 set_jumps(common->wordboundary, LABEL());
10244 check_wordboundary(common);
10246 if (common->anynewline != NULL)
10248 set_jumps(common->anynewline, LABEL());
10249 check_anynewline(common);
10251 if (common->hspace != NULL)
10253 set_jumps(common->hspace, LABEL());
10254 check_hspace(common);
10256 if (common->vspace != NULL)
10258 set_jumps(common->vspace, LABEL());
10259 check_vspace(common);
10261 if (common->casefulcmp != NULL)
10263 set_jumps(common->casefulcmp, LABEL());
10264 do_casefulcmp(common);
10266 if (common->caselesscmp != NULL)
10268 set_jumps(common->caselesscmp, LABEL());
10269 do_caselesscmp(common);
10271 if (common->reset_match != NULL)
10273 set_jumps(common->reset_match, LABEL());
10274 do_reset_match(common, (re->top_bracket + 1) * 2);
10281 if (common->utfreadchar != NULL)
10283 set_jumps(common->utfreadchar, LABEL());
10284 do_utfreadchar(common);
10286 if (common->utfreadchar16 != NULL)
10288 set_jumps(common->utfreadchar16, LABEL());
10289 do_utfreadchar16(common);
10291 if (common->utfreadtype8 != NULL)
10293 set_jumps(common->utfreadtype8, LABEL());
10294 do_utfreadtype8(common);
10299 if (common->getucd != NULL)
10301 set_jumps(common->getucd, LABEL());
10302 do_getucd(common);
10306 SLJIT_ASSERT(common->read_only_data + (common->read_only_data_size >> SLJIT_WORD_SHIFT) == common->read_only_data_ptr);
10307 SLJIT_FREE(common->optimized_cbracket);
10308 SLJIT_FREE(common->private_data_ptrs);
10312 label_addr = common->label_addrs;
10321 if (common->read_only_data)
10322 SLJIT_FREE(common->read_only_data);
10346 if (common->read_only_data)
10347 SLJIT_FREE(common->read_only_data);
10358 functions->read_only_data[mode] = common->read_only_data;