fixing a leaked reg bug when constant happens

This commit is contained in:
Jakub Doka 2024-09-30 21:55:34 +02:00
parent 6b7572f089
commit 802e8b5d55
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
4 changed files with 5 additions and 3 deletions

View file

@ -1242,6 +1242,7 @@ impl Codegen {
self.ci.emit(neg(dst.get(), oper.get())); self.ci.emit(neg(dst.get(), oper.get()));
self.ci.free_loc(drop_loc); self.ci.free_loc(drop_loc);
self.ci.regs.free(oper);
Some(Value::new(value.ty, dst)) Some(Value::new(value.ty, dst))
} }

View file

@ -20,8 +20,8 @@ use {
pub struct Logger; pub struct Logger;
impl log::Log for Logger { impl log::Log for Logger {
fn enabled(&self, metadata: &log::Metadata) -> bool { fn enabled(&self, _: &log::Metadata) -> bool {
log::max_level() >= metadata.level() true
} }
fn log(&self, record: &log::Record) { fn log(&self, record: &log::Record) {

View file

@ -3,9 +3,11 @@ fn main() -> std::io::Result<()> {
use std::io::Write; use std::io::Write;
log::set_logger(&hblang::Logger).unwrap(); log::set_logger(&hblang::Logger).unwrap();
log::set_max_level(log::LevelFilter::Error);
let args = std::env::args().collect::<Vec<_>>(); let args = std::env::args().collect::<Vec<_>>();
let args = args.iter().map(String::as_str).collect::<Vec<_>>(); let args = args.iter().map(String::as_str).collect::<Vec<_>>();
let opts = hblang::Options::from_args(&args)?; let opts = hblang::Options::from_args(&args)?;
let file = args.iter().filter(|a| !a.starts_with('-')).nth(1).copied().unwrap_or("main.hb"); let file = args.iter().filter(|a| !a.starts_with('-')).nth(1).copied().unwrap_or("main.hb");

View file

@ -1314,7 +1314,6 @@ pub fn report_to(
_ = writeln!(out, "{}", line.replace("\t", " ")); _ = writeln!(out, "{}", line.replace("\t", " "));
_ = writeln!(out, "{}^", " ".repeat(col - 1)); _ = writeln!(out, "{}^", " ".repeat(col - 1));
todo!()
} }
#[derive(PartialEq, Eq, Hash)] #[derive(PartialEq, Eq, Hash)]