- /*
- // look through every task for potential aliases
- Iterator taskItr = state.getTaskSymbolTable().getDescriptorsIterator();
- while( taskItr.hasNext() ) {
- TaskDescriptor td = (TaskDescriptor) taskItr.next();
-
- HashSet<AllocationSite> allocSites = getFlaggedAllocationSitesReachableFromTask( td );
-
- // for each task parameter, check for aliases with
- // other task parameters and every allocation site
- // reachable from this task
- FlatMethod fm = state.getMethodFlat( td );
- for( int i = 0; i < fm.numParameters(); ++i ) {
-
- // for the ith parameter check for aliases to all
- // higher numbered parameters
- for( int j = i + 1; j < fm.numParameters(); ++j ) {
- if( createsPotentialAliases( td, i, j ) ) {
- bw.write( "Task "+td+" potentially aliases parameters "+i+" and "+j+".\n" );
- }
- }
-
- // for the ith parameter, check for aliases against
- // the set of allocation sites reachable from this
- // task context
- Iterator allocItr = allocSites.iterator();
- while( allocItr.hasNext() ) {
- AllocationSite as = (AllocationSite) allocItr.next();
- if( createsPotentialAliases( td, i, as ) ) {
- bw.write( "Task "+td+" potentially aliases parameter "+i+" and "+as+".\n" );
- }
- }
- }
-
- // for each allocation site check for aliases with
- // other allocation sites in the context of execution
- // of this task
- Iterator allocItr = allocSites.iterator();
- while( allocItr.hasNext() ) {
- AllocationSite as = (AllocationSite) allocItr.next();
- if( createsPotentialAliases( td, as, allocSites ) ) {
- bw.write( "Task "+td+" potentially aliases "+as+" and the rest of the set.\n" );
- }
- }
- }
-
- bw.close();
- */
+
+ bw.write("Conducting ownership analysis with allocation depth = "+allocationDepth);
+
+ // 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");
+
+ HashSet<AllocationSite> allocSites = getFlaggedAllocationSitesReachableFromTask(td);
+
+ // for each task parameter, check for aliases with
+ // other task parameters and every allocation site
+ // reachable from this task
+ boolean foundSomeAlias = false;
+
+ FlatMethod fm = state.getMethodFlat(td);
+ for( int i = 0; i < fm.numParameters(); ++i ) {
+
+ // for the ith parameter check for aliases to all
+ // higher numbered parameters
+ for( int j = i + 1; j < fm.numParameters(); ++j ) {
+ if( createsPotentialAliases(td, i, j) ) {
+ foundSomeAlias = true;
+ bw.write("Potential alias between parameters "+i+" and "+j+".\n");
+ }
+ }
+
+ // for the ith parameter, check for aliases against
+ // the set of allocation sites reachable from this
+ // task context
+ Iterator allocItr = allocSites.iterator();
+ while( allocItr.hasNext() ) {
+ AllocationSite as = (AllocationSite) allocItr.next();
+ if( createsPotentialAliases(td, i, as) ) {
+ foundSomeAlias = true;
+ bw.write("Potential alias between parameter "+i+" and "+as.getFlatNew()+".\n");
+ }
+ }
+ }
+
+ // for each allocation site check for aliases with
+ // other allocation sites in the context of execution
+ // of this task
+ HashSet<AllocationSite> outerChecked = new HashSet<AllocationSite>();
+ Iterator allocItr1 = allocSites.iterator();
+ while( allocItr1.hasNext() ) {
+ AllocationSite as1 = (AllocationSite) allocItr1.next();
+
+ Iterator allocItr2 = allocSites.iterator();
+ while( allocItr2.hasNext() ) {
+ AllocationSite as2 = (AllocationSite) allocItr2.next();
+
+ if( !outerChecked.contains(as2) &&
+ createsPotentialAliases(td, as1, as2) ) {
+ foundSomeAlias = true;
+ bw.write("Potential alias between "+as1.getFlatNew()+" and "+as2.getFlatNew()+".\n");
+ }
+ }
+
+ outerChecked.add(as1);
+ }
+
+ if( !foundSomeAlias ) {
+ bw.write("No aliases between flagged objects in Task "+td+".\n");
+ }
+ }
+
+ bw.close();