Package soot.toolkits.graph

Examples of soot.toolkits.graph.HashMutableDirectedGraph


    do
    {
      iteration++;
      G.v().out.println("[DeadlockDetector] Deadlock Iteration #" + iteration);
      foundDeadlock = false;
      lockOrder = new HashMutableDirectedGraph(); // start each iteration with a fresh graph

      // Assemble the partial ordering of locks
      Iterator<CriticalSection> deadlockIt1 = criticalSections.iterator();
      while(deadlockIt1.hasNext() && !foundDeadlock)
      {
View Full Code Here


  public void reorderLocksets(Map<Value, Integer> lockToLockNum, MutableEdgeLabelledDirectedGraph lockOrder) {
    for(CriticalSection tn : criticalSections)
    {
      // Get the portion of the lock order that is visible to tn
      HashMutableDirectedGraph visibleOrder = new HashMutableDirectedGraph();
      if(tn.group != null)
      {
        for(CriticalSection otherTn : criticalSections)
        {
          // Check if otherTn and tn share a static lock
          boolean tnsShareAStaticLock = false;
          for( EquivalentValue tnLockEqVal : tn.lockset )
          {
            Integer tnLockNum = lockToLockNum.get(tnLockEqVal.getValue());
            if(tnLockNum < 0)
            {
              // this is a static lock... see if some lock in labelTn has the same #
              if(otherTn.group != null)
              {
                for( EquivalentValue otherTnLockEqVal : otherTn.lockset )
                {
                  if(lockToLockNum.get(otherTnLockEqVal.getValue()) == tnLockNum)
                  {
                    tnsShareAStaticLock = true;
                  }
                }
              }
              else
                tnsShareAStaticLock = true; // not really... but we want to skip this one
            }
          }
         
          if(!tnsShareAStaticLock || tn == otherTn) // if tns don't share any static lock, or if tns are the same one
          {
            // add these orderings to tn's visible order
            MutableDirectedGraph orderings = lockOrder.getEdgesForLabel(otherTn);
            for(Object node1 : orderings.getNodes())
            {
              if(!visibleOrder.containsNode(node1))
                visibleOrder.addNode(node1);
              for(Object node2 : orderings.getSuccsOf(node1))
              {
                if(!visibleOrder.containsNode(node2))
                  visibleOrder.addNode(node2);
                visibleOrder.addEdge(node1, node2);
              }
            }
          }
        }

        G.v().out.println("VISIBLE ORDER FOR " + tn.name);
        visibleOrder.printGraph();
     
        // Order locks in tn's lockset according to the visible order (insertion sort)
        List<EquivalentValue> newLockset = new ArrayList();
        for(EquivalentValue lockEqVal : tn.lockset)
        {
          Value lockToInsert = lockEqVal.getValue();
          Integer lockNumToInsert = lockToLockNum.get(lockToInsert);
          int i = 0;
          while( i < newLockset.size() )
          {
            EquivalentValue existingLockEqVal = newLockset.get(i);
            Value existingLock = existingLockEqVal.getValue();
            Integer existingLockNum = lockToLockNum.get(existingLock);
            if( visibleOrder.containsEdge(lockNumToInsert, existingLockNum) ||
              lockNumToInsert < existingLockNum )
//              !visibleOrder.containsEdge(existingLockNum, lockNumToInsert) ) // if(! existing before toinsert )
              break;
            i++;
          }
View Full Code Here

TOP

Related Classes of soot.toolkits.graph.HashMutableDirectedGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.