mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-07-31 03:51:56 +00:00
GC passive segments
We statically know which passive segments are actually used, so let's be sure to gc them!
This commit is contained in:
@@ -75,6 +75,7 @@ fn run_test(test: &Test) -> Result<(), Box<Error>> {
|
||||
let expected = extract_expected(&input);
|
||||
let status = Command::new("wat2wasm")
|
||||
.arg("--debug-names")
|
||||
.arg("--enable-bulk-memory")
|
||||
.arg(&test.input)
|
||||
.arg("-o")
|
||||
.arg(f.path())
|
||||
@@ -94,6 +95,7 @@ fn run_test(test: &Test) -> Result<(), Box<Error>> {
|
||||
fs::write(f.path(), wasm)?;
|
||||
|
||||
let status = Command::new("wasm2wat")
|
||||
.arg("--enable-bulk-memory")
|
||||
.arg(&f.path())
|
||||
.stderr(Stdio::inherit())
|
||||
.output()?;
|
||||
|
27
crates/gc/tests/wat/keep-passive-memory-segment.wat
Normal file
27
crates/gc/tests/wat/keep-passive-memory-segment.wat
Normal file
@@ -0,0 +1,27 @@
|
||||
(module
|
||||
(memory 0 10)
|
||||
|
||||
(func $foo
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
memory.init 0
|
||||
)
|
||||
|
||||
(data passive "wut")
|
||||
|
||||
(start $foo)
|
||||
)
|
||||
|
||||
;; STDOUT (update this section with `BLESS_TESTS=1` while running tests)
|
||||
;; (module
|
||||
;; (type (;0;) (func))
|
||||
;; (func $foo (type 0)
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; memory.init 0)
|
||||
;; (memory (;0;) 0 10)
|
||||
;; (start 0)
|
||||
;; (data (;0;) passive "wut"))
|
||||
;; STDOUT
|
30
crates/gc/tests/wat/keep-passive-segment.wat
Normal file
30
crates/gc/tests/wat/keep-passive-segment.wat
Normal file
@@ -0,0 +1,30 @@
|
||||
(module
|
||||
(import "" "" (table 0 1 anyfunc))
|
||||
|
||||
(func $foo
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
table.init 0
|
||||
)
|
||||
|
||||
(func $bar)
|
||||
|
||||
(elem passive $bar)
|
||||
|
||||
(start $foo)
|
||||
)
|
||||
|
||||
;; STDOUT (update this section with `BLESS_TESTS=1` while running tests)
|
||||
;; (module
|
||||
;; (type (;0;) (func))
|
||||
;; (import "" "" (table (;0;) 0 1 anyfunc))
|
||||
;; (func $foo (type 0)
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; table.init 0)
|
||||
;; (func $bar (type 0))
|
||||
;; (start 0)
|
||||
;; (elem (;0;) passive $bar))
|
||||
;; STDOUT
|
18
crates/gc/tests/wat/remove-passive-memory-segment.wat
Normal file
18
crates/gc/tests/wat/remove-passive-memory-segment.wat
Normal file
@@ -0,0 +1,18 @@
|
||||
(module
|
||||
(memory 0 10)
|
||||
|
||||
(func $foo
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
memory.init 0
|
||||
)
|
||||
|
||||
(data passive "wut")
|
||||
|
||||
)
|
||||
|
||||
;; STDOUT (update this section with `BLESS_TESTS=1` while running tests)
|
||||
;; (module
|
||||
;; (memory (;0;) 0 10))
|
||||
;; STDOUT
|
11
crates/gc/tests/wat/remove-unused-passive-segment.wat
Normal file
11
crates/gc/tests/wat/remove-unused-passive-segment.wat
Normal file
@@ -0,0 +1,11 @@
|
||||
(module
|
||||
(import "" "" (table 0 1 anyfunc))
|
||||
|
||||
(func $foo)
|
||||
|
||||
(elem passive $foo)
|
||||
)
|
||||
|
||||
;; STDOUT (update this section with `BLESS_TESTS=1` while running tests)
|
||||
;; (module)
|
||||
;; STDOUT
|
29
crates/gc/tests/wat/renumber-data-segment.wat
Normal file
29
crates/gc/tests/wat/renumber-data-segment.wat
Normal file
@@ -0,0 +1,29 @@
|
||||
(module
|
||||
(memory 0 10)
|
||||
|
||||
(func $foo
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
memory.init 1
|
||||
)
|
||||
|
||||
(data passive "wut")
|
||||
(data passive "wut2")
|
||||
(data passive "wut3")
|
||||
|
||||
(start $foo)
|
||||
)
|
||||
|
||||
;; STDOUT (update this section with `BLESS_TESTS=1` while running tests)
|
||||
;; (module
|
||||
;; (type (;0;) (func))
|
||||
;; (func $foo (type 0)
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; memory.init 0)
|
||||
;; (memory (;0;) 0 10)
|
||||
;; (start 0)
|
||||
;; (data (;0;) passive "wut2"))
|
||||
;; STDOUT
|
32
crates/gc/tests/wat/renumber-passive-segment.wat
Normal file
32
crates/gc/tests/wat/renumber-passive-segment.wat
Normal file
@@ -0,0 +1,32 @@
|
||||
(module
|
||||
(import "" "" (table 0 1 anyfunc))
|
||||
|
||||
(func $foo
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
table.init 1
|
||||
)
|
||||
|
||||
(func $bar)
|
||||
(func $bar2)
|
||||
|
||||
(elem passive $bar)
|
||||
(elem passive $bar2)
|
||||
|
||||
(start $foo)
|
||||
)
|
||||
|
||||
;; STDOUT (update this section with `BLESS_TESTS=1` while running tests)
|
||||
;; (module
|
||||
;; (type (;0;) (func))
|
||||
;; (import "" "" (table (;0;) 0 1 anyfunc))
|
||||
;; (func $foo (type 0)
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; i32.const 0
|
||||
;; table.init 0)
|
||||
;; (func $bar2 (type 0))
|
||||
;; (start 0)
|
||||
;; (elem (;0;) passive $bar2))
|
||||
;; STDOUT
|
Reference in New Issue
Block a user