summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-01-09 21:13:11 -0800
committerGitHub <noreply@github.com>2018-01-09 21:13:11 -0800
commit8f90b655201e4cd77196a0b90ea4f398ecfe2c56 (patch)
treebb2bf5fcb495944a36b0cfa9077be093e0cc9382 /src/wasm-binary.h
parent23728627ec6fbd43936b7564a7c8b598227ef9ce (diff)
downloadbinaryen-8f90b655201e4cd77196a0b90ea4f398ecfe2c56.tar.gz
binaryen-8f90b655201e4cd77196a0b90ea4f398ecfe2c56.tar.bz2
binaryen-8f90b655201e4cd77196a0b90ea4f398ecfe2c56.zip
Do not emit 100k data segments, browsers reject it (#1350)
Instead merge constant-offset segments if we must in order to stay under the limit. If we can't - too many non-constant-offset segments - then issue a warning.
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index a407c56e4..12aecfeaa 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -37,7 +37,14 @@ namespace wasm {
enum {
// the maximum amount of bytes we emit per LEB
- MaxLEB32Bytes = 5
+ MaxLEB32Bytes = 5,
+};
+
+// wasm VMs on the web have decided to impose some limits on what they
+// accept
+enum WebLimitations {
+ MaxDataSegments = 100 * 1000,
+ MaxFunctionBodySize = 128 * 1024
};
template<typename T, typename MiniT>