Update clippy settings and fix a few clippy warnings.
This commit is contained in:
@@ -111,9 +111,7 @@ fn handle_module(
|
|||||||
.compile(isa)
|
.compile(isa)
|
||||||
.map_err(|err| pretty_error(&context.func, Some(isa), err))?;
|
.map_err(|err| pretty_error(&context.func, Some(isa), err))?;
|
||||||
|
|
||||||
let mut mem = Vec::new();
|
let mut mem = vec![0; total_size as usize];
|
||||||
mem.resize(total_size as usize, 0);
|
|
||||||
|
|
||||||
let mut relocs = PrintRelocs { flag_print };
|
let mut relocs = PrintRelocs { flag_print };
|
||||||
let mut traps = PrintTraps { flag_print };
|
let mut traps = PrintTraps { flag_print };
|
||||||
let mut code_sink: binemit::MemoryCodeSink;
|
let mut code_sink: binemit::MemoryCodeSink;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//! Reads Wasm binary/text files, translates the functions' code to Cranelift IR.
|
//! Reads Wasm binary/text files, translates the functions' code to Cranelift IR.
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
allow(too_many_arguments, cyclomatic_complexity)
|
allow(clippy::too_many_arguments, clippy::cyclomatic_complexity)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
use crate::utils::{parse_sets_and_triple, read_to_end};
|
use crate::utils::{parse_sets_and_triple, read_to_end};
|
||||||
|
|||||||
@@ -17,10 +17,7 @@
|
|||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "std", warn(unstable_features))]
|
#![cfg_attr(feature = "std", warn(unstable_features))]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ where
|
|||||||
///
|
///
|
||||||
/// If the cursor reaches the end, return `None` and leave the cursor at the off-the-end
|
/// If the cursor reaches the end, return `None` and leave the cursor at the off-the-end
|
||||||
/// position.
|
/// position.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))]
|
||||||
pub fn next(&mut self) -> Option<(K, V)> {
|
pub fn next(&mut self) -> Option<(K, V)> {
|
||||||
self.path.next(self.pool)
|
self.path.next(self.pool)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ impl<F: Forest> NodePool<F> {
|
|||||||
pub fn free_tree(&mut self, node: Node) {
|
pub fn free_tree(&mut self, node: Node) {
|
||||||
if let NodeData::Inner { size, tree, .. } = self[node] {
|
if let NodeData::Inner { size, tree, .. } = self[node] {
|
||||||
// Note that we have to capture `tree` by value to avoid borrow checker trouble.
|
// Note that we have to capture `tree` by value to avoid borrow checker trouble.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_range_loop))]
|
||||||
for i in 0..usize::from(size + 1) {
|
for i in 0..usize::from(size + 1) {
|
||||||
// Recursively free sub-trees. This recursion can never be deeper than `MAX_PATH`,
|
// Recursively free sub-trees. This recursion can never be deeper than `MAX_PATH`,
|
||||||
// and since most trees have less than a handful of nodes, it is worthwhile to
|
// and since most trees have less than a handful of nodes, it is worthwhile to
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ where
|
|||||||
///
|
///
|
||||||
/// If the cursor reaches the end, return `None` and leave the cursor at the off-the-end
|
/// If the cursor reaches the end, return `None` and leave the cursor at the off-the-end
|
||||||
/// position.
|
/// position.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))]
|
||||||
pub fn next(&mut self) -> Option<K> {
|
pub fn next(&mut self) -> Option<K> {
|
||||||
self.path.next(self.pool).map(|(k, _)| k)
|
self.path.next(self.pool).map(|(k, _)| k)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ pub fn generate_table<T, H: Fn(&T) -> usize>(items: &Vec<T>, hash_function: H) -
|
|||||||
size.next_power_of_two()
|
size.next_power_of_two()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut table: Vec<Option<&T>> = Vec::new();
|
let mut table: Vec<Option<&T>> = vec![None; size];
|
||||||
table.resize(size, None);
|
|
||||||
|
|
||||||
for i in items {
|
for i in items {
|
||||||
let mut h = hash_function(i) % size;
|
let mut h = hash_function(i) % size;
|
||||||
|
|||||||
@@ -355,8 +355,7 @@ fn gen_descriptors(group: &SettingGroup, fmt: &mut Formatter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn gen_template(group: &SettingGroup, fmt: &mut Formatter) {
|
fn gen_template(group: &SettingGroup, fmt: &mut Formatter) {
|
||||||
let mut default_bytes: Vec<u8> = Vec::new();
|
let mut default_bytes: Vec<u8> = vec![0; group.settings_size as usize];
|
||||||
default_bytes.resize(group.settings_size as usize, 0);
|
|
||||||
for setting in &group.settings {
|
for setting in &group.settings {
|
||||||
*default_bytes.get_mut(setting.byte_offset as usize).unwrap() |= setting.default_byte();
|
*default_bytes.get_mut(setting.byte_offset as usize).unwrap() |= setting.default_byte();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
|
|||||||
|
|
||||||
fn put2(&mut self, x: u16) {
|
fn put2(&mut self, x: u16) {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
write_unaligned(self.data.offset(self.offset) as *mut u16, x);
|
write_unaligned(self.data.offset(self.offset) as *mut u16, x);
|
||||||
}
|
}
|
||||||
self.offset += 2;
|
self.offset += 2;
|
||||||
@@ -97,7 +97,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
|
|||||||
|
|
||||||
fn put4(&mut self, x: u32) {
|
fn put4(&mut self, x: u32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
write_unaligned(self.data.offset(self.offset) as *mut u32, x);
|
write_unaligned(self.data.offset(self.offset) as *mut u32, x);
|
||||||
}
|
}
|
||||||
self.offset += 4;
|
self.offset += 4;
|
||||||
@@ -105,7 +105,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
|
|||||||
|
|
||||||
fn put8(&mut self, x: u64) {
|
fn put8(&mut self, x: u64) {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
write_unaligned(self.data.offset(self.offset) as *mut u64, x);
|
write_unaligned(self.data.offset(self.offset) as *mut u64, x);
|
||||||
}
|
}
|
||||||
self.offset += 8;
|
self.offset += 8;
|
||||||
|
|||||||
@@ -751,7 +751,7 @@ impl<'c, 'f> ir::InstInserterBase<'c> for &'c mut EncCursor<'f> {
|
|||||||
}
|
}
|
||||||
// Assign an encoding.
|
// Assign an encoding.
|
||||||
// XXX Is there a way to describe this error to the user?
|
// XXX Is there a way to describe this error to the user?
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(match_wild_err_arm))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::match_wild_err_arm))]
|
||||||
match self
|
match self
|
||||||
.isa
|
.isa
|
||||||
.encode(&self.func, &self.func.dfg[inst], ctrl_typevar)
|
.encode(&self.func, &self.func.dfg[inst], ctrl_typevar)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use crate::entity::EntityRef;
|
|||||||
use crate::ir::instructions::InstructionData;
|
use crate::ir::instructions::InstructionData;
|
||||||
use crate::ir::{DataFlowGraph, Function, Inst, Opcode};
|
use crate::ir::{DataFlowGraph, Function, Inst, Opcode};
|
||||||
use crate::timing;
|
use crate::timing;
|
||||||
use std::vec::Vec;
|
|
||||||
|
|
||||||
/// Test whether the given opcode is unsafe to even consider for DCE.
|
/// Test whether the given opcode is unsafe to even consider for DCE.
|
||||||
fn trivially_unsafe_for_dce(opcode: Opcode) -> bool {
|
fn trivially_unsafe_for_dce(opcode: Opcode) -> bool {
|
||||||
@@ -46,9 +45,7 @@ pub fn do_dce(func: &mut Function, domtree: &mut DominatorTree) {
|
|||||||
let _tt = timing::dce();
|
let _tt = timing::dce();
|
||||||
debug_assert!(domtree.is_valid());
|
debug_assert!(domtree.is_valid());
|
||||||
|
|
||||||
let mut live = Vec::with_capacity(func.dfg.num_values());
|
let mut live = vec![false; func.dfg.num_values()];
|
||||||
live.resize(func.dfg.num_values(), false);
|
|
||||||
|
|
||||||
for &ebb in domtree.cfg_postorder() {
|
for &ebb in domtree.cfg_postorder() {
|
||||||
let mut pos = FuncCursor::new(func).at_bottom(ebb);
|
let mut pos = FuncCursor::new(func).at_bottom(ebb);
|
||||||
while let Some(inst) = pos.prev_inst() {
|
while let Some(inst) = pos.prev_inst() {
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ mod tests {
|
|||||||
use super::{magic_s32, magic_s64, magic_u32, magic_u64};
|
use super::{magic_s32, magic_s64, magic_u32, magic_u64};
|
||||||
use super::{MS32, MS64, MU32, MU64};
|
use super::{MS32, MS64, MU32, MU64};
|
||||||
|
|
||||||
fn mkMU32(mul_by: u32, do_add: bool, shift_by: i32) -> MU32 {
|
fn make_mu32(mul_by: u32, do_add: bool, shift_by: i32) -> MU32 {
|
||||||
MU32 {
|
MU32 {
|
||||||
mul_by,
|
mul_by,
|
||||||
do_add,
|
do_add,
|
||||||
@@ -229,7 +229,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mkMU64(mul_by: u64, do_add: bool, shift_by: i32) -> MU64 {
|
fn make_mu64(mul_by: u64, do_add: bool, shift_by: i32) -> MU64 {
|
||||||
MU64 {
|
MU64 {
|
||||||
mul_by,
|
mul_by,
|
||||||
do_add,
|
do_add,
|
||||||
@@ -237,237 +237,282 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mkMS32(mul_by: i32, shift_by: i32) -> MS32 {
|
fn make_ms32(mul_by: i32, shift_by: i32) -> MS32 {
|
||||||
MS32 { mul_by, shift_by }
|
MS32 { mul_by, shift_by }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mkMS64(mul_by: i64, shift_by: i32) -> MS64 {
|
fn make_ms64(mul_by: i64, shift_by: i32) -> MS64 {
|
||||||
MS64 { mul_by, shift_by }
|
MS64 { mul_by, shift_by }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_magicU32() {
|
fn test_magicU32() {
|
||||||
assert_eq!(magic_u32(2u32), mkMU32(0x80000000u32, false, 0));
|
assert_eq!(magic_u32(2u32), make_mu32(0x80000000u32, false, 0));
|
||||||
assert_eq!(magic_u32(3u32), mkMU32(0xaaaaaaabu32, false, 1));
|
assert_eq!(magic_u32(3u32), make_mu32(0xaaaaaaabu32, false, 1));
|
||||||
assert_eq!(magic_u32(4u32), mkMU32(0x40000000u32, false, 0));
|
assert_eq!(magic_u32(4u32), make_mu32(0x40000000u32, false, 0));
|
||||||
assert_eq!(magic_u32(5u32), mkMU32(0xcccccccdu32, false, 2));
|
assert_eq!(magic_u32(5u32), make_mu32(0xcccccccdu32, false, 2));
|
||||||
assert_eq!(magic_u32(6u32), mkMU32(0xaaaaaaabu32, false, 2));
|
assert_eq!(magic_u32(6u32), make_mu32(0xaaaaaaabu32, false, 2));
|
||||||
assert_eq!(magic_u32(7u32), mkMU32(0x24924925u32, true, 3));
|
assert_eq!(magic_u32(7u32), make_mu32(0x24924925u32, true, 3));
|
||||||
assert_eq!(magic_u32(9u32), mkMU32(0x38e38e39u32, false, 1));
|
assert_eq!(magic_u32(9u32), make_mu32(0x38e38e39u32, false, 1));
|
||||||
assert_eq!(magic_u32(10u32), mkMU32(0xcccccccdu32, false, 3));
|
assert_eq!(magic_u32(10u32), make_mu32(0xcccccccdu32, false, 3));
|
||||||
assert_eq!(magic_u32(11u32), mkMU32(0xba2e8ba3u32, false, 3));
|
assert_eq!(magic_u32(11u32), make_mu32(0xba2e8ba3u32, false, 3));
|
||||||
assert_eq!(magic_u32(12u32), mkMU32(0xaaaaaaabu32, false, 3));
|
assert_eq!(magic_u32(12u32), make_mu32(0xaaaaaaabu32, false, 3));
|
||||||
assert_eq!(magic_u32(25u32), mkMU32(0x51eb851fu32, false, 3));
|
assert_eq!(magic_u32(25u32), make_mu32(0x51eb851fu32, false, 3));
|
||||||
assert_eq!(magic_u32(125u32), mkMU32(0x10624dd3u32, false, 3));
|
assert_eq!(magic_u32(125u32), make_mu32(0x10624dd3u32, false, 3));
|
||||||
assert_eq!(magic_u32(625u32), mkMU32(0xd1b71759u32, false, 9));
|
assert_eq!(magic_u32(625u32), make_mu32(0xd1b71759u32, false, 9));
|
||||||
assert_eq!(magic_u32(1337u32), mkMU32(0x88233b2bu32, true, 11));
|
assert_eq!(magic_u32(1337u32), make_mu32(0x88233b2bu32, true, 11));
|
||||||
assert_eq!(magic_u32(65535u32), mkMU32(0x80008001u32, false, 15));
|
assert_eq!(magic_u32(65535u32), make_mu32(0x80008001u32, false, 15));
|
||||||
assert_eq!(magic_u32(65536u32), mkMU32(0x00010000u32, false, 0));
|
assert_eq!(magic_u32(65536u32), make_mu32(0x00010000u32, false, 0));
|
||||||
assert_eq!(magic_u32(65537u32), mkMU32(0xffff0001u32, false, 16));
|
assert_eq!(magic_u32(65537u32), make_mu32(0xffff0001u32, false, 16));
|
||||||
assert_eq!(magic_u32(31415927u32), mkMU32(0x445b4553u32, false, 23));
|
assert_eq!(magic_u32(31415927u32), make_mu32(0x445b4553u32, false, 23));
|
||||||
assert_eq!(magic_u32(0xdeadbeefu32), mkMU32(0x93275ab3u32, false, 31));
|
assert_eq!(
|
||||||
assert_eq!(magic_u32(0xfffffffdu32), mkMU32(0x40000001u32, false, 30));
|
magic_u32(0xdeadbeefu32),
|
||||||
assert_eq!(magic_u32(0xfffffffeu32), mkMU32(0x00000003u32, true, 32));
|
make_mu32(0x93275ab3u32, false, 31)
|
||||||
assert_eq!(magic_u32(0xffffffffu32), mkMU32(0x80000001u32, false, 31));
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_u32(0xfffffffdu32),
|
||||||
|
make_mu32(0x40000001u32, false, 30)
|
||||||
|
);
|
||||||
|
assert_eq!(magic_u32(0xfffffffeu32), make_mu32(0x00000003u32, true, 32));
|
||||||
|
assert_eq!(
|
||||||
|
magic_u32(0xffffffffu32),
|
||||||
|
make_mu32(0x80000001u32, false, 31)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_magicU64() {
|
fn test_magicU64() {
|
||||||
assert_eq!(magic_u64(2u64), mkMU64(0x8000000000000000u64, false, 0));
|
assert_eq!(magic_u64(2u64), make_mu64(0x8000000000000000u64, false, 0));
|
||||||
assert_eq!(magic_u64(3u64), mkMU64(0xaaaaaaaaaaaaaaabu64, false, 1));
|
assert_eq!(magic_u64(3u64), make_mu64(0xaaaaaaaaaaaaaaabu64, false, 1));
|
||||||
assert_eq!(magic_u64(4u64), mkMU64(0x4000000000000000u64, false, 0));
|
assert_eq!(magic_u64(4u64), make_mu64(0x4000000000000000u64, false, 0));
|
||||||
assert_eq!(magic_u64(5u64), mkMU64(0xcccccccccccccccdu64, false, 2));
|
assert_eq!(magic_u64(5u64), make_mu64(0xcccccccccccccccdu64, false, 2));
|
||||||
assert_eq!(magic_u64(6u64), mkMU64(0xaaaaaaaaaaaaaaabu64, false, 2));
|
assert_eq!(magic_u64(6u64), make_mu64(0xaaaaaaaaaaaaaaabu64, false, 2));
|
||||||
assert_eq!(magic_u64(7u64), mkMU64(0x2492492492492493u64, true, 3));
|
assert_eq!(magic_u64(7u64), make_mu64(0x2492492492492493u64, true, 3));
|
||||||
assert_eq!(magic_u64(9u64), mkMU64(0xe38e38e38e38e38fu64, false, 3));
|
assert_eq!(magic_u64(9u64), make_mu64(0xe38e38e38e38e38fu64, false, 3));
|
||||||
assert_eq!(magic_u64(10u64), mkMU64(0xcccccccccccccccdu64, false, 3));
|
assert_eq!(magic_u64(10u64), make_mu64(0xcccccccccccccccdu64, false, 3));
|
||||||
assert_eq!(magic_u64(11u64), mkMU64(0x2e8ba2e8ba2e8ba3u64, false, 1));
|
assert_eq!(magic_u64(11u64), make_mu64(0x2e8ba2e8ba2e8ba3u64, false, 1));
|
||||||
assert_eq!(magic_u64(12u64), mkMU64(0xaaaaaaaaaaaaaaabu64, false, 3));
|
assert_eq!(magic_u64(12u64), make_mu64(0xaaaaaaaaaaaaaaabu64, false, 3));
|
||||||
assert_eq!(magic_u64(25u64), mkMU64(0x47ae147ae147ae15u64, true, 5));
|
assert_eq!(magic_u64(25u64), make_mu64(0x47ae147ae147ae15u64, true, 5));
|
||||||
assert_eq!(magic_u64(125u64), mkMU64(0x0624dd2f1a9fbe77u64, true, 7));
|
assert_eq!(magic_u64(125u64), make_mu64(0x0624dd2f1a9fbe77u64, true, 7));
|
||||||
assert_eq!(magic_u64(625u64), mkMU64(0x346dc5d63886594bu64, false, 7));
|
assert_eq!(
|
||||||
assert_eq!(magic_u64(1337u64), mkMU64(0xc4119d952866a139u64, false, 10));
|
magic_u64(625u64),
|
||||||
|
make_mu64(0x346dc5d63886594bu64, false, 7)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_u64(1337u64),
|
||||||
|
make_mu64(0xc4119d952866a139u64, false, 10)
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(31415927u64),
|
magic_u64(31415927u64),
|
||||||
mkMU64(0x116d154b9c3d2f85u64, true, 25)
|
make_mu64(0x116d154b9c3d2f85u64, true, 25)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x00000000deadbeefu64),
|
magic_u64(0x00000000deadbeefu64),
|
||||||
mkMU64(0x93275ab2dfc9094bu64, false, 31)
|
make_mu64(0x93275ab2dfc9094bu64, false, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x00000000fffffffdu64),
|
magic_u64(0x00000000fffffffdu64),
|
||||||
mkMU64(0x8000000180000005u64, false, 31)
|
make_mu64(0x8000000180000005u64, false, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x00000000fffffffeu64),
|
magic_u64(0x00000000fffffffeu64),
|
||||||
mkMU64(0x0000000200000005u64, true, 32)
|
make_mu64(0x0000000200000005u64, true, 32)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x00000000ffffffffu64),
|
magic_u64(0x00000000ffffffffu64),
|
||||||
mkMU64(0x8000000080000001u64, false, 31)
|
make_mu64(0x8000000080000001u64, false, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x0000000100000000u64),
|
magic_u64(0x0000000100000000u64),
|
||||||
mkMU64(0x0000000100000000u64, false, 0)
|
make_mu64(0x0000000100000000u64, false, 0)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x0000000100000001u64),
|
magic_u64(0x0000000100000001u64),
|
||||||
mkMU64(0xffffffff00000001u64, false, 32)
|
make_mu64(0xffffffff00000001u64, false, 32)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0x0ddc0ffeebadf00du64),
|
magic_u64(0x0ddc0ffeebadf00du64),
|
||||||
mkMU64(0x2788e9d394b77da1u64, true, 60)
|
make_mu64(0x2788e9d394b77da1u64, true, 60)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0xfffffffffffffffdu64),
|
magic_u64(0xfffffffffffffffdu64),
|
||||||
mkMU64(0x4000000000000001u64, false, 62)
|
make_mu64(0x4000000000000001u64, false, 62)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0xfffffffffffffffeu64),
|
magic_u64(0xfffffffffffffffeu64),
|
||||||
mkMU64(0x0000000000000003u64, true, 64)
|
make_mu64(0x0000000000000003u64, true, 64)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_u64(0xffffffffffffffffu64),
|
magic_u64(0xffffffffffffffffu64),
|
||||||
mkMU64(0x8000000000000001u64, false, 63)
|
make_mu64(0x8000000000000001u64, false, 63)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_magicS32() {
|
fn test_magicS32() {
|
||||||
assert_eq!(magic_s32(-0x80000000i32), mkMS32(0x7fffffffu32 as i32, 30));
|
assert_eq!(
|
||||||
assert_eq!(magic_s32(-0x7FFFFFFFi32), mkMS32(0xbfffffffu32 as i32, 29));
|
magic_s32(-0x80000000i32),
|
||||||
assert_eq!(magic_s32(-0x7FFFFFFEi32), mkMS32(0x7ffffffdu32 as i32, 30));
|
make_ms32(0x7fffffffu32 as i32, 30)
|
||||||
assert_eq!(magic_s32(-31415927i32), mkMS32(0xbba4baadu32 as i32, 23));
|
);
|
||||||
assert_eq!(magic_s32(-1337i32), mkMS32(0x9df73135u32 as i32, 9));
|
assert_eq!(
|
||||||
assert_eq!(magic_s32(-256i32), mkMS32(0x7fffffffu32 as i32, 7));
|
magic_s32(-0x7FFFFFFFi32),
|
||||||
assert_eq!(magic_s32(-5i32), mkMS32(0x99999999u32 as i32, 1));
|
make_ms32(0xbfffffffu32 as i32, 29)
|
||||||
assert_eq!(magic_s32(-3i32), mkMS32(0x55555555u32 as i32, 1));
|
);
|
||||||
assert_eq!(magic_s32(-2i32), mkMS32(0x7fffffffu32 as i32, 0));
|
assert_eq!(
|
||||||
assert_eq!(magic_s32(2i32), mkMS32(0x80000001u32 as i32, 0));
|
magic_s32(-0x7FFFFFFEi32),
|
||||||
assert_eq!(magic_s32(3i32), mkMS32(0x55555556u32 as i32, 0));
|
make_ms32(0x7ffffffdu32 as i32, 30)
|
||||||
assert_eq!(magic_s32(4i32), mkMS32(0x80000001u32 as i32, 1));
|
);
|
||||||
assert_eq!(magic_s32(5i32), mkMS32(0x66666667u32 as i32, 1));
|
assert_eq!(magic_s32(-31415927i32), make_ms32(0xbba4baadu32 as i32, 23));
|
||||||
assert_eq!(magic_s32(6i32), mkMS32(0x2aaaaaabu32 as i32, 0));
|
assert_eq!(magic_s32(-1337i32), make_ms32(0x9df73135u32 as i32, 9));
|
||||||
assert_eq!(magic_s32(7i32), mkMS32(0x92492493u32 as i32, 2));
|
assert_eq!(magic_s32(-256i32), make_ms32(0x7fffffffu32 as i32, 7));
|
||||||
assert_eq!(magic_s32(9i32), mkMS32(0x38e38e39u32 as i32, 1));
|
assert_eq!(magic_s32(-5i32), make_ms32(0x99999999u32 as i32, 1));
|
||||||
assert_eq!(magic_s32(10i32), mkMS32(0x66666667u32 as i32, 2));
|
assert_eq!(magic_s32(-3i32), make_ms32(0x55555555u32 as i32, 1));
|
||||||
assert_eq!(magic_s32(11i32), mkMS32(0x2e8ba2e9u32 as i32, 1));
|
assert_eq!(magic_s32(-2i32), make_ms32(0x7fffffffu32 as i32, 0));
|
||||||
assert_eq!(magic_s32(12i32), mkMS32(0x2aaaaaabu32 as i32, 1));
|
assert_eq!(magic_s32(2i32), make_ms32(0x80000001u32 as i32, 0));
|
||||||
assert_eq!(magic_s32(25i32), mkMS32(0x51eb851fu32 as i32, 3));
|
assert_eq!(magic_s32(3i32), make_ms32(0x55555556u32 as i32, 0));
|
||||||
assert_eq!(magic_s32(125i32), mkMS32(0x10624dd3u32 as i32, 3));
|
assert_eq!(magic_s32(4i32), make_ms32(0x80000001u32 as i32, 1));
|
||||||
assert_eq!(magic_s32(625i32), mkMS32(0x68db8badu32 as i32, 8));
|
assert_eq!(magic_s32(5i32), make_ms32(0x66666667u32 as i32, 1));
|
||||||
assert_eq!(magic_s32(1337i32), mkMS32(0x6208cecbu32 as i32, 9));
|
assert_eq!(magic_s32(6i32), make_ms32(0x2aaaaaabu32 as i32, 0));
|
||||||
assert_eq!(magic_s32(31415927i32), mkMS32(0x445b4553u32 as i32, 23));
|
assert_eq!(magic_s32(7i32), make_ms32(0x92492493u32 as i32, 2));
|
||||||
assert_eq!(magic_s32(0x7ffffffei32), mkMS32(0x80000003u32 as i32, 30));
|
assert_eq!(magic_s32(9i32), make_ms32(0x38e38e39u32 as i32, 1));
|
||||||
assert_eq!(magic_s32(0x7fffffffi32), mkMS32(0x40000001u32 as i32, 29));
|
assert_eq!(magic_s32(10i32), make_ms32(0x66666667u32 as i32, 2));
|
||||||
|
assert_eq!(magic_s32(11i32), make_ms32(0x2e8ba2e9u32 as i32, 1));
|
||||||
|
assert_eq!(magic_s32(12i32), make_ms32(0x2aaaaaabu32 as i32, 1));
|
||||||
|
assert_eq!(magic_s32(25i32), make_ms32(0x51eb851fu32 as i32, 3));
|
||||||
|
assert_eq!(magic_s32(125i32), make_ms32(0x10624dd3u32 as i32, 3));
|
||||||
|
assert_eq!(magic_s32(625i32), make_ms32(0x68db8badu32 as i32, 8));
|
||||||
|
assert_eq!(magic_s32(1337i32), make_ms32(0x6208cecbu32 as i32, 9));
|
||||||
|
assert_eq!(magic_s32(31415927i32), make_ms32(0x445b4553u32 as i32, 23));
|
||||||
|
assert_eq!(
|
||||||
|
magic_s32(0x7ffffffei32),
|
||||||
|
make_ms32(0x80000003u32 as i32, 30)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_s32(0x7fffffffi32),
|
||||||
|
make_ms32(0x40000001u32 as i32, 29)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_magicS64() {
|
fn test_magicS64() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0x8000000000000000i64),
|
magic_s64(-0x8000000000000000i64),
|
||||||
mkMS64(0x7fffffffffffffffu64 as i64, 62)
|
make_ms64(0x7fffffffffffffffu64 as i64, 62)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0x7FFFFFFFFFFFFFFFi64),
|
magic_s64(-0x7FFFFFFFFFFFFFFFi64),
|
||||||
mkMS64(0xbfffffffffffffffu64 as i64, 61)
|
make_ms64(0xbfffffffffffffffu64 as i64, 61)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0x7FFFFFFFFFFFFFFEi64),
|
magic_s64(-0x7FFFFFFFFFFFFFFEi64),
|
||||||
mkMS64(0x7ffffffffffffffdu64 as i64, 62)
|
make_ms64(0x7ffffffffffffffdu64 as i64, 62)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0x0ddC0ffeeBadF00di64),
|
magic_s64(-0x0ddC0ffeeBadF00di64),
|
||||||
mkMS64(0x6c3b8b1635a4412fu64 as i64, 59)
|
make_ms64(0x6c3b8b1635a4412fu64 as i64, 59)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0x100000001i64),
|
magic_s64(-0x100000001i64),
|
||||||
mkMS64(0x800000007fffffffu64 as i64, 31)
|
make_ms64(0x800000007fffffffu64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0x100000000i64),
|
magic_s64(-0x100000000i64),
|
||||||
mkMS64(0x7fffffffffffffffu64 as i64, 31)
|
make_ms64(0x7fffffffffffffffu64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0xFFFFFFFFi64),
|
magic_s64(-0xFFFFFFFFi64),
|
||||||
mkMS64(0x7fffffff7fffffffu64 as i64, 31)
|
make_ms64(0x7fffffff7fffffffu64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0xFFFFFFFEi64),
|
magic_s64(-0xFFFFFFFEi64),
|
||||||
mkMS64(0x7ffffffefffffffdu64 as i64, 31)
|
make_ms64(0x7ffffffefffffffdu64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0xFFFFFFFDi64),
|
magic_s64(-0xFFFFFFFDi64),
|
||||||
mkMS64(0x7ffffffe7ffffffbu64 as i64, 31)
|
make_ms64(0x7ffffffe7ffffffbu64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-0xDeadBeefi64),
|
magic_s64(-0xDeadBeefi64),
|
||||||
mkMS64(0x6cd8a54d2036f6b5u64 as i64, 31)
|
make_ms64(0x6cd8a54d2036f6b5u64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(-31415927i64),
|
magic_s64(-31415927i64),
|
||||||
mkMS64(0x7749755a31e1683du64 as i64, 24)
|
make_ms64(0x7749755a31e1683du64 as i64, 24)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_s64(-1337i64),
|
||||||
|
make_ms64(0x9df731356bccaf63u64 as i64, 9)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_s64(-256i64),
|
||||||
|
make_ms64(0x7fffffffffffffffu64 as i64, 7)
|
||||||
|
);
|
||||||
|
assert_eq!(magic_s64(-5i64), make_ms64(0x9999999999999999u64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(-3i64), make_ms64(0x5555555555555555u64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(-2i64), make_ms64(0x7fffffffffffffffu64 as i64, 0));
|
||||||
|
assert_eq!(magic_s64(2i64), make_ms64(0x8000000000000001u64 as i64, 0));
|
||||||
|
assert_eq!(magic_s64(3i64), make_ms64(0x5555555555555556u64 as i64, 0));
|
||||||
|
assert_eq!(magic_s64(4i64), make_ms64(0x8000000000000001u64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(5i64), make_ms64(0x6666666666666667u64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(6i64), make_ms64(0x2aaaaaaaaaaaaaabu64 as i64, 0));
|
||||||
|
assert_eq!(magic_s64(7i64), make_ms64(0x4924924924924925u64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(9i64), make_ms64(0x1c71c71c71c71c72u64 as i64, 0));
|
||||||
|
assert_eq!(magic_s64(10i64), make_ms64(0x6666666666666667u64 as i64, 2));
|
||||||
|
assert_eq!(magic_s64(11i64), make_ms64(0x2e8ba2e8ba2e8ba3u64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(12i64), make_ms64(0x2aaaaaaaaaaaaaabu64 as i64, 1));
|
||||||
|
assert_eq!(magic_s64(25i64), make_ms64(0xa3d70a3d70a3d70bu64 as i64, 4));
|
||||||
|
assert_eq!(
|
||||||
|
magic_s64(125i64),
|
||||||
|
make_ms64(0x20c49ba5e353f7cfu64 as i64, 4)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_s64(625i64),
|
||||||
|
make_ms64(0x346dc5d63886594bu64 as i64, 7)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
magic_s64(1337i64),
|
||||||
|
make_ms64(0x6208ceca9433509du64 as i64, 9)
|
||||||
);
|
);
|
||||||
assert_eq!(magic_s64(-1337i64), mkMS64(0x9df731356bccaf63u64 as i64, 9));
|
|
||||||
assert_eq!(magic_s64(-256i64), mkMS64(0x7fffffffffffffffu64 as i64, 7));
|
|
||||||
assert_eq!(magic_s64(-5i64), mkMS64(0x9999999999999999u64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(-3i64), mkMS64(0x5555555555555555u64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(-2i64), mkMS64(0x7fffffffffffffffu64 as i64, 0));
|
|
||||||
assert_eq!(magic_s64(2i64), mkMS64(0x8000000000000001u64 as i64, 0));
|
|
||||||
assert_eq!(magic_s64(3i64), mkMS64(0x5555555555555556u64 as i64, 0));
|
|
||||||
assert_eq!(magic_s64(4i64), mkMS64(0x8000000000000001u64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(5i64), mkMS64(0x6666666666666667u64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(6i64), mkMS64(0x2aaaaaaaaaaaaaabu64 as i64, 0));
|
|
||||||
assert_eq!(magic_s64(7i64), mkMS64(0x4924924924924925u64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(9i64), mkMS64(0x1c71c71c71c71c72u64 as i64, 0));
|
|
||||||
assert_eq!(magic_s64(10i64), mkMS64(0x6666666666666667u64 as i64, 2));
|
|
||||||
assert_eq!(magic_s64(11i64), mkMS64(0x2e8ba2e8ba2e8ba3u64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(12i64), mkMS64(0x2aaaaaaaaaaaaaabu64 as i64, 1));
|
|
||||||
assert_eq!(magic_s64(25i64), mkMS64(0xa3d70a3d70a3d70bu64 as i64, 4));
|
|
||||||
assert_eq!(magic_s64(125i64), mkMS64(0x20c49ba5e353f7cfu64 as i64, 4));
|
|
||||||
assert_eq!(magic_s64(625i64), mkMS64(0x346dc5d63886594bu64 as i64, 7));
|
|
||||||
assert_eq!(magic_s64(1337i64), mkMS64(0x6208ceca9433509du64 as i64, 9));
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(31415927i64),
|
magic_s64(31415927i64),
|
||||||
mkMS64(0x88b68aa5ce1e97c3u64 as i64, 24)
|
make_ms64(0x88b68aa5ce1e97c3u64 as i64, 24)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x00000000deadbeefi64),
|
magic_s64(0x00000000deadbeefi64),
|
||||||
mkMS64(0x93275ab2dfc9094bu64 as i64, 31)
|
make_ms64(0x93275ab2dfc9094bu64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x00000000fffffffdi64),
|
magic_s64(0x00000000fffffffdi64),
|
||||||
mkMS64(0x8000000180000005u64 as i64, 31)
|
make_ms64(0x8000000180000005u64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x00000000fffffffei64),
|
magic_s64(0x00000000fffffffei64),
|
||||||
mkMS64(0x8000000100000003u64 as i64, 31)
|
make_ms64(0x8000000100000003u64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x00000000ffffffffi64),
|
magic_s64(0x00000000ffffffffi64),
|
||||||
mkMS64(0x8000000080000001u64 as i64, 31)
|
make_ms64(0x8000000080000001u64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x0000000100000000i64),
|
magic_s64(0x0000000100000000i64),
|
||||||
mkMS64(0x8000000000000001u64 as i64, 31)
|
make_ms64(0x8000000000000001u64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x0000000100000001i64),
|
magic_s64(0x0000000100000001i64),
|
||||||
mkMS64(0x7fffffff80000001u64 as i64, 31)
|
make_ms64(0x7fffffff80000001u64 as i64, 31)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x0ddc0ffeebadf00di64),
|
magic_s64(0x0ddc0ffeebadf00di64),
|
||||||
mkMS64(0x93c474e9ca5bbed1u64 as i64, 59)
|
make_ms64(0x93c474e9ca5bbed1u64 as i64, 59)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x7ffffffffffffffdi64),
|
magic_s64(0x7ffffffffffffffdi64),
|
||||||
mkMS64(0x2000000000000001u64 as i64, 60)
|
make_ms64(0x2000000000000001u64 as i64, 60)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x7ffffffffffffffei64),
|
magic_s64(0x7ffffffffffffffei64),
|
||||||
mkMS64(0x8000000000000003u64 as i64, 62)
|
make_ms64(0x8000000000000003u64 as i64, 62)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
magic_s64(0x7fffffffffffffffi64),
|
magic_s64(0x7fffffffffffffffi64),
|
||||||
mkMS64(0x4000000000000001u64 as i64, 61)
|
make_ms64(0x4000000000000001u64 as i64, 61)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ pub enum GlobalValueData {
|
|||||||
/// Type of the loaded value.
|
/// Type of the loaded value.
|
||||||
global_type: Type,
|
global_type: Type,
|
||||||
|
|
||||||
/// Specifies whether the memory that this refers to is readonly, allowing for the elimination of redundant loads.
|
/// Specifies whether the memory that this refers to is readonly, allowing for the
|
||||||
|
/// elimination of redundant loads.
|
||||||
readonly: bool,
|
readonly: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -335,8 +335,8 @@ pub struct OpcodeConstraints {
|
|||||||
typeset_offset: u8,
|
typeset_offset: u8,
|
||||||
|
|
||||||
/// Offset into `OPERAND_CONSTRAINT` table of the descriptors for this opcode. The first
|
/// Offset into `OPERAND_CONSTRAINT` table of the descriptors for this opcode. The first
|
||||||
/// `num_fixed_results()` entries describe the result constraints, then follows constraints for the
|
/// `num_fixed_results()` entries describe the result constraints, then follows constraints for
|
||||||
/// fixed `Value` input operands. (`num_fixed_value_arguments()` of them).
|
/// the fixed `Value` input operands. (`num_fixed_value_arguments()` of them).
|
||||||
constraint_offset: u16,
|
constraint_offset: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ fn static_addr(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check `offset > limit` which is now known non-negative.
|
// Check `offset > limit` which is now known non-negative.
|
||||||
let limit = bound - u64::from(access_size);
|
let limit = bound - access_size;
|
||||||
|
|
||||||
// We may be able to omit the check entirely for 32-bit offsets if the heap bound is 4 GB or
|
// We may be able to omit the check entirely for 32-bit offsets if the heap bound is 4 GB or
|
||||||
// more.
|
// more.
|
||||||
|
|||||||
@@ -6,27 +6,27 @@
|
|||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(feature="cargo-clippy", allow(
|
#![cfg_attr(feature="cargo-clippy", allow(
|
||||||
// Produces only a false positive:
|
// Produces only a false positive:
|
||||||
while_let_loop,
|
clippy::while_let_loop,
|
||||||
// Produces many false positives, but did produce some valid lints, now fixed:
|
// Produces many false positives, but did produce some valid lints, now fixed:
|
||||||
needless_lifetimes,
|
clippy::needless_lifetimes,
|
||||||
// Generated code makes some style transgressions, but readability doesn't suffer much:
|
// Generated code makes some style transgressions, but readability doesn't suffer much:
|
||||||
many_single_char_names,
|
clippy::many_single_char_names,
|
||||||
identity_op,
|
clippy::identity_op,
|
||||||
needless_borrow,
|
clippy::needless_borrow,
|
||||||
cast_lossless,
|
clippy::cast_lossless,
|
||||||
unreadable_literal,
|
clippy::unreadable_literal,
|
||||||
assign_op_pattern,
|
clippy::assign_op_pattern,
|
||||||
empty_line_after_outer_attr,
|
clippy::empty_line_after_outer_attr,
|
||||||
// Hard to avoid in generated code:
|
// Hard to avoid in generated code:
|
||||||
cyclomatic_complexity,
|
clippy::cyclomatic_complexity,
|
||||||
too_many_arguments,
|
clippy::too_many_arguments,
|
||||||
// Code generator doesn't have a way to collapse identical arms:
|
// Code generator doesn't have a way to collapse identical arms:
|
||||||
match_same_arms,
|
clippy::match_same_arms,
|
||||||
// These are relatively minor style issues, but would be easy to fix:
|
// These are relatively minor style issues, but would be easy to fix:
|
||||||
new_without_default,
|
clippy::new_without_default,
|
||||||
new_without_default_derive,
|
clippy::new_without_default_derive,
|
||||||
should_implement_trait,
|
clippy::should_implement_trait,
|
||||||
len_without_is_empty))]
|
clippy::len_without_is_empty))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ fn remove_loop_invariant_instructions(
|
|||||||
loop_values.insert(*val);
|
loop_values.insert(*val);
|
||||||
}
|
}
|
||||||
pos.goto_top(*ebb);
|
pos.goto_top(*ebb);
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(block_in_if_condition_stmt))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::block_in_if_condition_stmt))]
|
||||||
while let Some(inst) = pos.next_inst() {
|
while let Some(inst) = pos.next_inst() {
|
||||||
if is_loop_invariant(inst, &pos.func.dfg, &loop_values) {
|
if is_loop_invariant(inst, &pos.func.dfg, &loop_values) {
|
||||||
// If all the instruction's argument are defined outside the loop
|
// If all the instruction's argument are defined outside the loop
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ impl Move {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the "from" register and register class, if possible.
|
/// Get the "from" register and register class, if possible.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(wrong_self_convention))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::wrong_self_convention))]
|
||||||
fn from_reg(&self) -> Option<(RegClass, RegUnit)> {
|
fn from_reg(&self) -> Option<(RegClass, RegUnit)> {
|
||||||
match *self {
|
match *self {
|
||||||
Move::Reg { rc, from, .. } | Move::Spill { rc, from, .. } => Some((rc, from)),
|
Move::Reg { rc, from, .. } | Move::Spill { rc, from, .. } => Some((rc, from)),
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ impl VirtRegs {
|
|||||||
///
|
///
|
||||||
/// If `value` belongs to a virtual register, the congruence class is the values of the virtual
|
/// If `value` belongs to a virtual register, the congruence class is the values of the virtual
|
||||||
/// register. Otherwise it is just the value itself.
|
/// register. Otherwise it is just the value itself.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(trivially_copy_pass_by_ref))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::trivially_copy_pass_by_ref))]
|
||||||
pub fn congruence_class<'a, 'b>(&'a self, value: &'b Value) -> &'b [Value]
|
pub fn congruence_class<'a, 'b>(&'a self, value: &'b Value) -> &'b [Value]
|
||||||
where
|
where
|
||||||
'a: 'b,
|
'a: 'b,
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
//!
|
//!
|
||||||
//! - [`PrimaryMap`](struct.PrimaryMap.html) is used to keep track of a vector of entities,
|
//! - [`PrimaryMap`](struct.PrimaryMap.html) is used to keep track of a vector of entities,
|
||||||
//! assigning a unique entity reference to each.
|
//! assigning a unique entity reference to each.
|
||||||
//! - [`SecondaryMap`](struct.SecondaryMap.html) is used to associate secondary information to an entity.
|
//! - [`SecondaryMap`](struct.SecondaryMap.html) is used to associate secondary information to an
|
||||||
//! The map is implemented as a simple vector, so it does not keep track of which entities have
|
//! entity. The map is implemented as a simple vector, so it does not keep track of which
|
||||||
//! been inserted. Instead, any unknown entities map to the default value.
|
//! entities have been inserted. Instead, any unknown entities map to the default value.
|
||||||
//! - [`SparseMap`](struct.SparseMap.html) is used to associate secondary information to a small
|
//! - [`SparseMap`](struct.SparseMap.html) is used to associate secondary information to a small
|
||||||
//! number of entities. It tracks accurately which entities have been inserted. This is a
|
//! number of entities. It tracks accurately which entities have been inserted. This is a
|
||||||
//! specialized data structure which can use a lot of memory, so read the documentation before
|
//! specialized data structure which can use a lot of memory, so read the documentation before
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
allow(new_without_default, new_without_default_derive)
|
allow(clippy::new_without_default, clippy::new_without_default_derive)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ use std::vec::Vec;
|
|||||||
/// A mapping `K -> V` for densely indexed entity references.
|
/// A mapping `K -> V` for densely indexed entity references.
|
||||||
///
|
///
|
||||||
/// The `SecondaryMap` data structure uses the dense index space to implement a map with a vector.
|
/// The `SecondaryMap` data structure uses the dense index space to implement a map with a vector.
|
||||||
/// Unlike `PrimaryMap`, an `SecondaryMap` can't be used to allocate entity references. It is used to
|
/// Unlike `PrimaryMap`, an `SecondaryMap` can't be used to allocate entity references. It is used
|
||||||
/// associate secondary information with entities.
|
/// to associate secondary information with entities.
|
||||||
///
|
///
|
||||||
/// The map does not track if an entry for a key has been inserted or not. Instead it behaves as if
|
/// The map does not track if an entry for a key has been inserted or not. Instead it behaves as if
|
||||||
/// all keys have a default entry from the beginning.
|
/// all keys have a default entry from the beginning.
|
||||||
|
|||||||
@@ -37,19 +37,20 @@ pub trait SparseMapValue<K> {
|
|||||||
///
|
///
|
||||||
/// # Compared to `SecondaryMap`
|
/// # Compared to `SecondaryMap`
|
||||||
///
|
///
|
||||||
/// When should we use a `SparseMap` instead of a secondary `SecondaryMap`? First of all, `SparseMap`
|
/// When should we use a `SparseMap` instead of a secondary `SecondaryMap`? First of all,
|
||||||
/// does not provide the functionality of a `PrimaryMap` which can allocate and assign entity
|
/// `SparseMap` does not provide the functionality of a `PrimaryMap` which can allocate and assign
|
||||||
/// references to objects as they are pushed onto the map. It is only the secondary entity maps
|
/// entity references to objects as they are pushed onto the map. It is only the secondary entity
|
||||||
/// that can be replaced with a `SparseMap`.
|
/// maps that can be replaced with a `SparseMap`.
|
||||||
///
|
///
|
||||||
/// - A secondary entity map assigns a default mapping to all keys. It doesn't distinguish between
|
/// - A secondary entity map assigns a default mapping to all keys. It doesn't distinguish between
|
||||||
/// an unmapped key and one that maps to the default value. `SparseMap` does not require
|
/// an unmapped key and one that maps to the default value. `SparseMap` does not require
|
||||||
/// `Default` values, and it tracks accurately if a key has been mapped or not.
|
/// `Default` values, and it tracks accurately if a key has been mapped or not.
|
||||||
/// - Iterating over the contents of an `SecondaryMap` is linear in the size of the *key space*, while
|
/// - Iterating over the contents of an `SecondaryMap` is linear in the size of the *key space*,
|
||||||
/// iterating over a `SparseMap` is linear in the number of elements in the mapping. This is an
|
/// while iterating over a `SparseMap` is linear in the number of elements in the mapping. This
|
||||||
/// advantage precisely when the mapping is sparse.
|
/// is an advantage precisely when the mapping is sparse.
|
||||||
/// - `SparseMap::clear()` is constant time and super-fast. `SecondaryMap::clear()` is linear in the
|
/// - `SparseMap::clear()` is constant time and super-fast. `SecondaryMap::clear()` is linear in
|
||||||
/// size of the key space. (Or, rather the required `resize()` call following the `clear()` is).
|
/// the size of the key space. (Or, rather the required `resize()` call following the `clear()`
|
||||||
|
/// is).
|
||||||
/// - `SparseMap` requires the values to implement `SparseMapValue<K>` which means that they must
|
/// - `SparseMap` requires the values to implement `SparseMapValue<K>` which means that they must
|
||||||
/// contain their own key.
|
/// contain their own key.
|
||||||
pub struct SparseMap<K, V>
|
pub struct SparseMap<K, V>
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ impl Backend for FaerieBackend {
|
|||||||
namespace: &ModuleNamespace<Self>,
|
namespace: &ModuleNamespace<Self>,
|
||||||
code_size: u32,
|
code_size: u32,
|
||||||
) -> ModuleResult<FaerieCompiledFunction> {
|
) -> ModuleResult<FaerieCompiledFunction> {
|
||||||
let mut code: Vec<u8> = Vec::with_capacity(code_size as usize);
|
let mut code: Vec<u8> = vec![0; code_size as usize];
|
||||||
code.resize(code_size as usize, 0);
|
|
||||||
|
|
||||||
// Non-lexical lifetimes would obviate the braces here.
|
// Non-lexical lifetimes would obviate the braces here.
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
allow(new_without_default, new_without_default_derive)
|
allow(clippy::new_without_default, clippy::new_without_default_derive)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
unstable_features
|
unstable_features
|
||||||
)]
|
)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::type_complexity))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ impl<'a> FunctionBuilder<'a> {
|
|||||||
///
|
///
|
||||||
/// Useful for debug purposes. Use it with `None` for standard printing.
|
/// Useful for debug purposes. Use it with `None` for standard printing.
|
||||||
// Clippy thinks the lifetime that follows is needless, but rustc needs it
|
// Clippy thinks the lifetime that follows is needless, but rustc needs it
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(needless_lifetimes))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_lifetimes))]
|
||||||
pub fn display<'b, I: Into<Option<&'b TargetIsa>>>(&'b self, isa: I) -> DisplayFunction {
|
pub fn display<'b, I: Into<Option<&'b TargetIsa>>>(&'b self, isa: I) -> DisplayFunction {
|
||||||
self.func.display(isa)
|
self.func.display(isa)
|
||||||
}
|
}
|
||||||
@@ -608,7 +608,7 @@ impl<'a> FunctionBuilder<'a> {
|
|||||||
"`size` is not a power of two"
|
"`size` is not a power of two"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
access_size >= ::std::cmp::min(src_align, dest_align) as u64,
|
access_size >= u64::from(::std::cmp::min(src_align, dest_align)),
|
||||||
"`size` is smaller than `dest` and `src`'s alignment value."
|
"`size` is smaller than `dest` and `src`'s alignment value."
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -689,7 +689,7 @@ impl<'a> FunctionBuilder<'a> {
|
|||||||
"`size` is not a power of two"
|
"`size` is not a power of two"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
access_size >= buffer_align as u64,
|
access_size >= u64::from(buffer_align),
|
||||||
"`size` is smaller than `dest` and `src`'s alignment value."
|
"`size` is smaller than `dest` and `src`'s alignment value."
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -702,14 +702,14 @@ impl<'a> FunctionBuilder<'a> {
|
|||||||
let load_and_store_amount = size / access_size;
|
let load_and_store_amount = size / access_size;
|
||||||
|
|
||||||
if load_and_store_amount > THRESHOLD {
|
if load_and_store_amount > THRESHOLD {
|
||||||
let ch = self.ins().iconst(types::I32, ch as i64);
|
let ch = self.ins().iconst(types::I32, i64::from(ch));
|
||||||
let size = self.ins().iconst(config.pointer_type(), size as i64);
|
let size = self.ins().iconst(config.pointer_type(), size as i64);
|
||||||
self.call_memset(config, buffer, ch, size);
|
self.call_memset(config, buffer, ch, size);
|
||||||
} else {
|
} else {
|
||||||
let mut flags = MemFlags::new();
|
let mut flags = MemFlags::new();
|
||||||
flags.set_aligned();
|
flags.set_aligned();
|
||||||
|
|
||||||
let ch = ch as u64;
|
let ch = u64::from(ch);
|
||||||
let raw_value = if int_type == types::I64 {
|
let raw_value = if int_type == types::I64 {
|
||||||
(ch << 32) | (ch << 16) | (ch << 8) | ch
|
(ch << 32) | (ch << 16) | (ch << 8) | ch
|
||||||
} else if int_type == types::I32 {
|
} else if int_type == types::I32 {
|
||||||
@@ -777,7 +777,7 @@ impl<'a> FunctionBuilder<'a> {
|
|||||||
"`size` is not a power of two"
|
"`size` is not a power of two"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
access_size >= ::std::cmp::min(src_align, dest_align) as u64,
|
access_size >= u64::from(::std::cmp::min(src_align, dest_align)),
|
||||||
"`size` is smaller than `dest` and `src`'s alignment value."
|
"`size` is smaller than `dest` and `src`'s alignment value."
|
||||||
);
|
);
|
||||||
let load_and_store_amount = size / access_size;
|
let load_and_store_amount = size / access_size;
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
|
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "std", deny(unstable_features))]
|
#![cfg_attr(feature = "std", deny(unstable_features))]
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default))]
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "std", deny(unstable_features))]
|
#![cfg_attr(feature = "std", deny(unstable_features))]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
)]
|
)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "std", deny(unstable_features))]
|
#![cfg_attr(feature = "std", deny(unstable_features))]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -11,10 +11,7 @@
|
|||||||
)]
|
)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ pub fn parse_test<'a>(
|
|||||||
let isa_spec: isaspec::IsaSpec;
|
let isa_spec: isaspec::IsaSpec;
|
||||||
let commands: Vec<TestCommand<'a>>;
|
let commands: Vec<TestCommand<'a>>;
|
||||||
|
|
||||||
// Check for specified passes and target, if present throw out test commands/targets specified in file.
|
// Check for specified passes and target, if present throw out test commands/targets specified
|
||||||
|
// in file.
|
||||||
match passes {
|
match passes {
|
||||||
Some(pass_vec) => {
|
Some(pass_vec) => {
|
||||||
parser.parse_test_commands();
|
parser.parse_test_commands();
|
||||||
@@ -338,7 +339,7 @@ impl<'a> Parser<'a> {
|
|||||||
// clippy says self.lookahead is immutable so this loop is either infinite or never
|
// clippy says self.lookahead is immutable so this loop is either infinite or never
|
||||||
// running. I don't think this is true - self.lookahead is mutated in the loop body - so
|
// running. I don't think this is true - self.lookahead is mutated in the loop body - so
|
||||||
// maybe this is a clippy bug? Either way, disable clippy for this.
|
// maybe this is a clippy bug? Either way, disable clippy for this.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(while_immutable_condition))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::while_immutable_condition))]
|
||||||
while self.lookahead == None {
|
while self.lookahead == None {
|
||||||
match self.lex.next() {
|
match self.lex.next() {
|
||||||
Some(Ok(LocatedToken { token, location })) => {
|
Some(Ok(LocatedToken { token, location })) => {
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
)]
|
)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -326,13 +326,13 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
|
|||||||
match reloc {
|
match reloc {
|
||||||
Reloc::Abs4 => {
|
Reloc::Abs4 => {
|
||||||
// TODO: Handle overflow.
|
// TODO: Handle overflow.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
unsafe {
|
unsafe {
|
||||||
write_unaligned(at as *mut u32, what as u32)
|
write_unaligned(at as *mut u32, what as u32)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reloc::Abs8 => {
|
Reloc::Abs8 => {
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
unsafe {
|
unsafe {
|
||||||
write_unaligned(at as *mut u64, what as u64)
|
write_unaligned(at as *mut u64, what as u64)
|
||||||
};
|
};
|
||||||
@@ -340,7 +340,7 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
|
|||||||
Reloc::X86PCRel4 | Reloc::X86CallPCRel4 => {
|
Reloc::X86PCRel4 | Reloc::X86CallPCRel4 => {
|
||||||
// TODO: Handle overflow.
|
// TODO: Handle overflow.
|
||||||
let pcrel = ((what as isize) - (at as isize)) as i32;
|
let pcrel = ((what as isize) - (at as isize)) as i32;
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
unsafe {
|
unsafe {
|
||||||
write_unaligned(at as *mut i32, pcrel)
|
write_unaligned(at as *mut i32, pcrel)
|
||||||
};
|
};
|
||||||
@@ -391,13 +391,13 @@ impl<'simple_jit_backend> Backend for SimpleJITBackend {
|
|||||||
match reloc {
|
match reloc {
|
||||||
Reloc::Abs4 => {
|
Reloc::Abs4 => {
|
||||||
// TODO: Handle overflow.
|
// TODO: Handle overflow.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
unsafe {
|
unsafe {
|
||||||
write_unaligned(at as *mut u32, what as u32)
|
write_unaligned(at as *mut u32, what as u32)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reloc::Abs8 => {
|
Reloc::Abs8 => {
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||||
unsafe {
|
unsafe {
|
||||||
write_unaligned(at as *mut u64, what as u64)
|
write_unaligned(at as *mut u64, what as u64)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
)]
|
)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
)]
|
)]
|
||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ use std::{i32, u32};
|
|||||||
use wasmparser::{MemoryImmediate, Operator};
|
use wasmparser::{MemoryImmediate, Operator};
|
||||||
|
|
||||||
// Clippy warns about "flags: _" but its important to document that the flags field is ignored
|
// Clippy warns about "flags: _" but its important to document that the flags field is ignored
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(unneeded_field_pattern))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::unneeded_field_pattern))]
|
||||||
/// Translates wasm operators into Cranelift IR instructions. Returns `true` if it inserted
|
/// Translates wasm operators into Cranelift IR instructions. Returns `true` if it inserted
|
||||||
/// a return.
|
/// a return.
|
||||||
pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
||||||
@@ -894,7 +894,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clippy warns us of some fields we are deliberately ignoring
|
// Clippy warns us of some fields we are deliberately ignoring
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(unneeded_field_pattern))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::unneeded_field_pattern))]
|
||||||
/// Deals with a Wasm instruction located in an unreachable portion of the code. Most of them
|
/// Deals with a Wasm instruction located in an unreachable portion of the code. Most of them
|
||||||
/// are dropped but special ones like `End` or `Else` signal the potential end of the unreachable
|
/// are dropped but special ones like `End` or `Else` signal the potential end of the unreachable
|
||||||
/// portion so the translation state must be updated accordingly.
|
/// portion so the translation state must be updated accordingly.
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
|
|||||||
let vmctx = func.create_global_value(ir::GlobalValueData::VMContext {});
|
let vmctx = func.create_global_value(ir::GlobalValueData::VMContext {});
|
||||||
GlobalVariable::Memory {
|
GlobalVariable::Memory {
|
||||||
gv: vmctx,
|
gv: vmctx,
|
||||||
offset: offset,
|
offset,
|
||||||
ty: self.mod_info.globals[index].entity.ty,
|
ty: self.mod_info.globals[index].entity.ty,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ pub trait FuncEnvironment {
|
|||||||
/// The signature `sig_ref` was previously created by `make_indirect_sig()`.
|
/// The signature `sig_ref` was previously created by `make_indirect_sig()`.
|
||||||
///
|
///
|
||||||
/// Return the call instruction whose results are the WebAssembly return values.
|
/// Return the call instruction whose results are the WebAssembly return values.
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments))]
|
||||||
fn translate_call_indirect(
|
fn translate_call_indirect(
|
||||||
&mut self,
|
&mut self,
|
||||||
pos: FuncCursor,
|
pos: FuncCursor,
|
||||||
|
|||||||
@@ -13,10 +13,7 @@
|
|||||||
#![warn(unused_import_braces)]
|
#![warn(unused_import_braces)]
|
||||||
#![cfg_attr(feature = "std", deny(unstable_features))]
|
#![cfg_attr(feature = "std", deny(unstable_features))]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(new_without_default, new_without_default_derive)
|
|
||||||
)]
|
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
|
|||||||
Reference in New Issue
Block a user