Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 394c31b

Browse files
authored
Fix validation rules for memory.copy/fill/init (#56)
Also, update auto-generated test to cover 64-bit memories
1 parent 5cc08ad commit 394c31b

File tree

8 files changed

+8125
-892
lines changed

8 files changed

+8125
-892
lines changed

‎interpreter/valid/valid.ml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,17 @@ let rec check_instr (c : context) (e : instr) (s : infer_result_type) : op_type
397397
[value_type_of_index_type it] --> [value_type_of_index_type it]
398398

399399
| MemoryFill ->
400-
ignore (memory c (0l @@ e.at));
401-
[NumType I32Type; NumType I32Type; NumType I32Type] --> []
400+
let MemoryType (_, it) = memory c (0l @@ e.at) in
401+
[value_type_of_index_type it; NumType I32Type; value_type_of_index_type it] --> []
402402

403403
| MemoryCopy ->
404-
ignore (memory c (0l @@ e.at));
405-
[NumType I32Type; NumType I32Type; NumType I32Type] --> []
404+
let MemoryType (_, it) = memory c (0l @@ e.at) in
405+
[value_type_of_index_type it; value_type_of_index_type it; value_type_of_index_type it] --> []
406406

407407
| MemoryInit x ->
408-
ignore (memory c (0l @@ e.at));
408+
let MemoryType (_, it) = memory c (0l @@ e.at) in
409409
ignore (data c x);
410-
[NumType I32Type; NumType I32Type; NumType I32Type] --> []
410+
[value_type_of_index_type it; value_type_of_index_type it; value_type_of_index_type it] --> []
411411

412412
| DataDrop x ->
413413
ignore (data c x);

‎test/core/memory_copy.wast‎

Lines changed: 5574 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)