Disable multi-threading in V3FuncOpt (#6440)
This code is not thread safe. Specifically AstNode constructors are not thread safe, as they may create entries in the shared Dtype table via which can be racy.
This commit is contained in:
parent
a44907b700
commit
b60ad953c4
|
|
@ -324,13 +324,12 @@ void V3FuncOpt::funcOptAll(AstNetlist* nodep) {
|
||||||
UINFO(2, __FUNCTION__ << ":");
|
UINFO(2, __FUNCTION__ << ":");
|
||||||
{
|
{
|
||||||
const VNUser1InUse user1InUse;
|
const VNUser1InUse user1InUse;
|
||||||
V3ThreadScope threadScope;
|
|
||||||
for (AstNodeModule *modp = nodep->modulesp(), *nextModp; modp; modp = nextModp) {
|
for (AstNodeModule *modp = nodep->modulesp(), *nextModp; modp; modp = nextModp) {
|
||||||
nextModp = VN_AS(modp->nextp(), NodeModule);
|
nextModp = VN_AS(modp->nextp(), NodeModule);
|
||||||
for (AstNode *stmtp = modp->stmtsp(), *nextStmtp; stmtp; stmtp = nextStmtp) {
|
for (AstNode *stmtp = modp->stmtsp(), *nextStmtp; stmtp; stmtp = nextStmtp) {
|
||||||
nextStmtp = stmtp->nextp();
|
nextStmtp = stmtp->nextp();
|
||||||
if (AstCFunc* const cfuncp = VN_CAST(stmtp, CFunc)) {
|
if (AstCFunc* const cfuncp = VN_CAST(stmtp, CFunc)) {
|
||||||
threadScope.enqueue([cfuncp]() { FuncOptVisitor::apply(cfuncp); });
|
FuncOptVisitor::apply(cfuncp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue