feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志

This commit is contained in:
2026-08-10 17:56:28 +08:00
parent 9fa8ae5b5f
commit 8a53bfb584
34 changed files with 421 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
//! IR 日志宏:`ir_error!/warn!/info!/debug!/trace!`,经由 oxide_log 上报。
//! 编译管线属 Kernel 子系统,`OXIDE_LOG=oxide::kernel=debug` 控制本 crate 日志。
#[macro_export]
macro_rules! ir_error {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::ERROR, $($arg)*)
};
}
#[macro_export]
macro_rules! ir_warn {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::WARN, $($arg)*)
};
}
#[macro_export]
macro_rules! ir_info {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::INFO, $($arg)*)
};
}
#[macro_export]
macro_rules! ir_debug {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::DEBUG, $($arg)*)
};
}
#[macro_export]
macro_rules! ir_trace {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::TRACE, $($arg)*)
};
}
+1
View File
@@ -13,6 +13,7 @@
pub mod contract;
pub mod inst;
mod ir_log;
pub mod lower;
pub mod operand;
+1
View File
@@ -15,6 +15,7 @@ use crate::IRFunction;
/// IRFunction → CompiledModule 等价转换。溢出/标签错误消息为既有格式,逐字保持一致。
pub fn lower(f: &IRFunction) -> Result<CompiledModule, String> {
crate::ir_debug!("lower: {} insts", f.insts.len());
// 溢出检查 1:常量池(先于寄存器——超大常量池伴生的海量 vreg 会使后续检查的
// 稠密 bitset 表示爆内存;常量池超限是更基础的失效,先报它)
if f.const_overflow || f.constants.len() > u16::MAX as usize {