summaryrefslogtreecommitdiff
path: root/mjit_c.h
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-08 22:53:27 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-12-08 22:53:58 -0800
commit0dc5c117a5eb8773b717ef79c4f78ccf0e3981d5 (patch)
treeab6642e7cdf77cac215881c15bde32efd17337e1 /mjit_c.h
parentbfc225764e2b52126b1ff6632de9e9ac6a0aa15d (diff)
MJIT: Convert compact_p flag to an enum
I'm gonna add another type of unit shortly.
Diffstat (limited to 'mjit_c.h')
-rw-r--r--mjit_c.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/mjit_c.h b/mjit_c.h
index 7e4152d1f2..aec8dd31f6 100644
--- a/mjit_c.h
+++ b/mjit_c.h
@@ -14,23 +14,35 @@
#define NOT_COMPILED_STACK_SIZE -1
#define ALREADY_COMPILED_P(status, pos) (status->stack_size_for_pos[pos] != NOT_COMPILED_STACK_SIZE)
+// Type of rb_mjit_unit
+enum rb_mjit_unit_type {
+ // Single-ISEQ unit for mjit_compile
+ MJIT_UNIT_ISEQ = 0,
+ // All-ISEQ unit for mjit_compact
+ MJIT_UNIT_COMPACT = 1,
+};
+
// The unit structure that holds metadata of ISeq for MJIT.
+// TODO: Use different structs for ISEQ and COMPACT
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;
+ // Type of this unit
+ enum rb_mjit_unit_type type;
+
+ // ISEQ for a non-batch unit
rb_iseq_t *iseq;
// 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
+ // ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs
+ unsigned int cc_entries_size;
};
// Storage to keep data which is consistent in each conditional branch.