summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-28 01:06:04 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-28 01:06:04 +0000
commit24b1b433c5abf02e9f9c7eb3851f4417dc5d8751 (patch)
treefc513612cf7e6904294a2cf6052973e1c13c563e /vm_insnhelper.c
parentd3c0b20949916aa7b432a0498a8016d67a7822ad (diff)
vm_insnhelper.c: delete unused macros
- FIXNUM_2_P: moved to vm_insnhelper.c because that is the only place this macro is used. - FLONUM_2_P: ditto. - FLOAT_HEAP_P: not used anywhere. - FLOAT_INSTANCE_P: ditto. - GET_TOS: ditto. - USE_IC_FOR_SPECIALIZED_METHOD: ditto. - rb_obj_hidden_p: ditto. - REG_A: ditto. - REG_B: ditto. - GET_CONST_INLINE_CACHE: ditto. - vm_regan_regtype: moved inside of VM_COLLECT_USAGE_DETAILS because that os the only place this enum is used. - vm_regan_acttype: ditto. - GET_GLOBAL: used only once. Removed with replacing that usage. - SET_GLOBAL: ditto. - rb_method_definition_create: declaration moved to vm_insnhelper.c because that is the only place this declaration makes sense. - rb_method_definition_set: ditto. - rb_method_definition_eq: ditto. - rb_make_no_method_exception: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index b26a5930aa..4a6d7dc9d6 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -19,6 +19,12 @@
#include "ruby/config.h"
#include "debug_counter.h"
+extern rb_method_definition_t *rb_method_definition_create(rb_method_type_t type, ID mid);
+extern void rb_method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *def, void *opts);
+extern int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2);
+extern VALUE rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
+ int argc, const VALUE *argv, int priv);
+
/* control stack frame */
static rb_control_frame_t *vm_get_ruby_level_caller_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
@@ -1385,6 +1391,35 @@ opt_equal_fallback(VALUE recv, VALUE obj, CALL_INFO ci, CALL_CACHE cc)
#define BUILTIN_CLASS_P(x, k) (!SPECIAL_CONST_P(x) && RBASIC_CLASS(x) == k)
#define EQ_UNREDEFINED_P(t) BASIC_OP_UNREDEFINED_P(BOP_EQ, t##_REDEFINED_OP_FLAG)
+static bool
+FIXNUM_2_P(VALUE a, VALUE b)
+{
+ /* FIXNUM_P(a) && FIXNUM_P(b)
+ * == ((a & 1) && (b & 1))
+ * == a & b & 1 */
+ SIGNED_VALUE x = a;
+ SIGNED_VALUE y = b;
+ SIGNED_VALUE z = x & y & 1;
+ return z == 1;
+}
+
+static bool
+FLONUM_2_P(VALUE a, VALUE b)
+{
+#ifdef USE_FLONUM
+ /* FLONUM_P(a) && FLONUM_P(b)
+ * == ((a & 3) == 2) && ((b & 3) == 2)
+ * == ! ((a ^ 2) | (b ^ 2) & 3)
+ */
+ SIGNED_VALUE x = a;
+ SIGNED_VALUE y = b;
+ SIGNED_VALUE z = ((x ^ 2) | (y ^ 2)) & 3;
+ return !z;
+#else
+ return false;
+#endif
+}
+
/* 1: compare by identity, 0: not applicable, -1: redefined */
static inline int
comparable_by_identity(VALUE recv, VALUE obj)
@@ -1619,6 +1654,19 @@ rb_simple_iseq_p(const rb_iseq_t *iseq)
iseq->body->param.flags.has_block == FALSE;
}
+static void
+CALLER_SETUP_ARG(struct rb_control_frame_struct *restrict cfp,
+ struct rb_calling_info *restrict calling,
+ const struct rb_call_info *restrict ci)
+{
+ if (UNLIKELY(IS_ARGS_SPLAT(ci))) {
+ vm_caller_setup_arg_splat(cfp, calling);
+ }
+ if (UNLIKELY(IS_ARGS_KEYWORD(ci))) {
+ vm_caller_setup_arg_kw(cfp, calling, ci);
+ }
+}
+
static inline int
vm_callee_setup_arg(rb_execution_context_t *ec, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc,
const rb_iseq_t *iseq, VALUE *argv, int param_size, int local_size)