diff options
author | iximeow <me@iximeow.net> | 2019-02-09 03:55:01 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 16:10:13 -0800 |
commit | 5697c17af9ba0854f37edc5970ec862c446002d2 (patch) | |
tree | 4f0a35ca1335d1119408405d68ec8270e556e0f4 /src/lib.rs | |
parent | 754f0740b41dea0354abcf6d0a4b82a61b2d7638 (diff) |
some more inlining hints that appear to help cargo bench do things good
(this nets another 15% runtime improvement)
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -13,6 +13,7 @@ pub struct RegSpec { } impl RegSpec { + #[inline] fn from_parts(num: u8, extended: bool, bank: RegisterBank) -> RegSpec { RegSpec { num: num + if extended { 0b1000 } else { 0 }, @@ -20,6 +21,7 @@ impl RegSpec { } } + #[inline] fn gp_from_parts(num: u8, extended: bool, width: u8, rex: bool) -> RegSpec { // println!("from_parts width: {}, num: {}, extended: {}", width, num, extended); RegSpec { @@ -28,6 +30,7 @@ impl RegSpec { } } + #[inline] fn RIP() -> RegSpec { RegSpec { num: 0, @@ -35,6 +38,7 @@ impl RegSpec { } } + #[inline] fn EIP() -> RegSpec { RegSpec { num: 0, @@ -1451,6 +1455,7 @@ fn read_E<'a, T: Iterator<Item=&'a u8>>(bytes_iter: &mut T, prefixes: &Prefixes, Ok(()) } +#[inline] fn read_operands<'a, T: Iterator<Item=&'a u8>>( bytes_iter: &mut T, instruction: &mut Instruction, @@ -1979,6 +1984,7 @@ fn read_operands<'a, T: Iterator<Item=&'a u8>>( } } +#[inline] fn width_to_gp_reg_bank(width: u8, rex: bool) -> RegisterBank { use std::hint::unreachable_unchecked; match width { @@ -2015,6 +2021,7 @@ pub fn decode_one<'a, 'b, T: IntoIterator<Item=&'a u8>>(bytes: T, instr: &'b mut } } +#[inline] fn read_num<'a, T: Iterator<Item=&'a u8>>(bytes: &mut T, width: u8) -> u64 { let mut result = 0u64; let mut idx = 0; |