-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ignore missing imports (the wasm may have already had them optimized out) * handle segments that hold on to globals (root them, for now, as we can't remove segments) * run reorder-functions, as the optimal order may have changed after we dce * fix global, global init, and segment offset reachability * fix import rooting and processing - imports may be imported more than once
- Loading branch information
Showing
10 changed files
with
193 additions
and
65 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(module | ||
(import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32)) | ||
(global $STACKTOP (mut i32) (get_global $STACKTOP$asm2wasm$import)) | ||
|
||
(import "env" "UNUSEDTOP" (global $UNUSEDTOP$asm2wasm$import i32)) | ||
(global $UNUSEDTOP (mut i32) (get_global $UNUSEDTOP$asm2wasm$import)) | ||
|
||
(import "env" "imported_twice" (func $imported_twice_a)) ;; and used just once, | ||
(import "env" "imported_twice" (func $imported_twice_b)) ;; but the other should not kill the import for both! | ||
|
||
(import "env" "an-imported-table-func" (func $imported_table_func)) | ||
|
||
(import "env" "table" (table 10 10 anyfunc)) | ||
(elem (i32.const 0) $imported_table_func) | ||
|
||
(export "stackAlloc" (func $stackAlloc)) | ||
|
||
(func $stackAlloc | ||
(drop (get_global $STACKTOP)) | ||
(call $imported_twice_a) | ||
) | ||
) | ||
|
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,17 @@ | ||
(module | ||
(type $FUNCSIG$v (func)) | ||
(import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32)) | ||
(import "env" "imported_twice" (func $imported_twice_a)) | ||
(import "env" "an-imported-table-func" (func $imported_table_func)) | ||
(import "env" "table" (table 10 10 anyfunc)) | ||
(global $STACKTOP (mut i32) (get_global $STACKTOP$asm2wasm$import)) | ||
(elem (i32.const 0) $imported_table_func) | ||
(memory $0 0) | ||
(export "stackAlloc" (func $stackAlloc)) | ||
(func $stackAlloc (; 2 ;) (type $FUNCSIG$v) | ||
(drop | ||
(get_global $STACKTOP) | ||
) | ||
(call $imported_twice_a) | ||
) | ||
) |
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,2 @@ | ||
unused: global$UNUSEDTOP$2 | ||
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,16 @@ | ||
[ | ||
{ | ||
"name": "ignorable import", | ||
"import": ["non", "existent"] | ||
}, | ||
{ | ||
"name": "imported_twice", | ||
"import": ["env", "imported_twice"] | ||
}, | ||
{ | ||
"name": "stackAllocGood", | ||
"export": "stackAlloc", | ||
"root": true | ||
} | ||
] | ||
|
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 |
---|---|---|
@@ -1,11 +1,6 @@ | ||
unused: export$wasm_func_unused$14 | ||
unused: export$wasm_func_unused$12 | ||
unused: func$an_unused_wasm_func$1 | ||
unused: global$__THREW__$3 | ||
unused: global$__THREW__unused$4 | ||
unused: global$from_segment$5 | ||
unused: global$from_segment_2$6 | ||
unused: global$from_segment_never_used$7 | ||
unused: import$0$12 | ||
unused: import$DYNAMICTOP_PTR$asm2wasm$import_unused$11 | ||
unused: import$an_unused_js_func$9 | ||
unused: import$import$table$0$13 |
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
Oops, something went wrong.