mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-22 05:36:43 +00:00
Merge pull request #5484 from YosysHQ/emil/idstring-simpler-final-gc
driver: move IdString collection to yosys_shutdown
This commit is contained in:
commit
84adc82fad
4 changed files with 6 additions and 7 deletions
|
|
@ -158,7 +158,6 @@ extern "C" {
|
||||||
|
|
||||||
void yosys_atexit()
|
void yosys_atexit()
|
||||||
{
|
{
|
||||||
RTLIL::OwningIdString::collect_garbage(false);
|
|
||||||
#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE)
|
#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE)
|
||||||
if (!yosys_history_file.empty()) {
|
if (!yosys_history_file.empty()) {
|
||||||
#if defined(YOSYS_ENABLE_READLINE)
|
#if defined(YOSYS_ENABLE_READLINE)
|
||||||
|
|
|
||||||
|
|
@ -246,15 +246,14 @@ struct IdStringCollector {
|
||||||
int64_t RTLIL::OwningIdString::gc_ns;
|
int64_t RTLIL::OwningIdString::gc_ns;
|
||||||
int RTLIL::OwningIdString::gc_count;
|
int RTLIL::OwningIdString::gc_count;
|
||||||
|
|
||||||
void RTLIL::OwningIdString::collect_garbage(bool trace)
|
void RTLIL::OwningIdString::collect_garbage()
|
||||||
{
|
{
|
||||||
int64_t start = PerformanceTimer::query();
|
int64_t start = PerformanceTimer::query();
|
||||||
#ifndef YOSYS_NO_IDS_REFCNT
|
#ifndef YOSYS_NO_IDS_REFCNT
|
||||||
IdStringCollector collector;
|
IdStringCollector collector;
|
||||||
if (trace)
|
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
|
||||||
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
|
collector.trace(*design);
|
||||||
collector.trace(*design);
|
}
|
||||||
}
|
|
||||||
int size = GetSize(global_id_storage_);
|
int size = GetSize(global_id_storage_);
|
||||||
for (int i = static_cast<int>(StaticId::STATIC_ID_END); i < size; ++i) {
|
for (int i = static_cast<int>(StaticId::STATIC_ID_END); i < size; ++i) {
|
||||||
RTLIL::IdString::Storage &storage = global_id_storage_.at(i);
|
RTLIL::IdString::Storage &storage = global_id_storage_.at(i);
|
||||||
|
|
|
||||||
|
|
@ -574,7 +574,7 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect all non-owning references.
|
// Collect all non-owning references.
|
||||||
static void collect_garbage(bool trace = true);
|
static void collect_garbage();
|
||||||
static int64_t garbage_collection_ns() { return gc_ns; }
|
static int64_t garbage_collection_ns() { return gc_ns; }
|
||||||
static int garbage_collection_count() { return gc_count; }
|
static int garbage_collection_count() { return gc_count; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,7 @@ void yosys_shutdown()
|
||||||
|
|
||||||
delete yosys_design;
|
delete yosys_design;
|
||||||
yosys_design = NULL;
|
yosys_design = NULL;
|
||||||
|
RTLIL::OwningIdString::collect_garbage();
|
||||||
|
|
||||||
for (auto f : log_files)
|
for (auto f : log_files)
|
||||||
if (f != stderr)
|
if (f != stderr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue