diff options
author | Alon Zakai <azakai@google.com> | 2021-03-16 16:44:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 16:44:28 -0700 |
commit | 7ca01ed8762a41ddf5268167a9a175c96019d7c2 (patch) | |
tree | 6471436e8f2cc8aefb34fee0df7c5b0da07c2575 | |
parent | 39eac740cdf769b30e9969824387bf8b4b025aab (diff) | |
download | binaryen-7ca01ed8762a41ddf5268167a9a175c96019d7c2.tar.gz binaryen-7ca01ed8762a41ddf5268167a9a175c96019d7c2.tar.bz2 binaryen-7ca01ed8762a41ddf5268167a9a175c96019d7c2.zip |
Add missing fields in ModuleUtils::copyModule (#3692)
We were missing type names and the features section.
-rw-r--r-- | src/ir/module-utils.h | 2 | ||||
-rw-r--r-- | test/passes/func-metrics.txt | 2 | ||||
-rw-r--r-- | test/passes/roundtrip_typenames_features.bin.txt | 9 | ||||
-rw-r--r-- | test/passes/roundtrip_typenames_features.passes | 1 | ||||
-rw-r--r-- | test/passes/roundtrip_typenames_features.wasm | bin | 0 -> 118 bytes |
5 files changed, 13 insertions, 1 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index 22ed89b37..9b1682b91 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -129,6 +129,8 @@ inline void copyModule(const Module& in, Module& out) { out.start = in.start; out.userSections = in.userSections; out.debugInfoFileNames = in.debugInfoFileNames; + out.features = in.features; + out.typeNames = in.typeNames; } inline void clearModule(Module& wasm) { diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index b224c980c..1ca5d2fd9 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -253,7 +253,7 @@ func: 0 [vars] : 0 GlobalGet : 1 export: stackSave (0) - [removable-bytes-without-it]: 56 + [removable-bytes-without-it]: 62 [total] : 0 (module (type $0 (func (result i32))) diff --git a/test/passes/roundtrip_typenames_features.bin.txt b/test/passes/roundtrip_typenames_features.bin.txt new file mode 100644 index 000000000..852dea7f9 --- /dev/null +++ b/test/passes/roundtrip_typenames_features.bin.txt @@ -0,0 +1,9 @@ +(module + (type $ref?|$NamedStruct|_=>_none (func (param (ref null $NamedStruct)))) + (type $NamedStruct (struct )) + (export "export" (func $0)) + (func $0 (param $0 (ref null $NamedStruct)) + (nop) + ) + ;; features section: reference-types, gc +) diff --git a/test/passes/roundtrip_typenames_features.passes b/test/passes/roundtrip_typenames_features.passes new file mode 100644 index 000000000..490fcd42f --- /dev/null +++ b/test/passes/roundtrip_typenames_features.passes @@ -0,0 +1 @@ +roundtrip diff --git a/test/passes/roundtrip_typenames_features.wasm b/test/passes/roundtrip_typenames_features.wasm Binary files differnew file mode 100644 index 000000000..822accaa5 --- /dev/null +++ b/test/passes/roundtrip_typenames_features.wasm |