diff options
author | Alon Zakai <azakai@google.com> | 2023-11-30 11:52:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-30 11:52:57 -0800 |
commit | a191d66fce93829e7365f7f2f4be2799c62a1ee4 (patch) | |
tree | 82e1767542f4eda786928b1681774df238e588c3 /test/metadce/name_collision.wast | |
parent | 71b9cc0b50b119988b7ad3a5f5d2feec4d6c4a95 (diff) | |
download | binaryen-a191d66fce93829e7365f7f2f4be2799c62a1ee4.tar.gz binaryen-a191d66fce93829e7365f7f2f4be2799c62a1ee4.tar.bz2 binaryen-a191d66fce93829e7365f7f2f4be2799c62a1ee4.zip |
wasm-metadce: Improve name deduplication (#6138)
Avoid adding suffixes when we don't need them to keep names unique.
As background, the suffixes are not used by emcc at all, so they are just
for internal use in the tool. How that works is that metadce gets as input
the list of things the user cares about, with names for them, so it knows
the proper names to give imports and exports, and makes up names for
other things. Those made up names will not be read by the user, so we
can make them prettier as this PR does without breaking anything.
The main benefit of this PR is to make debugging easier.
Diffstat (limited to 'test/metadce/name_collision.wast')
-rw-r--r-- | test/metadce/name_collision.wast | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/metadce/name_collision.wast b/test/metadce/name_collision.wast new file mode 100644 index 000000000..62d11c697 --- /dev/null +++ b/test/metadce/name_collision.wast @@ -0,0 +1,18 @@ +(module + ;; This export is given the name "func$other" in the graph.text file, which + ;; collides with the internal name we give the function $other. A unique name + ;; should be generated for the function in the stdout that mentions it is + ;; unused, specifically + ;; + ;; unused: func$other$0 + ;; + ;; (the $0 suffix keeps it unique). + (export "test" (func $test)) + + ;; This function is used by the export. + (func $test) + + ;; This function is not used, and as mentioned above it will be called + ;; func$other$0 in the output. + (func $other) +) |