summaryrefslogtreecommitdiff
path: root/src/ir/struct-utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/struct-utils.h')
-rw-r--r--src/ir/struct-utils.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ir/struct-utils.h b/src/ir/struct-utils.h
index 667c9ed55..4e24aacf4 100644
--- a/src/ir/struct-utils.h
+++ b/src/ir/struct-utils.h
@@ -119,7 +119,9 @@ struct FunctionStructValuesMap
// void noteDefault(Type fieldType, HeapType type, Index index, T& info);
//
// * Note a copied value (read from this field and written to the same, possibly
-// in another object).
+// in another object). Note that we require that the two types (the one read
+// from, and written to) are identical; allowing subtyping is possible, but
+// would add complexity amid diminishing returns.
//
// void noteCopy(HeapType type, Index index, T& info);
//
@@ -232,8 +234,13 @@ struct StructScanner
// if we changed something.
template<typename T> class TypeHierarchyPropagator {
public:
+ // Constructor that gets a module and computes subtypes.
TypeHierarchyPropagator(Module& wasm) : subTypes(wasm) {}
+ // Constructor that gets subtypes and uses them, avoiding a scan of a
+ // module. TODO: avoid a copy here?
+ TypeHierarchyPropagator(const SubTypes& subTypes) : subTypes(subTypes) {}
+
SubTypes subTypes;
void propagateToSuperTypes(StructValuesMap<T>& infos) {