Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Address code review feedback.
Browse files Browse the repository at this point in the history
* Disable default features for the `byteorder` crate.
* Add a comment regarding the Windows ABI unwind code numerical values.
* Panic if we encounter a Windows function with a prologue greater than 256
  bytes in size.
  • Loading branch information
peterhuene committed Oct 30, 2019
1 parent 63461ed commit 5a41555
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cranelift-codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ target-lexicon = "0.8.1"
log = { version = "0.4.6", default-features = false }
serde = { version = "1.0.94", features = ["derive"], optional = true }
smallvec = { version = "0.6.10" }
byteorder = "1.3.2"
byteorder = { version = "1.3.2", default-features = false }
# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
# Please don't add any unless they are essential to the task of creating binary
# machine code. Integration tests that need external dependencies can be
Expand Down
6 changes: 3 additions & 3 deletions cranelift-codegen/src/isa/x86/unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl UnwindInfo {
for (offset, inst, size) in func.inst_offsets(entry_block, &isa.encoding_info()) {
// x64 ABI prologues cannot exceed 256 bytes in length
if (offset + size) > 256 {
return None;
panic!("function prologues cannot exceed 256 bytes in size for Windows x64");
}

prologue_size += size;
Expand Down Expand Up @@ -399,7 +399,7 @@ mod tests {
let mut mem = Vec::new();
unwind
.emit(&mut mem)
.expect("failed to emit unwind information");;
.expect("failed to emit unwind information");

assert_eq!(
mem,
Expand Down Expand Up @@ -465,7 +465,7 @@ mod tests {
let mut mem = Vec::new();
unwind
.emit(&mut mem)
.expect("failed to emit unwind information");;
.expect("failed to emit unwind information");

assert_eq!(
mem,
Expand Down
2 changes: 1 addition & 1 deletion cranelift-filetests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ log = "0.4.6"
memmap = "0.7.0"
num_cpus = "1.8.0"
region = "2.1.2"
byteorder = "1.3.2"
byteorder = { version = "1.3.2", default-features = false }

[features]
basic-blocks = []
1 change: 1 addition & 0 deletions cranelift-filetests/src/test_unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ enum UnwindOperation {

impl From<u8> for UnwindOperation {
fn from(value: u8) -> Self {
// The numerical value is specified as part of the Windows x64 ABI
match value {
0 => Self::PushNonvolatileRegister,
1 => Self::LargeStackAlloc,
Expand Down

0 comments on commit 5a41555

Please sign in to comment.