From e89b40149ff6327df9dcc47043528b0ddef6c377 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 6 Aug 2020 09:27:34 -0700 Subject: Asyncify verbose option (#3022) This logs out the decisions made about instrumenting functions, which can help figure out why a function is instrumented, or to get a list of what might need to be. As the test shows, it can print things like this: [asyncify] import is an import that can change the state [asyncify] calls-import can change the state due to import [asyncify] calls-calls-import can change the state due to calls-import [asyncify] calls-calls-calls-import can change the state due to calls-calls-import (the test has calls-calls-calls-import => calls-calls-import => calls-import -> import). --- src/ir/module-utils.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/ir/module-utils.h') diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index ab23649f7..8f89c780f 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -349,9 +349,14 @@ template struct CallGraphPropertyAnalysis { enum IndirectCalls { IgnoreIndirectCalls, IndirectCallsHaveProperty }; // Propagate a property from a function to those that call it. + // + // hasProperty() - Check if the property is present. + // canHaveProperty() - Check if the property could be present. + // addProperty() - Adds the property. This receives a second parameter which + // is the function due to which we are adding the property. void propagateBack(std::function hasProperty, std::function canHaveProperty, - std::function addProperty, + std::function addProperty, IndirectCalls indirectCalls) { // The work queue contains items we just learned can change the state. UniqueDeferredQueue work; @@ -359,7 +364,7 @@ template struct CallGraphPropertyAnalysis { if (hasProperty(map[func.get()]) || (indirectCalls == IndirectCallsHaveProperty && map[func.get()].hasIndirectCall)) { - addProperty(map[func.get()]); + addProperty(map[func.get()], func.get()); work.push(func.get()); } } @@ -369,7 +374,7 @@ template struct CallGraphPropertyAnalysis { // If we don't already have the property, and we are not forbidden // from getting it, then it propagates back to us now. if (!hasProperty(map[caller]) && canHaveProperty(map[caller])) { - addProperty(map[caller]); + addProperty(map[caller], func); work.push(caller); } } -- cgit v1.2.3