summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gc.c10
-rw-r--r--internal/gc.h9
2 files changed, 7 insertions, 12 deletions
diff --git a/gc.c b/gc.c
index ed05c3f3e4..8c360b485d 100644
--- a/gc.c
+++ b/gc.c
@@ -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;