private boolean isIntType(TypeDesc type) { switch (type.getTypeCode()) { case TypeDesc.INT_CODE: case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.CHAR_CODE: return true; } return false; }
static VerificationTypeInfo forType(ConstantPool cp, TypeDesc type) { switch (type.getTypeCode()) { default: return TopVariableInfo.THE; case TypeDesc.OBJECT_CODE: return new ObjectVariableInfo(cp, type); case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.CHAR_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.INT_CODE: return IntegerVariableInfo.THE; case TypeDesc.LONG_CODE: return LongVariableInfo.THE; case TypeDesc.FLOAT_CODE: return FloatVariableInfo.THE; case TypeDesc.DOUBLE_CODE: return DoubleVariableInfo.THE; } }
byte op; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: case TypeDesc.BOOLEAN_CODE:
int stackAdjust = -3; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: op = Opcode.IASTORE;
int stackAdjust = -1; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: op = Opcode.IALOAD;
public Class toClass(ClassLoader loader) { TypeDesc type = toPrimitiveType(); if (type != null) { switch (type.getTypeCode()) { default: case VOID_CODE:
String methodName; switch (to.getTypeCode()) { case TypeDesc.BOOLEAN_CODE: methodName = "booleanValue";
switch (type.getTypeCode()) { default: if (choice == "==") {
boolean writeIndex = false; int typeCode = mLocal.getType().getTypeCode();
switch (from.getTypeCode()) { default: break; case TypeDesc.BOOLEAN_CODE: if (to.toPrimitiveType().getTypeCode() == TypeDesc.BOOLEAN_CODE) { break;
/** * @param from must be a primitive type * @param to must be an object type */ private void box(TypeDesc from, TypeDesc to) { if (mTarget >= 0x00010005) { // Call the new valueOf method. invokeStatic(to.getRootName(), "valueOf", to, new TypeDesc[] {from}); return; } switch (from.getTypeCode()) { case TypeDesc.BOOLEAN_CODE: toBoolean(true); break; case TypeDesc.CHAR_CODE: case TypeDesc.FLOAT_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.INT_CODE: case TypeDesc.DOUBLE_CODE: case TypeDesc.LONG_CODE: invokeConstructor(to.getRootName(), new TypeDesc[]{from}); break; } }
boolean writeIndex = false; int typeCode = mLocal.getType().getTypeCode();
private boolean isIntType(TypeDesc type) { switch (type.getTypeCode()) { case TypeDesc.INT_CODE: case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.CHAR_CODE: return true; } return false; }
public void newObject(TypeDesc type, int dimensions) { if (dimensions <= 0) { // If type refers to an array, then this code is bogus. mInstructions.new NewObjectInstruction(mCp.addConstantClass(type)); return; } TypeDesc componentType = type.getComponentType(); if (dimensions == 1) { if (componentType.isPrimitive()) { addInstruction(0, type, Opcode.NEWARRAY, (byte)componentType.getTypeCode()); return; } addInstruction(0, type, Opcode.ANEWARRAY, mCp.addConstantClass(componentType)); return; } int stackAdjust = -(dimensions - 1); ConstantInfo info = mCp.addConstantClass(type); byte[] bytes = new byte[4]; bytes[0] = Opcode.MULTIANEWARRAY; //bytes[1] = (byte)0; //bytes[2] = (byte)0; bytes[3] = (byte)dimensions; mInstructions.new ConstantOperandInstruction(stackAdjust, type, bytes, info); }
private static int primitiveWidth(TypeDesc type) { switch (type.getTypeCode()) { default: return 0; case TypeDesc.BOOLEAN_CODE: return 1; case TypeDesc.BYTE_CODE: return 2; case TypeDesc.SHORT_CODE: return 3; case TypeDesc.CHAR_CODE: return 4; case TypeDesc.INT_CODE: return 5; case TypeDesc.FLOAT_CODE: return 6; case TypeDesc.LONG_CODE: return 7; case TypeDesc.DOUBLE_CODE: return 8; } }
static VerificationTypeInfo forType(ConstantPool cp, TypeDesc type) { switch (type.getTypeCode()) { default: return TopVariableInfo.THE; case TypeDesc.OBJECT_CODE: return new ObjectVariableInfo(cp, type); case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.CHAR_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.INT_CODE: return IntegerVariableInfo.THE; case TypeDesc.LONG_CODE: return LongVariableInfo.THE; case TypeDesc.FLOAT_CODE: return FloatVariableInfo.THE; case TypeDesc.DOUBLE_CODE: return DoubleVariableInfo.THE; } }
/** * Determines which overloaded "with" method on Query should be bound to. */ public static TypeDesc bindQueryParam(Class clazz) { // This method is a bit vestigial. Once upon a time the Query class did // not support all primitive types. if (clazz.isPrimitive()) { TypeDesc type = TypeDesc.forClass(clazz); switch (type.getTypeCode()) { case TypeDesc.INT_CODE: case TypeDesc.LONG_CODE: case TypeDesc.FLOAT_CODE: case TypeDesc.DOUBLE_CODE: case TypeDesc.BOOLEAN_CODE: case TypeDesc.CHAR_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.SHORT_CODE: return type; } } return TypeDesc.OBJECT; }
/** * Determines which overloaded "with" method on Query should be bound to. */ public static TypeDesc bindQueryParam(Class clazz) { // This method is a bit vestigial. Once upon a time the Query class did // not support all primitive types. if (clazz.isPrimitive()) { TypeDesc type = TypeDesc.forClass(clazz); switch (type.getTypeCode()) { case TypeDesc.INT_CODE: case TypeDesc.LONG_CODE: case TypeDesc.FLOAT_CODE: case TypeDesc.DOUBLE_CODE: case TypeDesc.BOOLEAN_CODE: case TypeDesc.CHAR_CODE: case TypeDesc.BYTE_CODE: case TypeDesc.SHORT_CODE: return type; } } return TypeDesc.OBJECT; }
int fromTypeCode = fromPrimitiveType.getTypeCode(); throw invalidConversion(fromType, toType); int toTypeCode = toPrimitiveType.getTypeCode();
/** * Generates code that loads zero, false, or null to the stack. */ private void loadBlankValue(CodeAssembler a, TypeDesc type) { switch (type.getTypeCode()) { case TypeDesc.OBJECT_CODE: a.loadNull(); break; case TypeDesc.LONG_CODE: a.loadConstant(0L); break; case TypeDesc.FLOAT_CODE: a.loadConstant(0.0f); break; case TypeDesc.DOUBLE_CODE: a.loadConstant(0.0d); break; case TypeDesc.INT_CODE: default: a.loadConstant(0); break; } }