Lines Matching refs:common

250   backtrack_common common;  member
261 backtrack_common common; member
283 backtrack_common common; member
293 backtrack_common common; member
298 backtrack_common common; member
312 backtrack_common common; member
332 backtrack_common common; member
344 backtrack_common common; member
589 #define OVECTOR_START (common->ovector_start)
591 #define OVECTOR_PRIV(i) (common->cbra_ptr + (i) * (sljit_sw)sizeof(sljit_sw))
592 #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
611 struct sljit_compiler *compiler = common->compiler
867 static PCRE2_SPTR next_opcode(compiler_common *common, PCRE2_SPTR cc) in next_opcode() argument
869 SLJIT_UNUSED_ARG(common); in next_opcode()
1021 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in next_opcode()
1043 if (common->utf) return NULL; in next_opcode()
1068 static BOOL check_opcode_types(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend) in check_opcode_types() argument
1081 common->has_set_som = TRUE; in check_opcode_types()
1082 common->might_be_empty = TRUE; in check_opcode_types()
1088 if (common->iref_ptr == 0) in check_opcode_types()
1090 common->iref_ptr = common->ovector_start; in check_opcode_types()
1091 common->ovector_start += 3 * sizeof(sljit_sw); in check_opcode_types()
1096 common->optimized_cbracket[GET2(cc, 1)] = 0; in check_opcode_types()
1110 common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0; in check_opcode_types()
1124 common->optimized_cbracket[GET2(cc, 1)] = 0; in check_opcode_types()
1132 slot = common->name_table + GET2(cc, 1) * common->name_entry_size; in check_opcode_types()
1135 common->optimized_cbracket[GET2(slot, 0)] = 0; in check_opcode_types()
1136 slot += common->name_entry_size; in check_opcode_types()
1143 if (common->recursive_head_ptr == 0) in check_opcode_types()
1145 common->recursive_head_ptr = common->ovector_start; in check_opcode_types()
1146 common->ovector_start += sizeof(sljit_sw); in check_opcode_types()
1153 if (common->capture_last_ptr == 0) in check_opcode_types()
1155 common->capture_last_ptr = common->ovector_start; in check_opcode_types()
1156 common->ovector_start += sizeof(sljit_sw); in check_opcode_types()
1169 common->has_then = TRUE; in check_opcode_types()
1170 common->control_head_ptr = 1; in check_opcode_types()
1179 if (common->mark_ptr == 0) in check_opcode_types()
1181 common->mark_ptr = common->ovector_start; in check_opcode_types()
1182 common->ovector_start += sizeof(sljit_sw); in check_opcode_types()
1188 common->has_then = TRUE; in check_opcode_types()
1189 common->control_head_ptr = 1; in check_opcode_types()
1195 common->has_skip_in_assert_back = TRUE; in check_opcode_types()
1202 common->control_head_ptr = 1; in check_opcode_types()
1203 common->has_skip_arg = TRUE; in check_opcode_types()
1205 common->has_skip_in_assert_back = TRUE; in check_opcode_types()
1220 cc = next_opcode(common, cc); in check_opcode_types()
1239 static int detect_early_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start, sljit… in detect_early_fail() argument
1249 SLJIT_ASSERT(*cc != OP_CBRA || common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] != 0); in detect_early_fail()
1320 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in detect_early_fail()
1391 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in detect_early_fail()
1431 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in detect_early_fail()
1485 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0) in detect_early_fail()
1502 if (*cc == OP_CBRA && common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0) in detect_early_fail()
1505 count = detect_early_fail(common, cc, private_data_start, depth + 1, count); in detect_early_fail()
1529 common->fast_forward_bc_ptr = accelerated_start; in detect_early_fail()
1530common->private_data_ptrs[(accelerated_start + 1) - common->start] = ((*private_data_start) << 3) … in detect_early_fail()
1535common->private_data_ptrs[(accelerated_start + 1) - common->start] = ((*private_data_start) << 3) … in detect_early_fail()
1537 if (common->early_fail_start_ptr == 0) in detect_early_fail()
1538 common->early_fail_start_ptr = *private_data_start; in detect_early_fail()
1541 common->early_fail_end_ptr = *private_data_start; in detect_early_fail()
1549common->private_data_ptrs[(accelerated_start + 1) - common->start] = ((*private_data_start) << 3) … in detect_early_fail()
1551 if (common->early_fail_start_ptr == 0) in detect_early_fail()
1552 common->early_fail_start_ptr = *private_data_start; in detect_early_fail()
1555 common->early_fail_end_ptr = *private_data_start; in detect_early_fail()
1615 static BOOL detect_repeat(compiler_common *common, PCRE2_SPTR begin) in detect_repeat() argument
1630 if (common->private_data_ptrs[end - common->start - LINK_SIZE] != 0) in detect_repeat()
1676 common->private_data_ptrs[max_end - common->start - LINK_SIZE] = next_end - max_end; in detect_repeat()
1677common->private_data_ptrs[max_end - common->start - LINK_SIZE + 1] = (type == OP_BRAZERO) ? OP_UPT… in detect_repeat()
1679 common->private_data_ptrs[max_end - common->start - LINK_SIZE + 2] = max + 2; in detect_repeat()
1691 common->private_data_ptrs[end - common->start - LINK_SIZE] = max_end - end; in detect_repeat()
1692 common->private_data_ptrs[end - common->start - LINK_SIZE + 1] = OP_EXACT; in detect_repeat()
1693 common->private_data_ptrs[end - common->start - LINK_SIZE + 2] = min; in detect_repeat()
1752 static void set_private_data_ptrs(compiler_common *common, int *private_data_start, PCRE2_SPTR ccen… in set_private_data_ptrs() argument
1754 PCRE2_SPTR cc = common->start; in set_private_data_ptrs()
1771 if (detect_repeat(common, cc)) in set_private_data_ptrs()
1784 if (common->private_data_ptrs[cc + 1 - common->start] != 0) in set_private_data_ptrs()
1786 common->private_data_ptrs[cc - common->start] = private_data_ptr; in set_private_data_ptrs()
1788 cc += common->private_data_ptrs[cc + 1 - common->start]; in set_private_data_ptrs()
1805 common->private_data_ptrs[cc - common->start] = private_data_ptr; in set_private_data_ptrs()
1812 common->private_data_ptrs[cc - common->start] = private_data_ptr; in set_private_data_ptrs()
1822 common->private_data_ptrs[cc - common->start] = private_data_ptr; in set_private_data_ptrs()
1895 cc = next_opcode(common, cc); in set_private_data_ptrs()
1904 common->private_data_ptrs[cc - common->start] = private_data_ptr; in set_private_data_ptrs()
1914 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in set_private_data_ptrs()
1936 static int get_framesize(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, BOOL recursive, … in get_framesize() argument
1947 SLJIT_ASSERT(common->control_head_ptr != 0); in get_framesize()
1958 possessive = length = (common->capture_last_ptr != 0) ? 5 : 3; in get_framesize()
1962 cc = next_opcode(common, cc); in get_framesize()
1970 SLJIT_ASSERT(common->has_set_som); in get_framesize()
1984 SLJIT_ASSERT(common->mark_ptr != 0); in get_framesize()
1991 if (common->control_head_ptr != 0) in get_framesize()
1998 if (common->has_set_som && !setsom_found) in get_framesize()
2003 if (common->mark_ptr != 0 && !setmark_found) in get_framesize()
2008 if (common->capture_last_ptr != 0 && !capture_last_found) in get_framesize()
2021 if (common->capture_last_ptr != 0 && !capture_last_found) in get_framesize()
2032 if (common->control_head_ptr != 0) in get_framesize()
2108 cc = next_opcode(common, cc); in get_framesize()
2122 static void init_frame(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, int stackpos, int … in init_frame() argument
2140 cc = next_opcode(common, cc); in init_frame()
2148 SLJIT_ASSERT(common->has_set_som); in init_frame()
2165 SLJIT_ASSERT(common->mark_ptr != 0); in init_frame()
2168 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); in init_frame()
2169 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr); in init_frame()
2179 if (common->has_set_som && !setsom_found) in init_frame()
2188 if (common->mark_ptr != 0 && !setmark_found) in init_frame()
2190 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); in init_frame()
2191 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr); in init_frame()
2197 if (common->capture_last_ptr != 0 && !capture_last_found) in init_frame()
2199 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); in init_frame()
2200 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr); in init_frame()
2213 if (common->capture_last_ptr != 0 && !capture_last_found) in init_frame()
2215 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); in init_frame()
2216 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr); in init_frame()
2236 cc = next_opcode(common, cc); in init_frame()
2256 static void delayed_mem_copy_init(delayed_mem_copy_status *status, compiler_common *common) in delayed_mem_copy_init() argument
2268 status->compiler = common->compiler; in delayed_mem_copy_init()
2322 static int get_recurse_data_length(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, in get_recurse_data_length() argument
2336 SLJIT_ASSERT(common->control_head_ptr != 0); in get_recurse_data_length()
2347 SLJIT_ASSERT(common->has_set_som); in get_recurse_data_length()
2353 if (common->has_set_som) in get_recurse_data_length()
2355 if (common->mark_ptr != 0) in get_recurse_data_length()
2357 if (common->capture_last_ptr != 0) in get_recurse_data_length()
2392 if (common->capture_last_ptr != 0) in get_recurse_data_length()
2394 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0) in get_recurse_data_length()
2402 if (common->capture_last_ptr != 0) in get_recurse_data_length()
2420 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in get_recurse_data_length()
2429 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in get_recurse_data_length()
2438 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in get_recurse_data_length()
2477 SLJIT_ASSERT(common->mark_ptr != 0); in get_recurse_data_length()
2480 if (common->control_head_ptr != 0) in get_recurse_data_length()
2501 SLJIT_ASSERT(common->control_head_ptr != 0); in get_recurse_data_length()
2515 cc = next_opcode(common, cc); in get_recurse_data_length()
2548 static void copy_recurse_data(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, in copy_recurse_data() argument
2564 SLJIT_ASSERT(common->control_head_ptr != 0); in copy_recurse_data()
2615 delayed_mem_copy_init(&status, common); in copy_recurse_data()
2622 delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, common->recursive_head_ptr); in copy_recurse_data()
2625 delayed_mem_copy_move(&status, SLJIT_SP, common->recursive_head_ptr, base_reg, stackptr); in copy_recurse_data()
2634 delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, common->control_head_ptr); in copy_recurse_data()
2637 delayed_mem_copy_move(&status, SLJIT_SP, common->control_head_ptr, base_reg, stackptr); in copy_recurse_data()
2652 SLJIT_ASSERT(common->has_set_som); in copy_recurse_data()
2665 if (common->has_set_som && !setsom_found) in copy_recurse_data()
2671 if (common->mark_ptr != 0 && !setmark_found) in copy_recurse_data()
2673 kept_shared_srcw[kept_shared_count] = common->mark_ptr; in copy_recurse_data()
2678 if (common->capture_last_ptr != 0 && !capture_last_found) in copy_recurse_data()
2680 shared_srcw[0] = common->capture_last_ptr; in copy_recurse_data()
2722 if (common->capture_last_ptr != 0 && !capture_last_found) in copy_recurse_data()
2724 shared_srcw[2] = common->capture_last_ptr; in copy_recurse_data()
2729 if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0) in copy_recurse_data()
2744 if (common->capture_last_ptr != 0 && !capture_last_found) in copy_recurse_data()
2746 shared_srcw[2] = common->capture_last_ptr; in copy_recurse_data()
2776 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in copy_recurse_data()
2789 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in copy_recurse_data()
2802 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); in copy_recurse_data()
2868 SLJIT_ASSERT(common->mark_ptr != 0); in copy_recurse_data()
2871 kept_shared_srcw[0] = common->mark_ptr; in copy_recurse_data()
2875 if (common->control_head_ptr != 0 && !control_head_found) in copy_recurse_data()
2877 private_srcw[0] = common->control_head_ptr; in copy_recurse_data()
2885 SLJIT_ASSERT(common->control_head_ptr != 0); in copy_recurse_data()
2888 private_srcw[0] = common->control_head_ptr; in copy_recurse_data()
2896 cc = next_opcode(common, cc); in copy_recurse_data()
2967 static SLJIT_INLINE PCRE2_SPTR set_then_offsets(compiler_common *common, PCRE2_SPTR cc, sljit_u8 *c… in set_then_offsets() argument
2979 cc = next_opcode(common, cc); in set_then_offsets()
2981 current_offset = common->then_offsets + (cc - common->start); in set_then_offsets()
2986 cc = set_then_offsets(common, cc, current_offset); in set_then_offsets()
2990 current_offset = common->then_offsets + (cc + 1 + LINK_SIZE - common->start); in set_then_offsets()
2993 cc = next_opcode(common, cc); in set_then_offsets()
3034 static void add_stub(compiler_common *common, struct sljit_jump *start) in add_stub() argument
3043 list_item->next = common->stubs; in add_stub()
3044 common->stubs = list_item; in add_stub()
3048 static void flush_stubs(compiler_common *common) in flush_stubs() argument
3051 stub_list *list_item = common->stubs; in flush_stubs()
3056 add_jump(compiler, &common->stackalloc, JUMP(SLJIT_FAST_CALL)); in flush_stubs()
3060 common->stubs = NULL; in flush_stubs()
3063 static SLJIT_INLINE void count_match(compiler_common *common) in count_match() argument
3068 add_jump(compiler, &common->calllimit, JUMP(SLJIT_ZERO)); in count_match()
3071 static SLJIT_INLINE void allocate_stack(compiler_common *common, int size) in allocate_stack() argument
3085 add_stub(common, CMP(SLJIT_LESS, STACK_TOP, 0, STACK_LIMIT, 0)); in allocate_stack()
3088 static SLJIT_INLINE void free_stack(compiler_common *common, int size) in free_stack() argument
3096 static sljit_uw * allocate_read_only_data(compiler_common *common, sljit_uw size) in allocate_read_only_data() argument
3111 *(void**)result = common->read_only_data_head; in allocate_read_only_data()
3112 common->read_only_data_head = (void *)result; in allocate_read_only_data()
3116 static SLJIT_INLINE void reset_ovector(compiler_common *common, int length) in reset_ovector() argument
3155 static SLJIT_INLINE void reset_early_fail(compiler_common *common) in reset_early_fail() argument
3158 sljit_u32 size = (sljit_u32)(common->early_fail_end_ptr - common->early_fail_start_ptr); in reset_early_fail()
3164 SLJIT_ASSERT(common->early_fail_start_ptr < common->early_fail_end_ptr); in reset_early_fail()
3168 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->early_fail_start_ptr, SLJIT_IMM, 0); in reset_early_fail()
3180 for (i = common->early_fail_start_ptr; i < common->early_fail_end_ptr; i += sizeof(sljit_sw)) in reset_early_fail()
3185 GET_LOCAL_BASE(TMP1, 0, common->early_fail_start_ptr); in reset_early_fail()
3205 static SLJIT_INLINE void do_reset_match(compiler_common *common, int length) in do_reset_match() argument
3248 if (common->mark_ptr != 0) in do_reset_match()
3249 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0); in do_reset_match()
3250 if (common->control_head_ptr != 0) in do_reset_match()
3251 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); in do_reset_match()
3255 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); in do_reset_match()
3283 static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbracket) in copy_ovector() argument
3296 OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); in copy_ovector()
3297 if (common->mark_ptr != 0) in copy_ovector()
3298 OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); in copy_ovector()
3301 if (common->mark_ptr != 0) in copy_ovector()
3308 OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); in copy_ovector()
3310 if (common->mark_ptr != 0) in copy_ovector()
3311 OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); in copy_ovector()
3314 if (common->mark_ptr != 0) in copy_ovector()
3380 static SLJIT_INLINE void return_with_partial_match(compiler_common *common, struct sljit_label *qui… in return_with_partial_match() argument
3387 SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0 in return_with_partial_match()
3388 && (common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start != 0 : common->hit_start == 0)); in return_with_partial_match()
3393 common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start : common->start_ptr); in return_with_partial_match()
3418 static SLJIT_INLINE void check_start_used_ptr(compiler_common *common) in check_start_used_ptr() argument
3424 if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in check_start_used_ptr()
3427 OP2(SLJIT_ADD, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, 1); in check_start_used_ptr()
3431 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in check_start_used_ptr()
3434 else if (common->mode == PCRE2_JIT_PARTIAL_HARD) in check_start_used_ptr()
3436 jump = CMP(SLJIT_LESS_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in check_start_used_ptr()
3437 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in check_start_used_ptr()
3442 static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, PCRE2_SPTR cc) in char_has_othercase() argument
3448 if (common->utf || common->ucp) in char_has_othercase()
3450 if (common->utf) in char_has_othercase()
3460 return common->fcc[c] != c; in char_has_othercase()
3465 return MAX_255(c) ? common->fcc[c] != c : FALSE; in char_has_othercase()
3468 static SLJIT_INLINE unsigned int char_othercase(compiler_common *common, unsigned int c) in char_othercase() argument
3472 if ((common->utf || common->ucp) && c > 127) in char_othercase()
3475 return TABLE_GET(c, common->fcc, c); in char_othercase()
3478 static unsigned int char_get_othercase_bit(compiler_common *common, PCRE2_SPTR cc) in char_get_othercase_bit() argument
3487 if (common->utf || common->ucp) in char_get_othercase_bit()
3489 if (common->utf) in char_get_othercase_bit()
3497 oc = common->fcc[c]; in char_get_othercase_bit()
3504 oc = TABLE_GET(c, common->fcc, c); in char_get_othercase_bit()
3508 oc = TABLE_GET(c, common->fcc, c); in char_get_othercase_bit()
3525 if (common->utf && c > 127) in char_get_othercase_bit()
3541 if (common->utf && c > 65535) in char_get_othercase_bit()
3554 static void check_partial(compiler_common *common, BOOL force) in check_partial() argument
3560 SLJIT_ASSERT(!force || common->mode != PCRE2_JIT_COMPLETE); in check_partial()
3562 if (common->mode == PCRE2_JIT_COMPLETE) in check_partial()
3565 if (!force && !common->allow_empty_partial) in check_partial()
3566 jump = CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in check_partial()
3567 else if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in check_partial()
3568 jump = CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1); in check_partial()
3570 if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in check_partial()
3571 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); in check_partial()
3574 if (common->partialmatchlabel != NULL) in check_partial()
3575 JUMPTO(SLJIT_JUMP, common->partialmatchlabel); in check_partial()
3577 add_jump(compiler, &common->partialmatch, JUMP(SLJIT_JUMP)); in check_partial()
3584 static void check_str_end(compiler_common *common, jump_list **end_reached) in check_str_end() argument
3590 if (common->mode == PCRE2_JIT_COMPLETE) in check_str_end()
3597 if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in check_str_end()
3599 …add_jump(compiler, end_reached, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_… in check_str_end()
3600 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); in check_str_end()
3605 …add_jump(compiler, end_reached, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_… in check_str_end()
3606 if (common->partialmatchlabel != NULL) in check_str_end()
3607 JUMPTO(SLJIT_JUMP, common->partialmatchlabel); in check_str_end()
3609 add_jump(compiler, &common->partialmatch, JUMP(SLJIT_JUMP)); in check_str_end()
3614 static void detect_partial_match(compiler_common *common, jump_list **backtracks) in detect_partial_match() argument
3619 if (common->mode == PCRE2_JIT_COMPLETE) in detect_partial_match()
3627 if (!common->allow_empty_partial) in detect_partial_match()
3628 …add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_p… in detect_partial_match()
3629 else if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in detect_partial_match()
3630 …add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJI… in detect_partial_match()
3632 if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in detect_partial_match()
3634 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); in detect_partial_match()
3639 if (common->partialmatchlabel != NULL) in detect_partial_match()
3640 JUMPTO(SLJIT_JUMP, common->partialmatchlabel); in detect_partial_match()
3642 add_jump(compiler, &common->partialmatch, JUMP(SLJIT_JUMP)); in detect_partial_match()
3647 static void process_partial_match(compiler_common *common) in process_partial_match() argument
3653 if (common->mode == PCRE2_JIT_PARTIAL_SOFT) in process_partial_match()
3655 jump = CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in process_partial_match()
3656 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); in process_partial_match()
3659 else if (common->mode == PCRE2_JIT_PARTIAL_HARD) in process_partial_match()
3661 if (common->partialmatchlabel != NULL) in process_partial_match()
3662 …CMPTO(SLJIT_LESS, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0, common->partialmatchla… in process_partial_match()
3664 …add_jump(compiler, &common->partialmatch, CMP(SLJIT_LESS, SLJIT_MEM1(SLJIT_SP), common->start_used… in process_partial_match()
3668 static void detect_partial_match_to(compiler_common *common, struct sljit_label *label) in detect_partial_match_to() argument
3673 process_partial_match(common); in detect_partial_match_to()
3676 static void peek_char(compiler_common *common, sljit_u32 max, sljit_s32 dst, sljit_sw dstw, jump_li… in peek_char() argument
3694 if (common->utf) in peek_char()
3701 …add_jump(compiler, common->invalid_utf ? &common->utfreadchar_invalid : &common->utfreadchar, JUMP… in peek_char()
3703 if (backtracks && common->invalid_utf) in peek_char()
3708 if (common->utf) in peek_char()
3714 if (common->invalid_utf) in peek_char()
3719 add_jump(compiler, &common->utfreadchar_invalid, JUMP(SLJIT_FAST_CALL)); in peek_char()
3721 if (backtracks && common->invalid_utf) in peek_char()
3737 if (common->invalid_utf) in peek_char()
3760 static void peek_char_back(compiler_common *common, sljit_u32 max, jump_list **backtracks) in peek_char_back() argument
3777 if (common->utf) in peek_char_back()
3782 if (common->invalid_utf) in peek_char_back()
3784 add_jump(compiler, &common->utfpeakcharback_invalid, JUMP(SLJIT_FAST_CALL)); in peek_char_back()
3789 add_jump(compiler, &common->utfpeakcharback, JUMP(SLJIT_FAST_CALL)); in peek_char_back()
3793 if (common->utf) in peek_char_back()
3797 if (common->invalid_utf) in peek_char_back()
3800 add_jump(compiler, &common->utfpeakcharback_invalid, JUMP(SLJIT_FAST_CALL)); in peek_char_back()
3818 if (common->invalid_utf) in peek_char_back()
3833 static void read_char(compiler_common *common, sljit_u32 min, sljit_u32 max, in read_char() argument
3858 if (common->utf) in read_char()
3862 if (common->invalid_utf && !(options & READ_CHAR_VALID_UTF)) in read_char()
3867 add_jump(compiler, &common->utfreadnewline_invalid, JUMP(SLJIT_FAST_CALL)); in read_char()
3869 add_jump(compiler, &common->utfreadchar_invalid, JUMP(SLJIT_FAST_CALL)); in read_char()
3924 add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL)); in read_char()
3948 if (common->utf) in read_char()
3952 if (common->invalid_utf && !(options & READ_CHAR_VALID_UTF)) in read_char()
3958 add_jump(compiler, &common->utfreadnewline_invalid, JUMP(SLJIT_FAST_CALL)); in read_char()
3960 add_jump(compiler, &common->utfreadchar_invalid, JUMP(SLJIT_FAST_CALL)); in read_char()
4006 if (common->invalid_utf) in read_char()
4046 static void read_char7_type(compiler_common *common, jump_list **backtracks, BOOL negated) in read_char7_type() argument
4054 SLJIT_ASSERT(common->utf); in read_char7_type()
4060 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes); in read_char7_type()
4066 if (common->invalid_utf) in read_char7_type()
4068 add_jump(compiler, &common->utfreadchar_invalid, JUMP(SLJIT_FAST_CALL)); in read_char7_type()
4083 static void read_char8_type(compiler_common *common, jump_list **backtracks, BOOL negated) in read_char8_type() argument
4101 if (common->utf) in read_char8_type()
4104 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes); in read_char8_type()
4109 if (common->invalid_utf) in read_char8_type()
4115 if (common->invalid_utf) in read_char8_type()
4121 if (common->invalid_utf) in read_char8_type()
4126 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes); in read_char8_type()
4129 else if (common->invalid_utf) in read_char8_type()
4131 add_jump(compiler, &common->utfreadchar_invalid, JUMP(SLJIT_FAST_CALL)); in read_char8_type()
4137 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes); in read_char8_type()
4141 add_jump(compiler, &common->utfreadtype8, JUMP(SLJIT_FAST_CALL)); in read_char8_type()
4149 if (common->invalid_utf && negated) in read_char8_type()
4158 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes); in read_char8_type()
4164 if (common->utf && negated) in read_char8_type()
4167 if (!common->invalid_utf) in read_char8_type()
4202 static void move_back(compiler_common *common, jump_list **backtracks, BOOL must_be_valid) in move_back() argument
4220 if (common->utf) in move_back()
4222 if (!must_be_valid && common->invalid_utf) in move_back()
4227 add_jump(compiler, &common->utfmoveback_invalid, JUMP(SLJIT_FAST_CALL)); in move_back()
4242 if (common->utf) in move_back()
4247 if (!must_be_valid && common->invalid_utf) in move_back()
4251 add_jump(compiler, &common->utfmoveback_invalid, JUMP(SLJIT_FAST_CALL)); in move_back()
4267 if (common->invalid_utf && !must_be_valid) in move_back()
4288 static void check_newlinechar(compiler_common *common, int nltype, jump_list **backtracks, BOOL jum… in check_newlinechar() argument
4296 add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL)); in check_newlinechar()
4316 SLJIT_ASSERT(nltype == NLTYPE_FIXED && common->newline < 256); in check_newlinechar()
4317 …backtracks, CMP(jumpifmatch ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline)); in check_newlinechar()
4324 static void do_utfreadchar(compiler_common *common) in do_utfreadchar() argument
4369 static void do_utfreadtype8(compiler_common *common) in do_utfreadtype8() argument
4390 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes); in do_utfreadtype8()
4405 static void do_utfreadchar_invalid(compiler_common *common) in do_utfreadchar_invalid() argument
4564 static void do_utfreadnewline_invalid(compiler_common *common) in do_utfreadnewline_invalid() argument
4577 if (common->nltype != NLTYPE_ANY) in do_utfreadnewline_invalid()
4579 SLJIT_ASSERT(common->nltype != NLTYPE_FIXED || common->newline < 128); in do_utfreadnewline_invalid()
4648 static void do_utfmoveback_invalid(compiler_common *common) in do_utfmoveback_invalid() argument
4744 static void do_utfpeakcharback(compiler_common *common) in do_utfpeakcharback() argument
4781 static void do_utfpeakcharback_invalid(compiler_common *common) in do_utfpeakcharback_invalid() argument
4917 static void do_utfreadchar_invalid(compiler_common *common) in do_utfreadchar_invalid() argument
4949 static void do_utfreadnewline_invalid(compiler_common *common) in do_utfreadnewline_invalid() argument
4981 static void do_utfmoveback_invalid(compiler_common *common) in do_utfmoveback_invalid() argument
5009 static void do_utfpeakcharback_invalid(compiler_common *common) in do_utfpeakcharback_invalid() argument
5047 static void do_getucd(compiler_common *common) in do_getucd() argument
5068 if (!common->utf) in do_getucd()
5087 static void do_getucdtype(compiler_common *common) in do_getucdtype() argument
5108 if (!common->utf) in do_getucdtype()
5136 static SLJIT_INLINE struct sljit_label *mainloop_entry(compiler_common *common) in mainloop_entry() argument
5149 sljit_u32 overall_options = common->re->overall_options; in mainloop_entry()
5150 BOOL hascrorlf = (common->re->flags & PCRE2_HASCRORLF) != 0; in mainloop_entry()
5155 && (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF || common->newline > 255)) in mainloop_entry()
5158 SLJIT_ASSERT(common->abort_label == NULL); in mainloop_entry()
5163 SLJIT_ASSERT(common->match_end_ptr != 0); in mainloop_entry()
5166 if (common->nltype == NLTYPE_FIXED && common->newline > 255) in mainloop_entry()
5173 CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, mainloop); in mainloop_entry()
5174 CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, mainloop); in mainloop_entry()
5176 … OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); in mainloop_entry()
5183 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, STR_PTR, 0); in mainloop_entry()
5184 read_char(common, common->nlmin, common->nlmax, NULL, READ_CHAR_NEWLINE); in mainloop_entry()
5185 check_newlinechar(common, common->nltype, &newline, TRUE); in mainloop_entry()
5188 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, STR_PTR, 0); in mainloop_entry()
5197 SLJIT_ASSERT(common->match_end_ptr != 0); in mainloop_entry()
5225 add_jump(compiler, &common->abort, CMP(SLJIT_LESS, TMP2, 0, STR_PTR, 0)); in mainloop_entry()
5227 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, TMP2, 0); in mainloop_entry()
5238 OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff); in mainloop_entry()
5251 if (common->utf && !common->invalid_utf) readuchar = TRUE; in mainloop_entry()
5259 CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, newlinelabel); in mainloop_entry()
5264 if (common->invalid_utf) in mainloop_entry()
5276 else if (common->utf) in mainloop_entry()
5284 if (common->invalid_utf) in mainloop_entry()
5296 else if (common->utf) in mainloop_entry()
5362 static int scan_prefix(compiler_common *common, PCRE2_SPTR cc, fast_forward_char_data *chars, int m… in scan_prefix() argument
5455 if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc); in scan_prefix()
5457 max_chars = scan_prefix(common, cc + len, chars, max_chars, rec_count); in scan_prefix()
5479 max_chars = scan_prefix(common, alternative + 1 + LINK_SIZE, chars, max_chars, rec_count); in scan_prefix()
5492 if (common->utf && !is_char7_bitset((const sljit_u8 *)(cc + 1), FALSE)) in scan_prefix()
5500 if (common->utf) return consumed; in scan_prefix()
5508 if (common->utf) return consumed; in scan_prefix()
5517 …if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_digit, F… in scan_prefix()
5526 …if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_space, F… in scan_prefix()
5535 …if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_word, FA… in scan_prefix()
5552 if (common->utf) return consumed; in scan_prefix()
5562 if (common->utf) return consumed; in scan_prefix()
5577 if (common->utf) return consumed; in scan_prefix()
5618 max_chars = scan_prefix(common, cc + 1, chars, max_chars, rec_count); in scan_prefix()
5704 if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc); in scan_prefix()
5707 if (caseless && char_has_othercase(common, cc)) in scan_prefix()
5710 if (common->utf) in scan_prefix()
5713 if ((int)PRIV(ord2utf)(char_othercase(common, chr), othercase) != len) in scan_prefix()
5721 if (common->ucp && chr > 127) in scan_prefix()
5725 othercase[0] = TABLE_GET(chr, common->fcc, chr); in scan_prefix()
5790 static BOOL check_fast_forward_char_pair_simd(compiler_common *common, fast_forward_char_data *char… in check_fast_forward_char_pair_simd() argument
5831 fast_forward_char_pair_simd(common, max_i, chars[max_i].chars[0], chars[max_i].chars[1], max_j, cha… in check_fast_forward_char_pair_simd()
5837 static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2,… in fast_forward_first_char2() argument
5844 BOOL has_match_end = (common->match_end_ptr != 0); in fast_forward_first_char2()
5846 SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE || offset == 0); in fast_forward_first_char2()
5849 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); in fast_forward_first_char2()
5867 fast_forward_char_simd(common, char1, char2, offset); in fast_forward_first_char2()
5882 if (common->mode == PCRE2_JIT_COMPLETE) in fast_forward_first_char2()
5883 add_jump(compiler, &common->failed_match, partial_quit); in fast_forward_first_char2()
5907 if (common->utf && offset > 0) in fast_forward_first_char2()
5916 if (common->mode != PCRE2_JIT_COMPLETE) in fast_forward_first_char2()
5923 static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common) in fast_forward_first_n_chars() argument
5945 max = scan_prefix(common, common->start, chars, MAX_N_CHARS, &rec_count); in fast_forward_first_n_chars()
5975 if (JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD && check_fast_forward_char_pair_simd(common, chars, max)) in fast_forward_first_n_chars()
6006 update_table = (sljit_u8 *)allocate_read_only_data(common, 256); in fast_forward_first_n_chars()
6050 fast_forward_first_char2(common, chars[offset].chars[0], chars[offset].chars[1], offset); in fast_forward_first_n_chars()
6056 if (common->match_end_ptr != 0) in fast_forward_first_n_chars()
6058 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); in fast_forward_first_n_chars()
6061 add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS)); in fast_forward_first_n_chars()
6068 add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS)); in fast_forward_first_n_chars()
6077 add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0)); in fast_forward_first_n_chars()
6118 if (common->utf && offset != 0) in fast_forward_first_n_chars()
6138 if (common->match_end_ptr != 0) in fast_forward_first_n_chars()
6145 static SLJIT_INLINE void fast_forward_first_char(compiler_common *common) in fast_forward_first_char() argument
6147 PCRE2_UCHAR first_char = (PCRE2_UCHAR)(common->re->first_codeunit); in fast_forward_first_char()
6151 if ((common->re->flags & PCRE2_FIRSTCASELESS) != 0) in fast_forward_first_char()
6153 oc = TABLE_GET(first_char, common->fcc, first_char); in fast_forward_first_char()
6155 if (first_char > 127 && (common->utf || common->ucp)) in fast_forward_first_char()
6160 fast_forward_first_char2(common, first_char, oc, 0); in fast_forward_first_char()
6163 static SLJIT_INLINE void fast_forward_newline(compiler_common *common) in fast_forward_newline() argument
6174 if (common->match_end_ptr != 0) in fast_forward_newline()
6177 OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); in fast_forward_newline()
6180 if (common->nltype == NLTYPE_FIXED && common->newline > 255) in fast_forward_newline()
6209 CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, loop); in fast_forward_newline()
6210 CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, loop); in fast_forward_newline()
6216 if (common->match_end_ptr != 0) in fast_forward_newline()
6231 move_back(common, NULL, FALSE); in fast_forward_newline()
6234 common->ff_newline_shortcut = loop; in fast_forward_newline()
6236 read_char(common, common->nlmin, common->nlmax, NULL, READ_CHAR_NEWLINE); in fast_forward_newline()
6238 if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF) in fast_forward_newline()
6240 check_newlinechar(common, common->nltype, &newline, FALSE); in fast_forward_newline()
6243 if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF) in fast_forward_newline()
6261 if (common->match_end_ptr != 0) in fast_forward_newline()
6265 static BOOL optimize_class(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert,…
6267 static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common) in fast_forward_start_bits() argument
6270 const sljit_u8 *start_bits = common->re->start_bitmap; in fast_forward_start_bits()
6278 if (common->match_end_ptr != 0) in fast_forward_start_bits()
6280 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); in fast_forward_start_bits()
6290 if (common->mode == PCRE2_JIT_COMPLETE) in fast_forward_start_bits()
6291 add_jump(compiler, &common->failed_match, partial_quit); in fast_forward_start_bits()
6296 if (!optimize_class(common, start_bits, (start_bits[31] & 0x80) != 0, FALSE, &matches)) in fast_forward_start_bits()
6304 if (common->utf && is_char7_bitset(start_bits, FALSE)) in fast_forward_start_bits()
6332 if (common->mode != PCRE2_JIT_COMPLETE) in fast_forward_start_bits()
6335 if (common->match_end_ptr != 0) in fast_forward_start_bits()
6339 static SLJIT_INLINE jump_list *search_requested_char(compiler_common *common, PCRE2_UCHAR req_char,… in search_requested_char() argument
6350 SLJIT_ASSERT(common->req_char_ptr != 0); in search_requested_char()
6352 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr); in search_requested_char()
6364 oc = TABLE_GET(req_char, common->fcc, req_char); in search_requested_char()
6366 if (req_char > 127 && (common->utf || common->ucp)) in search_requested_char()
6374 not_found = fast_requested_char_simd(common, req_char, oc); in search_requested_char()
6408 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr, TMP1, 0); in search_requested_char()
6415 static void do_revertframes(compiler_common *common) in do_revertframes() argument
6469 static void check_wordboundary(compiler_common *common) in check_wordboundary() argument
6493 if (common->invalid_utf) in check_wordboundary()
6495 peek_char_back(common, READ_CHAR_MAX, &invalid_utf1); in check_wordboundary()
6497 if (common->mode != PCRE2_JIT_COMPLETE) in check_wordboundary()
6500 move_back(common, NULL, TRUE); in check_wordboundary()
6501 check_start_used_ptr(common); in check_wordboundary()
6508 if (common->mode == PCRE2_JIT_COMPLETE) in check_wordboundary()
6509 peek_char_back(common, READ_CHAR_MAX, NULL); in check_wordboundary()
6512 move_back(common, NULL, TRUE); in check_wordboundary()
6513 check_start_used_ptr(common); in check_wordboundary()
6514 read_char(common, 0, READ_CHAR_MAX, NULL, READ_CHAR_UPDATE_STR_PTR); in check_wordboundary()
6520 if (common->ucp) in check_wordboundary()
6524 add_jump(compiler, &common->getucdtype, JUMP(SLJIT_FAST_CALL)); in check_wordboundary()
6542 if (common->utf) in check_wordboundary()
6545 OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes); in check_wordboundary()
6558 check_str_end(common, &skipread_list); in check_wordboundary()
6559 peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, &invalid_utf2); in check_wordboundary()
6566 if (common->ucp) in check_wordboundary()
6570 add_jump(compiler, &common->getucdtype, JUMP(SLJIT_FAST_CALL)); in check_wordboundary()
6589 if (common->utf) in check_wordboundary()
6592 OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes); in check_wordboundary()
6609 if (common->invalid_utf) in check_wordboundary()
6613 peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, NULL); in check_wordboundary()
6628 static BOOL optimize_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL … in optimize_class_ranges() argument
6780 static BOOL optimize_class_chars(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL i… in optimize_class_chars() argument
6881 static BOOL optimize_class(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert,… in optimize_class() argument
6884 if (optimize_class_ranges(common, bits, nclass, invert, backtracks)) in optimize_class()
6886 return optimize_class_chars(common, bits, nclass, invert, backtracks); in optimize_class()
6889 static void check_anynewline(compiler_common *common) in check_anynewline() argument
6902 if (common->utf) in check_anynewline()
6916 static void check_hspace(compiler_common *common) in check_hspace() argument
6930 if (common->utf) in check_hspace()
6955 static void check_vspace(compiler_common *common) in check_vspace() argument
6968 if (common->utf) in check_vspace()
6983 static void do_casefulcmp(compiler_common *common) in do_casefulcmp() argument
7063 static void do_caselesscmp(compiler_common *common) in do_caselesscmp() argument
7100 OP1(SLJIT_MOV, lcc_table, 0, SLJIT_IMM, common->lcc); in do_caselesscmp()
7161 static PCRE2_SPTR byte_sequence_compare(compiler_common *common, BOOL caseless, PCRE2_SPTR cc, in byte_sequence_compare() argument
7171 if (caseless && char_has_othercase(common, cc)) in byte_sequence_compare()
7173 othercasebit = char_get_othercase_bit(common, cc); in byte_sequence_compare()
7218 if (common->utf && HAS_EXTRALEN(*cc)) in byte_sequence_compare()
7336 static PCRE2_SPTR compile_char1_matchingpath(compiler_common *common, PCRE2_UCHAR type, PCRE2_SPTR …
7338 static void compile_xclass_matchingpath(compiler_common *common, PCRE2_SPTR cc, jump_list **backtra… in compile_xclass_matchingpath() argument
7348 BOOL utf = common->utf; in compile_xclass_matchingpath()
7421 compile_char1_matchingpath(common, OP_ALLANY, cc, backtracks, FALSE); in compile_xclass_matchingpath()
7467 read_char(common, min, max, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_xclass_matchingpath()
7471 read_char(common, min, max, (needstype || needsscript) ? backtracks : NULL, 0); in compile_xclass_matchingpath()
7473 read_char(common, min, max, NULL, 0); in compile_xclass_matchingpath()
7482 …if (!optimize_class(common, (const sljit_u8 *)cc, (((const sljit_u8 *)cc)[31] & 0x80) != 0, TRUE, … in compile_xclass_matchingpath()
7509 if (!optimize_class(common, (const sljit_u8 *)cc, FALSE, TRUE, list)) in compile_xclass_matchingpath()
7513 if (common->utf) in compile_xclass_matchingpath()
7525 if (common->utf) in compile_xclass_matchingpath()
7541 if (!common->utf) in compile_xclass_matchingpath()
7936 static PCRE2_SPTR compile_simple_assertion_matchingpath(compiler_common *common, PCRE2_UCHAR type, … in compile_simple_assertion_matchingpath() argument
7971 add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL)); in compile_simple_assertion_matchingpath()
7973 if (common->invalid_utf) in compile_simple_assertion_matchingpath()
7986 if (common->nltype == NLTYPE_FIXED && common->newline > 255) in compile_simple_assertion_matchingpath()
7990 if (common->mode == PCRE2_JIT_COMPLETE) in compile_simple_assertion_matchingpath()
7997 … OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff); in compile_simple_assertion_matchingpath()
8000 check_partial(common, TRUE); in compile_simple_assertion_matchingpath()
8005 …add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0… in compile_simple_assertion_matchingpath()
8006 … add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff)); in compile_simple_assertion_matchingpath()
8008 else if (common->nltype == NLTYPE_FIXED) in compile_simple_assertion_matchingpath()
8013 add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline)); in compile_simple_assertion_matchingpath()
8029 if (common->nltype == NLTYPE_ANYCRLF) in compile_simple_assertion_matchingpath()
8038 read_char(common, common->nlmin, common->nlmax, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_simple_assertion_matchingpath()
8040 add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL)); in compile_simple_assertion_matchingpath()
8049 if (common->mode != PCRE2_JIT_COMPLETE) in compile_simple_assertion_matchingpath()
8050 check_partial(common, TRUE); in compile_simple_assertion_matchingpath()
8055 if (common->mode != PCRE2_JIT_COMPLETE) in compile_simple_assertion_matchingpath()
8056 check_partial(common, TRUE); in compile_simple_assertion_matchingpath()
8069 if (!common->endonly) in compile_simple_assertion_matchingpath()
8070 compile_simple_assertion_matchingpath(common, OP_EODN, cc, backtracks); in compile_simple_assertion_matchingpath()
8074 check_partial(common, FALSE); in compile_simple_assertion_matchingpath()
8088 check_partial(common, FALSE); in compile_simple_assertion_matchingpath()
8092 if (common->nltype == NLTYPE_FIXED && common->newline > 255) in compile_simple_assertion_matchingpath()
8096 if (common->mode == PCRE2_JIT_COMPLETE) in compile_simple_assertion_matchingpath()
8102 …add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0… in compile_simple_assertion_matchingpath()
8103 check_partial(common, TRUE); in compile_simple_assertion_matchingpath()
8109 …add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0… in compile_simple_assertion_matchingpath()
8110 … add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff)); in compile_simple_assertion_matchingpath()
8114 peek_char(common, common->nlmax, TMP3, 0, NULL); in compile_simple_assertion_matchingpath()
8115 check_newlinechar(common, common->nltype, backtracks, FALSE); in compile_simple_assertion_matchingpath()
8157 if (!common->alt_circumflex) in compile_simple_assertion_matchingpath()
8160 if (common->nltype == NLTYPE_FIXED && common->newline > 255) in compile_simple_assertion_matchingpath()
8166 …add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0… in compile_simple_assertion_matchingpath()
8167 … add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff)); in compile_simple_assertion_matchingpath()
8171 peek_char_back(common, common->nlmax, backtracks); in compile_simple_assertion_matchingpath()
8172 check_newlinechar(common, common->nltype, backtracks, FALSE); in compile_simple_assertion_matchingpath()
8189 if (common->utf) in compile_simple_assertion_matchingpath()
8194 move_back(common, backtracks, FALSE); in compile_simple_assertion_matchingpath()
8204 check_start_used_ptr(common); in compile_simple_assertion_matchingpath()
8420 static PCRE2_SPTR compile_char1_matchingpath(compiler_common *common, PCRE2_UCHAR type, PCRE2_SPTR … in compile_char1_matchingpath() argument
8438 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8440 …if (common->utf && is_char7_bitset((const sljit_u8*)common->ctypes - cbit_length + cbit_digit, FAL… in compile_char1_matchingpath()
8441 read_char7_type(common, backtracks, type == OP_NOT_DIGIT); in compile_char1_matchingpath()
8444 read_char8_type(common, backtracks, type == OP_NOT_DIGIT); in compile_char1_matchingpath()
8453 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8455 …if (common->utf && is_char7_bitset((const sljit_u8*)common->ctypes - cbit_length + cbit_space, FAL… in compile_char1_matchingpath()
8456 read_char7_type(common, backtracks, type == OP_NOT_WHITESPACE); in compile_char1_matchingpath()
8459 read_char8_type(common, backtracks, type == OP_NOT_WHITESPACE); in compile_char1_matchingpath()
8467 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8469 …if (common->utf && is_char7_bitset((const sljit_u8*)common->ctypes - cbit_length + cbit_word, FALS… in compile_char1_matchingpath()
8470 read_char7_type(common, backtracks, type == OP_NOT_WORDCHAR); in compile_char1_matchingpath()
8473 read_char8_type(common, backtracks, type == OP_NOT_WORDCHAR); in compile_char1_matchingpath()
8480 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8481 read_char(common, common->nlmin, common->nlmax, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8482 if (common->nltype == NLTYPE_FIXED && common->newline > 255) in compile_char1_matchingpath()
8484 jump[0] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff); in compile_char1_matchingpath()
8486 if (common->mode != PCRE2_JIT_PARTIAL_HARD) in compile_char1_matchingpath()
8489 check_str_end(common, &end_list); in compile_char1_matchingpath()
8492 add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline & 0xff)); in compile_char1_matchingpath()
8497 check_newlinechar(common, common->nltype, backtracks, TRUE); in compile_char1_matchingpath()
8502 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8504 if (common->utf) in compile_char1_matchingpath()
8506 if (common->invalid_utf) in compile_char1_matchingpath()
8508 read_char(common, 0, READ_CHAR_MAX, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8537 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8550 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8551 compile_xclass_matchingpath(common, propdata, backtracks); in compile_char1_matchingpath()
8557 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8558 read_char(common, common->bsr_nlmin, common->bsr_nlmax, NULL, 0); in compile_char1_matchingpath()
8562 if (common->mode != PCRE2_JIT_PARTIAL_HARD) in compile_char1_matchingpath()
8565 check_str_end(common, &end_list); in compile_char1_matchingpath()
8571 check_newlinechar(common, common->bsr_nltype, backtracks, FALSE); in compile_char1_matchingpath()
8580 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8583 read_char(common, 0x9, 0x3000, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8585 read_char(common, 0x9, 0x3000, NULL, 0); in compile_char1_matchingpath()
8587 add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL)); in compile_char1_matchingpath()
8595 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8598 read_char(common, 0xa, 0x2029, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8600 read_char(common, 0xa, 0x2029, NULL, 0); in compile_char1_matchingpath()
8602 add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL)); in compile_char1_matchingpath()
8610 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8617common->utf ? (common->invalid_utf ? SLJIT_FUNC_OFFSET(do_extuni_utf_invalid) : SLJIT_FUNC_OFFSET(… in compile_char1_matchingpath()
8618 if (common->invalid_utf) in compile_char1_matchingpath()
8622common->invalid_utf ? SLJIT_FUNC_OFFSET(do_extuni_utf_invalid) : SLJIT_FUNC_OFFSET(do_extuni_no_ut… in compile_char1_matchingpath()
8623 if (!common->utf || common->invalid_utf) in compile_char1_matchingpath()
8629 if (common->mode == PCRE2_JIT_PARTIAL_HARD) in compile_char1_matchingpath()
8633 check_partial(common, TRUE); in compile_char1_matchingpath()
8643 if (common->utf && HAS_EXTRALEN(*cc)) length += GET_EXTRALEN(*cc); in compile_char1_matchingpath()
8646 if (check_str_ptr && common->mode != PCRE2_JIT_COMPLETE) in compile_char1_matchingpath()
8647 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8649 if (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0) in compile_char1_matchingpath()
8652 if (length > 1 || (check_str_ptr && common->mode == PCRE2_JIT_COMPLETE)) in compile_char1_matchingpath()
8660 return byte_sequence_compare(common, type == OP_CHARI, cc, &context, backtracks); in compile_char1_matchingpath()
8664 if (common->utf) in compile_char1_matchingpath()
8672 SLJIT_ASSERT(type == OP_CHARI && char_has_othercase(common, cc)); in compile_char1_matchingpath()
8674 if (check_str_ptr && common->mode == PCRE2_JIT_COMPLETE) in compile_char1_matchingpath()
8677 oc = char_othercase(common, c); in compile_char1_matchingpath()
8678 read_char(common, c < oc ? c : oc, c > oc ? c : oc, NULL, 0); in compile_char1_matchingpath()
8699 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8703 if (common->utf) in compile_char1_matchingpath()
8707 if (c < 128 && !common->invalid_utf) in compile_char1_matchingpath()
8710 if (type == OP_NOT || !char_has_othercase(common, cc)) in compile_char1_matchingpath()
8736 if (type == OP_NOT || !char_has_othercase(common, cc)) in compile_char1_matchingpath()
8738 read_char(common, c, c, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8743 oc = char_othercase(common, c); in compile_char1_matchingpath()
8744 read_char(common, c < oc ? c : oc, c > oc ? c : oc, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8762 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8765 bit = (common->utf && is_char7_bitset((const sljit_u8 *)cc, type == OP_NCLASS)) ? 127 : 255; in compile_char1_matchingpath()
8767 read_char(common, 0, bit, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8769 read_char(common, 0, bit, NULL, 0); in compile_char1_matchingpath()
8772 read_char(common, 0, 255, backtracks, READ_CHAR_UPDATE_STR_PTR); in compile_char1_matchingpath()
8774 read_char(common, 0, 255, NULL, 0); in compile_char1_matchingpath()
8777 if (optimize_class(common, (const sljit_u8 *)cc, type == OP_NCLASS, FALSE, backtracks)) in compile_char1_matchingpath()
8782 if (common->utf) in compile_char1_matchingpath()
8816 detect_partial_match(common, backtracks); in compile_char1_matchingpath()
8817 compile_xclass_matchingpath(common, cc + LINK_SIZE, backtracks); in compile_char1_matchingpath()
8825 static SLJIT_INLINE PCRE2_SPTR compile_charn_matchingpath(compiler_common *common, PCRE2_SPTR cc, P… in compile_charn_matchingpath() argument
8844 if (common->utf && HAS_EXTRALEN(cc[1])) in compile_charn_matchingpath()
8852 if (common->utf) in compile_charn_matchingpath()
8854 if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0) in compile_charn_matchingpath()
8861 if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0) in compile_charn_matchingpath()
8883 …do cc = byte_sequence_compare(common, *cc == OP_CHARI, cc + 1, &context, backtracks); while (conte… in compile_charn_matchingpath()
8888 return compile_char1_matchingpath(common, *cc, cc + 1, backtracks, TRUE); in compile_charn_matchingpath()
8923 static void compile_dnref_search(compiler_common *common, PCRE2_SPTR cc, jump_list **backtracks) in compile_dnref_search() argument
8928 PCRE2_SPTR slot = common->name_table + GET2(cc, 1) * common->name_entry_size; in compile_dnref_search()
8942 slot += common->name_entry_size; in compile_dnref_search()
8947 if (backtracks != NULL && !common->unset_backref) in compile_dnref_search()
8953 static void compile_ref_matchingpath(compiler_common *common, PCRE2_SPTR cc, jump_list **backtracks… in compile_ref_matchingpath() argument
8975 if (withchecks && !common->unset_backref) in compile_ref_matchingpath()
8982 if (common->utf && *cc == OP_REFI) in compile_ref_matchingpath()
8984 SLJIT_ASSERT(common->iref_ptr != 0); in compile_ref_matchingpath()
8994 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->iref_ptr, source_reg, 0); in compile_ref_matchingpath()
8995 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw), source_end_reg, 0); in compile_ref_matchingpath()
8996 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw) * 2, char1_reg, 0); in compile_ref_matchingpath()
9009 read_char(common, 0, READ_CHAR_MAX, NULL, READ_CHAR_UPDATE_STR_PTR | READ_CHAR_VALID_UTF); in compile_ref_matchingpath()
9016 read_char(common, 0, READ_CHAR_MAX, &no_match, READ_CHAR_UPDATE_STR_PTR); in compile_ref_matchingpath()
9022 add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL)); in compile_ref_matchingpath()
9047 if (common->mode == PCRE2_JIT_COMPLETE) in compile_ref_matchingpath()
9050 OP1(SLJIT_MOV, source_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr); in compile_ref_matchingpath()
9051 OP1(SLJIT_MOV, source_end_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw)); in compile_ref_matchingpath()
9052 OP1(SLJIT_MOV, char1_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw) * 2); in compile_ref_matchingpath()
9055 if (common->mode != PCRE2_JIT_COMPLETE) in compile_ref_matchingpath()
9058 OP1(SLJIT_MOV, source_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr); in compile_ref_matchingpath()
9059 OP1(SLJIT_MOV, source_end_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw)); in compile_ref_matchingpath()
9060 OP1(SLJIT_MOV, char1_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw) * 2); in compile_ref_matchingpath()
9062 check_partial(common, FALSE); in compile_ref_matchingpath()
9067 OP1(SLJIT_MOV, source_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr); in compile_ref_matchingpath()
9068 OP1(SLJIT_MOV, source_end_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw)); in compile_ref_matchingpath()
9069 OP1(SLJIT_MOV, char1_reg, 0, SLJIT_MEM1(SLJIT_SP), common->iref_ptr + sizeof(sljit_sw) * 2); in compile_ref_matchingpath()
9085 if (common->mode == PCRE2_JIT_COMPLETE) in compile_ref_matchingpath()
9088 …add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CAL… in compile_ref_matchingpath()
9091 if (common->mode != PCRE2_JIT_COMPLETE) in compile_ref_matchingpath()
9100 …add_jump(compiler, *cc == OP_REF ? &common->casefulcmp : &common->caselesscmp, JUMP(SLJIT_FAST_CAL… in compile_ref_matchingpath()
9103 check_partial(common, FALSE); in compile_ref_matchingpath()
9118 static SLJIT_INLINE PCRE2_SPTR compile_ref_iterator_matchingpath(compiler_common *common, PCRE2_SPT… in compile_ref_iterator_matchingpath() argument
9177 allocate_stack(common, 2); in compile_ref_iterator_matchingpath()
9190 compile_dnref_search(common, ccbegin, NULL); in compile_ref_iterator_matchingpath()
9200 allocate_stack(common, 1); in compile_ref_iterator_matchingpath()
9211 compile_dnref_search(common, ccbegin, &backtrack->topbacktracks); in compile_ref_iterator_matchingpath()
9224 compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, FALSE, FALSE); in compile_ref_iterator_matchingpath()
9236 allocate_stack(common, 1); in compile_ref_iterator_matchingpath()
9246 allocate_stack(common, 1); in compile_ref_iterator_matchingpath()
9254 count_match(common); in compile_ref_iterator_matchingpath()
9258 allocate_stack(common, ref ? 2 : 3); in compile_ref_iterator_matchingpath()
9273 compile_dnref_search(common, ccbegin, NULL); in compile_ref_iterator_matchingpath()
9291 compile_dnref_search(common, ccbegin, &backtrack->topbacktracks); in compile_ref_iterator_matchingpath()
9304 compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, TRUE, TRUE); in compile_ref_iterator_matchingpath()
9321 count_match(common); in compile_ref_iterator_matchingpath()
9325 static SLJIT_INLINE PCRE2_SPTR compile_recurse_matchingpath(compiler_common *common, PCRE2_SPTR cc,… in compile_recurse_matchingpath() argument
9329 recurse_entry *entry = common->entries; in compile_recurse_matchingpath()
9338 if (get_framesize(common, common->start + start, NULL, TRUE, &needs_control_head) == no_stack) in compile_recurse_matchingpath()
9340 start_cc = common->start + start; in compile_recurse_matchingpath()
9341 …compile_matchingpath(common, next_opcode(common, start_cc), bracketend(start_cc) - (1 + LINK_SIZE)… in compile_recurse_matchingpath()
9369 common->entries = entry; in compile_recurse_matchingpath()
9441 static SLJIT_INLINE PCRE2_SPTR compile_callout_matchingpath(compiler_common *common, PCRE2_SPTR cc,… in compile_callout_matchingpath() argument
9451 sljit_uw callout_arg_size = (common->re->top_bracket + 1) * 2 * sizeof(sljit_sw); in compile_callout_matchingpath()
9457 allocate_stack(common, callout_arg_size); in compile_callout_matchingpath()
9459 SLJIT_ASSERT(common->capture_last_ptr != 0); in compile_callout_matchingpath()
9460 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); in compile_callout_matchingpath()
9465 OP1(SLJIT_MOV_U32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_top), SLJIT_IMM, common->re->t… in compile_callout_matchingpath()
9470 if (common->mark_ptr != 0) in compile_callout_matchingpath()
9492 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_ptr != 0) ? TMP2 : SL… in compile_callout_matchingpath()
9503 free_stack(common, callout_arg_size); in compile_callout_matchingpath()
9508 if (common->abort_label == NULL) in compile_callout_matchingpath()
9509 add_jump(compiler, &common->abort, JUMP(SLJIT_NOT_EQUAL32) /* SIG_LESS */); in compile_callout_matchingpath()
9511 JUMPTO(SLJIT_NOT_EQUAL32 /* SIG_LESS */, common->abort_label); in compile_callout_matchingpath()
9548 static PCRE2_SPTR compile_assert_matchingpath(compiler_common *common, PCRE2_SPTR cc, assert_backtr… in compile_assert_matchingpath() argument
9561 jump_list **target = (conditional) ? &backtrack->condfailed : &backtrack->common.topbacktracks; in compile_assert_matchingpath()
9564 BOOL save_local_quit_available = common->local_quit_available; in compile_assert_matchingpath()
9565 BOOL save_in_positive_assertion = common->in_positive_assertion; in compile_assert_matchingpath()
9566 then_trap_backtrack *save_then_trap = common->then_trap; in compile_assert_matchingpath()
9567 struct sljit_label *save_quit_label = common->quit_label; in compile_assert_matchingpath()
9568 struct sljit_label *save_accept_label = common->accept_label; in compile_assert_matchingpath()
9569 jump_list *save_quit = common->quit; in compile_assert_matchingpath()
9570 jump_list *save_positive_assertion_quit = common->positive_assertion_quit; in compile_assert_matchingpath()
9571 jump_list *save_accept = common->accept; in compile_assert_matchingpath()
9576 common->then_trap = NULL; in compile_assert_matchingpath()
9586 framesize = get_framesize(common, cc, NULL, FALSE, &needs_control_head); in compile_assert_matchingpath()
9599 free_stack(common, 1); in compile_assert_matchingpath()
9616 allocate_stack(common, extrasize); in compile_assert_matchingpath()
9619 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_assert_matchingpath()
9627 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); in compile_assert_matchingpath()
9634 allocate_stack(common, framesize + extrasize); in compile_assert_matchingpath()
9640 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_assert_matchingpath()
9647 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); in compile_assert_matchingpath()
9652 init_frame(common, ccbegin, NULL, framesize + extrasize - 1, extrasize); in compile_assert_matchingpath()
9660 common->local_quit_available = TRUE; in compile_assert_matchingpath()
9661 common->quit_label = NULL; in compile_assert_matchingpath()
9662 common->quit = NULL; in compile_assert_matchingpath()
9665 common->in_positive_assertion = (opcode == OP_ASSERT || opcode == OP_ASSERTBACK); in compile_assert_matchingpath()
9666 common->positive_assertion_quit = NULL; in compile_assert_matchingpath()
9670 common->accept_label = NULL; in compile_assert_matchingpath()
9671 common->accept = NULL; in compile_assert_matchingpath()
9679 compile_matchingpath(common, ccbegin + 1 + LINK_SIZE, cc, &altbacktrack); in compile_assert_matchingpath()
9684 common->local_quit_available = save_local_quit_available; in compile_assert_matchingpath()
9685 common->quit_label = save_quit_label; in compile_assert_matchingpath()
9686 common->quit = save_quit; in compile_assert_matchingpath()
9688 common->in_positive_assertion = save_in_positive_assertion; in compile_assert_matchingpath()
9689 common->then_trap = save_then_trap; in compile_assert_matchingpath()
9690 common->accept_label = save_accept_label; in compile_assert_matchingpath()
9691 common->positive_assertion_quit = save_positive_assertion_quit; in compile_assert_matchingpath()
9692 common->accept = save_accept; in compile_assert_matchingpath()
9695 common->accept_label = LABEL(); in compile_assert_matchingpath()
9696 if (common->accept != NULL) in compile_assert_matchingpath()
9697 set_jumps(common->accept, common->accept_label); in compile_assert_matchingpath()
9705 free_stack(common, extrasize); in compile_assert_matchingpath()
9708 … OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1)); in compile_assert_matchingpath()
9717 … OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1)); in compile_assert_matchingpath()
9723 …OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-frame… in compile_assert_matchingpath()
9724 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_assert_matchingpath()
9758 compile_backtrackingpath(common, altbacktrack.top); in compile_assert_matchingpath()
9763 common->local_quit_available = save_local_quit_available; in compile_assert_matchingpath()
9764 common->quit_label = save_quit_label; in compile_assert_matchingpath()
9765 common->quit = save_quit; in compile_assert_matchingpath()
9767 common->in_positive_assertion = save_in_positive_assertion; in compile_assert_matchingpath()
9768 common->then_trap = save_then_trap; in compile_assert_matchingpath()
9769 common->accept_label = save_accept_label; in compile_assert_matchingpath()
9770 common->positive_assertion_quit = save_positive_assertion_quit; in compile_assert_matchingpath()
9771 common->accept = save_accept; in compile_assert_matchingpath()
9785 SLJIT_ASSERT(common->positive_assertion_quit == NULL); in compile_assert_matchingpath()
9787 common->positive_assertion_quit = common->quit; in compile_assert_matchingpath()
9791 if (common->positive_assertion_quit != NULL) in compile_assert_matchingpath()
9794 set_jumps(common->positive_assertion_quit, LABEL()); in compile_assert_matchingpath()
9801 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_assert_matchingpath()
9808 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(1)); in compile_assert_matchingpath()
9822 free_stack(common, 1); in compile_assert_matchingpath()
9826 free_stack(common, extrasize); in compile_assert_matchingpath()
9834 free_stack(common, framesize + extrasize - 1); in compile_assert_matchingpath()
9838 free_stack(common, framesize + extrasize); in compile_assert_matchingpath()
9905 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_assert_matchingpath()
9910 set_jumps(backtrack->common.topbacktracks, LABEL()); in compile_assert_matchingpath()
9924 free_stack(common, 1); in compile_assert_matchingpath()
9928 free_stack(common, extrasize); in compile_assert_matchingpath()
9937 free_stack(common, framesize + extrasize - 1); in compile_assert_matchingpath()
9941 free_stack(common, framesize + extrasize); in compile_assert_matchingpath()
9955 SLJIT_ASSERT(found == &backtrack->common.topbacktracks); in compile_assert_matchingpath()
9956 set_jumps(backtrack->common.topbacktracks, LABEL()); in compile_assert_matchingpath()
9957 backtrack->common.topbacktracks = NULL; in compile_assert_matchingpath()
9963 common->local_quit_available = save_local_quit_available; in compile_assert_matchingpath()
9964 common->quit_label = save_quit_label; in compile_assert_matchingpath()
9965 common->quit = save_quit; in compile_assert_matchingpath()
9967 common->in_positive_assertion = save_in_positive_assertion; in compile_assert_matchingpath()
9968 common->then_trap = save_then_trap; in compile_assert_matchingpath()
9969 common->accept_label = save_accept_label; in compile_assert_matchingpath()
9970 common->positive_assertion_quit = save_positive_assertion_quit; in compile_assert_matchingpath()
9971 common->accept = save_accept; in compile_assert_matchingpath()
9975 static SLJIT_INLINE void match_once_common(compiler_common *common, PCRE2_UCHAR ket, int framesize,… in match_once_common() argument
9991 free_stack(common, stacksize); in match_once_common()
10020 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0); in match_once_common()
10023 static SLJIT_INLINE int match_capture_common(compiler_common *common, int stacksize, int offset, in… in match_capture_common() argument
10027 if (common->capture_last_ptr != 0) in match_capture_common()
10029 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); in match_capture_common()
10030 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1); in match_capture_common()
10034 if (common->optimized_cbracket[offset >> 1] == 0) in match_capture_common()
10066 static SLJIT_INLINE void match_script_run_common(compiler_common *common, int private_data_ptr, bac… in match_script_run_common() argument
10075 common->utf ? SLJIT_FUNC_OFFSET(do_script_run_utf) : SLJIT_FUNC_OFFSET(do_script_run)); in match_script_run_common()
10137 static PCRE2_SPTR compile_bracket_matchingpath(compiler_common *common, PCRE2_SPTR cc, backtrack_co… in compile_bracket_matchingpath() argument
10206 if (common->optimized_cbracket[offset] == 0) in compile_bracket_matchingpath()
10226 …BACKTRACK_AS(bracket_backtrack)->u.framesize = get_framesize(common, ccbegin, NULL, FALSE, &needs_… in compile_bracket_matchingpath()
10237 allocate_stack(common, stacksize); in compile_bracket_matchingpath()
10255 free_stack(common, 1); in compile_bracket_matchingpath()
10310 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_bracket_matchingpath()
10332 allocate_stack(common, stacksize); in compile_bracket_matchingpath()
10359 allocate_stack(common, stacksize); in compile_bracket_matchingpath()
10380 …init_frame(common, ccbegin, NULL, BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize, stacks… in compile_bracket_matchingpath()
10386 if (common->optimized_cbracket[offset >> 1] != 0) in compile_bracket_matchingpath()
10389 allocate_stack(common, 2); in compile_bracket_matchingpath()
10399 allocate_stack(common, 1); in compile_bracket_matchingpath()
10408 allocate_stack(common, 1); in compile_bracket_matchingpath()
10415 allocate_stack(common, 1); in compile_bracket_matchingpath()
10434 slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size; in compile_bracket_matchingpath()
10438 slot += common->name_entry_size; in compile_bracket_matchingpath()
10444 slot += common->name_entry_size; in compile_bracket_matchingpath()
10466 if (common->currententry == NULL) in compile_bracket_matchingpath()
10470 else if (common->currententry->start == 0) in compile_bracket_matchingpath()
10473 … stacksize = stacksize == (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE); in compile_bracket_matchingpath()
10480 if (common->currententry == NULL || common->currententry->start == 0) in compile_bracket_matchingpath()
10485 slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size; in compile_bracket_matchingpath()
10486 i = (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE); in compile_bracket_matchingpath()
10491 slot += common->name_entry_size; in compile_bracket_matchingpath()
10520 assert->common.cc = matchingpath; in compile_bracket_matchingpath()
10522 matchingpath = compile_assert_matchingpath(common, matchingpath, assert, TRUE); in compile_bracket_matchingpath()
10526 compile_matchingpath(common, matchingpath, cc, backtrack); in compile_bracket_matchingpath()
10534 …match_once_common(common, ket, BACKTRACK_AS(bracket_backtrack)->u.framesize, private_data_ptr, has… in compile_bracket_matchingpath()
10537 match_script_run_common(common, private_data_ptr, backtrack); in compile_bracket_matchingpath()
10550 if (common->capture_last_ptr != 0) in compile_bracket_matchingpath()
10552 if (common->optimized_cbracket[offset >> 1] == 0) in compile_bracket_matchingpath()
10559 allocate_stack(common, stacksize); in compile_bracket_matchingpath()
10579 stacksize = match_capture_common(common, stacksize, offset, private_data_ptr); in compile_bracket_matchingpath()
10603 if (offset != 0 && common->optimized_cbracket[offset >> 1] != 0) in compile_bracket_matchingpath()
10619 free_stack(common, 1); in compile_bracket_matchingpath()
10633 free_stack(common, 1); in compile_bracket_matchingpath()
10646 count_match(common); in compile_bracket_matchingpath()
10654 allocate_stack(common, 1); in compile_bracket_matchingpath()
10674 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_bracket_matchingpath()
10678 free_stack(common, 1); in compile_bracket_matchingpath()
10684 count_match(common); in compile_bracket_matchingpath()
10698 static PCRE2_SPTR compile_bracketpos_matchingpath(compiler_common *common, PCRE2_SPTR cc, backtrack… in compile_bracketpos_matchingpath() argument
10738 SLJIT_ASSERT(common->optimized_cbracket[offset] == 0); in compile_bracketpos_matchingpath()
10749 framesize = get_framesize(common, cc, NULL, FALSE, &needs_control_head); in compile_bracketpos_matchingpath()
10756 if (common->capture_last_ptr != 0) in compile_bracketpos_matchingpath()
10768 allocate_stack(common, stacksize); in compile_bracketpos_matchingpath()
10779 if (common->capture_last_ptr != 0) in compile_bracketpos_matchingpath()
10780 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); in compile_bracketpos_matchingpath()
10783 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_bracketpos_matchingpath()
10784 if (common->capture_last_ptr != 0) in compile_bracketpos_matchingpath()
10793 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_bracketpos_matchingpath()
10819 allocate_stack(common, stacksize); in compile_bracketpos_matchingpath()
10822 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_bracketpos_matchingpath()
10842 init_frame(common, cc, NULL, stacksize - 1, stacksize - framesize); in compile_bracketpos_matchingpath()
10856 compile_matchingpath(common, ccbegin, cc, backtrack); in compile_bracketpos_matchingpath()
10870 if (common->capture_last_ptr != 0) in compile_bracketpos_matchingpath()
10871 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1); in compile_bracketpos_matchingpath()
10883 …OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack)… in compile_bracketpos_matchingpath()
10899 if (common->capture_last_ptr != 0) in compile_bracketpos_matchingpath()
10900 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1); in compile_bracketpos_matchingpath()
10914 …OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack)… in compile_bracketpos_matchingpath()
10929 flush_stubs(common); in compile_bracketpos_matchingpath()
10931 compile_backtrackingpath(common, backtrack->top); in compile_bracketpos_matchingpath()
10977 count_match(common); in compile_bracketpos_matchingpath()
10981 static SLJIT_INLINE PCRE2_SPTR get_iterator_parameters(compiler_common *common, PCRE2_SPTR cc, PCRE… in get_iterator_parameters() argument
11114 *end = next_opcode(common, cc); in get_iterator_parameters()
11121 if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc); in get_iterator_parameters()
11126 static PCRE2_SPTR compile_iterator_matchingpath(compiler_common *common, PCRE2_SPTR cc, backtrack_c… in compile_iterator_matchingpath() argument
11158 if (common->early_fail_start_ptr == 0 && common->fast_forward_bc_ptr == NULL) in compile_iterator_matchingpath()
11164 SLJIT_ASSERT(common->fast_forward_bc_ptr != NULL || early_fail_ptr == 0 in compile_iterator_matchingpath()
11165 …|| (early_fail_ptr >= common->early_fail_start_ptr && early_fail_ptr <= common->early_fail_end_ptr… in compile_iterator_matchingpath()
11170 cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &exact, &end); in compile_iterator_matchingpath()
11188 if (common->mode == PCRE2_JIT_COMPLETE in compile_iterator_matchingpath()
11190 && !common->utf in compile_iterator_matchingpath()
11198 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE); in compile_iterator_matchingpath()
11206 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE); in compile_iterator_matchingpath()
11213 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE); in compile_iterator_matchingpath()
11238 allocate_stack(common, 2); in compile_iterator_matchingpath()
11246 …compile_char1_matchingpath(common, type, cc, &BACKTRACK_AS(char_iterator_backtrack)->u.backtracks,… in compile_iterator_matchingpath()
11256 allocate_stack(common, 1); in compile_iterator_matchingpath()
11265 else if (type == OP_ALLANY && !common->invalid_utf) in compile_iterator_matchingpath()
11273 allocate_stack(common, 2); in compile_iterator_matchingpath()
11279 process_partial_match(common); in compile_iterator_matchingpath()
11287 else if (!common->utf) in compile_iterator_matchingpath()
11293 allocate_stack(common, 2); in compile_iterator_matchingpath()
11298 if (common->mode == PCRE2_JIT_COMPLETE) in compile_iterator_matchingpath()
11306 process_partial_match(common); in compile_iterator_matchingpath()
11326 charpos_enabled = !common->utf || !HAS_EXTRALEN(end[1]); in compile_iterator_matchingpath()
11330 if (charpos_enabled && *end == OP_CHARI && char_has_othercase(common, end + 1)) in compile_iterator_matchingpath()
11332 charpos_othercasebit = char_get_othercase_bit(common, end + 1); in compile_iterator_matchingpath()
11371 compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE); in compile_iterator_matchingpath()
11376 detect_partial_match(common, &backtrack->topbacktracks); in compile_iterator_matchingpath()
11383 allocate_stack(common, 2); in compile_iterator_matchingpath()
11395 compile_char1_matchingpath(common, type, cc, &no_match, FALSE); in compile_iterator_matchingpath()
11398 detect_partial_match(common, &no_match); in compile_iterator_matchingpath()
11425 allocate_stack(common, 2); in compile_iterator_matchingpath()
11432 if (common->utf) in compile_iterator_matchingpath()
11438 detect_partial_match(common, &no_match); in compile_iterator_matchingpath()
11440 compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); in compile_iterator_matchingpath()
11442 if (common->utf) in compile_iterator_matchingpath()
11452 detect_partial_match_to(common, label); in compile_iterator_matchingpath()
11457 if (common->utf) in compile_iterator_matchingpath()
11485 allocate_stack(common, 1); in compile_iterator_matchingpath()
11495 allocate_stack(common, 2); in compile_iterator_matchingpath()
11505 allocate_stack(common, 1); in compile_iterator_matchingpath()
11508 …compile_char1_matchingpath(common, type, cc, &BACKTRACK_AS(char_iterator_backtrack)->u.backtracks,… in compile_iterator_matchingpath()
11517 if (type == OP_ALLANY && !common->invalid_utf) in compile_iterator_matchingpath()
11523 process_partial_match(common); in compile_iterator_matchingpath()
11530 if (common->utf) in compile_iterator_matchingpath()
11533 detect_partial_match(common, &no_match); in compile_iterator_matchingpath()
11535 compile_char1_matchingpath(common, type, cc, &no_match, FALSE); in compile_iterator_matchingpath()
11537 detect_partial_match_to(common, label); in compile_iterator_matchingpath()
11552 detect_partial_match(common, &no_match); in compile_iterator_matchingpath()
11554 compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); in compile_iterator_matchingpath()
11555 detect_partial_match_to(common, label); in compile_iterator_matchingpath()
11568 if (common->utf) in compile_iterator_matchingpath()
11573 detect_partial_match(common, &no_match); in compile_iterator_matchingpath()
11575 compile_char1_matchingpath(common, type, cc, &no_match, FALSE); in compile_iterator_matchingpath()
11579 detect_partial_match_to(common, label); in compile_iterator_matchingpath()
11591 if (common->mode == PCRE2_JIT_COMPLETE) in compile_iterator_matchingpath()
11599 process_partial_match(common); in compile_iterator_matchingpath()
11607 detect_partial_match(common, &no_match); in compile_iterator_matchingpath()
11609 compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); in compile_iterator_matchingpath()
11612 detect_partial_match_to(common, label); in compile_iterator_matchingpath()
11623 compile_char1_matchingpath(common, type, cc, &no_match, TRUE); in compile_iterator_matchingpath()
11634 count_match(common); in compile_iterator_matchingpath()
11638 static SLJIT_INLINE PCRE2_SPTR compile_fail_accept_matchingpath(compiler_common *common, PCRE2_SPTR… in compile_fail_accept_matchingpath() argument
11651 if (*cc == OP_ACCEPT && common->currententry == NULL && (common->re->overall_options & PCRE2_ENDANC… in compile_fail_accept_matchingpath()
11652 add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0)); in compile_fail_accept_matchingpath()
11654 if (*cc == OP_ASSERT_ACCEPT || common->currententry != NULL || !common->might_be_empty) in compile_fail_accept_matchingpath()
11657 if (common->accept_label == NULL) in compile_fail_accept_matchingpath()
11658 add_jump(compiler, &common->accept, JUMP(SLJIT_JUMP)); in compile_fail_accept_matchingpath()
11660 JUMPTO(SLJIT_JUMP, common->accept_label); in compile_fail_accept_matchingpath()
11664 if (common->accept_label == NULL) in compile_fail_accept_matchingpath()
11665 …add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR… in compile_fail_accept_matchingpath()
11667 CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label); in compile_fail_accept_matchingpath()
11680 if (common->accept_label == NULL) in compile_fail_accept_matchingpath()
11681 add_jump(compiler, &common->accept, JUMP(SLJIT_ZERO)); in compile_fail_accept_matchingpath()
11683 JUMPTO(SLJIT_ZERO, common->accept_label); in compile_fail_accept_matchingpath()
11686 if (common->accept_label == NULL) in compile_fail_accept_matchingpath()
11687 add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0)); in compile_fail_accept_matchingpath()
11689 CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, common->accept_label); in compile_fail_accept_matchingpath()
11694 static SLJIT_INLINE PCRE2_SPTR compile_close_matchingpath(compiler_common *common, PCRE2_SPTR cc) in compile_close_matchingpath() argument
11698 BOOL optimized_cbracket = common->optimized_cbracket[offset] != 0; in compile_close_matchingpath()
11701 if (common->currententry != NULL) in compile_close_matchingpath()
11713 static SLJIT_INLINE PCRE2_SPTR compile_control_verb_matchingpath(compiler_common *common, PCRE2_SPT… in compile_control_verb_matchingpath() argument
11728 allocate_stack(common, 1); in compile_control_verb_matchingpath()
11738 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); in compile_control_verb_matchingpath()
11747 static SLJIT_INLINE void compile_then_trap_matchingpath(compiler_common *common, PCRE2_SPTR cc, PCR… in compile_then_trap_matchingpath() argument
11755 common->then_trap = BACKTRACK_AS(then_trap_backtrack); in compile_then_trap_matchingpath()
11756 BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode; in compile_then_trap_matchingpath()
11757 BACKTRACK_AS(then_trap_backtrack)->start = (sljit_sw)(cc - common->start); in compile_then_trap_matchingpath()
11758 BACKTRACK_AS(then_trap_backtrack)->framesize = get_framesize(common, cc, ccend, FALSE, &needs_contr… in compile_then_trap_matchingpath()
11763 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_then_trap_matchingpath()
11764 allocate_stack(common, size); in compile_then_trap_matchingpath()
11766 …OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3)… in compile_then_trap_matchingpath()
11768 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0); in compile_then_trap_matchingpath()
11775 init_frame(common, cc, ccend, size - 1, 0); in compile_then_trap_matchingpath()
11778 static void compile_matchingpath(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, backtrac… in compile_matchingpath() argument
11787 if (common->has_then && common->then_offsets[cc - common->start] != 0) in compile_matchingpath()
11789 SLJIT_ASSERT(*ccend != OP_END && common->control_head_ptr != 0); in compile_matchingpath()
11791 save_then_trap = common->then_trap; in compile_matchingpath()
11793 compile_then_trap_matchingpath(common, cc, ccend, parent); in compile_matchingpath()
11811 …cc = compile_simple_assertion_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top… in compile_matchingpath()
11833 …cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbackt… in compile_matchingpath()
11839 allocate_stack(common, 1); in compile_matchingpath()
11847 if (common->mode == PCRE2_JIT_COMPLETE) in compile_matchingpath()
11848 …cc = compile_charn_matchingpath(common, cc, ccend, parent->top != NULL ? &parent->top->nextbacktra… in compile_matchingpath()
11850 …cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbackt… in compile_matchingpath()
11918 cc = compile_iterator_matchingpath(common, cc, parent); in compile_matchingpath()
11924 cc = compile_iterator_matchingpath(common, cc, parent); in compile_matchingpath()
11926 …cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbackt… in compile_matchingpath()
11932 cc = compile_iterator_matchingpath(common, cc, parent); in compile_matchingpath()
11934 …cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbackt… in compile_matchingpath()
11941 cc = compile_ref_iterator_matchingpath(common, cc, parent); in compile_matchingpath()
11944 …compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent-… in compile_matchingpath()
11952 cc = compile_ref_iterator_matchingpath(common, cc, parent); in compile_matchingpath()
11955 …compile_dnref_search(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->top… in compile_matchingpath()
11956 …compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent-… in compile_matchingpath()
11962 cc = compile_recurse_matchingpath(common, cc, parent); in compile_matchingpath()
11967 cc = compile_callout_matchingpath(common, cc, parent); in compile_matchingpath()
11975 cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE); in compile_matchingpath()
11983 allocate_stack(common, 1); in compile_matchingpath()
11988 allocate_stack(common, 2); in compile_matchingpath()
11993 count_match(common); in compile_matchingpath()
12006 cc = compile_bracket_matchingpath(common, cc, parent); in compile_matchingpath()
12011 cc = compile_bracket_matchingpath(common, cc, parent); in compile_matchingpath()
12015 cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE); in compile_matchingpath()
12024 cc = compile_bracketpos_matchingpath(common, cc, parent); in compile_matchingpath()
12029 SLJIT_ASSERT(common->mark_ptr != 0); in compile_matchingpath()
12030 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); in compile_matchingpath()
12031 allocate_stack(common, common->has_skip_arg ? 5 : 1); in compile_matchingpath()
12034 OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0); in compile_matchingpath()
12036 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); in compile_matchingpath()
12038 if (common->has_skip_arg) in compile_matchingpath()
12040 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_matchingpath()
12041 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0); in compile_matchingpath()
12058 cc = compile_control_verb_matchingpath(common, cc, parent); in compile_matchingpath()
12064 cc = compile_fail_accept_matchingpath(common, cc, parent); in compile_matchingpath()
12068 cc = compile_close_matchingpath(common, cc); in compile_matchingpath()
12087 BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode; in compile_matchingpath()
12088 BACKTRACK_AS(then_trap_backtrack)->then_trap = common->then_trap; in compile_matchingpath()
12089 common->then_trap = save_then_trap; in compile_matchingpath()
12101 compile_backtrackingpath(common, (current)); \
12109 static void compile_iterator_backtrackingpath(compiler_common *common, struct backtrack_common *cur… in compile_iterator_backtrackingpath() argument
12125 cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &exact, &end); in compile_iterator_backtrackingpath()
12136 free_stack(common, 1); in compile_iterator_backtrackingpath()
12154 move_back(common, NULL, TRUE); in compile_iterator_backtrackingpath()
12161 move_back(common, NULL, TRUE); in compile_iterator_backtrackingpath()
12167 free_stack(common, 2); in compile_iterator_backtrackingpath()
12173 compile_char1_matchingpath(common, type, cc, &jumplist, TRUE); in compile_iterator_backtrackingpath()
12178 free_stack(common, 1); in compile_iterator_backtrackingpath()
12188 compile_char1_matchingpath(common, type, cc, &jumplist, TRUE); in compile_iterator_backtrackingpath()
12194 free_stack(common, 2); in compile_iterator_backtrackingpath()
12208 free_stack(common, 1); in compile_iterator_backtrackingpath()
12215 compile_char1_matchingpath(common, type, cc, &jumplist, TRUE); in compile_iterator_backtrackingpath()
12220 free_stack(common, 1); in compile_iterator_backtrackingpath()
12237 static SLJIT_INLINE void compile_ref_iterator_backtrackingpath(compiler_common *common, struct back… in compile_ref_iterator_backtrackingpath() argument
12251 free_stack(common, 1); in compile_ref_iterator_backtrackingpath()
12259 free_stack(common, ref ? 2 : 3); in compile_ref_iterator_backtrackingpath()
12262 static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_common *common, struct backtrack… in compile_recurse_backtrackingpath() argument
12277 compile_backtrackingpath(common, current->top); in compile_recurse_backtrackingpath()
12282 static void compile_assert_backtrackingpath(compiler_common *common, struct backtrack_common *curre… in compile_assert_backtrackingpath() argument
12310 free_stack(common, 1); in compile_assert_backtrackingpath()
12321 free_stack(common, 1); in compile_assert_backtrackingpath()
12324 free_stack(common, 1); in compile_assert_backtrackingpath()
12331 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_assert_backtrackingpath()
12351 static void compile_bracket_backtrackingpath(compiler_common *common, struct backtrack_common *curr… in compile_bracket_backtrackingpath() argument
12417 free_stack(common, 1); in compile_bracket_backtrackingpath()
12429 free_stack(common, 1); in compile_bracket_backtrackingpath()
12444 free_stack(common, 1); in compile_bracket_backtrackingpath()
12458 free_stack(common, 1); in compile_bracket_backtrackingpath()
12470 free_stack(common, 1); in compile_bracket_backtrackingpath()
12481 if (common->capture_last_ptr != 0) in compile_bracket_backtrackingpath()
12483 SLJIT_ASSERT(common->optimized_cbracket[offset >> 1] == 0); in compile_bracket_backtrackingpath()
12486 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, TMP1, 0); in compile_bracket_backtrackingpath()
12488 free_stack(common, 3); in compile_bracket_backtrackingpath()
12492 else if (common->optimized_cbracket[offset >> 1] == 0) in compile_bracket_backtrackingpath()
12496 free_stack(common, 2); in compile_bracket_backtrackingpath()
12507 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_bracket_backtrackingpath()
12518 free_stack(common, 1); in compile_bracket_backtrackingpath()
12527 free_stack(common, 1); in compile_bracket_backtrackingpath()
12555 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_bracket_backtrackingpath()
12598 compile_matchingpath(common, ccprev, cc, current); in compile_bracket_backtrackingpath()
12606 match_script_run_common(common, private_data_ptr, current); in compile_bracket_backtrackingpath()
12612 …match_once_common(common, ket, CURRENT_AS(bracket_backtrack)->u.framesize, private_data_ptr, has_a… in compile_bracket_backtrackingpath()
12625 if (common->capture_last_ptr != 0) in compile_bracket_backtrackingpath()
12627 if (common->optimized_cbracket[offset >> 1] == 0) in compile_bracket_backtrackingpath()
12634 allocate_stack(common, stacksize); in compile_bracket_backtrackingpath()
12654 stacksize = match_capture_common(common, stacksize, offset, private_data_ptr); in compile_bracket_backtrackingpath()
12664 if (offset != 0 && ket == OP_KETRMAX && common->optimized_cbracket[offset >> 1] != 0) in compile_bracket_backtrackingpath()
12706 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_bracket_backtrackingpath()
12716 free_stack(common, 1); in compile_bracket_backtrackingpath()
12722 if (common->optimized_cbracket[offset >> 1] != 0) in compile_bracket_backtrackingpath()
12726 free_stack(common, 2); in compile_bracket_backtrackingpath()
12733 free_stack(common, 1); in compile_bracket_backtrackingpath()
12740 free_stack(common, 1); in compile_bracket_backtrackingpath()
12759 free_stack(common, stacksize); in compile_bracket_backtrackingpath()
12769 free_stack(common, 2); in compile_bracket_backtrackingpath()
12784 free_stack(common, 1); in compile_bracket_backtrackingpath()
12792 free_stack(common, 1); in compile_bracket_backtrackingpath()
12803 free_stack(common, 1); in compile_bracket_backtrackingpath()
12806 free_stack(common, bra == OP_BRAMINZERO ? 2 : 1); in compile_bracket_backtrackingpath()
12808 free_stack(common, 1); in compile_bracket_backtrackingpath()
12818 static SLJIT_INLINE void compile_bracketpos_backtrackingpath(compiler_common *common, struct backtr… in compile_bracketpos_backtrackingpath() argument
12832 if (common->capture_last_ptr != 0) in compile_bracketpos_backtrackingpath()
12835 if (common->capture_last_ptr != 0) in compile_bracketpos_backtrackingpath()
12836 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, TMP1, 0); in compile_bracketpos_backtrackingpath()
12839 free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize); in compile_bracketpos_backtrackingpath()
12844 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_bracketpos_backtrackingpath()
12852 free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize); in compile_bracketpos_backtrackingpath()
12858 static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_common *common, struct backtr… in compile_braminzero_backtrackingpath() argument
12868 compile_bracket_matchingpath(common, current->cc, current); in compile_braminzero_backtrackingpath()
12869 compile_bracket_backtrackingpath(common, current->top); in compile_braminzero_backtrackingpath()
12874 backtrack.common.cc = current->cc; in compile_braminzero_backtrackingpath()
12877 compile_assert_matchingpath(common, current->cc, &backtrack, FALSE); in compile_braminzero_backtrackingpath()
12882 static SLJIT_INLINE void compile_control_verb_backtrackingpath(compiler_common *common, struct back… in compile_control_verb_backtrackingpath() argument
12891 if (common->then_trap != NULL) in compile_control_verb_backtrackingpath()
12893 SLJIT_ASSERT(common->control_head_ptr != 0); in compile_control_verb_backtrackingpath()
12895 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_control_verb_backtrackingpath()
12897 OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, common->then_trap->start); in compile_control_verb_backtrackingpath()
12905 add_jump(compiler, &common->then_trap->quit, JUMP(SLJIT_JUMP)); in compile_control_verb_backtrackingpath()
12908 else if (!common->local_quit_available && common->in_positive_assertion) in compile_control_verb_backtrackingpath()
12910 add_jump(compiler, &common->positive_assertion_quit, JUMP(SLJIT_JUMP)); in compile_control_verb_backtrackingpath()
12915 if (common->local_quit_available) in compile_control_verb_backtrackingpath()
12918 if (common->quit_label == NULL) in compile_control_verb_backtrackingpath()
12919 add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP)); in compile_control_verb_backtrackingpath()
12921 JUMPTO(SLJIT_JUMP, common->quit_label); in compile_control_verb_backtrackingpath()
12927 SLJIT_ASSERT(common->control_head_ptr != 0 && TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1); in compile_control_verb_backtrackingpath()
12928 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); in compile_control_verb_backtrackingpath()
12933 add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_IMM, 0)); in compile_control_verb_backtrackingpath()
12941 add_jump(compiler, &common->reset_match, JUMP(SLJIT_JUMP)); in compile_control_verb_backtrackingpath()
12944 static SLJIT_INLINE void compile_then_trap_backtrackingpath(compiler_common *common, struct backtra… in compile_then_trap_backtrackingpath() argument
12952 common->then_trap = CURRENT_AS(then_trap_backtrack)->then_trap; in compile_then_trap_backtrackingpath()
12960 free_stack(common, size); in compile_then_trap_backtrackingpath()
12967 add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); in compile_then_trap_backtrackingpath()
12971 free_stack(common, 3); in compile_then_trap_backtrackingpath()
12974 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0); in compile_then_trap_backtrackingpath()
12977 static void compile_backtrackingpath(compiler_common *common, struct backtrack_common *current) in compile_backtrackingpath() argument
12980 then_trap_backtrack *save_then_trap = common->then_trap; in compile_backtrackingpath()
12990 free_stack(common, 1); in compile_backtrackingpath()
13064 compile_iterator_backtrackingpath(common, current); in compile_backtrackingpath()
13071 compile_ref_iterator_backtrackingpath(common, current); in compile_backtrackingpath()
13075 compile_recurse_backtrackingpath(common, current); in compile_backtrackingpath()
13082 compile_assert_backtrackingpath(common, current); in compile_backtrackingpath()
13095 compile_bracket_backtrackingpath(common, current); in compile_backtrackingpath()
13100 compile_bracket_backtrackingpath(common, current); in compile_backtrackingpath()
13102 compile_assert_backtrackingpath(common, current); in compile_backtrackingpath()
13110 compile_bracketpos_backtrackingpath(common, current); in compile_backtrackingpath()
13114 compile_braminzero_backtrackingpath(common, current); in compile_backtrackingpath()
13118 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0)); in compile_backtrackingpath()
13119 if (common->has_skip_arg) in compile_backtrackingpath()
13121 free_stack(common, common->has_skip_arg ? 5 : 1); in compile_backtrackingpath()
13122 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP1, 0); in compile_backtrackingpath()
13123 if (common->has_skip_arg) in compile_backtrackingpath()
13124 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0); in compile_backtrackingpath()
13133 compile_control_verb_backtrackingpath(common, current); in compile_backtrackingpath()
13138 if (!common->local_quit_available) in compile_backtrackingpath()
13140 if (common->quit_label == NULL) in compile_backtrackingpath()
13141 add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP)); in compile_backtrackingpath()
13143 JUMPTO(SLJIT_JUMP, common->quit_label); in compile_backtrackingpath()
13156 compile_then_trap_backtrackingpath(common, current); in compile_backtrackingpath()
13165 common->then_trap = save_then_trap; in compile_backtrackingpath()
13168 static SLJIT_INLINE void compile_recurse(compiler_common *common) in compile_recurse() argument
13171 PCRE2_SPTR cc = common->start + common->currententry->start; in compile_recurse()
13177 int private_data_size = get_recurse_data_length(common, ccbegin, ccend, &needs_control_head, &has_q… in compile_recurse()
13187 common->then_trap = NULL; in compile_recurse()
13195 SLJIT_ASSERT(common->currententry->entry_label == NULL && common->recursive_head_ptr != 0); in compile_recurse()
13196 common->currententry->entry_label = LABEL(); in compile_recurse()
13197 set_jumps(common->currententry->entry_calls, common->currententry->entry_label); in compile_recurse()
13200 count_match(common); in compile_recurse()
13207 allocate_stack(common, private_data_size + local_size); in compile_recurse()
13211 copy_recurse_data(common, ccbegin, ccend, recurse_copy_from_global, local_size, private_data_size +… in compile_recurse()
13214 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0); in compile_recurse()
13217 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); in compile_recurse()
13223 common->quit_label = NULL; in compile_recurse()
13224 common->accept_label = NULL; in compile_recurse()
13225 common->quit = NULL; in compile_recurse()
13226 common->accept = NULL; in compile_recurse()
13237 compile_matchingpath(common, altbacktrack.cc, cc, &altbacktrack); in compile_recurse()
13241 allocate_stack(common, (alt_max > 1 || has_accept) ? 2 : 1); in compile_recurse()
13242 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr); in compile_recurse()
13257 SLJIT_ASSERT(common->currententry->backtrack_label == NULL); in compile_recurse()
13258 common->currententry->backtrack_label = LABEL(); in compile_recurse()
13259 set_jumps(common->currententry->backtrack_calls, common->currententry->backtrack_label); in compile_recurse()
13270 …copy_recurse_data(common, ccbegin, ccend, recurse_swap_global, local_size, private_data_size + loc… in compile_recurse()
13275 free_stack(common, 2); in compile_recurse()
13287 free_stack(common, has_accept ? 2 : 1); in compile_recurse()
13306 compile_backtrackingpath(common, altbacktrack.top); in compile_recurse()
13322 copy_recurse_data(common, ccbegin, ccend, recurse_copy_private_to_global, local_size, private_data_… in compile_recurse()
13325 free_stack(common, private_data_size + local_size); in compile_recurse()
13329 if (common->quit != NULL) in compile_recurse()
13333 set_jumps(common->quit, LABEL()); in compile_recurse()
13334 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr); in compile_recurse()
13335 …copy_recurse_data(common, ccbegin, ccend, recurse_copy_shared_to_global, local_size, private_data_… in compile_recurse()
13342 free_stack(common, 2); in compile_recurse()
13347 …copy_recurse_data(common, ccbegin, ccend, recurse_copy_kept_shared_to_global, local_size, private_… in compile_recurse()
13350 free_stack(common, private_data_size + local_size); in compile_recurse()
13355 if (common->accept != NULL) in compile_recurse()
13359 set_jumps(common->accept, LABEL()); in compile_recurse()
13361 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr); in compile_recurse()
13364 allocate_stack(common, 2); in compile_recurse()
13372 copy_recurse_data(common, ccbegin, ccend, recurse_swap_global, local_size, private_data_size + loca… in compile_recurse()
13391 compiler_common *common = &common_data; in jit_compile() local
13423 memset(common, 0, sizeof(compiler_common)); in jit_compile()
13424 common->re = re; in jit_compile()
13425 common->name_table = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code)); in jit_compile()
13426 rootbacktrack.cc = common->name_table + re->name_count * re->name_entry_size; in jit_compile()
13429 common->invalid_utf = (mode & PCRE2_JIT_INVALID_UTF) != 0; in jit_compile()
13433 common->start = rootbacktrack.cc; in jit_compile()
13434 common->read_only_data_head = NULL; in jit_compile()
13435 common->fcc = tables + fcc_offset; in jit_compile()
13436 common->lcc = (sljit_sw)(tables + lcc_offset); in jit_compile()
13437 common->mode = mode; in jit_compile()
13438 common->might_be_empty = (re->minlength == 0) || (re->flags & PCRE2_MATCH_EMPTY); in jit_compile()
13439 common->allow_empty_partial = (re->max_lookbehind > 0) || (re->flags & PCRE2_MATCH_EMPTY); in jit_compile()
13440 common->nltype = NLTYPE_FIXED; in jit_compile()
13443 case PCRE2_NEWLINE_CR: common->newline = CHAR_CR; break; in jit_compile()
13444 case PCRE2_NEWLINE_LF: common->newline = CHAR_NL; break; in jit_compile()
13445 case PCRE2_NEWLINE_CRLF: common->newline = (CHAR_CR << 8) | CHAR_NL; break; in jit_compile()
13446 …case PCRE2_NEWLINE_ANY: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_ANY; b… in jit_compile()
13447 …case PCRE2_NEWLINE_ANYCRLF: common->newline = (CHAR_CR << 8) | CHAR_NL; common->nltype = NLTYPE_AN… in jit_compile()
13448 case PCRE2_NEWLINE_NUL: common->newline = CHAR_NUL; break; in jit_compile()
13451 common->nlmax = READ_CHAR_MAX; in jit_compile()
13452 common->nlmin = 0; in jit_compile()
13454 common->bsr_nltype = NLTYPE_ANY; in jit_compile()
13456 common->bsr_nltype = NLTYPE_ANYCRLF; in jit_compile()
13460 common->bsr_nltype = NLTYPE_ANYCRLF; in jit_compile()
13462 common->bsr_nltype = NLTYPE_ANY; in jit_compile()
13465 common->bsr_nlmax = READ_CHAR_MAX; in jit_compile()
13466 common->bsr_nlmin = 0; in jit_compile()
13467 common->endonly = (re->overall_options & PCRE2_DOLLAR_ENDONLY) != 0; in jit_compile()
13468 common->ctypes = (sljit_sw)(tables + ctypes_offset); in jit_compile()
13469 common->name_count = re->name_count; in jit_compile()
13470 common->name_entry_size = re->name_entry_size; in jit_compile()
13471 common->unset_backref = (re->overall_options & PCRE2_MATCH_UNSET_BACKREF) != 0; in jit_compile()
13472 common->alt_circumflex = (re->overall_options & PCRE2_ALT_CIRCUMFLEX) != 0; in jit_compile()
13475 common->utf = (re->overall_options & PCRE2_UTF) != 0; in jit_compile()
13476 common->ucp = (re->overall_options & PCRE2_UCP) != 0; in jit_compile()
13477 if (common->utf) in jit_compile()
13479 if (common->nltype == NLTYPE_ANY) in jit_compile()
13480 common->nlmax = 0x2029; in jit_compile()
13481 else if (common->nltype == NLTYPE_ANYCRLF) in jit_compile()
13482 common->nlmax = (CHAR_CR > CHAR_NL) ? CHAR_CR : CHAR_NL; in jit_compile()
13486 common->nlmax = common->newline & 0xff; in jit_compile()
13489 if (common->nltype == NLTYPE_FIXED) in jit_compile()
13490 common->nlmin = common->newline & 0xff; in jit_compile()
13492 common->nlmin = (CHAR_CR < CHAR_NL) ? CHAR_CR : CHAR_NL; in jit_compile()
13494 if (common->bsr_nltype == NLTYPE_ANY) in jit_compile()
13495 common->bsr_nlmax = 0x2029; in jit_compile()
13497 common->bsr_nlmax = (CHAR_CR > CHAR_NL) ? CHAR_CR : CHAR_NL; in jit_compile()
13498 common->bsr_nlmin = (CHAR_CR < CHAR_NL) ? CHAR_CR : CHAR_NL; in jit_compile()
13501 common->invalid_utf = FALSE; in jit_compile()
13503 ccend = bracketend(common->start); in jit_compile()
13506 common->ovector_start = LIMIT_MATCH + sizeof(sljit_sw); in jit_compile()
13507 common->optimized_cbracket = (sljit_u8 *)SLJIT_MALLOC(re->top_bracket + 1, allocator_data); in jit_compile()
13508 if (!common->optimized_cbracket) in jit_compile()
13511 memset(common->optimized_cbracket, 0, re->top_bracket + 1); in jit_compile()
13513 memset(common->optimized_cbracket, 1, re->top_bracket + 1); in jit_compile()
13516 SLJIT_ASSERT(*common->start == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET); in jit_compile()
13518 common->capture_last_ptr = common->ovector_start; in jit_compile()
13519 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13521 if (!check_opcode_types(common, common->start, ccend)) in jit_compile()
13523 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13530 common->req_char_ptr = common->ovector_start; in jit_compile()
13531 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13535 common->start_used_ptr = common->ovector_start; in jit_compile()
13536 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13539 common->hit_start = common->ovector_start; in jit_compile()
13540 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13545 common->match_end_ptr = common->ovector_start; in jit_compile()
13546 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13549 common->control_head_ptr = 1; in jit_compile()
13551 if (common->control_head_ptr != 0) in jit_compile()
13553 common->control_head_ptr = common->ovector_start; in jit_compile()
13554 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13556 if (common->has_set_som) in jit_compile()
13559 common->start_ptr = common->ovector_start; in jit_compile()
13560 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13564 if ((common->ovector_start & sizeof(sljit_sw)) != 0) in jit_compile()
13565 common->ovector_start += sizeof(sljit_sw); in jit_compile()
13567 if (common->start_ptr == 0) in jit_compile()
13568 common->start_ptr = OVECTOR(0); in jit_compile()
13571 if (common->capture_last_ptr != 0) in jit_compile()
13572 memset(common->optimized_cbracket, 0, re->top_bracket + 1); in jit_compile()
13574 SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0)); in jit_compile()
13575 common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw); in jit_compile()
13577 total_length = ccend - common->start; in jit_compile()
13578 common->private_data_ptrs = (sljit_s32 *)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->… in jit_compile()
13579 if (!common->private_data_ptrs) in jit_compile()
13581 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13584 memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_s32)); in jit_compile()
13586 private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw); in jit_compile()
13587 set_private_data_ptrs(common, &private_data_size, ccend); in jit_compile()
13588 …CHORED) == 0 && (re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0 && !common->has_skip_in_asser… in jit_compile()
13589 detect_early_fail(common, common->start, &private_data_size, 0, 0); in jit_compile()
13591 SLJIT_ASSERT(common->early_fail_start_ptr <= common->early_fail_end_ptr); in jit_compile()
13595 SLJIT_FREE(common->private_data_ptrs, allocator_data); in jit_compile()
13596 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13600 if (common->has_then) in jit_compile()
13602 common->then_offsets = (sljit_u8 *)(common->private_data_ptrs + total_length); in jit_compile()
13603 memset(common->then_offsets, 0, total_length); in jit_compile()
13604 set_then_offsets(common, common->start, NULL); in jit_compile()
13610 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13611 SLJIT_FREE(common->private_data_ptrs, allocator_data); in jit_compile()
13614 common->compiler = compiler; in jit_compile()
13620 reset_ovector(common, (re->top_bracket + 1) * 2); in jit_compile()
13621 if (common->req_char_ptr != 0) in jit_compile()
13622 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr, SLJIT_R0, 0); in jit_compile()
13635 if (common->early_fail_start_ptr < common->early_fail_end_ptr) in jit_compile()
13636 reset_early_fail(common); in jit_compile()
13639 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1); in jit_compile()
13640 if (common->mark_ptr != 0) in jit_compile()
13641 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0); in jit_compile()
13642 if (common->control_head_ptr != 0) in jit_compile()
13643 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); in jit_compile()
13648 mainloop_label = mainloop_entry(common); in jit_compile()
13653 if (mode == PCRE2_JIT_COMPLETE && fast_forward_first_n_chars(common)) in jit_compile()
13656 fast_forward_first_char(common); in jit_compile()
13658 fast_forward_newline(common); in jit_compile()
13660 fast_forward_start_bits(common); in jit_compile()
13672 if (common->req_char_ptr != 0) in jit_compile()
13673 …reqcu_not_found = search_requested_char(common, (PCRE2_UCHAR)(re->last_codeunit), (re->flags & PCR… in jit_compile()
13679 if (common->capture_last_ptr != 0) in jit_compile()
13680 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, 0); in jit_compile()
13681 if (common->fast_forward_bc_ptr != NULL) in jit_compile()
13682 …OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), PRIVATE_DATA(common->fast_forward_bc_ptr + 1) >> 3, STR_PTR, … in jit_compile()
13684 if (common->start_ptr != OVECTOR(0)) in jit_compile()
13685 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_ptr, STR_PTR, 0); in jit_compile()
13690 jump = CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1); in jit_compile()
13691 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in jit_compile()
13695 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); in jit_compile()
13697 compile_matchingpath(common, common->start, ccend, &rootbacktrack); in jit_compile()
13701 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13702 SLJIT_FREE(common->private_data_ptrs, allocator_data); in jit_compile()
13703 PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); in jit_compile()
13710 if (common->might_be_empty) in jit_compile()
13716 common->accept_label = LABEL(); in jit_compile()
13717 if (common->accept != NULL) in jit_compile()
13718 set_jumps(common->accept, common->accept_label); in jit_compile()
13721 copy_ovector(common, re->top_bracket + 1); in jit_compile()
13722 common->quit_label = common->abort_label = LABEL(); in jit_compile()
13723 if (common->quit != NULL) in jit_compile()
13724 set_jumps(common->quit, common->quit_label); in jit_compile()
13725 if (common->abort != NULL) in jit_compile()
13726 set_jumps(common->abort, common->abort_label); in jit_compile()
13728 SET_LABEL(minlength_check_failed, common->abort_label); in jit_compile()
13733 if (common->failed_match != NULL) in jit_compile()
13735 SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE); in jit_compile()
13736 set_jumps(common->failed_match, LABEL()); in jit_compile()
13738 JUMPTO(SLJIT_JUMP, common->abort_label); in jit_compile()
13746 common->partialmatchlabel = LABEL(); in jit_compile()
13747 set_jumps(common->partialmatch, common->partialmatchlabel); in jit_compile()
13748 return_with_partial_match(common, common->quit_label); in jit_compile()
13751 if (common->might_be_empty) in jit_compile()
13753 compile_backtrackingpath(common, rootbacktrack.top); in jit_compile()
13757 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13758 SLJIT_FREE(common->private_data_ptrs, allocator_data); in jit_compile()
13759 PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); in jit_compile()
13769 jump = CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); in jit_compile()
13770 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); in jit_compile()
13771 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1); in jit_compile()
13772 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, TMP1, 0); in jit_compile()
13777 if ((re->overall_options & PCRE2_ANCHORED) == 0 && common->match_end_ptr != 0) in jit_compile()
13779 OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); in jit_compile()
13783 …(common->fast_forward_bc_ptr != NULL) ? (PRIVATE_DATA(common->fast_forward_bc_ptr + 1) >> 3) : com… in jit_compile()
13787 if (common->ff_newline_shortcut != NULL) in jit_compile()
13792 if (common->match_end_ptr != 0) in jit_compile()
13796 CMPTO(SLJIT_LESS, STR_PTR, 0, TMP1, 0, common->ff_newline_shortcut); in jit_compile()
13800 CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, common->ff_newline_shortcut); in jit_compile()
13804 CMPTO(SLJIT_LESS, STR_PTR, 0, (common->match_end_ptr == 0) ? STR_END : TMP1, 0, mainloop_label); in jit_compile()
13812 …CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1, common->partialmatc… in jit_compile()
13815 JUMPTO(SLJIT_JUMP, common->quit_label); in jit_compile()
13817 flush_stubs(common); in jit_compile()
13819 if (common->might_be_empty) in jit_compile()
13833 common->fast_forward_bc_ptr = NULL; in jit_compile()
13834 common->early_fail_start_ptr = 0; in jit_compile()
13835 common->early_fail_end_ptr = 0; in jit_compile()
13836 common->currententry = common->entries; in jit_compile()
13837 common->local_quit_available = TRUE; in jit_compile()
13838 quit_label = common->quit_label; in jit_compile()
13839 while (common->currententry != NULL) in jit_compile()
13842 compile_recurse(common); in jit_compile()
13846 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13847 SLJIT_FREE(common->private_data_ptrs, allocator_data); in jit_compile()
13848 PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); in jit_compile()
13851 flush_stubs(common); in jit_compile()
13852 common->currententry = common->currententry->next; in jit_compile()
13854 common->local_quit_available = FALSE; in jit_compile()
13855 common->quit_label = quit_label; in jit_compile()
13859 set_jumps(common->stackalloc, LABEL()); in jit_compile()
13884 JUMPTO(SLJIT_JUMP, common->quit_label); in jit_compile()
13887 set_jumps(common->calllimit, LABEL()); in jit_compile()
13889 JUMPTO(SLJIT_JUMP, common->quit_label); in jit_compile()
13891 if (common->revertframes != NULL) in jit_compile()
13893 set_jumps(common->revertframes, LABEL()); in jit_compile()
13894 do_revertframes(common); in jit_compile()
13896 if (common->wordboundary != NULL) in jit_compile()
13898 set_jumps(common->wordboundary, LABEL()); in jit_compile()
13899 check_wordboundary(common); in jit_compile()
13901 if (common->anynewline != NULL) in jit_compile()
13903 set_jumps(common->anynewline, LABEL()); in jit_compile()
13904 check_anynewline(common); in jit_compile()
13906 if (common->hspace != NULL) in jit_compile()
13908 set_jumps(common->hspace, LABEL()); in jit_compile()
13909 check_hspace(common); in jit_compile()
13911 if (common->vspace != NULL) in jit_compile()
13913 set_jumps(common->vspace, LABEL()); in jit_compile()
13914 check_vspace(common); in jit_compile()
13916 if (common->casefulcmp != NULL) in jit_compile()
13918 set_jumps(common->casefulcmp, LABEL()); in jit_compile()
13919 do_casefulcmp(common); in jit_compile()
13921 if (common->caselesscmp != NULL) in jit_compile()
13923 set_jumps(common->caselesscmp, LABEL()); in jit_compile()
13924 do_caselesscmp(common); in jit_compile()
13926 if (common->reset_match != NULL) in jit_compile()
13928 set_jumps(common->reset_match, LABEL()); in jit_compile()
13929 do_reset_match(common, (re->top_bracket + 1) * 2); in jit_compile()
13936 if (common->utfreadchar != NULL) in jit_compile()
13938 set_jumps(common->utfreadchar, LABEL()); in jit_compile()
13939 do_utfreadchar(common); in jit_compile()
13941 if (common->utfreadtype8 != NULL) in jit_compile()
13943 set_jumps(common->utfreadtype8, LABEL()); in jit_compile()
13944 do_utfreadtype8(common); in jit_compile()
13946 if (common->utfpeakcharback != NULL) in jit_compile()
13948 set_jumps(common->utfpeakcharback, LABEL()); in jit_compile()
13949 do_utfpeakcharback(common); in jit_compile()
13953 if (common->utfreadchar_invalid != NULL) in jit_compile()
13955 set_jumps(common->utfreadchar_invalid, LABEL()); in jit_compile()
13956 do_utfreadchar_invalid(common); in jit_compile()
13958 if (common->utfreadnewline_invalid != NULL) in jit_compile()
13960 set_jumps(common->utfreadnewline_invalid, LABEL()); in jit_compile()
13961 do_utfreadnewline_invalid(common); in jit_compile()
13963 if (common->utfmoveback_invalid) in jit_compile()
13965 set_jumps(common->utfmoveback_invalid, LABEL()); in jit_compile()
13966 do_utfmoveback_invalid(common); in jit_compile()
13968 if (common->utfpeakcharback_invalid) in jit_compile()
13970 set_jumps(common->utfpeakcharback_invalid, LABEL()); in jit_compile()
13971 do_utfpeakcharback_invalid(common); in jit_compile()
13974 if (common->getucd != NULL) in jit_compile()
13976 set_jumps(common->getucd, LABEL()); in jit_compile()
13977 do_getucd(common); in jit_compile()
13979 if (common->getucdtype != NULL) in jit_compile()
13981 set_jumps(common->getucdtype, LABEL()); in jit_compile()
13982 do_getucdtype(common); in jit_compile()
13986 SLJIT_FREE(common->optimized_cbracket, allocator_data); in jit_compile()
13987 SLJIT_FREE(common->private_data_ptrs, allocator_data); in jit_compile()
13995 PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); in jit_compile()
14010 PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); in jit_compile()
14027 functions->read_only_data_heads[mode] = common->read_only_data_head; in jit_compile()