[WASM] Caching string literals in global pool

This commit is contained in:
Igor Yakovlev
2022-10-07 19:03:04 +02:00
committed by teamcity
parent f95bfccf59
commit 033e2c45f1
21 changed files with 206 additions and 126 deletions
@@ -102,8 +102,11 @@ public class Char private constructor(public val value: Char) : Comparable<Char>
public inline fun toDouble(): Double =
this.toInt().toDouble()
override fun toString(): String =
String(WasmCharArray(1).also { it.set(0, this) })
override fun toString(): String {
val array = WasmCharArray(1)
array.set(0, this)
return array.createString()
}
override fun hashCode(): Int =
this.toInt().hashCode()