Skip to content

Commit

Permalink
Prevent MJIT compilation from running while moving
Browse files Browse the repository at this point in the history
pointers.

Instead of 4fe908c, just locking the MJIT
worker may be fine for this case. And also we might have the same issue
in all `gc_compact_after_gc` calls.
  • Loading branch information
k0kubun committed May 28, 2019
1 parent 6b5e712 commit 797d7ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gc.c
Expand Up @@ -8272,6 +8272,8 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl
{
if (0) fprintf(stderr, "gc_compact_after_gc: %d,%d,%d\n", use_toward_empty, use_double_pages, use_verifier);

mjit_gc_start_hook(); // prevent MJIT from running while moving pointers related to ISeq

if (use_verifier) {
gc_verify_internal_consistency(Qnil);
}
Expand Down Expand Up @@ -8315,6 +8317,8 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl
(void)moved_list;
#endif

mjit_gc_exit_hook(); // unlock MJIT here, because `rb_gc()` calls `mjit_gc_start_hook()` again.

/* GC after compaction to eliminate T_MOVED */
rb_gc();
}
Expand Down

0 comments on commit 797d7ef

Please sign in to comment.