зеркало из https://github.com/github/ruby.git
MJIT: Handle JIT failure properly
This commit is contained in:
Родитель
1e8fed2d2a
Коммит
5310147bb8
10
mjit.c
10
mjit.c
|
@ -244,7 +244,15 @@ check_unit_queue(void)
|
||||||
current_cc_ms = real_ms_time();
|
current_cc_ms = real_ms_time();
|
||||||
current_cc_unit = unit;
|
current_cc_unit = unit;
|
||||||
current_cc_pid = start_mjit_compile(unit);
|
current_cc_pid = start_mjit_compile(unit);
|
||||||
// TODO: handle -1
|
|
||||||
|
// JIT failure
|
||||||
|
if (current_cc_pid == -1) {
|
||||||
|
current_cc_pid = 0;
|
||||||
|
current_cc_unit->iseq->body->jit_func = (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC;
|
||||||
|
current_cc_unit = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mjit_opts.wait) {
|
if (mjit_opts.wait) {
|
||||||
mjit_wait(unit->iseq->body);
|
mjit_wait(unit->iseq->body);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1198,6 +1198,18 @@ class TestMJIT < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end if defined?(fork)
|
end if defined?(fork)
|
||||||
|
|
||||||
|
def test_jit_failure
|
||||||
|
_, err = eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", min_calls: 1, verbose: 1)
|
||||||
|
begin;
|
||||||
|
1.times do
|
||||||
|
class A
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
assert_match(/^MJIT warning: .+ unsupported instruction: defineclass/, err)
|
||||||
|
assert_match(/^JIT failure: block in <main>/, err)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# The shortest way to test one proc
|
# The shortest way to test one proc
|
||||||
|
|
Загрузка…
Ссылка в новой задаче