1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

prefixed functions exported for mjit

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-02-17 01:30:05 +00:00
parent 21249d849b
commit def3714be2
4 changed files with 29 additions and 26 deletions

View file

@ -640,8 +640,8 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
} }
MJIT_FUNC_EXPORTED VALUE MJIT_FUNC_EXPORTED VALUE
make_no_method_exception(VALUE exc, VALUE format, VALUE obj, rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
int argc, const VALUE *argv, int priv) int argc, const VALUE *argv, int priv)
{ {
int n = 0; int n = 0;
enum { 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, exc = rb_make_no_method_exception(exc, format, obj, argc, argv,
last_call_status & (MISSING_FCALL|MISSING_VCALL)); last_call_status & (MISSING_FCALL|MISSING_VCALL));
if (!(last_call_status & MISSING_MISSING)) { if (!(last_call_status & MISSING_MISSING)) {
rb_vm_pop_cfunc_frame(); 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); id = rb_check_id(&vid);
if (!id) { if (!id) {
if (rb_method_basic_definition_p(CLASS_OF(recv), idMethodMissing)) { if (rb_method_basic_definition_p(CLASS_OF(recv), idMethodMissing)) {
VALUE exc = make_no_method_exception(rb_eNoMethodError, 0, VALUE exc = rb_make_no_method_exception(rb_eNoMethodError, 0,
recv, argc, argv, recv, argc, argv,
scope != CALL_PUBLIC); scope != CALL_PUBLIC);
rb_exc_raise(exc); rb_exc_raise(exc);
} }
if (!SYMBOL_P(*argv)) { if (!SYMBOL_P(*argv)) {

View file

@ -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); 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 * static const rb_iseq_t *
def_iseq_ptr(rb_method_definition_t *def) 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 (!(ci->mid = rb_check_id(&sym))) {
if (rb_method_basic_definition_p(CLASS_OF(calling->recv), idMethodMissing)) { if (rb_method_basic_definition_p(CLASS_OF(calling->recv), idMethodMissing)) {
VALUE exc = make_no_method_exception(rb_eNoMethodError, 0, calling->recv, VALUE exc =
rb_long2int(calling->argc), &TOPN(i), rb_make_no_method_exception(rb_eNoMethodError, 0, calling->recv,
ci->flag & (VM_CALL_FCALL|VM_CALL_VCALL)); rb_long2int(calling->argc), &TOPN(i),
ci->flag & (VM_CALL_FCALL|VM_CALL_VCALL));
rb_exc_raise(exc); rb_exc_raise(exc);
} }
TOPN(i) = rb_str_intern(sym); 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); RB_OBJ_WRITE(me, &me->def->body.alias.original_me, cme);
} }
else { else {
method_definition_set((rb_method_entry_t *)me, rb_method_definition_t *def =
method_definition_create(VM_METHOD_TYPE_ALIAS, me->def->original_id), rb_method_definition_create(VM_METHOD_TYPE_ALIAS, me->def->original_id);
(void *)cme); rb_method_definition_set((rb_method_entry_t *)me, def, (void *)cme);
} }
} }
else { else {

View file

@ -184,8 +184,12 @@ enum vm_regan_acttype {
#define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state) #define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
#define INC_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, extern rb_method_definition_t *rb_method_definition_create(rb_method_type_t type, ID mid);
int argc, const VALUE *argv, int priv); 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 * static inline struct vm_throw_data *
THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, VALUE st) THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, VALUE st)

View file

@ -224,7 +224,7 @@ setup_method_cfunc_struct(rb_method_cfunc_t *cfunc, VALUE (*func)(), int argc)
} }
MJIT_FUNC_EXPORTED void 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; *(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 * 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; rb_method_definition_t *def;
def = ZALLOC(rb_method_definition_t); 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_FLAGS_COPY(me, src_me);
METHOD_ENTRY_COMPLEMENTED_SET(me); METHOD_ENTRY_COMPLEMENTED_SET(me);
if (!def) { if (!def) {
def = method_definition_create(VM_METHOD_TYPE_REFINED, called_id); def = rb_method_definition_create(VM_METHOD_TYPE_REFINED, called_id);
method_definition_set(me, def, &refined); rb_method_definition_set(me, def, &refined);
} }
VM_ASSERT(RB_TYPE_P(me->owner, T_MODULE)); 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; struct rb_method_entry_struct *orig_me;
VALUE owner; VALUE owner;
} refined; } refined;
rb_method_definition_t *def;
rb_vm_check_redefinition_opt_method(me, me->owner); 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); METHOD_ENTRY_FLAGS_COPY(refined.orig_me, me);
refined.owner = owner; 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); 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 */ /* create method entry */
me = rb_method_entry_create(mid, defined_class, visi, NULL); me = rb_method_entry_create(mid, defined_class, visi, NULL);
if (def == NULL) def = method_definition_create(type, original_id); if (def == NULL) def = rb_method_definition_create(type, original_id);
method_definition_set(me, def, opts); rb_method_definition_set(me, def, opts);
rb_clear_method_cache_by_class(klass); rb_clear_method_cache_by_class(klass);