summaryrefslogtreecommitdiff
path: root/mjit.h
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-06 21:27:46 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-12-06 21:36:58 -0800
commite6b63b382c30cb665d24853f745586a157ae58f3 (patch)
treeb5e32f5aac0760b86c9cdf3a2fbb5a9ca42814b2 /mjit.h
parent8684904cb418df3f6d15ea0b0ad5c7c357d7ef06 (diff)
MJIT: Refactor the jit_func enum for MJIT
All values should have a MJIT_ prefix. We could address the warning for the end mark if we just define the macro for the check next to the enum. It even simplifies some code for checking the enum.
Diffstat (limited to 'mjit.h')
-rw-r--r--mjit.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/mjit.h b/mjit.h
index 536ac9fa91..568f65d1e7 100644
--- a/mjit.h
+++ b/mjit.h
@@ -20,18 +20,18 @@
// Special address values of a function generated from the
// corresponding iseq by MJIT:
-enum rb_mjit_iseq_func {
+enum rb_mjit_func_state {
// ISEQ has never been enqueued to unit_queue yet
- NOT_ADDED_JIT_ISEQ_FUNC = 0,
+ MJIT_FUNC_NOT_QUEUED = 0,
// ISEQ is already queued for the machine code generation but the
// code is not ready yet for the execution
- NOT_READY_JIT_ISEQ_FUNC = 1,
+ MJIT_FUNC_COMPILING = 1,
// ISEQ included not compilable insn, some internal assertion failed
// or the unit is unloaded
- NOT_COMPILED_JIT_ISEQ_FUNC = 2,
- // End mark
- LAST_JIT_ISEQ_FUNC = 3
+ MJIT_FUNC_FAILED = 2,
};
+// Return true if jit_func is part of enum rb_mjit_func_state
+#define MJIT_FUNC_STATE_P(jit_func) ((uintptr_t)(jit_func) <= (uintptr_t)MJIT_FUNC_FAILED)
// MJIT options which can be defined on the MRI command line.
struct mjit_options {