Skip to content

Commit

Permalink
reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Apr 19, 2024
1 parent 8763508 commit 93c71fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions imemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ rb_imemo_mark_and_move(VALUE obj, bool reference_updating)
}
}
else {
if (vm_cc_orphan_p(cc) || vm_cc_refinement_p(cc)) {
if (vm_cc_super_p(cc) || vm_cc_refinement_p(cc)) {
rb_gc_mark_movable((VALUE)cc->cme_);
rb_gc_mark_movable((VALUE)cc->klass);
}
Expand Down Expand Up @@ -471,7 +471,7 @@ vm_ccs_free(struct rb_class_cc_entries *ccs, int alive, VALUE klass)
}
}

VM_ASSERT(!vm_cc_orphan_p(cc) && !vm_cc_refinement_p(cc));
VM_ASSERT(!vm_cc_super_p(cc) && !vm_cc_refinement_p(cc));
vm_cc_invalidate(cc);
}
ruby_xfree(ccs->entries);
Expand Down
12 changes: 6 additions & 6 deletions vm_callinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ struct rb_callcache {
/* VM_CALLCACHE_IVAR used for IVAR/ATTRSET/STRUCT_AREF/STRUCT_ASET methods */
#define VM_CALLCACHE_IVAR IMEMO_FL_USER0
#define VM_CALLCACHE_BF IMEMO_FL_USER1
#define VM_CALLCACHE_ORPHAN IMEMO_FL_USER2
#define VM_CALLCACHE_SUPER IMEMO_FL_USER2
#define VM_CALLCACHE_REFINEMENT IMEMO_FL_USER3

enum vm_cc_type {
cc_type_normal, // chained from ccs
cc_type_orphan,
cc_type_super,
cc_type_refinement,
};

Expand Down Expand Up @@ -346,8 +346,8 @@ vm_cc_new(VALUE klass,
switch (type) {
case cc_type_normal:
break;
case cc_type_orphan:
*(VALUE *)&cc->flags |= VM_CALLCACHE_ORPHAN;
case cc_type_super:
*(VALUE *)&cc->flags |= VM_CALLCACHE_SUPER;
break;
case cc_type_refinement:
*(VALUE *)&cc->flags |= VM_CALLCACHE_REFINEMENT;
Expand All @@ -360,9 +360,9 @@ vm_cc_new(VALUE klass,
}

static inline bool
vm_cc_orphan_p(const struct rb_callcache *cc)
vm_cc_super_p(const struct rb_callcache *cc)
{
return (cc->flags & VM_CALLCACHE_ORPHAN) != 0;
return (cc->flags & VM_CALLCACHE_SUPER) != 0;
}

static inline bool
Expand Down
6 changes: 3 additions & 3 deletions vm_insnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ vm_ccs_verify(struct rb_class_cc_entries *ccs, ID mid, VALUE klass)
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
VM_ASSERT(vm_cc_class_check(cc, klass));
VM_ASSERT(vm_cc_check_cme(cc, ccs->cme));
VM_ASSERT(!vm_cc_orphan_p(cc));
VM_ASSERT(!vm_cc_super_p(cc));
VM_ASSERT(!vm_cc_refinement_p(cc));
}
return TRUE;
Expand Down Expand Up @@ -4951,7 +4951,7 @@ vm_search_super_method(const rb_control_frame_t *reg_cfp, struct rb_call_data *c

if (!klass) {
/* bound instance method of module */
cc = vm_cc_new(klass, NULL, vm_call_method_missing, cc_type_orphan);
cc = vm_cc_new(klass, NULL, vm_call_method_missing, cc_type_super);
RB_OBJ_WRITE(reg_cfp->iseq, &cd->cc, cc);
}
else {
Expand All @@ -4966,7 +4966,7 @@ vm_search_super_method(const rb_control_frame_t *reg_cfp, struct rb_call_data *c
else if (cached_cme->called_id != mid) {
const rb_callable_method_entry_t *cme = rb_callable_method_entry(klass, mid);
if (cme) {
cc = vm_cc_new(klass, cme, vm_call_super_method, cc_type_orphan);
cc = vm_cc_new(klass, cme, vm_call_super_method, cc_type_super);
RB_OBJ_WRITE(reg_cfp->iseq, &cd->cc, cc);
}
else {
Expand Down

0 comments on commit 93c71fe

Please sign in to comment.