Skip to content

Commit 445ab67

Browse files
committed
Merge branch 'master' into issue_138
2 parents e1bf902 + c467768 commit 445ab67

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public Map<IJavaProject, Collection<Entrypoint>> analyze() throws CoreException
189189
* @see #analyze().
190190
*/
191191
public Map<IJavaProject, Collection<Entrypoint>> analyze(Optional<TimeCollector> collector) throws CoreException {
192-
LOGGER.info(() -> "Using N = " + this.getNForStreams() + ".");
192+
LOGGER.fine(() -> "Using N = " + this.getNForStreams() + ".");
193193

194194
Map<IJavaProject, Collection<Entrypoint>> ret = new HashMap<>();
195195

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamStateMachine.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,12 @@ else if (set2.isEmpty())
429429
return ret;
430430
}
431431

432+
private static void outputTypeStateStatistics(AggregateSolverResult result) {
433+
LOGGER.info("Total instances: " + result.totalInstancesNum());
434+
LOGGER.info("Processed instances: " + result.processedInstancesNum());
435+
LOGGER.info("Skipped instances: " + result.skippedInstances());
436+
}
437+
432438
private static IDFAState selectState(IDFAState state1, IDFAState state2) {
433439
if (state1.getName().equals(BOTTOM_STATE_NAME))
434440
return state2;
@@ -983,7 +989,9 @@ public Map<TypestateRule, Statistics> start(Set<Stream> streamSet, EclipseProjec
983989
throw new RuntimeException("Exception caught during typestate analysis.", e);
984990
}
985991

986-
// record statistics.
992+
// record typestate statistics.
993+
outputTypeStateStatistics(result);
994+
987995
Statistics lastStatistics = ret.put(rule,
988996
new Statistics(result.processedInstancesNum(), result.skippedInstances()));
989997
assert lastStatistics == null : "Reassociating statistics.";
@@ -1026,9 +1034,9 @@ public Map<TypestateRule, Statistics> start(Set<Stream> streamSet, EclipseProjec
10261034
// invocations?
10271035
if (isTerminalOperation(calledMethod)) {
10281036
// get the basic block for the call.
1037+
IR ir = cgNode.getIR();
10291038

1030-
ISSABasicBlock[] blocksForCall = cgNode.getIR()
1031-
.getBasicBlocksForCall(callSiteReference);
1039+
ISSABasicBlock[] blocksForCall = ir.getBasicBlocksForCall(callSiteReference);
10321040

10331041
assert blocksForCall.length == 1 : "Expecting only a single basic block for the call: "
10341042
+ callSiteReference;
@@ -1045,11 +1053,12 @@ public Map<TypestateRule, Statistics> start(Set<Stream> streamSet, EclipseProjec
10451053
// search through each instruction in the
10461054
// block.
10471055
int processedInstructions = 0;
1056+
10481057
for (SSAInstruction instruction : block) {
1049-
// if it's a phi instruction.
1050-
if (instruction instanceof SSAPhiInstruction)
1051-
// skip it. The pointer analysis
1052-
// below will handle it.
1058+
// if it's not an invoke instruction.
1059+
if (!(instruction instanceof SSAAbstractInvokeInstruction))
1060+
// skip it. Phi instructions will be handled by the pointer analysis
1061+
// below.
10531062
continue;
10541063

10551064
// Get the possible receivers. This

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/wala/EclipseProjectAnalysisEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public CallGraphBuilder<?> getCallGraphBuilder() {
178178
@Override
179179
protected CallGraphBuilder<?> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options,
180180
IAnalysisCacheView cache) {
181-
LOGGER.info(() -> "Using N = " + this.getNToUseForStreams());
181+
LOGGER.fine(() -> "Using N = " + this.getNToUseForStreams() + ".");
182182
return Util.makeNCFABuilder(N, options, (AnalysisCache) cache, cha, scope, this.getNToUseForStreams());
183183
}
184184

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/wala/nCFAContextWithReceiversSelector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public nCFAContextWithReceiversSelector(int n, ContextSelector base) {
9595
*/
9696
public nCFAContextWithReceiversSelector(int n, ContextSelector base, int nToUseForStreams) {
9797
super(n, base);
98-
LOGGER.info(() -> "Using N = " + nToUseForStreams);
98+
LOGGER.fine(() -> "Using N = " + nToUseForStreams + ".");
9999
this.contextLengthForStreams = nToUseForStreams;
100100
}
101101

@@ -171,7 +171,7 @@ protected int getLength(CGNode caller, CallSiteReference site, IMethod target) {
171171

172172
if (implementsBaseStream) {
173173
int lengthForStreams = this.getContextLengthForStreams();
174-
LOGGER.finer(() -> "Using N = " + lengthForStreams);
174+
LOGGER.finer(() -> "Using N = " + lengthForStreams + ".");
175175
return lengthForStreams;
176176
} else
177177
return super.getLength(caller, site, target);

edu.cuny.hunter.streamrefactoring.tests/test cases/edu/cuny/hunter/streamrefactoring/ui/tests/ConvertStreamToParallelRefactoringTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public String getRefactoringPath() {
327327
* Runs a single analysis test.
328328
*/
329329
private void helper(int nToUseForStreams, StreamAnalysisExpectedResult... expectedResults) throws Exception {
330-
LOGGER.info("Using N = " + nToUseForStreams);
330+
LOGGER.fine("Using N = " + nToUseForStreams + ".");
331331

332332
// compute the actual results.
333333
ICompilationUnit cu = this.createCUfromTestFile(this.getPackageP(), "A");

0 commit comments

Comments
 (0)