Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/target-cpu/fragments/seq-run.in
ViewVC logotype

Diff of /branches/vis15/src/compiler/target-cpu/fragments/seq-run.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4488, Sat Sep 3 00:02:19 2016 UTC revision 4489, Sat Sep 3 00:32:03 2016 UTC
# Line 11  Line 11 
11          return 0;          return 0;
12      }      }
13      else if (this->_stage == diderot::POST_CREATE) {      else if (this->_stage == diderot::POST_CREATE) {
14  #ifdef DIDEROT_HAS_GLOBAL_INITIALLY  #ifdef DIDEROT_HAS_GLOBAL_START
15          this->global_initially();          this->global_start();
16  #endif  #endif
17          this->_stage = diderot::RUNNING;          this->_stage = diderot::RUNNING;
18      }      }
# Line 32  Line 32 
32          std::cerr << "run with " << this->_nstrands << " strands ..." << std::endl;          std::cerr << "run with " << this->_nstrands << " strands ..." << std::endl;
33      }      }
34    
35  #ifdef DIDEROT_HAS_INITIALLY_METHOD  #ifdef DIDEROT_HAS_START_METHOD
36      this->run_initially();      this->run_start_methods();
37  #endif  #endif
38    
39    // iterate until all strands are stable    // iterate until all strands are stable
40      uint32_t nSteps = 0;      uint32_t nSteps = 0;
41      uint32_t nActive = this->_nactive;      uint32_t nActive = this->_strands.num_active();
42      while ((nActive > 0) && (nSteps < max_nsteps)) {      while ((nActive > 0) && (nSteps < max_nsteps)) {
43          nSteps++;          nSteps++;
44  #ifdef DIDEROT_HAS_STRAND_COMMUNICATION  #ifdef DIDEROT_HAS_STRAND_COMMUNICATION
# Line 47  Line 47 
47  #endif  #endif
48        // update strands        // update strands
49          uint32_t nStabilizing = 0;          uint32_t nStabilizing = 0;
50          for (int i = 0;  i < this->_nstrands;  i++) {          for (auto ix = this->_strands.begin_active();
51              if (! this->_status[i]) {              ix != this->_strands.end_active();
52                ix = this->_strands.next_active(ix))
53            {
54  #ifdef DIDEROT_DUAL_STATE  #ifdef DIDEROT_DUAL_STATE
55                  diderot::strand_status sts =              diderot::strand_status sts = @STRAND@_update(@UPDATE_ARGS@
56                      @STRAND@_update(@UPDATE_ARGS@&this->_inState[i], &this->_outState[i]);                  this->_strands.local_state(ix),
57                    this->_strands.in_state(ix),
58                    this->_strands.out_state(ix));
59  #else  #else
60                  diderot::strand_status sts = @STRAND@_update(@UPDATE_ARGS@&this->_state[i]);              diderot::strand_status sts = @STRAND@_update(@UPDATE_ARGS@
61                    this->_strands.strand(ix));
62  #endif  #endif
63                  switch (sts) {                  switch (sts) {
64                    case diderot::kStabilize:                    case diderot::kStabilize:
65                      this->_status[i] = diderot::kStabilize;                  this->_strands._status[ix] = diderot::kStabilize;
66                      nStabilizing++;                      nStabilizing++;
67                      break;                      break;
68                    case diderot::kDie:                    case diderot::kDie:
69                      this->_status[i] = diderot::kDead;                  this->_strands._status[ix] = diderot::kDead;
70                      nActive--;                      nActive--;
71                      break;                      break;
72                    default:                    default:
73                      break;                      break;
74                  }                  }
75              }              }
         }  
76          if (nStabilizing > 0) {          if (nStabilizing > 0) {
77              this->_nstable += nStabilizing;              this->_nstable += nStabilizing;
78              nActive -= nStabilizing;              nActive -= nStabilizing;

Legend:
Removed from v.4488  
changed lines
  Added in v.4489

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0