[Wasm] Major compiler and stdlib update
This commit is contained in:
@@ -1,397 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:ExcludedFromCodegen
|
||||
@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "unused")
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
@WasmInstruction(WasmInstruction.UNREACHABLE)
|
||||
external fun wasm_unreachable(): Nothing
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_EQZ)
|
||||
external fun wasm_i32_eqz(a: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_EQ)
|
||||
external fun wasm_i32_eq(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_NE)
|
||||
external fun wasm_i32_ne(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_LT_S)
|
||||
external fun wasm_i32_lt_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_LT_U)
|
||||
external fun wasm_i32_lt_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_GT_S)
|
||||
external fun wasm_i32_gt_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_GT_U)
|
||||
external fun wasm_i32_gt_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_LE_S)
|
||||
external fun wasm_i32_le_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_LE_U)
|
||||
external fun wasm_i32_le_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_GE_S)
|
||||
external fun wasm_i32_ge_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_GE_U)
|
||||
external fun wasm_i32_ge_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_EQZ)
|
||||
external fun wasm_i64_eqz(a: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_EQ)
|
||||
external fun wasm_i64_eq(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_NE)
|
||||
external fun wasm_i64_ne(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_LT_S)
|
||||
external fun wasm_i64_lt_s(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_LT_U)
|
||||
external fun wasm_i64_lt_u(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_GT_S)
|
||||
external fun wasm_i64_gt_s(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_GT_U)
|
||||
external fun wasm_i64_gt_u(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_LE_S)
|
||||
external fun wasm_i64_le_s(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_LE_U)
|
||||
external fun wasm_i64_le_u(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_GE_S)
|
||||
external fun wasm_i64_ge_s(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_GE_U)
|
||||
external fun wasm_i64_ge_u(a: Long, b: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_EQ)
|
||||
external fun wasm_f32_eq(a: Float, b: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_NE)
|
||||
external fun wasm_f32_ne(a: Float, b: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_LT)
|
||||
external fun wasm_f32_lt(a: Float, b: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_GT)
|
||||
external fun wasm_f32_gt(a: Float, b: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_LE)
|
||||
external fun wasm_f32_le(a: Float, b: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_GE)
|
||||
external fun wasm_f32_ge(a: Float, b: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_EQ)
|
||||
external fun wasm_f64_eq(a: Double, b: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_NE)
|
||||
external fun wasm_f64_ne(a: Double, b: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_LT)
|
||||
external fun wasm_f64_lt(a: Double, b: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_GT)
|
||||
external fun wasm_f64_gt(a: Double, b: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_LE)
|
||||
external fun wasm_f64_le(a: Double, b: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_GE)
|
||||
external fun wasm_f64_ge(a: Double, b: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_CLZ)
|
||||
external fun wasm_i32_clz(a: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_CTZ)
|
||||
external fun wasm_i32_ctz(a: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_POPCNT)
|
||||
external fun wasm_i32_popcnt(a: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_ADD)
|
||||
external fun wasm_i32_add(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_SUB)
|
||||
external fun wasm_i32_sub(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_MUL)
|
||||
external fun wasm_i32_mul(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_DIV_S)
|
||||
external fun wasm_i32_div_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_DIV_U)
|
||||
external fun wasm_i32_div_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_REM_S)
|
||||
external fun wasm_i32_rem_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_REM_U)
|
||||
external fun wasm_i32_rem_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_AND)
|
||||
external fun wasm_i32_and(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_OR)
|
||||
external fun wasm_i32_or(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_XOR)
|
||||
external fun wasm_i32_xor(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_SHL)
|
||||
external fun wasm_i32_shl(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_SHR_S)
|
||||
external fun wasm_i32_shr_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_SHR_U)
|
||||
external fun wasm_i32_shr_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_ROTL)
|
||||
external fun wasm_i32_rotl(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_ROTR)
|
||||
external fun wasm_i32_rotr(a: Int, b: Int): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_CLZ)
|
||||
external fun wasm_i64_clz(a: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_CTZ)
|
||||
external fun wasm_i64_ctz(a: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_POPCNT)
|
||||
external fun wasm_i64_popcnt(a: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_ADD)
|
||||
external fun wasm_i64_add(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_SUB)
|
||||
external fun wasm_i64_sub(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_MUL)
|
||||
external fun wasm_i64_mul(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_DIV_S)
|
||||
external fun wasm_i64_div_s(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_DIV_U)
|
||||
external fun wasm_i64_div_u(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_REM_S)
|
||||
external fun wasm_i64_rem_s(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_REM_U)
|
||||
external fun wasm_i64_rem_u(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_AND)
|
||||
external fun wasm_i64_and(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_OR)
|
||||
external fun wasm_i64_or(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_XOR)
|
||||
external fun wasm_i64_xor(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_SHL)
|
||||
external fun wasm_i64_shl(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_SHR_S)
|
||||
external fun wasm_i64_shr_s(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_SHR_U)
|
||||
external fun wasm_i64_shr_u(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_ROTL)
|
||||
external fun wasm_i64_rotl(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_ROTR)
|
||||
external fun wasm_i64_rotr(a: Long, b: Long): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_ABS)
|
||||
external fun wasm_f32_abs(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_NEG)
|
||||
external fun wasm_f32_neg(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CEIL)
|
||||
external fun wasm_f32_ceil(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_FLOOR)
|
||||
external fun wasm_f32_floor(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_TRUNC)
|
||||
external fun wasm_f32_trunc(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_NEAREST)
|
||||
external fun wasm_f32_nearest(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_SQRT)
|
||||
external fun wasm_f32_sqrt(a: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_ADD)
|
||||
external fun wasm_f32_add(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_SUB)
|
||||
external fun wasm_f32_sub(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_MUL)
|
||||
external fun wasm_f32_mul(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_DIV)
|
||||
external fun wasm_f32_div(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_FMIN)
|
||||
external fun wasm_f32_fmin(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_FMAX)
|
||||
external fun wasm_f32_fmax(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_COPYSIGN)
|
||||
external fun wasm_f32_copysign(a: Float, b: Float): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_ABS)
|
||||
external fun wasm_f64_abs(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_NEG)
|
||||
external fun wasm_f64_neg(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CEIL)
|
||||
external fun wasm_f64_ceil(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_FLOOR)
|
||||
external fun wasm_f64_floor(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_TRUNC)
|
||||
external fun wasm_f64_trunc(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_NEAREST)
|
||||
external fun wasm_f64_nearest(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_SQRT)
|
||||
external fun wasm_f64_sqrt(a: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_ADD)
|
||||
external fun wasm_f64_add(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_SUB)
|
||||
external fun wasm_f64_sub(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_MUL)
|
||||
external fun wasm_f64_mul(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_DIV)
|
||||
external fun wasm_f64_div(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_FMIN)
|
||||
external fun wasm_f64_fmin(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_FMAX)
|
||||
external fun wasm_f64_fmax(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_COPYSIGN)
|
||||
external fun wasm_f64_copysign(a: Double, b: Double): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_WRAP_I64)
|
||||
external fun wasm_i32_wrap_i64(a: Long): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_TRUNC_F32_S)
|
||||
external fun wasm_i32_trunc_f32_s(a: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_TRUNC_F32_U)
|
||||
external fun wasm_i32_trunc_f32_u(a: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_TRUNC_F64_S)
|
||||
external fun wasm_i32_trunc_f64_s(a: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_TRUNC_F64_U)
|
||||
external fun wasm_i32_trunc_f64_u(a: Double): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_EXTEND_I32_S)
|
||||
external fun wasm_i64_extend_i32_s(a: Int): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_EXTEND_I32_U)
|
||||
external fun wasm_i64_extend_i32_u(a: Int): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_TRUNC_F32_S)
|
||||
external fun wasm_i64_trunc_f32_s(a: Float): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_TRUNC_F32_U)
|
||||
external fun wasm_i64_trunc_f32_u(a: Float): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_TRUNC_F64_S)
|
||||
external fun wasm_i64_trunc_f64_s(a: Double): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_TRUNC_F64_U)
|
||||
external fun wasm_i64_trunc_f64_u(a: Double): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONVERT_I32_S)
|
||||
external fun wasm_f32_convert_i32_s(a: Int): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONVERT_I32_U)
|
||||
external fun wasm_f32_convert_i32_u(a: Int): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONVERT_I64_S)
|
||||
external fun wasm_f32_convert_i64_s(a: Long): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONVERT_I64_U)
|
||||
external fun wasm_f32_convert_i64_u(a: Long): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_DEMOTE_F64)
|
||||
external fun wasm_f32_demote_f64(a: Double): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONVERT_I32_S)
|
||||
external fun wasm_f64_convert_i32_s(a: Int): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONVERT_I32_U)
|
||||
external fun wasm_f64_convert_i32_u(a: Int): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONVERT_I64_S)
|
||||
external fun wasm_f64_convert_i64_s(a: Long): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONVERT_I64_U)
|
||||
external fun wasm_f64_convert_i64_u(a: Long): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_PROMOTE_F32)
|
||||
external fun wasm_f64_promote_f32(a: Float): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.I32_REINTERPRET_F32)
|
||||
external fun wasm_i32_reinterpret_f32(a: Float): Int
|
||||
|
||||
@WasmInstruction(WasmInstruction.I64_REINTERPRET_F64)
|
||||
external fun wasm_i64_reinterpret_f64(a: Double): Long
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_REINTERPRET_I32)
|
||||
external fun wasm_f32_reinterpret_i32(a: Int): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONST_NAN)
|
||||
external fun wasm_f32_const_nan(): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONST_PLUS_INF)
|
||||
external fun wasm_f32_const_plus_inf(): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F32_CONST_MINUS_INF)
|
||||
external fun wasm_f32_const_minus_inf(): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONST_NAN)
|
||||
external fun wasm_f64_const_nan(): Double
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONST_PLUS_INF)
|
||||
external fun wasm_f64_const_plus_inf(): Float
|
||||
|
||||
@WasmInstruction(WasmInstruction.F64_CONST_MINUS_INF)
|
||||
external fun wasm_f64_const_minus_inf(): Float
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
// `compareTo(x, y)` implemented as `(x >= y) - (x <= y)`
|
||||
|
||||
fun wasm_i32_compareTo(x: Int, y: Int): Int =
|
||||
wasm_i32_ge_s(x, y) - wasm_i32_le_s(x, y)
|
||||
|
||||
fun wasm_i64_compareTo(x: Long, y: Long): Int =
|
||||
wasm_i64_ge_s(x, y) - wasm_i64_le_s(x, y)
|
||||
|
||||
fun wasm_f32_compareTo(x: Float, y: Float): Int =
|
||||
wasm_f32_ge(x, y) - wasm_f32_le(x, y)
|
||||
|
||||
fun wasm_f64_compareTo(x: Double, y: Double): Int =
|
||||
wasm_f64_ge(x, y) - wasm_f64_le(x, y)
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
internal object DefaultConstructorMarker
|
||||
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("unused")
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
/** A function that takes 0 arguments. */
|
||||
public interface Function0<out R> : Function<R> {
|
||||
/** Invokes the function. */
|
||||
public operator fun invoke(): R
|
||||
}
|
||||
|
||||
/** A function that takes 1 argument. */
|
||||
public interface Function1<in P1, out R> : Function<R> {
|
||||
/** Invokes the function with the specified argument. */
|
||||
public operator fun invoke(p1: P1): R
|
||||
}
|
||||
|
||||
/** A function that takes 2 arguments. */
|
||||
public interface Function2<in P1, in P2, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2): R
|
||||
}
|
||||
|
||||
/** A function that takes 3 arguments. */
|
||||
public interface Function3<in P1, in P2, in P3, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3): R
|
||||
}
|
||||
|
||||
/** A function that takes 4 arguments. */
|
||||
public interface Function4<in P1, in P2, in P3, in P4, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4): R
|
||||
}
|
||||
|
||||
/** A function that takes 5 arguments. */
|
||||
public interface Function5<in P1, in P2, in P3, in P4, in P5, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): R
|
||||
}
|
||||
|
||||
/** A function that takes 6 arguments. */
|
||||
public interface Function6<in P1, in P2, in P3, in P4, in P5, in P6, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): R
|
||||
}
|
||||
|
||||
/** A function that takes 7 arguments. */
|
||||
public interface Function7<in P1, in P2, in P3, in P4, in P5, in P6, in P7, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): R
|
||||
}
|
||||
|
||||
/** A function that takes 8 arguments. */
|
||||
public interface Function8<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): R
|
||||
}
|
||||
|
||||
/** A function that takes 9 arguments. */
|
||||
public interface Function9<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): R
|
||||
}
|
||||
|
||||
/** A function that takes 10 arguments. */
|
||||
public interface Function10<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10): R
|
||||
}
|
||||
|
||||
/** A function that takes 11 arguments. */
|
||||
public interface Function11<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11): R
|
||||
}
|
||||
|
||||
/** A function that takes 12 arguments. */
|
||||
public interface Function12<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, out R> : Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12): R
|
||||
}
|
||||
|
||||
/** A function that takes 13 arguments. */
|
||||
public interface Function13<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 14 arguments. */
|
||||
public interface Function14<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 15 arguments. */
|
||||
public interface Function15<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 16 arguments. */
|
||||
public interface Function16<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 17 arguments. */
|
||||
public interface Function17<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16,
|
||||
p17: P17
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 18 arguments. */
|
||||
public interface Function18<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16,
|
||||
p17: P17,
|
||||
p18: P18
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 19 arguments. */
|
||||
public interface Function19<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16,
|
||||
p17: P17,
|
||||
p18: P18,
|
||||
p19: P19
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 20 arguments. */
|
||||
public interface Function20<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16,
|
||||
p17: P17,
|
||||
p18: P18,
|
||||
p19: P19,
|
||||
p20: P20
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 21 arguments. */
|
||||
public interface Function21<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16,
|
||||
p17: P17,
|
||||
p18: P18,
|
||||
p19: P19,
|
||||
p20: P20,
|
||||
p21: P21
|
||||
): R
|
||||
}
|
||||
|
||||
/** A function that takes 22 arguments. */
|
||||
public interface Function22<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, in P22, out R> :
|
||||
Function<R> {
|
||||
/** Invokes the function with the specified arguments. */
|
||||
public operator fun invoke(
|
||||
p1: P1,
|
||||
p2: P2,
|
||||
p3: P3,
|
||||
p4: P4,
|
||||
p5: P5,
|
||||
p6: P6,
|
||||
p7: P7,
|
||||
p8: P8,
|
||||
p9: P9,
|
||||
p10: P10,
|
||||
p11: P11,
|
||||
p12: P12,
|
||||
p13: P13,
|
||||
p14: P14,
|
||||
p15: P15,
|
||||
p16: P16,
|
||||
p17: P17,
|
||||
p18: P18,
|
||||
p19: P19,
|
||||
p20: P20,
|
||||
p21: P21,
|
||||
p22: P22
|
||||
): R
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
@ExcludedFromCodegen
|
||||
@WasmForeign
|
||||
internal class WasmExternRef
|
||||
|
||||
@WasmImport("runtime", "JsArray_new")
|
||||
internal fun JsArray_new(size: Int): WasmExternRef =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Byte(array: WasmExternRef, index: Int): Byte = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Byte(array: WasmExternRef, index: Int, value: Byte): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Char(array: WasmExternRef, index: Int): Char = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Char(array: WasmExternRef, index: Int, value: Char): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Short(array: WasmExternRef, index: Int): Short = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Short(array: WasmExternRef, index: Int, value: Short): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Int(array: WasmExternRef, index: Int): Int = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Int(array: WasmExternRef, index: Int, value: Int): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Long(array: WasmExternRef, index: Int): Long = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Long(array: WasmExternRef, index: Int, value: Long): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Float(array: WasmExternRef, index: Int): Float = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Float(array: WasmExternRef, index: Int, value: Float): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Double(array: WasmExternRef, index: Int): Double = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Double(array: WasmExternRef, index: Int, value: Double): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_Boolean(array: WasmExternRef, index: Int): Boolean = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_Boolean(array: WasmExternRef, index: Int, value: Boolean): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_get")
|
||||
internal fun JsArray_get_WasmExternRef(array: WasmExternRef, index: Int): WasmExternRef = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_set")
|
||||
internal fun JsArray_set_WasmExternRef(array: WasmExternRef, index: Int, value: WasmExternRef): Unit = implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "JsArray_getSize")
|
||||
internal fun JsArray_getSize(array: WasmExternRef): Int =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "identity")
|
||||
internal fun Any?.toWasmExternRef(): WasmExternRef =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@WasmImport("runtime", "identity")
|
||||
internal fun WasmExternRefToAny(ref: WasmExternRef): Any? =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal inline fun JsArray_fill_Byte(array: WasmExternRef, size: Int, init: (Int) -> Byte) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Byte(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Char(array: WasmExternRef, size: Int, init: (Int) -> Char) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Char(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Short(array: WasmExternRef, size: Int, init: (Int) -> Short) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Short(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Int(array: WasmExternRef, size: Int, init: (Int) -> Int) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Int(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Long(array: WasmExternRef, size: Int, init: (Int) -> Long) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Long(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Float(array: WasmExternRef, size: Int, init: (Int) -> Float) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Float(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Double(array: WasmExternRef, size: Int, init: (Int) -> Double) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Double(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun JsArray_fill_Boolean(array: WasmExternRef, size: Int, init: (Int) -> Boolean) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_Boolean(array, i, init(i))
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun <T> JsArray_fill_T(array: WasmExternRef, size: Int, init: (Int) -> T) {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
JsArray_set_WasmExternRef(array, i, init(i).toWasmExternRef())
|
||||
i++
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
@WasmImport("runtime", "String_getLiteral")
|
||||
internal fun stringLiteral(index: Int): String =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@WasmReinterpret
|
||||
internal fun unsafeNotNull(x: Any?): Any =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal fun nullableEquals(lhs: Any?, rhs: Any?): Boolean {
|
||||
if (wasm_ref_is_null(lhs))
|
||||
return wasm_ref_is_null(rhs)
|
||||
return unsafeNotNull(lhs).equals(rhs)
|
||||
}
|
||||
|
||||
internal fun anyNtoString(x: Any?): String = x.toString()
|
||||
|
||||
internal fun nullableFloatIeee754Equals(lhs: Float?, rhs: Float?): Boolean {
|
||||
if (lhs == null) return rhs == null
|
||||
if (rhs == null) return false
|
||||
return wasm_f32_eq(lhs, rhs)
|
||||
}
|
||||
|
||||
internal fun nullableDoubleIeee754Equals(lhs: Double?, rhs: Double?): Boolean {
|
||||
if (lhs == null) return rhs == null
|
||||
if (rhs == null) return false
|
||||
return wasm_f64_eq(lhs, rhs)
|
||||
}
|
||||
|
||||
|
||||
internal fun <T : Any> ensureNotNull(v: T?): T = if (v == null) THROW_NPE() else v
|
||||
|
||||
@ExcludedFromCodegen
|
||||
internal fun <T, R> boxIntrinsic(x: T): R =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@ExcludedFromCodegen
|
||||
internal fun <T, R> unboxIntrinsic(x: T): R =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal fun wasmThrow(e: Throwable): Nothing {
|
||||
println("Kotlin/Wasm exception wasm thrown: ${e.message}")
|
||||
wasm_unreachable()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
internal fun THROW_CCE(): Nothing {
|
||||
throw ClassCastException()
|
||||
}
|
||||
|
||||
internal fun THROW_NPE(): Nothing {
|
||||
throw NullPointerException()
|
||||
}
|
||||
|
||||
internal fun THROW_ISE(): Nothing {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
|
||||
internal fun THROW_IAE(): Nothing {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
internal fun throwUninitializedPropertyAccessException(name: String): Nothing {
|
||||
throw UninitializedPropertyAccessException("lateinit property $name has not been initialized")
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("unused") // Used by compiler
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
internal const val TYPE_INFO_ELEMENT_SIZE = 4
|
||||
|
||||
internal const val TYPE_INFO_VTABLE_OFFSET = 2 * TYPE_INFO_ELEMENT_SIZE
|
||||
internal const val TYPE_INFO_VTABLE_LENGTH_OFFSET = TYPE_INFO_ELEMENT_SIZE
|
||||
internal const val SUPER_CLASS_ID_OFFSET = 0
|
||||
|
||||
internal fun getVtablePtr(obj: Any): Int =
|
||||
obj.typeInfo + TYPE_INFO_VTABLE_OFFSET
|
||||
|
||||
internal fun getVtableLength(obj: Any): Int =
|
||||
wasm_i32_load(obj.typeInfo + TYPE_INFO_VTABLE_LENGTH_OFFSET)
|
||||
|
||||
internal fun getInterfaceListLength(obj: Any): Int =
|
||||
wasm_i32_load(obj.typeInfo + TYPE_INFO_VTABLE_LENGTH_OFFSET)
|
||||
|
||||
internal fun getSuperClassId(obj: Any): Int =
|
||||
wasm_i32_load(obj.typeInfo + SUPER_CLASS_ID_OFFSET)
|
||||
|
||||
internal fun getVirtualMethodId(obj: Any, virtualFunctionSlot: Int): Int {
|
||||
val vtablePtr = getVtablePtr(obj)
|
||||
val methodIdPtr = vtablePtr + virtualFunctionSlot * TYPE_INFO_ELEMENT_SIZE
|
||||
return wasm_i32_load(methodIdPtr)
|
||||
}
|
||||
|
||||
internal fun getInterfaceMethodId(obj: Any, methodSignatureId: Int): Int {
|
||||
val vtableLength = getVtableLength(obj)
|
||||
val vtableSignatures = getVtablePtr(obj) + vtableLength * TYPE_INFO_ELEMENT_SIZE
|
||||
var virtualFunctionSlot = 0
|
||||
while (virtualFunctionSlot < vtableLength) {
|
||||
if (wasm_i32_load(vtableSignatures + virtualFunctionSlot * TYPE_INFO_ELEMENT_SIZE) == methodSignatureId) {
|
||||
return getVirtualMethodId(obj, virtualFunctionSlot)
|
||||
}
|
||||
virtualFunctionSlot++
|
||||
}
|
||||
wasm_unreachable()
|
||||
}
|
||||
|
||||
|
||||
internal fun isSubClassOfImpl(currentClassId: Int, otherClassId: Int): Boolean {
|
||||
if (currentClassId == otherClassId) return true
|
||||
val anyClassId = wasmClassId<Any>()
|
||||
if (currentClassId == anyClassId && otherClassId != anyClassId) return false
|
||||
return isSubClassOfImpl(wasm_i32_load(currentClassId + SUPER_CLASS_ID_OFFSET), otherClassId)
|
||||
}
|
||||
|
||||
internal fun isSubClass(obj: Any, classId: Int): Boolean {
|
||||
return isSubClassOfImpl(obj.typeInfo, classId)
|
||||
}
|
||||
|
||||
internal fun isInterface(obj: Any, interfaceId: Int): Boolean {
|
||||
val vtableLength = getVtableLength(obj)
|
||||
val interfaceListSizePtr = getVtablePtr(obj) + 2 * vtableLength * TYPE_INFO_ELEMENT_SIZE
|
||||
val interfaceListPtr = interfaceListSizePtr + TYPE_INFO_ELEMENT_SIZE
|
||||
val interfaceListSize = wasm_i32_load(interfaceListSizePtr)
|
||||
|
||||
var interfaceSlot = 0
|
||||
while (interfaceSlot < interfaceListSize) {
|
||||
val supportedInterface = wasm_i32_load(interfaceListPtr + interfaceSlot * TYPE_INFO_ELEMENT_SIZE)
|
||||
if (supportedInterface == interfaceId) {
|
||||
return true
|
||||
}
|
||||
interfaceSlot++
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@ExcludedFromCodegen
|
||||
internal fun <T> wasmClassId(): Int =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@ExcludedFromCodegen
|
||||
internal fun <T> wasmInterfaceId(): Int =
|
||||
implementedAsIntrinsic
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
// Exclude declaration or file from lowering and code generation
|
||||
@Target(FILE, CLASS, FUNCTION, CONSTRUCTOR, PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class ExcludedFromCodegen
|
||||
|
||||
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmImport(val module: String, val name: String)
|
||||
|
||||
@Target(CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmForeign
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmReinterpret
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmPrimitive
|
||||
|
||||
/**
|
||||
* Replace calls to this functions with specified Wasm instruction.
|
||||
*
|
||||
* Operands are passed in the following order:
|
||||
* 1. Dispatch receiver (if present)
|
||||
* 2. Extension receiver (if present)
|
||||
* 3. Value arguments
|
||||
*
|
||||
* @mnemonic parameter is an instruction WAT name: "i32.add", "f64.trunc", etc.
|
||||
*
|
||||
* Immediate arguments (label, index, offest, align, etc.) are not supported yet.
|
||||
*/
|
||||
|
||||
@ExcludedFromCodegen
|
||||
internal val implementedAsIntrinsic: Nothing
|
||||
get() = null!!
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:ExcludedFromCodegen
|
||||
@file:Suppress("unused")
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
@WasmOp(WasmOp.UNREACHABLE)
|
||||
internal fun wasm_unreachable(): Nothing =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal fun wasm_float_nan(): Float =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal fun wasm_double_nan(): Double =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal fun <From, To> wasm_ref_cast(a: From): To =
|
||||
implementedAsIntrinsic
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
// `compareTo(x, y)` implemented as `(x >= y) - (x <= y)`
|
||||
|
||||
fun wasm_i32_compareTo(x: Int, y: Int): Int =
|
||||
wasm_i32_ge_s(x, y).toInt() - wasm_i32_le_s(x, y).toInt()
|
||||
|
||||
fun wasm_i64_compareTo(x: Long, y: Long): Int =
|
||||
wasm_i64_ge_s(x, y).toInt() - wasm_i64_le_s(x, y).toInt()
|
||||
|
||||
@WasmImport("runtime", "String_equals")
|
||||
fun wasm_string_eq(x: String, y: String): Boolean =
|
||||
implementedAsIntrinsic
|
||||
@@ -0,0 +1,514 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:ExcludedFromCodegen
|
||||
@file:Suppress(
|
||||
"INLINE_CLASS_IN_EXTERNAL_DECLARATION",
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"unused"
|
||||
)
|
||||
|
||||
package kotlin.wasm.internal
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmOp(val name: String) {
|
||||
companion object {
|
||||
const val I32_EQZ = "I32_EQZ"
|
||||
const val I64_EQZ = "I64_EQZ"
|
||||
const val I32_CLZ = "I32_CLZ"
|
||||
const val I32_CTZ = "I32_CTZ"
|
||||
const val I32_POPCNT = "I32_POPCNT"
|
||||
const val I64_CLZ = "I64_CLZ"
|
||||
const val I64_CTZ = "I64_CTZ"
|
||||
const val I64_POPCNT = "I64_POPCNT"
|
||||
const val F32_ABS = "F32_ABS"
|
||||
const val F32_NEG = "F32_NEG"
|
||||
const val F32_CEIL = "F32_CEIL"
|
||||
const val F32_FLOOR = "F32_FLOOR"
|
||||
const val F32_TRUNC = "F32_TRUNC"
|
||||
const val F32_NEAREST = "F32_NEAREST"
|
||||
const val F32_SQRT = "F32_SQRT"
|
||||
const val F64_ABS = "F64_ABS"
|
||||
const val F64_NEG = "F64_NEG"
|
||||
const val F64_CEIL = "F64_CEIL"
|
||||
const val F64_FLOOR = "F64_FLOOR"
|
||||
const val F64_TRUNC = "F64_TRUNC"
|
||||
const val F64_NEAREST = "F64_NEAREST"
|
||||
const val F64_SQRT = "F64_SQRT"
|
||||
const val I32_WRAP_I64 = "I32_WRAP_I64"
|
||||
const val I32_TRUNC_F32_S = "I32_TRUNC_F32_S"
|
||||
const val I32_TRUNC_F32_U = "I32_TRUNC_F32_U"
|
||||
const val I32_TRUNC_F64_S = "I32_TRUNC_F64_S"
|
||||
const val I32_TRUNC_F64_U = "I32_TRUNC_F64_U"
|
||||
const val I64_EXTEND_I32_S = "I64_EXTEND_I32_S"
|
||||
const val I64_EXTEND_I32_U = "I64_EXTEND_I32_U"
|
||||
const val I64_TRUNC_F32_S = "I64_TRUNC_F32_S"
|
||||
const val I64_TRUNC_F32_U = "I64_TRUNC_F32_U"
|
||||
const val I64_TRUNC_F64_S = "I64_TRUNC_F64_S"
|
||||
const val I64_TRUNC_F64_U = "I64_TRUNC_F64_U"
|
||||
const val F32_CONVERT_I32_S = "F32_CONVERT_I32_S"
|
||||
const val F32_CONVERT_I32_U = "F32_CONVERT_I32_U"
|
||||
const val F32_CONVERT_I64_S = "F32_CONVERT_I64_S"
|
||||
const val F32_CONVERT_I64_U = "F32_CONVERT_I64_U"
|
||||
const val F32_DEMOTE_F64 = "F32_DEMOTE_F64"
|
||||
const val F64_CONVERT_I32_S = "F64_CONVERT_I32_S"
|
||||
const val F64_CONVERT_I32_U = "F64_CONVERT_I32_U"
|
||||
const val F64_CONVERT_I64_S = "F64_CONVERT_I64_S"
|
||||
const val F64_CONVERT_I64_U = "F64_CONVERT_I64_U"
|
||||
const val F64_PROMOTE_F32 = "F64_PROMOTE_F32"
|
||||
const val I32_REINTERPRET_F32 = "I32_REINTERPRET_F32"
|
||||
const val I64_REINTERPRET_F64 = "I64_REINTERPRET_F64"
|
||||
const val F32_REINTERPRET_I32 = "F32_REINTERPRET_I32"
|
||||
const val F64_REINTERPRET_I64 = "F64_REINTERPRET_I64"
|
||||
const val I32_EXTEND8_S = "I32_EXTEND8_S"
|
||||
const val I32_EXTEND16_S = "I32_EXTEND16_S"
|
||||
const val I64_EXTEND8_S = "I64_EXTEND8_S"
|
||||
const val I64_EXTEND16_S = "I64_EXTEND16_S"
|
||||
const val I64_EXTEND32_S = "I64_EXTEND32_S"
|
||||
const val I32_TRUNC_SAT_F32_S = "I32_TRUNC_SAT_F32_S"
|
||||
const val I32_TRUNC_SAT_F32_U = "I32_TRUNC_SAT_F32_U"
|
||||
const val I32_TRUNC_SAT_F64_S = "I32_TRUNC_SAT_F64_S"
|
||||
const val I32_TRUNC_SAT_F64_U = "I32_TRUNC_SAT_F64_U"
|
||||
const val I64_TRUNC_SAT_F32_S = "I64_TRUNC_SAT_F32_S"
|
||||
const val I64_TRUNC_SAT_F32_U = "I64_TRUNC_SAT_F32_U"
|
||||
const val I64_TRUNC_SAT_F64_S = "I64_TRUNC_SAT_F64_S"
|
||||
const val I64_TRUNC_SAT_F64_U = "I64_TRUNC_SAT_F64_U"
|
||||
const val I32_EQ = "I32_EQ"
|
||||
const val I32_NE = "I32_NE"
|
||||
const val I32_LT_S = "I32_LT_S"
|
||||
const val I32_LT_U = "I32_LT_U"
|
||||
const val I32_GT_S = "I32_GT_S"
|
||||
const val I32_GT_U = "I32_GT_U"
|
||||
const val I32_LE_S = "I32_LE_S"
|
||||
const val I32_LE_U = "I32_LE_U"
|
||||
const val I32_GE_S = "I32_GE_S"
|
||||
const val I32_GE_U = "I32_GE_U"
|
||||
const val I64_EQ = "I64_EQ"
|
||||
const val I64_NE = "I64_NE"
|
||||
const val I64_LT_S = "I64_LT_S"
|
||||
const val I64_LT_U = "I64_LT_U"
|
||||
const val I64_GT_S = "I64_GT_S"
|
||||
const val I64_GT_U = "I64_GT_U"
|
||||
const val I64_LE_S = "I64_LE_S"
|
||||
const val I64_LE_U = "I64_LE_U"
|
||||
const val I64_GE_S = "I64_GE_S"
|
||||
const val I64_GE_U = "I64_GE_U"
|
||||
const val F32_EQ = "F32_EQ"
|
||||
const val F32_NE = "F32_NE"
|
||||
const val F32_LT = "F32_LT"
|
||||
const val F32_GT = "F32_GT"
|
||||
const val F32_LE = "F32_LE"
|
||||
const val F32_GE = "F32_GE"
|
||||
const val F64_EQ = "F64_EQ"
|
||||
const val F64_NE = "F64_NE"
|
||||
const val F64_LT = "F64_LT"
|
||||
const val F64_GT = "F64_GT"
|
||||
const val F64_LE = "F64_LE"
|
||||
const val F64_GE = "F64_GE"
|
||||
const val I32_ADD = "I32_ADD"
|
||||
const val I32_SUB = "I32_SUB"
|
||||
const val I32_MUL = "I32_MUL"
|
||||
const val I32_DIV_S = "I32_DIV_S"
|
||||
const val I32_DIV_U = "I32_DIV_U"
|
||||
const val I32_REM_S = "I32_REM_S"
|
||||
const val I32_REM_U = "I32_REM_U"
|
||||
const val I32_AND = "I32_AND"
|
||||
const val I32_OR = "I32_OR"
|
||||
const val I32_XOR = "I32_XOR"
|
||||
const val I32_SHL = "I32_SHL"
|
||||
const val I32_SHR_S = "I32_SHR_S"
|
||||
const val I32_SHR_U = "I32_SHR_U"
|
||||
const val I32_ROTL = "I32_ROTL"
|
||||
const val I32_ROTR = "I32_ROTR"
|
||||
const val I64_ADD = "I64_ADD"
|
||||
const val I64_SUB = "I64_SUB"
|
||||
const val I64_MUL = "I64_MUL"
|
||||
const val I64_DIV_S = "I64_DIV_S"
|
||||
const val I64_DIV_U = "I64_DIV_U"
|
||||
const val I64_REM_S = "I64_REM_S"
|
||||
const val I64_REM_U = "I64_REM_U"
|
||||
const val I64_AND = "I64_AND"
|
||||
const val I64_OR = "I64_OR"
|
||||
const val I64_XOR = "I64_XOR"
|
||||
const val I64_SHL = "I64_SHL"
|
||||
const val I64_SHR_S = "I64_SHR_S"
|
||||
const val I64_SHR_U = "I64_SHR_U"
|
||||
const val I64_ROTL = "I64_ROTL"
|
||||
const val I64_ROTR = "I64_ROTR"
|
||||
const val F32_ADD = "F32_ADD"
|
||||
const val F32_SUB = "F32_SUB"
|
||||
const val F32_MUL = "F32_MUL"
|
||||
const val F32_DIV = "F32_DIV"
|
||||
const val F32_MIN = "F32_MIN"
|
||||
const val F32_MAX = "F32_MAX"
|
||||
const val F32_COPYSIGN = "F32_COPYSIGN"
|
||||
const val F64_ADD = "F64_ADD"
|
||||
const val F64_SUB = "F64_SUB"
|
||||
const val F64_MUL = "F64_MUL"
|
||||
const val F64_DIV = "F64_DIV"
|
||||
const val F64_MIN = "F64_MIN"
|
||||
const val F64_MAX = "F64_MAX"
|
||||
const val F64_COPYSIGN = "F64_COPYSIGN"
|
||||
const val I32_CONST = "I32_CONST"
|
||||
const val I64_CONST = "I64_CONST"
|
||||
const val F32_CONST = "F32_CONST"
|
||||
const val F64_CONST = "F64_CONST"
|
||||
const val I32_LOAD = "I32_LOAD"
|
||||
const val I64_LOAD = "I64_LOAD"
|
||||
const val F32_LOAD = "F32_LOAD"
|
||||
const val F64_LOAD = "F64_LOAD"
|
||||
const val I32_LOAD8_S = "I32_LOAD8_S"
|
||||
const val I32_LOAD8_U = "I32_LOAD8_U"
|
||||
const val I32_LOAD16_S = "I32_LOAD16_S"
|
||||
const val I32_LOAD16_U = "I32_LOAD16_U"
|
||||
const val I64_LOAD8_S = "I64_LOAD8_S"
|
||||
const val I64_LOAD8_U = "I64_LOAD8_U"
|
||||
const val I64_LOAD16_S = "I64_LOAD16_S"
|
||||
const val I64_LOAD16_U = "I64_LOAD16_U"
|
||||
const val I64_LOAD32_S = "I64_LOAD32_S"
|
||||
const val I64_LOAD32_U = "I64_LOAD32_U"
|
||||
const val I32_STORE = "I32_STORE"
|
||||
const val I64_STORE = "I64_STORE"
|
||||
const val F32_STORE = "F32_STORE"
|
||||
const val F64_STORE = "F64_STORE"
|
||||
const val I32_STORE8 = "I32_STORE8"
|
||||
const val I32_STORE16 = "I32_STORE16"
|
||||
const val I64_STORE8 = "I64_STORE8"
|
||||
const val I64_STORE16 = "I64_STORE16"
|
||||
const val I64_STORE32 = "I64_STORE32"
|
||||
const val MEMORY_SIZE = "MEMORY_SIZE"
|
||||
const val MEMORY_GROW = "MEMORY_GROW"
|
||||
const val MEMORY_INIT = "MEMORY_INIT"
|
||||
const val DATA_DROP = "DATA_DROP"
|
||||
const val MEMORY_COPY = "MEMORY_COPY"
|
||||
const val MEMORY_FILL = "MEMORY_FILL"
|
||||
const val TABLE_GET = "TABLE_GET"
|
||||
const val TABLE_SET = "TABLE_SET"
|
||||
const val TABLE_GROW = "TABLE_GROW"
|
||||
const val TABLE_SIZE = "TABLE_SIZE"
|
||||
const val TABLE_FILL = "TABLE_FILL"
|
||||
const val TABLE_INIT = "TABLE_INIT"
|
||||
const val ELEM_DROP = "ELEM_DROP"
|
||||
const val TABLE_COPY = "TABLE_COPY"
|
||||
const val UNREACHABLE = "UNREACHABLE"
|
||||
const val NOP = "NOP"
|
||||
const val BLOCK = "BLOCK"
|
||||
const val LOOP = "LOOP"
|
||||
const val IF = "IF"
|
||||
const val ELSE = "ELSE"
|
||||
const val END = "END"
|
||||
const val BR = "BR"
|
||||
const val BR_IF = "BR_IF"
|
||||
const val BR_TABLE = "BR_TABLE"
|
||||
const val RETURN = "RETURN"
|
||||
const val CALL = "CALL"
|
||||
const val CALL_INDIRECT = "CALL_INDIRECT"
|
||||
const val DROP = "DROP"
|
||||
const val SELECT = "SELECT"
|
||||
const val SELECT_TYPED = "SELECT_TYPED"
|
||||
const val LOCAL_GET = "LOCAL_GET"
|
||||
const val LOCAL_SET = "LOCAL_SET"
|
||||
const val LOCAL_TEE = "LOCAL_TEE"
|
||||
const val GLOBAL_GET = "GLOBAL_GET"
|
||||
const val GLOBAL_SET = "GLOBAL_SET"
|
||||
const val REF_NULL = "REF_NULL"
|
||||
const val REF_IS_NULL = "REF_IS_NULL"
|
||||
const val REF_EQ = "REF_EQ"
|
||||
const val REF_FUNC = "REF_FUNC"
|
||||
const val STRUCT_NEW_WITH_RTT = "STRUCT_NEW_WITH_RTT"
|
||||
const val STRUCT_GET = "STRUCT_GET"
|
||||
const val STRUCT_SET = "STRUCT_SET"
|
||||
const val REF_CAST = "REF_CAST"
|
||||
const val RTT_CANON = "RTT_CANON"
|
||||
const val RTT_SUB = "RTT_SUB"
|
||||
}
|
||||
}
|
||||
|
||||
@WasmOp(WasmOp.I32_EQ)
|
||||
public external fun wasm_i32_eq(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_NE)
|
||||
public external fun wasm_i32_ne(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_LT_S)
|
||||
public external fun wasm_i32_lt_s(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_LT_U)
|
||||
public external fun wasm_i32_lt_u(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_GT_S)
|
||||
public external fun wasm_i32_gt_s(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_GT_U)
|
||||
public external fun wasm_i32_gt_u(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_LE_S)
|
||||
public external fun wasm_i32_le_s(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_LE_U)
|
||||
public external fun wasm_i32_le_u(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_GE_S)
|
||||
public external fun wasm_i32_ge_s(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_GE_U)
|
||||
public external fun wasm_i32_ge_u(a: Int, b: Int): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_EQ)
|
||||
public external fun wasm_i64_eq(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_NE)
|
||||
public external fun wasm_i64_ne(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_LT_S)
|
||||
public external fun wasm_i64_lt_s(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_LT_U)
|
||||
public external fun wasm_i64_lt_u(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_GT_S)
|
||||
public external fun wasm_i64_gt_s(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_GT_U)
|
||||
public external fun wasm_i64_gt_u(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_LE_S)
|
||||
public external fun wasm_i64_le_s(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_LE_U)
|
||||
public external fun wasm_i64_le_u(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_GE_S)
|
||||
public external fun wasm_i64_ge_s(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I64_GE_U)
|
||||
public external fun wasm_i64_ge_u(a: Long, b: Long): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F32_EQ)
|
||||
public external fun wasm_f32_eq(a: Float, b: Float): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F32_NE)
|
||||
public external fun wasm_f32_ne(a: Float, b: Float): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F32_LT)
|
||||
public external fun wasm_f32_lt(a: Float, b: Float): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F32_GT)
|
||||
public external fun wasm_f32_gt(a: Float, b: Float): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F32_LE)
|
||||
public external fun wasm_f32_le(a: Float, b: Float): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F32_GE)
|
||||
public external fun wasm_f32_ge(a: Float, b: Float): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F64_EQ)
|
||||
public external fun wasm_f64_eq(a: Double, b: Double): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F64_NE)
|
||||
public external fun wasm_f64_ne(a: Double, b: Double): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F64_LT)
|
||||
public external fun wasm_f64_lt(a: Double, b: Double): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F64_GT)
|
||||
public external fun wasm_f64_gt(a: Double, b: Double): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F64_LE)
|
||||
public external fun wasm_f64_le(a: Double, b: Double): Boolean
|
||||
|
||||
@WasmOp(WasmOp.F64_GE)
|
||||
public external fun wasm_f64_ge(a: Double, b: Double): Boolean
|
||||
|
||||
@WasmOp(WasmOp.I32_ADD)
|
||||
public external fun wasm_i32_add(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_SUB)
|
||||
public external fun wasm_i32_sub(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_MUL)
|
||||
public external fun wasm_i32_mul(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_DIV_S)
|
||||
public external fun wasm_i32_div_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_DIV_U)
|
||||
public external fun wasm_i32_div_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_REM_S)
|
||||
public external fun wasm_i32_rem_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_REM_U)
|
||||
public external fun wasm_i32_rem_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_AND)
|
||||
public external fun wasm_i32_and(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_OR)
|
||||
public external fun wasm_i32_or(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_XOR)
|
||||
public external fun wasm_i32_xor(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_SHL)
|
||||
public external fun wasm_i32_shl(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_SHR_S)
|
||||
public external fun wasm_i32_shr_s(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_SHR_U)
|
||||
public external fun wasm_i32_shr_u(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_ROTL)
|
||||
public external fun wasm_i32_rotl(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_ROTR)
|
||||
public external fun wasm_i32_rotr(a: Int, b: Int): Int
|
||||
|
||||
@WasmOp(WasmOp.I64_ADD)
|
||||
public external fun wasm_i64_add(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_SUB)
|
||||
public external fun wasm_i64_sub(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_MUL)
|
||||
public external fun wasm_i64_mul(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_DIV_S)
|
||||
public external fun wasm_i64_div_s(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_DIV_U)
|
||||
public external fun wasm_i64_div_u(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_REM_S)
|
||||
public external fun wasm_i64_rem_s(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_REM_U)
|
||||
public external fun wasm_i64_rem_u(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_AND)
|
||||
public external fun wasm_i64_and(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_OR)
|
||||
public external fun wasm_i64_or(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_XOR)
|
||||
public external fun wasm_i64_xor(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_SHL)
|
||||
public external fun wasm_i64_shl(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_SHR_S)
|
||||
public external fun wasm_i64_shr_s(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_SHR_U)
|
||||
public external fun wasm_i64_shr_u(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_ROTL)
|
||||
public external fun wasm_i64_rotl(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_ROTR)
|
||||
public external fun wasm_i64_rotr(a: Long, b: Long): Long
|
||||
|
||||
@WasmOp(WasmOp.F32_ADD)
|
||||
public external fun wasm_f32_add(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_SUB)
|
||||
public external fun wasm_f32_sub(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_MUL)
|
||||
public external fun wasm_f32_mul(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_DIV)
|
||||
public external fun wasm_f32_div(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_MIN)
|
||||
public external fun wasm_f32_min(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_MAX)
|
||||
public external fun wasm_f32_max(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_COPYSIGN)
|
||||
public external fun wasm_f32_copysign(a: Float, b: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F64_ADD)
|
||||
public external fun wasm_f64_add(a: Double, b: Double): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_SUB)
|
||||
public external fun wasm_f64_sub(a: Double, b: Double): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_MUL)
|
||||
public external fun wasm_f64_mul(a: Double, b: Double): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_DIV)
|
||||
public external fun wasm_f64_div(a: Double, b: Double): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_MIN)
|
||||
public external fun wasm_f64_min(a: Double, b: Double): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_MAX)
|
||||
public external fun wasm_f64_max(a: Double, b: Double): Double
|
||||
|
||||
|
||||
@WasmOp(WasmOp.REF_IS_NULL)
|
||||
public external fun wasm_ref_is_null(a: Any?): Boolean
|
||||
|
||||
@WasmOp(WasmOp.REF_EQ)
|
||||
public external fun wasm_ref_eq(a: Any?, b: Any?): Boolean
|
||||
|
||||
|
||||
// ---
|
||||
|
||||
@WasmOp(WasmOp.F32_NEAREST)
|
||||
public external fun wasm_f32_nearest(a: Float): Float
|
||||
|
||||
@WasmOp(WasmOp.F64_NEAREST)
|
||||
public external fun wasm_f64_nearest(a: Double): Double
|
||||
|
||||
@WasmOp(WasmOp.I32_WRAP_I64)
|
||||
public external fun wasm_i32_wrap_i64(a: Long): Int
|
||||
|
||||
@WasmOp(WasmOp.I64_EXTEND_I32_S)
|
||||
public external fun wasm_i64_extend_i32_s(a: Int): Long
|
||||
|
||||
@WasmOp(WasmOp.F32_CONVERT_I32_S)
|
||||
public external fun wasm_f32_convert_i32_s(a: Int): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_CONVERT_I64_S)
|
||||
public external fun wasm_f32_convert_i64_s(a: Long): Float
|
||||
|
||||
@WasmOp(WasmOp.F32_DEMOTE_F64)
|
||||
public external fun wasm_f32_demote_f64(a: Double): Float
|
||||
|
||||
@WasmOp(WasmOp.F64_CONVERT_I32_S)
|
||||
public external fun wasm_f64_convert_i32_s(a: Int): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_CONVERT_I64_S)
|
||||
public external fun wasm_f64_convert_i64_s(a: Long): Double
|
||||
|
||||
@WasmOp(WasmOp.F64_PROMOTE_F32)
|
||||
public external fun wasm_f64_promote_f32(a: Float): Double
|
||||
|
||||
@WasmOp(WasmOp.I32_REINTERPRET_F32)
|
||||
public external fun wasm_i32_reinterpret_f32(a: Float): Int
|
||||
|
||||
@WasmOp(WasmOp.F32_REINTERPRET_I32)
|
||||
public external fun wasm_f32_reinterpret_i32(a: Int): Float
|
||||
|
||||
@WasmOp(WasmOp.I32_TRUNC_SAT_F32_S)
|
||||
public external fun wasm_i32_trunc_sat_f32_s(a: Float): Int
|
||||
|
||||
@WasmOp(WasmOp.I32_TRUNC_SAT_F64_S)
|
||||
public external fun wasm_i32_trunc_sat_f64_s(a: Double): Int
|
||||
|
||||
@WasmOp(WasmOp.I64_TRUNC_SAT_F32_S)
|
||||
public external fun wasm_i64_trunc_sat_f32_s(a: Float): Long
|
||||
|
||||
@WasmOp(WasmOp.I64_TRUNC_SAT_F64_S)
|
||||
public external fun wasm_i64_trunc_sat_f64_s(a: Double): Long
|
||||
|
||||
@WasmOp(WasmOp.I32_LOAD)
|
||||
public external fun wasm_i32_load(x: Int): Int
|
||||
Reference in New Issue
Block a user