summaryrefslogtreecommitdiff
path: root/imemo.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-07-30 16:51:59 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-08-01 10:42:04 +0200
commit547f111b5b0d773af2a4268fe407fdacc7060109 (patch)
tree23d9c77e2bdc54e29cf2cff352e8226c4776d20a /imemo.c
parentf2a7e48deadb9101d49c9b613abf5a83c9e1dd49 (diff)
Refactor `vm_lookup_cc` to allow lock-free lookups in `RClass.cc_tbl`
In multi-ractor mode, the `cc_tbl` mutations use the RCU pattern, which allow lock-less reads. Based on the assumption that invalidations and misses should be increasingly rare as the process ages, locking on modification isn't a big concern.
Diffstat (limited to 'imemo.c')
-rw-r--r--imemo.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/imemo.c b/imemo.c
index a7d0b84c56..7298d78d65 100644
--- a/imemo.c
+++ b/imemo.c
@@ -515,41 +515,6 @@ rb_free_const_table(struct rb_id_table *tbl)
rb_id_table_free(tbl);
}
-// alive: if false, target pointers can be freed already.
-static void
-vm_ccs_free(struct rb_class_cc_entries *ccs, int alive, VALUE klass)
-{
- if (ccs->entries) {
- for (int i=0; i<ccs->len; i++) {
- const struct rb_callcache *cc = ccs->entries[i].cc;
- if (!alive) {
- // ccs can be free'ed.
- if (rb_gc_pointer_to_heap_p((VALUE)cc) &&
- !rb_objspace_garbage_object_p((VALUE)cc) &&
- IMEMO_TYPE_P(cc, imemo_callcache) &&
- cc->klass == klass) {
- // OK. maybe target cc.
- }
- else {
- continue;
- }
- }
-
- VM_ASSERT(!vm_cc_super_p(cc) && !vm_cc_refinement_p(cc));
- vm_cc_invalidate(cc);
- }
- ruby_xfree(ccs->entries);
- }
- ruby_xfree(ccs);
-}
-
-void
-rb_vm_ccs_free(struct rb_class_cc_entries *ccs)
-{
- RB_DEBUG_COUNTER_INC(ccs_free);
- vm_ccs_free(ccs, true, Qundef);
-}
-
static inline void
imemo_fields_free(struct rb_fields *fields)
{