From b7a93c2321c3eff101f22e426fae8b81bd21c39e Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 11 Nov 2020 12:25:36 +0100 Subject: [PATCH] Remove reloc_block It isn't called and all reloc sinks either ignore it or panic when it is called. --- cranelift/codegen/src/binemit/memorysink.rs | 9 --------- cranelift/codegen/src/binemit/mod.rs | 3 --- cranelift/codegen/src/isa/test_utils.rs | 2 -- cranelift/filetests/src/test_binemit.rs | 4 ---- cranelift/filetests/src/test_compile.rs | 1 - cranelift/filetests/src/test_rodata.rs | 1 - cranelift/filetests/src/test_stack_maps.rs | 1 - cranelift/object/src/backend.rs | 4 ---- cranelift/simplejit/src/backend.rs | 4 ---- cranelift/src/disasm.rs | 16 ---------------- crates/cranelift/src/lib.rs | 9 --------- crates/jit/src/trampoline.rs | 8 -------- crates/lightbeam/src/translate_sections.rs | 4 ---- crates/lightbeam/wasmtime/src/lib.rs | 9 --------- 14 files changed, 75 deletions(-) diff --git a/cranelift/codegen/src/binemit/memorysink.rs b/cranelift/codegen/src/binemit/memorysink.rs index 151983933d..d50d1c10eb 100644 --- a/cranelift/codegen/src/binemit/memorysink.rs +++ b/cranelift/codegen/src/binemit/memorysink.rs @@ -74,9 +74,6 @@ impl<'a> MemoryCodeSink<'a> { /// A trait for receiving relocations for code that is emitted directly into memory. pub trait RelocSink { - /// Add a relocation referencing a block at the current offset. - fn reloc_block(&mut self, _: CodeOffset, _: Reloc, _: CodeOffset); - /// Add a relocation referencing an external symbol at the current offset. fn reloc_external( &mut self, @@ -138,11 +135,6 @@ impl<'a> CodeSink for MemoryCodeSink<'a> { self.write(x); } - fn reloc_block(&mut self, rel: Reloc, block_offset: CodeOffset) { - let ofs = self.offset(); - self.relocs.reloc_block(ofs, rel, block_offset); - } - fn reloc_external( &mut self, srcloc: SourceLoc, @@ -204,7 +196,6 @@ impl<'a> CodeSink for MemoryCodeSink<'a> { pub struct NullRelocSink {} impl RelocSink for NullRelocSink { - fn reloc_block(&mut self, _: CodeOffset, _: Reloc, _: CodeOffset) {} fn reloc_external( &mut self, _: CodeOffset, diff --git a/cranelift/codegen/src/binemit/mod.rs b/cranelift/codegen/src/binemit/mod.rs index ae26f7f14e..b534ec9765 100644 --- a/cranelift/codegen/src/binemit/mod.rs +++ b/cranelift/codegen/src/binemit/mod.rs @@ -140,9 +140,6 @@ pub trait CodeSink { /// Add 8 bytes to the code section. fn put8(&mut self, _: u64); - /// Add a relocation referencing a block at the current offset. - fn reloc_block(&mut self, _: Reloc, _: CodeOffset); - /// Add a relocation referencing an external symbol plus the addend at the current offset. fn reloc_external(&mut self, _: SourceLoc, _: Reloc, _: &ExternalName, _: Addend); diff --git a/cranelift/codegen/src/isa/test_utils.rs b/cranelift/codegen/src/isa/test_utils.rs index 77ce94fd4b..01c500d6ca 100644 --- a/cranelift/codegen/src/isa/test_utils.rs +++ b/cranelift/codegen/src/isa/test_utils.rs @@ -59,8 +59,6 @@ impl CodeSink for TestCodeSink { } } - fn reloc_block(&mut self, _rel: Reloc, _block_offset: CodeOffset) {} - fn reloc_external( &mut self, _srcloc: SourceLoc, diff --git a/cranelift/filetests/src/test_binemit.rs b/cranelift/filetests/src/test_binemit.rs index 32d8514c92..ab25decaab 100644 --- a/cranelift/filetests/src/test_binemit.rs +++ b/cranelift/filetests/src/test_binemit.rs @@ -72,10 +72,6 @@ impl binemit::CodeSink for TextSink { self.offset += 8; } - fn reloc_block(&mut self, reloc: binemit::Reloc, block_offset: binemit::CodeOffset) { - write!(self.text, "{}({}) ", reloc, block_offset).unwrap(); - } - fn reloc_external( &mut self, _srcloc: ir::SourceLoc, diff --git a/cranelift/filetests/src/test_compile.rs b/cranelift/filetests/src/test_compile.rs index 2a3b5da6b7..b66f8eca66 100644 --- a/cranelift/filetests/src/test_compile.rs +++ b/cranelift/filetests/src/test_compile.rs @@ -109,7 +109,6 @@ impl binemit::CodeSink for SizeSink { self.offset += 8; } - fn reloc_block(&mut self, _reloc: binemit::Reloc, _block_offset: binemit::CodeOffset) {} fn reloc_external( &mut self, _srcloc: ir::SourceLoc, diff --git a/cranelift/filetests/src/test_rodata.rs b/cranelift/filetests/src/test_rodata.rs index 6a1976f4fe..83b10b4e08 100644 --- a/cranelift/filetests/src/test_rodata.rs +++ b/cranelift/filetests/src/test_rodata.rs @@ -106,7 +106,6 @@ impl binemit::CodeSink for RodataSink { } } - fn reloc_block(&mut self, _reloc: binemit::Reloc, _block_offset: binemit::CodeOffset) {} fn reloc_external( &mut self, _: ir::SourceLoc, diff --git a/cranelift/filetests/src/test_stack_maps.rs b/cranelift/filetests/src/test_stack_maps.rs index 2b70a111d2..d9db686d02 100644 --- a/cranelift/filetests/src/test_stack_maps.rs +++ b/cranelift/filetests/src/test_stack_maps.rs @@ -79,7 +79,6 @@ impl CodeSink for TestStackMapsSink { self.offset += 8; } - fn reloc_block(&mut self, _: Reloc, _: CodeOffset) {} fn reloc_external(&mut self, _: SourceLoc, _: Reloc, _: &ExternalName, _: Addend) {} fn reloc_constant(&mut self, _: Reloc, _: ConstantOffset) {} fn reloc_jt(&mut self, _: Reloc, _: JumpTable) {} diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index f8bffc8beb..81dd75c4cd 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -622,10 +622,6 @@ struct ObjectRelocSink { } impl RelocSink for ObjectRelocSink { - fn reloc_block(&mut self, _offset: CodeOffset, _reloc: Reloc, _block_offset: CodeOffset) { - unimplemented!(); - } - fn reloc_external( &mut self, offset: CodeOffset, diff --git a/cranelift/simplejit/src/backend.rs b/cranelift/simplejit/src/backend.rs index 470b504bf0..d211eb5feb 100644 --- a/cranelift/simplejit/src/backend.rs +++ b/cranelift/simplejit/src/backend.rs @@ -539,10 +539,6 @@ struct SimpleJITRelocSink { } impl RelocSink for SimpleJITRelocSink { - fn reloc_block(&mut self, _offset: CodeOffset, _reloc: Reloc, _block_offset: CodeOffset) { - unimplemented!(); - } - fn reloc_external( &mut self, offset: CodeOffset, diff --git a/cranelift/src/disasm.rs b/cranelift/src/disasm.rs index 90dec397a5..a98e867380 100644 --- a/cranelift/src/disasm.rs +++ b/cranelift/src/disasm.rs @@ -19,22 +19,6 @@ impl PrintRelocs { } impl binemit::RelocSink for PrintRelocs { - fn reloc_block( - &mut self, - where_: binemit::CodeOffset, - r: binemit::Reloc, - offset: binemit::CodeOffset, - ) { - if self.flag_print { - writeln!( - &mut self.text, - "reloc_block: {} {} at {}", - r, offset, where_ - ) - .unwrap(); - } - } - fn reloc_external( &mut self, where_: binemit::CodeOffset, diff --git a/crates/cranelift/src/lib.rs b/crates/cranelift/src/lib.rs index f128ab5717..a0e241572e 100644 --- a/crates/cranelift/src/lib.rs +++ b/crates/cranelift/src/lib.rs @@ -114,15 +114,6 @@ struct RelocSink { } impl binemit::RelocSink for RelocSink { - fn reloc_block( - &mut self, - _offset: binemit::CodeOffset, - _reloc: binemit::Reloc, - _block_offset: binemit::CodeOffset, - ) { - // This should use the `offsets` field of `ir::Function`. - panic!("block headers not yet implemented"); - } fn reloc_external( &mut self, offset: binemit::CodeOffset, diff --git a/crates/jit/src/trampoline.rs b/crates/jit/src/trampoline.rs index 9116666ea2..aebc4f1bc8 100644 --- a/crates/jit/src/trampoline.rs +++ b/crates/jit/src/trampoline.rs @@ -184,14 +184,6 @@ impl TrampolineRelocSink { } impl binemit::RelocSink for TrampolineRelocSink { - fn reloc_block( - &mut self, - _offset: binemit::CodeOffset, - _reloc: binemit::Reloc, - _block_offset: binemit::CodeOffset, - ) { - panic!("trampoline compilation should not produce block relocs"); - } fn reloc_external( &mut self, offset: binemit::CodeOffset, diff --git a/crates/lightbeam/src/translate_sections.rs b/crates/lightbeam/src/translate_sections.rs index ad32936420..7ddad9197d 100644 --- a/crates/lightbeam/src/translate_sections.rs +++ b/crates/lightbeam/src/translate_sections.rs @@ -83,10 +83,6 @@ pub fn element(elements: ElementSectionReader) -> Result<(), Error> { struct UnimplementedRelocSink; impl binemit::RelocSink for UnimplementedRelocSink { - fn reloc_block(&mut self, _: binemit::CodeOffset, _: binemit::Reloc, _: binemit::CodeOffset) { - unimplemented!() - } - fn reloc_external( &mut self, _: binemit::CodeOffset, diff --git a/crates/lightbeam/wasmtime/src/lib.rs b/crates/lightbeam/wasmtime/src/lib.rs index a1e67c6271..ed09e04550 100644 --- a/crates/lightbeam/wasmtime/src/lib.rs +++ b/crates/lightbeam/wasmtime/src/lib.rs @@ -86,15 +86,6 @@ struct RelocSink { } impl binemit::RelocSink for RelocSink { - fn reloc_block( - &mut self, - _offset: binemit::CodeOffset, - _reloc: binemit::Reloc, - _block_offset: binemit::CodeOffset, - ) { - // This should use the `offsets` field of `ir::Function`. - panic!("block headers not yet implemented"); - } fn reloc_external( &mut self, offset: binemit::CodeOffset,