本文整理汇总了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();
}
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例9: addInc
private void addInc() {
if (constructor) {
super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
LOG_INTERNAL_ALLOC_INC, VOID_SIGNATURE);
methodStartLabel = super.mark();
}
firstInstruction = false;
}
示例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);
}
}
示例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);
}
示例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;
}
}
示例13: addDec
private void addDec() {
if (constructor)
super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
LOG_INTERNAL_ALLOC_DEC, VOID_SIGNATURE);
}
示例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));
}
示例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);
}