diff options
author | Peter Zhu <[email protected]> | 2023-04-19 15:59:25 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-05-17 09:19:40 -0400 |
commit | 5199f2aaf9527c97e6ec371e19748d0c2ac7a70e () | |
tree | 752910a6360dbd7f00af1e665e17238cbce96c17 /internal/hash.h | |
parent | 264ba0f89a52c6d0d6425da0cdfb12bbd420c619 (diff) |
Implement Hash AR tables on VWA
Notes: Merged: https://.com/ruby/ruby/pull/7742
-rw-r--r-- | internal/hash.h | 40 |
1 files changed, 6 insertions, 34 deletions
@@ -42,15 +42,14 @@ enum ruby_rhash_flags { struct RHash { struct RBasic basic; - union { - st_table *st; - struct ar_table_struct *ar; /* possibly 0 */ - } as; const VALUE ifnone; union { ar_hint_t ary[RHASH_AR_TABLE_MAX_SIZE]; VALUE word; } ar_hint; }; #define RHASH(obj) ((struct RHash *)(obj)) @@ -86,6 +85,8 @@ int rb_hash_stlike_foreach_with_replace(VALUE hash, st_foreach_check_callback_fu int rb_hash_stlike_update(VALUE hash, st_data_t key, st_update_callback_func *func, st_data_t arg); VALUE rb_ident_hash_new_with_size(st_index_t size); static inline unsigned RHASH_AR_TABLE_SIZE_RAW(VALUE h); static inline VALUE RHASH_IFNONE(VALUE h); static inline size_t RHASH_SIZE(VALUE h); @@ -96,9 +97,6 @@ static inline struct ar_table_struct *RHASH_AR_TABLE(VALUE h); static inline st_table *RHASH_ST_TABLE(VALUE h); static inline size_t RHASH_ST_SIZE(VALUE h); static inline void RHASH_ST_CLEAR(VALUE h); -static inline bool RHASH_TRANSIENT_P(VALUE h); -static inline void RHASH_SET_TRANSIENT_FLAG(VALUE h); -static inline void RHASH_UNSET_TRANSIENT_FLAG(VALUE h); RUBY_SYMBOL_EXPORT_BEGIN /* hash.c (export) */ @@ -128,7 +126,7 @@ RHASH_AR_TABLE_P(VALUE h) static inline struct ar_table_struct * RHASH_AR_TABLE(VALUE h) { - return RHASH(h)->as.ar; } static inline st_table * @@ -187,30 +185,4 @@ RHASH_AR_TABLE_SIZE_RAW(VALUE h) return (unsigned)ret; } -static inline bool -RHASH_TRANSIENT_P(VALUE h) -{ -#if USE_TRANSIENT_HEAP - return FL_TEST_RAW(h, RHASH_TRANSIENT_FLAG); -#else - return false; -#endif -} - -static inline void -RHASH_SET_TRANSIENT_FLAG(VALUE h) -{ -#if USE_TRANSIENT_HEAP - FL_SET_RAW(h, RHASH_TRANSIENT_FLAG); -#endif -} - -static inline void -RHASH_UNSET_TRANSIENT_FLAG(VALUE h) -{ -#if USE_TRANSIENT_HEAP - FL_UNSET_RAW(h, RHASH_TRANSIENT_FLAG); -#endif -} - #endif /* INTERNAL_HASH_H */ |