Tidy up some internals of instance allocation (#5346)
* Simplify the `ModuleRuntimeInfo` trait slightly Fold two functions into one as they're only called from one location anyway. * Remove ModuleRuntimeInfo::signature This is redundant as the array mapping is already stored within the `VMContext` so that can be consulted rather than having a separate trait function for it. This required altering the `Global` creation slightly to work correctly in this situation. * Remove a now-dead constant * Shared `VMOffsets` across instances This commit removes the computation of `VMOffsets` to being per-module instead of per-instance. The `VMOffsets` structure is also quite large so this shaves off 112 bytes per instance which isn't a huge impact but should help lower the cost of instantiating small modules. * Remove `InstanceAllocator::adjust_tunables` This is no longer needed or necessary with the pooling allocator. * Fix compile warning * Fix a vtune warning * Fix pooling tests * Fix another test warning
This commit is contained in:
@@ -646,10 +646,11 @@ fn instance_too_large() -> Result<()> {
|
||||
|
||||
let engine = Engine::new(&config)?;
|
||||
let expected = "\
|
||||
instance allocation for this module requires 336 bytes which exceeds the \
|
||||
instance allocation for this module requires 224 bytes which exceeds the \
|
||||
configured maximum of 16 bytes; breakdown of allocation requirement:
|
||||
|
||||
* 76.19% - 256 bytes - instance state management
|
||||
* 64.29% - 144 bytes - instance state management
|
||||
* 7.14% - 16 bytes - jit store state
|
||||
";
|
||||
match Module::new(&engine, "(module)") {
|
||||
Ok(_) => panic!("should have failed to compile"),
|
||||
@@ -663,11 +664,11 @@ configured maximum of 16 bytes; breakdown of allocation requirement:
|
||||
lots_of_globals.push_str(")");
|
||||
|
||||
let expected = "\
|
||||
instance allocation for this module requires 1936 bytes which exceeds the \
|
||||
instance allocation for this module requires 1824 bytes which exceeds the \
|
||||
configured maximum of 16 bytes; breakdown of allocation requirement:
|
||||
|
||||
* 13.22% - 256 bytes - instance state management
|
||||
* 82.64% - 1600 bytes - defined globals
|
||||
* 7.89% - 144 bytes - instance state management
|
||||
* 87.72% - 1600 bytes - defined globals
|
||||
";
|
||||
match Module::new(&engine, &lots_of_globals) {
|
||||
Ok(_) => panic!("should have failed to compile"),
|
||||
|
||||
Reference in New Issue
Block a user