Remove left-over prefetch code

This code is no longer needed now that we no longer use prefetching in
the garbage collector.
parent 725dd097
Pipeline #99332249 passed with stages
in 17 minutes and 26 seconds
......@@ -7,7 +7,6 @@ use std::io::{self, Write};
use std::process;
use libinko::config::Config;
use libinko::prefetch;
use libinko::vm::machine::Machine;
use libinko::vm::state::State;
......@@ -30,7 +29,6 @@ fn run() -> i32 {
options.parsing_style(ParsingStyle::StopAtFirstFree);
options.optflag("h", "help", "Shows this help message");
options.optflag("v", "version", "Prints the version number");
options.optflag("f", "features", "Displays the state of various features");
options.optmulti(
"I",
......@@ -58,13 +56,6 @@ fn run() -> i32 {
return 0;
}
if matches.opt_present("f") {
println!("Prefetching: {:?}", prefetch::ENABLED);
println!("SSE: {:?}", cfg!(target_feature = "sse"));
return 0;
}
if matches.free.is_empty() {
print_usage(&options);
......
......@@ -38,7 +38,6 @@ pub mod object;
pub mod object_pointer;
pub mod object_value;
pub mod platform;
pub mod prefetch;
pub mod process;
pub mod process_status;
pub mod register;
......
//! Support for CPU prefetching.
/// Indicates if prefetching is available.
pub const ENABLED: bool = cfg!(all(
any(target_arch = "x86", target_arch = "x86_64"),
target_feature = "sse"
));
/// Prefetches a pointer for a read operation.
///
/// On unsupported platforms this function will be a noop.
#[allow(unused_variables)]
pub fn prefetch_read<T>(pointer: *const T) {
#[cfg(all(target_arch = "x86", target_feature = "sse"))]
{
use std::arch::x86 as arch_impl;
unsafe {
arch_impl::_mm_prefetch(
pointer as *const i8,
arch_impl::_MM_HINT_NTA,
);
}
return;
}
#[cfg(all(target_arch = "x86_64", target_feature = "sse"))]
{
use std::arch::x86_64 as arch_impl;
unsafe {
arch_impl::_mm_prefetch(
pointer as *const i8,
arch_impl::_MM_HINT_NTA,
);
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_prefetch_read() {
// This is just a smoke test to see if the function blows up or not.
let thing = Box::new(10_u8);
let ptr = &*thing as *const u8;
prefetch_read(ptr);
// Mostly to make sure the code doesn't just get optimised away.
assert_eq!(unsafe { *ptr }, 10);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment