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


Java AbstractInsnNode.getOpcode方法代码示例

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


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

示例1: newOperation

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public SourceValue newOperation(final AbstractInsnNode insn) {
    int size;
    switch (insn.getOpcode()) {
    case LCONST_0:
    case LCONST_1:
    case DCONST_0:
    case DCONST_1:
        size = 2;
        break;
    case LDC:
        Object cst = ((LdcInsnNode) insn).cst;
        size = cst instanceof Long || cst instanceof Double ? 2 : 1;
        break;
    case GETSTATIC:
        size = Type.getType(((FieldInsnNode) insn).desc).getSize();
        break;
    default:
        size = 1;
    }
    return new SourceValue(size, insn);
}
 
开发者ID:acmerli,项目名称:fastAOP,代码行数:23,代码来源:SourceInterpreter.java

示例2: getMethodTransformers

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public MethodTransformer[] getMethodTransformers() {
	
	MethodTransformer transformRenderParticle = new MethodTransformer() {

		@Override
		public MethodName getName() {
			return Names.Particle_renderParticle;
		}
		
		@Override
		public void transform(ClassNode classNode, MethodNode method, boolean obfuscated) {
			CLTLog.info("Found method: " + method.name + " " + method.desc);
			
			for (AbstractInsnNode instruction : method.instructions.toArray()) {
				if (instruction.getOpcode() == ANEWARRAY) {
					CLTLog.info("Found ANEWARRAY in method " + getName().all());
					
					instruction = instruction.getPrevious();
					
					transformParticle(classNode, method, instruction, 14);
					
					break;
				}
			}
		}
	};
	
	return new MethodTransformer[] {transformRenderParticle};
}
 
开发者ID:shaunlebron,项目名称:flex-fov,代码行数:31,代码来源:ParticleTransformer.java

示例3: isSimpleConstant

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
private static boolean isSimpleConstant(Object previousInstructionObject) {
	// CHECKSTYLE:OFF
	final AbstractInsnNode previousInstruction = (AbstractInsnNode) previousInstructionObject;
	// CHECKSTYLE:ON
	final int opcode = previousInstruction.getOpcode();
	return (opcode >= Opcodes.ACONST_NULL && opcode <= Opcodes.DCONST_1
			|| opcode == Opcodes.SIPUSH || opcode == Opcodes.BIPUSH)
			&& (previousInstruction instanceof InsnNode
					|| previousInstruction instanceof IntInsnNode);
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:11,代码来源:LocalVariablesAnalyzer.java

示例4: analyzeConstantInstruction

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
private void analyzeConstantInstruction(Object instructionObject) {
	// CHECKSTYLE:OFF
	final AbstractInsnNode instruction = (AbstractInsnNode) instructionObject;
	// CHECKSTYLE:ON
	if (instruction.getOpcode() == Opcodes.LDC) {
		// une instruction d'opcode LDC est forcément de type LdcInsnNode
		final VarInsnNode varInstruction = varInstructionsByConstantesMap
				.get(((LdcInsnNode) instruction).cst);
		// varInstruction peut être null si cette constante n'est pas dans une variable
		if (varInstruction != null) {
			removeLocalVariable(varInstruction);
		}
	}
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:15,代码来源:LocalVariablesAnalyzer.java

示例5: overclockRenderer

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
private static void overclockRenderer(ClassNode node, boolean isObfuscated)
{
    // We're attempting to turn this line from Minecraft.runGameLoop:
    //          this.updateDisplay();
    // into this:
    //          TimeHelper.updateDisplay();
    // TimeHelper's method then decides whether or not to pass the call on to Minecraft.updateDisplay().
    
    final String methodName = isObfuscated ? "as" : "runGameLoop";
    final String methodDescriptor = "()V"; // No params, returns void.

    System.out.println("MALMO: Found Minecraft, attempting to transform it");

    for (MethodNode method : node.methods)
    {
        if (method.name.equals(methodName) && method.desc.equals(methodDescriptor))
        {
            System.out.println("MALMO: Found Minecraft.runGameLoop() method, attempting to transform it");
            for (AbstractInsnNode instruction : method.instructions.toArray())
            {
                if (instruction.getOpcode() == Opcodes.INVOKEVIRTUAL)
                {
                    MethodInsnNode visitMethodNode = (MethodInsnNode)instruction;
                    if (visitMethodNode.name.equals(isObfuscated ? "h" : "updateDisplay"))
                    {
                        visitMethodNode.owner = "com/microsoft/Malmo/Utils/TimeHelper";
                        if (isObfuscated)
                        {
                            visitMethodNode.name = "updateDisplay";
                        }
                        visitMethodNode.setOpcode(Opcodes.INVOKESTATIC);
                        method.instructions.remove(visitMethodNode.getPrevious());  // ALOAD 0 not needed for static invocation.
                        System.out.println("MALMO: Hooked into call to Minecraft.updateDisplay()");
                    }
                }
            }
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:40,代码来源:OverclockingClassTransformer.java

示例6: unaryOperation

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public BasicValue unaryOperation(AbstractInsnNode insnNode, BasicValue value) throws AnalyzerException {
    if (insnNode.getOpcode() == Opcodes.ANEWARRAY && value instanceof IntegerConstantBasicValue) {
        IntegerConstantBasicValue constantBasicValue = (IntegerConstantBasicValue) value;
        String desc = ((TypeInsnNode) insnNode).desc;
        return new ArraySizeBasicValue(Type.getType("[" + Type.getObjectType(desc)), constantBasicValue.minValue,
            constantBasicValue.maxValue);
    }
    return super.unaryOperation(insnNode, value);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:ESLoggerUsageChecker.java

示例7: naryOperation

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public SourceValue naryOperation(final AbstractInsnNode insn,
        final List<? extends SourceValue> values) {
    int size;
    int opcode = insn.getOpcode();
    if (opcode == MULTIANEWARRAY) {
        size = 1;
    } else {
        String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc
                : ((MethodInsnNode) insn).desc;
        size = Type.getReturnType(desc).getSize();
    }
    return new SourceValue(size, insn);
}
 
开发者ID:ItzSomebody,项目名称:Spigot-Nonce-ID-Finder,代码行数:15,代码来源:SourceInterpreter.java

示例8: binaryOperation

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public SourceValue binaryOperation(final AbstractInsnNode insn,
        final SourceValue value1, final SourceValue value2) {
    int size;
    switch (insn.getOpcode()) {
    case LALOAD:
    case DALOAD:
    case LADD:
    case DADD:
    case LSUB:
    case DSUB:
    case LMUL:
    case DMUL:
    case LDIV:
    case DDIV:
    case LREM:
    case DREM:
    case LSHL:
    case LSHR:
    case LUSHR:
    case LAND:
    case LOR:
    case LXOR:
        size = 2;
        break;
    default:
        size = 1;
    }
    return new SourceValue(size, insn);
}
 
开发者ID:ItzSomebody,项目名称:BukkitPlugin-Message-Injector,代码行数:31,代码来源:SourceInterpreter.java

示例9: getMethodTransformers

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public MethodTransformer[] getMethodTransformers() {
	
	MethodTransformer transformRenderParticle = new MethodTransformer() {

		@Override
		public MethodName getName() {
			return Names.Particle_renderParticle;
		}
		
		@Override
		public void transform(ClassNode classNode, MethodNode method, boolean obfuscated) {
			CLTLog.info("Found method: " + method.name + " " + method.desc);
			
			for (AbstractInsnNode instruction : method.instructions.toArray()) {
				if (instruction.getOpcode() == ISHR) {
					CLTLog.info("Found ISHR in method " + getName().all());
					
					instruction = instruction.getPrevious().getPrevious();
					
					transformParticle(classNode, method, instruction, 14);
					
					break;
				}
			}
		}
	};
	
	return new MethodTransformer[] {transformRenderParticle};
}
 
开发者ID:shaunlebron,项目名称:flex-fov,代码行数:31,代码来源:ParticleBreakingTransformer.java

示例10: binaryOperation

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public BasicValue binaryOperation(final AbstractInsnNode insn,
        final BasicValue value1, final BasicValue value2)
        throws AnalyzerException {
    switch (insn.getOpcode()) {
    case IALOAD:
    case BALOAD:
    case CALOAD:
    case SALOAD:
    case IADD:
    case ISUB:
    case IMUL:
    case IDIV:
    case IREM:
    case ISHL:
    case ISHR:
    case IUSHR:
    case IAND:
    case IOR:
    case IXOR:
        return BasicValue.INT_VALUE;
    case FALOAD:
    case FADD:
    case FSUB:
    case FMUL:
    case FDIV:
    case FREM:
        return BasicValue.FLOAT_VALUE;
    case LALOAD:
    case LADD:
    case LSUB:
    case LMUL:
    case LDIV:
    case LREM:
    case LSHL:
    case LSHR:
    case LUSHR:
    case LAND:
    case LOR:
    case LXOR:
        return BasicValue.LONG_VALUE;
    case DALOAD:
    case DADD:
    case DSUB:
    case DMUL:
    case DDIV:
    case DREM:
        return BasicValue.DOUBLE_VALUE;
    case AALOAD:
        return BasicValue.REFERENCE_VALUE;
    case LCMP:
    case FCMPL:
    case FCMPG:
    case DCMPL:
    case DCMPG:
        return BasicValue.INT_VALUE;
    case IF_ICMPEQ:
    case IF_ICMPNE:
    case IF_ICMPLT:
    case IF_ICMPGE:
    case IF_ICMPGT:
    case IF_ICMPLE:
    case IF_ACMPEQ:
    case IF_ACMPNE:
    case PUTFIELD:
        return null;
    default:
        throw new Error("Internal error.");
    }
}
 
开发者ID:ItzSomebody,项目名称:Simple-JAR-Watermark,代码行数:71,代码来源:BasicInterpreter.java

示例11: getNextPseudoInsn

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
public static @Nullable AbstractInsnNode getNextPseudoInsn(AbstractInsnNode insn) {
	while ((insn = insn.getNext()) != null && insn.getOpcode() != -1);
	return insn;
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:5,代码来源:AsmUtils.java

示例12: copyOperation

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
@Override
public BasicValue copyOperation(final AbstractInsnNode insn,
        final BasicValue value) throws AnalyzerException {
    Value expected;
    switch (insn.getOpcode()) {
    case ILOAD:
    case ISTORE:
        expected = BasicValue.INT_VALUE;
        break;
    case FLOAD:
    case FSTORE:
        expected = BasicValue.FLOAT_VALUE;
        break;
    case LLOAD:
    case LSTORE:
        expected = BasicValue.LONG_VALUE;
        break;
    case DLOAD:
    case DSTORE:
        expected = BasicValue.DOUBLE_VALUE;
        break;
    case ALOAD:
        if (!value.isReference()) {
            throw new AnalyzerException(insn, null, "an object reference",
                    value);
        }
        return value;
    case ASTORE:
        if (!value.isReference()
                && !BasicValue.RETURNADDRESS_VALUE.equals(value)) {
            throw new AnalyzerException(insn, null,
                    "an object reference or a return address", value);
        }
        return value;
    default:
        return value;
    }
    if (!expected.equals(value)) {
        throw new AnalyzerException(insn, null, expected, value);
    }
    return value;
}
 
开发者ID:acmerli,项目名称:fastAOP,代码行数:43,代码来源:BasicVerifier.java

示例13: getPreviousRealInsn

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
public static @Nullable AbstractInsnNode getPreviousRealInsn(AbstractInsnNode insn) {
	while ((insn = insn.getPrevious()) != null && insn.getOpcode() == -1);
	return insn;
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:5,代码来源:AsmUtils.java

示例14: getPreviousPseudoInsn

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
public static @Nullable AbstractInsnNode getPreviousPseudoInsn(AbstractInsnNode insn) {
	while ((insn = insn.getPrevious()) != null && insn.getOpcode() != -1);
	return insn;
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:5,代码来源:AsmUtils.java

示例15: isControlFlowInstruction

import org.objectweb.asm.tree.AbstractInsnNode; //导入方法依赖的package包/类
private static boolean isControlFlowInstruction(AbstractInsnNode insn) {
  return isReturn(insn) || isThrow(insn) || isSwitch(insn) || (insn instanceof JumpInsnNode)
      || insn.getOpcode() == Opcodes.RET;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:5,代码来源:JarSourceCode.java


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