Skip to content

Commit b96d8be

Browse files
committed
WIP
1 parent 5e6d221 commit b96d8be

4 files changed

Lines changed: 18 additions & 12 deletions

File tree

gc/default/default.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5461,7 +5461,12 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, VALUE src)
54615461
uint32_t orig_shape, new_shape;
54625462
VALUE dest = rb_gc_impl_location(objspace, src);
54635463

5464-
new_shape = orig_shape = rb_gc_get_shape(src);
5464+
if (RB_TYPE_P(src, T_IMEMO)) {
5465+
new_shape = orig_shape = 0;
5466+
}
5467+
else {
5468+
new_shape = orig_shape = rb_gc_get_shape(src);
5469+
}
54655470

54665471
if (RB_TYPE_P(src, T_OBJECT)) {
54675472
if (dest_pool != heap) {
@@ -5470,14 +5475,6 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, VALUE src)
54705475
}
54715476
}
54725477

5473-
if (FL_TEST_RAW(src, RUBY_FL_ADDRESS_SEEN) && !rb_shape_has_old_address(new_shape)) {
5474-
DURING_GC_COULD_MALLOC_REGION_START();
5475-
{
5476-
rb_obj_field_set(dest, rb_shape_transition_old_address(new_shape), 0, src);
5477-
}
5478-
DURING_GC_COULD_MALLOC_REGION_END();
5479-
}
5480-
54815478
while (!try_move(objspace, dest_pool, dest_pool->free_pages, src)) {
54825479
struct gc_sweep_context ctx = {
54835480
.page = dest_pool->sweeping_page,
@@ -5503,6 +5500,15 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, VALUE src)
55035500
}
55045501
}
55055502

5503+
if (FL_TEST_RAW(dest, RUBY_FL_ADDRESS_SEEN) && !rb_shape_has_old_address(new_shape)) {
5504+
DURING_GC_COULD_MALLOC_REGION_START();
5505+
{
5506+
new_shape = rb_shape_transition_old_address(new_shape);
5507+
rb_obj_field_set(dest, new_shape, 0, src);
5508+
}
5509+
DURING_GC_COULD_MALLOC_REGION_END();
5510+
}
5511+
55065512
if (new_shape != orig_shape) {
55075513
rb_gc_set_shape(dest, new_shape);
55085514
}
@@ -6168,6 +6174,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
61686174
if (RVALUE_MARKED(objspace, obj)) SET_ENTRY(marked, Qtrue);
61696175
if (RVALUE_PINNED(objspace, obj)) SET_ENTRY(pinned, Qtrue);
61706176
if (rb_obj_id_p(obj)) SET_ENTRY(object_id, rb_obj_id(obj));
6177+
if (FL_TEST_RAW(obj, RUBY_FL_ADDRESS_SEEN)) SET_ENTRY(address_seen, Qtrue);
61716178
if (FL_TEST(obj, FL_SHAREABLE)) SET_ENTRY(shareable, Qtrue);
61726179

61736180
object_metadata_entries[n].name = 0;

gc/mmtk/mmtk.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,6 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
12211221
} while (0)
12221222

12231223
if (rb_obj_id_p(obj)) SET_ENTRY(object_id, rb_obj_id(obj));
1224-
if (FL_TEST_RAW(obj, RUBY_FL_ADDRESS_SEEN)) SET_ENTRY(address_seen, Qtrue)
12251224

12261225
object_metadata_entries[n].name = 0;
12271226
object_metadata_entries[n].val = 0;

shape.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ rb_shape_object_id(shape_id_t original_shape_id)
760760
shape_id_t
761761
rb_shape_old_address(shape_id_t original_shape_id)
762762
{
763-
RUBY_ASSERT(rb_shape_has_object_id(original_shape_id));
763+
RUBY_ASSERT(rb_shape_has_old_address(original_shape_id));
764764

765765
rb_shape_t *shape = RSHAPE(original_shape_id);
766766
while (shape->type != SHAPE_OLD_ADDRESS) {

variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ VALUE
12691269
rb_obj_field_get(VALUE obj, shape_id_t target_shape_id)
12701270
{
12711271
RUBY_ASSERT(!SPECIAL_CONST_P(obj));
1272-
RUBY_ASSERT(RSHAPE_TYPE_P(target_shape_id, SHAPE_IVAR) || RSHAPE_TYPE_P(target_shape_id, SHAPE_OBJ_ID));
1272+
RUBY_ASSERT(RSHAPE_EDGE_NAME(target_shape_id));
12731273

12741274
if (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE) {
12751275
ASSERT_vm_locking();

0 commit comments

Comments
 (0)