Lines Matching refs:jump
320 static SLJIT_INLINE sljit_u16* detect_jump_type(struct sljit_jump *jump, sljit_u16 *code_ptr, sljit… in detect_jump_type() argument
324 if (jump->flags & SLJIT_REWRITABLE_JUMP) in detect_jump_type()
327 if (jump->flags & JUMP_ADDR) { in detect_jump_type()
329 if (!(jump->u.target & 0x1)) in detect_jump_type()
331 diff = (sljit_sw)jump->u.target - (sljit_sw)(code_ptr + 2) - executable_offset; in detect_jump_type()
333 SLJIT_ASSERT(jump->u.label != NULL); in detect_jump_type()
334 diff = (sljit_sw)(code + jump->u.label->size) - (sljit_sw)(code_ptr + 2); in detect_jump_type()
337 if (jump->flags & IS_COND) { in detect_jump_type()
338 SLJIT_ASSERT(!(jump->flags & IS_BL)); in detect_jump_type()
342 jump->flags |= PATCH_TYPE1; in detect_jump_type()
343 jump->addr = (sljit_uw)(code_ptr - 1); in detect_jump_type()
347 jump->flags |= PATCH_TYPE2; in detect_jump_type()
348 jump->addr = (sljit_uw)(code_ptr - 1); in detect_jump_type()
352 } else if (jump->flags & IS_BL) { in detect_jump_type()
355 jump->flags |= PATCH_TYPE5; in detect_jump_type()
360 jump->flags |= PATCH_TYPE3; in detect_jump_type()
365 jump->flags |= PATCH_TYPE4; in detect_jump_type()
372 if (jump->flags & IS_COND) { in detect_jump_type()
374 jump->addr = (sljit_uw)(code_ptr - 1); in detect_jump_type()
380 static SLJIT_INLINE sljit_sw mov_addr_get_length(struct sljit_jump *jump, sljit_u16 *code_ptr, slji… in mov_addr_get_length() argument
386 if (jump->flags & JUMP_ADDR) in mov_addr_get_length()
387 addr = jump->u.target; in mov_addr_get_length()
389 addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code + jump->u.label->size, executable_offset); in mov_addr_get_length()
397 jump->flags |= PATCH_TYPE6; in mov_addr_get_length()
404 static SLJIT_INLINE void generate_jump_or_mov_addr(struct sljit_jump *jump, sljit_sw executable_off… in generate_jump_or_mov_addr() argument
406 sljit_s32 type = (jump->flags >> 4) & 0xf; in generate_jump_or_mov_addr()
407 sljit_u16 *jump_inst = (sljit_u16*)jump->addr; in generate_jump_or_mov_addr()
411 diff = (sljit_sw)((jump->flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr); in generate_jump_or_mov_addr()
414 ins = (jump->flags & JUMP_MOV_ADDR) ? *jump_inst : RDN3(TMP_REG1); in generate_jump_or_mov_addr()
415 set_imm32_const((sljit_u16*)jump->addr, ins, (sljit_uw)diff); in generate_jump_or_mov_addr()
420 SLJIT_ASSERT(jump->flags & JUMP_MOV_ADDR); in generate_jump_or_mov_addr()
436 SLJIT_ASSERT((diff & 0x1) != 0 && !(jump->flags & JUMP_MOV_ADDR)); in generate_jump_or_mov_addr()
437 diff = (diff - (sljit_sw)(jump->addr + sizeof(sljit_u32)) - executable_offset) >> 1; in generate_jump_or_mov_addr()
442 SLJIT_ASSERT(diff <= 0x7f && diff >= -0x80 && (jump->flags & IS_COND)); in generate_jump_or_mov_addr()
443 jump_inst[0] = (sljit_u16)(0xd000 | (jump->flags & 0xf00) | ((sljit_ins)diff & 0xff)); in generate_jump_or_mov_addr()
447 SLJIT_ASSERT(diff <= 0x7ffff && diff >= -0x80000 && (jump->flags & IS_COND)); in generate_jump_or_mov_addr()
448 …jump_inst[0] = (sljit_u16)(0xf000 | COPY_BITS(jump->flags, 8, 6, 4) | COPY_BITS(diff, 11, 0, 6) | … in generate_jump_or_mov_addr()
453 SLJIT_ASSERT(diff <= 0x3ff && diff >= -0x400 && !(jump->flags & IS_COND)); in generate_jump_or_mov_addr()
478 struct sljit_jump *jump; in reduce_code_size() local
486 jump = compiler->jumps; in reduce_code_size()
513 jump->addr -= size_reduce; in reduce_code_size()
514 if (!(jump->flags & JUMP_MOV_ADDR)) { in reduce_code_size()
517 if (!(jump->flags & (SLJIT_REWRITABLE_JUMP | JUMP_ADDR))) { in reduce_code_size()
519 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr - 2; in reduce_code_size()
521 if (jump->flags & IS_COND) { in reduce_code_size()
529 …} else if (!(jump->flags & IS_BL) && diff <= (0x7ff / SSIZE_OF(u16)) && diff >= (-0x800 / SSIZE_OF… in reduce_code_size()
541 if (!(jump->flags & JUMP_ADDR)) { in reduce_code_size()
542 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
551 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
552 jump = jump->next; in reduce_code_size()
553 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in reduce_code_size()
572 struct sljit_jump *jump; in sljit_generate_code() local
589 jump = compiler->jumps; in sljit_generate_code()
601 SLJIT_ASSERT(!jump || jump->addr >= half_count); in sljit_generate_code()
613 if (!(jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
614 half_count = half_count - 1 + (jump->flags >> JUMP_SIZE_SHIFT); in sljit_generate_code()
615 jump->addr = (sljit_uw)code_ptr; in sljit_generate_code()
616 code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset); in sljit_generate_code()
617 SLJIT_ASSERT((sljit_uw)code_ptr - jump->addr < in sljit_generate_code()
618 … ((jump->flags >> JUMP_SIZE_SHIFT) + ((jump->flags & 0xf0) <= PATCH_TYPE2)) * sizeof(sljit_u16)); in sljit_generate_code()
620 half_count += jump->flags >> JUMP_SIZE_SHIFT; in sljit_generate_code()
622 code_ptr += mov_addr_get_length(jump, code_ptr, code, executable_offset); in sljit_generate_code()
623 jump->addr = (sljit_uw)addr; in sljit_generate_code()
626 jump = jump->next; in sljit_generate_code()
627 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in sljit_generate_code()
650 SLJIT_ASSERT(!jump); in sljit_generate_code()
654 jump = compiler->jumps; in sljit_generate_code()
655 while (jump) { in sljit_generate_code()
656 generate_jump_or_mov_addr(jump, executable_offset); in sljit_generate_code()
657 jump = jump->next; in sljit_generate_code()
2665 struct sljit_jump *jump; in sljit_emit_jump() local
2671 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2672 PTR_FAIL_IF(!jump); in sljit_emit_jump()
2673 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2677 jump->flags |= IS_COND; in sljit_emit_jump()
2679 jump->flags |= cc << 8; in sljit_emit_jump()
2683 jump->addr = compiler->size; in sljit_emit_jump()
2687 jump->flags |= IS_BL; in sljit_emit_jump()
2693 return jump; in sljit_emit_jump()
2878 struct sljit_jump *jump; in sljit_emit_call() local
2894 jump = sljit_emit_jump(compiler, type); in sljit_emit_call()
2895 PTR_FAIL_IF(jump == NULL); in sljit_emit_call()
2906 return jump; in sljit_emit_call()
2912 return jump; in sljit_emit_call()
2933 struct sljit_jump *jump; in sljit_emit_ijump() local
2953 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2954 FAIL_IF(!jump); in sljit_emit_ijump()
2955 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0)); in sljit_emit_ijump()
2956 jump->u.target = (sljit_uw)srcw; in sljit_emit_ijump()
2958 jump->addr = compiler->size; in sljit_emit_ijump()
4267 struct sljit_jump *jump; in sljit_emit_mov_addr() local
4274 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_mov_addr()
4275 PTR_FAIL_IF(!jump); in sljit_emit_mov_addr()
4276 set_mov_addr(jump, compiler, 0); in sljit_emit_mov_addr()
4284 return jump; in sljit_emit_mov_addr()