summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2022-12-23 17:39:44 -0800
committerTakashi Kokubun <[email protected]>2023-03-05 22:11:20 -0800
commit43f579afb404be4c1c6dfd98e1936a2ede917e7f (patch)
tree1609a9e317a0484eb569023f7e48237409b833be /mjit.c
parent25ae82b83e36f96d18d1ba29431676329b7307d8 (diff)
Fix a critical mistake around GC
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/mjit.c b/mjit.c
index 8d2e009c79..cda8a85e20 100644
--- a/mjit.c
+++ b/mjit.c
@@ -348,13 +348,6 @@ mjit_child_after_fork(void)
// TODO: remove this
}
-// Called by rb_vm_mark()
-void
-mjit_mark(void)
-{
- // TODO: implement
-}
-
void
mjit_mark_cc_entries(const struct rb_iseq_constant_body *const body)
{
@@ -392,6 +385,21 @@ rb_mjit_compile(const rb_iseq_t *iseq)
RB_VM_LOCK_LEAVE();
}
+// Called by rb_vm_mark()
+void
+mjit_mark(void)
+{
+ if (!mjit_enabled)
+ return;
+ RUBY_MARK_ENTER("mjit");
+
+ // Mark objects used by the MJIT compiler
+ rb_gc_mark(rb_MJITCompiler);
+ rb_gc_mark(rb_cMJITIseqPtr);
+
+ RUBY_MARK_LEAVE("mjit");
+}
+
void
mjit_init(const struct mjit_options *opts)
{