List of usage examples for org.objectweb.asm Opcodes IF_ICMPGE
int IF_ICMPGE
To view the source code for org.objectweb.asm Opcodes IF_ICMPGE.
Click Source Link
From source file:org.sonar.java.bytecode.se.BytecodeEGWalkerExecuteTest.java
License:Open Source License
@Test public void test_compare_instructions() { int[] opcodes = { Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPLT, Opcodes.IF_ICMPGE, Opcodes.IF_ACMPEQ, Opcodes.IF_ACMPNE }; SymbolicValue left = new SymbolicValue(); SymbolicValue right = new SymbolicValue(); for (int opcode : opcodes) { ProgramState programState = walker.branchingState(new Instruction(opcode), ProgramState.EMPTY_STATE.stackValue(left).stackValue(right)); RelationalSymbolicValue relSV = (RelationalSymbolicValue) programState.peekValue(); assertThat(relSV.getLeftOp()).isSameAs(left); assertThat(relSV.getRightOp()).isSameAs(right); }/*from w w w . jav a 2 s .co m*/ // these opcodes inverse operator and swap operands int[] swapOperandsOpcodes = { Opcodes.IF_ICMPLE, Opcodes.IF_ICMPGT }; for (int opcode : swapOperandsOpcodes) { ProgramState programState = walker.branchingState(new Instruction(opcode), ProgramState.EMPTY_STATE.stackValue(left).stackValue(right)); RelationalSymbolicValue relSV = (RelationalSymbolicValue) programState.peekValue(); assertThat(relSV.getRightOp()).isSameAs(left); assertThat(relSV.getLeftOp()).isSameAs(right); } }
From source file:org.spongepowered.asm.mixin.injection.points.JumpInsnPoint.java
License:MIT License
public JumpInsnPoint(InjectionPointData data) { this.opCode = data.getOpcode(-1, Opcodes.IFEQ, Opcodes.IFNE, Opcodes.IFLT, Opcodes.IFGE, Opcodes.IFGT, Opcodes.IFLE, Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPLT, Opcodes.IF_ICMPGE, Opcodes.IF_ICMPGT, Opcodes.IF_ICMPLE, Opcodes.IF_ACMPEQ, Opcodes.IF_ACMPNE, Opcodes.GOTO, Opcodes.JSR, Opcodes.IFNULL, Opcodes.IFNONNULL, -1); this.ordinal = data.getOrdinal(); }
From source file:serianalyzer.JVMImpl.java
License:Open Source License
/** * @param opcode//from ww w . ja v a2s . c o m * @param label * @param s * @return */ static boolean handleJVMJump(int opcode, Label label, JVMStackState s) { boolean tainted; switch (opcode) { case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPNE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: BaseType o1 = s.pop(); BaseType o2 = s.pop(); tainted = !(o1 != null) || !(o2 != null) || o1.isTainted() || o2.isTainted(); break; case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IFNULL: case Opcodes.IFNONNULL: BaseType c = s.pop(); tainted = (c == null || c.isTainted()); break; case Opcodes.JSR: s.push(new BasicConstant(Type.INT_TYPE, label)); tainted = false; break; case Opcodes.GOTO: tainted = false; break; default: log.warn("Unsupported opcode " + opcode); //$NON-NLS-1$ tainted = true; } return tainted; }
From source file:uk.co.mysterymayhem.tessellatorfix.Transformer.java
private static byte[] patchTessellatorClass(byte[] bytes) { String targetMethodName;//from w ww. j a va2s . c om if (Plugin.runtimeDeobfEnabled) { targetMethodName = "func_147564_a"; } else { targetMethodName = "getVertexState"; } ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); Iterator<MethodNode> methods = classNode.methods.iterator(); while (methods.hasNext()) { MethodNode m = methods.next(); if ((m.name.equals(targetMethodName) && m.desc.equals("(FFF)Lnet/minecraft/client/shader/TesselatorVertexState;"))) { FMLLog.info("Inside target Tessellator method"); InsnList toInject = new InsnList(); // Insertion of "if (this.rawBufferIndex < 1) return" LabelNode labelNode = new LabelNode(); toInject.add(new VarInsnNode(Opcodes.ALOAD, 0)); String fieldName; if (Plugin.runtimeDeobfEnabled) { fieldName = "field_147569_p"; } else { fieldName = "rawBufferIndex"; } toInject.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/Tessellator", fieldName, "I")); toInject.add(new InsnNode(Opcodes.ICONST_1)); toInject.add(new JumpInsnNode(Opcodes.IF_ICMPGE, labelNode)); toInject.add(new InsnNode(Opcodes.ACONST_NULL)); toInject.add(new InsnNode(Opcodes.ARETURN)); toInject.add(labelNode); // Insert after m.instructions.insert(toInject); ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); classNode.accept(writer); FMLLog.info("Exiting target Tessellator method"); return writer.toByteArray(); } } FMLLog.warning("Could not find Tessellator method out of:"); StringBuilder builder = new StringBuilder(); for (MethodNode methodNode : classNode.methods) { builder.append(methodNode.name).append(":").append(methodNode.desc).append("\n"); } FMLLog.info(builder.toString()); return bytes; }
From source file:v6.java.preverifier.MethodRewriter.java
License:Open Source License
/** * Visit the specified instruction and do the right thing. * //from w w w .j a va2s . co m * @param method * @param region * @param insnNode * @throws AnalyzerException */ private void visitInstruction(MethodNode method, Region region, AbstractInsnNode insnNode) throws AnalyzerException { int opcode = insnNode.getOpcode(); switch (opcode) { case Opcodes.JSR: visitJumpToSubroutine(method, region, (JumpInsnNode) insnNode); break; case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPNE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: case Opcodes.GOTO: case Opcodes.IFNULL: case Opcodes.IFNONNULL: visitJump(method, region, (JumpInsnNode) insnNode); break; case Opcodes.LOOKUPSWITCH: visitLookupSwitch(method, region, (LookupSwitchInsnNode) insnNode); break; case Opcodes.TABLESWITCH: visitTableSwitch(method, region, (TableSwitchInsnNode) insnNode); break; default: insnNode.accept(method); } }