this wont work because exception handlers arent run so it wont see all returns

This commit is contained in:
Adam
2016-02-13 17:07:01 -05:00
parent 8efd637a87
commit 66e9960596
4 changed files with 84 additions and 53 deletions

View File

@@ -11,11 +11,13 @@ import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
import net.runelite.deob.attributes.code.instruction.types.InvokeInstruction;
import net.runelite.deob.attributes.code.instruction.types.LVTInstruction;
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
import net.runelite.deob.attributes.code.instruction.types.ReturnInstruction;
import net.runelite.deob.attributes.code.instruction.types.SetFieldInstruction;
import net.runelite.deob.attributes.code.instructions.InvokeStatic;
import net.runelite.deob.execution.Execution;
import net.runelite.deob.execution.Frame;
import net.runelite.deob.execution.InstructionContext;
import net.runelite.deob.execution.MethodContext;
import net.runelite.deob.execution.ParallellMappingExecutor;
import net.runelite.deob.execution.StackContext;
import net.runelite.deob.execution.VariableContext;
@@ -86,6 +88,9 @@ public class MappingExecutorUtil
frame.other = frame2;
frame2.other = frame;
MethodContext ctx1 = frame.getMethodCtx(),
ctx2 = frame2.getMethodCtx();
ParallellMappingExecutor parallel = new ParallellMappingExecutor(e, e2);
ParallelExecutorMapping mappings = new ParallelExecutorMapping(m1.getMethods().getClassFile().getGroup(),
m2.getMethods().getClassFile().getGroup());
@@ -184,9 +189,31 @@ public class MappingExecutorUtil
e.paused = e2.paused = false;
}
// if (mappings.getMap().isEmpty() == false)
// {
// checkReturns(m1, ctx1);
// }
return mappings;
}
//static boolean hit;
private static boolean checkReturns(Method method, MethodContext ctx)
{
List<Instruction> ins = method.getCode().getInstructions().getInstructions().stream().filter(i -> i instanceof ReturnInstruction).collect(Collectors.toList());
List<Instruction> exc = ctx.instructions.stream().map(i -> i.getInstruction()).collect(Collectors.toList());
for (Instruction i : ins)
{
if (!exc.contains(i))
{
return false;
}
}
return true;
}
//private static boolean containsMappableInstruction
public static boolean isMappable(InvokeInstruction ii)
{

View File

@@ -236,9 +236,12 @@ public class Frame
}
InstructionContext ictx = this.instructions.get(this.instructions.size() - 1);
assert ictx.getInstruction() == oldCur;
execution.contexts.put(oldCur, ictx);
this.ctx.instructions.add(ictx);
execution.executed.add(oldCur);
processExceptions(oldCur);

View File

@@ -1,7 +1,8 @@
package net.runelite.deob.execution;
import java.util.ArrayList;
import java.util.Collection;
import net.runelite.deob.Field;
import java.util.List;
import net.runelite.deob.attributes.code.Instruction;
import org.apache.commons.collections4.map.MultiValueMap;
@@ -9,6 +10,7 @@ public class MethodContext
{
private Execution execution;
private MultiValueMap<InstructionContext, Instruction> visited = new MultiValueMap<>();
public List<InstructionContext> instructions = new ArrayList<>();
public MethodContext(Execution execution)
{