Skip to content

Commit f7932db

Browse files
committed
Don't override inline, lol
1 parent 2291bdf commit f7932db

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

zjit/src/cruby_methods.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ pub fn init() -> Annotations {
220220
annotate!(rb_cModule, "name", types::StringExact.union(types::NilClass), no_gc, leaf, elidable);
221221
annotate!(rb_cModule, "===", inline_module_eqq, types::BoolExact, no_gc, leaf);
222222
annotate!(rb_cArray, "length", inline_array_length, types::Fixnum, no_gc, leaf, elidable);
223-
annotate!(rb_cArray, "size", types::Fixnum, no_gc, leaf, elidable);
224223
annotate!(rb_cArray, "empty?", types::BoolExact, no_gc, leaf, elidable);
225224
annotate!(rb_cArray, "reverse", types::ArrayExact, leaf, elidable);
226225
annotate!(rb_cArray, "join", types::StringExact);

zjit/src/hir/opt_tests.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3554,13 +3554,42 @@ mod hir_opt_tests {
35543554
v18:ArrayExact = NewArray v11, v12
35553555
PatchPoint MethodRedefined(Array@0x1000, length@0x1008, cme:0x1010)
35563556
PatchPoint NoSingletonClass(Array@0x1000)
3557+
v29:CInt64 = ArrayLength v18
3558+
v30:Fixnum = BoxFixnum v29
35573559
IncrCounter inline_cfunc_optimized_send_count
3558-
v30:Fixnum = CCall v18, :Array#length@0x1038
35593560
CheckInterrupts
35603561
Return v30
35613562
");
35623563
}
35633564

3565+
#[test]
3566+
fn test_opt_length_profiled() {
3567+
eval("
3568+
def test(a) = a.length
3569+
test([])
3570+
");
3571+
assert_snapshot!(hir_string("test"), @r"
3572+
fn test@<compiled>:2:
3573+
bb0():
3574+
EntryPoint interpreter
3575+
v1:BasicObject = LoadSelf
3576+
v2:BasicObject = GetLocal :a, l0, SP@4
3577+
Jump bb2(v1, v2)
3578+
bb1(v5:BasicObject, v6:BasicObject):
3579+
EntryPoint JIT(0)
3580+
Jump bb2(v5, v6)
3581+
bb2(v8:BasicObject, v9:BasicObject):
3582+
PatchPoint MethodRedefined(Array@0x1000, length@0x1008, cme:0x1010)
3583+
PatchPoint NoSingletonClass(Array@0x1000)
3584+
v23:ArrayExact = GuardType v9, ArrayExact
3585+
v24:CInt64 = ArrayLength v23
3586+
v25:Fixnum = BoxFixnum v24
3587+
IncrCounter inline_cfunc_optimized_send_count
3588+
CheckInterrupts
3589+
Return v25
3590+
");
3591+
}
3592+
35643593
#[test]
35653594
fn test_opt_size() {
35663595
eval("

0 commit comments

Comments
 (0)