Closed
Description
All WAT snippets were taken from the editor on the AssemblyScript's front page.
Redundant operations
export function foo(): void {
memory.fill(16, 255, 3);
}
;; INFO asc module.ts --textFile module.wat --binaryFile module.wasm -O3 --runtime stub
(module
(type $none_=>_none (func))
(memory $0 0)
(export "foo" (func $module/foo))
(export "memory" (memory $0))
(func $module/foo
i32.const 16
i32.const 255
i32.store8
i32.const 18
i32.const 255
i32.store8
i32.const 17
i32.const 255
i32.store8
i32.const 18
i32.const 255
i32.store8
i32.const 17
i32.const 255
i32.store8
i32.const 16
i32.const 255
i32.store8
)
)
Negative offsets
export function foo(): void {
memory.fill(0, 0, 2);
}
;; INFO asc module.ts --textFile module.wat --binaryFile module.wasm -O3 --runtime stub
(module
(type $none_=>_none (func))
(memory $0 0)
(export "foo" (func $module/foo))
(export "memory" (memory $0))
(func $module/foo
i32.const 0
i32.const 0
i32.store8
i32.const -2
i32.const 0
i32.store8 offset=3
)
)