Skip to content

Commit c3c2544

Browse files
committed
ZJIT: Annotate Symbol#to_s and Symbol#name as returning StringExact
1 parent 46525fa commit c3c2544

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

zjit/src/cruby_methods.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ pub fn init() -> Annotations {
225225
annotate_builtin!(rb_mKernel, "Float", types::Float);
226226
annotate_builtin!(rb_mKernel, "Integer", types::Integer);
227227
annotate_builtin!(rb_mKernel, "class", types::Class, leaf);
228+
annotate_builtin!(rb_cSymbol, "name", types::StringExact);
229+
annotate_builtin!(rb_cSymbol, "to_s", types::StringExact);
228230

229231
Annotations {
230232
cfuncs: std::mem::take(cfuncs),

zjit/src/hir.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8185,9 +8185,9 @@ mod tests {
81858185
EntryPoint JIT(0)
81868186
Jump bb2(v4)
81878187
bb2(v6:BasicObject):
8188-
v11:BasicObject = InvokeBuiltin leaf _bi28, v6
8188+
v11:StringExact = InvokeBuiltin leaf _bi28, v6
81898189
Jump bb3(v6, v11)
8190-
bb3(v13:BasicObject, v14:BasicObject):
8190+
bb3(v13:BasicObject, v14:StringExact):
81918191
CheckInterrupts
81928192
Return v14
81938193
");
@@ -8207,9 +8207,9 @@ mod tests {
82078207
EntryPoint JIT(0)
82088208
Jump bb2(v4)
82098209
bb2(v6:BasicObject):
8210-
v11:BasicObject = InvokeBuiltin leaf _bi12, v6
8210+
v11:StringExact = InvokeBuiltin leaf _bi12, v6
82118211
Jump bb3(v6, v11)
8212-
bb3(v13:BasicObject, v14:BasicObject):
8212+
bb3(v13:BasicObject, v14:StringExact):
82138213
CheckInterrupts
82148214
Return v14
82158215
");
@@ -15391,7 +15391,7 @@ mod opt_tests {
1539115391
PatchPoint MethodRedefined(Symbol@0x1000, to_s@0x1008, cme:0x1010)
1539215392
v21:StaticSymbol = GuardType v9, StaticSymbol
1539315393
IncrCounter inline_iseq_optimized_send_count
15394-
v24:BasicObject = InvokeBuiltin leaf _bi12, v21
15394+
v24:StringExact = InvokeBuiltin leaf _bi12, v21
1539515395
CheckInterrupts
1539615396
Return v24
1539715397
");
@@ -15417,7 +15417,7 @@ mod opt_tests {
1541715417
PatchPoint MethodRedefined(Symbol@0x1000, to_s@0x1008, cme:0x1010)
1541815418
v21:StaticSymbol = GuardType v9, StaticSymbol
1541915419
IncrCounter inline_iseq_optimized_send_count
15420-
v24:BasicObject = InvokeBuiltin leaf _bi12, v21
15420+
v24:StringExact = InvokeBuiltin leaf _bi12, v21
1542115421
CheckInterrupts
1542215422
Return v24
1542315423
");

0 commit comments

Comments
 (0)