Skip to content

Commit

Permalink
Merge branch 'main' of github.com:WebAssembly/spec into wasmfx-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil committed Jun 28, 2024
2 parents e24d2ef + 2e6b128 commit 8d8b835
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/mirror-to-master.yml

This file was deleted.

2 changes: 1 addition & 1 deletion document/core/binary/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
.. note::
The initial integer can be interpreted as a bitfield.
Bit 0 indicates a passive or declarative segment,
Bit 0 distinguishes a passive or declarative segment from an active segment,
bit 1 indicates the presence of an explicit table index for an active segment and otherwise distinguishes passive from declarative segments,
bit 2 indicates the use of element type and element :ref:`expressions <binary-expr>` instead of element kind and element indices.

Expand Down
25 changes: 25 additions & 0 deletions test/core/memory.wast
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,28 @@
"(import \"\" \"\" (memory $foo 1))"
"(import \"\" \"\" (memory $foo 1))")
"duplicate memory")

;; Test that exporting random globals does not change a memory's semantics.

(module
(memory (export "memory") 1 1)

;; These should not change the behavior of memory accesses.
(global (export "__data_end") i32 (i32.const 10000))
(global (export "__stack_top") i32 (i32.const 10000))
(global (export "__heap_base") i32 (i32.const 10000))

(func (export "load") (param i32) (result i32)
(i32.load8_u (local.get 0))
)
)

;; None of these memory accesses should trap.
(assert_return (invoke "load" (i32.const 0)) (i32.const 0))
(assert_return (invoke "load" (i32.const 10000)) (i32.const 0))
(assert_return (invoke "load" (i32.const 20000)) (i32.const 0))
(assert_return (invoke "load" (i32.const 30000)) (i32.const 0))
(assert_return (invoke "load" (i32.const 40000)) (i32.const 0))
(assert_return (invoke "load" (i32.const 50000)) (i32.const 0))
(assert_return (invoke "load" (i32.const 60000)) (i32.const 0))
(assert_return (invoke "load" (i32.const 65535)) (i32.const 0))

0 comments on commit 8d8b835

Please sign in to comment.