Skip to content

Commit 84adc82

Browse files
authored
Merge pull request #5484 from YosysHQ/emil/idstring-simpler-final-gc
driver: move IdString collection to yosys_shutdown
2 parents ba99c05 + c497b3b commit 84adc82

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

kernel/driver.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ extern "C" {
158158

159159
void yosys_atexit()
160160
{
161-
RTLIL::OwningIdString::collect_garbage(false);
162161
#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE)
163162
if (!yosys_history_file.empty()) {
164163
#if defined(YOSYS_ENABLE_READLINE)

kernel/rtlil.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,14 @@ struct IdStringCollector {
246246
int64_t RTLIL::OwningIdString::gc_ns;
247247
int RTLIL::OwningIdString::gc_count;
248248

249-
void RTLIL::OwningIdString::collect_garbage(bool trace)
249+
void RTLIL::OwningIdString::collect_garbage()
250250
{
251251
int64_t start = PerformanceTimer::query();
252252
#ifndef YOSYS_NO_IDS_REFCNT
253253
IdStringCollector collector;
254-
if (trace)
255-
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
256-
collector.trace(*design);
257-
}
254+
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
255+
collector.trace(*design);
256+
}
258257
int size = GetSize(global_id_storage_);
259258
for (int i = static_cast<int>(StaticId::STATIC_ID_END); i < size; ++i) {
260259
RTLIL::IdString::Storage &storage = global_id_storage_.at(i);

kernel/rtlil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
574574
}
575575

576576
// Collect all non-owning references.
577-
static void collect_garbage(bool trace = true);
577+
static void collect_garbage();
578578
static int64_t garbage_collection_ns() { return gc_ns; }
579579
static int garbage_collection_count() { return gc_count; }
580580

kernel/yosys.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ void yosys_shutdown()
260260

261261
delete yosys_design;
262262
yosys_design = NULL;
263+
RTLIL::OwningIdString::collect_garbage();
263264

264265
for (auto f : log_files)
265266
if (f != stderr)

0 commit comments

Comments
 (0)