зеркало из https://github.com/github/ruby.git
Tweak mjit_exec() to remove YJIT symbol exports
We were exporting a couple of symbols in yjit.h because they could be used by code generated by MJIT. We don't want MJIT calling into YJIT code anyways so let's stop exporting them to libruby.so. Also adjust indentation and comments in mjit_exec().
This commit is contained in:
Родитель
b242ea87da
Коммит
735b3a7748
21
mjit.h
21
mjit.h
|
@ -137,28 +137,35 @@ mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_
|
|||
}
|
||||
|
||||
// Try to execute the current iseq in ec. Use JIT code if it is ready.
|
||||
// If it is not, add ISEQ to the compilation queue and return Qundef.
|
||||
// If it is not, add ISEQ to the compilation queue and return Qundef for MJIT.
|
||||
// YJIT compiles on the thread running the iseq.
|
||||
static inline VALUE
|
||||
mjit_exec(rb_execution_context_t *ec)
|
||||
{
|
||||
const rb_iseq_t *iseq = ec->cfp->iseq;
|
||||
struct rb_iseq_constant_body *body = iseq->body;
|
||||
bool yjit_enabled = false;
|
||||
#ifndef MJIT_HEADER
|
||||
// Don't want to compile with YJIT or use code generated by YJIT
|
||||
// when running inside code generated by MJIT.
|
||||
yjit_enabled = rb_yjit_enabled_p();
|
||||
#endif
|
||||
|
||||
if (mjit_call_p || rb_yjit_enabled_p()) {
|
||||
if (mjit_call_p || yjit_enabled) {
|
||||
body->total_calls++;
|
||||
}
|
||||
|
||||
#ifndef MJIT_HEADER
|
||||
if (rb_yjit_enabled_p() && !mjit_call_p && body->total_calls == rb_yjit_call_threshold()) {
|
||||
if (yjit_enabled && !mjit_call_p && body->total_calls == rb_yjit_call_threshold()) {
|
||||
// If we couldn't generate any code for this iseq, then return
|
||||
// Qundef so the interpreter will handle the call.
|
||||
if (!rb_yjit_compile_iseq(iseq, ec)) {
|
||||
return Qundef;
|
||||
return Qundef;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(mjit_call_p || rb_yjit_enabled_p()))
|
||||
if (!(mjit_call_p || yjit_enabled))
|
||||
return Qundef;
|
||||
|
||||
RB_DEBUG_COUNTER_INC(mjit_exec);
|
||||
|
@ -167,8 +174,8 @@ mjit_exec(rb_execution_context_t *ec)
|
|||
|
||||
// YJIT tried compiling this function once before and couldn't do
|
||||
// it, so return Qundef so the interpreter handles it.
|
||||
if (rb_yjit_enabled_p() && func == 0) {
|
||||
return Qundef;
|
||||
if (yjit_enabled && func == 0) {
|
||||
return Qundef;
|
||||
}
|
||||
|
||||
if (UNLIKELY((uintptr_t)func <= LAST_JIT_ISEQ_FUNC)) {
|
||||
|
|
2
yjit.h
2
yjit.h
|
@ -62,10 +62,8 @@ struct rb_yjit_options {
|
|||
bool test_backend;
|
||||
};
|
||||
|
||||
MJIT_SYMBOL_EXPORT_BEGIN
|
||||
bool rb_yjit_enabled_p(void);
|
||||
unsigned rb_yjit_call_threshold(void);
|
||||
MJIT_SYMBOL_EXPORT_END
|
||||
|
||||
void rb_yjit_invalidate_all_method_lookup_assumptions(void);
|
||||
void rb_yjit_method_lookup_change(VALUE klass, ID mid);
|
||||
|
|
Загрузка…
Ссылка в новой задаче