org.objectweb.asm.Opcodes# IINC 源码实例Demo

下面列出了org.objectweb.asm.Opcodes# IINC 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。


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;
}
 

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;
}
 
源代码3 项目: JByteMod-Beta   文件: IincInsnNode.java

public IincInsnNode() {
  super(Opcodes.IINC);
}
 

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;
}
 
源代码5 项目: CodenameOne   文件: IInc.java

public IInc(int var, int num) {
    super(Opcodes.IINC);
    this.var = var;
    this.num = num;
}
 
源代码6 项目: pitest   文件: InfiniteForLoopFilter.java

@Override
boolean couldCauseInfiniteLoop(MethodTree method, MutationDetails each) {
  final AbstractInsnNode instruction = method.instruction(each.getInstructionIndex());
  return instruction.getOpcode() == Opcodes.IINC;
}
 
源代码7 项目: Cafebabe   文件: IincInsnNode.java

/**
 * 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;
}
 
源代码8 项目: Concurnas   文件: IincInsnNode.java

/**
 * 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;
}
 
源代码9 项目: JByteMod-Beta   文件: IincInsnNode.java

/**
 * 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;
}
 
源代码10 项目: JReFrameworker   文件: IincInsnNode.java

/**
 * 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;
}
 
源代码11 项目: JReFrameworker   文件: IincInsnNode.java

/**
 * 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;
}
 
 方法所在类
 同类方法