Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change UninitializedUnwindContext::initialize to borrow #395

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ mod cfi {
.set_got(0)
.set_text(0);

let mut ctx = Some(UninitializedUnwindContext::new());
let mut ctx = UninitializedUnwindContext::new();

b.iter(|| {
let mut entries = eh_frame.entries(&bases);
Expand All @@ -630,22 +630,18 @@ mod cfi {
.parse(|offset| eh_frame.cie_from_offset(&bases, offset))
.expect("Should be able to get CIE for FED");

let mut context = ctx
.take()
.unwrap()
let context = ctx
.initialize(fde.cie())
.expect("Should be able to initialize ctx");

{
let mut table = UnwindTable::new(&mut context, &fde);
let mut table = UnwindTable::new(context, &fde);
while let Some(row) =
table.next_row().expect("Should get next unwind table row")
{
test::black_box(row);
}
}

ctx = Some(context.reset());
}
};
}
Expand Down Expand Up @@ -715,11 +711,12 @@ mod cfi {
let fde = get_fde_with_longest_cfi_instructions(&eh_frame);

b.iter(|| {
let mut ctx = UninitializedUnwindContext::new()
let mut ctx = UninitializedUnwindContext::new();
let context = ctx
.initialize(fde.cie())
.expect("Should initialize the ctx OK");

let mut table = UnwindTable::new(&mut ctx, &fde);
let mut table = UnwindTable::new(context, &fde);
while let Some(row) = table.next_row().expect("Should get next unwind table row") {
test::black_box(row);
}
Expand All @@ -732,23 +729,19 @@ mod cfi {
let eh_frame = EhFrame::new(&eh_frame, LittleEndian);
let fde = get_fde_with_longest_cfi_instructions(&eh_frame);

let mut ctx = Some(UninitializedUnwindContext::new());
let mut ctx = UninitializedUnwindContext::new();

b.iter(|| {
let mut context = ctx
.take()
.unwrap()
let context = ctx
.initialize(fde.cie())
.expect("Should be able to initialize ctx");

{
let mut table = UnwindTable::new(&mut context, &fde);
let mut table = UnwindTable::new(context, &fde);
while let Some(row) = table.next_row().expect("Should get next unwind table row") {
test::black_box(row);
}
}

ctx = Some(context.reset());
});
}
}
Loading