Skip to content

Commit 09cf964

Browse files
committed
Remove some dead code from the .gcc_except_table writer
1 parent c53aef9 commit 09cf964

File tree

2 files changed

+2
-61
lines changed

2 files changed

+2
-61
lines changed

src/debuginfo/gcc_except_table.rs

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub(super) struct GccExceptTable {
55
pub call_sites: CallSiteTable,
66
pub actions: ActionTable,
77
pub type_info: TypeInfoTable,
8-
pub exception_specs: ExceptionSpecTable,
98
}
109

1110
impl GccExceptTable {
@@ -80,8 +79,7 @@ impl GccExceptTable {
8079
// type_info
8180
self.type_info.write(w, encoding)?;
8281

83-
// exception specs
84-
self.exception_specs.write(w)?;
82+
// exception specs (unused for rust)
8583

8684
// align to 4 bytes
8785
while w.len() % 4 != 0 {
@@ -194,11 +192,7 @@ impl Action {
194192
fn write<W: Writer>(&self, w: &mut W, action_table_offset: u64) -> gimli::write::Result<()> {
195193
// ttypeIndex
196194
let ttype_index = match self.kind {
197-
ActionKind::Cleanup => 0,
198195
ActionKind::Catch(type_info_id) => type_info_id.0 as i64 + 1,
199-
ActionKind::ExceptionSpec(exception_spec_offset) => {
200-
-(exception_spec_offset.0 as i64 + 1)
201-
}
202196
};
203197
w.write_sleb128(ttype_index)?;
204198
// actionOffset
@@ -215,12 +209,8 @@ impl Action {
215209
}
216210

217211
#[derive(Copy, Clone)]
218-
#[expect(dead_code)]
219212
pub(super) enum ActionKind {
220-
Cleanup,
221213
Catch(TypeInfoId),
222-
// FIXME
223-
ExceptionSpec(ExceptionSpecOffset),
224214
}
225215

226216
pub(super) struct TypeInfoTable {
@@ -257,53 +247,6 @@ impl TypeInfoTable {
257247
#[derive(Copy, Clone)]
258248
pub(super) struct TypeInfoId(u64);
259249

260-
pub(super) struct ExceptionSpecTable {
261-
specs: Vec<ExceptionSpec>,
262-
encoded_length: u64,
263-
}
264-
265-
impl ExceptionSpecTable {
266-
pub(super) fn new() -> ExceptionSpecTable {
267-
ExceptionSpecTable { specs: vec![], encoded_length: 0 }
268-
}
269-
270-
#[expect(dead_code)] // FIXME
271-
pub(super) fn add(&mut self, exception_spec: ExceptionSpec) -> ExceptionSpecOffset {
272-
let id = ExceptionSpecOffset(self.encoded_length);
273-
self.encoded_length += exception_spec.encoded_size();
274-
self.specs.push(exception_spec);
275-
id
276-
}
277-
278-
fn write<W: Writer>(&self, w: &mut W) -> gimli::write::Result<()> {
279-
for exception_spec in &self.specs {
280-
exception_spec.write(w)?;
281-
}
282-
283-
Ok(())
284-
}
285-
}
286-
287-
#[derive(Copy, Clone)]
288-
pub(super) struct ExceptionSpecOffset(u64);
289-
290-
pub(super) struct ExceptionSpec(pub Vec<TypeInfoId>);
291-
292-
impl ExceptionSpec {
293-
fn encoded_size(&self) -> u64 {
294-
let mut len = LenWriter(0);
295-
self.write(&mut len).unwrap();
296-
len.0 as u64
297-
}
298-
299-
fn write<W: Writer>(&self, w: &mut W) -> gimli::write::Result<()> {
300-
for type_info_id in &self.0 {
301-
w.write_uleb128(type_info_id.0 + 1)?;
302-
}
303-
w.write_u8(0)
304-
}
305-
}
306-
307250
struct LenWriter(usize);
308251

309252
impl Writer for LenWriter {

src/debuginfo/unwind.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use gimli::{Encoding, Format, RunTimeEndian};
99

1010
use super::emit::{DebugRelocName, address_for_data, address_for_func};
1111
use super::gcc_except_table::{
12-
Action, ActionKind, ActionTable, CallSite, CallSiteTable, ExceptionSpecTable, GccExceptTable,
13-
TypeInfoTable,
12+
Action, ActionKind, ActionTable, CallSite, CallSiteTable, GccExceptTable, TypeInfoTable,
1413
};
1514
use super::object::WriteDebugInfo;
1615
use crate::prelude::*;
@@ -157,7 +156,6 @@ impl UnwindContext {
157156
call_sites: CallSiteTable(vec![]),
158157
actions: ActionTable::new(),
159158
type_info: TypeInfoTable::new(gimli::DW_EH_PE_udata4),
160-
exception_specs: ExceptionSpecTable::new(),
161159
};
162160

163161
let catch_type = gcc_except_table_data.type_info.add(Address::Constant(0));

0 commit comments

Comments
 (0)