FlatCall fc = (FlatCall) fn;
MethodDescriptor mdCallee = fc.getMethod();
FlatMethod fmCallee = state.getMethodFlat( mdCallee );
-
+
+ // before transfer func, possibly inject
+ // stall-site taints
+ if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+
+ if(rblockStatus.isInCriticalRegion(fmContaining, fn)){
+ // x.y=f , stall x and y if they are not accessible
+ // also contribute write effects on stall site of x
+ if(!rg.isAccessible(fc.getThis())) {
+ rg.taintStallSite(fn, fc.getThis());
+ }
+
+ // accessible status update
+ rg.makeAccessible(fc.getThis());
+ }
+ }
+
boolean debugCallSite =
mdCaller.getSymbol().equals( state.DISJOINTDEBUGCALLER ) &&
Iterator effectItrB = readTableB.entrySet().iterator();
while (effectItrB.hasNext()) {
Map.Entry meB = (Map.Entry) effectItrB.next();
- AllocSite asB = (AllocSite) meA.getKey();
- Set<Effect> esB = (Set<Effect>) meA.getValue();
+ AllocSite asB = (AllocSite) meB.getKey();
+ Set<Effect> esB = (Set<Effect>) meB.getValue();
for (Iterator iterator = strongUpdateSetA.iterator(); iterator.hasNext();) {
Effect strongUpdateA = (Effect) iterator.next();
effectItrB = writeTableB.entrySet().iterator();
while (effectItrB.hasNext()) {
Map.Entry meB = (Map.Entry) effectItrB.next();
- AllocSite asB = (AllocSite) meA.getKey();
- Set<Effect> esB = (Set<Effect>) meA.getValue();
+ AllocSite asB = (AllocSite) meB.getKey();
+ Set<Effect> esB = (Set<Effect>) meB.getValue();
for (Iterator iterator = strongUpdateSetA.iterator(); iterator.hasNext();) {
Effect strongUpdateA = (Effect) iterator.next();
newElement.setStatus(seseLock.getNodeType(node));
if (isFineElement(newElement.getStatus())) {
newElement.setDynID(node.getVar().toString());
+ newElement.setTempDesc(node.getVar());
}
waitingElementSet.add(newElement);
}
import IR.State;
import IR.TypeUtil;
import IR.Flat.FKind;
+import IR.Flat.FlatCall;
import IR.Flat.FlatEdge;
import IR.Flat.FlatElementNode;
import IR.Flat.FlatFieldNode;
conflictGraph = new ConflictGraph();
}
- if( fn instanceof FlatFieldNode){
- FlatFieldNode ffn = (FlatFieldNode)fn;
+ if (fn instanceof FlatFieldNode) {
+ FlatFieldNode ffn = (FlatFieldNode) fn;
rhs = ffn.getSrc();
- }else{
- FlatElementNode fen = (FlatElementNode)fn;
+ } else {
+ FlatElementNode fen = (FlatElementNode) fn;
rhs = fen.getSrc();
}
conflictGraph = new ConflictGraph();
}
- if( fn instanceof FlatSetFieldNode){
+ if (fn instanceof FlatSetFieldNode) {
FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
lhs = fsfn.getDst();
rhs = fsfn.getSrc();
- }else{
+ } else {
FlatSetElementNode fsen = (FlatSetElementNode) fn;
lhs = fsen.getDst();
rhs = fsen.getSrc();
}
-
+
// collects effects of stall site and generates stall site node
Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
conflictGraph.addStallSite(taint2Effects, rhs);
}
}
break;
+
+ case FKind.FlatCall: {
+ conflictGraph = sese2conflictGraph.get(currentSESE);
+ if (conflictGraph == null) {
+ conflictGraph = new ConflictGraph();
+ }
+
+ FlatCall fc = (FlatCall) fn;
+ lhs = fc.getThis();
+
+ // collects effects of stall site and generates stall site node
+ Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
+ conflictGraph.addStallSite(taint2Effects, lhs);
+ if (conflictGraph.id2cn.size() > 0) {
+ sese2conflictGraph.put(currentSESE, conflictGraph);
+ }
+ }
+
+ break;
+
}
}
for (Iterator iterator = coarseToCover.iterator(); iterator.hasNext();) {
ConflictEdge edge = (ConflictEdge) iterator.next();
-
if (seseLock.getConflictNodeSet().size() == 0) {
// initial setup
if (seseLock.hasSelfCoarseEdge(edge.getVertexU())) {
// and it is not parent
type = ConflictNode.SCC;
} else {
- type = ConflictNode.PARENT_COARSE;
+ type = ConflictNode.PARENT_WRITE;
}
seseLock.addConflictNode(edge.getVertexU(), type);
} else {
if (edge.getVertexU().isStallSiteNode()) {
- type = ConflictNode.PARENT_COARSE;
+ if(edge.getVertexU().getWriteEffectSet().isEmpty()){
+ type = ConflictNode.PARENT_READ;
+ }else{
+ type = ConflictNode.PARENT_WRITE;
+ }
} else {
- type = ConflictNode.COARSE;
+ type = ConflictNode.COARSE;
}
seseLock.addConflictNode(edge.getVertexU(), type);
}
// and it is not parent
type = ConflictNode.SCC;
} else {
- type = ConflictNode.PARENT_COARSE;
+ type = ConflictNode.PARENT_WRITE;
}
seseLock.addConflictNode(edge.getVertexV(), type);
} else {
- if (edge.getVertexV().isStallSiteNode()) {
- type = ConflictNode.PARENT_COARSE;
+ if (edge.getVertexV().isStallSiteNode()) {
+ if(edge.getVertexV().getWriteEffectSet().isEmpty()){
+ type = ConflictNode.PARENT_READ;
+ }else{
+ type = ConflictNode.PARENT_WRITE;
+ }
} else {
type = ConflictNode.COARSE;
}
// new node has a coarse-grained edge to all fine-read, fine-write,
// parent
changed = true;
+
+ if(newNode.isInVarNode() &&
+ (!seseLock.hasSelfCoarseEdge(newNode)) &&
+ seseLock.hasCoarseEdgeWithParentCoarse(newNode)){
+ // this case can't be covered by this queue
+ coarseToCover.remove(edge);
+ break;
+ }
if (seseLock.hasSelfCoarseEdge(newNode)) {
// SCC
}
public void addConflictEdge(ConflictEdge e) {
- conflictEdgeSet.add(e);
+ conflictEdgeSet.add(e);
}
public boolean containsConflictEdge(ConflictEdge e) {
}
return false;
}
+
+ public boolean hasSelfEdge(ConflictNode node) {
+
+ Set<ConflictEdge> set = node.getEdgeSet();
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ ConflictEdge conflictEdge = (ConflictEdge) iterator.next();
+
+ if ((!conflictEdge.isCoarseEdge()) && conflictEdge.getVertexU() == conflictEdge.getVertexV()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean hasCoarseEdgeWithParentCoarse(ConflictNode node) {
+
+ Set<ConflictEdge> set = node.getEdgeSet();
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ ConflictEdge conflictEdge = (ConflictEdge) iterator.next();
+
+ ConflictNode cNode;
+ if (conflictEdge.getVertexU() == node) {
+ cNode = conflictEdge.getVertexV();
+ } else {
+ cNode = conflictEdge.getVertexU();
+ }
+ Integer cNodeTypeIn = nodeTypeMap.get(cNode);
+ if (cNodeTypeIn != null && cNodeTypeIn.intValue() == ConflictNode.PARENT_COARSE) {
+ return true;
+ }
+ }
+ return false;
+ }
public ConflictNode getNewNodeConnectedWithGroup(ConflictEdge newEdge) {