mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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]
This commit is contained in:
parent
6fd9cb8087
commit
e23540e566
Notes:
git
2022-06-24 06:02:07 +09:00
5 changed files with 172 additions and 39 deletions
6
iseq.h
6
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue