type::Manager: Simplify interface and use BlockAllocator

Internally use BlockAllocator to allocate the types.
When we optimize the allocation patterns of BlockAllocator, this will now benefit both AST nodes and types.

Remove Reset(). It was not used.

Remove type::Manager::Get(std::unique_ptr<type::Type>) - this was used (via Module::unique_type) in one place, which has easily been migrated to using the standard Module::create<>.

Replace all remaining uses of std::unique_ptr<> of types in tests with the standard create<> so we can guarantee uniqueness of the types.

Change-Id: Ib0e1fe94e492b31816450df5de0c839a0aefcb9e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38362
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-01-21 16:35:10 +00:00
committed by Commit Bot service account
parent 1e29f4beb0
commit 281b602f59
11 changed files with 138 additions and 172 deletions

View File

@@ -69,13 +69,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
std::unordered_set<tint::type::Type*> src_types;
for (auto& src_type : src.types()) {
src_types.emplace(src_type.second.get());
src_types.emplace(src_type.second);
}
for (auto* dst_node : dst.nodes()) {
ASSERT_EQ(src_nodes.count(dst_node), 0u);
}
for (auto& dst_type : dst.types()) {
ASSERT_EQ(src_types.count(dst_type.second.get()), 0u);
ASSERT_EQ(src_types.count(dst_type.second), 0u);
}
// Regenerate the wgsl for the src module. We use this instead of the original