Skip to content

Commit

Permalink
[PSym] Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-goel committed Oct 6, 2023
1 parent 21a52f0 commit 08ce723
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
2 changes: 0 additions & 2 deletions Src/PRuntimes/PSymRuntime/src/main/java/psym/EntryPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import psym.runtime.scheduler.search.SearchScheduler;
import psym.runtime.scheduler.search.explicit.ExplicitSearchScheduler;
import psym.runtime.scheduler.search.symbolic.SymbolicSearchScheduler;
import psym.runtime.scheduler.search.symmetry.SymmetryMode;
import psym.runtime.scheduler.search.symmetry.SymmetryTracker;
import psym.utils.exception.BugFoundException;
import psym.utils.exception.MemoutException;
import psym.utils.monitor.MemoryMonitor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package psym.valuesummary;

import java.util.*;

import lombok.Getter;
import psym.runtime.PSymGlobal;
import psym.runtime.machine.Machine;
Expand All @@ -23,29 +22,6 @@ public class NamedTupleVS implements ValueSummary<NamedTupleVS> {
/** Underlying representation as a TupleVS */
@Getter private final TupleVS tuple;

private void storeSymmetricTuple() {
if (PSymGlobal.getConfiguration().getSymmetryMode() == SymmetryMode.Full) {
if (this.names.size() == 2 && !isEmptyVS()) {
if (this.names.get(0).equals("symtag")) {
if (PSymGlobal.getSymmetryTracker() instanceof ExplicitSymmetryTracker) {
ExplicitSymmetryTracker symTracker = (ExplicitSymmetryTracker) PSymGlobal.getSymmetryTracker();

Object symTagObj = this.tuple.getField(0).getConcreteValue();
Object dataObj = this.tuple.getField(1).getConcreteValue();

if (symTagObj != null) {
String symTag = symTagObj.toString();
Machine machineTag = Machine.getNameToMachine().get(symTag);
if (machineTag != null) {
symTracker.addMachineSymData(machineTag, dataObj);
}
}
}
}
}
}
}

private NamedTupleVS(List<String> names, TupleVS tuple) {
this.names = names;
this.tuple = tuple;
Expand Down Expand Up @@ -86,6 +62,29 @@ public NamedTupleVS(Object... namesAndFields) {
storeSymmetricTuple();
}

private void storeSymmetricTuple() {
if (PSymGlobal.getConfiguration().getSymmetryMode() == SymmetryMode.Full) {
if (this.names.size() == 2 && !isEmptyVS()) {
if (this.names.get(0).equals("symtag")) {
if (PSymGlobal.getSymmetryTracker() instanceof ExplicitSymmetryTracker) {
ExplicitSymmetryTracker symTracker = (ExplicitSymmetryTracker) PSymGlobal.getSymmetryTracker();

Object symTagObj = this.tuple.getField(0).getConcreteValue();
Object dataObj = this.tuple.getField(1).getConcreteValue();

if (symTagObj != null) {
String symTag = symTagObj.toString();
Machine machineTag = Machine.getNameToMachine().get(symTag);
if (machineTag != null) {
symTracker.addMachineSymData(machineTag, dataObj);
}
}
}
}
}
}
}

/**
* Copy the value summary
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.stream.IntStream;
import lombok.Getter;
import psym.runtime.machine.Machine;
import psym.utils.exception.BugFoundException;

/** Represents a tuple value summaries */
@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 08ce723

Please sign in to comment.