OpcodeOps

object OpcodeOps

Common opcode helper logic shared by constant evaluation and host import glue.

Note about parameter ordering: because of the JVM's calling convention, the parameters to a method are ordered such that the last value pushed is the last argument to the method, i.e., method(tos - 2, tos - 1, tos).

Functions

Link copied to clipboard
Link copied to clipboard
fun boxForTable(stackValue: Long, instance: Instance): Int

Converts a stack long value to an int suitable for table storage. i31 values (tagged longs) are boxed as WasmI31Ref GC refs so the tag is preserved. For non-GC values (funcref, externref), this is a no-op cast to int.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun F32_EQ(a: Float, b: Float): Int
Link copied to clipboard
Link copied to clipboard
fun F32_GE(a: Float, b: Float): Int
Link copied to clipboard
fun F32_GT(a: Float, b: Float): Int
Link copied to clipboard
fun F32_LE(a: Float, b: Float): Int
Link copied to clipboard
fun F32_LT(a: Float, b: Float): Int
Link copied to clipboard
fun F32_MAX(a: Float, b: Float): Float
Link copied to clipboard
fun F32_MIN(a: Float, b: Float): Float
Link copied to clipboard
fun F32_NE(a: Float, b: Float): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun F64_EQ(a: Double, b: Double): Int
Link copied to clipboard
Link copied to clipboard
fun F64_GE(a: Double, b: Double): Int
Link copied to clipboard
fun F64_GT(a: Double, b: Double): Int
Link copied to clipboard
fun F64_LE(a: Double, b: Double): Int
Link copied to clipboard
fun F64_LT(a: Double, b: Double): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun F64_NE(a: Double, b: Double): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun I32_CLZ(tos: Int): Int
Link copied to clipboard
fun I32_CTZ(tos: Int): Int
Link copied to clipboard
fun I32_DIV_S(a: Int, b: Int): Int
Link copied to clipboard
fun I32_DIV_U(a: Int, b: Int): Int
Link copied to clipboard
fun I32_EQ(b: Int, a: Int): Int
Link copied to clipboard
fun I32_EQZ(a: Int): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun I32_GE_S(a: Int, b: Int): Int
Link copied to clipboard
fun I32_GE_U(a: Int, b: Int): Int
Link copied to clipboard
fun I32_GT_S(a: Int, b: Int): Int
Link copied to clipboard
fun I32_GT_U(a: Int, b: Int): Int
Link copied to clipboard
fun I32_LE_S(a: Int, b: Int): Int
Link copied to clipboard
fun I32_LE_U(a: Int, b: Int): Int
Link copied to clipboard
fun I32_LT_S(a: Int, b: Int): Int
Link copied to clipboard
fun I32_LT_U(a: Int, b: Int): Int
Link copied to clipboard
fun I32_NE(b: Int, a: Int): Int
Link copied to clipboard
fun I32_POPCNT(tos: Int): Int
Link copied to clipboard
Link copied to clipboard
fun I32_REM_S(a: Int, b: Int): Int
Link copied to clipboard
fun I32_REM_U(a: Int, b: Int): Int
Link copied to clipboard
fun I32_ROTL(v: Int, c: Int): Int
Link copied to clipboard
fun I32_ROTR(v: Int, c: Int): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun I64_CLZ(tos: Long): Long
Link copied to clipboard
fun I64_CTZ(tos: Long): Long
Link copied to clipboard
fun I64_DIV_S(a: Long, b: Long): Long
Link copied to clipboard
fun I64_DIV_U(a: Long, b: Long): Long
Link copied to clipboard
fun I64_EQ(b: Long, a: Long): Int
Link copied to clipboard
fun I64_EQZ(a: Long): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun I64_GE_S(a: Long, b: Long): Int
Link copied to clipboard
fun I64_GE_U(a: Long, b: Long): Int
Link copied to clipboard
fun I64_GT_S(a: Long, b: Long): Int
Link copied to clipboard
fun I64_GT_U(a: Long, b: Long): Int
Link copied to clipboard
fun I64_LE_S(a: Long, b: Long): Int
Link copied to clipboard
fun I64_LE_U(a: Long, b: Long): Int
Link copied to clipboard
fun I64_LT_S(a: Long, b: Long): Int
Link copied to clipboard
fun I64_LT_U(a: Long, b: Long): Int
Link copied to clipboard
fun I64_NE(b: Long, a: Long): Int
Link copied to clipboard
fun I64_POPCNT(tos: Long): Long
Link copied to clipboard
Link copied to clipboard
fun I64_REM_S(a: Long, b: Long): Long
Link copied to clipboard
fun I64_REM_U(a: Long, b: Long): Long
Link copied to clipboard
fun I64_ROTL(v: Long, c: Long): Long
Link copied to clipboard
fun I64_ROTR(v: Long, c: Long): Long
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun TABLE_COPY(instance: Instance, srcTableIndex: Int, dstTableIndex: Int, size: Int, s: Int, d: Int)
Link copied to clipboard
fun TABLE_FILL(instance: Instance, tableIndex: Int, size: Int, value: Int, offset: Int)
Link copied to clipboard
fun TABLE_GET(instance: Instance, tableIndex: Int, index: Int): Int
Link copied to clipboard
fun TABLE_INIT(instance: Instance, tableidx: Int, elementidx: Int, size: Int, elemidx: Int, offset: Int)
Link copied to clipboard
fun unboxFromTable(tableValue: Int, instance: Instance, elementType: ValType): Long

Converts an int from table storage to a stack long value, unboxing i31 refs. Only performs GC ref lookup for GC-typed tables (anyref, eqref, etc.) to avoid overhead for funcref tables in non-GC modules.