Migrate most of wasmtime from lazy_static to once_cell (#4368)
* Update tracing-core to a version which doesn't depend on lazy-static. * Update crossbeam-utils to a version that doesn't depend on lazy-static. * Update crossbeam-epoch to a version that doesn't depend on lazy-static. * Update clap to a version that doesn't depend on lazy-static. * Convert Wasmtime's own use of lazy_static to once_cell. * Make `GDB_REGISTRATION`'s comment a doc comment. * Fix compilation on Windows.
This commit is contained in:
@@ -11,7 +11,7 @@ readme = "README.md"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
lazy_static = {version = "1.3.0", optional = true }
|
||||
once_cell = {version = "1.12.0", optional = true }
|
||||
object = { version = "0.28.0", default-features = false, features = ["std", "read_core"], optional = true }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
@@ -21,5 +21,5 @@ rustix = { version = "0.35.6", features = ["mm", "param", "time"], optional = tr
|
||||
maintenance = { status = "actively-developed" }
|
||||
|
||||
[features]
|
||||
gdb_jit_int = ["lazy_static"]
|
||||
gdb_jit_int = ["once_cell"]
|
||||
perf_jitdump = ["rustix", "object"]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! the __jit_debug_register_code() and __jit_debug_descriptor to register
|
||||
//! or unregister generated object images with debuggers.
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::pin::Pin;
|
||||
use std::ptr;
|
||||
use std::sync::Mutex;
|
||||
@@ -32,15 +32,13 @@ extern "C" {
|
||||
fn __jit_debug_register_code();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
// The process controls access to the __jit_debug_descriptor by itself --
|
||||
// the GDB/LLDB accesses this structure and its data at the process startup
|
||||
// and when paused in __jit_debug_register_code.
|
||||
//
|
||||
// The GDB_REGISTRATION lock is needed for GdbJitImageRegistration to protect
|
||||
// access to the __jit_debug_descriptor within this process.
|
||||
pub static ref GDB_REGISTRATION: Mutex<()> = Mutex::new(Default::default());
|
||||
}
|
||||
/// The process controls access to the __jit_debug_descriptor by itself --
|
||||
/// the GDB/LLDB accesses this structure and its data at the process startup
|
||||
/// and when paused in __jit_debug_register_code.
|
||||
///
|
||||
/// The GDB_REGISTRATION lock is needed for GdbJitImageRegistration to protect
|
||||
/// access to the __jit_debug_descriptor within this process.
|
||||
static GDB_REGISTRATION: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(Default::default()));
|
||||
|
||||
/// Registeration for JIT image
|
||||
pub struct GdbJitImageRegistration {
|
||||
|
||||
Reference in New Issue
Block a user