Logo Search packages:      
Sourcecode: scala version File versions  Download package

final void scala::actors::FJTaskRunner::coInvoke ( FJTask[]  tasks  )  [inline, protected]

Array-based version of coInvoke

Definition at line 941 of file FJTaskRunner.java.

References base, COLLECT_STATS, deq, scala::actors::FJTask::isDone(), pop(), put(), runs, scan(), scala::actors::FJTask::setDone(), slowCoInvoke(), and top.

                                                {
    int nforks = tasks.length - 1;

    // inline bulk push of all but one task

    int t = top;

    if (nforks >= 0 && t + nforks < (base & (deq.length-1)) + deq.length) {
      for (int i = 0; i < nforks; ++i) {
        deq[t++ & (deq.length-1)].put(tasks[i]);
        top = t;
      }

      // inline invoke of one task
      FJTask v = tasks[nforks];
      if (!v.isDone()) { 
        if (COLLECT_STATS) ++runs; 
        v.run(); 
        v.setDone(); 
      }
      
      // inline  taskJoins
      
      for (int i = 0; i < nforks; ++i) { 
        FJTask w = tasks[i];
        while (!w.isDone()) {

          FJTask task = pop();
          if (task != null) {
            if (!task.isDone()) {
              if (COLLECT_STATS) ++runs;
              task.run(); 
              task.setDone(); 
            }
          }
          else
            scan(w);
        }
      }
    }

    else  // handle non-inlinable cases
      slowCoInvoke(tasks);
  }


Generated by  Doxygen 1.6.0   Back to index