Set<SESEEffectsKey> readEffectsSetB = nodeB.getReadEffectsSet();
Set<SESEEffectsKey> writeEffectsSetB = nodeB.getWriteEffectsSet();
Set<SESEEffectsKey> strongUpdateSetB = nodeB.getStrongUpdateSet();
+ /*
+ System.out.println("nodeA="+nodeA);
+ System.out.println("readEffectsSetA="+readEffectsSetA);
+ System.out.println("writeEffectsSetA="+writeEffectsSetA);
+ System.out.println("strongUpdateSetA="+strongUpdateSetA);
+ System.out.println("nodeB="+nodeB);
+ System.out.println("readEffectsSetB="+readEffectsSetB);
+ System.out.println("writeEffectsSetB="+writeEffectsSetB);
+ System.out.println("strongUpdateSetB="+strongUpdateSetB);
+ System.out.println("--");
+ */
// if node A has write effects on reading/writing regions of node B
if (writeEffectsSetA != null) {
SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIterA
.next();
- if (!hasStrongUpdate(seseEffectsKey, strongUpdateSetA)) {
+// if (!hasStrongUpdate(seseEffectsKey, strongUpdateSetA)) {
String writeHeapRegionID = seseEffectsKey.getHRNUniqueId();
String writeFieldName = seseEffectsKey.getFieldDescriptor();
}
}
- }
+// } // end of if(hasStrong)
}
}
SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIterB
.next();
- if (!hasStrongUpdate(seseEffectsKey, strongUpdateSetB)) {
+ //if (!hasStrongUpdate(seseEffectsKey, strongUpdateSetB)) {
String writeHeapRegionID = seseEffectsKey.getHRNUniqueId();
String writeFieldName = seseEffectsKey.getFieldDescriptor();
}
}
}
- }
+ //} // if(hasStrong)
}
}
if (hasStrongUpdate(writeEffect, strongUpdateSet)) {
strongUpdateCount++;
}
+
+ if(writeEffect.isStrong()){
+ return false;
+ }
}
+
if (liveInNode.getWriteEffectsSet().size() == strongUpdateCount) {
return false;
}else{
newElement.setAllocList(allocSet);
newElement.setWaitingID(seseLock.getID());
newElement.setStatus(type);
- waitingElementSet.add(newElement);
+ if(!waitingElementSet.contains(newElement)){
+ waitingElementSet.add(newElement);
+ }else{
+ }
+
+
}
}
}
// allocSiteIDSet.add(hrn.getGloballyUniqueIdentifier());
if (hrn.getAllocationSite() != null) {
returnSet.add(new Integer(hrn.getAllocationSite().getID()));
+ }else{
+ returnSet.add(new Integer(hrn.getID()));
}
}
}
FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
assert fsen.equals(currentSESE);
+
+// if(fsen.getParent()!=null && fsen.getParent().getSeseEffectsSet()!=null){
+// Hashtable<TempDescriptor, HashSet<SESEEffectsKey>> strongTable=
+// fsen.getParent().getSeseEffectsSet().getStrongUpdateTable();
+// fsen.getSeseEffectsSet().getStrongUpdateTable().putAll(strongTable);
+// }
+
if (!fsen.getIsCallerSESEplaceholder()) {
// uniquely taint each live-in variable
TempDescriptor src=fon.getLeft();
// if(!currentSESE.getIsCallerSESEplaceholder()){
- if( fon.getOp().getOp() ==Operation.ASSIGN && currentSESE.getInVarSet().contains(src)){
+ if( fon.getOp().getOp() ==Operation.ASSIGN && ( currentSESE.getInVarSet().contains(src) || (currentSESE.getOutVarSet().contains(src)))){
invarMap.put(dest, src);
}
// }
}break;
+ case FKind.FlatNew:{
+ FlatNew fnew=(FlatNew)fn;
+ TempDescriptor dst=fnew.getDst();
+ if(dst.getType().isArray()){
+ currentSESE.getSeseEffectsSet().addStrongUpdateVar(dst, new SESEEffectsKey("", dst.getType(), new Integer(0), ""));
+ }
+
+ }break;
+
case FKind.FlatElementNode:{
FlatElementNode fsen=(FlatElementNode)fn;
if(invarMap.containsKey(dst)){
TempDescriptor invarTD=invarMap.get(dst);
- currentSESE.getSeseEffectsSet().addWritingVar(invarTD, new SESEEffectsKey("", dst.getType(), new Integer(0), ""));
+
+ SESEEffectsSet effectSet=currentSESE.getSeseEffectsSet();
+ ///// if write effects occurs through variable which was strongly updated, ignore it?
+ if(effectSet.getStrongUpdateSet(invarTD)!=null && effectSet.getStrongUpdateSet(invarTD).size()>0){
+ SESEEffectsKey key=new SESEEffectsKey("", dst.getType(), new Integer(0), "");
+ key.setStrong(true);
+ currentSESE.getSeseEffectsSet().addWritingVar(invarTD, key);
+ }else{
+ currentSESE.getSeseEffectsSet().addWritingVar(invarTD, new SESEEffectsKey("", dst.getType(), new Integer(0), ""));
+ }
+ /////
+
}
}break;
MethodEffects me = ownAnalysis.getMethodEffectsAnalysis()
.getMethodEffectsByMethodContext(calleeMC);
+
OwnershipGraph calleeOG = ownAnalysis
.getOwnvershipGraphByMethodContext(calleeMC);
+
FlatMethod fm = state.getMethodFlat(fc.getMethod());
ParameterDecomposition decomp = new ParameterDecomposition(
ownAnalysis, fc, fm, calleeMC, calleeOG, og);
- int base;
+ int base=0;
if (((MethodDescriptor) calleeMC.getDescriptor()).isStatic()) {
base = 0;
} else {
base = 1;
}
- for (int i = 0; i < fc.numArgs(); i++) {
-
- TempDescriptor arg = fc.getArg(i);
- Set<EffectsKey> readSet = me.getEffects().getReadingSet(
- i + base);
- Set<EffectsKey> writeSet = me.getEffects().getWritingSet(
- i + base);
-
- Set<EffectsKey> strongUpdateSet = me.getEffects()
- .getStrongUpdateSet(i + base);
+ for (int i = 0; i < fc.numArgs()+base; i++) {
+
+ TempDescriptor arg ;
+ Set<EffectsKey> readSet;
+ Set<EffectsKey> writeSet;
+ Set<EffectsKey> strongUpdateSet;
+
+ int paramIdx=0;
+
+ boolean isThis=false;
+ if(i==fc.numArgs()){
+ paramIdx=0;
+ arg = fc.getThis();
+ Integer hrnPrimaryID = calleeOG.paramIndex2idPrimary.get(paramIdx);
+ Integer hrnSecondaryID = calleeOG.paramIndex2idSecondary.get(paramIdx);
+ readSet = me.getEffects().getReadingSet(
+ 0);
+ writeSet = me.getEffects().getWritingSet(
+ 0);
+ strongUpdateSet = me.getEffects()
+ .getStrongUpdateSet(0);
+ isThis=true;
+ }else{
+ paramIdx=i + base;
+ arg = fc.getArg(i);
+ readSet = me.getEffects().getReadingSet(
+ i + base);
+ writeSet = me.getEffects().getWritingSet(
+ i + base);
+ strongUpdateSet = me.getEffects()
+ .getStrongUpdateSet(i + base);
+ }
LabelNode argLN = og.td2ln.get(arg);
if (argLN != null) {
while (affectedIter.hasNext()) {
TempDescriptor affectedTD = affectedIter.next();
+ if(isThis){
+ if (currentSESE.getInVarSet().contains(affectedTD)) {
+// Integer hrnPrimaryID = calleeOG.paramIndex2idPrimary.get(paramIdx);
+// Integer hrnSecondaryID = calleeOG.paramIndex2idSecondary.get(paramIdx);
+// System.out.println("primID="+hrnPrimaryID);
+// System.out.println("seconID="+hrnSecondaryID);
+ }
+ }
if (currentSESE.getInVarSet().contains(affectedTD)) {
if (readSet != null) {
while (readIter.hasNext()) {
EffectsKey key = readIter.next();
Set<Integer> hrnSet = getCallerHRNId(
- new Integer(i + base), calleeOG,
+ new Integer(paramIdx), calleeOG,
key.getHRNId(), decomp);
Iterator<Integer> hrnIter = hrnSet
.iterator();
currentSESE.readEffects(affectedTD, key
.getFieldDescriptor(), key
.getTypeDescriptor(), refHRN);
+
}
}
}
EffectsKey key = writeIter.next();
Set<Integer> hrnSet = getCallerHRNId(
- new Integer(i + base), calleeOG,
+ new Integer(paramIdx), calleeOG,
key.getHRNId(), decomp);
Iterator<Integer> hrnIter = hrnSet
.iterator();
EffectsKey key = strongUpdateIter.next();
Set<Integer> hrnSet = getCallerHRNId(
- new Integer(i + base), calleeOG,
+ new Integer(paramIdx), calleeOG,
key.getHRNId(), decomp);
Iterator<Integer> hrnIter = hrnSet
.iterator();
.getOwnvershipGraphByMethodContext(mc);
LabelNode ln = lastOG.td2ln.get(tempDescriptor);
+
Set<HeapRegionNode> hrnSet = new HashSet<HeapRegionNode>();
Iterator<ReferenceEdge> refIter = ln
.iteratorToReferencees();
readEffectsSet, writeEffectsSet, strongUpdateSet, reachabilitySet);
}
+
if(conflictGraph.id2cn.size()>0){
conflictGraphResults.put(seseSummary.getCurrentParent(),conflictGraph);
}
private TypeDescriptor td;
private Integer hrnId;
private String hrnUniqueId;
+ private boolean wStrong=false;
public SESEEffectsKey(String fd, TypeDescriptor td, Integer hrnId, String hrnUniqueId) {
this.fd = fd;
this.hrnId = hrnId;
this.hrnUniqueId=hrnUniqueId;
}
+
+ public void setStrong(boolean wStrong){
+ this.wStrong=wStrong;
+ }
+
+ public boolean isStrong(){
+ return wStrong;
+ }
public String getFieldDescriptor() {
return fd;
package Analysis.MLP;
import java.util.HashSet;
+import java.util.Iterator;
public class WaitingElement {
this.allocList.addAll(allocList);
}
+ public boolean equals(Object o) {
+
+ if (o == null) {
+ return false;
+ }
+
+ if (!(o instanceof WaitingElement)) {
+ return false;
+ }
+
+ WaitingElement in = (WaitingElement) o;
+
+ if (waitingID == in.getWaitingID() && status == in.getStatus()
+ && allocList.equals(in.getAllocList())) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ public String toString() {
+ return "[waitingID=" + waitingID + " status=" + status + " allocList="
+ + allocList + "]";
+ }
+
+ public int hashCode() {
+
+ int hash = 1;
+
+ hash = hash * 31 + waitingID;
+
+ hash += status;
+
+ for (Iterator iterator = allocList.iterator(); iterator.hasNext();) {
+ Integer type = (Integer) iterator.next();
+ hash += type.intValue();
+ }
+
+ return hash;
+
+ }
+
}
\ No newline at end of file
private TypeDescriptor td;
private Integer hrnId;
private String hrnUniqueId;
+ private int paramIden;
- public EffectsKey(String fd, TypeDescriptor td, Integer hrnId, String hrnUniqueId) {
+ public EffectsKey(String fd, TypeDescriptor td, Integer hrnId, String hrnUniqueId, int paramIden) {
this.fd = fd;
this.td = td;
this.hrnId = hrnId;
this.hrnUniqueId=hrnUniqueId;
+ this.paramIden=paramIden;
+ }
+
+ public int getParamIden(){
+ return paramIden;
}
public String getFieldDescriptor() {
while (paramIter.hasNext()) {
Integer paramID = paramIter.next();
effectsSet.addReadingVar(paramID, new EffectsKey(
- fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier()));
+ fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier(),0));
// effectsSet.addReadingVar(paramID, new EffectsKey(
// fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID()));
while (paramIter.hasNext()) {
Integer paramID = paramIter.next();
effectsSet.addReadingVar(paramID, new EffectsKey(
- fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier()));
+ fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier(),1));
// effectsSet.addReadingVar(paramID, new EffectsKey(
// fieldDesc.getSymbol(), srcDesc.getType(),hrn.getID()));
while (paramIter.hasNext()) {
Integer paramID = paramIter.next();
effectsSet.addWritingVar(paramID, new EffectsKey(
- fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier()));
+ fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier(),0));
// effectsSet.addWritingVar(paramID, new EffectsKey(
// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID()));
if(strongUpdate){
effectsSet.addStrongUpdateVar(paramID, new EffectsKey(
- fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier()));
+ fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier(),0));
// effectsSet.addStrongUpdateVar(paramID, new EffectsKey(
// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID()));
}
while (paramIter.hasNext()) {
Integer paramID = paramIter.next();
effectsSet.addWritingVar(paramID, new EffectsKey(
- fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier()));
+ fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier(),1));
// effectsSet.addWritingVar(paramID, new EffectsKey(
// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID()));
if(strongUpdate){
effectsSet.addStrongUpdateVar(paramID, new EffectsKey(
- fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier()));
+ fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID(),hrn.getGloballyUniqueIdentifier(),1));
// effectsSet.addStrongUpdateVar(paramID, new EffectsKey(
// fieldDesc.getSymbol(), dstDesc.getType(),hrn.getID()));
}
Integer paramIdx = paramIter.next();
HashSet<EffectsKey> newSet = callee.getEffects().getReadTable()
.get(calleeParamIdx);
- effectsSet.addReadingEffectsSet(paramIdx, newSet);
+
+
+ if(newSet!=null){
+ HashSet<EffectsKey> thisSet=new HashSet<EffectsKey>();
+ HeapRegionNode priHRN=og.id2hrn.get(og.paramIndex2idPrimary.get(paramIdx));
+ Integer secIdx=og.paramIndex2idSecondary.get(paramIdx);
+ HeapRegionNode secHRN=null;
+ if(secIdx!=null){
+ secHRN=og.id2hrn.get(secIdx);
+ }else{
+ secHRN=priHRN;
+ }
+
+ for (Iterator iterator = newSet.iterator(); iterator.hasNext();) {
+ EffectsKey effectsKey = (EffectsKey) iterator.next();
+ HeapRegionNode hrnTemp;
+ if(effectsKey.getParamIden()==0){//primary
+ hrnTemp=priHRN;
+ }else{//secondary
+ hrnTemp=secHRN;
+ }
+ EffectsKey newEffectsKey;
+ if(secIdx==null){
+ newEffectsKey=new EffectsKey(effectsKey.getFieldDescriptor(), effectsKey.getTypeDescriptor(), hrnTemp.getID(),hrnTemp.getGloballyUniqueIdentifier(),0);
+ }else{
+ newEffectsKey=new EffectsKey(effectsKey.getFieldDescriptor(), effectsKey.getTypeDescriptor(), hrnTemp.getID(),hrnTemp.getGloballyUniqueIdentifier(),effectsKey.getParamIden());
+ }
+ thisSet.add(newEffectsKey);
+ }
+
+ effectsSet.addReadingEffectsSet(paramIdx, thisSet);
+ }
+
}
// handle write effects
Integer paramIdx = paramIter.next();
HashSet<EffectsKey> newSet = callee.getEffects()
.getWriteTable().get(calleeParamIdx);
- effectsSet.addWritingEffectsSet(paramIdx, newSet);
+
+ if(newSet!=null){
+
+ HashSet<EffectsKey> thisSet=new HashSet<EffectsKey>();
+ HeapRegionNode priHRN=og.id2hrn.get(og.paramIndex2idPrimary.get(paramIdx));
+ Integer secIdx=og.paramIndex2idSecondary.get(paramIdx);
+ HeapRegionNode secHRN=null;
+ if(secIdx!=null){
+ secHRN=og.id2hrn.get(secIdx);
+ }else{
+ secHRN=priHRN;
+ }
+
+ for (Iterator iterator = newSet.iterator(); iterator.hasNext();) {
+ EffectsKey effectsKey = (EffectsKey) iterator.next();
+ HeapRegionNode hrnTemp;
+ if(effectsKey.getParamIden()==0){//primary
+ hrnTemp=priHRN;
+ }else{//secondary
+ hrnTemp=secHRN;
+ }
+ EffectsKey newEffectsKey;
+ if(secIdx==null){
+ newEffectsKey=new EffectsKey(effectsKey.getFieldDescriptor(), effectsKey.getTypeDescriptor(), hrnTemp.getID(),hrnTemp.getGloballyUniqueIdentifier(),0);
+ }else{
+ newEffectsKey=new EffectsKey(effectsKey.getFieldDescriptor(), effectsKey.getTypeDescriptor(), hrnTemp.getID(),hrnTemp.getGloballyUniqueIdentifier(),effectsKey.getParamIden());
+ }
+ thisSet.add(newEffectsKey);
+ }
+
+ effectsSet.addWritingEffectsSet(paramIdx, thisSet);
+ }
+
}
// handle strong update effects
Integer paramIdx = paramIter.next();
HashSet<EffectsKey> newSet = callee.getEffects()
.getStrongUpdateTable().get(calleeParamIdx);
- effectsSet.addStrongUpdateEffectsSet(paramIdx, newSet);
+ if(newSet!=null){
+
+ HashSet<EffectsKey> thisSet=new HashSet<EffectsKey>();
+ HeapRegionNode priHRN=og.id2hrn.get(og.paramIndex2idPrimary.get(paramIdx));
+ Integer secIdx=og.paramIndex2idSecondary.get(paramIdx);
+ HeapRegionNode secHRN=null;
+ if(secIdx!=null){
+ secHRN=og.id2hrn.get(secIdx);
+ }else{
+ secHRN=priHRN;
+ }
+
+ for (Iterator iterator = newSet.iterator(); iterator.hasNext();) {
+ EffectsKey effectsKey = (EffectsKey) iterator.next();
+ HeapRegionNode hrnTemp;
+ if(effectsKey.getParamIden()==0){//primary
+ hrnTemp=priHRN;
+ }else{//secondary
+ hrnTemp=secHRN;
+ }
+ EffectsKey newEffectsKey;
+ if(secIdx==null){
+ newEffectsKey=new EffectsKey(effectsKey.getFieldDescriptor(), effectsKey.getTypeDescriptor(), hrnTemp.getID(),hrnTemp.getGloballyUniqueIdentifier(),0);
+ }else{
+ newEffectsKey=new EffectsKey(effectsKey.getFieldDescriptor(), effectsKey.getTypeDescriptor(), hrnTemp.getID(),hrnTemp.getGloballyUniqueIdentifier(),effectsKey.getParamIden());
+ }
+ thisSet.add(newEffectsKey);
+ }
+
+ effectsSet.addStrongUpdateEffectsSet(paramIdx, thisSet);
+ }
+
}
}