aboutsummaryrefslogtreecommitdiffstats
path: root/vm_exec.h
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-03-16 10:41:12 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-16 10:42:17 -0700
commit9947574b9cad74fbf04fa44d49647c591590c511 (patch)
tree0a36aa340dc9747c8ef277f96f9712cce8d69b26 /vm_exec.h
parenta8e7fee80129b0ba360c2671582117c8e18a6464 (diff)
downloadruby-9947574b9cad74fbf04fa44d49647c591590c511.tar.gz
Refactor jit_func_t and jit_exec
I closed https://github.com/ruby/ruby/pull/7543, but part of the diff seems useful regardless, so I extracted it.
Diffstat (limited to 'vm_exec.h')
-rw-r--r--vm_exec.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/vm_exec.h b/vm_exec.h
index 361516e86b..a00bd5027c 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -174,6 +174,14 @@ default: \
#define THROW_EXCEPTION(exc) return (VALUE)(exc)
#endif
+#define JIT_EXEC(ec, val) do { \
+ rb_jit_func_t func; \
+ if (val == Qundef && (func = jit_compile(ec))) { \
+ val = func(ec, ec->cfp); \
+ if (ec->tag->state) THROW_EXCEPTION(val); \
+ } \
+} while (0)
+
#define SCREG(r) (reg_##r)
#define VM_DEBUG_STACKOVERFLOW 0