mirror of
https://github.com/YosysHQ/yosys
synced 2025-05-14 11:14:44 +00:00
cxxrtl: make observer methods non-virtual. (breaking change)
This avoids having to devirtualize them later to get performance back, and simplifies the code a bit. The change is prompted by the desire to add a similar observer object to `eval()`, and a repeated consideration of whether the dispatch on these should be virtual in first place.
This commit is contained in:
parent
ed81cc5f81
commit
bf1a99da09
3 changed files with 9 additions and 19 deletions
|
@ -556,22 +556,20 @@ public:
|
|||
bool record_incremental(ModuleT &module) {
|
||||
assert(streaming);
|
||||
|
||||
struct : public observer {
|
||||
struct {
|
||||
std::unordered_map<const chunk_t*, spool::ident_t> *ident_lookup;
|
||||
spool::writer *writer;
|
||||
|
||||
CXXRTL_ALWAYS_INLINE
|
||||
void on_update(size_t chunks, const chunk_t *base, const chunk_t *value) override {
|
||||
void on_update(size_t chunks, const chunk_t *base, const chunk_t *value) {
|
||||
writer->write_change(ident_lookup->at(base), chunks, value);
|
||||
}
|
||||
|
||||
CXXRTL_ALWAYS_INLINE
|
||||
void on_update(size_t chunks, const chunk_t *base, const chunk_t *value, size_t index) override {
|
||||
void on_update(size_t chunks, const chunk_t *base, const chunk_t *value, size_t index) {
|
||||
writer->write_change(ident_lookup->at(base), chunks, value, index);
|
||||
}
|
||||
} record_observer;
|
||||
record_observer.ident_lookup = &ident_lookup;
|
||||
record_observer.writer = &writer;
|
||||
} record_observer = { &ident_lookup, &writer };
|
||||
|
||||
writer.write_sample(/*incremental=*/true, pointer++, timestamp);
|
||||
for (auto input_index : inputs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue