summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-06-12 14:02:51 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:36 -0400
commitb93f59ced0a1dbab6b18839e8664a02ea7b3b1aa (patch)
treee84f69744695739f9111931df83d96fd1b53b5f1 /bootstraptest
parentd416a15c86f0641f5dda3d32c05a30fd5510ccf6 (diff)
Implement invokebuiltin_delegate
invokebuiltin_delegate is a special version of invokebuiltin used for sending a contiguous subset of the current method's locals. In some cases YJIT would already handle this for trivial cases it could be inlined, implementing this OP allows it to work when the method isn't inlinable (not marked as 'inline', does more than just call, not called from yjit, etc).
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index fcf027d728..de20b3565e 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1040,6 +1040,36 @@ assert_equal 'foo123', %q{
make_str("foo", 123)
}
+# test invokebuiltin_delegate as used inside Dir.open
+assert_equal '.', %q{
+ def foo(path)
+ Dir.open(path).path
+ end
+
+ foo(".")
+ foo(".")
+}
+
+# test invokebuiltin_delegate_leave in method called from jit
+assert_normal_exit %q{
+ def foo(obj)
+ obj.clone
+ end
+
+ foo(Object.new)
+ foo(Object.new)
+}
+
+# test invokebuiltin_delegate_leave in method called from cfunc
+assert_normal_exit %q{
+ def foo(obj)
+ [obj].map(&:clone)
+ end
+
+ foo(Object.new)
+ foo(Object.new)
+}
+
# getlocal with 2 levels
assert_equal '7', %q{
def foo(foo, bar)