|
@@ -53,10 +53,11 @@ public class PseudoCodeProcessor {
|
|
|
ControlFlow cf = null;
|
|
|
if( mem.isDefined( "_call" + programPointer.getId(), MemoryType.LOCAL ) )
|
|
|
{
|
|
|
- mem.undeclare( "_call" + programPointer.getId(), MemoryType.LOCAL );
|
|
|
+ String name = "_call" + programPointer.getId();
|
|
|
+ mem.undeclare( name, MemoryType.LOCAL );
|
|
|
cf = programPointer.emptyForwardStep( mem );
|
|
|
cf.setBackwardAction( (Memory m) -> {
|
|
|
- mem.declare( "_call" + programPointer.getId(), true, MemoryType.LOCAL );
|
|
|
+ mem.declare( name, true, MemoryType.LOCAL );
|
|
|
});
|
|
|
}
|
|
|
else
|
|
@@ -68,11 +69,12 @@ public class PseudoCodeProcessor {
|
|
|
case ControlFlow.STEP_INTO:
|
|
|
if( mem.isDefined( "_returnTo" + programPointer.getId(), MemoryType.GLOBAL ) )
|
|
|
{
|
|
|
- mem.declare( "_returnTo" + programPointer.getId(), mem.read( "_returnTo" + programPointer.getId(), MemoryType.GLOBAL ), MemoryType.LOCAL );
|
|
|
- mem.undeclare( "_returnTo" + programPointer.getId(), MemoryType.GLOBAL );
|
|
|
+ String name = "_returnTo" + programPointer.getId();
|
|
|
+ mem.declare( name, mem.read( name, MemoryType.GLOBAL ), MemoryType.LOCAL );
|
|
|
+ mem.undeclare( name, MemoryType.GLOBAL );
|
|
|
cf.setBackwardAction( (Memory m) -> {
|
|
|
- mem.declare( "_returnTo" + programPointer.getId(), mem.read( "_returnTo" + programPointer.getId(), MemoryType.LOCAL ), MemoryType.GLOBAL );
|
|
|
- mem.undeclare( "_returnTo" + programPointer.getId(), MemoryType.LOCAL );
|
|
|
+ mem.declare( name, mem.read( name, MemoryType.LOCAL ), MemoryType.GLOBAL );
|
|
|
+ mem.undeclare( name, MemoryType.LOCAL );
|
|
|
});
|
|
|
}
|
|
|
if( programPointer.getChildCount() == 0 )
|
|
@@ -84,10 +86,11 @@ public class PseudoCodeProcessor {
|
|
|
return CodeStatus.FINISHED;
|
|
|
if( before.isDefined( "_returnTo" + programPointer.getId() ) )
|
|
|
{
|
|
|
- PseudoCodeNode nextPC = before.<PseudoCodeNode>get( "_returnTo" + programPointer.getId() );
|
|
|
- before.undeclare( "_returnTo" + programPointer.getId() );
|
|
|
+ String name = "_returnTo" + programPointer.getId();
|
|
|
+ PseudoCodeNode nextPC = before.<PseudoCodeNode>get( name );
|
|
|
+ before.undeclare( name );
|
|
|
cf.setBackwardAction( (Memory m) -> {
|
|
|
- before.declare( "_returnTo" + programPointer.getId(), nextPC );
|
|
|
+ before.declare( name, nextPC );
|
|
|
});
|
|
|
return selectNextNode( nextPC, programPointer );
|
|
|
}
|
|
@@ -98,11 +101,12 @@ public class PseudoCodeProcessor {
|
|
|
return selectNextNode( nextPC, programPointer );
|
|
|
case ControlFlow.CALL:
|
|
|
PseudoCodeNode f = cf.getFunction();
|
|
|
- mem.declare( "_call" + programPointer.getId(), true, MemoryType.LOCAL );
|
|
|
+ String name = "_call" + programPointer.getId();
|
|
|
+ mem.declare( name, true, MemoryType.LOCAL );
|
|
|
mem.declare( "_returnTo" + f.getId(), cf.getJumpBack(), MemoryType.GLOBAL );
|
|
|
cf.setBackwardAction( (Memory m) -> {
|
|
|
m.undeclare( "_returnTo" + f.getId(), MemoryType.GLOBAL );
|
|
|
- m.undeclare( "_call" + programPointer.getId(), MemoryType.LOCAL );
|
|
|
+ m.undeclare( name, MemoryType.LOCAL );
|
|
|
});
|
|
|
return selectNextNode( f, programPointer );
|
|
|
}
|