当前位置: 首页>>代码示例>>Java>>正文


Java Opcodes.T_SHORT属性代码示例

本文整理汇总了Java中org.objectweb.asm.Opcodes.T_SHORT属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.T_SHORT属性的具体用法?Java Opcodes.T_SHORT怎么用?Java Opcodes.T_SHORT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.T_SHORT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: arrayTypeDesc

private static String arrayTypeDesc(int arrayTypeCode) {
  switch (arrayTypeCode) {
    case Opcodes.T_BOOLEAN:
      return "[Z";
    case Opcodes.T_CHAR:
      return "[C";
    case Opcodes.T_FLOAT:
      return "[F";
    case Opcodes.T_DOUBLE:
      return "[D";
    case Opcodes.T_BYTE:
      return "[B";
    case Opcodes.T_SHORT:
      return "[S";
    case Opcodes.T_INT:
      return "[I";
    case Opcodes.T_LONG:
      return "[J";
    default:
      throw new Unreachable("Unexpected array-type code " + arrayTypeCode);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:22,代码来源:JarSourceCode.java

示例2: 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

示例3: 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,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:39,代码来源:GeneratorAdapter.java

示例4: visitIntInsn

/**
 * Imports instructions with a single integer operand (byte push, short push
 * and allocation of primitive arrays).
 *
 * @param opcode  Opcode.
 * @param operand Integer operand.
 */
@Override
public void visitIntInsn(final int opcode, final int operand) {
  switch(opcode) {
    // Constants
    case Opcodes.BIPUSH: createConstant(new Byte((byte) operand));      break;
    case Opcodes.SIPUSH: createConstant(new Short((short) operand));    break;
    
    // New Array (Primitive)
    case Opcodes.NEWARRAY:
      Type type = null;
      
      switch(operand) {
        case Opcodes.T_BOOLEAN: type = Type.BOOL;   break;
        case Opcodes.T_CHAR:    type = Type.CHAR;   break;
        case Opcodes.T_FLOAT:   type = Type.FLOAT;  break;
        case Opcodes.T_DOUBLE:  type = Type.DOUBLE; break;
        case Opcodes.T_BYTE:    type = Type.BYTE;   break;
        case Opcodes.T_SHORT:   type = Type.SHORT;  break;
        case Opcodes.T_INT:     type = Type.INT;    break;
        case Opcodes.T_LONG:    type = Type.LONG;   break;
      }
      
      ordered.add(stack.push(new NewArray(type, stack.pop())));
      break;
  }
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:33,代码来源:MethodImporter.java

示例5: visit

/**
 * Output instructions for allocating arrays, both for primitive and
 * reference types.
 *
 * @param instruction Array allocation instruction.
 * @return            <code>null</code>
 */
@Override
public Void visit(NewArray instruction) {
  if(instruction.getElementType().getSort() == Type.Sort.REF) {
    mv.visitTypeInsn(
      Opcodes.ANEWARRAY,
      instruction.getElementType().getInternalName()
    );
  } else {
    int type;

    switch(instruction.getElementType().getSort()) {
      case BOOL:   type = Opcodes.T_BOOLEAN; break;
      case CHAR:   type = Opcodes.T_CHAR;    break;
      case FLOAT:  type = Opcodes.T_FLOAT;   break;
      case DOUBLE: type = Opcodes.T_DOUBLE;  break;
      case BYTE:   type = Opcodes.T_BYTE;    break;
      case SHORT:  type = Opcodes.T_SHORT;   break;
      case INT:    type = Opcodes.T_INT;     break;
      case LONG:   type = Opcodes.T_LONG;    break;
      default: throw new RuntimeException("Unknown array element type");
    }

    mv.visitIntInsn(Opcodes.NEWARRAY, type);
  }

  return null;
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:34,代码来源:InstructionExporter.java

示例6: visitIntInsn

@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();
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:43,代码来源:InstructionAdapter.java


注:本文中的org.objectweb.asm.Opcodes.T_SHORT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。