@@ -72,6 +72,8 @@ struct MMTk_final_job {
7272
7373#ifdef RB_THREAD_LOCAL_SPECIFIER
7474RB_THREAD_LOCAL_SPECIFIER struct MMTk_GCThreadTLS * rb_mmtk_gc_thread_tls ;
75+
76+ RB_THREAD_LOCAL_SPECIFIER VALUE marking_parent_object ;
7577#else
7678# error We currently need language-supported TLS
7779#endif
@@ -270,26 +272,34 @@ rb_mmtk_update_object_references(MMTk_ObjectReference mmtk_object)
270272 VALUE object = (VALUE )mmtk_object ;
271273
272274 if (!RB_FL_TEST (object , RUBY_FL_WEAK_REFERENCE )) {
275+ marking_parent_object = object ;
273276 rb_gc_update_object_references (rb_gc_get_objspace (), object );
277+ marking_parent_object = 0 ;
274278 }
275279}
276280
277281static void
278282rb_mmtk_call_gc_mark_children (MMTk_ObjectReference object )
279283{
284+ marking_parent_object = (VALUE )object ;
280285 rb_gc_mark_children (rb_gc_get_objspace (), (VALUE )object );
286+ marking_parent_object = 0 ;
281287}
282288
283289static void
284290rb_mmtk_handle_weak_references (MMTk_ObjectReference mmtk_object , bool moving )
285291{
286292 VALUE object = (VALUE )mmtk_object ;
287293
294+ marking_parent_object = object ;
295+
288296 rb_gc_handle_weak_references (object );
289297
290298 if (moving ) {
291299 rb_gc_update_object_references (rb_gc_get_objspace (), object );
292300 }
301+
302+ marking_parent_object = 0 ;
293303}
294304
295305static void
@@ -797,6 +807,17 @@ void rb_gc_impl_adjust_memory_usage(void *objspace_ptr, ssize_t diff) { }
797807static inline VALUE
798808rb_mmtk_call_object_closure (VALUE obj , bool pin )
799809{
810+ if (RB_UNLIKELY (RB_BUILTIN_TYPE (obj ) == T_NONE )) {
811+ const size_t info_size = 256 ;
812+ char obj_info_buf [info_size ];
813+ rb_raw_obj_info (obj_info_buf , info_size , obj );
814+
815+ char parent_obj_info_buf [info_size ];
816+ rb_raw_obj_info (parent_obj_info_buf , info_size , marking_parent_object );
817+
818+ rb_bug ("try to mark T_NONE object (obj: %s, parent: %s)" , obj_info_buf , parent_obj_info_buf );
819+ }
820+
800821 return (VALUE )rb_mmtk_gc_thread_tls -> object_closure .c_function (
801822 rb_mmtk_gc_thread_tls -> object_closure .rust_closure ,
802823 rb_mmtk_gc_thread_tls -> gc_context ,
0 commit comments