Package com.dylibso.chicory.runtime
Class OpcodeImpl
java.lang.Object
com.dylibso.chicory.runtime.OpcodeImpl
Note: Some opcodes are easy or trivial to implement as compiler intrinsics (local.get, i32.add, etc).
Others would be very difficult to implement and maintain (floating point truncations, for example).
The idea of this class is to share the core logic of both the interpreter and AOT implementations for
shareable opcodes (that is, opcodes that are not completely different in operation depending on
whether they're run in the interpreter or in the AOT, such as local.get, local.set, etc) in a
single place that is statically accessible. If the AOT does not have an intrinsic for an opcode (and
the opcode is not a flow control opcode), then a static call will be generated to the method in this
class that implements the opcode.
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).
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatF32_ABS(float x) static floatF32_CEIL(float x) static floatF32_CONVERT_I32_S(int x) static floatF32_CONVERT_I32_U(int x) static floatF32_CONVERT_I64_S(long x) static floatF32_CONVERT_I64_U(long x) static floatF32_COPYSIGN(float a, float b) static intF32_EQ(float a, float b) static floatF32_FLOOR(float x) static intF32_GE(float a, float b) static intF32_GT(float a, float b) static intF32_LE(float a, float b) static intF32_LT(float a, float b) static floatF32_MAX(float a, float b) static floatF32_MIN(float a, float b) static intF32_NE(float a, float b) static floatF32_NEAREST(float x) static floatF32_REINTERPRET_I32(int x) static floatF32_SQRT(float x) static floatF32_TRUNC(float x) static doubleF64_ABS(double x) static doubleF64_CEIL(double x) static doubleF64_CONVERT_I32_S(int x) static doubleF64_CONVERT_I32_U(int x) static doubleF64_CONVERT_I64_S(long x) static doubleF64_CONVERT_I64_U(long tos) static doubleF64_COPYSIGN(double a, double b) static intF64_EQ(double a, double b) static doubleF64_FLOOR(double x) static intF64_GE(double a, double b) static intF64_GT(double a, double b) static intF64_LE(double a, double b) static intF64_LT(double a, double b) static doubleF64_MAX(double a, double b) static doubleF64_MIN(double a, double b) static intF64_NE(double a, double b) static doubleF64_NEAREST(double x) static doubleF64_REINTERPRET_I64(long x) static doubleF64_SQRT(double x) static doubleF64_TRUNC(double x) static intI32_CLZ(int tos) static intI32_CTZ(int tos) static intI32_DIV_S(int a, int b) static intI32_DIV_U(int a, int b) static intI32_EQ(int b, int a) static intI32_EQZ(int a) static intI32_EXTEND_16_S(int tos) static intI32_EXTEND_8_S(int tos) static intI32_GE_S(int a, int b) static intI32_GE_U(int a, int b) static intI32_GT_S(int a, int b) static intI32_GT_U(int a, int b) static intI32_LE_S(int a, int b) static intI32_LE_U(int a, int b) static intI32_LT_S(int a, int b) static intI32_LT_U(int a, int b) static intI32_NE(int b, int a) static intI32_POPCNT(int tos) static intI32_REINTERPRET_F32(float x) static intI32_REM_S(int a, int b) static intI32_REM_U(int a, int b) static intI32_ROTL(int v, int c) static intI32_ROTR(int v, int c) static intI32_TRUNC_F32_S(float x) static intI32_TRUNC_F32_U(float x) static intI32_TRUNC_F64_S(double tos) static intI32_TRUNC_F64_U(double tos) static intI32_TRUNC_SAT_F32_S(float x) static intI32_TRUNC_SAT_F32_U(float x) static intI32_TRUNC_SAT_F64_S(double x) static intI32_TRUNC_SAT_F64_U(double x) static longI64_CLZ(long tos) static longI64_CTZ(long tos) static longI64_DIV_S(long a, long b) static longI64_DIV_U(long a, long b) static intI64_EQ(long b, long a) static intI64_EQZ(long a) static longI64_EXTEND_16_S(long tos) static longI64_EXTEND_32_S(long tos) static longI64_EXTEND_8_S(long tos) static longI64_EXTEND_I32_U(int x) static intI64_GE_S(long a, long b) static intI64_GE_U(long a, long b) static intI64_GT_S(long a, long b) static intI64_GT_U(long a, long b) static intI64_LE_S(long a, long b) static intI64_LE_U(long a, long b) static intI64_LT_S(long a, long b) static intI64_LT_U(long a, long b) static intI64_NE(long b, long a) static longI64_POPCNT(long tos) static longI64_REINTERPRET_F64(double x) static longI64_REM_S(long a, long b) static longI64_REM_U(long a, long b) static longI64_ROTL(long v, long c) static longI64_ROTR(long v, long c) static longI64_TRUNC_F32_S(float x) static longI64_TRUNC_F32_U(float x) static longI64_TRUNC_F64_S(double x) static longI64_TRUNC_F64_U(double x) static longI64_TRUNC_SAT_F32_S(float x) static longI64_TRUNC_SAT_F32_U(float x) static longI64_TRUNC_SAT_F64_S(double x) static longI64_TRUNC_SAT_F64_U(double x) static voidTABLE_COPY(Instance instance, int srcTableIndex, int dstTableIndex, int size, int s, int d) static voidTABLE_FILL(Instance instance, int tableIndex, int size, int value, int offset) static intstatic voidTABLE_INIT(Instance instance, int tableidx, int elementidx, int size, int elemidx, int offset)
-
Method Details
-
I32_CLZ
public static int I32_CLZ(int tos) -
I32_CTZ
public static int I32_CTZ(int tos) -
I32_DIV_S
public static int I32_DIV_S(int a, int b) -
I32_DIV_U
public static int I32_DIV_U(int a, int b) -
I32_EQ
public static int I32_EQ(int b, int a) -
I32_EQZ
public static int I32_EQZ(int a) -
I32_EXTEND_8_S
public static int I32_EXTEND_8_S(int tos) -
I32_EXTEND_16_S
public static int I32_EXTEND_16_S(int tos) -
I32_GE_S
public static int I32_GE_S(int a, int b) -
I32_GE_U
public static int I32_GE_U(int a, int b) -
I32_GT_S
public static int I32_GT_S(int a, int b) -
I32_GT_U
public static int I32_GT_U(int a, int b) -
I32_LE_S
public static int I32_LE_S(int a, int b) -
I32_LE_U
public static int I32_LE_U(int a, int b) -
I32_LT_S
public static int I32_LT_S(int a, int b) -
I32_LT_U
public static int I32_LT_U(int a, int b) -
I32_NE
public static int I32_NE(int b, int a) -
I32_POPCNT
public static int I32_POPCNT(int tos) -
I32_REINTERPRET_F32
public static int I32_REINTERPRET_F32(float x) -
I32_REM_S
public static int I32_REM_S(int a, int b) -
I32_REM_U
public static int I32_REM_U(int a, int b) -
I32_ROTR
public static int I32_ROTR(int v, int c) -
I32_ROTL
public static int I32_ROTL(int v, int c) -
I32_TRUNC_F32_S
public static int I32_TRUNC_F32_S(float x) -
I32_TRUNC_F32_U
public static int I32_TRUNC_F32_U(float x) -
I32_TRUNC_F64_S
public static int I32_TRUNC_F64_S(double tos) -
I32_TRUNC_F64_U
public static int I32_TRUNC_F64_U(double tos) -
I32_TRUNC_SAT_F32_S
public static int I32_TRUNC_SAT_F32_S(float x) -
I32_TRUNC_SAT_F32_U
public static int I32_TRUNC_SAT_F32_U(float x) -
I32_TRUNC_SAT_F64_S
public static int I32_TRUNC_SAT_F64_S(double x) -
I32_TRUNC_SAT_F64_U
public static int I32_TRUNC_SAT_F64_U(double x) -
I64_CLZ
public static long I64_CLZ(long tos) -
I64_CTZ
public static long I64_CTZ(long tos) -
I64_DIV_S
public static long I64_DIV_S(long a, long b) -
I64_DIV_U
public static long I64_DIV_U(long a, long b) -
I64_EQ
public static int I64_EQ(long b, long a) -
I64_EQZ
public static int I64_EQZ(long a) -
I64_EXTEND_8_S
public static long I64_EXTEND_8_S(long tos) -
I64_EXTEND_16_S
public static long I64_EXTEND_16_S(long tos) -
I64_EXTEND_32_S
public static long I64_EXTEND_32_S(long tos) -
I64_EXTEND_I32_U
public static long I64_EXTEND_I32_U(int x) -
I64_GE_S
public static int I64_GE_S(long a, long b) -
I64_GE_U
public static int I64_GE_U(long a, long b) -
I64_GT_S
public static int I64_GT_S(long a, long b) -
I64_GT_U
public static int I64_GT_U(long a, long b) -
I64_LE_S
public static int I64_LE_S(long a, long b) -
I64_LE_U
public static int I64_LE_U(long a, long b) -
I64_LT_S
public static int I64_LT_S(long a, long b) -
I64_LT_U
public static int I64_LT_U(long a, long b) -
I64_NE
public static int I64_NE(long b, long a) -
I64_POPCNT
public static long I64_POPCNT(long tos) -
I64_REINTERPRET_F64
public static long I64_REINTERPRET_F64(double x) -
I64_REM_S
public static long I64_REM_S(long a, long b) -
I64_REM_U
public static long I64_REM_U(long a, long b) -
I64_ROTR
public static long I64_ROTR(long v, long c) -
I64_ROTL
public static long I64_ROTL(long v, long c) -
I64_TRUNC_F32_S
public static long I64_TRUNC_F32_S(float x) -
I64_TRUNC_F32_U
public static long I64_TRUNC_F32_U(float x) -
I64_TRUNC_F64_S
public static long I64_TRUNC_F64_S(double x) -
I64_TRUNC_F64_U
public static long I64_TRUNC_F64_U(double x) -
I64_TRUNC_SAT_F32_S
public static long I64_TRUNC_SAT_F32_S(float x) -
I64_TRUNC_SAT_F32_U
public static long I64_TRUNC_SAT_F32_U(float x) -
I64_TRUNC_SAT_F64_S
public static long I64_TRUNC_SAT_F64_S(double x) -
I64_TRUNC_SAT_F64_U
public static long I64_TRUNC_SAT_F64_U(double x) -
F32_ABS
public static float F32_ABS(float x) -
F32_CEIL
public static float F32_CEIL(float x) -
F32_CONVERT_I32_S
public static float F32_CONVERT_I32_S(int x) -
F32_CONVERT_I32_U
public static float F32_CONVERT_I32_U(int x) -
F32_CONVERT_I64_S
public static float F32_CONVERT_I64_S(long x) -
F32_CONVERT_I64_U
public static float F32_CONVERT_I64_U(long x) -
F32_COPYSIGN
public static float F32_COPYSIGN(float a, float b) -
F32_EQ
public static int F32_EQ(float a, float b) -
F32_FLOOR
public static float F32_FLOOR(float x) -
F32_GE
public static int F32_GE(float a, float b) -
F32_GT
public static int F32_GT(float a, float b) -
F32_LE
public static int F32_LE(float a, float b) -
F32_LT
public static int F32_LT(float a, float b) -
F32_MAX
public static float F32_MAX(float a, float b) -
F32_MIN
public static float F32_MIN(float a, float b) -
F32_NE
public static int F32_NE(float a, float b) -
F32_NEAREST
public static float F32_NEAREST(float x) -
F32_REINTERPRET_I32
public static float F32_REINTERPRET_I32(int x) -
F32_SQRT
public static float F32_SQRT(float x) -
F32_TRUNC
public static float F32_TRUNC(float x) -
F64_ABS
public static double F64_ABS(double x) -
F64_CEIL
public static double F64_CEIL(double x) -
F64_CONVERT_I32_S
public static double F64_CONVERT_I32_S(int x) -
F64_CONVERT_I32_U
public static double F64_CONVERT_I32_U(int x) -
F64_CONVERT_I64_S
public static double F64_CONVERT_I64_S(long x) -
F64_CONVERT_I64_U
public static double F64_CONVERT_I64_U(long tos) -
F64_COPYSIGN
public static double F64_COPYSIGN(double a, double b) -
F64_EQ
public static int F64_EQ(double a, double b) -
F64_FLOOR
public static double F64_FLOOR(double x) -
F64_GE
public static int F64_GE(double a, double b) -
F64_GT
public static int F64_GT(double a, double b) -
F64_LE
public static int F64_LE(double a, double b) -
F64_LT
public static int F64_LT(double a, double b) -
F64_MAX
public static double F64_MAX(double a, double b) -
F64_MIN
public static double F64_MIN(double a, double b) -
F64_NE
public static int F64_NE(double a, double b) -
F64_NEAREST
public static double F64_NEAREST(double x) -
F64_REINTERPRET_I64
public static double F64_REINTERPRET_I64(long x) -
F64_SQRT
public static double F64_SQRT(double x) -
F64_TRUNC
public static double F64_TRUNC(double x) -
TABLE_GET
-
TABLE_FILL
-
TABLE_COPY
public static void TABLE_COPY(Instance instance, int srcTableIndex, int dstTableIndex, int size, int s, int d) -
TABLE_INIT
public static void TABLE_INIT(Instance instance, int tableidx, int elementidx, int size, int elemidx, int offset)
-