summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-04-19 16:16:27 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-05-17 09:19:40 -0400
commitcea9c30fa549885e36471f1782359df2bdcf895a (patch)
treeb004d05c75af965c0bd4202f3ddcbe0b04de895c /internal
parent0938964ba1af3924cf969fb809fc3598892bc20d (diff)
downloadruby-cea9c30fa549885e36471f1782359df2bdcf895a.tar.gz
Move ar_hint to ar_table_struct
This allows Hashes with ST tables to fit int he 80 byte size pool.
Diffstat (limited to 'internal')
-rw-r--r--internal/hash.h14
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