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


Java Opcodes.NEWARRAY属性代码示例

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


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

示例1: updateState

private void updateState(IntInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH: {
      state.push(Type.INT_TYPE);
      break;
    }
    case Opcodes.NEWARRAY: {
      String desc = arrayTypeDesc(insn.operand);
      Type type = Type.getType(desc);
      state.pop();
      state.push(type);
      break;
    }
    default:
      throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:18,代码来源:JarSourceCode.java

示例2: build

private void build(IntInsnNode insn, IRBuilder builder) {
  switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH: {
      int dest = state.push(Type.INT_TYPE);
      builder.addIntConst(dest, insn.operand);
      break;
    }
    case Opcodes.NEWARRAY: {
      String desc = arrayTypeDesc(insn.operand);
      Type type = Type.getType(desc);
      DexType dexType = application.getTypeFromDescriptor(desc);
      int count = state.pop(Type.INT_TYPE).register;
      int array = state.push(type);
      builder.addNewArrayEmpty(array, count, dexType);
      break;
    }
    default:
      throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:21,代码来源:JarSourceCode.java

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

示例4: visitIntInsn

public void visitIntInsn(int opcode, int operand) {
	if (firstInstruction)
		addInc();
	super.visitIntInsn(opcode, operand);
	if (opcode == Opcodes.NEWARRAY) {
		int   siteId = getNextSiteId();
		addLog(true, siteId);
	}
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:9,代码来源:AllocateInstrument.java

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

示例6: canThrow

private boolean canThrow(AbstractInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.AALOAD:
    case Opcodes.AASTORE:
    case Opcodes.ANEWARRAY:
      // ARETURN does not throw in its dex image.
    case Opcodes.ARRAYLENGTH:
    case Opcodes.ATHROW:
    case Opcodes.BALOAD:
    case Opcodes.BASTORE:
    case Opcodes.CALOAD:
    case Opcodes.CASTORE:
    case Opcodes.CHECKCAST:
    case Opcodes.DALOAD:
    case Opcodes.DASTORE:
      // DRETURN does not throw in its dex image.
    case Opcodes.FALOAD:
    case Opcodes.FASTORE:
      // FRETURN does not throw in its dex image.
    case Opcodes.GETFIELD:
    case Opcodes.GETSTATIC:
    case Opcodes.IALOAD:
    case Opcodes.IASTORE:
    case Opcodes.IDIV:
    case Opcodes.INSTANCEOF:
    case Opcodes.INVOKEDYNAMIC:
    case Opcodes.INVOKEINTERFACE:
    case Opcodes.INVOKESPECIAL:
    case Opcodes.INVOKESTATIC:
    case Opcodes.INVOKEVIRTUAL:
    case Opcodes.IREM:
      // IRETURN does not throw in its dex image.
    case Opcodes.LALOAD:
    case Opcodes.LASTORE:
    case Opcodes.LDIV:
    case Opcodes.LREM:
      // LRETURN does not throw in its dex image.
    case Opcodes.MONITORENTER:
    case Opcodes.MONITOREXIT:
    case Opcodes.MULTIANEWARRAY:
    case Opcodes.NEW:
    case Opcodes.NEWARRAY:
    case Opcodes.PUTFIELD:
    case Opcodes.PUTSTATIC:
      // RETURN does not throw in its dex image.
    case Opcodes.SALOAD:
    case Opcodes.SASTORE:
      return true;
    case Opcodes.LDC: {
      // const-class and const-string* may throw in dex.
      LdcInsnNode ldc = (LdcInsnNode) insn;
      return ldc.cst instanceof String || ldc.cst instanceof Type;
    }
    default:
      return false;
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:57,代码来源:JarSourceCode.java


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