diff --git a/crates/environ/src/vmoffsets.rs b/crates/environ/src/vmoffsets.rs index f6f67cab92..9c0b97e80e 100644 --- a/crates/environ/src/vmoffsets.rs +++ b/crates/environ/src/vmoffsets.rs @@ -62,8 +62,6 @@ pub struct VMOffsets

{ pub num_imported_memories: u32, /// The number of imported globals in the module. pub num_imported_globals: u32, - /// The number of defined functions in the module. - pub num_defined_functions: u32, /// The number of defined tables in the module. pub num_defined_tables: u32, /// The number of defined memories in the module. @@ -129,8 +127,6 @@ pub struct VMOffsetsFields

{ pub num_imported_memories: u32, /// The number of imported globals in the module. pub num_imported_globals: u32, - /// The number of defined functions in the module. - pub num_defined_functions: u32, /// The number of defined tables in the module. pub num_defined_tables: u32, /// The number of defined memories in the module. @@ -151,10 +147,11 @@ impl VMOffsets

{ num_imported_tables: cast_to_u32(module.num_imported_tables), num_imported_memories: cast_to_u32(module.num_imported_memories), num_imported_globals: cast_to_u32(module.num_imported_globals), - num_defined_functions: cast_to_u32(module.functions.len()), - num_defined_tables: cast_to_u32(module.table_plans.len()), - num_defined_memories: cast_to_u32(module.memory_plans.len()), - num_defined_globals: cast_to_u32(module.globals.len()), + num_defined_tables: cast_to_u32(module.table_plans.len() - module.num_imported_tables), + num_defined_memories: cast_to_u32( + module.memory_plans.len() - module.num_imported_memories, + ), + num_defined_globals: cast_to_u32(module.globals.len() - module.num_imported_globals), num_escaped_funcs: cast_to_u32(module.num_escaped_funcs), }) } @@ -183,7 +180,6 @@ impl VMOffsets

{ num_defined_tables: _, num_defined_globals: _, num_defined_memories: _, - num_defined_functions: _, num_escaped_funcs: _, // used as the initial size below @@ -237,7 +233,6 @@ impl From> for VMOffsets

{ num_imported_tables: fields.num_imported_tables, num_imported_memories: fields.num_imported_memories, num_imported_globals: fields.num_imported_globals, - num_defined_functions: fields.num_defined_functions, num_defined_tables: fields.num_defined_tables, num_defined_memories: fields.num_defined_memories, num_defined_globals: fields.num_defined_globals, diff --git a/crates/runtime/src/externref.rs b/crates/runtime/src/externref.rs index 354e4fde9b..f7c86e0aea 100644 --- a/crates/runtime/src/externref.rs +++ b/crates/runtime/src/externref.rs @@ -1041,7 +1041,6 @@ mod tests { num_imported_tables: 0, num_imported_memories: 0, num_imported_globals: 0, - num_defined_functions: 0, num_defined_tables: 0, num_defined_memories: 0, num_defined_globals: 0, @@ -1068,7 +1067,6 @@ mod tests { num_imported_tables: 0, num_imported_memories: 0, num_imported_globals: 0, - num_defined_functions: 0, num_defined_tables: 0, num_defined_memories: 0, num_defined_globals: 0, @@ -1095,7 +1093,6 @@ mod tests { num_imported_tables: 0, num_imported_memories: 0, num_imported_globals: 0, - num_defined_functions: 0, num_defined_tables: 0, num_defined_memories: 0, num_defined_globals: 0, diff --git a/tests/all/pooling_allocator.rs b/tests/all/pooling_allocator.rs index b68dd1602a..0509df7825 100644 --- a/tests/all/pooling_allocator.rs +++ b/tests/all/pooling_allocator.rs @@ -630,10 +630,11 @@ fn instance_too_large() -> Result<()> { let engine = Engine::new(&config)?; let expected = "\ -instance allocation for this module requires 320 bytes which exceeds the \ +instance allocation for this module requires 304 bytes which exceeds the \ configured maximum of 16 bytes; breakdown of allocation requirement: - * 80.00% - 256 bytes - instance state management + * 78.95% - 240 bytes - instance state management + * 5.26% - 16 bytes - jit store state "; match Module::new(&engine, "(module)") { Ok(_) => panic!("should have failed to compile"), @@ -647,11 +648,11 @@ configured maximum of 16 bytes; breakdown of allocation requirement: lots_of_globals.push_str(")"); let expected = "\ -instance allocation for this module requires 1920 bytes which exceeds the \ +instance allocation for this module requires 1904 bytes which exceeds the \ configured maximum of 16 bytes; breakdown of allocation requirement: - * 13.33% - 256 bytes - instance state management - * 83.33% - 1600 bytes - defined globals + * 12.61% - 240 bytes - instance state management + * 84.03% - 1600 bytes - defined globals "; match Module::new(&engine, &lots_of_globals) { Ok(_) => panic!("should have failed to compile"),