diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-04-29 11:47:19 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:34 -0400 |
commit | 684e84df7cdfd47d2b66d717369121337a2bd32d (patch) | |
tree | 1e9760bb148720599ca1aa99cbc0e24c665a7ecb /bootstraptest | |
parent | 62c1297e246966bd3b309d3a3ce3cd0dc78c389d (diff) |
Use rb_ivar_get() for general case of getivar (#17)
* Use rb_ivar_get() for general case of getivar
Pretty straight forward. Buys about 1% coverage on railsbench.
* Update yjit_codegen.c
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 6bf0f53e9e..6ac31f8134 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -656,6 +656,33 @@ assert_equal '[100, 299]', %q{ [bar(ins), bar(oth)] } +# get ivar on object, then on hash +assert_equal '[42, 100]', %q{ + class Hash + attr_accessor :foo + end + + class A + attr_reader :foo + + def initialize + @foo = 42 + end + end + + def use(val) + val.foo + end + + + h = {} + h.foo = 100 + obj = A.new + + use(obj) + [use(obj), use(h)] +} + # get ivar on String assert_equal '[nil, nil, 42, 42]', %q{ # @foo to exercise the getinstancevariable instruction |