Skip to content

Commit 8d8b835

Browse files
committed
Merge branch 'main' of github.com:WebAssembly/spec into wasmfx-merge
2 parents e24d2ef + 2e6b128 commit 8d8b835

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

.github/workflows/mirror-to-master.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

document/core/binary/modules.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
378378
379379
.. note::
380380
The initial integer can be interpreted as a bitfield.
381-
Bit 0 indicates a passive or declarative segment,
381+
Bit 0 distinguishes a passive or declarative segment from an active segment,
382382
bit 1 indicates the presence of an explicit table index for an active segment and otherwise distinguishes passive from declarative segments,
383383
bit 2 indicates the use of element type and element :ref:`expressions <binary-expr>` instead of element kind and element indices.
384384

test/core/memory.wast

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,28 @@
237237
"(import \"\" \"\" (memory $foo 1))"
238238
"(import \"\" \"\" (memory $foo 1))")
239239
"duplicate memory")
240+
241+
;; Test that exporting random globals does not change a memory's semantics.
242+
243+
(module
244+
(memory (export "memory") 1 1)
245+
246+
;; These should not change the behavior of memory accesses.
247+
(global (export "__data_end") i32 (i32.const 10000))
248+
(global (export "__stack_top") i32 (i32.const 10000))
249+
(global (export "__heap_base") i32 (i32.const 10000))
250+
251+
(func (export "load") (param i32) (result i32)
252+
(i32.load8_u (local.get 0))
253+
)
254+
)
255+
256+
;; None of these memory accesses should trap.
257+
(assert_return (invoke "load" (i32.const 0)) (i32.const 0))
258+
(assert_return (invoke "load" (i32.const 10000)) (i32.const 0))
259+
(assert_return (invoke "load" (i32.const 20000)) (i32.const 0))
260+
(assert_return (invoke "load" (i32.const 30000)) (i32.const 0))
261+
(assert_return (invoke "load" (i32.const 40000)) (i32.const 0))
262+
(assert_return (invoke "load" (i32.const 50000)) (i32.const 0))
263+
(assert_return (invoke "load" (i32.const 60000)) (i32.const 0))
264+
(assert_return (invoke "load" (i32.const 65535)) (i32.const 0))

0 commit comments

Comments
 (0)