Skip to content

Commit a8d95ac

Browse files
authored
Add Memset+Memcpy to FutureFeatures.md (#1057)
1 parent b763aed commit a8d95ac

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

FutureFeatures.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,22 @@ static signature validation check. This could be improved by allowing:
561561
check of a call to a heterogeneous table;
562562
* any other specific GC reference type, effectively allowing WebAssembly code
563563
to implement a variety of rooting API schemes.
564+
565+
### Memset and Memcpy Operators
566+
567+
Copying and clearing large memory regions is very common, and making these
568+
operations fast is architecture dependent. Although this can be done in the MVP
569+
via `i32.load` and `i32.store`, this requires more bytes of code and forces VMs
570+
to recognize the loops as well. The following operators can be added to improve
571+
performance:
572+
573+
* `move_memory`: Copy data from a source memory region to destination region;
574+
these regions may overlap: the copy is performed as if the source region was
575+
first copied to a temporary buffer, then the temporary buffer is copied to
576+
the destination region
577+
* `set_memory`: Set all bytes in a memory region to a given byte
578+
579+
We expect that WebAssembly producers will use these operations when the region
580+
size is known to be large, and will use loads/stores otherwise.
581+
582+
TODO: determine how these operations interact w/ shared memory.

0 commit comments

Comments
 (0)