[WASM] Refactoring wasm array copy functions
diff --git a/generators/wasm/WasmIntrinsicGenerator.kt b/generators/wasm/WasmIntrinsicGenerator.kt
index aa5e683..70bacfa 100644
--- a/generators/wasm/WasmIntrinsicGenerator.kt
+++ b/generators/wasm/WasmIntrinsicGenerator.kt
@@ -104,11 +104,11 @@
     
                 @WasmOp(WasmOp.ARRAY_LEN)
                 fun len(): Int =
-                    implementedAsIntrinsic                    
+                    implementedAsIntrinsic
             }
             
-            internal inline fun $name.copyTo(destination: $name, sourceIndex: Int, destinationIndex: Int, length: Int) {
-                wasm_array_copy<$name>(destination, destinationIndex, this, sourceIndex, length)
+            internal inline fun copyWasmArray(source: $name, destination: $name, sourceIndex: Int, destinationIndex: Int, length: Int) {
+                wasm_array_copy<$name>(destination, destinationIndex, source, sourceIndex, length)
             }
     
             internal inline fun $name.fill(size: Int, init: (Int) -> $type) {
diff --git a/libraries/stdlib/wasm/builtins/kotlin/String.kt b/libraries/stdlib/wasm/builtins/kotlin/String.kt
index b119532..719c8bd 100644
--- a/libraries/stdlib/wasm/builtins/kotlin/String.kt
+++ b/libraries/stdlib/wasm/builtins/kotlin/String.kt
@@ -29,8 +29,8 @@
         if (otherLen == 0) return String(thisChars)
 
         val newChars = WasmCharArray(thisLen + otherLen)
-        thisChars.copyTo(newChars, 0, 0, thisLen)
-        otherChars.copyTo(newChars, 0, thisLen, otherLen)
+        copyWasmArray(thisChars, newChars, 0, 0, thisLen)
+        copyWasmArray(otherChars, newChars, 0, thisLen, otherLen)
         return String(newChars)
     }
 
@@ -54,7 +54,7 @@
         val actualEndIndex = endIndex.coerceAtMost(thisChars.len())
         val newCharsLen = actualEndIndex - actualStartIndex
         val newChars = WasmCharArray(newCharsLen)
-        thisChars.copyTo(newChars, actualStartIndex, 0, newCharsLen)
+        copyWasmArray(thisChars, newChars, actualStartIndex, 0, newCharsLen)
         return String(newChars)
     }
 
diff --git a/libraries/stdlib/wasm/src/generated/_ArraysWasm.kt b/libraries/stdlib/wasm/src/generated/_ArraysWasm.kt
index 322f415..c3f4ee7 100644
--- a/libraries/stdlib/wasm/src/generated/_ArraysWasm.kt
+++ b/libraries/stdlib/wasm/src/generated/_ArraysWasm.kt
@@ -1017,8 +1017,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun <T> Array<out T>.copyInto(destination: Array<T>, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): Array<T> {
-    @Suppress("UNCHECKED_CAST")
-    arrayCopy(this as Array<Any?>, startIndex, destination as Array<Any?>, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1041,7 +1043,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun ByteArray.copyInto(destination: ByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ByteArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1064,7 +1069,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun ShortArray.copyInto(destination: ShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ShortArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1087,7 +1095,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun IntArray.copyInto(destination: IntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): IntArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1110,7 +1121,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun LongArray.copyInto(destination: LongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): LongArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1133,7 +1147,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun FloatArray.copyInto(destination: FloatArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): FloatArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1156,7 +1173,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun DoubleArray.copyInto(destination: DoubleArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): DoubleArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1179,7 +1199,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun BooleanArray.copyInto(destination: BooleanArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): BooleanArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
@@ -1202,7 +1225,10 @@
 @SinceKotlin("1.3")
 @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
 public actual fun CharArray.copyInto(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): CharArray {
-    arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+    AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+    val rangeSize = endIndex - startIndex
+    AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+    kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
     return destination
 }
 
diff --git a/libraries/stdlib/wasm/src/generated/_WasmArrays.kt b/libraries/stdlib/wasm/src/generated/_WasmArrays.kt
index 3db1676..b28e080 100644
--- a/libraries/stdlib/wasm/src/generated/_WasmArrays.kt
+++ b/libraries/stdlib/wasm/src/generated/_WasmArrays.kt
@@ -32,11 +32,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmAnyArray.copyTo(destination: WasmAnyArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmAnyArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmAnyArray, destination: WasmAnyArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmAnyArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmAnyArray.fill(size: Int, init: (Int) -> Any?) {
@@ -58,11 +58,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmByteArray.copyTo(destination: WasmByteArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmByteArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmByteArray, destination: WasmByteArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmByteArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmByteArray.fill(size: Int, init: (Int) -> Byte) {
@@ -84,11 +84,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmCharArray.copyTo(destination: WasmCharArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmCharArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmCharArray, destination: WasmCharArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmCharArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmCharArray.fill(size: Int, init: (Int) -> Char) {
@@ -110,11 +110,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmShortArray.copyTo(destination: WasmShortArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmShortArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmShortArray, destination: WasmShortArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmShortArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmShortArray.fill(size: Int, init: (Int) -> Short) {
@@ -136,11 +136,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmIntArray.copyTo(destination: WasmIntArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmIntArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmIntArray, destination: WasmIntArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmIntArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmIntArray.fill(size: Int, init: (Int) -> Int) {
@@ -162,11 +162,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmLongArray.copyTo(destination: WasmLongArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmLongArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmLongArray, destination: WasmLongArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmLongArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmLongArray.fill(size: Int, init: (Int) -> Long) {
@@ -188,11 +188,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmFloatArray.copyTo(destination: WasmFloatArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmFloatArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmFloatArray, destination: WasmFloatArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmFloatArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmFloatArray.fill(size: Int, init: (Int) -> Float) {
@@ -214,11 +214,11 @@
 
     @WasmOp(WasmOp.ARRAY_LEN)
     fun len(): Int =
-        implementedAsIntrinsic                    
+        implementedAsIntrinsic
 }
 
-internal inline fun WasmDoubleArray.copyTo(destination: WasmDoubleArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
-    wasm_array_copy<WasmDoubleArray>(destination, destinationIndex, this, sourceIndex, length)
+internal inline fun copyWasmArray(source: WasmDoubleArray, destination: WasmDoubleArray, sourceIndex: Int, destinationIndex: Int, length: Int) {
+    wasm_array_copy<WasmDoubleArray>(destination, destinationIndex, source, sourceIndex, length)
 }
 
 internal inline fun WasmDoubleArray.fill(size: Int, init: (Int) -> Double) {
diff --git a/libraries/stdlib/wasm/src/kotlin/collections/ArraysWasm.kt b/libraries/stdlib/wasm/src/kotlin/collections/ArraysWasm.kt
index 862b4c5..7143e73 100644
--- a/libraries/stdlib/wasm/src/kotlin/collections/ArraysWasm.kt
+++ b/libraries/stdlib/wasm/src/kotlin/collections/ArraysWasm.kt
@@ -5,84 +5,6 @@
 
 package kotlin.collections
 
-import kotlin.wasm.internal.copyTo
-
-private inline fun rangeCheck(index: Int, count: Int, arraySize: Int) {
-    if (index < 0 || count < 0 || index + count > arraySize) throw IndexOutOfBoundsException()
-}
-
-internal inline fun arrayCopy(array: ByteArray, fromIndex: Int, destination: ByteArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: ShortArray, fromIndex: Int, destination: ShortArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: CharArray, fromIndex: Int, destination: CharArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: IntArray, fromIndex: Int, destination: IntArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: LongArray, fromIndex: Int, destination: LongArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: FloatArray, fromIndex: Int, destination: FloatArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: DoubleArray, fromIndex: Int, destination: DoubleArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: BooleanArray, fromIndex: Int, destination: BooleanArray, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
-internal inline fun arrayCopy(array: Array<Any?>, fromIndex: Int, destination: Array<Any?>, toIndex: Int, count: Int) {
-    val srcStorage = array.storage
-    rangeCheck(fromIndex, count, srcStorage.len())
-    val dstStorage = destination.storage
-    rangeCheck(toIndex, count, dstStorage.len())
-    srcStorage.copyTo(dstStorage, fromIndex, toIndex, count)
-}
-
 /**
  * Returns a *typed* array containing all of the elements of this collection.
  *
diff --git a/libraries/stdlib/wasm/src/kotlin/text/StringBuilderWasm.kt b/libraries/stdlib/wasm/src/kotlin/text/StringBuilderWasm.kt
index 771d4dc..80bdcf2 100644
--- a/libraries/stdlib/wasm/src/kotlin/text/StringBuilderWasm.kt
+++ b/libraries/stdlib/wasm/src/kotlin/text/StringBuilderWasm.kt
@@ -8,13 +8,13 @@
 import kotlin.wasm.internal.*
 
 internal fun insertString(array: CharArray, destinationIndex: Int, value: String, sourceIndex: Int, count: Int): Int {
-    value.chars.copyTo(array.storage, sourceIndex, destinationIndex, count)
+    copyWasmArray(value.chars, array.storage, sourceIndex, destinationIndex, count)
     return count
 }
 
 internal fun unsafeStringFromCharArray(array: CharArray, start: Int, size: Int): String {
     val copy = WasmCharArray(size)
-    array.storage.copyTo(copy, start, 0, size)
+    copyWasmArray(array.storage, copy, start, 0, size)
     return String.unsafeFromCharArray(copy)
 }
 
diff --git a/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt b/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt
index 89fde9f..fd033c1 100644
--- a/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt
+++ b/libraries/stdlib/wasm/src/kotlin/text/StringsWasm.kt
@@ -74,7 +74,7 @@
         throw IndexOutOfBoundsException()
 
     val copy = WasmCharArray(length)
-    chars.storage.copyTo(copy, offset, 0, length)
+    copyWasmArray(chars.storage, copy, offset, 0, length)
     return String.unsafeFromCharArray(copy)
 }
 
@@ -87,7 +87,7 @@
     val thisStorage = this.storage
     val thisLength = thisStorage.len()
     val copy = WasmCharArray(thisLength)
-    this.storage.copyTo(copy, 0, 0, thisLength)
+    copyWasmArray(this.storage, copy, 0, 0, thisLength)
     return String.unsafeFromCharArray(copy)
 }
 
@@ -108,7 +108,7 @@
 
     val length = endIndex - startIndex
     val copy = WasmCharArray(length)
-    this.storage.copyTo(copy, startIndex, 0, length)
+    copyWasmArray(this.storage, copy, startIndex, 0, length)
     return String.unsafeFromCharArray(copy)
 }
 
@@ -121,7 +121,7 @@
     val thisChars = this.chars
     val thisLength = thisChars.len()
     val newArray = CharArray(thisLength)
-    thisChars.copyTo(newArray.storage, 0, 0, thisLength)
+    copyWasmArray(thisChars, newArray.storage, 0, 0, thisLength)
     return newArray
 }
 
@@ -141,7 +141,7 @@
     AbstractList.checkBoundsIndexes(startIndex, endIndex, length)
     val newLength = endIndex - startIndex
     val newArray = CharArray(newLength)
-    this.chars.copyTo(newArray.storage, startIndex, 0, newLength)
+    copyWasmArray(this.chars, newArray.storage, startIndex, 0, newLength)
     return newArray
 }
 
diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt
index 96755d3..0c1d8c3 100644
--- a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt
+++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt
@@ -919,6 +919,17 @@
                         """
                     }
                 }
+                on(Backend.Wasm) {
+                    body {
+                        """
+                        AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
+                        val rangeSize = endIndex - startIndex
+                        AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
+                        kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
+                        return destination
+                        """
+                    }
+                }
             }
         }
     }