Skip to content

Commit e561c35

Browse files
committed
.
1 parent a0d7cae commit e561c35

1 file changed

Lines changed: 97 additions & 97 deletions

File tree

zjit/src/hir/opt_tests.rs

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -11881,6 +11881,103 @@ mod hir_opt_tests {
1188111881
");
1188211882
}
1188311883

11884+
#[test]
11885+
fn test_is_a_array_subclass_folds_to_true() {
11886+
eval(r#"
11887+
class C < Array; end
11888+
O = C.new
11889+
def test = O.is_a?(Array)
11890+
test
11891+
"#);
11892+
assert_snapshot!(hir_string("test"), @r"
11893+
fn test@<compiled>:4:
11894+
bb1():
11895+
EntryPoint interpreter
11896+
v1:BasicObject = LoadSelf
11897+
Jump bb3(v1)
11898+
bb2():
11899+
EntryPoint JIT(0)
11900+
v4:BasicObject = LoadArg :self@0
11901+
Jump bb3(v4)
11902+
bb3(v6:BasicObject):
11903+
PatchPoint SingleRactorMode
11904+
PatchPoint StableConstantNames(0x1000, O)
11905+
v22:ArraySubclass[VALUE(0x1008)] = Const Value(VALUE(0x1008))
11906+
PatchPoint StableConstantNames(0x1010, Array)
11907+
v25:Class[Array@0x1018] = Const Value(VALUE(0x1018))
11908+
PatchPoint NoSingletonClass(C@0x1020)
11909+
PatchPoint MethodRedefined(C@0x1020, is_a?@0x1028, cme:0x1030)
11910+
v31:TrueClass = Const Value(true)
11911+
IncrCounter inline_cfunc_optimized_send_count
11912+
CheckInterrupts
11913+
Return v31
11914+
");
11915+
}
11916+
11917+
#[test]
11918+
fn test_is_a_user_defined_class_folds_to_true() {
11919+
eval(r#"
11920+
class C; end
11921+
O = C.new
11922+
def test = O.is_a?(C)
11923+
test
11924+
"#);
11925+
assert_snapshot!(hir_string("test"), @r"
11926+
fn test@<compiled>:4:
11927+
bb1():
11928+
EntryPoint interpreter
11929+
v1:BasicObject = LoadSelf
11930+
Jump bb3(v1)
11931+
bb2():
11932+
EntryPoint JIT(0)
11933+
v4:BasicObject = LoadArg :self@0
11934+
Jump bb3(v4)
11935+
bb3(v6:BasicObject):
11936+
PatchPoint SingleRactorMode
11937+
PatchPoint StableConstantNames(0x1000, O)
11938+
v22:ObjectSubclass[VALUE(0x1008)] = Const Value(VALUE(0x1008))
11939+
PatchPoint StableConstantNames(0x1010, C)
11940+
v25:Class[C@0x1018] = Const Value(VALUE(0x1018))
11941+
PatchPoint NoSingletonClass(C@0x1018)
11942+
PatchPoint MethodRedefined(C@0x1018, is_a?@0x1019, cme:0x1020)
11943+
v31:TrueClass = Const Value(true)
11944+
IncrCounter inline_cfunc_optimized_send_count
11945+
CheckInterrupts
11946+
Return v31
11947+
");
11948+
}
11949+
11950+
#[test]
11951+
fn test_is_a_symbol_folds_to_true() {
11952+
eval(r#"
11953+
O = :my_static_symbol
11954+
def test = O.is_a?(Symbol)
11955+
test
11956+
"#);
11957+
assert_snapshot!(hir_string("test"), @r"
11958+
fn test@<compiled>:3:
11959+
bb1():
11960+
EntryPoint interpreter
11961+
v1:BasicObject = LoadSelf
11962+
Jump bb3(v1)
11963+
bb2():
11964+
EntryPoint JIT(0)
11965+
v4:BasicObject = LoadArg :self@0
11966+
Jump bb3(v4)
11967+
bb3(v6:BasicObject):
11968+
PatchPoint SingleRactorMode
11969+
PatchPoint StableConstantNames(0x1000, O)
11970+
v22:StaticSymbol[:my_static_symbol] = Const Value(VALUE(0x1008))
11971+
PatchPoint StableConstantNames(0x1010, Symbol)
11972+
v25:Class[Symbol@0x1018] = Const Value(VALUE(0x1018))
11973+
PatchPoint MethodRedefined(Symbol@0x1018, is_a?@0x1019, cme:0x1020)
11974+
v30:TrueClass = Const Value(true)
11975+
IncrCounter inline_cfunc_optimized_send_count
11976+
CheckInterrupts
11977+
Return v30
11978+
");
11979+
}
11980+
1188411981
#[test]
1188511982
fn counting_complex_feature_use_for_fallback() {
1188611983
eval("
@@ -13750,101 +13847,4 @@ mod hir_opt_tests {
1375013847
Jump bb8(v67, v94)
1375113848
");
1375213849
}
13753-
13754-
#[test]
13755-
fn test_is_a_array_subclass_folds_to_true() {
13756-
eval(r#"
13757-
class C < Array; end
13758-
O = C.new
13759-
def test = O.is_a?(Array)
13760-
test
13761-
"#);
13762-
assert_snapshot!(hir_string("test"), @r"
13763-
fn test@<compiled>:4:
13764-
bb1():
13765-
EntryPoint interpreter
13766-
v1:BasicObject = LoadSelf
13767-
Jump bb3(v1)
13768-
bb2():
13769-
EntryPoint JIT(0)
13770-
v4:BasicObject = LoadArg :self@0
13771-
Jump bb3(v4)
13772-
bb3(v6:BasicObject):
13773-
PatchPoint SingleRactorMode
13774-
PatchPoint StableConstantNames(0x1000, O)
13775-
v22:ArraySubclass[VALUE(0x1008)] = Const Value(VALUE(0x1008))
13776-
PatchPoint StableConstantNames(0x1010, Array)
13777-
v25:Class[Array@0x1018] = Const Value(VALUE(0x1018))
13778-
PatchPoint NoSingletonClass(C@0x1020)
13779-
PatchPoint MethodRedefined(C@0x1020, is_a?@0x1028, cme:0x1030)
13780-
v31:TrueClass = Const Value(true)
13781-
IncrCounter inline_cfunc_optimized_send_count
13782-
CheckInterrupts
13783-
Return v31
13784-
");
13785-
}
13786-
13787-
#[test]
13788-
fn test_is_a_user_defined_class_folds_to_true() {
13789-
eval(r#"
13790-
class C; end
13791-
O = C.new
13792-
def test = O.is_a?(C)
13793-
test
13794-
"#);
13795-
assert_snapshot!(hir_string("test"), @r"
13796-
fn test@<compiled>:4:
13797-
bb1():
13798-
EntryPoint interpreter
13799-
v1:BasicObject = LoadSelf
13800-
Jump bb3(v1)
13801-
bb2():
13802-
EntryPoint JIT(0)
13803-
v4:BasicObject = LoadArg :self@0
13804-
Jump bb3(v4)
13805-
bb3(v6:BasicObject):
13806-
PatchPoint SingleRactorMode
13807-
PatchPoint StableConstantNames(0x1000, O)
13808-
v22:ObjectSubclass[VALUE(0x1008)] = Const Value(VALUE(0x1008))
13809-
PatchPoint StableConstantNames(0x1010, C)
13810-
v25:Class[C@0x1018] = Const Value(VALUE(0x1018))
13811-
PatchPoint NoSingletonClass(C@0x1018)
13812-
PatchPoint MethodRedefined(C@0x1018, is_a?@0x1019, cme:0x1020)
13813-
v31:TrueClass = Const Value(true)
13814-
IncrCounter inline_cfunc_optimized_send_count
13815-
CheckInterrupts
13816-
Return v31
13817-
");
13818-
}
13819-
13820-
#[test]
13821-
fn test_is_a_symbol_folds_to_true() {
13822-
eval(r#"
13823-
O = :my_static_symbol
13824-
def test = O.is_a?(Symbol)
13825-
test
13826-
"#);
13827-
assert_snapshot!(hir_string("test"), @r"
13828-
fn test@<compiled>:3:
13829-
bb1():
13830-
EntryPoint interpreter
13831-
v1:BasicObject = LoadSelf
13832-
Jump bb3(v1)
13833-
bb2():
13834-
EntryPoint JIT(0)
13835-
v4:BasicObject = LoadArg :self@0
13836-
Jump bb3(v4)
13837-
bb3(v6:BasicObject):
13838-
PatchPoint SingleRactorMode
13839-
PatchPoint StableConstantNames(0x1000, O)
13840-
v22:StaticSymbol[:my_static_symbol] = Const Value(VALUE(0x1008))
13841-
PatchPoint StableConstantNames(0x1010, Symbol)
13842-
v25:Class[Symbol@0x1018] = Const Value(VALUE(0x1018))
13843-
PatchPoint MethodRedefined(Symbol@0x1018, is_a?@0x1019, cme:0x1020)
13844-
v30:TrueClass = Const Value(true)
13845-
IncrCounter inline_cfunc_optimized_send_count
13846-
CheckInterrupts
13847-
Return v30
13848-
");
13849-
}
1385013850
}

0 commit comments

Comments
 (0)