summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-10-08 12:48:53 -0700
committerGitHub <noreply@github.com>2021-10-08 12:48:53 -0700
commit562250e14af4f74911b5f8510ca3c5774c9b1e1c (patch)
tree697710519fbd6e7bd7ae346050ca0cdcc2fa85a5 /src/wasm.h
parentc2fa907f010b6418e5cbfc3c5baface3c0898062 (diff)
downloadbinaryen-562250e14af4f74911b5f8510ca3c5774c9b1e1c.tar.gz
binaryen-562250e14af4f74911b5f8510ca3c5774c9b1e1c.tar.bz2
binaryen-562250e14af4f74911b5f8510ca3c5774c9b1e1c.zip
Emit heap types for call_indirect that match the table (#4221)
See #4220 - this lets us handle the common case for now of simply having an identical heap type to the table when the signature is identical. With this PR, #4207's optimization of call_ref + table.get into call_indirect now leads to a binary that works in V8 in nominal mode.
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index fbec9247a..c87b8c197 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -556,6 +556,9 @@ enum BrOnOp {
BrOnNonI31,
};
+// Forward declaration for methods that receive a Module as a parameter.
+class Module;
+
//
// Expressions
//
@@ -828,6 +831,15 @@ public:
bool isReturn = false;
void finalize();
+
+ // FIXME We should probably store a heap type here, and not a signature, see
+ // https://github.com/WebAssembly/binaryen/issues/4220
+ // For now, copy the heap type from the table if it matches - then a
+ // nominal check will succeed too. If it does not match, then just
+ // emit something for it like we always used to, using
+ // HeapType(sig) (also do that if no module is provided).
+ // FIXME When we remove this, also remove the forward decl of Module, above.
+ HeapType getHeapType(Module* module = nullptr);
};
class LocalGet : public SpecificExpression<Expression::LocalGetId> {