mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
chore: get builtin module context without lock
This commit is contained in:
parent
0c7f02db18
commit
74d304a1b7
4 changed files with 15 additions and 10 deletions
|
@ -263,6 +263,14 @@ impl SharedModuleCache {
|
|||
ref_.get(path).map(|entry| &entry.module)
|
||||
}
|
||||
|
||||
// HACK: <builtins> is referenced very frequently and mutable references are not taken,
|
||||
// so it can be take without lock.
|
||||
pub fn raw_ref_builtins_ctx(&self) -> Option<&ModuleContext> {
|
||||
let ref_ = unsafe { self.0.as_ptr().as_ref().unwrap() };
|
||||
ref_.get(std::path::Path::new("<builtins>"))
|
||||
.map(|entry| &entry.module)
|
||||
}
|
||||
|
||||
pub fn register<P: Into<NormalizedPathBuf>>(
|
||||
&self,
|
||||
path: P,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue