Java Code Examples for org.objectweb.asm.Opcodes#IINC

The following examples show how to use org.objectweb.asm.Opcodes#IINC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowObfuscationTransformer.java    From deobfuscator with Apache License 2.0 6 votes vote down vote up
private List<AbstractInsnNode> getPossibleDupPop(AbstractInsnNode ain)
{
	AbstractInsnNode next = ain;
	List<AbstractInsnNode> instrs = new ArrayList<>();
	while(next != null)
	{
		if(Utils.isInstruction(next) && next.getOpcode() != Opcodes.IINC)
			instrs.add(next);
		if(instrs.size() >= 3)
			break;
		next = next.getNext();
	}
	if(instrs.size() >= 3 && (willPush(instrs.get(0)) || ain.getOpcode() == Opcodes.DUP) 
		&& (willPush(instrs.get(1)) || instrs.get(1).getOpcode() == Opcodes.DUP)
		&& instrs.get(2).getOpcode() == Opcodes.POP2)
		return instrs;
	else
		return null;
}
 
Example 2
Source File: FlowObfuscationTransformer.java    From deobfuscator with Apache License 2.0 6 votes vote down vote up
private List<AbstractInsnNode> getPossibleSwap(AbstractInsnNode ain, int mode)
{
	AbstractInsnNode next = ain;
	List<AbstractInsnNode> instrs = new ArrayList<>();
	while(next != null)
	{
		if(Utils.isInstruction(next) && next.getOpcode() != Opcodes.IINC)
			instrs.add(next);
		if(instrs.size() >= (mode == 0 ? 3 : 4))
			break;
		next = next.getNext();
	}
	if(mode == 0 && instrs.size() >= 3 && willPush(instrs.get(0)) && willPush(instrs.get(1))
		&& instrs.get(2).getOpcode() == Opcodes.SWAP)
		return instrs;
	else if(mode == 1 && instrs.size() >= 4 && willPush(instrs.get(0)) 
		&& (willPush(instrs.get(1)) || instrs.get(1).getOpcode() == Opcodes.DUP)
		&& instrs.get(2).getOpcode() == Opcodes.GETFIELD
		&& Type.getType(((FieldInsnNode)instrs.get(2)).desc).getSort() != Type.LONG
		&& Type.getType(((FieldInsnNode)instrs.get(2)).desc).getSort() != Type.DOUBLE
		&& instrs.get(3).getOpcode() == Opcodes.SWAP)
		return instrs;
	else
		return null;
}
 
Example 3
Source File: IincInsnNode.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
public IincInsnNode() {
  super(Opcodes.IINC);
}
 
Example 4
Source File: UselessArithmeticTransformer.java    From deobfuscator with Apache License 2.0 4 votes vote down vote up
private List<AbstractInsnNode> getPossibleInsns(AbstractInsnNode ain)
{
	List<AbstractInsnNode> instrs = new ArrayList<>();
	while(ain != null)
	{
		if(ain instanceof LineNumberNode || ain instanceof FrameNode)
		{
			ain = ain.getNext();
			continue;
		}
		instrs.add(ain);
		if(instrs.size() >= 23)
			break;
		ain = ain.getNext();
	}
	if(instrs.size() == 23 && instrs.get(0).getOpcode() == Opcodes.ILOAD
		&& instrs.get(1).getOpcode() == Opcodes.ICONST_1
		&& instrs.get(2).getOpcode() == Opcodes.ISUB
		&& instrs.get(3).getOpcode() == Opcodes.ISTORE)
	{
		int var1 = ((VarInsnNode)instrs.get(0)).var;
		int var2 = ((VarInsnNode)instrs.get(3)).var;
		if(instrs.get(4).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(4)).var == var1
			&& instrs.get(5).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(5)).var == var2
			&& instrs.get(6).getOpcode() == Opcodes.IMUL
			&& instrs.get(7).getOpcode() == Opcodes.ISTORE
			&& ((VarInsnNode)instrs.get(7)).var == var2
			&& instrs.get(8).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(8)).var == var2
			&& instrs.get(9).getOpcode() == Opcodes.ICONST_2
			&& instrs.get(10).getOpcode() == Opcodes.IREM
			&& instrs.get(11).getOpcode() == Opcodes.ISTORE
			&& ((VarInsnNode)instrs.get(11)).var == var2
			&& instrs.get(12).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(12)).var == var2
			&& instrs.get(13).getOpcode() == Opcodes.I2L
			&& instrs.get(14).getOpcode() == Opcodes.ICONST_0
			&& instrs.get(15).getOpcode() == Opcodes.I2L
			&& instrs.get(16).getOpcode() == Opcodes.LCMP
			&& instrs.get(17).getOpcode() == Opcodes.ICONST_1
			&& instrs.get(18).getOpcode() == Opcodes.IXOR
			&& instrs.get(19).getOpcode() == Opcodes.ICONST_1
			&& instrs.get(20).getOpcode() == Opcodes.IAND
			&& instrs.get(21).getOpcode() == Opcodes.IFEQ
			&& instrs.get(22).getOpcode() == Opcodes.IINC)
			return instrs;
	}
	return null;
}
 
Example 5
Source File: IInc.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public IInc(int var, int num) {
    super(Opcodes.IINC);
    this.var = var;
    this.num = num;
}
 
Example 6
Source File: InfiniteForLoopFilter.java    From pitest with Apache License 2.0 4 votes vote down vote up
@Override
boolean couldCauseInfiniteLoop(MethodTree method, MutationDetails each) {
  final AbstractInsnNode instruction = method.instruction(each.getInstructionIndex());
  return instruction.getOpcode() == Opcodes.IINC;
}
 
Example 7
Source File: IincInsnNode.java    From Cafebabe with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Constructs a new {@link IincInsnNode}.
 *
 * @param var
 *          index of the local variable to be incremented.
 * @param incr
 *          increment amount to increment the local variable by.
 */
public IincInsnNode(final int var, final int incr) {
	super(Opcodes.IINC);
	this.var = var;
	this.incr = incr;
}
 
Example 8
Source File: IincInsnNode.java    From Concurnas with MIT License 2 votes vote down vote up
/**
 * Constructs a new {@link IincInsnNode}.
 *
 * @param var index of the local variable to be incremented.
 * @param incr increment amount to increment the local variable by.
 */
public IincInsnNode(final int var, final int incr) {
  super(Opcodes.IINC);
  this.var = var;
  this.incr = incr;
}
 
Example 9
Source File: IincInsnNode.java    From JByteMod-Beta with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new {@link IincInsnNode}.
 * 
 * @param var
 *          index of the local variable to be incremented.
 * @param incr
 *          increment amount to increment the local variable by.
 */
public IincInsnNode(final int var, final int incr) {
  super(Opcodes.IINC);
  this.var = var;
  this.incr = incr;
}
 
Example 10
Source File: IincInsnNode.java    From JReFrameworker with MIT License 2 votes vote down vote up
/**
 * Constructs a new {@link IincInsnNode}.
 *
 * @param var index of the local variable to be incremented.
 * @param incr increment amount to increment the local variable by.
 */
public IincInsnNode(final int var, final int incr) {
  super(Opcodes.IINC);
  this.var = var;
  this.incr = incr;
}
 
Example 11
Source File: IincInsnNode.java    From JReFrameworker with MIT License 2 votes vote down vote up
/**
 * Constructs a new {@link IincInsnNode}.
 *
 * @param var index of the local variable to be incremented.
 * @param incr increment amount to increment the local variable by.
 */
public IincInsnNode(final int var, final int incr) {
  super(Opcodes.IINC);
  this.var = var;
  this.incr = incr;
}