Skip to content

Commit c6f4a4b

Browse files
authored
Merge pull request #63 from ruby/write-barrier-check-not-t-none
Assert that objects are not T_NONE in the write barrier
2 parents 489a136 + 59d2720 commit c6f4a4b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

gc/mmtk/mmtk.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ RB_THREAD_LOCAL_SPECIFIER VALUE marking_parent_object;
8383
# error We currently need language-supported TLS
8484
#endif
8585

86+
#ifdef MMTK_DEBUG
87+
# define MMTK_ASSERT(expr, ...) RUBY_ASSERT_ALWAYS(expr, #expr RBIMPL_VA_OPT_ARGS(__VA_ARGS__))
88+
#else
89+
# define MMTK_ASSERT(expr, ...) ((void)0)
90+
#endif
91+
8692
#include <pthread.h>
8793

8894
static void
@@ -975,6 +981,9 @@ rb_gc_impl_writebarrier(void *objspace_ptr, VALUE a, VALUE b)
975981
}
976982
#endif
977983

984+
MMTK_ASSERT(BUILTIN_TYPE(a) != T_NONE);
985+
MMTK_ASSERT(BUILTIN_TYPE(b) != T_NONE);
986+
978987
mmtk_object_reference_write_post(cache->mutator, (MMTk_ObjectReference)a);
979988
}
980989

0 commit comments

Comments
 (0)