summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2024-12-06 12:34:19 -0800
committerGitHub <noreply@github.com>2024-12-06 20:34:19 +0000
commit729ea41d145d369b203dca6f70b251ea365cb3d0 (patch)
tree269217c2d17d6e8a4a59eb6b822aa4cdac17aa28 /src/wasm/wasm-binary.cpp
parent3f82ffc70362bf967d91d3cb56ee4c8c5ebe1161 (diff)
downloadbinaryen-729ea41d145d369b203dca6f70b251ea365cb3d0.tar.gz
binaryen-729ea41d145d369b203dca6f70b251ea365cb3d0.tar.bz2
binaryen-729ea41d145d369b203dca6f70b251ea365cb3d0.zip
Add bulk-memory-opt feature and ignore call-indirect-overlong (#7139)
LLVM recently split the bulk-memory-opt feature out from bulk-memory, containing just memory.copy and memory.fill. This change follows that, making bulk-memory-opt also enabled when all of bulk-memory is enabled. It also introduces call-indirect-overlong following LLVM, but ignores it, since Binaryen has always allowed the encoding (i.e. command line flags enabling or disabling the feature are accepted but ignored).
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index f710c8bc1..0c931f518 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1354,6 +1354,10 @@ void WasmBinaryWriter::writeFeaturesSection() {
return BinaryConsts::CustomSections::SharedEverythingFeature;
case FeatureSet::FP16:
return BinaryConsts::CustomSections::FP16Feature;
+ case FeatureSet::BulkMemoryOpt:
+ return BinaryConsts::CustomSections::BulkMemoryOptFeature;
+ case FeatureSet::CallIndirectOverlong:
+ return BinaryConsts::CustomSections::CallIndirectOverlongFeature;
case FeatureSet::None:
case FeatureSet::Default:
case FeatureSet::All:
@@ -4790,6 +4794,12 @@ void WasmBinaryReader::readFeatures(size_t payloadLen) {
feature = FeatureSet::Atomics;
} else if (name == BinaryConsts::CustomSections::BulkMemoryFeature) {
feature = FeatureSet::BulkMemory;
+ if (used) {
+ // For backward compatibility, enable this dependent feature.
+ feature |= FeatureSet::BulkMemoryOpt;
+ }
+ } else if (name == BinaryConsts::CustomSections::BulkMemoryOptFeature) {
+ feature = FeatureSet::BulkMemoryOpt;
} else if (name == BinaryConsts::CustomSections::ExceptionHandlingFeature) {
feature = FeatureSet::ExceptionHandling;
} else if (name == BinaryConsts::CustomSections::MutableGlobalsFeature) {