summaryrefslogtreecommitdiff
path: root/mjit_c.h
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-10 22:21:06 -0800
committerGitHub <noreply@github.com>2022-12-10 22:21:06 -0800
commit9d59d093bd99ca7f4266dec1e9b4cd8b5efbd2d4 (patch)
tree79b98a225e9451e280518f06c33d02d06cbcfbcb /mjit_c.h
parent7055574cf9dbcabd9d440c364f3e7b7812527bde (diff)
MJIT: Compile methods in batches (#6900)
* MJIT: Compile methods in batches * MJIT: make mjit-bindgen * MJIT: Fix RubyVM::MJIT tests
Notes
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
Diffstat (limited to 'mjit_c.h')
-rw-r--r--mjit_c.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/mjit_c.h b/mjit_c.h
index aec8dd31f6..cc4040c9df 100644
--- a/mjit_c.h
+++ b/mjit_c.h
@@ -14,25 +14,31 @@
#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
+// Linked list of struct rb_mjit_unit.
+struct rb_mjit_unit_list {
+ struct ccan_list_head head;
+ int length; // the list length
+};
+
enum rb_mjit_unit_type {
- // Single-ISEQ unit for mjit_compile
+ // Single-ISEQ unit for unit_queue
MJIT_UNIT_ISEQ = 0,
+ // Multi-ISEQ unit for mjit_batch
+ MJIT_UNIT_BATCH = 1,
// All-ISEQ unit for mjit_compact
- MJIT_UNIT_COMPACT = 1,
+ MJIT_UNIT_COMPACT = 2,
};
// The unit structure that holds metadata of ISeq for MJIT.
-// TODO: Use different structs for ISEQ and COMPACT
+// TODO: Use different structs for ISEQ and BATCH/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;
+ /* MJIT_UNIT_ISEQ */
// 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.
@@ -43,6 +49,12 @@ struct rb_mjit_unit {
const struct rb_callcache **cc_entries;
// ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs
unsigned int cc_entries_size;
+
+ /* MJIT_UNIT_BATCH, MJIT_UNIT_COMPACT */
+ // Dlopen handle of the loaded object file.
+ void *handle;
+ // Units compacted by this batch
+ struct rb_mjit_unit_list units; // MJIT_UNIT_BATCH only
};
// Storage to keep data which is consistent in each conditional branch.