From 4c8b537d7194bbb300c23162d07b9cf25b8d7447 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 14 Nov 2025 01:52:22 +0000 Subject: [PATCH] Remove YOSYS_NO_IDS_REFCNT Refcounting is hardly used at all so this option is not that useful. We might want to have a different option that disables GC if that becomes a performance issue, but that should be a different option. --- kernel/rtlil.cc | 9 --------- kernel/rtlil.h | 6 ------ 2 files changed, 15 deletions(-) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index d18a709c9..dc851c019 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -40,10 +40,8 @@ std::vector RTLIL::IdString::global_id_storage_; std::unordered_map RTLIL::IdString::global_id_index_; std::unordered_map RTLIL::IdString::global_autoidx_id_prefix_storage_; std::unordered_map RTLIL::IdString::global_autoidx_id_storage_; -#ifndef YOSYS_NO_IDS_REFCNT std::unordered_map RTLIL::IdString::global_refcount_storage_; std::vector RTLIL::IdString::global_free_idx_list_; -#endif static void populate(std::string_view name) { @@ -104,7 +102,6 @@ int RTLIL::IdString::really_insert(std::string_view p, std::unordered_map(malloc(p.size() + 1)); memcpy(buf, p.data(), p.size()); buf[p.size()] = 0; @@ -249,7 +242,6 @@ int RTLIL::OwningIdString::gc_count; void RTLIL::OwningIdString::collect_garbage() { int64_t start = PerformanceTimer::query(); -#ifndef YOSYS_NO_IDS_REFCNT IdStringCollector collector; for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) { collector.trace(*design); @@ -291,7 +283,6 @@ void RTLIL::OwningIdString::collect_garbage() } it = global_autoidx_id_prefix_storage_.erase(it); } -#endif int64_t time_ns = PerformanceTimer::query() - start; Pass::subtract_from_current_runtime_ns(time_ns); gc_ns += time_ns; diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 4da030e8d..a674d87e9 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -153,11 +153,9 @@ struct RTLIL::IdString static std::unordered_map global_autoidx_id_prefix_storage_; // Explicit string storage for autoidx IDs static std::unordered_map global_autoidx_id_storage_; -#ifndef YOSYS_NO_IDS_REFCNT // All (index, refcount) pairs in this map have refcount > 0. static std::unordered_map global_refcount_storage_; static std::vector global_free_idx_list_; -#endif static int refcount(int idx) { auto it = global_refcount_storage_.find(idx); @@ -597,7 +595,6 @@ private: } static void get_reference(int idx) { - #ifndef YOSYS_NO_IDS_REFCNT if (idx < static_cast(StaticId::STATIC_ID_END)) return; auto it = global_refcount_storage_.find(idx); @@ -605,7 +602,6 @@ private: global_refcount_storage_.insert(it, {idx, 1}); else ++it->second; - #endif #ifdef YOSYS_XTRACE_GET_PUT if (yosys_xtrace && idx >= static_cast(StaticId::STATIC_ID_END)) log("#X# GET-BY-INDEX '%s' (index %d, refcount %u)\n", from_index(idx), idx, refcount(idx)); @@ -614,7 +610,6 @@ private: void put_reference() { - #ifndef YOSYS_NO_IDS_REFCNT // put_reference() may be called from destructors after the destructor of // global_refcount_storage_ has been run. in this case we simply do nothing. if (index_ < static_cast(StaticId::STATIC_ID_END) || !destruct_guard_ok) @@ -628,7 +623,6 @@ private: if (--it->second == 0) { global_refcount_storage_.erase(it); } - #endif } };