diff options
author | Aaron Patterson <[email protected]> | 2022-06-17 15:28:14 -0700 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2022-06-23 14:01:46 -0700 |
commit | e23540e5666664e23f2adecdc2cc591f3ff6fe2f (patch) | |
tree | 3110c9f0fd255be8a2de463aa2dd9ddaa3506c18 /iseq.h | |
parent | 6fd9cb8087c08d46058eb7554585f43953e76131 (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 'iseq.h')
-rw-r--r-- | iseq.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |