當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.DOUBLE屬性代碼示例

本文整理匯總了Java中org.objectweb.asm.Type.DOUBLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Type.DOUBLE屬性的具體用法?Java Type.DOUBLE怎麽用?Java Type.DOUBLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.objectweb.asm.Type的用法示例。


在下文中一共展示了Type.DOUBLE屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSubTypeOf

@Override
protected boolean isSubTypeOf(final BasicValue value,
        final BasicValue expected) {
    Type expectedType = expected.getType();
    Type type = value.getType();
    switch (expectedType.getSort()) {
    case Type.INT:
    case Type.FLOAT:
    case Type.LONG:
    case Type.DOUBLE:
        return type.equals(expectedType);
    case Type.ARRAY:
    case Type.OBJECT:
        if ("Lnull;".equals(type.getDescriptor())) {
            return true;
        } else if (type.getSort() == Type.OBJECT
                || type.getSort() == Type.ARRAY) {
            return isAssignableFrom(expectedType, type);
        } else {
            return false;
        }
    default:
        throw new Error("Internal error");
    }
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:25,代碼來源:SimpleVerifier.java

示例2: isPrimitive

@Contract("null -> fail")
private static boolean isPrimitive(Type type) {
    switch (type.getSort()) {
        case Type.BYTE:
        case Type.BOOLEAN:
        case Type.SHORT:
        case Type.CHAR:
        case Type.INT:
        case Type.FLOAT:
        case Type.LONG:
        case Type.DOUBLE:
            return true;
        default:
            return false;
    }
}
 
開發者ID:mikroskeem,項目名稱:Shuriken,代碼行數:16,代碼來源:MethodGenerator.java

示例3: numericType

private static NumericType numericType(Type type) {
  switch (type.getSort()) {
    case Type.BYTE:
      return NumericType.BYTE;
    case Type.CHAR:
      return NumericType.CHAR;
    case Type.SHORT:
      return NumericType.SHORT;
    case Type.INT:
      return NumericType.INT;
    case Type.LONG:
      return NumericType.LONG;
    case Type.FLOAT:
      return NumericType.FLOAT;
    case Type.DOUBLE:
      return NumericType.DOUBLE;
    default:
      throw new Unreachable("Invalid type in numericType: " + type);
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:20,代碼來源:JarSourceCode.java

示例4: newLocal

/**
 * Creates a new local variable of the given type.
 * 
 * @param type
 *            the type of the local variable to be created.
 * @return the identifier of the newly created local variable.
 */
public int newLocal(final Type type) {
    Object t;
    switch (type.getSort()) {
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        t = Opcodes.INTEGER;
        break;
    case Type.FLOAT:
        t = Opcodes.FLOAT;
        break;
    case Type.LONG:
        t = Opcodes.LONG;
        break;
    case Type.DOUBLE:
        t = Opcodes.DOUBLE;
        break;
    case Type.ARRAY:
        t = type.getDescriptor();
        break;
    // case Type.OBJECT:
    default:
        t = type.getInternalName();
        break;
    }
    int local = newLocalMapping(type);
    setLocalType(local, type);
    setFrameLocal(local, t);
    return local;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:39,代碼來源:LocalVariablesSorter.java

示例5: newarray

public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:33,代碼來源:InstructionAdapter.java

示例6: checkCastReturn

final protected void checkCastReturn(Type returnType) {
    final int sort = returnType.getSort();
    switch (sort) {
        case Type.VOID: {
            pop();
            mv.visitInsn(Opcodes.RETURN);
            break;
        }
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
        case Type.INT: {
            unbox(returnType);
            returnValue();
            break;
        }
        case Type.FLOAT: {
            unbox(returnType);
            mv.visitInsn(Opcodes.FRETURN);
            break;
        }
        case Type.LONG: {
            unbox(returnType);
            mv.visitInsn(Opcodes.LRETURN);
            break;
        }
        case Type.DOUBLE: {
            unbox(returnType);
            mv.visitInsn(Opcodes.DRETURN);
            break;
        }
        case Type.ARRAY:
        case Type.OBJECT:
        case Type.METHOD:
        default: {
            // checkCast(returnType);
            unbox(returnType);
            mv.visitInsn(ARETURN);
            break;
        }

    }
}
 
開發者ID:alibaba,項目名稱:jvm-sandbox,代碼行數:44,代碼來源:ReWriteMethod.java

示例7: newArray

/**
 * Generates the instruction to create a new array.
 * 
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:39,代碼來源:GeneratorAdapter.java

示例8: newValue

@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }
    switch (type.getSort()) {
    case Type.VOID:
        return null;
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        return BasicValue.INT_VALUE;
    case Type.FLOAT:
        return BasicValue.FLOAT_VALUE;
    case Type.LONG:
        return BasicValue.LONG_VALUE;
    case Type.DOUBLE:
        return BasicValue.DOUBLE_VALUE;
    case Type.ARRAY:
    case Type.OBJECT:
        return BasicValue.REFERENCE_VALUE;
    default:
        throw new Error("Internal error");
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:27,代碼來源:BasicInterpreter.java

示例9: push

/**
 * Generates the instruction to push the given value on the stack.
 * 
 * @param value
 *            the value to be pushed on the stack.
 */
public void push(final Type value) {
    if (value == null) {
        mv.visitInsn(Opcodes.ACONST_NULL);
    } else {
        switch (value.getSort()) {
        case Type.BOOLEAN:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean",
                    "TYPE", CLDESC);
            break;
        case Type.CHAR:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Character",
                    "TYPE", CLDESC);
            break;
        case Type.BYTE:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Byte", "TYPE",
                    CLDESC);
            break;
        case Type.SHORT:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Short", "TYPE",
                    CLDESC);
            break;
        case Type.INT:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Integer",
                    "TYPE", CLDESC);
            break;
        case Type.FLOAT:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Float", "TYPE",
                    CLDESC);
            break;
        case Type.LONG:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Long", "TYPE",
                    CLDESC);
            break;
        case Type.DOUBLE:
            mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Double",
                    "TYPE", CLDESC);
            break;
        default:
            mv.visitLdcInsn(value);
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:48,代碼來源:GeneratorAdapter.java

示例10: AnalyzerAdapter

/**
 * Creates a new {@link AnalyzerAdapter}.
 * 
 * @param api
 *            the ASM API version implemented by this visitor. Must be one
 *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param owner
 *            the owner's class name.
 * @param access
 *            the method's access flags (see {@link Opcodes}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param mv
 *            the method visitor to which this adapter delegates calls. May
 *            be <tt>null</tt>.
 */
protected AnalyzerAdapter(final int api, final String owner,
        final int access, final String name, final String desc,
        final MethodVisitor mv) {
    super(api, mv);
    this.owner = owner;
    locals = new ArrayList<Object>();
    stack = new ArrayList<Object>();
    uninitializedTypes = new HashMap<Object, Object>();

    if ((access & Opcodes.ACC_STATIC) == 0) {
        if ("<init>".equals(name)) {
            locals.add(Opcodes.UNINITIALIZED_THIS);
        } else {
            locals.add(owner);
        }
    }
    Type[] types = Type.getArgumentTypes(desc);
    for (int i = 0; i < types.length; ++i) {
        Type type = types[i];
        switch (type.getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
        case Type.INT:
            locals.add(Opcodes.INTEGER);
            break;
        case Type.FLOAT:
            locals.add(Opcodes.FLOAT);
            break;
        case Type.LONG:
            locals.add(Opcodes.LONG);
            locals.add(Opcodes.TOP);
            break;
        case Type.DOUBLE:
            locals.add(Opcodes.DOUBLE);
            locals.add(Opcodes.TOP);
            break;
        case Type.ARRAY:
            locals.add(types[i].getDescriptor());
            break;
        // case Type.OBJECT:
        default:
            locals.add(types[i].getInternalName());
        }
    }
    maxLocals = locals.size();
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:66,代碼來源:AnalyzerAdapter.java

示例11: ifCmp

/**
 * Generates the instructions to jump to a label based on the comparison of
 * the top two stack values.
 * 
 * @param type
 *            the type of the top two stack values.
 * @param mode
 *            how these values must be compared. One of EQ, NE, LT, GE, GT,
 *            LE.
 * @param label
 *            where to jump if the comparison result is <tt>true</tt>.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
    switch (type.getSort()) {
    case Type.LONG:
        mv.visitInsn(Opcodes.LCMP);
        break;
    case Type.DOUBLE:
        mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL
                : Opcodes.DCMPG);
        break;
    case Type.FLOAT:
        mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL
                : Opcodes.FCMPG);
        break;
    case Type.ARRAY:
    case Type.OBJECT:
        switch (mode) {
        case EQ:
            mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
            return;
        case NE:
            mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
            return;
        }
        throw new IllegalArgumentException("Bad comparison for type "
                + type);
    default:
        int intOp = -1;
        switch (mode) {
        case EQ:
            intOp = Opcodes.IF_ICMPEQ;
            break;
        case NE:
            intOp = Opcodes.IF_ICMPNE;
            break;
        case GE:
            intOp = Opcodes.IF_ICMPGE;
            break;
        case LT:
            intOp = Opcodes.IF_ICMPLT;
            break;
        case LE:
            intOp = Opcodes.IF_ICMPLE;
            break;
        case GT:
            intOp = Opcodes.IF_ICMPGT;
            break;
        }
        mv.visitJumpInsn(intOp, label);
        return;
    }
    mv.visitJumpInsn(mode, label);
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:64,代碼來源:GeneratorAdapter.java

示例12: insertSetObject

@SuppressWarnings("deprecation")
static private void insertSetObject(ClassWriter cw, String classNameInternal, ArrayList<Field> fields) {
	int maxStack = 6;
	MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "set", "(Ljava/lang/Object;ILjava/lang/Object;)V", null, null);
	mv.visitCode();
	mv.visitVarInsn(ILOAD, 2);

	if (!fields.isEmpty()) {
		maxStack--;
		Label[] labels = new Label[fields.size()];
		for (int i = 0, n = labels.length; i < n; i++)
			labels[i] = new Label();
		Label defaultLabel = new Label();
		mv.visitTableSwitchInsn(0, labels.length - 1, defaultLabel, labels);

		for (int i = 0, n = labels.length; i < n; i++) {
			Field field = fields.get(i);
			Type fieldType = Type.getType(field.getType());

			mv.visitLabel(labels[i]);
			mv.visitFrame(F_SAME, 0, null, 0, null);
			mv.visitVarInsn(ALOAD, 1);
			mv.visitTypeInsn(CHECKCAST, classNameInternal);
			mv.visitVarInsn(ALOAD, 3);

			switch (fieldType.getSort()) {
			case Type.BOOLEAN:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z");
				break;
			case Type.BYTE:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B");
				break;
			case Type.CHAR:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C");
				break;
			case Type.SHORT:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S");
				break;
			case Type.INT:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I");
				break;
			case Type.FLOAT:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F");
				break;
			case Type.LONG:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J");
				break;
			case Type.DOUBLE:
				mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
				mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D");
				break;
			case Type.ARRAY:
				mv.visitTypeInsn(CHECKCAST, fieldType.getDescriptor());
				break;
			case Type.OBJECT:
				mv.visitTypeInsn(CHECKCAST, fieldType.getInternalName());
				break;
			}

			mv.visitFieldInsn(PUTFIELD, classNameInternal, field.getName(), fieldType.getDescriptor());
			mv.visitInsn(RETURN);
		}

		mv.visitLabel(defaultLabel);
		mv.visitFrame(F_SAME, 0, null, 0, null);
	}
	mv = insertThrowExceptionForFieldNotFound(mv);
	mv.visitMaxs(maxStack, 4);
	mv.visitEnd();
}
 
開發者ID:HankXV,項目名稱:Limitart,代碼行數:77,代碼來源:FieldAccess.java


注:本文中的org.objectweb.asm.Type.DOUBLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。