Fix import relocations in CodeBuilder.

This commit is contained in:
Brian Carroll 2022-11-15 09:13:41 +00:00
parent 4dea82b2f5
commit ddddb7d4f1
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
3 changed files with 60 additions and 52 deletions

View file

@ -363,12 +363,8 @@ impl<'a> WasmBackend<'a> {
/// Reset function-level data
fn reset(&mut self) {
// Push the completed CodeBuilder into the module and swap it for a new empty one
let mut swap_code_builder = CodeBuilder::new(self.env.arena);
std::mem::swap(&mut swap_code_builder, &mut self.code_builder);
swap_code_builder.serialize_without_relocs(&mut self.module.code.bytes);
self.code_builder.insert_into_module(&mut self.module);
self.code_builder.clear();
self.storage.clear();
self.joinpoint_label_map.clear();
assert_eq!(self.block_depth, 0);