summaryrefslogtreecommitdiff
path: root/iseq.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 /iseq.h
parent6fd9cb8087c08d46058eb7554585f43953e76131 (diff)
downloadruby-e23540e5666664e23f2adecdc2cc591f3ff6fe2f.tar.gz
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]
Diffstat (limited to 'iseq.h')
-rw-r--r--iseq.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/iseq.h b/iseq.h
index a7d542fa09..46a8b1b010 100644
--- a/iseq.h
+++ b/iseq.h
@@ -17,6 +17,12 @@ RUBY_EXTERN const int ruby_api_version[];
#define ISEQ_MAJOR_VERSION ((unsigned int)ruby_api_version[0])
#define ISEQ_MINOR_VERSION ((unsigned int)ruby_api_version[1])
+#define ISEQ_MBITS_SIZE sizeof(iseq_bits_t)
+#define ISEQ_MBITS_BITLENGTH (ISEQ_MBITS_SIZE * CHAR_BIT)
+#define ISEQ_MBITS_SET(buf, i) (buf[(i) / ISEQ_MBITS_BITLENGTH] |= ((iseq_bits_t)1 << ((i) % ISEQ_MBITS_BITLENGTH)))
+#define ISEQ_MBITS_SET_P(buf, i) ((buf[(i) / ISEQ_MBITS_BITLENGTH] >> ((i) % ISEQ_MBITS_BITLENGTH)) & 0x1)
+#define ISEQ_MBITS_BUFLEN(size) (((size + (ISEQ_MBITS_BITLENGTH - 1)) & -ISEQ_MBITS_BITLENGTH) / ISEQ_MBITS_BITLENGTH)
+
#ifndef USE_ISEQ_NODE_ID
#define USE_ISEQ_NODE_ID 1
#endif