Store return stack pop with stack context instead of what I was trying to do before
This commit is contained in:
@@ -301,6 +301,14 @@ public class MappingExecutorUtil
|
||||
return resolve(storedCtx, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.getInstruction() instanceof InvokeStatic)
|
||||
{
|
||||
if (from.returnSource != null)
|
||||
{
|
||||
return resolve(from.returnSource.getPushed(), from.returnSource);
|
||||
}
|
||||
}
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public class ParallellMappingExecutor
|
||||
return f2;
|
||||
}
|
||||
|
||||
public static boolean enable = false;
|
||||
public static boolean enable = true;
|
||||
public static List<StackContext> returnStacks = new ArrayList<>();
|
||||
private Frame popStack(Frame f)
|
||||
{
|
||||
@@ -335,27 +335,30 @@ public class ParallellMappingExecutor
|
||||
|
||||
StackContext invokePushed = i2.getPushes().get(0);
|
||||
|
||||
if (invokePushed.getPushed().getInstruction() != i2.getInstruction())
|
||||
//if (!(invokePushed.getPushed().getInstruction() instanceof InvokeStatic))
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
//returnStacks.add(invokePushed);
|
||||
returnStacks.add(returnValue);
|
||||
boolean b = returnStacks.contains(invokePushed);
|
||||
assert invokePushed.getPopped().isEmpty();
|
||||
|
||||
// replace invokePushed with returnValue?
|
||||
i2.getPushes().remove(invokePushed);
|
||||
i2.getPushes().add(returnValue);
|
||||
|
||||
//invokePushed.setpushed = null
|
||||
|
||||
Stack stack = r.getStack();
|
||||
StackContext s = stack.pop();
|
||||
assert s == invokePushed;
|
||||
stack.push(returnValue);
|
||||
//assert invokePushed.returnSource == null;
|
||||
invokePushed.returnSource = returnValue;
|
||||
//
|
||||
// if (invokePushed.getPushed().getInstruction() != i2.getInstruction())
|
||||
// //if (!(invokePushed.getPushed().getInstruction() instanceof InvokeStatic))
|
||||
// {
|
||||
// return r;
|
||||
// }
|
||||
//
|
||||
// //returnStacks.add(invokePushed);
|
||||
// returnStacks.add(returnValue);
|
||||
// boolean b = returnStacks.contains(invokePushed);
|
||||
// assert invokePushed.getPopped().isEmpty();
|
||||
//
|
||||
// // replace invokePushed with returnValue?
|
||||
// i2.getPushes().remove(invokePushed);
|
||||
// i2.getPushes().add(returnValue);
|
||||
//
|
||||
// //invokePushed.setpushed = null
|
||||
//
|
||||
// Stack stack = r.getStack();
|
||||
// StackContext s = stack.pop();
|
||||
// assert s == invokePushed;
|
||||
// stack.push(returnValue);
|
||||
|
||||
//assert invokePushed.getPushed().getPushes().contains(invokePushed);
|
||||
//invokePushed.getpu
|
||||
|
||||
@@ -11,6 +11,7 @@ public class StackContext
|
||||
public Type type; // type of this
|
||||
private Value value;
|
||||
public boolean removed;
|
||||
public StackContext returnSource; // if this is the return value of an invokestatic, returnSource is the stack popped by the Return instruction
|
||||
|
||||
public StackContext(InstructionContext pushed, Type type, Value value)
|
||||
{
|
||||
|
||||
@@ -522,6 +522,14 @@ public class MapStaticTest
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPackets() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File(JAR1));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File(JAR2));
|
||||
testPackets(group1, group2);
|
||||
}
|
||||
|
||||
//@Test
|
||||
public ParallelExecutorMapping testPackets(ClassGroup group1, ClassGroup group2) throws IOException
|
||||
|
||||
Reference in New Issue
Block a user