summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-29 21:32:16 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-11-29 21:34:46 -0800
commit7a2b1364ef5889497e7c203f644610f346bdd80a (patch)
treec0095b1a444d10a77df45b6e1b355bbb1b895f6d
parentecc15bc94afc574b6f06478a8625d6364db5c7a9 (diff)
MJIT: Merge mjit_unit.h into mjit_c.h
The distinction doesn't make much difference today.
-rw-r--r--common.mk3
-rw-r--r--mjit.c2
-rw-r--r--mjit_c.h31
-rw-r--r--mjit_unit.h29
4 files changed, 29 insertions, 36 deletions
diff --git a/common.mk b/common.mk
index 8187f9e572..e806861f1e 100644
--- a/common.mk
+++ b/common.mk
@@ -9809,8 +9809,8 @@ mjit.$(OBJEXT): {$(VPATH)}missing.h
mjit.$(OBJEXT): {$(VPATH)}mjit.c
mjit.$(OBJEXT): {$(VPATH)}mjit.h
mjit.$(OBJEXT): {$(VPATH)}mjit.rbinc
+mjit.$(OBJEXT): {$(VPATH)}mjit_c.h
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
@@ -10023,7 +10023,6 @@ mjit_c.$(OBJEXT): {$(VPATH)}mjit_c.h
mjit_c.$(OBJEXT): {$(VPATH)}mjit_c.rb
mjit_c.$(OBJEXT): {$(VPATH)}mjit_c.rbinc
mjit_c.$(OBJEXT): {$(VPATH)}mjit_compile_attr.inc
-mjit_c.$(OBJEXT): {$(VPATH)}mjit_unit.h
mjit_c.$(OBJEXT): {$(VPATH)}node.h
mjit_c.$(OBJEXT): {$(VPATH)}ruby_assert.h
mjit_c.$(OBJEXT): {$(VPATH)}ruby_atomic.h
diff --git a/mjit.c b/mjit.c
index d06ec7ef6a..c1c1420bfd 100644
--- a/mjit.c
+++ b/mjit.c
@@ -88,7 +88,7 @@
#include "vm_core.h"
#include "vm_callinfo.h"
#include "mjit.h"
-#include "mjit_unit.h"
+#include "mjit_c.h"
#include "gc.h"
#include "ruby_assert.h"
#include "ruby/debug.h"
diff --git a/mjit_c.h b/mjit_c.h
index 120f07280d..b9569b0bd1 100644
--- a/mjit_c.h
+++ b/mjit_c.h
@@ -1,19 +1,42 @@
// This file is parsed by tool/mjit/generate.rb to generate mjit_c.rb
-#ifndef MJIT_COMPILER_H
-#define MJIT_COMPILER_H
+#ifndef MJIT_C_H
+#define MJIT_C_H
#include "ruby/internal/config.h"
#include "vm_core.h"
#include "vm_callinfo.h"
#include "builtin.h"
+#include "ccan/list/list.h"
#include "mjit.h"
-#include "mjit_unit.h"
#include "shape.h"
// Macros to check if a position is already compiled using compile_status.stack_size_for_pos
#define NOT_COMPILED_STACK_SIZE -1
#define ALREADY_COMPILED_P(status, pos) (status->stack_size_for_pos[pos] != NOT_COMPILED_STACK_SIZE)
+// 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
+};
+
// Storage to keep data which is consistent in each conditional branch.
// This is created and used for one `compile_insns` call and its values
// should be copied for extra `compile_insns` call.
@@ -51,4 +74,4 @@ struct compile_status {
struct inlined_call_context inline_context;
};
-#endif /* MJIT_COMPILER_H */
+#endif /* MJIT_C_H */
diff --git a/mjit_unit.h b/mjit_unit.h
deleted file mode 100644
index 8f80a070e0..0000000000
--- a/mjit_unit.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef MJIT_UNIT_H
-#define MJIT_UNIT_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 /* MJIT_UNIT_H */