Movatterモバイル変換


[0]ホーム

URL:


  1. WebAssembly
  2. Reference
  3. WebAssembly memory instructions
  4. copy

copy: Wasm text instruction

Thecopymemory instruction copies data from one region of a memory to another.

The instruction does not return a value.If either the source or destination range is out of bounds, the instruction traps.

Syntax

Copy within default memory

wat
;; Copy data in default memory from [100, 125] to [50, 75]i32.const 50 ;; Destination address to copy toi32.const 100 ;; Source address to copy fromi32.const 25 ;; Number of bytes to copymemory.copy  ;; Copy memory;; Copy in default memory using an S-function(memory.copy (i32.const 50) (i32.const 100) (i32.const 25))

Copy specified memory (if multi-memory supported)

wat
;; Copy data in specific memory  [100, 125] to [50, 75]i32.const 50 ;; Destination address to copy toi32.const 100 ;; Source address to copy fromi32.const 25 ;; Number of bytes to copymemory.copy (memory 2)  ;; Copy memory within memory with index 2;; Copy within memory referenced by its namei32.const 50 ;; Destination address to copy toi32.const 100 ;; Source address to copy fromi32.const 25 ;; Number of bytes to copymemory.copy (memory $memoryName) ;; Copy memory with memory named "$memoryName";; Copy same memory using an S function(memory.copy (memory $memoryName) (i32.const 50) (i32.const 100) (i32.const 25))

Instructions and opcodes

InstructionBinary opcode
memory.copy0xFC 0x0a

Specifications

Specification
Unknown specification
# syntax-instr-memory

Browser compatibility

webassembly.bulk-memory-operations

webassembly.multiMemory

Note:ThemultiMemory compatibility table indicates versions in whichcopy can be used with a specified memory.

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp