minor interupt on halt responsivity improvement and final Cargo.toml args

This commit is contained in:
Mwa
2026-03-20 19:30:00 +01:00
parent b5962c6b50
commit af111c5992
4 changed files with 19 additions and 14 deletions

2
.cargo/config.toml Normal file
View File

@@ -0,0 +1,2 @@
[build]
rustflags = ["-Ctarget-cpu=native"]

View File

@@ -3,4 +3,5 @@ resolver = "3"
members = ["simu","asm","bitmap_to_asm"]
[profile.release]
debug = "line-tables-only"
opt-level = 2
# panic = "abort"

View File

@@ -2,7 +2,7 @@ use crate::wait::WaitOnAtomic;
#[cfg(feature = "debug")]
use std::collections::HashMap;
use std::{
hint::{likely, unlikely, unreachable_unchecked},
hint::{cold_path, likely, unlikely, unreachable_unchecked},
io::Read,
mem::transmute,
ops::{Index, IndexMut},
@@ -518,6 +518,7 @@ impl Computer {
(&SHARED.external_enabled_interupts)
.store(self[reg1], std::sync::atomic::Ordering::Relaxed);
} else {
cold_path();
self.serve_interupt(InteruptKind::IllegalOpcode, [next_opcode]);
}
}
@@ -563,6 +564,7 @@ impl Computer {
}
//guaranted by the inequality and is multiple of 4
_ => {
cold_path();
self.serve_interupt(
InteruptKind::IllegalOpcode,
[next_opcode],
@@ -612,6 +614,7 @@ impl Computer {
println!("awaiting interupt...");
}
SHARED.external_interupts.wait(0);
return;
}
self.pc = ((addr + self.pc as u32) & 0x1FFF_FFFF) as usize;
}
@@ -729,7 +732,11 @@ impl Computer {
kind,
[rx.0.into(), self[ry], self.resolve(op2), opcode],
),
InteruptKind::IllegalOpcode => self.serve_interupt(kind, [next_opcode]),
InteruptKind::IllegalOpcode => {
cold_path();
self.serve_interupt(kind, [next_opcode])
}
_ => unsafe { unreachable_unchecked() },
}
}

View File

@@ -1,9 +1,4 @@
#![feature(
likely_unlikely,
widening_mul,
sync_unsafe_cell,
int_lowest_highest_one
)]
#![feature(likely_unlikely, widening_mul, int_lowest_highest_one)]
#![deny(clippy::all)]
use std::env::args;
@@ -69,7 +64,8 @@ impl<'a> ApplicationHandler for App<'a> {
let surface_texture = SurfaceTexture::new(size.width, size.height, window);
let pix = PixelsBuilder::new(WIDTH, HEIGHT, surface_texture)
.clear_color(Color::BLACK)
.blend_state(BlendState::REPLACE).build() ;
.blend_state(BlendState::REPLACE)
.build();
self.pixels = Some(pix.unwrap());
}
@@ -214,8 +210,7 @@ impl<'a> ApplicationHandler for App<'a> {
#[cfg(not(feature = "rgba"))]
let rgba: [u8; 4] = raw.to_le_bytes();
#[cfg(feature = "rgba")]
let rgba =
raw.to_be_bytes();
let rgba = raw.to_be_bytes();
for i in 0..4 {
screen[addr * 4 + i] = rgba[i];
}