forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wasm-metadce: Improve name deduplication (WebAssembly#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.
- Loading branch information
Showing
12 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
unused: global$UNUSEDTOP$2 | ||
unused: global$UNUSEDTOP | ||
unused: ignorable import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(module | ||
(type $0 (func)) | ||
(export "test" (func $test)) | ||
(func $test (type $0) | ||
(nop) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
unused: func$other$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"name": "func$other", | ||
"root": true, | ||
"export": "test" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
unused: export$wasm_func$4 | ||
unused: export$wasm_func_unused$5 | ||
unused: func$a_wasm_func$0 | ||
unused: func$an_unused_wasm_func$1 | ||
unused: export$wasm_func | ||
unused: export$wasm_func_unused | ||
unused: func$a_wasm_func | ||
unused: func$an_unused_wasm_func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
unused: export$wasm_func_unused$10 | ||
unused: func$an_unused_wasm_func$1 | ||
unused: global$__THREW__unused$4 | ||
unused: export$wasm_func_unused | ||
unused: func$an_unused_wasm_func | ||
unused: global$__THREW__unused |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
unused: export$wasm_func_a$4 | ||
unused: export$wasm_tag_a$5 | ||
unused: func$a_wasm_func$0 | ||
unused: tag$a_wasm_tag$2 | ||
unused: export$wasm_func_a | ||
unused: export$wasm_tag_a | ||
unused: func$a_wasm_func | ||
unused: tag$a_wasm_tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
unused: func$a_wasm_func$0 | ||
unused: func$a_wasm_func | ||
unused: outside_js_function | ||
unused: wasm_export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters