Skip to content

ZJIT: We use as_heap and fields_obj to mean the same thing sometimes #1024

Description

@tekknolagi

Looking at this HIR dump from optcarrot:

Optimized HIR:
fn wait_one_clock@/Users/emacs/Documents/code/yjit-bench/benchmarks/optcarrot/lib/optcarrot/ppu.rb:906:
bb1():
  EntryPoint interpreter
  v1:HeapBasicObject = LoadSelf
  Jump bb3(v1)
bb2():
  EntryPoint JIT(0)
  v4:HeapBasicObject = LoadArg :self@0
  Jump bb3(v4)
bb3(v6:HeapBasicObject):
  PatchPoint SingleRactorMode
  v12:CShape = LoadField v6, :shape_id@0x4
  v13:CShape[0x4040017a] = GuardBitEquals v12, CShape(0x4040017a) recompile
  v14:RubyValue = LoadField v6, :fields_obj@0x10
  v15:BasicObject = LoadField v14, :@hclk@0x68
  v17:Fixnum[1] = Const Value(1)
  PatchPoint MethodRedefined(Integer@0x1013844e0, +@0x2b, cme:0x10136bfd0)
  v72:Fixnum = GuardType v15, Fixnum recompile
  v73:Fixnum = FixnumAdd v72, v17
  v26:BasicObject = LoadField v6, :as_heap@0x10
  StoreField v26, :@hclk@0x68, v73
  WriteBarrier v26, v73
  PatchPoint SingleRactorMode
  v37:BasicObject = LoadField v14, :@hclk_target@0x78
  v44:BasicObject = LoadField v14, :@hclk@0x68
  PatchPoint MethodRedefined(Integer@0x1013844e0, <=@0x8a, cme:0x10136c2a0)
  v76:Fixnum = GuardType v37, Fixnum recompile
  v77:Fixnum = GuardType v44, Fixnum
  v78:BoolExact = FixnumLe v76, v77
  v49:CBool = Test v78
  CondBranch v49, bb5(), bb4(v6)
bb5():
  v54:BasicObject = GetConstantPath 0x8dc425800
  SideExit NoProfileSend recompile
bb4(v61:HeapBasicObject):
  v64:NilClass = Const Value(nil)
  CheckInterrupts
  Return v64

v14:RubyValue = LoadField v6, :fields_obj@0x10 and v26:BasicObject = LoadField v6, :as_heap@0x10 seem to be doing the same thing with different names which is really confusing.

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