mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 18:13:50 +02:00
Fix inlining of forks (#3594)
Before this change, some forked processes were being inlined in `V3Timing` because they contained no `CAwait`s. This only works under the assumption that no `CAwait`s will be added there later, which is not true, as a function called by a forked process could be turned into a coroutine later. The call would be wrapped in a new `CAwait`, but the process itself would have already been inlined at this point. This commit moves the inlining to `transformForks` in `V3SchedTiming`, which is called at a point when all `CAwait`s are already in place. Signed-off-by: Krzysztof Bieganski <[email protected]>
This commit is contained in:
+5
-18
@@ -614,25 +614,12 @@ private:
|
||||
VL_RESTORER(m_procp);
|
||||
m_procp = beginp;
|
||||
iterate(beginp);
|
||||
if (!m_procp->user2()) {
|
||||
// No awaits, we can inline this process
|
||||
if (auto* const stmtsp = beginp->stmtsp()) {
|
||||
nodep->addHereThisAsNext(stmtsp->unlinkFrBackWithNext());
|
||||
}
|
||||
VL_DO_DANGLING(beginp->unlinkFrBack()->deleteTree(), beginp);
|
||||
// We inlined at least one process, so we can consider it joined; convert join_any
|
||||
// to join_none
|
||||
if (nodep->joinType().joinAny()) nodep->joinType(VJoinType::JOIN_NONE);
|
||||
} else {
|
||||
// Name the begin (later the name will be used for a new function)
|
||||
beginp->name(nodep->name() + "__" + cvtToStr(idx++));
|
||||
}
|
||||
}
|
||||
if (!nodep->stmtsp()) {
|
||||
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||
} else if (!nodep->joinType().joinNone()) {
|
||||
makeForkJoin(nodep);
|
||||
// Even if we do not find any awaits, we cannot simply inline the process here, as new
|
||||
// awaits could be added later.
|
||||
// Name the begin (later the name will be used for a new function)
|
||||
beginp->name(nodep->name() + "__" + cvtToStr(idx++));
|
||||
}
|
||||
if (!nodep->joinType().joinNone()) makeForkJoin(nodep);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
||||
Reference in New Issue
Block a user