From 8c76f93fcef412605d0ef01e7987a903be6c9e99 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Wed, 12 Nov 2025 20:22:30 +0100 Subject: [PATCH] rtlil: make tracing optional in IdString garbage collection --- kernel/rtlil.cc | 9 +++++---- kernel/rtlil.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index d18a709c9..ee53afe41 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -246,14 +246,15 @@ struct IdStringCollector { int64_t RTLIL::OwningIdString::gc_ns; int RTLIL::OwningIdString::gc_count; -void RTLIL::OwningIdString::collect_garbage() +void RTLIL::OwningIdString::collect_garbage(bool trace) { int64_t start = PerformanceTimer::query(); #ifndef YOSYS_NO_IDS_REFCNT IdStringCollector collector; - for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) { - collector.trace(*design); - } + if (trace) + for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) { + collector.trace(*design); + } int size = GetSize(global_id_storage_); for (int i = static_cast(StaticId::STATIC_ID_END); i < size; ++i) { RTLIL::IdString::Storage &storage = global_id_storage_.at(i); diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 584c4e11b..6098d916b 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -574,7 +574,7 @@ struct RTLIL::OwningIdString : public RTLIL::IdString { } // Collect all non-owning references. - static void collect_garbage(); + static void collect_garbage(bool trace = true); static int64_t garbage_collection_ns() { return gc_ns; } static int garbage_collection_count() { return gc_count; }