summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-03 18:25:13 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-09 09:52:46 +0900
commite1e84fbb4f7df57d48fd2b1331edd0d521df7812 (patch)
treec23c752223b8b3eac098a2215f1d5fd18e0ae090 /vm_insnhelper.c
parent324038c66edc947a7738440621587575355087a4 (diff)
VM_CI_NEW_ID: USE_EMBED_CI could be false
It was a wrong idea to assume CIs are always embedded.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3179
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index a9ce512506..15ccf23386 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1784,19 +1784,22 @@ 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) \
- ((const struct rb_callinfo *)\
- ((((VALUE)(mid)) << CI_EMBED_ID_SHFT) | RUBY_FIXNUM_FLAG))
-
VALUE
rb_equal_opt(VALUE obj1, VALUE obj2)
{
STATIC_ASSERT(idEq_is_embeddable, VM_CI_EMBEDDABLE_P(idEq, 0, 1, 0));
+#if USE_EMBED_CI
static struct rb_call_data cd = {
- .ci = VM_CI_NEW_ID(idEq),
+ .ci = vm_ci_new_id(idEq, 0, 1, 0),
+ .cc = &vm_empty_cc,
+ };
+#else
+ struct rb_call_data cd = {
+ .ci = &VM_CI_ON_STACK(idEq, 0, 1, 0),
.cc = &vm_empty_cc,
};
+#endif
return opt_equality(NULL, obj1, obj2, &cd);
}
@@ -1806,10 +1809,17 @@ rb_eql_opt(VALUE obj1, VALUE obj2)
{
STATIC_ASSERT(idEqlP_is_embeddable, VM_CI_EMBEDDABLE_P(idEqlP, 0, 1, 0));
+#if USE_EMBED_CI
static struct rb_call_data cd = {
- .ci = VM_CI_NEW_ID(idEqlP),
+ .ci = vm_ci_new_id(idEqlP, 0, 1, 0),
.cc = &vm_empty_cc,
};
+#else
+ struct rb_call_data cd = {
+ .ci = &VM_CI_ON_STACK(idEqlP, 0, 1, 0),
+ .cc = &vm_empty_cc,
+ };
+#endif
return opt_equality(NULL, obj1, obj2, &cd);
}