MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / global_code

Function global_code

crates/wasmtime/src/runtime/module/registry.rs:374–377  ·  view source on GitHub ↗

This is the global code registry that stores information for all loaded code objects that are currently in use by any `Store` in the current process. The purpose of this map is to be called from signal handlers to determine whether a program counter is a wasm trap or not. Specifically macOS has no contextual information about the thread available, hence the necessity for global state rather than

()

Source from the content-addressed store, hash-verified

372// registry. When a `ModuleRegistry` is destroyed then all of its entries
373// are removed from the global registry.
374fn global_code() -> &'static RwLock<GlobalRegistry> {
375 static GLOBAL_CODE: OnceLock<RwLock<GlobalRegistry>> = OnceLock::new();
376 GLOBAL_CODE.get_or_init(Default::default)
377}
378
379type GlobalRegistry = TryBTreeMap<usize, (usize, Arc<CodeMemory>)>;
380

Callers 3

lookup_codeFunction · 0.85
register_codeFunction · 0.85
unregister_codeFunction · 0.85

Calls 2

newFunction · 0.50
get_or_initMethod · 0.45

Tested by

no test coverage detected