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


Java Opcodes.INVOKESTATIC屬性代碼示例

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


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

示例1: doVisitMethodInsn

private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    switch (opcode) {
    case Opcodes.INVOKESPECIAL:
        invokespecial(owner, name, desc, itf);
        break;
    case Opcodes.INVOKEVIRTUAL:
        invokevirtual(owner, name, desc, itf);
        break;
    case Opcodes.INVOKESTATIC:
        invokestatic(owner, name, desc, itf);
        break;
    case Opcodes.INVOKEINTERFACE:
        invokeinterface(owner, name, desc);
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:19,代碼來源:InstructionAdapter.java

示例2: visitMethodInsn

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
  DexType ownerType = application.getTypeFromName(owner);
  DexMethod method = application.getMethod(ownerType, name, desc);
  switch (opcode) {
    case Opcodes.INVOKEVIRTUAL:
      registry.registerInvokeVirtual(method);
      break;
    case Opcodes.INVOKESTATIC:
      registry.registerInvokeStatic(method);
      break;
    case Opcodes.INVOKEINTERFACE:
      registry.registerInvokeInterface(method);
      break;
    case Opcodes.INVOKESPECIAL:
      if (name.equals(Constants.INSTANCE_INITIALIZER_NAME) || ownerType == clazz) {
        registry.registerInvokeDirect(method);
      } else {
        registry.registerInvokeSuper(method);
      }
      break;
    default:
      throw new Unreachable("Unexpected opcode " + opcode);
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:25,代碼來源:JarRegisterEffectsVisitor.java

示例3: visit

/**
 * Output call instructions, outputing the correct opcode for the type of
 * call.
 *
 * @param instruction Call instruction.
 * @return            <code>null</code>
 */
@Override
public Void visit(Call instruction) {
  Method    m = instruction.getMethod();
  ClassNode c = m.getOwner();
  
  int opcode;

  switch(instruction.getSort()) {
    case INTERFACE: opcode = Opcodes.INVOKEINTERFACE; break;
    case VIRTUAL:   opcode = Opcodes.INVOKEVIRTUAL;   break;
    case SPECIAL:   opcode = Opcodes.INVOKESPECIAL;   break;
    case STATIC:    opcode = Opcodes.INVOKESTATIC;    break;
    default:        throw new RuntimeException("Unknown call type");
  }

  mv.visitMethodInsn(opcode, c.getName(), m.getName(), m.getDescriptor());
  
  return null;
}
 
開發者ID:adnanmitf09,項目名稱:Rubus,代碼行數:26,代碼來源:InstructionExporter.java

示例4: visitEnd

public void visitEnd() {
	if (exit) {
		done = true;
		Label methodEndLabel = super.mark();
		super.catchException(methodStartLabel,methodEndLabel,Type.getType(RuntimeException.class));
		super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_STOP_METHOD, LOG_METHOD_SIGNATURE);
		super.visitInsn(Opcodes.ATHROW);
		if (exceptions!=null) {
			for(String ex: exceptions) {
				super.catchException(methodStartLabel,methodEndLabel,Type.getObjectType(ex));
				super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_STOP_METHOD, LOG_METHOD_SIGNATURE);
				super.visitInsn(Opcodes.ATHROW);
			}
		}
	}
	super.visitEnd();
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:17,代碼來源:LogInstrument.java

示例5: onMethodEnter

protected void onMethodEnter() {
	if (done || ! isSynchronized()) return;
	
	has_monitor_operation = true;
	super.visitInsn(Opcodes.ACONST_NULL);
	super.pop();
	methodStartLabel = super.mark();

	super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_ENTER_METHOD, LOG_CLASS_SIGNATURE);
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:10,代碼來源:MonitorInstrument.java

示例6: addLog

private void addLog(boolean dup, int site) {
	if (dup)
		super.visitInsn(Opcodes.DUP);
	super.visitLdcInsn(new Integer(site));
	super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
			LOG_INTERNAL_ALLOC_REPORT, OBJECT_SITE_SIGNATURE);
	if (!constructor)
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_ALLOC_DONE, VOID_SIGNATURE);
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:10,代碼來源:AllocateInstrument.java

示例7: onMethodEnter

protected void onMethodEnter() {
	if (exit)
		methodStartLabel = super.mark();

	if (!entry) return;
	
	super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_START_METHOD, LOG_INTERNAL_SIGNATURE);
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:8,代碼來源:LogInstrument.java

示例8: visitCode

@Override
public void visitCode() {
	/*
	 * 0  aload_0 [dos]
	 * 1  invokestatic mcheli.multiplay.MCH_MultiplayClient.readImageData(java.io.DataOutputStream) : void [33]
	 * 4  return
	 */
	super.visitVarInsn(Opcodes.ALOAD, 0);
	super.visitMethodInsn(Opcodes.INVOKESTATIC, "net/teamfruit/mchelishield/MCH_MultiplayClient", "readImageData", DescHelper.toDesc(void.class, "java.io.DataOutputStream"), false);
	super.visitInsn(Opcodes.RETURN);
}
 
開發者ID:Team-Fruit,項目名稱:McHeliPrivacyShield,代碼行數:11,代碼來源:MCH_MultiplayClientVisitor.java

示例9: addInc

private void addInc() {
	if (constructor) {
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_ALLOC_INC, VOID_SIGNATURE);
		methodStartLabel = super.mark();
	}
	firstInstruction = false;
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:8,代碼來源:AllocateInstrument.java

示例10: visitInsn

public void visitInsn(int opcode) {
	if (opcode == Opcodes.MONITORENTER) {
		has_monitor_operation = true;
		super.dup();
		super.visitInsn(opcode);
		super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_ENTER_METHOD, LOG_OBJECT_SIGNATURE);
	} else if (opcode == Opcodes.MONITOREXIT) {
		has_monitor_operation = true;
		super.dup();
		super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_EXIT_METHOD, LOG_OBJECT_SIGNATURE);
		super.visitInsn(opcode);
	} else {
		super.visitInsn(opcode);
	}
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:15,代碼來源:MonitorInstrument.java

示例11: visitMethodInsn

public void visitMethodInsn(int opcode, String owner, String name, String desc) {
	if (opcode == Opcodes.INVOKEVIRTUAL &&
		JAVA_LANG_OBJECT.equals(owner) &&
		NOTIFY_SIGNATURE.equals(desc) && 
		(NOTIFY_METHOD.equals(name) || NOTIFY_ALL_METHOD.equals(name))) {
		super.dup();
		super.visitMethodInsn(Opcodes.INVOKESTATIC, className, LOG_INTERNAL_NOTIFY_METHOD, LOG_OBJECT_SIGNATURE);
	}
	super.visitMethodInsn(opcode, owner, name, desc);
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:10,代碼來源:MonitorInstrument.java

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

示例13: addDec

private void addDec() {
	if (constructor)
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_ALLOC_DEC, VOID_SIGNATURE);
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:5,代碼來源:AllocateInstrument.java

示例14: invokeStatic

public static Invocation invokeStatic(BytecodeMethod bytecodeMethod, String owner, String
        name, String desc) {
    return new Invocation(bytecodeMethod.asm(), Opcodes.INVOKESTATIC, new NameSpecification
            (owner), name, new MethodDescriptor(bytecodeMethod.asm().name, desc));
}
 
開發者ID:PizzaCrust,項目名稱:Passion,代碼行數:5,代碼來源:Invocation.java

示例15: getWrapperConstructionInsn

static MethodInsnNode getWrapperConstructionInsn(Type type) {
    char charType = type.getDescriptor().charAt(0);
    String wrapper;
    switch (charType) {
        case 'B':
            wrapper = "java/lang/Byte";
            break;
        case 'C':
            wrapper = "java/lang/Character";
            break;
        case 'D':
            wrapper = "java/lang/Double";
            break;
        case 'F':
            wrapper = "java/lang/Float";
            break;
        case 'I':
            wrapper = "java/lang/Integer";
            break;
        case 'J':
            wrapper = "java/lang/Long";
            break;
        case 'L':
            return null;
        case '[':
            return null;
        case 'Z':
            wrapper = "java/lang/Boolean";
            break;
        case 'S':
            wrapper = "java/lang/Short";
            break;
        default:
            throw new ClassFormatError("Invalid method signature: "
                    + type.getDescriptor());
    }

    return new MethodInsnNode(Opcodes.INVOKESTATIC, wrapper, "valueOf",
            "(" + charType + ")L" + wrapper + ";", false);

}
 
開發者ID:yutian-tianpl,項目名稱:byte-cobweb,代碼行數:41,代碼來源:TreeInsn.java


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