ruby-changes:64768
From: Koichi <ko1@a...>
Date: Wed, 6 Jan 2021 14:58:11 +0900 (JST)
Subject: [ruby-changes:64768] 954d6c7432 (master): remove invalidated cc
https://git.ruby-lang.org/ruby.git/commit/?id=954d6c7432 From 954d6c743219c11c84dd107d059001752f186a27 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Wed, 6 Jan 2021 13:06:25 +0900 Subject: remove invalidated cc if cc is invalidated, cc should be released from iseq. diff --git a/iseq.c b/iseq.c index 096d456..2d83bc3 100644 --- a/iseq.c +++ b/iseq.c @@ -359,8 +359,12 @@ rb_iseq_mark(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L359 rb_gc_mark_movable((VALUE)ci); } if (cc && vm_cc_markable(cc)) { - rb_gc_mark_movable((VALUE)cc); - // TODO: check enable + if (!vm_cc_invalidated_p(cc)) { + rb_gc_mark_movable((VALUE)cc); + } + else { + cds[i].cc = rb_vm_empty_cc(); + } } } } diff --git a/vm_callinfo.h b/vm_callinfo.h index 4ee6fa7..1fe76eb 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -357,6 +357,17 @@ vm_cc_markable(const struct rb_callcache *cc) https://github.com/ruby/ruby/blob/trunk/vm_callinfo.h#L357 return FL_TEST_RAW((VALUE)cc, VM_CALLCACHE_UNMARKABLE) == 0; } +static inline bool +vm_cc_invalidated_p(const struct rb_callcache *cc) +{ + if (cc->klass && METHOD_ENTRY_INVALIDATED(vm_cc_cme(cc))) { + return false; + } + else { + return true; + } +} + // For MJIT. cc_cme is supposed to have inlined `vm_cc_cme(cc)`. static inline bool vm_cc_valid_p(const struct rb_callcache *cc, const rb_callable_method_entry_t *cc_cme, VALUE klass) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/