Class JvmOpcodes
java.lang.Object
org.ek9lang.compiler.backend.jvm.support.JvmOpcodes
Shared JVM opcode selection for the bytecode generators: primitive/reference local-variable
load/store opcodes and optimal integer-constant loading. Single-sources the per-type opcode
switches and the ICONST/BIPUSH/SIPUSH/LDC ladder that were duplicated across several generators.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisPrimitive(String typeName) WhethertypeNameis an EK9/Java primitive type (uses the I/L/F/D-family opcodes rather than the reference A-family).static intloadOpcode(String type) The JVM local-variable LOAD opcode fortype(ALOAD for object/reference types and null).static voidpushIntConstant(org.objectweb.asm.MethodVisitor mv, int value) Push an int constant onto the operand stack using the most compact instruction: ICONST_M1..ICONST_5 for -1..5, BIPUSH for a byte, SIPUSH for a short, otherwise LDC.static intstoreOpcode(String type) The JVM local-variable STORE opcode fortype(ASTORE for object/reference types).
-
Method Details
-
isPrimitive
WhethertypeNameis an EK9/Java primitive type (uses the I/L/F/D-family opcodes rather than the reference A-family). -
loadOpcode
The JVM local-variable LOAD opcode fortype(ALOAD for object/reference types and null). -
storeOpcode
The JVM local-variable STORE opcode fortype(ASTORE for object/reference types). -
pushIntConstant
public static void pushIntConstant(org.objectweb.asm.MethodVisitor mv, int value) Push an int constant onto the operand stack using the most compact instruction: ICONST_M1..ICONST_5 for -1..5, BIPUSH for a byte, SIPUSH for a short, otherwise LDC.
-