Skip to content

Commit 4f19bb6

Browse files
Fixed: array swap issue #5
1 parent a68ada1 commit 4f19bb6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/de/wwu/muggl/instructions/general/Load.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import de.wwu.muggl.vm.execution.MugglToJavaConversion;
1818
import de.wwu.muggl.vm.impl.symbolic.SymbolicExecutionException;
1919
import de.wwu.muggl.vm.impl.symbolic.SymbolicVirtualMachine;
20+
import de.wwu.muggl.vm.initialization.ModifieableArrayref;
2021
import de.wwu.testtool.expressions.Variable;
2122

2223
/**
@@ -178,7 +179,12 @@ public void executeSymbolically(Frame frame, int localVariable) throws NoExcepti
178179

179180
// Generate an ArrayInitializationChoicePoint.
180181
((SymbolicVirtualMachine) frame.getVm()).generateNewChoicePoint(this, null, null);
181-
frame.getMethod().setGeneratedValue(localVariable, localVariables[localVariable]);
182+
183+
if (localVariables[localVariable] == null) {
184+
frame.getMethod().setGeneratedValue(localVariable, null);
185+
} else {
186+
frame.getMethod().setGeneratedValue(localVariable, ((ModifieableArrayref)localVariables[localVariable]).clone());
187+
}
182188
} else {
183189
// Create and push an non array type.
184190
Variable variable = this.typedInstruction.getNewVariable(frame.getMethod(), localVariable);

src/de/wwu/muggl/symbolic/searchAlgorithms/choice/array/ArrayInitializationChoicePoint.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,11 @@ public synchronized void applyStateChanges() {
509509
// Set or push?
510510
if (this.index != -1) {
511511
this.frame.setLocalVariable(this.index, this.preparedArray);
512-
this.frame.getMethod().setGeneratedValue(this.index, this.preparedArray);
512+
if (this.preparedArray == null) {
513+
this.frame.getMethod().setGeneratedValue(this.index, null);
514+
} else {
515+
this.frame.getMethod().setGeneratedValue(this.index, this.preparedArray.clone());
516+
}
513517
} else {
514518
// Push.
515519
this.frame.getOperandStack().push(this.preparedArray);

0 commit comments

Comments
 (0)