File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -310,14 +310,26 @@ rb_iseq_mark_and_update(rb_iseq_t *iseq, bool reference_updating)
310310
311311 if (cds [i ].ci ) rb_gc_mark_and_move_ptr (& cds [i ].ci );
312312
313- if (cds [i ].cc && (reference_updating || vm_cc_markable (cds [i ].cc ))) {
314- VM_ASSERT (reference_updating || (cds [i ].cc -> flags & VM_CALLCACHE_ON_STACK ) == 0 );
315-
316- if (reference_updating || !vm_cc_invalidated_p (cds [i ].cc )) {
317- rb_gc_mark_and_move_ptr (& cds [i ].cc );
313+ const struct rb_callcache * cc = cds [i ].cc ;
314+ if (cc ) {
315+ if (reference_updating ) {
316+ cc = (const struct rb_callcache * )rb_gc_location ((VALUE )cc );
318317 }
319- else {
320- cds [i ].cc = rb_vm_empty_cc ();
318+
319+ if (vm_cc_markable (cc )) {
320+ VM_ASSERT ((cc -> flags & VM_CALLCACHE_ON_STACK ) == 0 );
321+
322+ const struct rb_callable_method_entry_struct * cme = vm_cc_cme (cc );
323+ if (reference_updating ) {
324+ cme = (const struct rb_callable_method_entry_struct * )rb_gc_location ((VALUE )cme );
325+ }
326+
327+ if (cc -> klass && !METHOD_ENTRY_INVALIDATED (cme )) {
328+ rb_gc_mark_and_move_ptr (& cds [i ].cc );
329+ }
330+ else {
331+ cds [i ].cc = rb_vm_empty_cc ();
332+ }
321333 }
322334 }
323335 }
You can’t perform that action at this time.
0 commit comments