Commit 7de325da authored by Yudi Zheng's avatar Yudi Zheng
Browse files

Now the MarkedRegion contains a reference to the method instruction list.

parent 7aa33d10
......@@ -14,16 +14,16 @@ public class BodyMarker implements Marker {
public List<MarkedRegion> mark(MethodNode method) {
List<MarkedRegion> regions = new LinkedList<MarkedRegion>();
InsnList ilst = method.instructions;
MarkedRegion region = new MarkedRegion();
MarkedRegion region = new MarkedRegion(ilst);
region.start = ilst.getFirst();
for (AbstractInsnNode instr : method.instructions.toArray()) {
int opcode = instr.getOpcode();
if (opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN)
if (opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN)
region.addExitPoint(instr.getPrevious());
}
regions.add(region);
return regions;
}
......
......@@ -17,7 +17,7 @@ public class InvocationMarker implements Marker {
for (AbstractInsnNode instruction : ilst.toArray())
if (instruction instanceof MethodInsnNode)
regions.add(new MarkedRegion(instruction, instruction));
regions.add(new MarkedRegion(ilst, instruction, instruction));
return regions;
}
......
......@@ -4,17 +4,22 @@ import java.util.LinkedList;
import java.util.List;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.InsnList;
public class MarkedRegion {
public InsnList ilst;
public AbstractInsnNode start;
public List<AbstractInsnNode> ends;
public MarkedRegion() {
public MarkedRegion(InsnList ilst) {
this.ilst = ilst;
this.start = null;
this.ends = new LinkedList<AbstractInsnNode>();
}
public MarkedRegion(AbstractInsnNode start, AbstractInsnNode end) {
public MarkedRegion(InsnList ilst, AbstractInsnNode start,
AbstractInsnNode end) {
this.ilst = ilst;
this.start = start;
this.ends = new LinkedList<AbstractInsnNode>();
this.ends.add(end);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment