diff --git a/vm_eval.c b/vm_eval.c index 61c112ad7f..ba75fbbda7 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -640,8 +640,8 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj) } MJIT_FUNC_EXPORTED VALUE -make_no_method_exception(VALUE exc, VALUE format, VALUE obj, - int argc, const VALUE *argv, int priv) +rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj, + int argc, const VALUE *argv, int priv) { int n = 0; enum { @@ -700,8 +700,8 @@ raise_method_missing(rb_execution_context_t *ec, int argc, const VALUE *argv, VA } { - exc = make_no_method_exception(exc, format, obj, argc, argv, - last_call_status & (MISSING_FCALL|MISSING_VCALL)); + exc = rb_make_no_method_exception(exc, format, obj, argc, argv, + last_call_status & (MISSING_FCALL|MISSING_VCALL)); if (!(last_call_status & MISSING_MISSING)) { rb_vm_pop_cfunc_frame(); } @@ -891,9 +891,9 @@ send_internal(int argc, const VALUE *argv, VALUE recv, call_type scope) id = rb_check_id(&vid); if (!id) { if (rb_method_basic_definition_p(CLASS_OF(recv), idMethodMissing)) { - VALUE exc = make_no_method_exception(rb_eNoMethodError, 0, - recv, argc, argv, - scope != CALL_PUBLIC); + VALUE exc = rb_make_no_method_exception(rb_eNoMethodError, 0, + recv, argc, argv, + scope != CALL_PUBLIC); rb_exc_raise(exc); } if (!SYMBOL_P(*argv)) { diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 5567c6b20f..e595dc3187 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1569,10 +1569,6 @@ static inline VALUE vm_call_method(rb_execution_context_t *ec, rb_control_frame_ static vm_call_handler vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size); -extern rb_method_definition_t *method_definition_create(rb_method_type_t type, ID mid); -extern void 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); - static const rb_iseq_t * def_iseq_ptr(rb_method_definition_t *def) { @@ -2034,9 +2030,10 @@ vm_call_opt_send(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct if (!(ci->mid = rb_check_id(&sym))) { if (rb_method_basic_definition_p(CLASS_OF(calling->recv), idMethodMissing)) { - VALUE exc = make_no_method_exception(rb_eNoMethodError, 0, calling->recv, - rb_long2int(calling->argc), &TOPN(i), - ci->flag & (VM_CALL_FCALL|VM_CALL_VCALL)); + VALUE exc = + rb_make_no_method_exception(rb_eNoMethodError, 0, calling->recv, + rb_long2int(calling->argc), &TOPN(i), + ci->flag & (VM_CALL_FCALL|VM_CALL_VCALL)); rb_exc_raise(exc); } TOPN(i) = rb_str_intern(sym); @@ -2215,9 +2212,9 @@ aliased_callable_method_entry(const rb_callable_method_entry_t *me) RB_OBJ_WRITE(me, &me->def->body.alias.original_me, cme); } else { - method_definition_set((rb_method_entry_t *)me, - method_definition_create(VM_METHOD_TYPE_ALIAS, me->def->original_id), - (void *)cme); + rb_method_definition_t *def = + rb_method_definition_create(VM_METHOD_TYPE_ALIAS, me->def->original_id); + rb_method_definition_set((rb_method_entry_t *)me, def, (void *)cme); } } else { diff --git a/vm_insnhelper.h b/vm_insnhelper.h index c07a937855..aca7a779d0 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -184,8 +184,12 @@ enum vm_regan_acttype { #define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state) #define INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state) -extern VALUE make_no_method_exception(VALUE exc, VALUE format, VALUE obj, - int argc, const VALUE *argv, int priv); +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); static inline struct vm_throw_data * THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, VALUE st) diff --git a/vm_method.c b/vm_method.c index 1062b70959..c4fc9a9e28 100644 --- a/vm_method.c +++ b/vm_method.c @@ -224,7 +224,7 @@ setup_method_cfunc_struct(rb_method_cfunc_t *cfunc, VALUE (*func)(), int argc) } MJIT_FUNC_EXPORTED void -method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *def, void *opts) +rb_method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *def, void *opts) { *(rb_method_definition_t **)&me->def = def; @@ -338,7 +338,7 @@ method_definition_reset(const rb_method_entry_t *me) } MJIT_FUNC_EXPORTED rb_method_definition_t * -method_definition_create(rb_method_type_t type, ID mid) +rb_method_definition_create(rb_method_type_t type, ID mid) { rb_method_definition_t *def; def = ZALLOC(rb_method_definition_t); @@ -429,8 +429,8 @@ rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID cal METHOD_ENTRY_FLAGS_COPY(me, src_me); METHOD_ENTRY_COMPLEMENTED_SET(me); if (!def) { - def = method_definition_create(VM_METHOD_TYPE_REFINED, called_id); - method_definition_set(me, def, &refined); + def = rb_method_definition_create(VM_METHOD_TYPE_REFINED, called_id); + rb_method_definition_set(me, def, &refined); } VM_ASSERT(RB_TYPE_P(me->owner, T_MODULE)); @@ -460,6 +460,7 @@ make_method_entry_refined(VALUE owner, rb_method_entry_t *me) struct rb_method_entry_struct *orig_me; VALUE owner; } refined; + rb_method_definition_t *def; rb_vm_check_redefinition_opt_method(me, me->owner); @@ -471,7 +472,8 @@ make_method_entry_refined(VALUE owner, rb_method_entry_t *me) METHOD_ENTRY_FLAGS_COPY(refined.orig_me, me); refined.owner = owner; - method_definition_set(me, method_definition_create(VM_METHOD_TYPE_REFINED, me->called_id), (void *)&refined); + def = rb_method_definition_create(VM_METHOD_TYPE_REFINED, me->called_id); + rb_method_definition_set(me, def, (void *)&refined); METHOD_ENTRY_VISI_SET(me, METHOD_VISI_PUBLIC); } } @@ -593,8 +595,8 @@ rb_method_entry_make(VALUE klass, ID mid, VALUE defined_class, rb_method_visibil /* create method entry */ me = rb_method_entry_create(mid, defined_class, visi, NULL); - if (def == NULL) def = method_definition_create(type, original_id); - method_definition_set(me, def, opts); + if (def == NULL) def = rb_method_definition_create(type, original_id); + rb_method_definition_set(me, def, opts); rb_clear_method_cache_by_class(klass);