mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Improved naming of Exportable to ImportableExportable
This commit is contained in:
parent
9f561db90b
commit
60b1520808
@ -22,7 +22,7 @@ use super::super::common::slice::{BoundedSlice, UncheckedSlice};
|
||||
use super::errors::ErrorKind;
|
||||
use super::import_object::{ImportObject, ImportValue};
|
||||
use super::memory::LinearMemory;
|
||||
use super::module::{Export, Exportable, Module};
|
||||
use super::module::{Export, ImportableExportable, Module};
|
||||
use super::relocation::{Reloc, RelocSink, RelocationType};
|
||||
use super::math_intrinsics;
|
||||
|
||||
@ -305,7 +305,7 @@ impl Instance {
|
||||
};
|
||||
|
||||
for (i, global) in module.info.globals.iter().enumerate() {
|
||||
let Exportable {entity, import_name, ..} = global;
|
||||
let ImportableExportable {entity, import_name, ..} = global;
|
||||
let value: i64 = match entity.initializer {
|
||||
GlobalInit::I32Const(n) => n as _,
|
||||
GlobalInit::I64Const(n) => n,
|
||||
|
@ -71,9 +71,9 @@ fn get_func_name(func_index: FuncIndex) -> ir::ExternalName {
|
||||
ir::ExternalName::user(0, func_index.index() as u32)
|
||||
}
|
||||
|
||||
/// A collection of names under which a given entity is exported.
|
||||
/// A collection of names under which a given entity is imported/exported.
|
||||
#[derive(Debug)]
|
||||
pub struct Exportable<T> {
|
||||
pub struct ImportableExportable<T> {
|
||||
/// An entity.
|
||||
pub entity: T,
|
||||
|
||||
@ -84,7 +84,7 @@ pub struct Exportable<T> {
|
||||
pub import_name: Option<(String, String)>,
|
||||
}
|
||||
|
||||
impl<T> Exportable<T> {
|
||||
impl<T> ImportableExportable<T> {
|
||||
pub fn new(entity: T, import_name: Option<(String, String)>) -> Self {
|
||||
Self {
|
||||
entity,
|
||||
@ -124,7 +124,7 @@ pub struct ModuleInfo {
|
||||
pub signatures: Vec<ir::Signature>,
|
||||
|
||||
/// Functions, imported and local.
|
||||
pub functions: PrimaryMap<FuncIndex, Exportable<SignatureIndex>>,
|
||||
pub functions: PrimaryMap<FuncIndex, ImportableExportable<SignatureIndex>>,
|
||||
|
||||
/// Function bodies.
|
||||
pub function_bodies: PrimaryMap<DefinedFuncIndex, ir::Function>,
|
||||
@ -133,7 +133,7 @@ pub struct ModuleInfo {
|
||||
pub imported_funcs: Vec<(String, String)>,
|
||||
|
||||
/// Tables as provided by `declare_table`.
|
||||
pub tables: Vec<Exportable<Table>>,
|
||||
pub tables: Vec<ImportableExportable<Table>>,
|
||||
|
||||
/// WebAssembly table initializers.
|
||||
pub table_elements: Vec<TableElements>,
|
||||
@ -142,13 +142,13 @@ pub struct ModuleInfo {
|
||||
pub tables_base: Option<ir::GlobalValue>,
|
||||
|
||||
/// Memories as provided by `declare_memory`.
|
||||
pub memories: Vec<Exportable<Memory>>,
|
||||
pub memories: Vec<ImportableExportable<Memory>>,
|
||||
|
||||
/// The Cranelift global holding the base address of the globals vector.
|
||||
pub globals_base: Option<ir::GlobalValue>,
|
||||
|
||||
/// Globals as provided by `declare_global`.
|
||||
pub globals: Vec<Exportable<Global>>,
|
||||
pub globals: Vec<ImportableExportable<Global>>,
|
||||
|
||||
/// The start function.
|
||||
pub start_func: Option<FuncIndex>,
|
||||
@ -158,7 +158,7 @@ pub struct ModuleInfo {
|
||||
|
||||
/// Exported entities
|
||||
/// We use this in order to have a O(1) allocation of the exports
|
||||
/// rather than iterating through the Exportable elements.
|
||||
/// rather than iterating through the ImportableExportable elements.
|
||||
pub exports: HashMap<String, Export>,
|
||||
|
||||
/// The external function declaration for implementing wasm's `current_memory`.
|
||||
@ -712,7 +712,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
self.info.imported_funcs.len(),
|
||||
"Imported functions must be declared first"
|
||||
);
|
||||
self.info.functions.push(Exportable::new(sig_index, None));
|
||||
self.info.functions.push(ImportableExportable::new(sig_index, None));
|
||||
self.info
|
||||
.imported_funcs
|
||||
.push((String::from(module), String::from(field)));
|
||||
@ -723,7 +723,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
}
|
||||
|
||||
fn declare_func_type(&mut self, sig_index: SignatureIndex) {
|
||||
self.info.functions.push(Exportable::new(sig_index, None));
|
||||
self.info.functions.push(ImportableExportable::new(sig_index, None));
|
||||
}
|
||||
|
||||
fn get_func_type(&self, func_index: FuncIndex) -> SignatureIndex {
|
||||
@ -731,7 +731,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
}
|
||||
|
||||
fn declare_global(&mut self, global: Global) {
|
||||
self.info.globals.push(Exportable::new(global, None));
|
||||
self.info.globals.push(ImportableExportable::new(global, None));
|
||||
}
|
||||
|
||||
fn declare_global_import(
|
||||
@ -740,7 +740,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
module: &'data str,
|
||||
field: &'data str,
|
||||
) {
|
||||
self.info.globals.push(Exportable::new(global, Some((String::from(module), String::from(field)))));
|
||||
self.info.globals.push(ImportableExportable::new(global, Some((String::from(module), String::from(field)))));
|
||||
}
|
||||
|
||||
fn get_global(&self, global_index: GlobalIndex) -> &Global {
|
||||
@ -748,7 +748,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
}
|
||||
|
||||
fn declare_table(&mut self, table: Table) {
|
||||
self.info.tables.push(Exportable::new(table, None));
|
||||
self.info.tables.push(ImportableExportable::new(table, None));
|
||||
}
|
||||
|
||||
fn declare_table_import(
|
||||
@ -757,7 +757,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
module: &'data str,
|
||||
field: &'data str,
|
||||
) {
|
||||
self.info.tables.push(Exportable::new(table, Some((String::from(module), String::from(field)))));
|
||||
self.info.tables.push(ImportableExportable::new(table, Some((String::from(module), String::from(field)))));
|
||||
}
|
||||
|
||||
fn declare_table_elements(
|
||||
@ -776,7 +776,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
}
|
||||
|
||||
fn declare_memory(&mut self, memory: Memory) {
|
||||
self.info.memories.push(Exportable::new(memory, None));
|
||||
self.info.memories.push(ImportableExportable::new(memory, None));
|
||||
}
|
||||
|
||||
fn declare_memory_import(
|
||||
@ -785,7 +785,7 @@ impl<'data> ModuleEnvironment<'data> for Module {
|
||||
module: &'data str,
|
||||
field: &'data str,
|
||||
) {
|
||||
self.info.memories.push(Exportable::new(memory, Some((String::from(module), String::from(field)))));
|
||||
self.info.memories.push(ImportableExportable::new(memory, Some((String::from(module), String::from(field)))));
|
||||
}
|
||||
|
||||
fn declare_data_initialization(
|
||||
|
Loading…
Reference in New Issue
Block a user