diff options
author | Peter Zhu <[email protected]> | 2023-04-11 09:16:52 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-04-11 11:25:12 -0400 |
commit | b4571097df4a6bd848f1195026d82a92f3a7f9d8 (patch) | |
tree | 628a1ca1c063d9a634b7d8d3a69b9820c0c06a80 | |
parent | 7297374c5e3dc2b66ee55d918b3f933e78dd23fd (diff) |
Enable 5 size pools on 32 bit systems
This commit will allow 32 bit systems to take advantage of VWA.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7688
-rw-r--r-- | gc.c | 10 | ||||
-rw-r--r-- | internal/gc.h | 9 |
2 files changed, 7 insertions, 12 deletions
@@ -2824,9 +2824,6 @@ newobj_slowpath(VALUE klass, VALUE flags, rb_objspace_t *objspace, rb_ractor_t * } obj = newobj_alloc(objspace, cr, size_pool_idx, true); -#if SHAPE_IN_BASIC_FLAGS - flags |= (VALUE)(size_pool_idx) << SHAPE_FLAG_SHIFT; -#endif newobj_init(klass, flags, wb_protected, objspace, obj); gc_event_hook_prep(objspace, RUBY_INTERNAL_EVENT_NEWOBJ, obj, newobj_zero_slot(obj)); @@ -2873,14 +2870,15 @@ newobj_of0(VALUE klass, VALUE flags, int wb_protected, rb_ractor_t *cr, size_t a size_t size_pool_idx = size_pool_idx_for_size(alloc_size); + if (SHAPE_IN_BASIC_FLAGS || (flags & RUBY_T_MASK) == T_OBJECT) { + flags |= (VALUE)size_pool_idx << SHAPE_FLAG_SHIFT; + } + if (!UNLIKELY(during_gc || ruby_gc_stressful || gc_event_hook_available_p(objspace)) && wb_protected) { obj = newobj_alloc(objspace, cr, size_pool_idx, false); -#if SHAPE_IN_BASIC_FLAGS - flags |= (VALUE)size_pool_idx << SHAPE_FLAG_SHIFT; -#endif newobj_init(klass, flags, wb_protected, objspace, obj); } else { diff --git a/internal/gc.h b/internal/gc.h index 86f3f4ae17..bb0f8016fb 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -186,14 +186,11 @@ struct rb_objspace; /* in vm_core.h */ // We use SIZE_POOL_COUNT number of shape IDs for transitions out of different size pools // The next available shape ID will be the SPECIAL_CONST_SHAPE_ID #ifndef SIZE_POOL_COUNT -# if (SIZEOF_UINT64_T == SIZEOF_VALUE) -# define SIZE_POOL_COUNT 5 -# else -# define SIZE_POOL_COUNT 1 -# endif +# define SIZE_POOL_COUNT 5 #endif -#define RCLASS_EXT_EMBEDDED (SIZE_POOL_COUNT > 1) +// TODO: Make rb_classext_t small enough to fit in 80 bytes on 32 bit +#define RCLASS_EXT_EMBEDDED (SIZEOF_UINT64_T == SIZEOF_VALUE) typedef struct ractor_newobj_size_pool_cache { struct RVALUE *freelist; |