use of org.objectweb.asm.tree.LabelNode in project phosphor by gmu-swe.
the class LocalVariableManager method remapLocal.
@Override
public void remapLocal(int local, Type type) {
Label lbl = new Label();
super.visitLabel(lbl);
curLocalIdxToLVNode.get(local).end = new LabelNode(lbl);
super.remapLocal(local, type);
LocalVariableNode newLVN = new LocalVariableNode("phosphorShadowLV" + createdLVIdx, type.getDescriptor(), null, new LabelNode(lbl), new LabelNode(end), local);
createdLVs.add(newLVN);
curLocalIdxToLVNode.put(local, newLVN);
createdLVIdx++;
}
use of org.objectweb.asm.tree.LabelNode in project phosphor by gmu-swe.
the class LocalVariableManager method createMasterControlTaintLV.
public int createMasterControlTaintLV() {
int idx = super.newLocal(Type.getType(ControlTaintTagStack.class));
if (ctrlTagStartLbl == null) {
ctrlTagStartLbl = new Label();
super.visitLabel(ctrlTagStartLbl);
}
LocalVariableNode newLVN = new LocalVariableNode("phosphorJumpControlTag" + jumpIdx, Type.getDescriptor(ControlTaintTagStack.class), null, new LabelNode(ctrlTagStartLbl), new LabelNode(end), idx);
createdLVs.add(newLVN);
analyzer.locals.add(idx, Type.getInternalName(ControlTaintTagStack.class));
this.idxOfMasterControlLV = idx;
jumpIdx++;
return idx;
}
use of org.objectweb.asm.tree.LabelNode in project phosphor by gmu-swe.
the class LocalVariableManager method newPreAllocedReturnType.
private int newPreAllocedReturnType(Type type) {
int idx = super.newLocal(type);
Label lbl = new Label();
super.visitLabel(lbl);
// System.out.println("End is going to be " + end);
LocalVariableNode newLVN = new LocalVariableNode("phosphorReturnPreAlloc" + createdLVIdx, type.getDescriptor(), null, new LabelNode(lbl), new LabelNode(end), idx);
createdLVs.add(newLVN);
curLocalIdxToLVNode.put(idx, newLVN);
createdLVIdx++;
analyzer.locals.add(idx, type.getInternalName());
return idx;
}
use of org.objectweb.asm.tree.LabelNode in project phosphor by gmu-swe.
the class LocalVariableManager method newControlTaintLV.
public int newControlTaintLV() {
int idx = super.newLocal(Type.getType("Ledu/columbia/cs/psl/phosphor/struct/EnqueuedTaint;"));
if (ctrlTagStartLbl == null) {
ctrlTagStartLbl = new Label();
super.visitLabel(ctrlTagStartLbl);
}
LocalVariableNode newLVN = new LocalVariableNode("phosphorJumpControlTag" + jumpIdx, "Ledu/columbia/cs/psl/phosphor/struct/EnqueuedTaint;", null, new LabelNode(ctrlTagStartLbl), new LabelNode(end), idx);
createdLVs.add(newLVN);
// System.out.println("Create taint tag at " + idx);
analyzer.locals.add(idx, "edu/columbia/cs/psl/phosphor/struct/EnqueuedTaint");
jumpIdx++;
return idx;
}
use of org.objectweb.asm.tree.LabelNode in project evosuite by EvoSuite.
the class ReplaceComparisonOperator method apply.
/* (non-Javadoc)
* @see org.evosuite.cfg.instrumentation.MutationOperator#apply(org.objectweb.asm.tree.MethodNode, java.lang.String, java.lang.String, org.evosuite.cfg.BytecodeInstruction)
*/
/**
* {@inheritDoc}
*/
@Override
public List<Mutation> apply(MethodNode mn, String className, String methodName, BytecodeInstruction instruction, Frame frame) {
JumpInsnNode node = (JumpInsnNode) instruction.getASMNode();
List<Mutation> mutations = new LinkedList<Mutation>();
LabelNode target = node.label;
boolean isBoolean = frame.getStack(frame.getStackSize() - 1) == BooleanValueInterpreter.BOOLEAN_VALUE;
for (Integer op : getOperators(node.getOpcode(), isBoolean)) {
logger.debug("Adding replacement " + op);
if (op >= 0) {
// insert mutation into bytecode with conditional
JumpInsnNode mutation = new JumpInsnNode(op, target);
// insert mutation into pool
Mutation mutationObject = MutationPool.addMutation(className, methodName, NAME + " " + getOp(node.getOpcode()) + " -> " + getOp(op), instruction, mutation, getInfectionDistance(node.getOpcode(), op));
mutations.add(mutationObject);
} else {
// Replace relational operator with TRUE/FALSE
InsnList mutation = new InsnList();
if (opcodesInt.contains(node.getOpcode()))
mutation.add(new InsnNode(Opcodes.POP));
else
mutation.add(new InsnNode(Opcodes.POP2));
if (op == TRUE) {
mutation.add(new LdcInsnNode(1));
} else {
mutation.add(new LdcInsnNode(0));
}
mutation.add(new JumpInsnNode(Opcodes.IFNE, target));
Mutation mutationObject = MutationPool.addMutation(className, methodName, NAME + " " + getOp(node.getOpcode()) + " -> " + op, instruction, mutation, getInfectionDistance(node.getOpcode(), op));
mutations.add(mutationObject);
}
}
return mutations;
}
Aggregations