Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Utilize handleDisableOnFork and make it taking method name as argument
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Oct 7, 2025
commit 47815cd30b5beecb3e4b5354759dbbfdf9c04c49
11 changes: 7 additions & 4 deletions src/V3LinkJump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ class LinkJumpVisitor final : public VNVisitor {
return new AstStmtExpr{
fl, new AstMethodCall{fl, queueRefp, "push_back", new AstArg{fl, "", processSelfp}}};
}
void handleDisableOnFork(AstDisable* const nodep, const std::vector<AstBegin*>& forks) {
void handleDisableOnFork(AstDisable* const nodep, const std::vector<AstBegin*>& forks,
const std::string& methodName) {
// The support utilizes the process::kill()` method. For each `disable` a queue of
// processes is declared. At the beginning of each fork that can be disabled, its process
// handle is pushed to the queue. `disable` statement is replaced with calling `kill()`
Expand Down Expand Up @@ -217,7 +218,7 @@ class LinkJumpVisitor final : public VNVisitor {
}
AstVarRef* const queueRefp = new AstVarRef{fl, topPkgp, processQueuep, VAccess::READWRITE};
AstTaskRef* const killQueueCall
= new AstTaskRef{fl, VN_AS(getMemberp(processClassp, "killQueue"), Task),
= new AstTaskRef{fl, VN_AS(getMemberp(processClassp, methodName), Task),
new AstArg{fl, "", queueRefp}};
killQueueCall->classOrPackagep(processClassp);
AstStmtExpr* const killStmtp = new AstStmtExpr{fl, killQueueCall};
Expand Down Expand Up @@ -413,18 +414,20 @@ class LinkJumpVisitor final : public VNVisitor {
}
forks.push_back(beginp);
}
handleDisableOnFork(nodep, forks);
handleDisableOnFork(nodep, forks, "killQueue");
} else if (AstBegin* const beginp = VN_CAST(targetp, Begin)) {
if (directlyUnderFork(beginp)) {
std::vector<AstBegin*> forks{beginp};
handleDisableOnFork(nodep, forks);
handleDisableOnFork(nodep, forks, "killQueue");
} else {
const std::string targetName = beginp->name();
if (existsBlockAbove(targetName)) {
if (beginp->user3() & CIF_INSIDE) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disabling block inside a fork");
}
if (beginp->user3() & CIF_CONTAINS) {
std::vector<AstBegin*> blocks{beginp};
handleDisableOnFork(nodep, blocks, "disableForkQueue");
if (m_ftaskp) {
nodep->v3warn(E_UNSUPPORTED,
"Unsupported: disabling block that is inside task / "
Expand Down