v8/third_party/wasm-api/example/global.wat
Jakob Kummerow 912b3912b4 [wasm-c-api] Add upstream examples as tests
Plus a script to compile/link/run them.

Change-Id: Iac8ffcda3a73902261c07a7b4e5d967a19414c75
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1564058
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60911}
2019-04-17 18:04:16 +00:00

28 lines
1.5 KiB
Plaintext

(module
(global $f32_import (import "" "const f32") f32)
(global $i64_import (import "" "const i64") i64)
(global $mut_f32_import (import "" "var f32") (mut f32))
(global $mut_i64_import (import "" "var i64") (mut i64))
(global $f32_export (export "const f32") f32 (f32.const 5))
(global $i64_export (export "const i64") i64 (i64.const 6))
(global $mut_f32_export (export "var f32") (mut f32) (f32.const 7))
(global $mut_i64_export (export "var i64") (mut i64) (i64.const 8))
(func (export "get const f32 import") (result f32) (global.get $f32_import))
(func (export "get const i64 import") (result i64) (global.get $i64_import))
(func (export "get var f32 import") (result f32) (global.get $mut_f32_import))
(func (export "get var i64 import") (result i64) (global.get $mut_i64_import))
(func (export "get const f32 export") (result f32) (global.get $f32_export))
(func (export "get const i64 export") (result i64) (global.get $i64_export))
(func (export "get var f32 export") (result f32) (global.get $mut_f32_export))
(func (export "get var i64 export") (result i64) (global.get $mut_i64_export))
(func (export "set var f32 import") (param f32) (global.set $mut_f32_import (local.get 0)))
(func (export "set var i64 import") (param i64) (global.set $mut_i64_import (local.get 0)))
(func (export "set var f32 export") (param f32) (global.set $mut_f32_export (local.get 0)))
(func (export "set var f64 export") (param i64) (global.set $mut_i64_export (local.get 0)))
)