mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
ZJIT: Add flag to disable the HIR optimizer (#14181)
Also add a check in the bisect script that can assign blame to the HIR optimizer.
This commit is contained in:
parent
e26ab5dbf2
commit
998be6b3a4
3 changed files with 14 additions and 1 deletions
|
@ -118,6 +118,11 @@ Tempfile.create "jit_list" do |temp_file|
|
|||
jit_list = File.readlines(temp_file.path).map(&:strip).reject(&:empty?)
|
||||
end
|
||||
LOGGER.info("Starting with JIT list of #{jit_list.length} items.")
|
||||
# Try running without the optimizer
|
||||
_, stderr, exitcode = run_with_jit_list(RUBY, ["--zjit-disable-hir-opt", *OPTIONS], jit_list)
|
||||
if exitcode == 0
|
||||
LOGGER.warn "*** Command suceeded with HIR optimizer disabled. HIR optimizer is probably at fault. ***"
|
||||
end
|
||||
# Now narrow it down
|
||||
command = lambda do |items|
|
||||
_, _, exitcode = run_with_jit_list(RUBY, OPTIONS, items)
|
||||
|
|
|
@ -1275,7 +1275,9 @@ fn compile_iseq(iseq: IseqPtr) -> Option<Function> {
|
|||
return None;
|
||||
}
|
||||
};
|
||||
function.optimize();
|
||||
if !get_option!(disable_hir_opt) {
|
||||
function.optimize();
|
||||
}
|
||||
if let Err(err) = function.validate() {
|
||||
debug!("ZJIT: compile_iseq: {err:?}");
|
||||
return None;
|
||||
|
|
|
@ -35,6 +35,9 @@ pub struct Options {
|
|||
/// Enable debug logging
|
||||
pub debug: bool,
|
||||
|
||||
/// Turn off the HIR optimizer
|
||||
pub disable_hir_opt: bool,
|
||||
|
||||
/// Dump initial High-level IR before optimization
|
||||
pub dump_hir_init: Option<DumpHIR>,
|
||||
|
||||
|
@ -66,6 +69,7 @@ impl Default for Options {
|
|||
num_profiles: 1,
|
||||
stats: false,
|
||||
debug: false,
|
||||
disable_hir_opt: false,
|
||||
dump_hir_init: None,
|
||||
dump_hir_opt: None,
|
||||
dump_hir_graphviz: false,
|
||||
|
@ -210,6 +214,8 @@ fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
|
|||
|
||||
("debug", "") => options.debug = true,
|
||||
|
||||
("disable-hir-opt", "") => options.disable_hir_opt = true,
|
||||
|
||||
// --zjit-dump-hir dumps the actual input to the codegen, which is currently the same as --zjit-dump-hir-opt.
|
||||
("dump-hir" | "dump-hir-opt", "") => options.dump_hir_opt = Some(DumpHIR::WithoutSnapshot),
|
||||
("dump-hir" | "dump-hir-opt", "all") => options.dump_hir_opt = Some(DumpHIR::All),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue