Move the signature_ids field first.

This commit is contained in:
Dan Gohman
2019-01-03 09:44:21 -08:00
parent e8e8f453a4
commit 482a054c75
3 changed files with 40 additions and 24 deletions

View File

@@ -59,6 +59,9 @@ pub struct FuncEnvironment<'module_environment> {
/// The Cranelift global holding the vmctx address.
vmctx: Option<ir::GlobalValue>,
/// The Cranelift global holding the base address of the signature IDs vector.
signature_ids_base: Option<ir::GlobalValue>,
/// The Cranelift global holding the base address of the imported functions table.
imported_functions_base: Option<ir::GlobalValue>,
@@ -80,9 +83,6 @@ pub struct FuncEnvironment<'module_environment> {
/// The Cranelift global holding the base address of the globals vector.
globals_base: Option<ir::GlobalValue>,
/// The Cranelift global holding the base address of the signature IDs vector.
signature_ids_base: Option<ir::GlobalValue>,
/// The external function declaration for implementing wasm's `memory.size`
/// for locally-defined 32-bit memories.
memory32_size_extfunc: Option<FuncRef>,
@@ -109,6 +109,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
target_config,
module,
vmctx: None,
signature_ids_base: None,
imported_functions_base: None,
imported_tables_base: None,
imported_memories_base: None,
@@ -116,7 +117,6 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
tables_base: None,
memories_base: None,
globals_base: None,
signature_ids_base: None,
memory32_size_extfunc: None,
imported_memory32_size_extfunc: None,
memory_grow_extfunc: None,

View File

@@ -207,45 +207,45 @@ impl VMOffsets {
/// Offsets for `VMContext`.
impl VMOffsets {
/// The offset of the `signature_ids` field.
pub fn vmctx_signature_ids(&self) -> u8 {
0 * self.pointer_size
}
/// The offset of the `tables` field.
#[allow(clippy::erasing_op)]
pub fn vmctx_imported_functions(&self) -> u8 {
0 * self.pointer_size
1 * self.pointer_size
}
/// The offset of the `tables` field.
#[allow(clippy::identity_op)]
pub fn vmctx_imported_tables(&self) -> u8 {
1 * self.pointer_size
2 * self.pointer_size
}
/// The offset of the `memories` field.
pub fn vmctx_imported_memories(&self) -> u8 {
2 * self.pointer_size
3 * self.pointer_size
}
/// The offset of the `globals` field.
pub fn vmctx_imported_globals(&self) -> u8 {
3 * self.pointer_size
4 * self.pointer_size
}
/// The offset of the `tables` field.
pub fn vmctx_tables(&self) -> u8 {
4 * self.pointer_size
5 * self.pointer_size
}
/// The offset of the `memories` field.
pub fn vmctx_memories(&self) -> u8 {
5 * self.pointer_size
6 * self.pointer_size
}
/// The offset of the `globals` field.
pub fn vmctx_globals(&self) -> u8 {
6 * self.pointer_size
}
/// The offset of the `signature_ids` field.
pub fn vmctx_signature_ids(&self) -> u8 {
7 * self.pointer_size
}