From f6661f50854e0cdccb03ee516a21ce62adf6c802 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 16 Oct 2020 15:20:40 +0900 Subject: sync RClass::ext::iv_index_tbl iv_index_tbl manages instance variable indexes (ID -> index). This data structure should be synchronized with other ractors so introduce some VM locks. This patch also introduced atomic ivar cache used by set/getinlinecache instructions. To make updating ivar cache (IVC), we changed iv_index_tbl data structure to manage (ID -> entry) and an entry points serial and index. IVC points to this entry so that cache update becomes atomically. --- internal/class.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/class.h b/internal/class.h index bb12825162..eade920ff0 100644 --- a/internal/class.h +++ b/internal/class.h @@ -25,8 +25,14 @@ struct rb_subclass_entry { struct rb_subclass_entry *next; }; +struct rb_iv_index_tbl_entry { + uint32_t index; + rb_serial_t class_serial; + VALUE class_value; +}; + struct rb_classext_struct { - struct st_table *iv_index_tbl; + struct st_table *iv_index_tbl; // ID -> struct rb_iv_index_tbl_entry struct st_table *iv_tbl; #if SIZEOF_SERIAL_T == SIZEOF_VALUE /* otherwise m_tbl is in struct RClass */ struct rb_id_table *m_tbl; -- cgit v1.2.3