Skip to content

Commit 7e6f7fb

Browse files
authored
ZJIT: Annotate BasicObject#initialize (ruby#14590)
It's a no-op and always returns `nil`. Fixes Shopify#755
1 parent 4e05fe5 commit 7e6f7fb

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

zjit/src/cruby_methods.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ pub fn init() -> Annotations {
177177
annotate!(rb_mKernel, "nil?", types::FalseClass, no_gc, leaf, elidable);
178178
annotate!(rb_cBasicObject, "==", types::BoolExact, no_gc, leaf, elidable);
179179
annotate!(rb_cBasicObject, "!", types::BoolExact, no_gc, leaf, elidable);
180+
annotate!(rb_cBasicObject, "initialize", types::NilClass, no_gc, leaf, elidable);
180181

181182
annotate_builtin!(rb_mKernel, "Float", types::Float);
182183
annotate_builtin!(rb_mKernel, "Integer", types::Integer);

zjit/src/hir.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8121,7 +8121,8 @@ mod opt_tests {
81218121
v6:NilClass = Const Value(nil)
81228122
PatchPoint MethodRedefined(C@0x1008, new@0x1010, cme:0x1018)
81238123
v37:HeapObject[class_exact:C] = ObjectAllocClass VALUE(0x1008)
8124-
v12:BasicObject = SendWithoutBlock v37, :initialize
8124+
PatchPoint MethodRedefined(C@0x1008, initialize@0x1040, cme:0x1048)
8125+
v39:NilClass = CCall initialize@0x1070, v37
81258126
CheckInterrupts
81268127
CheckInterrupts
81278128
Return v37

0 commit comments

Comments
 (0)