Skip to content

Commit

Permalink
Convert getinstancevariable to new backend IR (#352)
Browse files Browse the repository at this point in the history
* Convert getinstancevariable to new backend IR

* Support mem-based mem

* Use more into()

* Add tests for getivar

* Just load obj_opnd to a register

* Apply another into()

* Flip the nil-out condition

* Fix duplicated counts of side_exit
  • Loading branch information
k0kubun committed Aug 25, 2022
1 parent 893a472 commit 208788a
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 164 deletions.
16 changes: 16 additions & 0 deletions bootstraptest/test_yjit_new_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,22 @@ def foo()
foo()
}

# getinstancevariable
assert_equal '[nil, 1]', %q{
class Foo
def foo()
@foo
end
end
@bar = 1
def bar
@bar
end
[Foo.new.foo, bar]
}




Expand Down
9 changes: 8 additions & 1 deletion yjit/src/backend/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,14 @@ impl Target
pub fn unwrap_label_idx(&self) -> usize {
match self {
Target::Label(idx) => *idx,
_ => unreachable!()
_ => unreachable!("trying to unwrap {:?} into label", self)
}
}

pub fn unwrap_code_ptr(&self) -> CodePtr {
match self {
Target::CodePtr(ptr) => *ptr,
_ => unreachable!("trying to unwrap {:?} into code ptr", self)
}
}
}
Expand Down
Loading

0 comments on commit 208788a

Please sign in to comment.