org.objectweb.asm.Opcodes# T_FLOAT 源码实例Demo

下面列出了org.objectweb.asm.Opcodes# T_FLOAT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: obfuscator   文件: PrimitiveUtils.java

public static Class<?> getPrimitiveByNewArrayId(int id) {
    switch (id) {
        case Opcodes.T_BOOLEAN:
            return boolean.class;
        case Opcodes.T_CHAR:
            return char.class;
        case Opcodes.T_FLOAT:
            return float.class;
        case Opcodes.T_DOUBLE:
            return double.class;
        case Opcodes.T_BYTE:
            return byte.class;
        case Opcodes.T_SHORT:
            return short.class;
        case Opcodes.T_INT:
            return int.class;
        case Opcodes.T_LONG:
            return long.class;
    }
    throw new IllegalArgumentException("Unknown type " + id);
}
 
源代码2 项目: maple-ir   文件: TypeUtils.java

public static int getPrimitiveArrayOpcode(Type type) {
	switch (type.getElementType().getSort()) {
		case Type.BOOLEAN:
			return Opcodes.T_BOOLEAN;
		case Type.BYTE:
			return Opcodes.T_BYTE;
		case Type.SHORT:
			return Opcodes.T_SHORT;
		case Type.CHAR:
			return Opcodes.T_CHAR;
		case Type.INT:
			return Opcodes.T_INT;
		case Type.LONG:
			return Opcodes.T_LONG;
		case Type.FLOAT:
			return Opcodes.T_FLOAT;
		case Type.DOUBLE:
			return Opcodes.T_DOUBLE;
		default:
			throw new RuntimeException("WT");
	}
}
 
源代码3 项目: serianalyzer   文件: JVMImpl.java

/**
 * @param operand
 * @return
 */
private static Type makeBasicArrayType ( int operand ) {

    switch ( operand ) {
    case Opcodes.T_BOOLEAN:
        return Type.getType("[Z"); //$NON-NLS-1$
    case Opcodes.T_BYTE:
        return Type.getType("[B"); //$NON-NLS-1$
    case Opcodes.T_CHAR:
        return Type.getType("[C"); //$NON-NLS-1$
    case Opcodes.T_DOUBLE:
        return Type.getType("[D"); //$NON-NLS-1$
    case Opcodes.T_FLOAT:
        return Type.getType("[F"); //$NON-NLS-1$
    case Opcodes.T_INT:
        return Type.getType("[I"); //$NON-NLS-1$
    case Opcodes.T_LONG:
        return Type.getType("[J"); //$NON-NLS-1$
    case Opcodes.T_SHORT:
        return Type.getType("[S"); //$NON-NLS-1$

    default:
        log.error("Unknown array type " + operand); //$NON-NLS-1$
    }
    return null;
}
 
源代码4 项目: deobfuscator   文件: PrimitiveUtils.java

public static Class<?> getPrimitiveByNewArrayId(int id) {
    switch (id) {
        case Opcodes.T_BOOLEAN:
            return boolean.class;
        case Opcodes.T_CHAR:
            return char.class;
        case Opcodes.T_FLOAT:
            return float.class;
        case Opcodes.T_DOUBLE:
            return double.class;
        case Opcodes.T_BYTE:
            return byte.class;
        case Opcodes.T_SHORT:
            return short.class;
        case Opcodes.T_INT:
            return int.class;
        case Opcodes.T_LONG:
            return long.class;
    }
    throw new IllegalArgumentException("Unknown type " + id);
}
 

private Type toType(int operand) {
  switch (operand) {
    case Opcodes.T_BOOLEAN :
      return JavaType.BOOLEAN;
    case Opcodes.T_BYTE :
      return JavaType.BYTE;
    case Opcodes.T_CHAR :
      return JavaType.CHAR;
    case Opcodes.T_DOUBLE :
      return JavaType.DOUBLE;
    case Opcodes.T_FLOAT :
      return JavaType.FLOAT;
    case Opcodes.T_INT :
      return JavaType.INT;
    case Opcodes.T_LONG :
      return JavaType.LONG;
    case Opcodes.T_SHORT :
      return JavaType.SHORT;
    default :
      throw new IllegalArgumentException();
  }
}
 
源代码6 项目: es6draft   文件: InstructionAssembler.java

private static final int arrayType(Type type) {
    switch (type.getSort()) {
    case Type.Sort.BOOLEAN:
        return Opcodes.T_BOOLEAN;
    case Type.Sort.CHAR:
        return Opcodes.T_CHAR;
    case Type.Sort.BYTE:
        return Opcodes.T_BYTE;
    case Type.Sort.SHORT:
        return Opcodes.T_SHORT;
    case Type.Sort.INT:
        return Opcodes.T_INT;
    case Type.Sort.FLOAT:
        return Opcodes.T_FLOAT;
    case Type.Sort.LONG:
        return Opcodes.T_LONG;
    case Type.Sort.DOUBLE:
        return Opcodes.T_DOUBLE;
    case Type.Sort.OBJECT:
    case Type.Sort.ARRAY:
    case Type.Sort.METHOD:
    case Type.Sort.VOID:
    default:
        throw new IllegalArgumentException();
    }
}
 
源代码7 项目: Concurnas   文件: InstructionAdapter.java

/**
 * Generates the instruction to create and push on the stack an array of the given type.
 *
 * @param methodVisitor the method visitor to use to generate the instruction.
 * @param type an array Type.
 */
static void newarray(final MethodVisitor methodVisitor, final Type type) {
  int arrayType;
  switch (type.getSort()) {
    case Type.BOOLEAN:
      arrayType = Opcodes.T_BOOLEAN;
      break;
    case Type.CHAR:
      arrayType = Opcodes.T_CHAR;
      break;
    case Type.BYTE:
      arrayType = Opcodes.T_BYTE;
      break;
    case Type.SHORT:
      arrayType = Opcodes.T_SHORT;
      break;
    case Type.INT:
      arrayType = Opcodes.T_INT;
      break;
    case Type.FLOAT:
      arrayType = Opcodes.T_FLOAT;
      break;
    case Type.LONG:
      arrayType = Opcodes.T_LONG;
      break;
    case Type.DOUBLE:
      arrayType = Opcodes.T_DOUBLE;
      break;
    default:
      methodVisitor.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
      return;
  }
  methodVisitor.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
源代码8 项目: Concurnas   文件: Utils.java

public static void singleLevelArrayConst(BytecodeOutputter mv, Type consType) {
	if(consType instanceof PrimativeType )
	//if(consType instanceof PrimativeType && PrimativeTypeEnum.LAMBDA != ((PrimativeType)consType).type && consType.getArrayLevels() == 1)
	{
		PrimativeTypeEnum ee = ((PrimativeType)consType).type;
		int op;
		switch(ee)
		{
			case BOOLEAN: op = Opcodes.T_BOOLEAN; break; 
			case CHAR: op = Opcodes.T_CHAR; break; 
			case FLOAT: op = Opcodes.T_FLOAT; break; 
			case DOUBLE: op = Opcodes.T_DOUBLE; break; 
			case SHORT: op = Opcodes.T_SHORT; break; 
			case INT: op = Opcodes.T_INT; break; 
			case BYTE: op = Opcodes.T_BYTE; break; 
			default: op = Opcodes.T_LONG; break;//long 
		}
		
		 mv.visitIntInsn(Opcodes.NEWARRAY, op);
	}
	else
	{
		if( (consType instanceof NamedType && ((NamedType)consType).getIsRef() )){
			consType = ((NamedType)consType).copyTypeSpecific();
			consType.setArrayLevels(0);
		}
		String tt = consType.getBytecodeType();// -> [Ljava/lang/Object;		//java.lang.String[]	
		tt = tt.substring(1, tt.length()-1);
		if(consType.hasArrayLevels() && (consType.getOrigonalGenericTypeUpperBoundRaw() == null || consType instanceof GenericType)){
			tt = tt.substring(1, tt.length());
		}
		
		mv.visitTypeInsn(Opcodes.ANEWARRAY, tt);
	}
}
 

public void newarray(final Type type) {
  int arrayType;
  switch (type.getSort()) {
    case Type.BOOLEAN:
      arrayType = Opcodes.T_BOOLEAN;
      break;
    case Type.CHAR:
      arrayType = Opcodes.T_CHAR;
      break;
    case Type.BYTE:
      arrayType = Opcodes.T_BYTE;
      break;
    case Type.SHORT:
      arrayType = Opcodes.T_SHORT;
      break;
    case Type.INT:
      arrayType = Opcodes.T_INT;
      break;
    case Type.FLOAT:
      arrayType = Opcodes.T_FLOAT;
      break;
    case Type.LONG:
      arrayType = Opcodes.T_LONG;
      break;
    case Type.DOUBLE:
      arrayType = Opcodes.T_DOUBLE;
      break;
    default:
      mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
      return;
  }
  mv.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
源代码10 项目: JByteMod-Beta   文件: GeneratorAdapter.java

/**
 * Generates the instruction to create a new array.
 *
 * @param type the type of the array elements.
 */
public void newArray(final Type type) {
  int arrayType;
  switch (type.getSort()) {
    case Type.BOOLEAN:
      arrayType = Opcodes.T_BOOLEAN;
      break;
    case Type.CHAR:
      arrayType = Opcodes.T_CHAR;
      break;
    case Type.BYTE:
      arrayType = Opcodes.T_BYTE;
      break;
    case Type.SHORT:
      arrayType = Opcodes.T_SHORT;
      break;
    case Type.INT:
      arrayType = Opcodes.T_INT;
      break;
    case Type.FLOAT:
      arrayType = Opcodes.T_FLOAT;
      break;
    case Type.LONG:
      arrayType = Opcodes.T_LONG;
      break;
    case Type.DOUBLE:
      arrayType = Opcodes.T_DOUBLE;
      break;
    default:
      typeInsn(Opcodes.ANEWARRAY, type);
      return;
  }
  mv.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
源代码11 项目: JReFrameworker   文件: InstructionAdapter.java

/**
 * Generates the instruction to create and push on the stack an array of the given type.
 *
 * @param type an array Type.
 */
public void newarray(final Type type) {
  int arrayType;
  switch (type.getSort()) {
    case Type.BOOLEAN:
      arrayType = Opcodes.T_BOOLEAN;
      break;
    case Type.CHAR:
      arrayType = Opcodes.T_CHAR;
      break;
    case Type.BYTE:
      arrayType = Opcodes.T_BYTE;
      break;
    case Type.SHORT:
      arrayType = Opcodes.T_SHORT;
      break;
    case Type.INT:
      arrayType = Opcodes.T_INT;
      break;
    case Type.FLOAT:
      arrayType = Opcodes.T_FLOAT;
      break;
    case Type.LONG:
      arrayType = Opcodes.T_LONG;
      break;
    case Type.DOUBLE:
      arrayType = Opcodes.T_DOUBLE;
      break;
    default:
      mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
      return;
  }
  mv.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
源代码12 项目: JReFrameworker   文件: InstructionAdapter.java

/**
 * Generates the instruction to create and push on the stack an array of the given type.
 *
 * @param type an array Type.
 */
public void newarray(final Type type) {
  int arrayType;
  switch (type.getSort()) {
    case Type.BOOLEAN:
      arrayType = Opcodes.T_BOOLEAN;
      break;
    case Type.CHAR:
      arrayType = Opcodes.T_CHAR;
      break;
    case Type.BYTE:
      arrayType = Opcodes.T_BYTE;
      break;
    case Type.SHORT:
      arrayType = Opcodes.T_SHORT;
      break;
    case Type.INT:
      arrayType = Opcodes.T_INT;
      break;
    case Type.FLOAT:
      arrayType = Opcodes.T_FLOAT;
      break;
    case Type.LONG:
      arrayType = Opcodes.T_LONG;
      break;
    case Type.DOUBLE:
      arrayType = Opcodes.T_DOUBLE;
      break;
    default:
      mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
      return;
  }
  mv.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
源代码13 项目: JReFrameworker   文件: GeneratorAdapter.java

/**
 * Generates the instruction to create a new array.
 *
 * @param type the type of the array elements.
 */
public void newArray(final Type type) {
  int arrayType;
  switch (type.getSort()) {
    case Type.BOOLEAN:
      arrayType = Opcodes.T_BOOLEAN;
      break;
    case Type.CHAR:
      arrayType = Opcodes.T_CHAR;
      break;
    case Type.BYTE:
      arrayType = Opcodes.T_BYTE;
      break;
    case Type.SHORT:
      arrayType = Opcodes.T_SHORT;
      break;
    case Type.INT:
      arrayType = Opcodes.T_INT;
      break;
    case Type.FLOAT:
      arrayType = Opcodes.T_FLOAT;
      break;
    case Type.LONG:
      arrayType = Opcodes.T_LONG;
      break;
    case Type.DOUBLE:
      arrayType = Opcodes.T_DOUBLE;
      break;
    default:
      typeInsn(Opcodes.ANEWARRAY, type);
      return;
  }
  mv.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
源代码14 项目: Concurnas   文件: InstructionAdapter.java

@Override
public void visitIntInsn(final int opcode, final int operand) {
  switch (opcode) {
    case Opcodes.BIPUSH:
      iconst(operand);
      break;
    case Opcodes.SIPUSH:
      iconst(operand);
      break;
    case Opcodes.NEWARRAY:
      switch (operand) {
        case Opcodes.T_BOOLEAN:
          newarray(Type.BOOLEAN_TYPE);
          break;
        case Opcodes.T_CHAR:
          newarray(Type.CHAR_TYPE);
          break;
        case Opcodes.T_BYTE:
          newarray(Type.BYTE_TYPE);
          break;
        case Opcodes.T_SHORT:
          newarray(Type.SHORT_TYPE);
          break;
        case Opcodes.T_INT:
          newarray(Type.INT_TYPE);
          break;
        case Opcodes.T_FLOAT:
          newarray(Type.FLOAT_TYPE);
          break;
        case Opcodes.T_LONG:
          newarray(Type.LONG_TYPE);
          break;
        case Opcodes.T_DOUBLE:
          newarray(Type.DOUBLE_TYPE);
          break;
        default:
          throw new IllegalArgumentException();
      }
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
源代码15 项目: nuls-v2   文件: Newarray.java

public static void newarray(Frame frame) {
    VariableType type;
    int length = frame.operandStack.popInt();
    if (length < 0) {
        frame.throwNegativeArraySizeException();
        return;
    } else {
        switch (frame.intInsnNode().operand) {
            case Opcodes.T_BOOLEAN:
                type = VariableType.BOOLEAN_ARRAY_TYPE;
                break;
            case Opcodes.T_CHAR:
                type = VariableType.CHAR_ARRAY_TYPE;
                break;
            case Opcodes.T_FLOAT:
                type = VariableType.FLOAT_ARRAY_TYPE;
                break;
            case Opcodes.T_DOUBLE:
                type = VariableType.DOUBLE_ARRAY_TYPE;
                break;
            case Opcodes.T_BYTE:
                type = VariableType.BYTE_ARRAY_TYPE;
                break;
            case Opcodes.T_SHORT:
                type = VariableType.SHORT_ARRAY_TYPE;
                break;
            case Opcodes.T_INT:
                type = VariableType.INT_ARRAY_TYPE;
                break;
            case Opcodes.T_LONG:
                type = VariableType.LONG_ARRAY_TYPE;
                break;
            default:
                throw new IllegalArgumentException("unknown operand");
        }
    }

    ObjectRef arrayRef = frame.heap.newArray(type, length);
    frame.operandStack.pushRef(arrayRef);

    //Log.result(frame.getCurrentOpCode(), arrayRef);
}
 
源代码16 项目: nuls   文件: Newarray.java

public static void newarray(Frame frame) {
    VariableType type;
    int length = frame.operandStack.popInt();
    if (length < 0) {
        frame.throwNegativeArraySizeException();
        return;
    } else {
        switch (frame.intInsnNode().operand) {
            case Opcodes.T_BOOLEAN:
                type = VariableType.BOOLEAN_ARRAY_TYPE;
                break;
            case Opcodes.T_CHAR:
                type = VariableType.CHAR_ARRAY_TYPE;
                break;
            case Opcodes.T_FLOAT:
                type = VariableType.FLOAT_ARRAY_TYPE;
                break;
            case Opcodes.T_DOUBLE:
                type = VariableType.DOUBLE_ARRAY_TYPE;
                break;
            case Opcodes.T_BYTE:
                type = VariableType.BYTE_ARRAY_TYPE;
                break;
            case Opcodes.T_SHORT:
                type = VariableType.SHORT_ARRAY_TYPE;
                break;
            case Opcodes.T_INT:
                type = VariableType.INT_ARRAY_TYPE;
                break;
            case Opcodes.T_LONG:
                type = VariableType.LONG_ARRAY_TYPE;
                break;
            default:
                throw new IllegalArgumentException("unknown operand");
        }
    }

    ObjectRef arrayRef = frame.heap.newArray(type, length);
    frame.operandStack.pushRef(arrayRef);

    //Log.result(frame.getCurrentOpCode(), arrayRef);
}
 
源代码17 项目: JByteMod-Beta   文件: InstructionAdapter.java

@Override
public void visitIntInsn(final int opcode, final int operand) {
  switch (opcode) {
    case Opcodes.BIPUSH:
      iconst(operand);
      break;
    case Opcodes.SIPUSH:
      iconst(operand);
      break;
    case Opcodes.NEWARRAY:
      switch (operand) {
        case Opcodes.T_BOOLEAN:
          newarray(Type.BOOLEAN_TYPE);
          break;
        case Opcodes.T_CHAR:
          newarray(Type.CHAR_TYPE);
          break;
        case Opcodes.T_BYTE:
          newarray(Type.BYTE_TYPE);
          break;
        case Opcodes.T_SHORT:
          newarray(Type.SHORT_TYPE);
          break;
        case Opcodes.T_INT:
          newarray(Type.INT_TYPE);
          break;
        case Opcodes.T_FLOAT:
          newarray(Type.FLOAT_TYPE);
          break;
        case Opcodes.T_LONG:
          newarray(Type.LONG_TYPE);
          break;
        case Opcodes.T_DOUBLE:
          newarray(Type.DOUBLE_TYPE);
          break;
        default:
          throw new IllegalArgumentException();
      }
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
源代码18 项目: JReFrameworker   文件: InstructionAdapter.java

@Override
public void visitIntInsn(final int opcode, final int operand) {
  switch (opcode) {
    case Opcodes.BIPUSH:
      iconst(operand);
      break;
    case Opcodes.SIPUSH:
      iconst(operand);
      break;
    case Opcodes.NEWARRAY:
      switch (operand) {
        case Opcodes.T_BOOLEAN:
          newarray(Type.BOOLEAN_TYPE);
          break;
        case Opcodes.T_CHAR:
          newarray(Type.CHAR_TYPE);
          break;
        case Opcodes.T_BYTE:
          newarray(Type.BYTE_TYPE);
          break;
        case Opcodes.T_SHORT:
          newarray(Type.SHORT_TYPE);
          break;
        case Opcodes.T_INT:
          newarray(Type.INT_TYPE);
          break;
        case Opcodes.T_FLOAT:
          newarray(Type.FLOAT_TYPE);
          break;
        case Opcodes.T_LONG:
          newarray(Type.LONG_TYPE);
          break;
        case Opcodes.T_DOUBLE:
          newarray(Type.DOUBLE_TYPE);
          break;
        default:
          throw new IllegalArgumentException();
      }
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
源代码19 项目: JReFrameworker   文件: InstructionAdapter.java

@Override
public void visitIntInsn(final int opcode, final int operand) {
  switch (opcode) {
    case Opcodes.BIPUSH:
      iconst(operand);
      break;
    case Opcodes.SIPUSH:
      iconst(operand);
      break;
    case Opcodes.NEWARRAY:
      switch (operand) {
        case Opcodes.T_BOOLEAN:
          newarray(Type.BOOLEAN_TYPE);
          break;
        case Opcodes.T_CHAR:
          newarray(Type.CHAR_TYPE);
          break;
        case Opcodes.T_BYTE:
          newarray(Type.BYTE_TYPE);
          break;
        case Opcodes.T_SHORT:
          newarray(Type.SHORT_TYPE);
          break;
        case Opcodes.T_INT:
          newarray(Type.INT_TYPE);
          break;
        case Opcodes.T_FLOAT:
          newarray(Type.FLOAT_TYPE);
          break;
        case Opcodes.T_LONG:
          newarray(Type.LONG_TYPE);
          break;
        case Opcodes.T_DOUBLE:
          newarray(Type.DOUBLE_TYPE);
          break;
        default:
          throw new IllegalArgumentException();
      }
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
源代码20 项目: bazel   文件: BytecodeTypeInference.java

@Override
public void visitIntInsn(int opcode, int operand) {
  switch (opcode) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH:
      push(InferredType.INT);
      break;
    case Opcodes.NEWARRAY:
      pop();
      switch (operand) {
        case Opcodes.T_BOOLEAN:
          pushDescriptor("[Z");
          break;
        case Opcodes.T_CHAR:
          pushDescriptor("[C");
          break;
        case Opcodes.T_FLOAT:
          pushDescriptor("[F");
          break;
        case Opcodes.T_DOUBLE:
          pushDescriptor("[D");
          break;
        case Opcodes.T_BYTE:
          pushDescriptor("[B");
          break;
        case Opcodes.T_SHORT:
          pushDescriptor("[S");
          break;
        case Opcodes.T_INT:
          pushDescriptor("[I");
          break;
        case Opcodes.T_LONG:
          pushDescriptor("[J");
          break;
        default:
          throw new RuntimeException("Unhandled operand value: " + operand);
      }
      break;
    default:
      throw new RuntimeException("Unhandled opcode " + opcode);
  }
  super.visitIntInsn(opcode, operand);
}
 
 方法所在类
 同类方法