diff --git a/test/wasm-api-tests/wasm-api-test.h b/test/wasm-api-tests/wasm-api-test.h index d04a731429..f566d398ca 100644 --- a/test/wasm-api-tests/wasm-api-test.h +++ b/test/wasm-api-tests/wasm-api-test.h @@ -41,9 +41,10 @@ class WasmCapiTest : public ::testing::Test { WasmCapiTest() : Test(), engine_(Engine::make()), - zone_(&allocator_, ZONE_NAME), - wire_bytes_(&zone_), - builder_(&zone_), + allocator_(std::make_unique()), + zone_(std::make_unique(allocator_.get(), ZONE_NAME)), + wire_bytes_(zone_.get()), + builder_(zone_->New(zone_.get())), exports_(ownvec::make()), wasm_i_i_sig_(1, 1, wasm_i_i_sig_types_) { store_ = Store::make(engine_.get()); @@ -53,7 +54,7 @@ class WasmCapiTest : public ::testing::Test { } void Compile() { - builder_.WriteTo(&wire_bytes_); + builder_->WriteTo(&wire_bytes_); size_t size = wire_bytes_.end() - wire_bytes_.begin(); vec binary = vec::make( size, @@ -119,10 +120,13 @@ class WasmCapiTest : public ::testing::Test { instance_.reset(); module_.reset(); store_.reset(); + builder_ = nullptr; + zone_.reset(); + allocator_.reset(); engine_.reset(); } - WasmModuleBuilder* builder() { return &builder_; } + WasmModuleBuilder* builder() { return builder_; } Engine* engine() { return engine_.get(); } Store* store() { return store_.get(); } Module* module() { return module_.get(); } @@ -135,10 +139,10 @@ class WasmCapiTest : public ::testing::Test { private: own engine_; - AccountingAllocator allocator_; - Zone zone_; + own allocator_; + own zone_; ZoneBuffer wire_bytes_; - WasmModuleBuilder builder_; + WasmModuleBuilder* builder_; own store_; own module_; own instance_;