diff options
author | Alon Zakai <azakai@google.com> | 2020-08-06 09:27:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 09:27:34 -0700 |
commit | e89b40149ff6327df9dcc47043528b0ddef6c377 (patch) | |
tree | 96bc5d3e68868d0ae0594eb84b79e61ee7d3dd37 /src/ir/module-utils.h | |
parent | 550b36a1866a262f21c008a4d8cbaf65d14d0c01 (diff) | |
download | binaryen-e89b40149ff6327df9dcc47043528b0ddef6c377.tar.gz binaryen-e89b40149ff6327df9dcc47043528b0ddef6c377.tar.bz2 binaryen-e89b40149ff6327df9dcc47043528b0ddef6c377.zip |
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).
Diffstat (limited to 'src/ir/module-utils.h')
-rw-r--r-- | src/ir/module-utils.h | 11 |
1 files changed, 8 insertions, 3 deletions
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<typename T> 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<bool(const T&)> hasProperty, std::function<bool(const T&)> canHaveProperty, - std::function<void(T&)> addProperty, + std::function<void(T&, Function*)> addProperty, IndirectCalls indirectCalls) { // The work queue contains items we just learned can change the state. UniqueDeferredQueue<Function*> work; @@ -359,7 +364,7 @@ template<typename T> 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<typename T> 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); } } |