Lines Matching refs:jump

170 static SLJIT_INLINE sljit_ins* detect_jump_type(struct sljit_jump *jump, sljit_ins *code, sljit_sw …  in detect_jump_type()  argument
176 inst = (sljit_ins *)jump->addr; in detect_jump_type()
178 if (jump->flags & SLJIT_REWRITABLE_JUMP) in detect_jump_type()
181 if (jump->flags & JUMP_ADDR) in detect_jump_type()
182 target_addr = jump->u.target; in detect_jump_type()
184 SLJIT_ASSERT(jump->u.label != NULL); in detect_jump_type()
185 target_addr = (sljit_uw)(code + jump->u.label->size) + (sljit_uw)executable_offset; in detect_jump_type()
190 if (jump->flags & IS_COND) { in detect_jump_type()
196 jump->flags |= PATCH_B; in detect_jump_type()
197 jump->addr = (sljit_uw)inst; in detect_jump_type()
205 if (jump->flags & IS_COND) { in detect_jump_type()
213 jump->flags |= PATCH_J; in detect_jump_type()
219 if (jump->flags & IS_COND) in detect_jump_type()
222 jump->flags |= PATCH_REL32; in detect_jump_type()
228 if (jump->flags & IS_COND) in detect_jump_type()
231 jump->flags |= PATCH_ABS32; in detect_jump_type()
237 if (jump->flags & IS_COND) in detect_jump_type()
240 jump->flags |= PATCH_ABS44; in detect_jump_type()
246 if (jump->flags & IS_COND) in detect_jump_type()
249 jump->flags |= PATCH_ABS52; in detect_jump_type()
267 static SLJIT_INLINE sljit_sw mov_addr_get_length(struct sljit_jump *jump, sljit_ins *code_ptr, slji… in mov_addr_get_length() argument
273 SLJIT_ASSERT(jump->flags < ((sljit_uw)6 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
274 if (jump->flags & JUMP_ADDR) in mov_addr_get_length()
275 addr = jump->u.target; in mov_addr_get_length()
277 addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code + jump->u.label->size, executable_offset); in mov_addr_get_length()
282 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
283 jump->flags |= PATCH_REL32; in mov_addr_get_length()
288 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
289 jump->flags |= PATCH_ABS32; in mov_addr_get_length()
294 SLJIT_ASSERT(jump->flags >= ((sljit_uw)3 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
295 jump->flags |= PATCH_ABS44; in mov_addr_get_length()
300 SLJIT_ASSERT(jump->flags >= ((sljit_uw)4 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
301 jump->flags |= PATCH_ABS52; in mov_addr_get_length()
305 SLJIT_ASSERT(jump->flags >= ((sljit_uw)5 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
311 static SLJIT_INLINE void load_addr_to_reg(struct sljit_jump *jump, sljit_sw executable_offset) in load_addr_to_reg() argument
313 sljit_uw flags = jump->flags; in load_addr_to_reg()
314 sljit_uw addr = (flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr; in load_addr_to_reg()
315 sljit_ins *ins = (sljit_ins*)jump->addr; in load_addr_to_reg()
404 struct sljit_jump *jump; in reduce_code_size() local
412 jump = compiler->jumps; in reduce_code_size()
439 jump->addr -= size_reduce; in reduce_code_size()
440 if (!(jump->flags & JUMP_MOV_ADDR)) { in reduce_code_size()
443 if (!(jump->flags & SLJIT_REWRITABLE_JUMP)) { in reduce_code_size()
444 if (jump->flags & JUMP_ADDR) { in reduce_code_size()
446 if (jump->u.target <= S32_MAX) in reduce_code_size()
448 else if (jump->u.target <= S44_MAX) in reduce_code_size()
450 else if (jump->u.target <= S52_MAX) in reduce_code_size()
455 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
457 …if ((jump->flags & IS_COND) && (diff + 1) <= (BRANCH_MAX / SSIZE_OF(ins)) && (diff + 1) >= (BRANCH… in reduce_code_size()
469 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
474 if (!(jump->flags & JUMP_ADDR)) { in reduce_code_size()
476 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
480 } else if (jump->u.target < S32_MAX) in reduce_code_size()
482 else if (jump->u.target < S44_MAX) in reduce_code_size()
484 else if (jump->u.target <= S52_MAX) in reduce_code_size()
488 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
492 jump = jump->next; in reduce_code_size()
493 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in reduce_code_size()
512 struct sljit_jump *jump; in sljit_generate_code() local
529 jump = compiler->jumps; in sljit_generate_code()
541 SLJIT_ASSERT(!jump || jump->addr >= word_count); in sljit_generate_code()
553 if (!(jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
554 word_count = word_count - 1 + (jump->flags >> JUMP_SIZE_SHIFT); in sljit_generate_code()
555 jump->addr = (sljit_uw)code_ptr; in sljit_generate_code()
556 code_ptr = detect_jump_type(jump, code, executable_offset); in sljit_generate_code()
557 …SLJIT_ASSERT((jump->flags & PATCH_B) || ((sljit_uw)code_ptr - jump->addr < (jump->flags >> JUMP_SI… in sljit_generate_code()
561 jump->addr = (sljit_uw)code_ptr; in sljit_generate_code()
564 word_count += jump->flags >> JUMP_SIZE_SHIFT; in sljit_generate_code()
566 code_ptr += mov_addr_get_length(jump, code_ptr, code, executable_offset); in sljit_generate_code()
567 jump->addr = addr; in sljit_generate_code()
570 jump = jump->next; in sljit_generate_code()
571 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in sljit_generate_code()
594 SLJIT_ASSERT(!jump); in sljit_generate_code()
598 jump = compiler->jumps; in sljit_generate_code()
599 while (jump) { in sljit_generate_code()
601 if (!(jump->flags & (PATCH_B | PATCH_J)) || (jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
602 load_addr_to_reg(jump, executable_offset); in sljit_generate_code()
606 addr = (jump->flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr; in sljit_generate_code()
607 buf_ptr = (sljit_ins *)jump->addr; in sljit_generate_code()
610 if (jump->flags & PATCH_B) { in sljit_generate_code()
619 buf_ptr[0] = JAL | RD((jump->flags & IS_CALL) ? RETURN_ADDR_REG : TMP_ZERO) | (sljit_ins)addr; in sljit_generate_code()
622 jump = jump->next; in sljit_generate_code()
2613 struct sljit_jump *jump; in sljit_emit_jump() local
2619 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2620 PTR_FAIL_IF(!jump); in sljit_emit_jump()
2621 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2628 jump->flags |= IS_COND; in sljit_emit_jump()
2631 jump->addr = compiler->size; in sljit_emit_jump()
2635 jump->flags |= IS_CALL; in sljit_emit_jump()
2643 return jump; in sljit_emit_jump()
2666 struct sljit_jump *jump; in sljit_emit_cmp() local
2712 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_cmp()
2713 PTR_FAIL_IF(!jump); in sljit_emit_cmp()
2714 set_jump(jump, compiler, (sljit_u32)((type & SLJIT_REWRITABLE_JUMP) | IS_COND)); in sljit_emit_cmp()
2752 jump->addr = compiler->size; in sljit_emit_cmp()
2757 return jump; in sljit_emit_cmp()
2764 struct sljit_jump *jump; in sljit_emit_ijump() local
2779 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2780 FAIL_IF(!jump); in sljit_emit_ijump()
2781 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_CALL : 0)); in sljit_emit_ijump()
2782 jump->u.target = (sljit_uw)srcw; in sljit_emit_ijump()
2784 jump->addr = compiler->size; in sljit_emit_ijump()
3093 struct sljit_jump *jump; in sljit_emit_mov_addr() local
3100 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_mov_addr()
3101 PTR_FAIL_IF(!jump); in sljit_emit_mov_addr()
3102 set_mov_addr(jump, compiler, 0); in sljit_emit_mov_addr()
3115 return jump; in sljit_emit_mov_addr()