Rename "Stackmap" to "StackMap"
And "stackmap" to "stack_map". This commit is purely mechanical.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! CLI tool to reduce Cranelift IR files crashing during compilation.
|
||||
|
||||
use crate::disasm::{PrintRelocs, PrintStackmaps, PrintTraps};
|
||||
use crate::disasm::{PrintRelocs, PrintStackMaps, PrintTraps};
|
||||
use crate::utils::{parse_sets_and_triple, read_to_string};
|
||||
use cranelift_codegen::cursor::{Cursor, FuncCursor};
|
||||
use cranelift_codegen::flowgraph::ControlFlowGraph;
|
||||
@@ -1045,14 +1045,14 @@ impl<'a> CrashCheckContext<'a> {
|
||||
let res = match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||
let mut relocs = PrintRelocs::new(false);
|
||||
let mut traps = PrintTraps::new(false);
|
||||
let mut stackmaps = PrintStackmaps::new(false);
|
||||
let mut stack_maps = PrintStackMaps::new(false);
|
||||
|
||||
let _ = self.context.compile_and_emit(
|
||||
self.isa,
|
||||
&mut self.code_memory,
|
||||
&mut relocs,
|
||||
&mut traps,
|
||||
&mut stackmaps,
|
||||
&mut stack_maps,
|
||||
);
|
||||
})) {
|
||||
Ok(()) => CheckResult::Succeed,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! CLI tool to read Cranelift IR files and compile them into native code.
|
||||
|
||||
use crate::disasm::{print_all, PrintRelocs, PrintStackmaps, PrintTraps};
|
||||
use crate::disasm::{print_all, PrintRelocs, PrintStackMaps, PrintTraps};
|
||||
use crate::utils::{parse_sets_and_triple, read_to_string};
|
||||
use cranelift_codegen::print_errors::pretty_error;
|
||||
use cranelift_codegen::settings::FlagsOrIsa;
|
||||
@@ -58,7 +58,7 @@ fn handle_module(
|
||||
for (func, _) in test_file.functions {
|
||||
let mut relocs = PrintRelocs::new(flag_print);
|
||||
let mut traps = PrintTraps::new(flag_print);
|
||||
let mut stackmaps = PrintStackmaps::new(flag_print);
|
||||
let mut stack_maps = PrintStackMaps::new(flag_print);
|
||||
|
||||
if let Some(isa) = isa {
|
||||
let mut context = Context::new();
|
||||
@@ -67,7 +67,7 @@ fn handle_module(
|
||||
|
||||
// Compile and encode the result to machine code.
|
||||
let code_info = context
|
||||
.compile_and_emit(isa, &mut mem, &mut relocs, &mut traps, &mut stackmaps)
|
||||
.compile_and_emit(isa, &mut mem, &mut relocs, &mut traps, &mut stack_maps)
|
||||
.map_err(|err| pretty_error(&context.func, Some(isa), err))?;
|
||||
|
||||
if flag_print {
|
||||
@@ -82,7 +82,7 @@ fn handle_module(
|
||||
code_info.jumptables_size + code_info.rodata_size,
|
||||
&relocs,
|
||||
&traps,
|
||||
&stackmaps,
|
||||
&stack_maps,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,12 +97,12 @@ impl binemit::TrapSink for PrintTraps {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PrintStackmaps {
|
||||
pub struct PrintStackMaps {
|
||||
pub flag_print: bool,
|
||||
pub text: String,
|
||||
}
|
||||
|
||||
impl PrintStackmaps {
|
||||
impl PrintStackMaps {
|
||||
pub fn new(flag_print: bool) -> Self {
|
||||
Self {
|
||||
flag_print,
|
||||
@@ -111,10 +111,10 @@ impl PrintStackmaps {
|
||||
}
|
||||
}
|
||||
|
||||
impl binemit::StackmapSink for PrintStackmaps {
|
||||
fn add_stackmap(&mut self, offset: binemit::CodeOffset, _: binemit::Stackmap) {
|
||||
impl binemit::StackMapSink for PrintStackMaps {
|
||||
fn add_stack_map(&mut self, offset: binemit::CodeOffset, _: binemit::StackMap) {
|
||||
if self.flag_print {
|
||||
writeln!(&mut self.text, "add_stackmap at {}", offset).unwrap();
|
||||
writeln!(&mut self.text, "add_stack_map at {}", offset).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,12 +223,12 @@ pub fn print_all(
|
||||
rodata_size: u32,
|
||||
relocs: &PrintRelocs,
|
||||
traps: &PrintTraps,
|
||||
stackmaps: &PrintStackmaps,
|
||||
stack_maps: &PrintStackMaps,
|
||||
) -> Result<(), String> {
|
||||
print_bytes(&mem);
|
||||
print_disassembly(isa, &mem[0..code_size as usize])?;
|
||||
print_readonly_data(&mem[code_size as usize..(code_size + rodata_size) as usize]);
|
||||
println!("\n{}\n{}\n{}", &relocs.text, &traps.text, &stackmaps.text);
|
||||
println!("\n{}\n{}\n{}", &relocs.text, &traps.text, &stack_maps.text);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
allow(clippy::too_many_arguments, clippy::cognitive_complexity)
|
||||
)]
|
||||
|
||||
use crate::disasm::{print_all, PrintRelocs, PrintStackmaps, PrintTraps};
|
||||
use crate::disasm::{print_all, PrintRelocs, PrintStackMaps, PrintTraps};
|
||||
use crate::utils::parse_sets_and_triple;
|
||||
use crate::UseTerminalColor;
|
||||
use cranelift_codegen::ir::DisplayFunctionAnnotations;
|
||||
@@ -219,14 +219,14 @@ fn handle_module(
|
||||
let mut mem = vec![];
|
||||
let mut relocs = PrintRelocs::new(flag_print);
|
||||
let mut traps = PrintTraps::new(flag_print);
|
||||
let mut stackmaps = PrintStackmaps::new(flag_print);
|
||||
let mut stack_maps = PrintStackMaps::new(flag_print);
|
||||
if flag_check_translation {
|
||||
if let Err(errors) = context.verify(fisa) {
|
||||
return Err(pretty_verifier_error(&context.func, fisa.isa, None, errors));
|
||||
}
|
||||
} else {
|
||||
let code_info = context
|
||||
.compile_and_emit(isa, &mut mem, &mut relocs, &mut traps, &mut stackmaps)
|
||||
.compile_and_emit(isa, &mut mem, &mut relocs, &mut traps, &mut stack_maps)
|
||||
.map_err(|err| pretty_error(&context.func, fisa.isa, err))?;
|
||||
|
||||
if flag_print_size {
|
||||
@@ -289,7 +289,7 @@ fn handle_module(
|
||||
rodata_size,
|
||||
&relocs,
|
||||
&traps,
|
||||
&stackmaps,
|
||||
&stack_maps,
|
||||
)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user