Skip to content

Commit

Permalink
Fix validation rules for memory.copy/fill/init
Browse files Browse the repository at this point in the history
Also, update auto-generated test to cover 64-bit memories
  • Loading branch information
sbc100 committed May 2, 2024
1 parent 5cc08ad commit 9d0ef24
Show file tree
Hide file tree
Showing 8 changed files with 8,125 additions and 892 deletions.
12 changes: 6 additions & 6 deletions interpreter/valid/valid.ml
Original file line number Diff line number Diff line change
Expand Up @@ -397,17 +397,17 @@ let rec check_instr (c : context) (e : instr) (s : infer_result_type) : op_type
[value_type_of_index_type it] --> [value_type_of_index_type it]

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

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

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

| DataDrop x ->
ignore (data c x);
Expand Down
5,574 changes: 5,574 additions & 0 deletions test/core/memory_copy.wast

Large diffs are not rendered by default.

Loading

0 comments on commit 9d0ef24

Please sign in to comment.