From 7e1257a84d02e9c71930379e5598c7a166eb684d Mon Sep 17 00:00:00 2001 From: Erin Date: Wed, 26 Jul 2023 20:54:24 +0200 Subject: [PATCH] Nightly opts --- hbvm/Cargo.toml | 1 + hbvm/src/lib.rs | 3 +++ hbvm/src/mem/bmc.rs | 1 + hbvm/src/mem/mod.rs | 1 + 4 files changed, 6 insertions(+) diff --git a/hbvm/Cargo.toml b/hbvm/Cargo.toml index 87b74fa..98d8051 100644 --- a/hbvm/Cargo.toml +++ b/hbvm/Cargo.toml @@ -9,6 +9,7 @@ lto = true [features] default = ["alloc"] alloc = [] +nightly = [] [dependencies] delegate = "0.9" diff --git a/hbvm/src/lib.rs b/hbvm/src/lib.rs index e9a01e3..8e07bb5 100644 --- a/hbvm/src/lib.rs +++ b/hbvm/src/lib.rs @@ -12,6 +12,8 @@ #![no_std] +#![cfg_attr(feature = "nightly", feature(fn_align))] + #[cfg(feature = "alloc")] extern crate alloc; @@ -90,6 +92,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> /// Execute program /// /// Program can return [`VmRunError`] if a trap handling failed + #[cfg_attr(feature = "nightly", repr(align(4096)))] pub fn run(&mut self) -> Result { use hbbytecode::opcode::*; loop { diff --git a/hbvm/src/mem/bmc.rs b/hbvm/src/mem/bmc.rs index 7c4551a..35d282d 100644 --- a/hbvm/src/mem/bmc.rs +++ b/hbvm/src/mem/bmc.rs @@ -26,6 +26,7 @@ pub struct BlockCopier { } impl BlockCopier { + #[inline] pub fn new(src: u64, dst: u64, count: usize) -> Self { Self { src, diff --git a/hbvm/src/mem/mod.rs b/hbvm/src/mem/mod.rs index 1c230c2..8ef07b3 100644 --- a/hbvm/src/mem/mod.rs +++ b/hbvm/src/mem/mod.rs @@ -310,6 +310,7 @@ struct AddrPageLookuper { impl AddrPageLookuper { /// Create a new page lookuper + #[inline] pub const fn new(addr: u64, size: usize, pagetable: *const PageTable) -> Self { Self { addr,