Skip to content

Commit 6942771

Browse files
tenderloveKaanOzkan
authored andcommitted
WIP trying to debug make test-all TESTS=test/ruby/test_gc_compact.rb TESTOPTS='-n /moving_arrays_up/'
1 parent 9ec1092 commit 6942771

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

gc/default/default.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static ruby_gc_params_t gc_params = {
214214
* enable to embed GC debugging information.
215215
*/
216216
#ifndef GC_DEBUG
217-
#define GC_DEBUG 0
217+
#define GC_DEBUG 1
218218
#endif
219219

220220
/* RGENGC_DEBUG:
@@ -1363,6 +1363,8 @@ static inline void
13631363
RVALUE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, VALUE obj)
13641364
{
13651365
RB_DEBUG_COUNTER_INC(obj_promote);
1366+
GC_ASSERT(!RB_TYPE_P(obj, T_NONE));
1367+
GC_ASSERT(!RB_TYPE_P(obj, T_MOVED));
13661368
RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(objspace, GET_HEAP_PAGE(obj), obj);
13671369
}
13681370

@@ -5931,6 +5933,9 @@ rgengc_rememberset_mark_plane(rb_objspace_t *objspace, uintptr_t p, bits_t bitse
59315933
if (bitset & 1) {
59325934
VALUE obj = (VALUE)p;
59335935
gc_report(2, objspace, "rgengc_rememberset_mark: mark %s\n", rb_obj_info(obj));
5936+
if (!RVALUE_UNCOLLECTIBLE(objspace, obj)) {
5937+
fprintf(stderr, "addr %p\n", (void *)obj);
5938+
}
59345939
GC_ASSERT(RVALUE_UNCOLLECTIBLE(objspace, obj));
59355940
GC_ASSERT(RVALUE_OLD_P(objspace, obj) || RVALUE_WB_UNPROTECTED(objspace, obj));
59365941

@@ -6077,6 +6082,17 @@ rb_gc_impl_writebarrier(void *objspace_ptr, VALUE a, VALUE b)
60776082
{
60786083
rb_objspace_t *objspace = objspace_ptr;
60796084

6085+
GC_ASSERT(!RB_TYPE_P(a, T_NONE));
6086+
GC_ASSERT(!RB_TYPE_P(b, T_NONE));
6087+
GC_ASSERT(!RB_TYPE_P(a, T_MOVED));
6088+
GC_ASSERT(!RB_TYPE_P(b, T_MOVED));
6089+
if (RB_TYPE_P(a, T_HASH)) {
6090+
fprintf(stderr, "adding hash to RS %p\n", (void *)a);
6091+
}
6092+
if (RB_TYPE_P(b, T_HASH)) {
6093+
fprintf(stderr, "adding hash to RS %p\n", (void *)b);
6094+
}
6095+
60806096
if (RGENGC_CHECK_MODE) {
60816097
if (SPECIAL_CONST_P(a)) rb_bug("rb_gc_writebarrier: a is special const: %"PRIxVALUE, a);
60826098
if (SPECIAL_CONST_P(b)) rb_bug("rb_gc_writebarrier: b is special const: %"PRIxVALUE, b);
@@ -6938,6 +6954,8 @@ gc_move(rb_objspace_t *objspace, VALUE src, VALUE dest, size_t src_slot_size, si
69386954
int uncollectible;
69396955
int age;
69406956

6957+
struct rvalue_overhead * info = GET_RVALUE_OVERHEAD(src);
6958+
fprintf(stderr, "Moving object: %p -> %p %s %s:%d\n", (void *)src, (void *)dest, rb_obj_info(src), info->file, info->line);
69416959
gc_report(4, objspace, "Moving object: %p -> %p\n", (void *)src, (void *)dest);
69426960

69436961
GC_ASSERT(BUILTIN_TYPE(src) != T_NONE);
@@ -7015,6 +7033,8 @@ gc_move(rb_objspace_t *objspace, VALUE src, VALUE dest, size_t src_slot_size, si
70157033
}
70167034

70177035
if (uncollectible) {
7036+
GC_ASSERT(!RB_TYPE_P(dest, T_NONE));
7037+
GC_ASSERT(!RB_TYPE_P(dest, T_MOVED));
70187038
MARK_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(dest), dest);
70197039
}
70207040
else {

vm_insnhelper.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6051,9 +6051,11 @@ vm_invokeblock_fastpath(struct rb_execution_context_struct *ec,
60516051
}
60526052

60536053
cd->cc = ret;
6054+
//vm_ccs_push((VALUE)callee_iseq, ISEQ_BODY(callee_iseq)->block_ccs, ci, ret);
60546055
RB_OBJ_WRITTEN(reg_cfp->iseq, Qundef, ret);
6055-
vm_ccs_push((VALUE)callee_iseq, ISEQ_BODY(callee_iseq)->block_ccs, ci, ret);
60566056
RUBY_ASSERT(ret->klass == (VALUE)callee_iseq);
6057+
fprintf(stderr, "ret %p iseq %p\n", (void *)ret, (void *)callee_iseq);
6058+
RB_GC_GUARD(ret);
60576059
}
60586060
else {
60596061
/*

0 commit comments

Comments
 (0)