diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-03-31 07:57:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 07:57:49 -0700 |
commit | 1d24b83eaf710510c132091db89715607d64eea7 (patch) | |
tree | 34c38a85f0b3f0fe91226d85b951d897e356fc71 /src/passes/MemoryPacking.cpp | |
parent | e7c4f9da6d4a98f58b6320b5769f653a6bf26d3e (diff) | |
download | binaryen-1d24b83eaf710510c132091db89715607d64eea7.tar.gz binaryen-1d24b83eaf710510c132091db89715607d64eea7.tar.bz2 binaryen-1d24b83eaf710510c132091db89715607d64eea7.zip |
[MemoryPacking] Remove workaround for old V8 bug (#4558)
V8 used to incorrectly parse the segment index on bulk memory instructions as a
signed LEB rather than an unsigned LEB, which meant it only worked correctly
with up to 63 data segments. That bug has been fixed for over two years now, so
lift the maximum number of segments generated by memory packing from 63 to the
specified max, 100k.
Diffstat (limited to 'src/passes/MemoryPacking.cpp')
-rw-r--r-- | src/passes/MemoryPacking.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/passes/MemoryPacking.cpp b/src/passes/MemoryPacking.cpp index 8267dc8bf..c6fd0e313 100644 --- a/src/passes/MemoryPacking.cpp +++ b/src/passes/MemoryPacking.cpp @@ -94,11 +94,6 @@ makeGtShiftedMemorySize(Builder& builder, Module& module, MemoryInit* curr) { } // anonymous namespace struct MemoryPacking : public Pass { - // FIXME: Chrome has a bug decoding section indices that prevents it from - // using more than 63. Just use WebLimitations::MaxDataSegments once this is - // fixed. See https://bugs.chromium.org/p/v8/issues/detail?id=10151. - uint32_t maxSegments; - void run(PassRunner* runner, Module* module) override; bool canOptimize(const Memory& memory, const PassOptions& passOptions); void optimizeBulkMemoryOps(PassRunner* runner, Module* module); @@ -129,10 +124,6 @@ void MemoryPacking::run(PassRunner* runner, Module* module) { return; } - maxSegments = module->features.hasBulkMemory() - ? 63 - : uint32_t(WebLimitations::MaxDataSegments); - auto& segments = module->memory.segments; // For each segment, a list of bulk memory instructions that refer to it @@ -541,7 +532,7 @@ void MemoryPacking::createSplitSegments(Builder& builder, offset = segment.offset; } } - if (maxSegments <= packed.size() + segmentsRemaining) { + if (WebLimitations::MaxDataSegments <= packed.size() + segmentsRemaining) { // Give up splitting and merge all remaining ranges except end zeroes auto lastNonzero = ranges.end() - 1; if (lastNonzero->isZero) { |