mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Remove unusable variants from Align enum
I discovered today that Wasmer throws an error if you use "higher than natural" alignment in a store instruction. So let's take them out of the enum.
This commit is contained in:
parent
8a1a164544
commit
a25101b378
1 changed files with 3 additions and 8 deletions
|
@ -84,7 +84,9 @@ impl std::fmt::Debug for VmBlock<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wasm memory alignment. (Rust representation matches Wasm encoding)
|
/// Wasm memory alignment for load/store instructions.
|
||||||
|
/// Rust representation matches Wasm encoding.
|
||||||
|
/// It's an error to specify alignment higher than the "natural" alignment of the instruction
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum Align {
|
pub enum Align {
|
||||||
|
@ -92,10 +94,6 @@ pub enum Align {
|
||||||
Bytes2 = 1,
|
Bytes2 = 1,
|
||||||
Bytes4 = 2,
|
Bytes4 = 2,
|
||||||
Bytes8 = 3,
|
Bytes8 = 3,
|
||||||
Bytes16 = 4,
|
|
||||||
Bytes32 = 5,
|
|
||||||
Bytes64 = 6,
|
|
||||||
// ... we can add more if we need them ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u32> for Align {
|
impl From<u32> for Align {
|
||||||
|
@ -105,9 +103,6 @@ impl From<u32> for Align {
|
||||||
2 => Align::Bytes2,
|
2 => Align::Bytes2,
|
||||||
4 => Align::Bytes4,
|
4 => Align::Bytes4,
|
||||||
8 => Align::Bytes8,
|
8 => Align::Bytes8,
|
||||||
16 => Align::Bytes16,
|
|
||||||
32 => Align::Bytes32,
|
|
||||||
64 => Align::Bytes64,
|
|
||||||
_ => panic!("{:?}-byte alignment not supported", x),
|
_ => panic!("{:?}-byte alignment not supported", x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue