Lines Matching refs:jump
408 static SLJIT_INLINE sljit_ins* detect_jump_type(struct sljit_jump *jump, sljit_ins *code, sljit_sw … in detect_jump_type() argument
414 inst = (sljit_ins *)jump->addr; in detect_jump_type()
416 if (jump->flags & SLJIT_REWRITABLE_JUMP) in detect_jump_type()
419 if (jump->flags & JUMP_ADDR) in detect_jump_type()
420 target_addr = jump->u.target; in detect_jump_type()
422 SLJIT_ASSERT(jump->u.label != NULL); in detect_jump_type()
423 target_addr = (sljit_uw)(code + jump->u.label->size) + (sljit_uw)executable_offset; in detect_jump_type()
428 if (jump->flags & IS_COND) { in detect_jump_type()
434 jump->flags |= PATCH_B; in detect_jump_type()
435 jump->addr = (sljit_uw)inst; in detect_jump_type()
443 if (jump->flags & IS_COND) { in detect_jump_type()
447 jump->flags |= PATCH_J; in detect_jump_type()
452 if (jump->flags & IS_COND) in detect_jump_type()
455 jump->flags |= PATCH_REL32; in detect_jump_type()
461 if (jump->flags & IS_COND) in detect_jump_type()
464 jump->flags |= PATCH_ABS32; in detect_jump_type()
470 if (jump->flags & IS_COND) in detect_jump_type()
473 jump->flags |= PATCH_ABS52; in detect_jump_type()
479 if (jump->flags & IS_COND) in detect_jump_type()
485 static SLJIT_INLINE sljit_sw mov_addr_get_length(struct sljit_jump *jump, sljit_ins *code_ptr, slji… in mov_addr_get_length() argument
491 SLJIT_ASSERT(jump->flags < ((sljit_uw)6 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
492 if (jump->flags & JUMP_ADDR) in mov_addr_get_length()
493 addr = jump->u.target; in mov_addr_get_length()
495 addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code + jump->u.label->size, executable_offset); in mov_addr_get_length()
500 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
501 jump->flags |= PATCH_REL32; in mov_addr_get_length()
506 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
507 jump->flags |= PATCH_ABS32; in mov_addr_get_length()
512 SLJIT_ASSERT(jump->flags >= ((sljit_uw)2 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
513 jump->flags |= PATCH_ABS52; in mov_addr_get_length()
517 SLJIT_ASSERT(jump->flags >= ((sljit_uw)3 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
521 static SLJIT_INLINE void load_addr_to_reg(struct sljit_jump *jump, sljit_sw executable_offset) in load_addr_to_reg() argument
523 sljit_uw flags = jump->flags; in load_addr_to_reg()
524 sljit_uw addr = (flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr; in load_addr_to_reg()
525 sljit_ins *ins = (sljit_ins*)jump->addr; in load_addr_to_reg()
571 struct sljit_jump *jump; in reduce_code_size() local
579 jump = compiler->jumps; in reduce_code_size()
607 jump->addr -= size_reduce; in reduce_code_size()
608 if (!(jump->flags & JUMP_MOV_ADDR)) { in reduce_code_size()
611 if (!(jump->flags & SLJIT_REWRITABLE_JUMP)) { in reduce_code_size()
612 if (jump->flags & JUMP_ADDR) { in reduce_code_size()
613 if (jump->u.target <= S32_MAX) in reduce_code_size()
615 else if (jump->u.target <= S52_MAX) in reduce_code_size()
619 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
621 …if ((jump->flags & IS_COND) && (diff + 1) <= (BRANCH16_MAX / SSIZE_OF(ins)) && (diff + 1) >= (BRAN… in reduce_code_size()
631 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
635 if (!(jump->flags & JUMP_ADDR)) { in reduce_code_size()
637 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
641 } else if (jump->u.target < S32_MAX) in reduce_code_size()
643 else if (jump->u.target <= S52_MAX) in reduce_code_size()
647 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
650 jump = jump->next; in reduce_code_size()
651 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in reduce_code_size()
670 struct sljit_jump *jump; in sljit_generate_code() local
687 jump = compiler->jumps; in sljit_generate_code()
699 SLJIT_ASSERT(!jump || jump->addr >= word_count); in sljit_generate_code()
711 if (!(jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
712 word_count = word_count - 1 + (jump->flags >> JUMP_SIZE_SHIFT); in sljit_generate_code()
713 jump->addr = (sljit_uw)code_ptr; in sljit_generate_code()
714 code_ptr = detect_jump_type(jump, code, executable_offset); in sljit_generate_code()
715 …SLJIT_ASSERT((jump->flags & PATCH_B) || ((sljit_uw)code_ptr - jump->addr < (jump->flags >> JUMP_SI… in sljit_generate_code()
717 word_count += jump->flags >> JUMP_SIZE_SHIFT; in sljit_generate_code()
719 code_ptr += mov_addr_get_length(jump, code_ptr, code, executable_offset); in sljit_generate_code()
720 jump->addr = addr; in sljit_generate_code()
722 jump = jump->next; in sljit_generate_code()
723 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in sljit_generate_code()
746 SLJIT_ASSERT(!jump); in sljit_generate_code()
750 jump = compiler->jumps; in sljit_generate_code()
751 while (jump) { in sljit_generate_code()
753 if (!(jump->flags & (PATCH_B | PATCH_J)) || (jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
754 load_addr_to_reg(jump, executable_offset); in sljit_generate_code()
758 addr = (jump->flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr; in sljit_generate_code()
759 buf_ptr = (sljit_ins *)jump->addr; in sljit_generate_code()
762 if (jump->flags & PATCH_B) { in sljit_generate_code()
769 if (jump->flags & IS_CALL) in sljit_generate_code()
774 jump = jump->next; in sljit_generate_code()
2696 struct sljit_jump *jump; in sljit_emit_jump() local
2702 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2703 PTR_FAIL_IF(!jump); in sljit_emit_jump()
2704 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2711 jump->flags |= IS_COND; in sljit_emit_jump()
2714 jump->addr = compiler->size; in sljit_emit_jump()
2718 jump->flags |= IS_CALL; in sljit_emit_jump()
2726 return jump; in sljit_emit_jump()
2749 struct sljit_jump *jump; in sljit_emit_cmp() local
2792 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_cmp()
2793 PTR_FAIL_IF(!jump); in sljit_emit_cmp()
2794 set_jump(jump, compiler, (sljit_u32)((type & SLJIT_REWRITABLE_JUMP) | IS_COND)); in sljit_emit_cmp()
2835 jump->addr = compiler->size; in sljit_emit_cmp()
2841 return jump; in sljit_emit_cmp()
2846 struct sljit_jump *jump; in sljit_emit_ijump() local
2861 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2862 FAIL_IF(!jump); in sljit_emit_ijump()
2863 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_CALL : 0)); in sljit_emit_ijump()
2864 jump->u.target = (sljit_uw)srcw; in sljit_emit_ijump()
2866 jump->addr = compiler->size; in sljit_emit_ijump()
3740 struct sljit_jump *jump; in sljit_emit_mov_addr() local
3747 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_mov_addr()
3748 PTR_FAIL_IF(!jump); in sljit_emit_mov_addr()
3749 set_mov_addr(jump, compiler, 0); in sljit_emit_mov_addr()
3759 return jump; in sljit_emit_mov_addr()