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


Java Opcodes.NEW屬性代碼示例

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


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

示例1: visitTypeInsn

@Override
public void visitTypeInsn(final int opcode, final String type) {
    if (opcode == Opcodes.NEW) {
        if (labels == null) {
            Label l = new Label();
            labels = new ArrayList<Label>(3);
            labels.add(l);
            if (mv != null) {
                mv.visitLabel(l);
            }
        }
        for (int i = 0; i < labels.size(); ++i) {
            uninitializedTypes.put(labels.get(i), type);
        }
    }
    if (mv != null) {
        mv.visitTypeInsn(opcode, type);
    }
    execute(opcode, 0, type);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:20,代碼來源:AnalyzerAdapter.java

示例2: visitTypeInsn

@Override
public void visitTypeInsn(final int opcode, final String type) {
    Type t = Type.getObjectType(type);
    switch (opcode) {
    case Opcodes.NEW:
        anew(t);
        break;
    case Opcodes.ANEWARRAY:
        newarray(t);
        break;
    case Opcodes.CHECKCAST:
        checkcast(t);
        break;
    case Opcodes.INSTANCEOF:
        instanceOf(t);
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:20,代碼來源:InstructionAdapter.java

示例3: visitTypeInsn

public void visitTypeInsn(int opcode, String type) {
	if (firstInstruction)
		addInc();
	super.visitTypeInsn(opcode, type);
	// we deal with Opcodes.NEW through the constructors
	if (opcode == Opcodes.ANEWARRAY) {
		int   siteId = getNextSiteId();
		addLog(true, siteId);
	} else if (DO_NEW_INVOKESPECIAL_SEQUENCE && opcode == Opcodes.NEW) {
		super.visitInsn(Opcodes.DUP);
		Triplet p = new Triplet();
		p.type = type;
		p.var = this.localsBase + 1 + newTypeStack.size();
		p.siteId = getNextSiteId();
		if (this.maxLocals < p.var) {
			this.maxLocals = p.var;
			methodToLargestLocal.put(this.encodedName, new Integer(
					p.var));
		}
		super.setLocalType(p.var, JAVA_LANG_OBJECT_TYPE); // super.newLocal(OBJECT_TYPE);
		newTypeStack.addLast(p);
		super.visitVarInsn(Opcodes.ASTORE, p.var);
	}
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:24,代碼來源:AllocateInstrument.java

示例4: addWhereAmI

private void addWhereAmI() {
	// 0: new #2; //class java/lang/Exception
	// 3: dup
	// 4: invokespecial #3; //Method java/lang/Exception."<init>":()V
	// 7: invokevirtual #4; //Method
	// java/lang/Exception.printStackTrace:()V
	// 10: return
	// super.visitTypeInsn(Opcodes.NEW, type);
	String exClass = Type.getInternalName(Exception.class);
	super.visitTypeInsn(Opcodes.NEW, exClass);
	super.visitInsn(Opcodes.DUP);
	super.visitMethodInsn(Opcodes.INVOKESPECIAL, exClass, "<init>",
			"()V");
	super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, exClass,
			"printStackTrace", "()V");
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:16,代碼來源:AllocateInstrument.java

示例5: visitTypeInsn

@Override
public void visitTypeInsn(final int opcode, final String type) {
    checkStartCode();
    checkEndCode();
    checkOpcode(opcode, 3);
    checkInternalName(type, "type");
    if (opcode == Opcodes.NEW && type.charAt(0) == '[') {
        throw new IllegalArgumentException(
                "NEW cannot be used to create arrays: " + type);
    }
    super.visitTypeInsn(opcode, type);
    ++insnCount;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:13,代碼來源:CheckMethodAdapter.java

示例6: updateState

private void updateState(TypeInsnNode insn) {
  Type type = Type.getObjectType(insn.desc);
  switch (insn.getOpcode()) {
    case Opcodes.NEW: {
      state.push(type);
      break;
    }
    case Opcodes.ANEWARRAY: {
      Type arrayType = makeArrayType(type);
      state.pop();
      state.push(arrayType);
      break;
    }
    case Opcodes.CHECKCAST: {
      // Pop the top value and push it back on with the checked type.
      state.pop(type);
      state.push(type);
      break;
    }
    case Opcodes.INSTANCEOF: {
      state.pop(JarState.REFERENCE_TYPE);
      state.push(Type.INT_TYPE);
      break;
    }
    default:
      throw new Unreachable("Unexpected TypeInsn opcode: " + insn.getOpcode());
  }

}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:29,代碼來源:JarSourceCode.java

示例7: visitTypeInsn

/**
 * Imports instructions with a single type operand (allocation of reference
 * arrays, allocation of objects, casting and type checks).
 *
 * @param opcode     Opcode.
 * @param descriptor String descriptor of the type operand.
 */
@Override
public void visitTypeInsn(final int opcode, final String descriptor) {
  Type type = Type.getObjectType(descriptor);

  switch(opcode) {
    // News
    case Opcodes.ANEWARRAY: ordered.add(stack.push(new NewArray(type, stack.pop())));  break;
    case Opcodes.NEW:       ordered.add(stack.push(new NewObject(type)));              break;

    // Type Checks
    case Opcodes.CHECKCAST: ordered.add(stack.push(new CheckCast(stack.pop(), type))); break;
    case Opcodes.INSTANCEOF:ordered.add(stack.push(new InstanceOf(stack.pop(), type)));break;
  }
}
 
開發者ID:adnanmitf09,項目名稱:Rubus,代碼行數:21,代碼來源:MethodImporter.java

示例8: newOperation

@Override
public BasicValue newOperation(final AbstractInsnNode insn) throws AnalyzerException {
  if (insn.getOpcode() == Opcodes.NEW) {
    final TypeInsnNode t = (TypeInsnNode) insn;

    // if this is for a holder class, we'll replace it
    final ValueHolderIden iden = HOLDERS.get(t.desc);
    if (iden != null) {
      return ReplacingBasicValue.create(Type.getObjectType(t.desc), iden, index++, valueList);
    }
  }

  return super.newOperation(insn);
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:14,代碼來源:ReplacingInterpreter.java

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