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

This commit is contained in:
爱特每羊队
2026-08-10 17:56:28 +08:00
parent 61898f8983
commit d3ed1113ef
34 changed files with 421 additions and 1 deletions
+1
View File
@@ -9,6 +9,7 @@ description = "OxideJS - basic block partition and CFG analysis pass over IR"
[dependencies]
oxide_ir = { path = "../oxide_ir" }
oxide_bytecode = { path = "../oxide_bytecode" }
oxide_log = { path = "../oxide_log" }
[dev-dependencies]
oxide_parser = { path = "../oxide_parser" }
+37
View File
@@ -0,0 +1,37 @@
//! CFG 日志宏:`cfg_error!/warn!/info!/debug!/trace!`,经由 oxide_log 上报。
//! 编译管线属 Kernel 子系统,`OXIDE_LOG=oxide::kernel=debug` 控制本 crate 日志。
#[macro_export]
macro_rules! cfg_error {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::ERROR, $($arg)*)
};
}
#[macro_export]
macro_rules! cfg_warn {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::WARN, $($arg)*)
};
}
#[macro_export]
macro_rules! cfg_info {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::INFO, $($arg)*)
};
}
#[macro_export]
macro_rules! cfg_debug {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::DEBUG, $($arg)*)
};
}
#[macro_export]
macro_rules! cfg_trace {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::TRACE, $($arg)*)
};
}
+4 -1
View File
@@ -8,6 +8,7 @@
//! (异常边)→ `finalize`(exit 哨兵 + preds 反推)。每阶段是独立文件的纯函数,
//! 中间产物(heads / blocks / exit_id)显式传参,无共享可变状态。
mod cfg_log;
mod exception;
mod finalize;
mod partition;
@@ -93,7 +94,9 @@ pub fn build_cfg(f: &IRFunction) -> Cfg {
let heads = partition::partition_blocks(f);
let (mut blocks, exit_id) = split::split_and_edges(f, &heads);
exception::add_exception_edges(f, &mut blocks);
finalize::finalize(blocks, exit_id)
let cfg = finalize::finalize(blocks, exit_id);
cfg_debug!("build_cfg: {} blocks", cfg.blocks.len());
cfg
}
#[cfg(test)]