summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-01 13:07:49 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-09 09:52:46 +0900
commit97f456374d73a8510ecfce44f3ed3b775e57f3a0 (patch)
tree4aaee6512d79cd205b5b1a6a7c3eccaa3eb2188c /vm_insnhelper.c
parent3da9c519737ba4c64eaaf2ee4af341c430fbad0a (diff)
rb_eql_opt: fully static call data
This changeset reduces the generated binary of rb_eql_opt from 86 bytes to 20 bytes on my machine, according to nm(1).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3179
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 8b44a44420..e7e126b2e7 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1784,8 +1784,6 @@ opt_equality(const rb_iseq_t *cd_owner, VALUE recv, VALUE obj, CALL_DATA cd)
#undef EQ_UNREDEFINED_P
#ifndef MJIT_HEADER
-
-#define vm_ci_new_id(mid) vm_ci_new_runtime(mid, 0, 0, NULL)
#define VM_CI_NEW_ID(mid) \
((const struct rb_callinfo *)\
((((VALUE)(mid)) << CI_EMBED_ID_SHFT) | RUBY_FIXNUM_FLAG))
@@ -1802,14 +1800,20 @@ rb_equal_opt(VALUE obj1, VALUE obj2)
return opt_equality(NULL, obj1, obj2, &cd);
}
-#endif
VALUE
rb_eql_opt(VALUE obj1, VALUE obj2)
{
- struct rb_call_data cd = { .ci = vm_ci_new_id(idEqlP), .cc = vm_cc_empty() };
+ STATIC_ASSERT(idEqlP_is_embeddable, VM_CI_EMBEDDABLE_P(idEqlP, 0, 1, 0));
+
+ static struct rb_call_data cd = {
+ .ci = VM_CI_NEW_ID(idEqlP),
+ .cc = &vm_empty_cc,
+ };
+
return opt_equality(NULL, obj1, obj2, &cd);
}
+#endif
extern VALUE rb_vm_call0(rb_execution_context_t *ec, VALUE, ID, int, const VALUE*, const rb_callable_method_entry_t *, int kw_splat);