mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-23 17:51:33 +00:00
Avoid invoking a function pointer with JsStatic
The previous codegen wasn't enough to convince LLVM that the function pointer was a constant value and could be aggressively inlined, so this updates the `JsStatic` internals slightly to guarantee to LLVM that the function pointer is constant and no dynamic dispatch is needed after all
This commit is contained in:
@ -303,9 +303,9 @@ impl Drop for JsValue {
|
||||
///
|
||||
/// This type implements `Deref` to the inner type so it's typically used as if
|
||||
/// it were `&T`.
|
||||
pub struct JsStatic<T> {
|
||||
pub struct JsStatic<T: 'static> {
|
||||
#[doc(hidden)]
|
||||
pub __inner: UnsafeCell<Option<T>>,
|
||||
pub __inner: &'static UnsafeCell<Option<T>>,
|
||||
#[doc(hidden)]
|
||||
pub __init: fn() -> T,
|
||||
}
|
||||
|
Reference in New Issue
Block a user