This method attempted to reserve space in the `results` list of final modules. Unfortunately `results.reserve(nmodules)` isn't enough here because this can be called many times before a module is actually finished and pushed onto the vector. The attempted logic to work around this was buggy, however, and would simply trigger geometric growth on every single reservation because it erroneously assumed that a reservation would be exactly met. This is fixed by avoiding looking at the vector's capacity and instead keeping track of modules-to-be in a side field. This is the incremented and passed to `reserve` as it represents the number of modules that will eventually make their way into the result vector.
This is the wasmtime-environ crate, which contains the implementations
of the ModuleEnvironment and FuncEnvironment traits from
cranelift-wasm. They effectively
implement an ABI for basic wasm compilation that defines how linear memories
are allocated, how indirect calls work, and other details. They can be used
for JITing, native object files, or other purposes.