From 67ef1ea3ed5008d5a0cca75dd18d8b99fa4169e3 Mon Sep 17 00:00:00 2001 From: yeom Date: Wed, 18 Nov 2009 19:45:57 +0000 Subject: [PATCH] reflect changes of allocation site and heap region identifier. --- Robust/src/Analysis/MLP/MLPAnalysis.java | 75 +++++++++++++------ Robust/src/Analysis/MLP/SESEEffectsKey.java | 8 +- .../OwnershipAnalysis/EffectsKey.java | 8 +- .../OwnershipAnalysis/MethodEffects.java | 24 ++++-- Robust/src/IR/Flat/FlatSESEEnterNode.java | 11 +-- 5 files changed, 91 insertions(+), 35 deletions(-) diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 37fe8dea..768685e3 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -211,9 +211,18 @@ public class MLPAnalysis { // Parent/child memory conflicts analysis seseConflictsForward(javaCallGraph); + Set keySet=mapMethodContextToLiveInAllocationSiteSet.keySet(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { + MethodContext methodContext = (MethodContext) iterator.next(); + HashSet asSet=mapMethodContextToLiveInAllocationSiteSet.get(methodContext); + for (Iterator iterator2 = asSet.iterator(); iterator2.hasNext();) { + AllocationSite allocationSite = (AllocationSite) iterator2.next(); + } + } + // disjoint analysis with a set of flagged allocation sites of live-in variables & stall sites try { - OwnershipAnalysis oa2 = new OwnershipAnalysis(state, + ownAnalysisForSESEConflicts = new OwnershipAnalysis(state, tu, callGraph, ownAnalysis.liveness, @@ -1074,7 +1083,7 @@ public class MLPAnalysis { FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; assert fsen.equals(currentSESE); - + if (!fsen.getIsCallerSESEplaceholder()) { // uniquely taint each live-in variable Set set = fsen.getInVarSet(); @@ -1118,7 +1127,7 @@ public class MLPAnalysis { case FKind.FlatSESEExitNode: { FlatSESEExitNode fsexit = (FlatSESEExitNode) fn; - + if (!fsexit.getFlatEnter().getIsCallerSESEplaceholder()) { FlatSESEEnterNode enterNode = fsexit.getFlatEnter(); @@ -1147,7 +1156,8 @@ public class MLPAnalysis { .next(); parentEffectsSet.add(new SESEEffectsKey(seseKey .getFieldDescriptor(), seseKey - .getTypeDescriptor(), seseKey.getHRNId())); + .getTypeDescriptor(), seseKey.getHRNId(), + seseKey.getHRNUniqueId())); } parentReadTable.put(td, parentEffectsSet); @@ -1174,7 +1184,8 @@ public class MLPAnalysis { .next(); parentEffectsSet.add(new SESEEffectsKey(seseKey .getFieldDescriptor(), seseKey - .getTypeDescriptor(), seseKey.getHRNId())); + .getTypeDescriptor(), seseKey.getHRNId(), + seseKey.getHRNUniqueId())); } parentWriteTable.put(td, parentEffectsSet); @@ -1202,7 +1213,8 @@ public class MLPAnalysis { .next(); parentEffectsSet.add(new SESEEffectsKey(seseKey .getFieldDescriptor(), seseKey - .getTypeDescriptor(), seseKey.getHRNId())); + .getTypeDescriptor(), seseKey.getHRNId(), + seseKey.getHRNUniqueId())); } parentstrongUpdateTable.put(td, parentEffectsSet); @@ -1244,9 +1256,14 @@ public class MLPAnalysis { .next(); if (field.getSymbol().equals( referenceEdge.getField())) { - currentSESE.readEffects(affectedTD, field - .getSymbol(), src.getType(), - referenceEdge.getDst().getID()); + + HeapRegionNode refHRN = og.id2hrn + .get(referenceEdge.getDst().getID()); + + currentSESE + .readEffects(affectedTD, field + .getSymbol(), + src.getType(), refHRN); } } @@ -1281,8 +1298,7 @@ public class MLPAnalysis { TempDescriptor tempDescriptor = (TempDescriptor) referSetIter .next(); currentSESE.readEffects(tempDescriptor, field - .getSymbol(), src.getType(), accessHRN - .getID()); + .getSymbol(), src.getType(), accessHRN); } // } } @@ -1304,8 +1320,7 @@ public class MLPAnalysis { while (hrnIter.hasNext()) { HeapRegionNode hrn = hrnIter.next(); currentSESE.readEffects(affectedTD, field - .getSymbol(), src.getType(), hrn - .getID()); + .getSymbol(), src.getType(), hrn); } } @@ -1372,10 +1387,13 @@ public class MLPAnalysis { .next(); if (field.getSymbol().equals( referenceEdge.getField())) { + + HeapRegionNode refHRN = og.id2hrn + .get(referenceEdge.getDst().getID()); + currentSESE.writeEffects(affectedTD, field .getSymbol(), dst.getType(), - referenceEdge.getDst().getID(), - strongUpdate); + refHRN, strongUpdate); } } @@ -1409,8 +1427,8 @@ public class MLPAnalysis { TempDescriptor tempDescriptor = (TempDescriptor) referSetIter .next(); currentSESE.writeEffects(tempDescriptor, field - .getSymbol(), dst.getType(), accessHRN - .getID(), strongUpdate); + .getSymbol(), dst.getType(), accessHRN, + strongUpdate); } // } } @@ -1430,8 +1448,8 @@ public class MLPAnalysis { while (hrnIter.hasNext()) { HeapRegionNode hrn = hrnIter.next(); currentSESE.writeEffects(affectedTD, field - .getSymbol(), dst.getType(), hrn - .getID(), strongUpdate); + .getSymbol(), dst.getType(), hrn, + strongUpdate); } @@ -1503,9 +1521,13 @@ public class MLPAnalysis { while (hrnIter.hasNext()) { Integer hrnID = (Integer) hrnIter .next(); + + HeapRegionNode refHRN = og.id2hrn + .get(hrnID); + currentSESE.readEffects(affectedTD, key .getFieldDescriptor(), key - .getTypeDescriptor(), hrnID); + .getTypeDescriptor(), refHRN); } } } @@ -1524,10 +1546,14 @@ public class MLPAnalysis { while (hrnIter.hasNext()) { Integer hrnID = (Integer) hrnIter .next(); + + HeapRegionNode refHRN = og.id2hrn + .get(hrnID); + currentSESE.writeEffects(affectedTD, key.getFieldDescriptor(), key .getTypeDescriptor(), - hrnID, false); + refHRN, false); } } @@ -1547,10 +1573,14 @@ public class MLPAnalysis { while (hrnIter.hasNext()) { Integer hrnID = (Integer) hrnIter .next(); + + HeapRegionNode refHRN = og.id2hrn + .get(hrnID); + currentSESE.writeEffects(affectedTD, key.getFieldDescriptor(), key .getTypeDescriptor(), - hrnID, true); + refHRN, true); } } @@ -1571,6 +1601,7 @@ public class MLPAnalysis { } private void flagAllocationSite(MethodContext mc, AllocationSite ac){ + HashSet set=mapMethodContextToLiveInAllocationSiteSet.get(mc); if(set==null){ set=new HashSet(); diff --git a/Robust/src/Analysis/MLP/SESEEffectsKey.java b/Robust/src/Analysis/MLP/SESEEffectsKey.java index fbb58a24..4c5af54d 100644 --- a/Robust/src/Analysis/MLP/SESEEffectsKey.java +++ b/Robust/src/Analysis/MLP/SESEEffectsKey.java @@ -7,11 +7,13 @@ public class SESEEffectsKey { private String fd; private TypeDescriptor td; private Integer hrnId; + private String hrnUniqueId; - public SESEEffectsKey(String fd, TypeDescriptor td, Integer hrnId) { + public SESEEffectsKey(String fd, TypeDescriptor td, Integer hrnId, String hrnUniqueId) { this.fd = fd; this.td = td; this.hrnId = hrnId; + this.hrnUniqueId=hrnUniqueId; } public String getFieldDescriptor() { @@ -25,6 +27,10 @@ public class SESEEffectsKey { public Integer getHRNId() { return hrnId; } + + public String getHRNUniqueId(){ + return hrnUniqueId; + } public String toString() { return "(" + td + ")" + fd + "#" + hrnId; diff --git a/Robust/src/Analysis/OwnershipAnalysis/EffectsKey.java b/Robust/src/Analysis/OwnershipAnalysis/EffectsKey.java index 39d9c6c1..9a2b97ee 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/EffectsKey.java +++ b/Robust/src/Analysis/OwnershipAnalysis/EffectsKey.java @@ -7,11 +7,13 @@ public class EffectsKey { private String fd; private TypeDescriptor td; private Integer hrnId; + private String hrnUniqueId; - public EffectsKey(String fd, TypeDescriptor td, Integer hrnId) { + public EffectsKey(String fd, TypeDescriptor td, Integer hrnId, String hrnUniqueId) { this.fd = fd; this.td = td; this.hrnId = hrnId; + this.hrnUniqueId=hrnUniqueId; } public String getFieldDescriptor() { @@ -25,6 +27,10 @@ public class EffectsKey { public Integer getHRNId() { return hrnId; } + + public String getHRNUniqueId(){ + return hrnUniqueId; + } public String toString() { return "(" + td + ")" + fd + "#" + hrnId; diff --git a/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java b/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java index cacb40af..e84fc8c6 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java +++ b/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java @@ -40,7 +40,9 @@ public class MethodEffects { while (paramIter.hasNext()) { Integer paramID = paramIter.next(); effectsSet.addReadingVar(paramID, new EffectsKey( - fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID())); + fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier())); +// effectsSet.addReadingVar(paramID, new EffectsKey( +// fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID())); } } @@ -55,7 +57,9 @@ public class MethodEffects { while (paramIter.hasNext()) { Integer paramID = paramIter.next(); effectsSet.addReadingVar(paramID, new EffectsKey( - fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID())); + fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier())); +// effectsSet.addReadingVar(paramID, new EffectsKey( +// fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID())); } } @@ -107,10 +111,14 @@ public class MethodEffects { while (paramIter.hasNext()) { Integer paramID = paramIter.next(); effectsSet.addWritingVar(paramID, new EffectsKey( - fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); + fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier())); +// effectsSet.addWritingVar(paramID, new EffectsKey( +// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); if(strongUpdate){ effectsSet.addStrongUpdateVar(paramID, new EffectsKey( - fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); + fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier())); +// effectsSet.addStrongUpdateVar(paramID, new EffectsKey( +// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); } } @@ -126,10 +134,14 @@ public class MethodEffects { while (paramIter.hasNext()) { Integer paramID = paramIter.next(); effectsSet.addWritingVar(paramID, new EffectsKey( - fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); + fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier())); +// effectsSet.addWritingVar(paramID, new EffectsKey( +// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); if(strongUpdate){ effectsSet.addStrongUpdateVar(paramID, new EffectsKey( - fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); + fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier())); +// effectsSet.addStrongUpdateVar(paramID, new EffectsKey( +// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID())); } } diff --git a/Robust/src/IR/Flat/FlatSESEEnterNode.java b/Robust/src/IR/Flat/FlatSESEEnterNode.java index b2de4d12..2e59a992 100644 --- a/Robust/src/IR/Flat/FlatSESEEnterNode.java +++ b/Robust/src/IR/Flat/FlatSESEEnterNode.java @@ -8,6 +8,7 @@ import Analysis.MLP.SESEEffectsKey; import Analysis.MLP.SESEEffectsSet; import Analysis.MLP.SESEandAgePair; import Analysis.MLP.VariableSourceToken; +import Analysis.OwnershipAnalysis.HeapRegionNode; import IR.ClassDescriptor; import IR.FieldDescriptor; import IR.MethodDescriptor; @@ -337,15 +338,15 @@ public class FlatSESEEnterNode extends FlatNode { return 31*id; } - public void writeEffects(TempDescriptor td, String fd, TypeDescriptor type, Integer hrnId, boolean strongUpdate){ - seseEffectsSet.addWritingVar(td, new SESEEffectsKey(fd, type, hrnId)); + public void writeEffects(TempDescriptor td, String fd, TypeDescriptor type, HeapRegionNode hrn, boolean strongUpdate){ + seseEffectsSet.addWritingVar(td, new SESEEffectsKey(fd, type, hrn.getID(), hrn.getGloballyUniqueIdentifier())); if(strongUpdate){ - seseEffectsSet.addStrongUpdateVar(td, new SESEEffectsKey(fd, type, hrnId)); + seseEffectsSet.addStrongUpdateVar(td, new SESEEffectsKey(fd, type, hrn.getID(), hrn.getGloballyUniqueIdentifier())); } } - public void readEffects(TempDescriptor td, String fd, TypeDescriptor type, Integer hrnId ){ - seseEffectsSet.addReadingVar(td, new SESEEffectsKey(fd, type, hrnId)); + public void readEffects(TempDescriptor td, String fd, TypeDescriptor type, HeapRegionNode hrn ){ + seseEffectsSet.addReadingVar(td, new SESEEffectsKey(fd, type, hrn.getID(), hrn.getGloballyUniqueIdentifier())); } public SESEEffectsSet getSeseEffectsSet(){ -- 2.34.1