mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
41f405c486
commit
e8617d0e7e
3 changed files with 10 additions and 3 deletions
2
yjit.h
2
yjit.h
|
@ -14,6 +14,8 @@
|
|||
#define PLATFORM_SUPPORTED_P 1
|
||||
#endif
|
||||
|
||||
#define JIT_ENABLED USE_MJIT
|
||||
|
||||
#ifndef YJIT_CHECK_MODE
|
||||
#define YJIT_CHECK_MODE 0
|
||||
#endif
|
||||
|
|
|
@ -945,7 +945,10 @@ invalidate_block_version(block_t* block)
|
|||
|
||||
// Clear out the JIT func so that we can recompile later and so the
|
||||
// interpreter will run the iseq
|
||||
|
||||
#if JIT_ENABLED
|
||||
iseq->body->jit_func = 0;
|
||||
#endif
|
||||
|
||||
// TODO:
|
||||
// May want to recompile a new entry point (for interpreter entry blocks)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue