diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-12-07 14:31:10 -1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-07 14:31:10 -1000 |
commit | e44343a76d96a836e7f0abc0779d774e90621674 (patch) | |
tree | abd2a19314353963b6a0d06e0ab35555ce727baf /src/ast_utils.h | |
parent | 6c4f6d7022ebdd640f2a8e4df8c4885774b9b184 (diff) | |
download | binaryen-e44343a76d96a836e7f0abc0779d774e90621674.tar.gz binaryen-e44343a76d96a836e7f0abc0779d774e90621674.tar.bz2 binaryen-e44343a76d96a836e7f0abc0779d774e90621674.zip |
hash the type of nodes (#856)
Diffstat (limited to 'src/ast_utils.h')
-rw-r--r-- | src/ast_utils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h index f10fb40eb..3396f5ed5 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -742,6 +742,16 @@ struct ExpressionAnalyzer { continue; } hash(curr->_id); + // we often don't need to hash the type, as it is tied to other values + // we are hashing anyhow, but there are exceptions: for example, a + // get_local's type is determined by the function, so if we are + // hashing only expression fragments, then two from different + // functions may turn out the same even if the type differs. Likewise, + // if we hash between modules, then we need to take int account + // call_imports type, etc. The simplest thing is just to hash the + // type for all of them. + hash(curr->type); + #define PUSH(clazz, what) \ stack.push_back(curr->cast<clazz>()->what); #define HASH(clazz, what) \ |