From 45cb3deabf11c7dbb99d5a0cf71a799ad9902541 Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 2 Feb 2009 20:54:28 +0000 Subject: [PATCH] disjointness for Java has all planned features --- .../OwnershipAnalysis/AllocationSite.java | 14 +++++++++----- .../OwnershipAnalysis/OwnershipAnalysis.java | 2 +- .../OwnershipAnalysis/OwnershipGraph.java | 6 +++--- Robust/src/IR/Flat/BuildFlat.java | 4 ++-- Robust/src/IR/Flat/FlatNew.java | 18 +++++++++--------- Robust/src/IR/Tree/BuildIR.java | 14 ++++++++++---- Robust/src/IR/Tree/CreateObjectNode.java | 10 +++++----- Robust/src/Parse/java14.cup | 9 +++------ 8 files changed, 42 insertions(+), 35 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java b/Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java index 7829ea11..9ccece7b 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java +++ b/Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java @@ -28,7 +28,7 @@ public class AllocationSite { protected Vector ithOldest; protected Integer summary; protected FlatNew flatNew; - protected boolean forceAnalyze; + protected String disjointId; public static final int AGE_notInThisSite = 100; public static final int AGE_in_I = 101; @@ -41,12 +41,12 @@ public class AllocationSite { public static final int SHADOWAGE_summary = -103; - public AllocationSite(int allocationDepth, FlatNew flatNew, boolean forceAnalyze) { + public AllocationSite(int allocationDepth, FlatNew flatNew, String disjointId) { assert allocationDepth >= 1; this.allocationDepth = allocationDepth; this.flatNew = flatNew; - this.forceAnalyze = forceAnalyze; + this.disjointId = disjointId; ithOldest = new Vector(allocationDepth); id = generateUniqueAllocationSiteID(); @@ -58,8 +58,8 @@ public class AllocationSite { } - public boolean doForceAnalyze() { - return forceAnalyze; + public String getDisjointId() { + return disjointId; } @@ -182,4 +182,8 @@ public class AllocationSite { public String toStringVerbose() { return "allocSite" + id + " "+flatNew.getType().toPrettyString(); } + + public String toStringForDOT() { + return "disjoint "+disjointId+"\\n"+toString()+"\\n"+getType(); + } } diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index d79e9150..cc5b0a55 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -823,7 +823,7 @@ public class OwnershipAnalysis { private AllocationSite getAllocationSiteFromFlatNewPRIVATE(FlatNew fn) { if( !mapFlatNewToAllocationSite.containsKey(fn) ) { - AllocationSite as = new AllocationSite(allocationDepth, fn, fn.isDisjoint()); + AllocationSite as = new AllocationSite(allocationDepth, fn, fn.getDisjointId()); // the newest nodes are single objects for( int i = 0; i < allocationDepth; ++i ) { diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 610ba4a6..11a94138 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -82,7 +82,7 @@ public class OwnershipGraph { boolean markForAnalysis = isFlagged || isParameter; - if( allocSite != null && allocSite.doForceAnalyze() ) { + if( allocSite != null && allocSite.getDisjointId() != null ) { markForAnalysis = true; } @@ -868,7 +868,7 @@ public class OwnershipGraph { false, as, null, - as + "\\n" + as.getType() + "\\nsummary"); + as.toStringForDOT() + "\\nsummary"); for( int i = 0; i < as.getAllocationDepth(); ++i ) { Integer idIth = as.getIthOldest(i); @@ -880,7 +880,7 @@ public class OwnershipGraph { false, as, null, - as + "\\n" + as.getType() + "\\n" + i + " oldest"); + as.toStringForDOT() + "\\n" + i + " oldest"); } } diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java index 7b4edf85..9eec4e65 100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ b/Robust/src/IR/Flat/BuildFlat.java @@ -212,7 +212,7 @@ public class BuildFlat { private NodePair flattenCreateObjectNode(CreateObjectNode con,TempDescriptor out_temp) { TypeDescriptor td=con.getType(); if (!td.isArray()) { - FlatNew fn=new FlatNew(td, out_temp, con.isGlobal(), con.isDisjoint()); + FlatNew fn=new FlatNew(td, out_temp, con.isGlobal(), con.getDisjointId()); TempDescriptor[] temps=new TempDescriptor[con.numArgs()]; FlatNode last=fn; // Build arguments @@ -271,7 +271,7 @@ public class BuildFlat { out_temp : TempDescriptor.tempFactory("arg",en.getType()); } - FlatNew fn=new FlatNew(td, out_temp, temps[0], con.isGlobal(), con.isDisjoint()); + FlatNew fn=new FlatNew(td, out_temp, temps[0], con.isGlobal(), con.getDisjointId()); last.addNext(fn); if (temps.length>1) { NodePair np=generateNewArrayLoop(temps, td.dereference(), out_temp, 0, con.isGlobal()); diff --git a/Robust/src/IR/Flat/FlatNew.java b/Robust/src/IR/Flat/FlatNew.java index 03f2892d..50616075 100644 --- a/Robust/src/IR/Flat/FlatNew.java +++ b/Robust/src/IR/Flat/FlatNew.java @@ -6,22 +6,22 @@ public class FlatNew extends FlatNode { TypeDescriptor type; TempDescriptor size; boolean isglobal; - boolean isdisjoint; + String disjointId; public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) { this.type=type; this.dst=dst; this.size=null; this.isglobal=isglobal; - this.isdisjoint=false; + this.disjointId=null; } - public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal, boolean isdisjoint) { + public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal, String disjointId) { this.type=type; this.dst=dst; this.size=null; this.isglobal=isglobal; - this.isdisjoint=isdisjoint; + this.disjointId=disjointId; } public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) { @@ -29,23 +29,23 @@ public class FlatNew extends FlatNode { this.dst=dst; this.size=size; this.isglobal=isglobal; - this.isdisjoint=false; + this.disjointId=null; } - public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal, boolean isdisjoint) { + public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal, String disjointId) { this.type=type; this.dst=dst; this.size=size; this.isglobal=isglobal; - this.isdisjoint=isdisjoint; + this.disjointId=disjointId; } public boolean isGlobal() { return isglobal; } - public boolean isDisjoint() { - return isdisjoint; + public String getDisjointId() { + return disjointId; } public String toString() { diff --git a/Robust/src/IR/Tree/BuildIR.java b/Robust/src/IR/Tree/BuildIR.java index 342fd897..8e70258c 100644 --- a/Robust/src/IR/Tree/BuildIR.java +++ b/Robust/src/IR/Tree/BuildIR.java @@ -398,8 +398,11 @@ public class BuildIR { TypeDescriptor td=parseTypeDescriptor(pn); Vector args=parseArgumentList(pn); boolean isglobal=pn.getChild("global")!=null; - boolean isdisjoint=pn.getChild("disjoint")!=null; - CreateObjectNode con=new CreateObjectNode(td, isglobal, isdisjoint); + String disjointId=null; + if( pn.getChild("disjoint") != null) { + disjointId = pn.getChild("disjoint").getTerminal(); + } + CreateObjectNode con=new CreateObjectNode(td, isglobal, disjointId); for(int i=0; i