summaryrefslogtreecommitdiff
path: root/src/wasm-type.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-11-26 15:22:04 -0800
committerGitHub <noreply@github.com>2019-11-26 15:22:04 -0800
commitec53d11e0792884e1125fe5a1a437a5eff260259 (patch)
tree0ebeab40cade82309507aceab7f810e9a37929fb /src/wasm-type.h
parent7665f703f4e3437564be25ae276e1daaedd98d79 (diff)
downloadbinaryen-ec53d11e0792884e1125fe5a1a437a5eff260259.tar.gz
binaryen-ec53d11e0792884e1125fe5a1a437a5eff260259.tar.bz2
binaryen-ec53d11e0792884e1125fe5a1a437a5eff260259.zip
Refactor and optimize binary writing type collection (#2478)
Create a new ParallelFunctionAnalysis helper, which lets us run in parallel on all functions and collect info from them, without manually handling locks etc. Use that in the binary writing code's type collection logic, avoiding a lock for each type increment. Also add Signature printing which was useful to debug this.
Diffstat (limited to 'src/wasm-type.h')
-rw-r--r--src/wasm-type.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 7b3845aec..ddfb7c9a1 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -96,10 +96,6 @@ struct ResultType {
std::string toString() const;
};
-std::ostream& operator<<(std::ostream& os, Type t);
-std::ostream& operator<<(std::ostream& os, ParamType t);
-std::ostream& operator<<(std::ostream& os, ResultType t);
-
struct Signature {
Type params;
Type results;
@@ -112,6 +108,11 @@ struct Signature {
bool operator<(const Signature& other) const;
};
+std::ostream& operator<<(std::ostream& os, Type t);
+std::ostream& operator<<(std::ostream& os, ParamType t);
+std::ostream& operator<<(std::ostream& os, ResultType t);
+std::ostream& operator<<(std::ostream& os, Signature t);
+
constexpr Type none = Type::none;
constexpr Type i32 = Type::i32;
constexpr Type i64 = Type::i64;