Skip to content

Commit 350b544

Browse files
committed
YJIT: Refactor to forward jump_to_next_insn() return value
It's more concise this way and since `return Some(EndBlock)` is the only correct answer, no point repeating it everywhere.
1 parent 199877d commit 350b544

File tree

1 file changed

+17
-36
lines changed

1 file changed

+17
-36
lines changed

yjit/src/codegen.rs

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3369,9 +3369,7 @@ fn gen_definedivar(
33693369
jit_putobject(asm, result);
33703370

33713371
// Jump to next instruction. This allows guard chains to share the same successor.
3372-
jump_to_next_insn(jit, asm);
3373-
3374-
return Some(EndBlock);
3372+
return jump_to_next_insn(jit, asm);
33753373
}
33763374

33773375
fn gen_checktype(
@@ -3717,8 +3715,7 @@ fn gen_opt_eq(
37173715
};
37183716

37193717
if specialized {
3720-
jump_to_next_insn(jit, asm);
3721-
Some(EndBlock)
3718+
jump_to_next_insn(jit, asm)
37223719
} else {
37233720
gen_opt_send_without_block(jit, asm)
37243721
}
@@ -3798,8 +3795,7 @@ fn gen_opt_aref(
37983795
}
37993796

38003797
// Jump to next instruction. This allows guard chains to share the same successor.
3801-
jump_to_next_insn(jit, asm);
3802-
return Some(EndBlock);
3798+
return jump_to_next_insn(jit, asm);
38033799
} else if comptime_recv.class_of() == unsafe { rb_cHash } {
38043800
if !assume_bop_not_redefined(jit, asm, HASH_REDEFINED_OP_FLAG, BOP_AREF) {
38053801
return None;
@@ -3835,8 +3831,7 @@ fn gen_opt_aref(
38353831
asm.mov(stack_ret, val);
38363832

38373833
// Jump to next instruction. This allows guard chains to share the same successor.
3838-
jump_to_next_insn(jit, asm);
3839-
Some(EndBlock)
3834+
jump_to_next_insn(jit, asm)
38403835
} else {
38413836
// General case. Call the [] method.
38423837
gen_opt_send_without_block(jit, asm)
@@ -3904,8 +3899,7 @@ fn gen_opt_aset(
39043899
let stack_ret = asm.stack_push(Type::Unknown);
39053900
asm.mov(stack_ret, val);
39063901

3907-
jump_to_next_insn(jit, asm);
3908-
return Some(EndBlock);
3902+
return jump_to_next_insn(jit, asm)
39093903
} else if comptime_recv.class_of() == unsafe { rb_cHash } {
39103904
// Guard receiver is a Hash
39113905
jit_guard_known_klass(
@@ -3933,8 +3927,7 @@ fn gen_opt_aset(
39333927
let stack_ret = asm.stack_push(Type::Unknown);
39343928
asm.mov(stack_ret, ret);
39353929

3936-
jump_to_next_insn(jit, asm);
3937-
Some(EndBlock)
3930+
jump_to_next_insn(jit, asm)
39383931
} else {
39393932
gen_opt_send_without_block(jit, asm)
39403933
}
@@ -6795,8 +6788,7 @@ fn gen_send_cfunc(
67956788
gen_counter_incr(jit, asm, Counter::num_send_cfunc_inline);
67966789
// cfunc codegen generated code. Terminate the block so
67976790
// there isn't multiple calls in the same block.
6798-
jump_to_next_insn(jit, asm);
6799-
return Some(EndBlock);
6791+
return jump_to_next_insn(jit, asm);
68006792
}
68016793
}
68026794
}
@@ -7088,8 +7080,7 @@ fn gen_send_cfunc(
70887080

70897081
// Jump (fall through) to the call continuation block
70907082
// We do this to end the current block after the call
7091-
jump_to_next_insn(jit, asm);
7092-
Some(EndBlock)
7083+
jump_to_next_insn(jit, asm)
70937084
}
70947085

70957086
// Generate RARRAY_LEN. For array_opnd, use Opnd::Reg to reduce memory access,
@@ -7628,8 +7619,7 @@ fn gen_send_iseq(
76287619
// Seems like a safe assumption.
76297620

76307621
// Let guard chains share the same successor
7631-
jump_to_next_insn(jit, asm);
7632-
return Some(EndBlock);
7622+
return jump_to_next_insn(jit, asm);
76337623
}
76347624
}
76357625

@@ -7667,8 +7657,7 @@ fn gen_send_iseq(
76677657
}
76687658

76697659
// Let guard chains share the same successor
7670-
jump_to_next_insn(jit, asm);
7671-
return Some(EndBlock);
7660+
return jump_to_next_insn(jit, asm);
76727661
}
76737662

76747663
// Stack overflow check
@@ -8744,8 +8733,7 @@ fn gen_struct_aref(
87448733
let ret = asm.stack_push(Type::Unknown);
87458734
asm.mov(ret, val);
87468735

8747-
jump_to_next_insn(jit, asm);
8748-
Some(EndBlock)
8736+
jump_to_next_insn(jit, asm)
87498737
}
87508738

87518739
fn gen_struct_aset(
@@ -8791,8 +8779,7 @@ fn gen_struct_aset(
87918779
let ret = asm.stack_push(Type::Unknown);
87928780
asm.mov(ret, val);
87938781

8794-
jump_to_next_insn(jit, asm);
8795-
Some(EndBlock)
8782+
jump_to_next_insn(jit, asm)
87968783
}
87978784

87988785
// Generate code that calls a method with dynamic dispatch
@@ -8834,8 +8821,7 @@ fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>(
88348821
jit_perf_symbol_pop!(jit, asm, PerfMap::Codegen);
88358822

88368823
// End the current block for invalidationg and sharing the same successor
8837-
jump_to_next_insn(jit, asm);
8838-
Some(EndBlock)
8824+
jump_to_next_insn(jit, asm)
88398825
}
88408826

88418827
fn gen_send_general(
@@ -9538,8 +9524,7 @@ fn gen_invokeblock_specialized(
95389524
asm.clear_local_types();
95399525

95409526
// Share the successor with other chains
9541-
jump_to_next_insn(jit, asm);
9542-
Some(EndBlock)
9527+
jump_to_next_insn(jit, asm)
95439528
} else if comptime_handler.symbol_p() {
95449529
gen_counter_incr(jit, asm, Counter::invokeblock_symbol);
95459530
None
@@ -10099,8 +10084,7 @@ fn gen_opt_getconstant_path(
1009910084
let stack_top = asm.stack_push(Type::Unknown);
1010010085
asm.store(stack_top, val);
1010110086

10102-
jump_to_next_insn(jit, asm);
10103-
return Some(EndBlock);
10087+
return jump_to_next_insn(jit, asm);
1010410088
}
1010510089

1010610090
let cref_sensitive = !unsafe { (*ice).ic_cref }.is_null();
@@ -10148,8 +10132,7 @@ fn gen_opt_getconstant_path(
1014810132
jit_putobject(asm, unsafe { (*ice).value });
1014910133
}
1015010134

10151-
jump_to_next_insn(jit, asm);
10152-
Some(EndBlock)
10135+
jump_to_next_insn(jit, asm)
1015310136
}
1015410137

1015510138
// Push the explicit block parameter onto the temporary stack. Part of the
@@ -10274,9 +10257,7 @@ fn gen_getblockparamproxy(
1027410257
unreachable!("absurd given initial filtering");
1027510258
}
1027610259

10277-
jump_to_next_insn(jit, asm);
10278-
10279-
Some(EndBlock)
10260+
jump_to_next_insn(jit, asm)
1028010261
}
1028110262

1028210263
fn gen_getblockparam(

0 commit comments

Comments
 (0)