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/world-methods.in
ViewVC logotype

Diff of /branches/vis15/src/compiler/target-cpu/fragments/world-methods.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 26  Line 26 
26      delete this->_globals;      delete this->_globals;
27  #endif  #endif
28    
   // free state arrays  
 #ifdef DIDEROT_DUAL_STATE  
     delete[] this->_inState;  
     delete[] this->_outState;  
 #else  
     delete[] this->_state;  
 #endif  
     delete[] this->_status;  
   
29  #ifdef DIDEROT_HAS_STRAND_COMMUNICATION  #ifdef DIDEROT_HAS_STRAND_COMMUNICATION
30      delete this->_tree;      delete this->_tree;
31  #endif  #endif
# Line 58  Line 49 
49          biffMsgAdd (this->_errors, "unable to initialize scheduler structures");          biffMsgAdd (this->_errors, "unable to initialize scheduler structures");
50          return true;          return true;
51      }      }
     this->_sched->_nactive = 0;  
 #else /* DIDEROT_TARGET_C */  
     this->_nactive = 0;  
52  #endif  #endif
53    
54  #if !defined(DIDEROT_STANDALONE_EXEC) && !defined(DIDEROT_NO_INPUTS)  #if !defined(DIDEROT_STANDALONE_EXEC) && !defined(DIDEROT_NO_INPUTS)
# Line 94  Line 82 
82      }      }
83    
84  #ifdef DIDEROT_HAS_STRAND_COMMUNICATION  #ifdef DIDEROT_HAS_STRAND_COMMUNICATION
85      this->_tree = new diderot::kdtree<@SPATIAL_DIM@, @REALTY@, @STRANDTY@> (numStrands);      this->_tree = new diderot::kdtree<@SPATIAL_DIM@, @REALTY@, strand_array> (numStrands);
86  #endif  #endif
87    
88    // allocate the strand state pointers    // allocate the strand array
89      this->_nstrands = numStrands;      if (this->_strands.alloc (numStrands)) {
90  #ifdef DIDEROT_TARGET_PARALLEL          biffMsgAdd (this->_errors, "unable to allocate strand-state array\n");
     this->_sched->_nactive = numStrands;  
     this->_sched->_nstable = 0;  
 #else /* DIDEROT_TARGET_SEQUENTIAL */  
     this->_nactive = numStrands;  
     this->_nstable = 0;  
 #endif  
     this->_status = new (std::nothrow) uint8_t[numStrands];  
 #ifdef DIDEROT_DUAL_STATE  
     this->_inState = new (std::nothrow) @STRANDTY@[numStrands];  
     this->_outState = new (std::nothrow) @STRANDTY@[numStrands];  
     if ((this->_inState == nullptr) || (this->_outState == nullptr) || (this->_status == nullptr)) {  
         biffMsgAdd (this->_errors, "unable to allocate strand states\n");  
         return true;  
     }  
 #else  
     this->_state = new (std::nothrow) @STRANDTY@[numStrands];  
     if ((this->_state == nullptr) || (this->_status == nullptr)) {  
         biffMsgAdd (this->_errors, "unable to allocate strand states\n");  
91          return true;          return true;
92      }      }
 #endif  
93    
94    // initialize strand state pointers etc.    // initialize strand state pointers etc.
95      for (size_t i = 0;  i < numStrands;  i++) {      this->_strands.create_strands (numStrands);
         this->_status[i] = diderot::kActive;  
     }  
96    
97      return false;      return false;
98    
# Line 135  Line 102 
102  //  //
103  inline void world::swap_state ()  inline void world::swap_state ()
104  {  {
105  #ifdef DIDEROT_DUAL_STATE      this->_strands.swap ();
   // swap in and out  
     @STRANDTY@ *tmp = this->_inState;  
     this->_inState = this->_outState;  
     this->_outState = tmp;  
 #endif  
106  }  }
107    
108  // get the number of strands  #ifdef DIDEROT_HAS_STABILIZE_ALL
109  //  void world::stabilize_all ()
110  #ifdef DIDEROT_TARGET_PARALLEL  {
111  //inline uint32_t world::num_active_strands () const { return this->_sched->_nactive; }  #ifndef DIDEROT_NO_GLOBALS
112  //inline uint32_t world::num_all_strands () const { return this->_nstrands; }      globals *glob = this->_globals;
113  //inline uint32_t world::num_stable_strands () const { return this->_sched->_nstable; }  #endif
114  inline uint32_t world::num_active_strands () { return this->_sched->_nactive; }  
115  inline uint32_t world::num_all_strands () { return this->_nstrands; }      if (this->_strands.num_active() > 0) {
116  inline uint32_t world::num_stable_strands () { return this->_sched->_nstable; }          for (auto ix = this->_strands.begin_active();
117  #else              ix != this->_strands.end_active();
118  //inline uint32_t world::num_active_strands () const { return this->_nactive; }              ix = this->_strands.next_active(ix))
119  //inline uint32_t world::num_all_strands () const { return this->_nstrands; }          {
120  //inline uint32_t world::num_stable_strands () const { return this->_nstable; }              this->_strands.stabilize (@STABILIZE_ARGS@ix);
121  inline uint32_t world::num_active_strands () { return this->_nactive; }          }
122  inline uint32_t world::num_all_strands () { return this->_nstrands; }      }
123  inline uint32_t world::num_stable_strands () { return this->_nstable; }  }
124  #endif  #endif

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