// use the methods given above to check every possible alias
// between task parameters and flagged allocation sites reachable
// from the task
- public void writeAllAliases(String outputFile, String timeReport) throws java.io.IOException {
+ public void writeAllAliases(String outputFile,
+ String timeReport,
+ String justTime,
+ boolean tabularOutput,
+ int numLines
+ ) throws java.io.IOException {
checkAnalysisComplete();
BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile) );
- bw.write("Conducting ownership analysis with allocation depth = "+allocationDepth+"\n");
- bw.write(timeReport+"\n");
+ if( !tabularOutput ) {
+ bw.write("Conducting ownership analysis with allocation depth = "+allocationDepth+"\n");
+ bw.write(timeReport+"\n");
+ }
+
+ int numAlias = 0;
// look through every task for potential aliases
Iterator taskItr = state.getTaskSymbolTable().getDescriptorsIterator();
while( taskItr.hasNext() ) {
TaskDescriptor td = (TaskDescriptor) taskItr.next();
- bw.write("\n---------"+td+"--------\n");
+ if( !tabularOutput ) {
+ bw.write("\n---------"+td+"--------\n");
+ }
HashSet<AllocationSite> allocSites = getFlaggedAllocationSitesReachableFromTask(td);
Set<HeapRegionNode> common;
-
+
// for each task parameter, check for aliases with
// other task parameters and every allocation site
// reachable from this task
common = createsPotentialAliases(td, i, j);
if( !common.isEmpty() ) {
foundSomeAlias = true;
- bw.write("Potential alias between parameters "+i+" and "+j+".\n");
- bw.write(prettyPrintNodeSet( common )+"\n" );
+ if( !tabularOutput ) {
+ bw.write("Potential alias between parameters "+i+" and "+j+".\n");
+ bw.write(prettyPrintNodeSet( common )+"\n" );
+ } else {
+ ++numAlias;
+ }
}
}
-
+
// for the ith parameter, check for aliases against
// the set of allocation sites reachable from this
// task context
common = createsPotentialAliases(td, i, as);
if( !common.isEmpty() ) {
foundSomeAlias = true;
- bw.write("Potential alias between parameter "+i+" and "+as.getFlatNew()+".\n");
- bw.write(prettyPrintNodeSet( common )+"\n" );
+ if( !tabularOutput ) {
+ bw.write("Potential alias between parameter "+i+" and "+as.getFlatNew()+".\n");
+ bw.write(prettyPrintNodeSet( common )+"\n" );
+ } else {
+ ++numAlias;
+ }
}
}
}
-
+
// for each allocation site check for aliases with
// other allocation sites in the context of execution
// of this task
if( !outerChecked.contains(as2) ) {
common = createsPotentialAliases(td, as1, as2);
-
+
if( !common.isEmpty() ) {
foundSomeAlias = true;
- bw.write("Potential alias between "+as1.getFlatNew()+" and "+as2.getFlatNew()+".\n");
- bw.write(prettyPrintNodeSet( common )+"\n" );
+ if( !tabularOutput ) {
+ bw.write("Potential alias between "+as1.getFlatNew()+" and "+as2.getFlatNew()+".\n");
+ bw.write(prettyPrintNodeSet( common )+"\n" );
+ } else {
+ ++numAlias;
+ }
}
}
}
}
if( !foundSomeAlias ) {
- bw.write("No aliases between flagged objects in Task "+td+".\n");
+ if( !tabularOutput ) {
+ bw.write("No aliases between flagged objects in Task "+td+".\n");
+ }
}
}
- bw.write( "\n"+computeAliasContextHistogram() );
+ if( !tabularOutput ) {
+ bw.write( "\n"+computeAliasContextHistogram() );
+ } else {
+ bw.write( " & "+numAlias+
+ " & "+justTime+
+ " & "+numLines+
+ " & "+numMethodsAnalyzed()+
+ " \\\\\n" );
+ }
+
bw.close();
}
// this version of writeAllAliases is for Java programs that have no tasks
- public void writeAllAliasesJava(String outputFile, String timeReport) throws java.io.IOException {
+ public void writeAllAliasesJava(String outputFile,
+ String timeReport,
+ String justTime,
+ boolean tabularOutput,
+ int numLines
+ ) throws java.io.IOException {
checkAnalysisComplete();
assert !state.TASK;
double timeEndAnalysis = (double) System.nanoTime();
double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) );
String treport = String.format( "The reachability analysis took %.3f sec.", dt );
+ String justtime = String.format( "%.2f", dt );
System.out.println( treport );
if( writeDOTs && !writeAllDOTs ) {
if( aliasFile != null ) {
if( state.TASK ) {
- writeAllAliases(aliasFile, treport);
+ writeAllAliases(aliasFile, treport, justtime, state.OWNERSHIPALIASTAB, state.lines);
} else {
- writeAllAliasesJava(aliasFile, treport);
+ writeAllAliasesJava(aliasFile, treport, justtime, state.OWNERSHIPALIASTAB, state.lines);
}
}
return s;
}
+
+ private int numMethodsAnalyzed() {
+ return descriptorsToAnalyze.size();
+ }
public class OwnershipGraph {
+ // use to disable improvements for comparison
+ protected static final boolean DISABLE_STRONG_UPDATES = false;
+ protected static final boolean DISABLE_GLOBAL_SWEEP = false;
+
+
private int allocationDepth;
private TypeUtil typeUtil;
(hrnX.isSingleObject() && lnX.getNumReferencees() == 1) // case 2
)
) {
- strongUpdate = true;
- clearReferenceEdgesFrom( hrnX, f.getType(), f.getSymbol(), false );
+ if( !DISABLE_STRONG_UPDATES ) {
+ strongUpdate = true;
+ clearReferenceEdgesFrom( hrnX, f.getType(), f.getSymbol(), false );
+ }
}
}
// if there was a strong update, make sure to improve
// reachability with a global sweep
- if( strongUpdate ) {
- globalSweep();
+ if( strongUpdate ) {
+ if( !DISABLE_GLOBAL_SWEEP ) {
+ globalSweep();
+ }
}
}
if( (hrn.getNumReferencers() == 1) || // case 1
(hrn.isSingleObject() && argLabel_i.getNumReferencees() == 1) // case 2
) {
-
- effectCalleeStrongUpdates( paramIndex, ogCallee, hrn );
+ if( !DISABLE_STRONG_UPDATES ) {
+ effectCalleeStrongUpdates( paramIndex, ogCallee, hrn );
+ }
}
}
}
// improve reachability as much as possible
- globalSweep();
-
+ if( !DISABLE_GLOBAL_SWEEP ) {
+ globalSweep();
+ }
if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
Set<HeapRegionNode> common = new HashSet<HeapRegionNode>();
if( aliasDetected ) {
common = findCommonReachableNodes( hrn1, hrn2 );
- assert !common.isEmpty();
+ if( !(DISABLE_STRONG_UPDATES || DISABLE_GLOBAL_SWEEP) ) {
+ assert !common.isEmpty();
+ }
}
return common;
--- /dev/null
+#!/bin/bash
+
+NAME[0]=Bank
+BDIR[0]=BankApp
+
+NAME[1]=Chat
+BDIR[1]=ChatTag
+
+NAME[2]=Conglomerator
+BDIR[2]=Conglomerator/Tag
+
+NAME[3]=jHTTPp2
+BDIR[3]=Jhttpp2/BR
+
+NAME[4]=MapReduce1
+BDIR[4]=MapReduce/Tag
+
+NAME[5]=MultiGame
+BDIR[5]=MMG/Tag
+
+NAME[6]=Performance
+BDIR[6]=Performance
+
+NAME[7]=PERT
+BDIR[7]=PERT/Tag
+
+NAME[8]=FilterBank
+BDIR[8]=Scheduling/FilterBank
+
+NAME[9]=Fractal
+BDIR[9]=Scheduling/Fractal
+
+NAME[10]=MolDynamics
+BDIR[10]=Scheduling/JGFMolDyn
+
+NAME[11]=MonteCarlo
+BDIR[11]=Scheduling/JGFMonteCarlo
+
+NAME[12]=Series
+BDIR[12]=Scheduling/JGFSeries
+
+NAME[13]=KMeans
+BDIR[13]=Scheduling/KMeans
+
+NAME[14]=MapReduce2
+BDIR[14]=Scheduling/MapReduce
+
+NAME[15]=FluidAnimate
+BDIR[15]=Scheduling/PSFluidAnimate
+
+NAME[16]=Spider1
+BDIR[16]=Spider/BR
+
+NAME[17]=Spider2
+BDIR[17]=Spider/BRTag
+
+NAME[18]=TileSearch
+BDIR[18]=TileSearch/Tag
+
+NAME[19]=TicTacToe
+BDIR[19]=TTTTag
+
+NAME[20]=WebServer1
+BDIR[20]=WebServer
+
+NAME[21]=WebServer2
+BDIR[21]=WebServerTag
+
+NUMBENCHMARKS=22
+
+
+
+###########################
+# No need to modify below!
+###########################
+
+BENCHTOP=~/research/Robust/src/Benchmarks
+BENCHSUM=$BENCHTOP/Ownership
+
+TABFILE=tabResults.tex
+rm -f $TABFILE
+touch $TABFILE
+echo '\begin{tabular}{|l|l|r|r|r|}' >> $TABFILE
+echo '\hline' >> $TABFILE
+echo 'Benchmark & Sharing & Time (s) & Lines & Methods \\' >> $TABFILE
+echo '\hline' >> $TABFILE
+
+i="0"
+while [ $i -lt $NUMBENCHMARKS ]; do
+ cd $BENCHTOP/${BDIR[$i]}
+ # unfortunately this echo adds an unwanted newline
+ echo ${NAME[$i]} >> $BENCHSUM/$TABFILE
+ make -f $BENCHSUM/makefile
+ cat aliases.txt >> $BENCHSUM/$TABFILE
+ make -f $BENCHSUM/makefile clean
+ i=$[$i+1]
+done
+
+cd $BENCHSUM
+
+echo '\hline' >> $TABFILE
+echo '\end{tabular}' >> $TABFILE
+
+# remove unwanted newlines from file so latex doesn't barf
+sed '
+/$/ {
+# append the next line
+ N
+# look for multi-line pattern
+ /\n \&/ {
+# delete everything between
+ s/\n \&/ \&/
+# print
+ P
+# then delete the first line
+ D
+ }
+}' <$TABFILE >$TABFILE.temp
+mv $TABFILE.temp $TABFILE
BUILDSCRIPT=~/research/Robust/src/buildscript
-BSFLAGS= -recover -justanalyze -ownership -ownaliasfile aliases.txt -enable-assertions -ownwritedots final #-flatirtasks
+BSFLAGS= -recover -justanalyze -ownership -ownaliasfiletab aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks
AD1= -ownallocdepth 1
AD3= -ownallocdepth 3
AD5= -ownallocdepth 5
rm -f *~
rm -f *.dot
rm -f *.png
+ rm -f *.aux
+ rm -f *.log
+ rm -f *.pdf
rm -f aliases.txt
All versions run with $k=1$ on dw-8.
+Average of 64.4 methods per benchmark.
-\section{Normal}
-\begin{tabular}{|l|l|r|r|}
-\hline
-Benchmark & Sharing & Time (s) & Lines & Methods \\
-\hline
-Bank & 0 & 6.87 & 1,825 & \\
-Chat & 3 & 6.45 & 1,510 & \\
-Conglomerator & 0 & 4.55 & 1,979 & \\
-MapReduce(1) & 2 & 11.83 & 2,274 & \\
-Performance & 0 & 2.10 & 1,760 & \\
-PERT & 0 & 2.77 & 1,950 & \\
-MapReduce(Sc) & 3 & 17.12 & 2,218 & \\
-Spider(1) & 0 & 7.66 & 1,593 & \\
-Spider(2) & 0 & 6.90 & 1,597 & \\
-TileSearch & 0 & 9.47 & 2,050 & \\
-TicTacToe & 0 & 3.80 & 1,532 & \\
-WebServer(1) & 0 & 9.28 & 1,856 & \\
-WebServer(2) & 0 & 8.27 & 1,855 & \\
-\hline
-jHTTPp2 & 0 & 6.73 & 2,583 & \\
-FluidAnimate & 2 & 368.61 & 3,587 & \\
-FilterBank & 0 & 1.83 & 1,321 & \\
-KMeans & 2 & 5.60 & 2,659 & \\
-MonteCarlo & 0 & 3.69 & 3,542 & \\
-Moldyn & 2 & 6.03 & 1,902 & \\
-Series & 0 & 1.99 & 1,405 & \\
-MultiGame & 10 & 25.57 & 3,003 & \\
-Fractal & 1 & 2.13 & 1,334 & \\
+
+\section{Alias Context Histogram}
+Histogram of alias contexts per method over all programs analyzed.
+
+\begin{tabular}{|r|r|r|}
+\hline
+num unique alias contexts & num methods \\
+\hline
+1 & 1324 \\
+2 & 37 \\
+3 & 16 \\
+4 & 6 \\
+5 & 11 \\
+6 & 0 \\
+7 & 1 \\
\hline
\end{tabular}
-Histogram of alias contexts per method over all programs analyzed.
+
+\section{All Improvement On}
+\begin{tabular}{|l|l|r|r|r|}
+\hline
+Benchmark & Sharing & Time (s) & Lines & Methods \\
+\hline
+Bank & 0 & 3.49 & 1825 & 67 \\
+Chat & 3 & 3.58 & 1510 & 71 \\
+Conglomerator & 0 & 3.11 & 1979 & 93 \\
+jHTTPp2 & 0 & 5.57 & 2583 & 122 \\
+MapReduce1 & 2 & 10.43 & 2274 & 114 \\
+MultiGame & 10 & 35.11 & 3003 & 46 \\
+Performance & 0 & 1.43 & 1760 & 30 \\
+PERT & 0 & 2.16 & 1950 & 61 \\
+FilterBank & 0 & 0.79 & 1321 & 9 \\
+Fractal & 1 & 0.68 & 1334 & 8 \\
+MolDynamics & 2 & 8.29 & 1902 & 31 \\
+MonteCarlo & 0 & 2.07 & 3542 & 49 \\
+Series & 0 & 0.77 & 1405 & 10 \\
+KMeans & 2 & 2.92 & 2659 & 45 \\
+MapReduce2 & 3 & 11.35 & 2218 & 95 \\
+FluidAnimate & 2 & 312.60 & 3587 & 82 \\
+Spider1 & 0 & 5.09 & 1593 & 80 \\
+Spider2 & 0 & 4.77 & 1597 & 83 \\
+TileSearch & 0 & 7.10 & 2050 & 34 \\
+TicTacToe & 0 & 2.31 & 1532 & 68 \\
+WebServer1 & 0 & 5.38 & 1856 & 97 \\
+WebServer2 & 0 & 6.62 & 1855 & 100 \\
+\hline
+\end{tabular}
+
-\begin{tabular}{|r|r|}
+
+
+\section{Strong Updates Off}
+\begin{tabular}{|l|l|r|r|r|}
\hline
-# unique alias contexts & counting(not important) & # methods \\
+Benchmark & Sharing & Time (s) & Lines & Methods \\
\hline
-1 & 65+66+91+115+109+44+28+59+9+8+30+49+10+42+88+73+76+79+28+66+93+96 & \\
-2 & 4+2+2+2+1+1+3+4+5+3+3+5+1+1 & \\
-3 & 1+1+4+1+1+1+2+1+2+2 & \\
-4 & 1+1+1+1+1+1 & \\
-5 & 1+1+2+1+2+1+1+1+1 & \\
-6 & & \\
-7 & 1 & \\
+Bank & 0 & 3.99 & 1825 & 67 \\
+Chat & 3 & 5.70 & 1510 & 71 \\
+Conglomerator & 0 & 3.11 & 1979 & 93 \\
+jHTTPp2 & 0 & 4.89 & 2583 & 122 \\
+MapReduce1 & 2 & 12.48 & 2274 & 114 \\
+MultiGame & 10 & 35.61 & 3003 & 46 \\
+Performance & 0 & 1.30 & 1760 & 30 \\
+PERT & 0 & 1.60 & 1950 & 61 \\
+FilterBank & 0 & 0.83 & 1321 & 9 \\
+Fractal & 1 & 0.61 & 1334 & 8 \\
+MolDynamics & 2 & 5.85 & 1902 & 31 \\
+MonteCarlo & 0 & 2.24 & 3542 & 49 \\
+Series & 0 & 0.86 & 1405 & 10 \\
+KMeans & 2 & 2.90 & 2659 & 45 \\
+MapReduce2 & 3 & 10.62 & 2218 & 95 \\
+FluidAnimate & 2 & 461.38 & 3587 & 82 \\
+Spider1 & 0 & 6.03 & 1593 & 80 \\
+Spider2 & 0 & 5.26 & 1597 & 83 \\
+TileSearch & 0 & 5.51 & 2050 & 34 \\
+TicTacToe & 0 & 2.12 & 1532 & 68 \\
+WebServer1 & 0 & 7.87 & 1856 & 97 \\
+WebServer2 & 0 & 6.23 & 1855 & 100 \\
\hline
\end{tabular}
+\section{Global Sweep Off}
+\begin{tabular}{|l|l|r|r|r|}
+\hline
+Benchmark & Sharing & Time (s) & Lines & Methods \\
+\hline
+Bank & 0 & 2.86 & 1825 & 67 \\
+Chat & 3 & 3.69 & 1510 & 71 \\
+Conglomerator & 0 & 2.61 & 1979 & 93 \\
+jHTTPp2 & 0 & 4.95 & 2583 & 122 \\
+MapReduce1 & 2 & 12.04 & 2274 & 114 \\
+MultiGame & 10 & 51.11 & 3003 & 46 \\
+Performance & 0 & 0.94 & 1760 & 30 \\
+PERT & 0 & 1.81 & 1950 & 61 \\
+FilterBank & 0 & 0.68 & 1321 & 9 \\
+Fractal & 1 & 0.57 & 1334 & 8 \\
+MolDynamics & 2 & 6.06 & 1902 & 31 \\
+MonteCarlo & 0 & 2.02 & 3542 & 49 \\
+Series & 0 & 0.61 & 1405 & 10 \\
+KMeans & 2 & 3.08 & 2659 & 45 \\
+MapReduce2 & 3 & 26.79 & 2218 & 95 \\
+FluidAnimate & 2 & 562.32 & 3587 & 82 \\
+Spider1 & 0 & 4.14 & 1593 & 80 \\
+Spider2 & 0 & 4.15 & 1597 & 83 \\
+TileSearch & 0 & 6.63 & 2050 & 34 \\
+TicTacToe & 0 & 1.77 & 1532 & 68 \\
+WebServer1 & 0 & 4.57 & 1856 & 97 \\
+WebServer2 & 0 & 5.27 & 1855 & 100 \\
+\hline
+\end{tabular}
+
+
+
+\section{Strong Updates AND Global Sweep Off}
+\begin{tabular}{|l|l|r|r|r|}
+\hline
+Benchmark & Sharing & Time (s) & Lines & Methods \\
+\hline
+Bank & 0 & 3.28 & 1825 & 67 \\
+Chat & 3 & 4.22 & 1510 & 71 \\
+Conglomerator & 0 & 2.44 & 1979 & 93 \\
+jHTTPp2 & 0 & 4.74 & 2583 & 122 \\
+MapReduce1 & 2 & 10.88 & 2274 & 114 \\
+MultiGame & 10 & 41.70 & 3003 & 46 \\
+Performance & 0 & 1.14 & 1760 & 30 \\
+PERT & 0 & 1.71 & 1950 & 61 \\
+FilterBank & 0 & 0.71 & 1321 & 9 \\
+Fractal & 1 & 0.65 & 1334 & 8 \\
+MolDynamics & 2 & 6.24 & 1902 & 31 \\
+MonteCarlo & 0 & 2.16 & 3542 & 49 \\
+Series & 0 & 0.62 & 1405 & 10 \\
+KMeans & 2 & 3.12 & 2659 & 45 \\
+MapReduce2 & 3 & 24.33 & 2218 & 95 \\
+FluidAnimate & 2 & 509.12 & 3587 & 82 \\
+Spider1 & 0 & 4.02 & 1593 & 80 \\
+Spider2 & 0 & 4.21 & 1597 & 83 \\
+TileSearch & 0 & 6.40 & 2050 & 34 \\
+TicTacToe & 0 & 1.84 & 1532 & 68 \\
+WebServer1 & 0 & 6.06 & 1856 & 97 \\
+WebServer2 & 0 & 5.68 & 1855 & 100 \\
+\hline
+\end{tabular}
+
+
+
\end{document}
public boolean OWNERSHIPWRITEDOTS=false;
public boolean OWNERSHIPWRITEALL=false;
public String OWNERSHIPALIASFILE=null;
+ public boolean OWNERSHIPALIASTAB=false;
public boolean OPTIONAL=false;
public boolean ARRAYBOUNDARYCHECK=true;
public boolean RAW=false;
if (args[++i].equals("all")) {
state.OWNERSHIPWRITEALL=true;
}
- } else if (option.equals("-ownaliasfile"))
+ } else if (option.equals("-ownaliasfile")) {
state.OWNERSHIPALIASFILE=args[++i];
+ } else if (option.equals("-ownaliasfiletab")) {
+ state.OWNERSHIPALIASFILE=args[++i];
+ state.OWNERSHIPALIASTAB=true;
+ }
else if (option.equals("-optional"))
state.OPTIONAL=true;
else if (option.equals("-optimize"))
--- /dev/null
+PROGRAM=test
+
+SOURCE_FILES=$(PROGRAM).java
+
+BUILDSCRIPT=~/research/Robust/src/buildscript
+BSFLAGS= -recover -justanalyze -ownership -ownallocdepth 1 -ownwritedots final -ownaliasfile aliases.txt -enable-assertions
+
+all: $(PROGRAM).bin
+
+view: PNGs
+ eog *.png &
+
+PNGs: DOTs
+ d2p *COMPLETE*.dot
+
+DOTs: $(PROGRAM).bin
+
+$(PROGRAM).bin: $(SOURCE_FILES)
+ $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES)
+
+clean:
+ rm -f $(PROGRAM).bin
+ rm -fr tmpbuilddirectory
+ rm -f *~
+ rm -f *.dot
+ rm -f *.png
+ rm -f aliases.txt
--- /dev/null
+
+public class Parameter {
+ flag w;
+ int a;
+ int b;
+ Foo f;
+ Foo g;
+ Parameter p;
+ Parameter q;
+ public Parameter() {}
+}
+
+public class Foo {
+ Foo f;
+ Foo g;
+ Parameter p;
+ Parameter q;
+ public Foo() {}
+ void noFlaggedAlias() {
+ this.f.p = new Parameter();
+ }
+}
+
+task Startup( StartupObject s{ initialstate } ) {
+ Parameter p0 = new Parameter();
+ taskexit( s{ !initialstate } );
+}
+
+task noAliasAlways( Parameter p0{ w }, Parameter p1{ !w } ) {
+ p0.f = new Foo();
+ p1.g = new Foo();
+ taskexit( p0{ !w }, p1{ w } );
+}
+
+task noAliasWithStrong( Parameter p0{ w }, Parameter p1{ !w } ) {
+ p0.f = new Foo();
+ p1.g = p0.f;
+ p1.g = new Foo();
+ taskexit( p0{ !w }, p1{ w } );
+}
+
+task noAliasWithGlobal( Parameter p0{ w }, Parameter p1{ !w } ) {
+ Foo f0 = new Foo();
+ f0.f = new Foo();
+
+ f0.p = p0;
+ f0.f.p = p1;
+
+ f0.noFlaggedAlias();
+
+ taskexit( p0{ !w }, p1{ w } );
+}
+
+task noAliasWithGlobalAndStrong( Parameter p0{ w }, Parameter p1{ !w } ) {
+ p0.f = new Foo();
+ p0.f.f = new Foo();
+ p0.f.f.p = new Parameter();
+
+ p1.f = p0.f;
+ p1.f.f.p = new Parameter();
+
+ p0.f.f = null;
+ p0.f = null;
+
+ taskexit( p0{ !w }, p1{ w } );
+}