Lines Matching refs:jump

207 static SLJIT_INLINE sljit_ins* detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit…  in detect_jump_type()  argument
212 if (jump->flags & SLJIT_REWRITABLE_JUMP) in detect_jump_type()
215 if (jump->flags & JUMP_ADDR) in detect_jump_type()
216 target_addr = jump->u.target; in detect_jump_type()
218 SLJIT_ASSERT(jump->u.label != NULL); in detect_jump_type()
219 target_addr = (sljit_uw)(code + jump->u.label->size) + (sljit_uw)executable_offset; in detect_jump_type()
224 if (jump->flags & IS_COND) { in detect_jump_type()
227 *(--code_ptr) ^= (jump->flags & IS_CBZ) ? (0x1 << 24) : 0x1; in detect_jump_type()
228 jump->flags |= PATCH_COND; in detect_jump_type()
229 jump->addr -= sizeof(sljit_ins); in detect_jump_type()
236 if (jump->flags & IS_COND) in detect_jump_type()
238 jump->flags |= PATCH_B; in detect_jump_type()
243 if (jump->flags & IS_COND) in detect_jump_type()
250 if (jump->flags & IS_COND) in detect_jump_type()
252 jump->flags |= PATCH_B32; in detect_jump_type()
258 if (jump->flags & IS_COND) in detect_jump_type()
260 jump->flags |= PATCH_ABS48; in detect_jump_type()
266 jump->flags |= PATCH_ABS64; in detect_jump_type()
271 static SLJIT_INLINE sljit_sw mov_addr_get_length(struct sljit_jump *jump, sljit_ins *code_ptr, slji… in mov_addr_get_length() argument
277 SLJIT_ASSERT(jump->flags < ((sljit_uw)4 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
278 if (jump->flags & JUMP_ADDR) in mov_addr_get_length()
279 addr = jump->u.target; in mov_addr_get_length()
281 addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code + jump->u.label->size, executable_offset); in mov_addr_get_length()
286 jump->flags |= PATCH_B; in mov_addr_get_length()
291 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
292 jump->flags |= PATCH_B32; in mov_addr_get_length()
297 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
302 SLJIT_ASSERT(jump->flags >= ((sljit_uw)2 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
303 jump->flags |= PATCH_ABS48; in mov_addr_get_length()
307 SLJIT_ASSERT(jump->flags >= ((sljit_uw)3 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
308 jump->flags |= PATCH_ABS64; in mov_addr_get_length()
312 static SLJIT_INLINE void generate_jump_or_mov_addr(struct sljit_jump *jump, sljit_sw executable_off… in generate_jump_or_mov_addr() argument
314 sljit_sw addr = (sljit_sw)((jump->flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr); in generate_jump_or_mov_addr()
315 sljit_ins* buf_ptr = (sljit_ins*)jump->addr; in generate_jump_or_mov_addr()
319 if (!(jump->flags & JUMP_MOV_ADDR)) { in generate_jump_or_mov_addr()
320 if (jump->flags & PATCH_COND) { in generate_jump_or_mov_addr()
327 if (jump->flags & PATCH_B) { in generate_jump_or_mov_addr()
330 buf_ptr[0] = ((jump->flags & IS_BL) ? BL : B) | (sljit_ins)(addr & 0x3ffffff); in generate_jump_or_mov_addr()
336 if (jump->flags & PATCH_B32) { in generate_jump_or_mov_addr()
346 if (jump->flags & PATCH_B) { in generate_jump_or_mov_addr()
353 if (jump->flags & PATCH_B32) { in generate_jump_or_mov_addr()
362 …SLJIT_ASSERT((jump->flags & (PATCH_ABS48 | PATCH_ABS64)) || (sljit_uw)addr <= (sljit_uw)0xffffffff… in generate_jump_or_mov_addr()
363 SLJIT_ASSERT((jump->flags & PATCH_ABS64) || (sljit_uw)addr <= (sljit_uw)0xffffffffffff); in generate_jump_or_mov_addr()
367 if (jump->flags & (PATCH_ABS48 | PATCH_ABS64)) in generate_jump_or_mov_addr()
370 if (jump->flags & PATCH_ABS64) in generate_jump_or_mov_addr()
377 struct sljit_jump *jump; in reduce_code_size() local
385 jump = compiler->jumps; in reduce_code_size()
412 jump->addr -= size_reduce; in reduce_code_size()
413 if (!(jump->flags & JUMP_MOV_ADDR)) { in reduce_code_size()
416 if (!(jump->flags & SLJIT_REWRITABLE_JUMP)) { in reduce_code_size()
417 if (jump->flags & JUMP_ADDR) { in reduce_code_size()
418 if (jump->u.target < 0x100000000l) in reduce_code_size()
420 else if (jump->u.target < 0x1000000000000l) in reduce_code_size()
424 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
426 …if ((jump->flags & IS_COND) && (diff + 1) <= (0xfffff / SSIZE_OF(ins)) && (diff + 1) >= (-0x100000… in reduce_code_size()
440 if (!(jump->flags & JUMP_ADDR)) { in reduce_code_size()
441 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
447 } else if (jump->u.target < 0x100000000l) in reduce_code_size()
449 else if (jump->u.target < 0x1000000000000l) in reduce_code_size()
455 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
456 jump = jump->next; in reduce_code_size()
457 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in reduce_code_size()
476 struct sljit_jump *jump; in sljit_generate_code() local
493 jump = compiler->jumps; in sljit_generate_code()
505 SLJIT_ASSERT(!jump || jump->addr >= word_count); in sljit_generate_code()
517 if (!(jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
518 word_count = word_count - 1 + (jump->flags >> JUMP_SIZE_SHIFT); in sljit_generate_code()
519 jump->addr = (sljit_uw)code_ptr; in sljit_generate_code()
520 code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset); in sljit_generate_code()
521 …SLJIT_ASSERT((jump->flags & PATCH_COND) || ((sljit_uw)code_ptr - jump->addr < (jump->flags >> JUMP… in sljit_generate_code()
523 word_count += jump->flags >> JUMP_SIZE_SHIFT; in sljit_generate_code()
525 code_ptr += mov_addr_get_length(jump, code_ptr, code, executable_offset); in sljit_generate_code()
526 jump->addr = (sljit_uw)addr; in sljit_generate_code()
529 jump = jump->next; in sljit_generate_code()
530 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump); in sljit_generate_code()
553 SLJIT_ASSERT(!jump); in sljit_generate_code()
557 jump = compiler->jumps; in sljit_generate_code()
558 while (jump) { in sljit_generate_code()
559 generate_jump_or_mov_addr(jump, executable_offset); in sljit_generate_code()
560 jump = jump->next; in sljit_generate_code()
2344 struct sljit_jump *jump; in sljit_emit_jump() local
2349 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2350 PTR_FAIL_IF(!jump); in sljit_emit_jump()
2351 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2355 jump->flags |= IS_COND; in sljit_emit_jump()
2358 jump->flags |= IS_BL; in sljit_emit_jump()
2360 jump->addr = compiler->size; in sljit_emit_jump()
2365 return jump; in sljit_emit_jump()
2387 struct sljit_jump *jump; in emit_cmp_to0() local
2393 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in emit_cmp_to0()
2394 PTR_FAIL_IF(!jump); in emit_cmp_to0()
2395 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in emit_cmp_to0()
2396 jump->flags |= IS_CBZ | IS_COND; in emit_cmp_to0()
2413 jump->addr = compiler->size; in emit_cmp_to0()
2418 return jump; in emit_cmp_to0()
2423 struct sljit_jump *jump; in sljit_emit_ijump() local
2438 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2439 FAIL_IF(!jump); in sljit_emit_ijump()
2440 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0)); in sljit_emit_ijump()
2441 jump->u.target = (sljit_uw)srcw; in sljit_emit_ijump()
2443 jump->addr = compiler->size; in sljit_emit_ijump()
3446 struct sljit_jump *jump; in sljit_emit_mov_addr() local
3456 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_mov_addr()
3457 PTR_FAIL_IF(!jump); in sljit_emit_mov_addr()
3458 set_mov_addr(jump, compiler, 1); in sljit_emit_mov_addr()
3465 return jump; in sljit_emit_mov_addr()