3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-12-05 03:26:46 +00:00

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.
This commit is contained in:
Robert O'Callahan 2025-11-14 01:52:22 +00:00
parent 7f9de6e48f
commit 4c8b537d71
2 changed files with 0 additions and 15 deletions

View file

@ -40,10 +40,8 @@ std::vector<RTLIL::IdString::Storage> RTLIL::IdString::global_id_storage_;
std::unordered_map<std::string_view, int> RTLIL::IdString::global_id_index_;
std::unordered_map<int, const std::string*> RTLIL::IdString::global_autoidx_id_prefix_storage_;
std::unordered_map<int, char*> RTLIL::IdString::global_autoidx_id_storage_;
#ifndef YOSYS_NO_IDS_REFCNT
std::unordered_map<int, int> RTLIL::IdString::global_refcount_storage_;
std::vector<int> 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<std::s
}
}
#ifndef YOSYS_NO_IDS_REFCNT
if (global_free_idx_list_.empty()) {
log_assert(global_id_storage_.size() < 0x40000000);
global_free_idx_list_.push_back(global_id_storage_.size());
@ -113,10 +110,6 @@ int RTLIL::IdString::really_insert(std::string_view p, std::unordered_map<std::s
int idx = global_free_idx_list_.back();
global_free_idx_list_.pop_back();
#else
int idx = global_id_storage_.size();
global_id_index_[global_id_storage_.back()] = idx;
#endif
char* buf = static_cast<char*>(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;

View file

@ -153,11 +153,9 @@ struct RTLIL::IdString
static std::unordered_map<int, const std::string*> global_autoidx_id_prefix_storage_;
// Explicit string storage for autoidx IDs
static std::unordered_map<int, char*> global_autoidx_id_storage_;
#ifndef YOSYS_NO_IDS_REFCNT
// All (index, refcount) pairs in this map have refcount > 0.
static std::unordered_map<int, int> global_refcount_storage_;
static std::vector<int> 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<short>(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<short>(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<short>(StaticId::STATIC_ID_END) || !destruct_guard_ok)
@ -628,7 +623,6 @@ private:
if (--it->second == 0) {
global_refcount_storage_.erase(it);
}
#endif
}
};