mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
cxxrtl: reduce stack space consumed by debug_info()
further.
Before this commit, this function would create a temporary `std::string` per debug item (and scope). After this commit, an additional overload is used to push that down the call stack. This reduces stack usage by about 50% more on top of the previous commit.
This commit is contained in:
parent
9134cd1928
commit
80798daf53
2 changed files with 70 additions and 60 deletions
|
@ -1466,6 +1466,11 @@ struct debug_items {
|
|||
});
|
||||
}
|
||||
|
||||
// This overload exists to reduce excessive stack slot allocation in `CXXRTL_EXTREMELY_COLD void debug_info()`.
|
||||
void add(const std::string &base_path, const char *path, debug_item &&item, const char *serialized_item_attrs) {
|
||||
add(base_path + path, std::move(item), metadata::deserialize(serialized_item_attrs));
|
||||
}
|
||||
|
||||
size_t count(const std::string &path) const {
|
||||
if (table.count(path) == 0)
|
||||
return 0;
|
||||
|
@ -1512,6 +1517,11 @@ struct debug_scopes {
|
|||
scope.cell_attrs = std::unique_ptr<debug_attrs>(new debug_attrs { cell_attrs });
|
||||
}
|
||||
|
||||
// This overload exists to reduce excessive stack slot allocation in `CXXRTL_EXTREMELY_COLD void debug_info()`.
|
||||
void add(const std::string &base_path, const char *path, const char *module_name, const char *serialized_module_attrs, const char *serialized_cell_attrs) {
|
||||
add(base_path + path, module_name, metadata::deserialize(serialized_module_attrs), metadata::deserialize(serialized_cell_attrs));
|
||||
}
|
||||
|
||||
size_t contains(const std::string &path) const {
|
||||
return table.count(path);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue