pub struct WasmGlobal {
pub index: u32,
pub init: Option<GlobalInit>,
pub mutable: bool,
pub slot_bytes: u32,
pub float_or_v128: bool,
}Expand description
A WASM global’s declaration — its initial value and mutability (#237).
Needed so the native-pointer ABI can recognize a global whose initializer is
a linear-memory address (e.g. $__stack_pointer = 65536) and make it
__synth_wasm_data-relative, rather than reading it from an R9 globals table
the self-contained drop-in object can’t rely on.
Fields§
§index: u32Global index (defined globals; imported globals are not counted here).
init: Option<GlobalInit>The captured constant initializer (#237/#649): i32.const or
i64.const. Float/non-const init exprs decode to None — see
GlobalInit.
mutable: boolWhether the global is mutable.
slot_bytes: u32#643: byte width of the global’s storage slot, from its declared value
type — 4 for i32/f32, 8 for i64/f64, 16 for v128. The globals table is
laid out by SUMMING these widths (not index * 4): an i64 global needs
room for both words, and every later global’s offset shifts with it.
float_or_v128: boolRQ-59-GLOBALINIT (#1052): declared content type is f32/f64/v128.
Those globals’ initializers are deliberately uncaptured (init: None)
AND their access is the GI-FPU-001 (#369) / #680 loud-skip lane, so a
dropped initializer is unobservable through generated code. An
INTEGER global with init: None (a non-const init expr) has no such
cover — the relocatable-path init-materialization guard needs to tell
the two apart, and slot_bytes alone cannot (4 = i32 OR f32).
Trait Implementations§
Source§impl Clone for WasmGlobal
impl Clone for WasmGlobal
Source§fn clone(&self) -> WasmGlobal
fn clone(&self) -> WasmGlobal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more