From 3f6d80604ec59942784e6a4c5cdfface39db85e7 Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 14 Oct 2009 15:09:54 +0000 Subject: [PATCH] investigating OOPSLA benchmarks further --- Robust/src/Benchmarks/mlp/directto/README.txt | 3 ++ .../Benchmarks/mlp/directto/mlp-java/D2.java | 40 +++++++------------ .../mlp/directto/mlp-java/MessageList.java | 5 ++- .../mappingWeakness/makefile | 27 +++++++++++++ .../mappingWeakness/test.java | 10 +++++ 5 files changed, 58 insertions(+), 27 deletions(-) create mode 100644 Robust/src/Benchmarks/mlp/directto/README.txt create mode 100644 Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/makefile create mode 100644 Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/test.java diff --git a/Robust/src/Benchmarks/mlp/directto/README.txt b/Robust/src/Benchmarks/mlp/directto/README.txt new file mode 100644 index 00000000..3bc08bec --- /dev/null +++ b/Robust/src/Benchmarks/mlp/directto/README.txt @@ -0,0 +1,3 @@ +The DirectTo benchmark reads in a text file to build a list of +messages for tracking and routing aircraft without conflicts. + diff --git a/Robust/src/Benchmarks/mlp/directto/mlp-java/D2.java b/Robust/src/Benchmarks/mlp/directto/mlp-java/D2.java index 874a1d18..477e9d34 100755 --- a/Robust/src/Benchmarks/mlp/directto/mlp-java/D2.java +++ b/Robust/src/Benchmarks/mlp/directto/mlp-java/D2.java @@ -5,23 +5,24 @@ //import java.io.*; public class D2 { - public ReadWrite rw; - private Static singletonStatic ; public Static getStatic () { return singletonStatic ; } - private AircraftList singletonAircraftList ; public AircraftList getAircraftList () { return singletonAircraftList ; } - private Algorithm singletonAlgorithm ; public Algorithm getAlgorithm () { return singletonAlgorithm ; } - private FixList singletonFixList ; public FixList getFixList () { return singletonFixList ; } - private Flight singletonFlight ; public Flight getFlight () { return singletonFlight ; } - private FlightList singletonFlightList ; public FlightList getFlightList () { return singletonFlightList ; } - private MessageList singletonMessageList ; public MessageList getMessageList () { return singletonMessageList ; } - private TrajectorySynthesizer singletonTrajectorySynthesizer; public TrajectorySynthesizer getTrajectorySynthesizer() { return singletonTrajectorySynthesizer; } + public ReadWrite singletonReadWrite ; public ReadWrite getReadWrite () { return singletonReadWrite ; } + public Static singletonStatic ; public Static getStatic () { return singletonStatic ; } + public AircraftList singletonAircraftList ; public AircraftList getAircraftList () { return singletonAircraftList ; } + public Algorithm singletonAlgorithm ; public Algorithm getAlgorithm () { return singletonAlgorithm ; } + public FixList singletonFixList ; public FixList getFixList () { return singletonFixList ; } + public Flight singletonFlight ; public Flight getFlight () { return singletonFlight ; } + public FlightList singletonFlightList ; public FlightList getFlightList () { return singletonFlightList ; } + public MessageList singletonMessageList ; public MessageList getMessageList () { return singletonMessageList ; } + public TrajectorySynthesizer singletonTrajectorySynthesizer; public TrajectorySynthesizer getTrajectorySynthesizer() { return singletonTrajectorySynthesizer; } public D2() { + singletonReadWrite = new ReadWrite (); singletonStatic = new Static (); singletonAircraftList = new AircraftList (); singletonFixList = new FixList (); singletonAlgorithm = new Algorithm (); - singletonFlight = new Flight ( "" ); + singletonFlight = new Flight (""); singletonFlightList = new FlightList (); singletonMessageList = new MessageList (); singletonTrajectorySynthesizer = new TrajectorySynthesizer(); @@ -31,28 +32,17 @@ public class D2 { System.out.println("D2 - Application started"); D2 d2 = new D2(); - - d2.rw=new ReadWrite(); - d2.rw.read(d2); + d2.getReadWrite().read(d2); - d2.getMessageList().executeAll(d2); - int count = 0; while( d2.getFlightList().anyPlanesAlive() ) { d2.getAlgorithm().doIteration(d2); - - count++; - if( count % 10000 == 0 ) { - //System.out.println( "iteration "+count ); - } - - if( count == 1000 ) { - break; - } } - d2.rw.write(d2); + d2.getReadWrite().write(d2); + + System.out.println("D2 - Application finished"); } } diff --git a/Robust/src/Benchmarks/mlp/directto/mlp-java/MessageList.java b/Robust/src/Benchmarks/mlp/directto/mlp-java/MessageList.java index c91db3bb..2f268cb4 100755 --- a/Robust/src/Benchmarks/mlp/directto/mlp-java/MessageList.java +++ b/Robust/src/Benchmarks/mlp/directto/mlp-java/MessageList.java @@ -10,12 +10,13 @@ public class MessageList { public Message data() { Message m = (Message) messages.elementAt(0); - messages.removeElementAt(0); return m; } public Message next() { - return data(); + Message m = (Message) messages.elementAt(0); + messages.removeElementAt(0); + return m; } public boolean hasNext() { diff --git a/Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/makefile b/Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/makefile new file mode 100644 index 00000000..fdfcf351 --- /dev/null +++ b/Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/makefile @@ -0,0 +1,27 @@ +PROGRAM=test + +SOURCE_FILES=$(PROGRAM).java + +BUILDSCRIPT=~/research/Robust/src/buildscript +BSFLAGS= -mainclass Test -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 diff --git a/Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/test.java b/Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/test.java new file mode 100644 index 00000000..b5d6ffa0 --- /dev/null +++ b/Robust/src/Tests/OwnershipAnalysisTest/mappingWeakness/test.java @@ -0,0 +1,10 @@ +public class Test { + static public void main( String[] args ) { + int n = 10; + Vector v1 = new Vector( n ); + for( int i = 0; i < n; ++i ) { + Vector v1prime = disjoint v1p new Vector( n ); + v1.setElementAt( v1prime, i ); + } + } +} -- 2.34.1