summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-06-17 15:28:14 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2022-06-23 14:01:46 -0700
commite23540e5666664e23f2adecdc2cc591f3ff6fe2f (patch)
tree3110c9f0fd255be8a2de463aa2dd9ddaa3506c18 /vm_core.h
parent6fd9cb8087c08d46058eb7554585f43953e76131 (diff)
Speed up ISeq by marking via bitmaps and IC rearranging
This commit adds a bitfield to the iseq body that stores offsets inside the iseq buffer that contain values we need to mark. We can use this bitfield to mark objects instead of disassembling the instructions. This commit also groups inline storage entries and adds a counter for each entry. This allows us to iterate and mark each entry without disassembling instructions Since we have a bitfield and grouped inline caches, we can mark all VALUE objects associated with instructions without actually disassembling the instructions at mark time. [Feature #18875] [ruby-core:109042]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6053
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/vm_core.h b/vm_core.h
index 2fca0aecd2..2ae5318607 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -335,6 +335,10 @@ pathobj_realpath(VALUE pathobj)
/* Forward declarations */
struct rb_mjit_unit;
+typedef uintptr_t iseq_bits_t;
+
+#define ISEQ_IS_SIZE(body) (body->ic_size + body->ivc_size + body->ise_size)
+
struct rb_iseq_constant_body {
enum iseq_type {
ISEQ_TYPE_TOP,
@@ -444,7 +448,7 @@ struct rb_iseq_constant_body {
const struct rb_iseq_struct *parent_iseq;
struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */
- union iseq_inline_storage_entry *is_entries;
+ union iseq_inline_storage_entry *is_entries; /* [ TS_(ICVARC|IVC) ... | TS_ISE | TS_IC ] */
struct rb_call_data *call_data; //struct rb_call_data calls[ci_size];
struct {
@@ -456,9 +460,12 @@ struct rb_iseq_constant_body {
} variable;
unsigned int local_table_size;
- unsigned int is_size;
+ unsigned int ic_size; // Number if IC caches
+ unsigned int ise_size; // Number of ISE caches
+ unsigned int ivc_size; // Number of IVC and ICVARC caches
unsigned int ci_size;
unsigned int stack_max; /* for stack overflow check */
+ iseq_bits_t * mark_offset_bits; /* Find references for GC */
char catch_except_p; /* If a frame of this ISeq may catch exception, set TRUE */
// If true, this ISeq is leaf *and* backtraces are not used, for example,