-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from data-pup/add-garbage-subcommand
Add a `twiggy garbage` command. Fixes issue #48.
- Loading branch information
Showing
13 changed files
with
260 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Bytes │ Size % │ Garbage Item | ||
───────┼────────┼────────────────────── | ||
11 ┊ 5.58% ┊ unusedAddThreeNumbers | ||
8 ┊ 4.06% ┊ unusedAddOne | ||
7 ┊ 3.55% ┊ type[2] | ||
5 ┊ 2.54% ┊ type[1] | ||
5 ┊ 2.54% ┊ unusedChild | ||
4 ┊ 2.03% ┊ type[0] | ||
1 ┊ 0.51% ┊ func[0] | ||
1 ┊ 0.51% ┊ func[1] | ||
1 ┊ 0.51% ┊ func[2] |
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 @@ | ||
[{"name":"unusedAddThreeNumbers","bytes":11,"size_percent":5.583756345177665},{"name":"unusedAddOne","bytes":8,"size_percent":4.060913705583756},{"name":"type[2]","bytes":7,"size_percent":3.5532994923857872},{"name":"type[1]","bytes":5,"size_percent":2.5380710659898478},{"name":"unusedChild","bytes":5,"size_percent":2.5380710659898478},{"name":"type[0]","bytes":4,"size_percent":2.030456852791878},{"name":"func[0]","bytes":1,"size_percent":0.5076142131979695},{"name":"func[1]","bytes":1,"size_percent":0.5076142131979695},{"name":"func[2]","bytes":1,"size_percent":0.5076142131979695}] |
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,4 @@ | ||
Bytes │ Size % │ Garbage Item | ||
───────┼────────┼────────────────────── | ||
11 ┊ 5.58% ┊ unusedAddThreeNumbers | ||
8 ┊ 4.06% ┊ unusedAddOne |
Binary file not shown.
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,43 @@ | ||
(module | ||
;; ------------------------------------------------------------------------- | ||
;; This is a WebAssembly text file that can be compiled in a wasm module to | ||
;; test the `twiggy garbage` command. This file contains exported functions, | ||
;; as well as unreachable functions of different sizes. | ||
;; ------------------------------------------------------------------------- | ||
;; NOTE: The test cases expect that this module is compiled with debug | ||
;; names written to the binary file, which affects the size percentages. | ||
;; Compile this file using the following command: | ||
;; | ||
;; wat2wasm --debug-names garbage.wat -o garbage.wasm | ||
;; ------------------------------------------------------------------------- | ||
|
||
;; This unused function is called by 'unusedAddOne'. Push 1 onto the stack. | ||
(func $unusedChild (result i32) | ||
i32.const 1) | ||
|
||
;; This unused function will call `unusedChild`, and return `val + 1`. | ||
(func $unusedAddOne (param $val i32) (result i32) | ||
get_local $val | ||
call $unusedChild | ||
i32.add) | ||
|
||
;; This unused function adds three numbers, and returns the result. | ||
(func $unusedAddThreeNumbers | ||
(param $first i32) (param $second i32) (param $third i32) (result i32) | ||
get_local $first | ||
get_local $second | ||
i32.add | ||
get_local $third | ||
i32.add | ||
) | ||
|
||
;; This function exists to test that reachable items are not shown. | ||
(func $add (param $lhs i32) (param $rhs i32) (result i32) | ||
get_local $lhs | ||
get_local $rhs | ||
i32.add | ||
) | ||
|
||
;; Export only the `add` function. | ||
(export "add" (func $add)) | ||
) |
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