Skip to content

ZJIT: We are missing opportunities to elide inline frames #1070

Description

@tekknolagi
def foo(x) = x + 1
def bar(x) = x + 1
def test = foo(3) + bar(4)
test
test

This gets rid of the frame for bar but not foo even though they are the same:

Optimized HIR:
fn test@inlineframe.rb:3:
bb1():
  EntryPoint interpreter
  v1:BasicObject = LoadSelf
  Jump bb3(v1)
bb2():
  EntryPoint JIT(0)
  v4:BasicObject = LoadArg :self@0
  Jump bb3(v4)
bb3(v6:BasicObject):
  v11:Fixnum[3] = Const Value(3)
  PatchPoint MethodRedefined(Object@0x101a30f00, foo@0xa801, cme:0x101af6c50)
  v28:ObjectSubclass[class_exact*:Object@VALUE(0x101a30f00)] = GuardType v6, ObjectSubclass[class_exact*:Object@VALUE(0x101a30f00)] recompile
  PushInlineFrame :foo, v28 (0x101a45540), num_args=1
  v45:Fixnum[1] = Const Value(1)
  PatchPoint MethodRedefined(Integer@0x101a344c0, +@0x2b, cme:0x101a1c280)
  v84:Fixnum[4] = Const Value(4)
  PopInlineFrame
  v16:Fixnum[4] = Const Value(4)
  PatchPoint MethodRedefined(Object@0x101a30f00, bar@0xa811, cme:0x101af6c78)
  v86:Fixnum[9] = Const Value(9)
  CheckInterrupts
  Return v86

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions