-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Test Case
Any Wasm module.
Steps to Reproduce
let engine = Engine::default();
let module = Module::from_file(&engine, "testcase.wasm").unwrap();
let range = module.image_range();
let offset = unsafe { range.end.offset_from(range.start) };
println!("Offset is {offset}");Expected Results
The documentation for the method says:
Returns the range of bytes in memory where this module’s compilation image resides.
The compilation image for a module contains executable code, data, debug information, etc. This is roughly the same as the Module::serialize but not the exact same.
I was expecting the range to contain the bytes that contain all of the compilation image.
Actual Results
The range contains the bytes for the executable code but no longer includes data, debug information, or any other parts of the compilation image.
The source code for the method appears to only retrieve the text section.
Versions and Environment
Wasmtime version or commit: Wasmtime 40.0.0
Operating system: All
Architecture: All
Extra Info
We're using the image_size API in wasmtime-rb to inform the Ruby garbage collector about the size of the memory used for the anonymous mmap when creating a module.
It looks like the change in implementation was introduced here on line 975.