Rename the address field of Table/Memory/Global exports to definition.
For functions, `address` makes sense because it's the address of the function. Bt for Table/Memory/Global, it points to a `VM*Definition` field.
This commit is contained in:
@@ -21,7 +21,7 @@ pub enum Export {
|
||||
/// A table export value.
|
||||
Table {
|
||||
/// The address of the table descriptor.
|
||||
address: *mut VMTableDefinition,
|
||||
definition: *mut VMTableDefinition,
|
||||
/// Pointer to the containing VMContext.
|
||||
vmctx: *mut VMContext,
|
||||
/// The table declaration, used for compatibilty checking.
|
||||
@@ -31,7 +31,7 @@ pub enum Export {
|
||||
/// A memory export value.
|
||||
Memory {
|
||||
/// The address of the memory descriptor.
|
||||
address: *mut VMMemoryDefinition,
|
||||
definition: *mut VMMemoryDefinition,
|
||||
/// Pointer to the containing VMContext.
|
||||
vmctx: *mut VMContext,
|
||||
/// The memory declaration, used for compatibilty checking.
|
||||
@@ -41,7 +41,7 @@ pub enum Export {
|
||||
/// A global export value.
|
||||
Global {
|
||||
/// The address of the global storage.
|
||||
address: *mut VMGlobalDefinition,
|
||||
definition: *mut VMGlobalDefinition,
|
||||
/// The global declaration, used for compatibilty checking.
|
||||
global: Global,
|
||||
},
|
||||
@@ -62,9 +62,13 @@ impl Export {
|
||||
}
|
||||
|
||||
/// Construct a table export value.
|
||||
pub fn table(address: *mut VMTableDefinition, vmctx: *mut VMContext, table: TablePlan) -> Self {
|
||||
pub fn table(
|
||||
definition: *mut VMTableDefinition,
|
||||
vmctx: *mut VMContext,
|
||||
table: TablePlan,
|
||||
) -> Self {
|
||||
Export::Table {
|
||||
address,
|
||||
definition,
|
||||
vmctx,
|
||||
table,
|
||||
}
|
||||
@@ -72,19 +76,19 @@ impl Export {
|
||||
|
||||
/// Construct a memory export value.
|
||||
pub fn memory(
|
||||
address: *mut VMMemoryDefinition,
|
||||
definition: *mut VMMemoryDefinition,
|
||||
vmctx: *mut VMContext,
|
||||
memory: MemoryPlan,
|
||||
) -> Self {
|
||||
Export::Memory {
|
||||
address,
|
||||
definition,
|
||||
vmctx,
|
||||
memory,
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct a global export value.
|
||||
pub fn global(address: *mut VMGlobalDefinition, global: Global) -> Self {
|
||||
Export::Global { address, global }
|
||||
pub fn global(definition: *mut VMGlobalDefinition, global: Global) -> Self {
|
||||
Export::Global { definition, global }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ impl Instance {
|
||||
}
|
||||
}
|
||||
wasmtime_environ::Export::Table(index) => {
|
||||
let (address, vmctx) = if let Some(def_index) =
|
||||
let (definition, vmctx) = if let Some(def_index) =
|
||||
self.module.defined_table_index(*index)
|
||||
{
|
||||
(
|
||||
@@ -272,13 +272,13 @@ impl Instance {
|
||||
(import.from, import.vmctx)
|
||||
};
|
||||
Export::Table {
|
||||
address,
|
||||
definition,
|
||||
vmctx,
|
||||
table: self.module.table_plans[*index].clone(),
|
||||
}
|
||||
}
|
||||
wasmtime_environ::Export::Memory(index) => {
|
||||
let (address, vmctx) = if let Some(def_index) =
|
||||
let (definition, vmctx) = if let Some(def_index) =
|
||||
self.module.defined_memory_index(*index)
|
||||
{
|
||||
(
|
||||
@@ -290,13 +290,13 @@ impl Instance {
|
||||
(import.from, import.vmctx)
|
||||
};
|
||||
Export::Memory {
|
||||
address,
|
||||
definition,
|
||||
vmctx,
|
||||
memory: self.module.memory_plans[*index].clone(),
|
||||
}
|
||||
}
|
||||
wasmtime_environ::Export::Global(index) => Export::Global {
|
||||
address: if let Some(def_index) = self.module.defined_global_index(*index) {
|
||||
definition: if let Some(def_index) = self.module.defined_global_index(*index) {
|
||||
unsafe { self.vmctx.global_mut(def_index) }
|
||||
} else {
|
||||
unsafe { self.vmctx.imported_global(*index).from }
|
||||
|
||||
Reference in New Issue
Block a user