diff options
author | Peter Zhu <[email protected]> | 2023-04-19 16:16:27 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-05-17 09:19:40 -0400 |
commit | cea9c30fa549885e36471f1782359df2bdcf895a (patch) | |
tree | b004d05c75af965c0bd4202f3ddcbe0b04de895c /internal/hash.h | |
parent | 0938964ba1af3924cf969fb809fc3598892bc20d (diff) |
Move ar_hint to ar_table_struct
This allows Hashes with ST tables to fit int he 80 byte size pool.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7742
Diffstat (limited to 'internal/hash.h')
-rw-r--r-- | internal/hash.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/internal/hash.h b/internal/hash.h index c9a8b49c20..248a53429d 100644 --- a/internal/hash.h +++ b/internal/hash.h @@ -46,6 +46,10 @@ typedef struct ar_table_pair_struct { } ar_table_pair; typedef struct ar_table_struct { + union { + ar_hint_t ary[RHASH_AR_TABLE_MAX_SIZE]; + VALUE word; + } ar_hint; /* 64bit CPU: 8B * 2 * 8 = 128B */ ar_table_pair pairs[RHASH_AR_TABLE_MAX_SIZE]; } ar_table; @@ -53,20 +57,10 @@ typedef struct ar_table_struct { struct RHash { struct RBasic basic; const VALUE ifnone; - union { - ar_hint_t ary[RHASH_AR_TABLE_MAX_SIZE]; - VALUE word; - } ar_hint; }; #define RHASH(obj) ((struct RHash *)(obj)) -#ifndef MAX -# define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif - -#define RHASH_SLOT_SIZE (sizeof(struct RHash) + MAX(sizeof(ar_table), sizeof(st_table))) - #ifdef RHASH_IFNONE # undef RHASH_IFNONE #endif |