Enable 5 size pools on 32 bit systems

This commit will allow 32 bit systems to take advantage of VWA.
This commit is contained in:
Peter Zhu 2023-04-11 09:16:52 -04:00
parent 7297374c5e
commit b4571097df
Notes: git 2023-04-11 15:25:36 +00:00
2 changed files with 7 additions and 12 deletions

10
gc.c
View File

@ -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 {

View File

@ -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;