diff --git a/common.mk b/common.mk
index d99d52f357..f1764ef9ea 100644
--- a/common.mk
+++ b/common.mk
@@ -9658,6 +9658,7 @@ mjit.$(OBJEXT): {$(VPATH)}mjit.h
 mjit.$(OBJEXT): {$(VPATH)}mjit.rb
 mjit.$(OBJEXT): {$(VPATH)}mjit.rbinc
 mjit.$(OBJEXT): {$(VPATH)}mjit_config.h
+mjit.$(OBJEXT): {$(VPATH)}mjit_unit.h
 mjit.$(OBJEXT): {$(VPATH)}node.h
 mjit.$(OBJEXT): {$(VPATH)}onigmo.h
 mjit.$(OBJEXT): {$(VPATH)}oniguruma.h
@@ -9865,6 +9866,7 @@ mjit_compile.$(OBJEXT): {$(VPATH)}missing.h
 mjit_compile.$(OBJEXT): {$(VPATH)}mjit.h
 mjit_compile.$(OBJEXT): {$(VPATH)}mjit_compile.c
 mjit_compile.$(OBJEXT): {$(VPATH)}mjit_compile.inc
+mjit_compile.$(OBJEXT): {$(VPATH)}mjit_unit.h
 mjit_compile.$(OBJEXT): {$(VPATH)}node.h
 mjit_compile.$(OBJEXT): {$(VPATH)}ruby_assert.h
 mjit_compile.$(OBJEXT): {$(VPATH)}ruby_atomic.h
diff --git a/mjit.c b/mjit.c
index b52c5fad9f..da3fd9d61e 100644
--- a/mjit.c
+++ b/mjit.c
@@ -87,6 +87,7 @@
 #include "vm_core.h"
 #include "vm_callinfo.h"
 #include "mjit.h"
+#include "mjit_unit.h"
 #include "gc.h"
 #include "ruby_assert.h"
 #include "ruby/debug.h"
@@ -149,29 +150,6 @@ typedef intptr_t pid_t;
 # define USE_JIT_COMPACTION 1
 #endif
 
-// The unit structure that holds metadata of ISeq for MJIT.
-struct rb_mjit_unit {
-    struct ccan_list_node unode;
-    // Unique order number of unit.
-    int id;
-    // Dlopen handle of the loaded object file.
-    void *handle;
-    rb_iseq_t *iseq;
-#if defined(_WIN32)
-    // DLL cannot be removed while loaded on Windows. If this is set, it'll be lazily deleted.
-    char *so_file;
-#endif
-    // Only used by unload_units. Flag to check this unit is currently on stack or not.
-    bool used_code_p;
-    // True if it's a unit for JIT compaction
-    bool compact_p;
-    // mjit_compile's optimization switches
-    struct rb_mjit_compile_info compile_info;
-    // captured CC values, they should be marked with iseq.
-    const struct rb_callcache **cc_entries;
-    unsigned int cc_entries_size; // ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs
-};
-
 // Linked list of struct rb_mjit_unit.
 struct rb_mjit_unit_list {
     struct ccan_list_head head;
@@ -1138,13 +1116,6 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
 }
 #endif
 
-// To see cc_entries using index returned by `mjit_capture_cc_entries` in mjit_compile.c
-const struct rb_callcache **
-mjit_iseq_cc_entries(const struct rb_iseq_constant_body *const body)
-{
-    return body->jit_unit->cc_entries;
-}
-
 // Capture cc entries of `captured_iseq` and append them to `compiled_iseq->jit_unit->cc_entries`.
 // This is needed when `captured_iseq` is inlined by `compiled_iseq` and GC needs to mark inlined cc.
 //
diff --git a/mjit_compile.c b/mjit_compile.c
index 985c3caba6..66deaa9a65 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -20,6 +20,7 @@
 #include "internal/object.h"
 #include "internal/variable.h"
 #include "mjit.h"
+#include "mjit_unit.h"
 #include "vm_core.h"
 #include "vm_callinfo.h"
 #include "vm_exec.h"
@@ -87,8 +88,6 @@ call_data_index(CALL_DATA cd, const struct rb_iseq_constant_body *body)
     return cd - body->call_data;
 }
 
-const struct rb_callcache ** mjit_iseq_cc_entries(const struct rb_iseq_constant_body *const body);
-
 // Using this function to refer to cc_entries allocated by `mjit_capture_cc_entries`
 // instead of storing cc_entries in status directly so that we always refer to a new address
 // returned by `realloc` inside it.
@@ -96,7 +95,7 @@ static const struct rb_callcache **
 captured_cc_entries(const struct compile_status *status)
 {
     VM_ASSERT(status->cc_entries_index != -1);
-    return mjit_iseq_cc_entries(status->compiled_iseq) + status->cc_entries_index;
+    return status->compiled_iseq->jit_unit->cc_entries + status->cc_entries_index;
 }
 
 // Returns true if call cache is still not obsoleted and vm_cc_cme(cc)->def->type is available.
diff --git a/mjit_unit.h b/mjit_unit.h
new file mode 100644
index 0000000000..2e23a8d5fc
--- /dev/null
+++ b/mjit_unit.h
@@ -0,0 +1,29 @@
+#ifndef INTERNAL_MJIT_H
+#define INTERNAL_MJIT_H
+
+#include "ccan/list/list.h"
+
+// The unit structure that holds metadata of ISeq for MJIT.
+struct rb_mjit_unit {
+    struct ccan_list_node unode;
+    // Unique order number of unit.
+    int id;
+    // Dlopen handle of the loaded object file.
+    void *handle;
+    rb_iseq_t *iseq;
+#if defined(_WIN32)
+    // DLL cannot be removed while loaded on Windows. If this is set, it'll be lazily deleted.
+    char *so_file;
+#endif
+    // Only used by unload_units. Flag to check this unit is currently on stack or not.
+    bool used_code_p;
+    // True if it's a unit for JIT compaction
+    bool compact_p;
+    // mjit_compile's optimization switches
+    struct rb_mjit_compile_info compile_info;
+    // captured CC values, they should be marked with iseq.
+    const struct rb_callcache **cc_entries;
+    unsigned int cc_entries_size; // ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs
+};
+
+#endif /* INTERNAL_MJIT_H */