use of org.objectweb.asm.tree.LocalVariableNode 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.LocalVariableNode 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.LocalVariableNode 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.LocalVariableNode in project evosuite by EvoSuite.
the class ReplaceVariable method getType.
private Type getType(MethodNode mn, AbstractInsnNode node) throws VariableNotFoundException {
if (node instanceof VarInsnNode) {
LocalVariableNode var = getLocal(mn, node, ((VarInsnNode) node).var);
return Type.getType(var.desc);
} else if (node instanceof FieldInsnNode) {
return Type.getType(((FieldInsnNode) node).desc);
} else if (node instanceof IincInsnNode) {
IincInsnNode incNode = (IincInsnNode) node;
LocalVariableNode var = getLocal(mn, node, incNode.var);
return Type.getType(var.desc);
} else {
throw new RuntimeException("Unknown variable node: " + node);
}
}
use of org.objectweb.asm.tree.LocalVariableNode in project evosuite by EvoSuite.
the class ReplaceVariable method getLocal.
private LocalVariableNode getLocal(MethodNode mn, AbstractInsnNode node, int index) throws VariableNotFoundException {
int currentId = mn.instructions.indexOf(node);
for (Object v : mn.localVariables) {
LocalVariableNode localVar = (LocalVariableNode) v;
int startId = mn.instructions.indexOf(localVar.start);
int endId = mn.instructions.indexOf(localVar.end);
logger.info("Checking " + localVar.index + " in scope " + startId + " - " + endId);
if (currentId >= startId && currentId <= endId && localVar.index == index)
return localVar;
}
throw new VariableNotFoundException("Could not find local variable " + index + " at position " + currentId + ", have variables: " + mn.localVariables.size());
}
Aggregations