Skip to content

Commit ecebf16

Browse files
k0kubunXrXr
andauthored
YJIT: Add more information to an assert message (ruby#14481)
YJIT: Add more information to an assert message in jit_guard_known_class (ruby#14480) --------- Co-authored-by: Alan Wu <[email protected]>
1 parent 600dc9c commit ecebf16

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

yjit/src/codegen.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,6 @@ fn gen_expandarray(
22812281
jit_guard_known_klass(
22822282
jit,
22832283
asm,
2284-
comptime_recv.class_of(),
22852284
array_opnd,
22862285
array_opnd.into(),
22872286
comptime_recv,
@@ -3696,7 +3695,6 @@ fn gen_equality_specialized(
36963695
jit_guard_known_klass(
36973696
jit,
36983697
asm,
3699-
unsafe { rb_cString },
37003698
a_opnd,
37013699
a_opnd.into(),
37023700
comptime_a,
@@ -3722,7 +3720,6 @@ fn gen_equality_specialized(
37223720
jit_guard_known_klass(
37233721
jit,
37243722
asm,
3725-
unsafe { rb_cString },
37263723
b_opnd,
37273724
b_opnd.into(),
37283725
comptime_b,
@@ -3819,7 +3816,6 @@ fn gen_opt_aref(
38193816
jit_guard_known_klass(
38203817
jit,
38213818
asm,
3822-
unsafe { rb_cArray },
38233819
recv_opnd,
38243820
recv_opnd.into(),
38253821
comptime_recv,
@@ -3859,7 +3855,6 @@ fn gen_opt_aref(
38593855
jit_guard_known_klass(
38603856
jit,
38613857
asm,
3862-
unsafe { rb_cHash },
38633858
recv_opnd,
38643859
recv_opnd.into(),
38653860
comptime_recv,
@@ -3912,7 +3907,6 @@ fn gen_opt_aset(
39123907
jit_guard_known_klass(
39133908
jit,
39143909
asm,
3915-
unsafe { rb_cArray },
39163910
recv,
39173911
recv.into(),
39183912
comptime_recv,
@@ -3924,7 +3918,6 @@ fn gen_opt_aset(
39243918
jit_guard_known_klass(
39253919
jit,
39263920
asm,
3927-
unsafe { rb_cInteger },
39283921
key,
39293922
key.into(),
39303923
comptime_key,
@@ -3957,7 +3950,6 @@ fn gen_opt_aset(
39573950
jit_guard_known_klass(
39583951
jit,
39593952
asm,
3960-
unsafe { rb_cHash },
39613953
recv,
39623954
recv.into(),
39633955
comptime_recv,
@@ -4916,13 +4908,13 @@ fn gen_jump(
49164908
fn jit_guard_known_klass(
49174909
jit: &mut JITState,
49184910
asm: &mut Assembler,
4919-
known_klass: VALUE,
49204911
obj_opnd: Opnd,
49214912
insn_opnd: YARVOpnd,
49224913
sample_instance: VALUE,
49234914
max_chain_depth: u8,
49244915
counter: Counter,
49254916
) {
4917+
let known_klass = sample_instance.class_of();
49264918
let val_type = asm.ctx.get_opnd_type(insn_opnd);
49274919

49284920
if val_type.known_class() == Some(known_klass) {
@@ -5028,7 +5020,7 @@ fn jit_guard_known_klass(
50285020
assert_eq!(sample_instance.class_of(), rb_cString, "context says class is exactly ::String")
50295021
};
50305022
} else {
5031-
assert!(!val_type.is_imm());
5023+
assert!(!val_type.is_imm(), "{insn_opnd:?} should be a heap object, but was {val_type:?} for {sample_instance:?}");
50325024

50335025
// Check that the receiver is a heap object
50345026
// Note: if we get here, the class doesn't have immediate instances.
@@ -5672,7 +5664,6 @@ fn jit_rb_float_plus(
56725664
jit_guard_known_klass(
56735665
jit,
56745666
asm,
5675-
comptime_obj.class_of(),
56765667
obj,
56775668
obj.into(),
56785669
comptime_obj,
@@ -5714,7 +5705,6 @@ fn jit_rb_float_minus(
57145705
jit_guard_known_klass(
57155706
jit,
57165707
asm,
5717-
comptime_obj.class_of(),
57185708
obj,
57195709
obj.into(),
57205710
comptime_obj,
@@ -5756,7 +5746,6 @@ fn jit_rb_float_mul(
57565746
jit_guard_known_klass(
57575747
jit,
57585748
asm,
5759-
comptime_obj.class_of(),
57605749
obj,
57615750
obj.into(),
57625751
comptime_obj,
@@ -5798,7 +5787,6 @@ fn jit_rb_float_div(
57985787
jit_guard_known_klass(
57995788
jit,
58005789
asm,
5801-
comptime_obj.class_of(),
58025790
obj,
58035791
obj.into(),
58045792
comptime_obj,
@@ -6062,7 +6050,6 @@ fn jit_rb_str_getbyte(
60626050
jit_guard_known_klass(
60636051
jit,
60646052
asm,
6065-
comptime_idx.class_of(),
60666053
idx,
60676054
idx.into(),
60686055
comptime_idx,
@@ -9068,7 +9055,6 @@ fn gen_send_general(
90689055
perf_call!("gen_send_general: ", jit_guard_known_klass(
90699056
jit,
90709057
asm,
9071-
comptime_recv_klass,
90729058
recv,
90739059
recv_opnd,
90749060
comptime_recv,
@@ -9982,7 +9968,6 @@ fn gen_objtostring(
99829968
jit_guard_known_klass(
99839969
jit,
99849970
asm,
9985-
comptime_recv.class_of(),
99869971
recv,
99879972
recv.into(),
99889973
comptime_recv,
@@ -9996,7 +9981,6 @@ fn gen_objtostring(
99969981
jit_guard_known_klass(
99979982
jit,
99989983
asm,
9999-
comptime_recv.class_of(),
100009984
recv,
100019985
recv.into(),
100029986
comptime_recv,

0 commit comments

Comments
 (0)