Skip to content

Commit b457109

Browse files
committed
Enable 5 size pools on 32 bit systems
This commit will allow 32 bit systems to take advantage of VWA.
1 parent 7297374 commit b457109

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

gc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,9 +2824,6 @@ newobj_slowpath(VALUE klass, VALUE flags, rb_objspace_t *objspace, rb_ractor_t *
28242824
}
28252825

28262826
obj = newobj_alloc(objspace, cr, size_pool_idx, true);
2827-
#if SHAPE_IN_BASIC_FLAGS
2828-
flags |= (VALUE)(size_pool_idx) << SHAPE_FLAG_SHIFT;
2829-
#endif
28302827
newobj_init(klass, flags, wb_protected, objspace, obj);
28312828

28322829
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
28732870

28742871
size_t size_pool_idx = size_pool_idx_for_size(alloc_size);
28752872

2873+
if (SHAPE_IN_BASIC_FLAGS || (flags & RUBY_T_MASK) == T_OBJECT) {
2874+
flags |= (VALUE)size_pool_idx << SHAPE_FLAG_SHIFT;
2875+
}
2876+
28762877
if (!UNLIKELY(during_gc ||
28772878
ruby_gc_stressful ||
28782879
gc_event_hook_available_p(objspace)) &&
28792880
wb_protected) {
28802881
obj = newobj_alloc(objspace, cr, size_pool_idx, false);
2881-
#if SHAPE_IN_BASIC_FLAGS
2882-
flags |= (VALUE)size_pool_idx << SHAPE_FLAG_SHIFT;
2883-
#endif
28842882
newobj_init(klass, flags, wb_protected, objspace, obj);
28852883
}
28862884
else {

internal/gc.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,11 @@ struct rb_objspace; /* in vm_core.h */
186186
// We use SIZE_POOL_COUNT number of shape IDs for transitions out of different size pools
187187
// The next available shape ID will be the SPECIAL_CONST_SHAPE_ID
188188
#ifndef SIZE_POOL_COUNT
189-
# if (SIZEOF_UINT64_T == SIZEOF_VALUE)
190-
# define SIZE_POOL_COUNT 5
191-
# else
192-
# define SIZE_POOL_COUNT 1
193-
# endif
189+
# define SIZE_POOL_COUNT 5
194190
#endif
195191

196-
#define RCLASS_EXT_EMBEDDED (SIZE_POOL_COUNT > 1)
192+
// TODO: Make rb_classext_t small enough to fit in 80 bytes on 32 bit
193+
#define RCLASS_EXT_EMBEDDED (SIZEOF_UINT64_T == SIZEOF_VALUE)
197194

198195
typedef struct ractor_newobj_size_pool_cache {
199196
struct RVALUE *freelist;

0 commit comments

Comments
 (0)