refactor: 扁平化对象属性存储并优化常量池与 IC 热路径

This commit is contained in:
2026-06-13 23:59:47 +08:00
parent 7b13bbbd7d
commit 551695bfad
26 changed files with 307 additions and 87 deletions
+8
View File
@@ -24,6 +24,14 @@ struct StringForgeInner {
entries: Vec<StringEntry>,
}
/// Global string interning pool shared by all VMs.
///
/// Concurrency model:
/// `StringForge` keeps a single `RwLock` around the interner state.
/// - `lookup()` takes a shared read lock and scales across readers.
/// - `intern()` uses a read-check then write-check pattern to keep hot-path hits cheap.
/// - New string insertion is serialized, which matches the workload here: most strings
/// are interned early and later accesses are dominated by reads.
pub struct StringForge {
inner: RwLock<StringForgeInner>,
}