fixing hbbytecode having the std mentioned
This commit is contained in:
parent
6057e88034
commit
0e9f4402cb
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -173,7 +173,6 @@ version = "0.10.2"
|
||||||
source = "git+https://github.com/jakubDoka/regalloc2#52b2bbe908e78af1715de88f562f62a83e36ca96"
|
source = "git+https://github.com/jakubDoka/regalloc2#52b2bbe908e78af1715de88f562f62a83e36ca96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"log",
|
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl TryFrom<u8> for Instr {
|
||||||
}
|
}
|
||||||
|
|
||||||
if value < NAMES.len() as u8 {
|
if value < NAMES.len() as u8 {
|
||||||
unsafe { Ok(std::mem::transmute::<u8, Instr>(value)) }
|
unsafe { Ok(core::mem::transmute::<u8, Instr>(value)) }
|
||||||
} else {
|
} else {
|
||||||
failed(value)
|
failed(value)
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,9 @@ unsafe fn encode<T>(instr: T) -> (usize, [u8; instrs::MAX_SIZE]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg(feature = "disasm")]
|
||||||
fn decode<T>(binary: &mut &[u8]) -> Option<T> {
|
fn decode<T>(binary: &mut &[u8]) -> Option<T> {
|
||||||
let (front, rest) = std::mem::take(binary).split_at_checked(core::mem::size_of::<T>())?;
|
let (front, rest) = core::mem::take(binary).split_at_checked(core::mem::size_of::<T>())?;
|
||||||
*binary = rest;
|
*binary = rest;
|
||||||
unsafe { Some(core::ptr::read(front.as_ptr() as *const T)) }
|
unsafe { Some(core::ptr::read(front.as_ptr() as *const T)) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ path = "src/main.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hbbytecode = { version = "0.1.0", path = "../hbbytecode" }
|
hbbytecode = { version = "0.1.0", path = "../hbbytecode" }
|
||||||
hbvm = { path = "../hbvm", features = ["nightly"] }
|
hbvm = { path = "../hbvm", features = ["nightly"] }
|
||||||
regalloc2 = { git = "https://github.com/jakubDoka/regalloc2", features = ["trace-log"] }
|
regalloc2 = { git = "https://github.com/jakubDoka/regalloc2", features = [] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.11.5"
|
env_logger = "0.11.5"
|
||||||
|
|
|
@ -504,6 +504,14 @@ main := fn(): int {
|
||||||
if y == width break
|
if y == width break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width += 1
|
||||||
|
|
||||||
|
loop {
|
||||||
|
if width < y break
|
||||||
|
y += 1
|
||||||
|
}
|
||||||
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -1818,7 +1818,25 @@ impl Codegen {
|
||||||
std::mem::swap(&mut env.preferred_regs_by_class, &mut env.non_preferred_regs_by_class);
|
std::mem::swap(&mut env.preferred_regs_by_class, &mut env.non_preferred_regs_by_class);
|
||||||
};
|
};
|
||||||
let options = regalloc2::RegallocOptions { verbose_log: false, validate_ssa: true };
|
let options = regalloc2::RegallocOptions { verbose_log: false, validate_ssa: true };
|
||||||
let output = regalloc2::run(&func, &env, &options).unwrap_or_else(|err| panic!("{err}"));
|
let iters = std::time::SystemTime::now()
|
||||||
|
.duration_since(std::time::SystemTime::UNIX_EPOCH)
|
||||||
|
.unwrap()
|
||||||
|
.as_nanos() as u32
|
||||||
|
% 300
|
||||||
|
+ 300;
|
||||||
|
let mut output =
|
||||||
|
regalloc2::run(&func, &env, &options).unwrap_or_else(|err| panic!("{err}"));
|
||||||
|
let now = std::time::Instant::now();
|
||||||
|
for i in 0..iters {
|
||||||
|
output = regalloc2::run(&func, &env, &options).unwrap_or_else(|err| panic!("{err}"));
|
||||||
|
if (iters + i) % 2 == 0 {
|
||||||
|
std::mem::swap(
|
||||||
|
&mut env.preferred_regs_by_class,
|
||||||
|
&mut env.non_preferred_regs_by_class,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eprintln!("took: {:?}", now.elapsed().checked_div(iters).unwrap());
|
||||||
|
|
||||||
let mut saved_regs = HashMap::<u8, u8>::default();
|
let mut saved_regs = HashMap::<u8, u8>::default();
|
||||||
let mut atr = |allc: regalloc2::Allocation| {
|
let mut atr = |allc: regalloc2::Allocation| {
|
||||||
|
|
Loading…
Reference in a new issue