summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-12 15:25:58 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-12 15:25:58 (GMT)
commit1fd816803b3c7c2d0b138e06be578b833a132718 (patch)
tree3d0173cf8af5949767e7c3e6375d188e3277e530 /vm_insnhelper.c
parent1012e50ac7c7cf42b8806f427e587ec4163bbea8 (diff)
vm_insnhelper.c: inline array aref with integer
internal.h: define inlinable rb_ary_entry_internal. array.c: use rb_ary_entry_internal. * Benchmark ruby --jit mame/optcarrot/bin/optcarrot --benchmark mame/optcarrot/examples/Lan_Master.nes ** Before checksum: 59662 fps: 58.095175012159686 ** After fps: 59.874751599221526 checksum: 59662 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index a0f63df..415070f 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3647,7 +3647,12 @@ vm_opt_aref(VALUE recv, VALUE obj)
}
else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_AREF, ARRAY_REDEFINED_OP_FLAG)) {
- return rb_ary_aref1(recv, obj);
+ if (FIXNUM_P(obj)) {
+ return rb_ary_entry_internal(recv, FIX2LONG(obj));
+ }
+ else {
+ return rb_ary_aref1(recv, obj);
+ }
}
else if (RBASIC_CLASS(recv) == rb_cHash &&
BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG)) {