summaryrefslogtreecommitdiff
path: root/yjit_iface.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-07-15 15:43:39 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:38 -0400
commite8617d0e7ea8039f3757896f547107f51566256b (patch)
tree0ce51bfb188c7687c3d8c5cb69236c4efefec450 /yjit_iface.c
parent41f405c486a01c1a16c3f102c11d41c8fbbafe60 (diff)
Make sure we can still compile with the JIT disabled
If `--disable-jit-support` is passed to configure, then `jit_func` is removed from the iseq body and we can't compile YJIT. This commit detects when the JIT function pointer is gone and disables YJIT in that case.
Diffstat (limited to 'yjit_iface.c')
-rw-r--r--yjit_iface.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/yjit_iface.c b/yjit_iface.c
index 0985dd8d53..b6283a26f8 100644
--- a/yjit_iface.c
+++ b/yjit_iface.c
@@ -453,8 +453,8 @@ typedef VALUE (*yjit_func_t)(rb_execution_context_t *, rb_control_frame_t *);
bool
rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec)
{
+#if (OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE) && JIT_ENABLED
bool success = true;
-#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
RB_VM_LOCK_ENTER();
// TODO: I think we need to stop all other ractors here
@@ -471,8 +471,10 @@ rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec)
}
RB_VM_LOCK_LEAVE();
-#endif
return success;
+#else
+ return false;
+#endif
}
struct yjit_block_itr {
@@ -1004,7 +1006,7 @@ outgoing_ids(VALUE self)
void
rb_yjit_init(struct rb_yjit_options *options)
{
- if (!PLATFORM_SUPPORTED_P) {
+ if (!PLATFORM_SUPPORTED_P || !JIT_ENABLED) {
return;
}