summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-06-15 21:58:00 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2022-06-15 21:58:00 -0700
commit66f0ce34f12ed710c97aad30b083017c73f399ad (patch)
tree9d8e0531030028b7bb9d146ec164f019ff7432b3 /mjit.c
parent1ffc6c43f696fc18f1d3b52b09a2ef0dd00ac09c (diff)
MJIT: Get rid of obsoleted compiling_iseqs
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/mjit.c b/mjit.c
index 043bb34c32..9531172a66 100644
--- a/mjit.c
+++ b/mjit.c
@@ -1050,11 +1050,8 @@ mjit_finish(bool close_handle_p)
// Called by rb_vm_mark().
//
-// Mark an ISeq being compiled to prevent its CCs from being GC-ed, which
-// an MJIT worker may concurrently see.
-//
-// Also mark active_units so that we do not GC ISeq which may still be
-// referred to by mjit_recompile() or compact_all_jit_code().
+// Mark active_units so that we do not GC ISeq which may still be
+// referenced by mjit_recompile() or mjit_compact().
void
mjit_mark(void)
{
@@ -1062,36 +1059,9 @@ mjit_mark(void)
return;
RUBY_MARK_ENTER("mjit");
- // We need to release a lock when calling rb_gc_mark to avoid doubly acquiring
- // a lock by by mjit_gc_start_hook inside rb_gc_mark.
- //
- // Because an MJIT worker may modify active_units anytime, we need to convert
- // the linked list to an array to safely loop its ISeqs without keeping a lock.
- int length = 0;
- if (compiling_iseqs != NULL) {
- while (compiling_iseqs[length]) length++;
- }
- length += active_units.length;
- const rb_iseq_t **iseqs = ALLOCA_N(const rb_iseq_t *, length);
-
struct rb_mjit_unit *unit = NULL;
- int i = 0;
- if (compiling_iseqs != NULL) {
- while (compiling_iseqs[i]) {
- iseqs[i] = compiling_iseqs[i];
- i++;
- }
- }
ccan_list_for_each(&active_units.head, unit, unode) {
- iseqs[i] = unit->iseq;
- i++;
- }
- assert(i == length);
-
- for (i = 0; i < length; i++) {
- if (iseqs[i] == NULL) // ISeq is GC-ed
- continue;
- rb_gc_mark((VALUE)iseqs[i]);
+ rb_gc_mark((VALUE)unit->iseq);
}
RUBY_MARK_LEAVE("mjit");