Struct cranelift_wasm::DummyEnvironment
source · pub struct DummyEnvironment {
pub info: DummyModuleInfo,
pub trans: FuncTranslator,
pub func_bytecode_sizes: Vec<usize>,
pub debug_info: bool,
pub module_name: Option<String>,
/* private fields */
}
Expand description
This ModuleEnvironment
implementation is a “naïve” one, doing essentially nothing and
emitting placeholders when forced to. Don’t try to execute code translated for this
environment, essentially here for translation debug purposes.
Fields§
§info: DummyModuleInfo
Module information.
trans: FuncTranslator
Function translation.
func_bytecode_sizes: Vec<usize>
Vector of wasm bytecode size for each function.
debug_info: bool
Instructs to collect debug data during translation.
module_name: Option<String>
Name of the module from the wasm file.
Implementations§
source§impl DummyEnvironment
impl DummyEnvironment
sourcepub fn new(config: TargetFrontendConfig, debug_info: bool) -> Self
pub fn new(config: TargetFrontendConfig, debug_info: bool) -> Self
Creates a new DummyEnvironment
instance.
sourcepub fn func_env(&self) -> DummyFuncEnvironment<'_>
pub fn func_env(&self) -> DummyFuncEnvironment<'_>
Return a DummyFuncEnvironment
for translating functions within this
DummyEnvironment
.
sourcepub fn get_func_type(&self, func_index: FuncIndex) -> TypeIndex
pub fn get_func_type(&self, func_index: FuncIndex) -> TypeIndex
Get the type for the function at the given index.
sourcepub fn get_num_func_imports(&self) -> usize
pub fn get_num_func_imports(&self) -> usize
Return the number of imported functions within this DummyEnvironment
.
sourcepub fn get_func_name(&self, func_index: FuncIndex) -> Option<&str>
pub fn get_func_name(&self, func_index: FuncIndex) -> Option<&str>
Return the name of the function, if a name for the function with the corresponding index exists.
sourcepub fn test_expected_reachability(&mut self, reachability: Vec<(bool, bool)>)
pub fn test_expected_reachability(&mut self, reachability: Vec<(bool, bool)>)
Test reachability bits before and after every opcode during translation, as provided by the
FuncTranslationState
. This is generally used only for unit tests. This is applied to
every function in the module (so is likely only useful for test modules with one function).