int main(void) { uint16_t ctimer; init_ports(); init_timers(); /* clear flags and enable interrupts */ TIFR = _BV(OCF0A); /* timer 0 output compare A */ GIFR = _BV(PCIF); /* pin-change interrupt */ sei(); /* enable interrupts */ for (;;) { ATOMIC_BLOCK(ATOMIC_FORCEON) { ctimer = commtimer; } if (ctimer > COM_PERIOD_MAX) stalled = 1; if (stalled) { spinup(); stalled = 0; } wdt_reset(); } }
void Cell::move() { if (!evolution.isNull()) { spawn(); spinup(); position += evolution; life = lifetime; } }
//------------------------------handle_use------------------------------------- // Handle uses of the merge point. Basically, split-if makes the merge point // go away so all uses of the merge point must go away as well. Most block // local uses have already been split-up, through the merge point. Uses from // far below the merge point can't always be split up (e.g., phi-uses are // pinned) and it makes too much stuff live. Instead we use a path-based // solution to move uses down. // // If the use is along the pre-split-CFG true branch, then the new use will // be from the post-split-CFG true merge point. Vice-versa for the false // path. Some uses will be along both paths; then we sink the use to the // post-dominating location; we may need to insert a Phi there. void PhaseIdealLoop::handle_use( Node *use, Node *def, small_cache *cache, Node *region_dom, Node *new_false, Node *new_true, Node *old_false, Node *old_true ) { Node *use_blk = find_use_block(use,def,old_false,new_false,old_true,new_true); if( !use_blk ) return; // He's dead, Jim // Walk up the dominator tree until I hit either the old IfFalse, the old // IfTrue or the old If. Insert Phis where needed. Node *new_def = spinup( region_dom, new_false, new_true, use_blk, def, cache ); // Found where this USE goes. Re-point him. uint i; for( i = 0; i < use->req(); i++ ) if( use->in(i) == def ) break; assert( i < use->req(), "def should be among use's inputs" ); _igvn.hash_delete(use); use->set_req(i, new_def); _igvn._worklist.push(use); }
void Cell::initialize(int px, int py, char* const psym) { position.setX(px); position.setY(py); evolution.setX(0); evolution.setY(0); life = 0.0f; lifetime = 0.0f; symbol = strdup(" "); resync = true; if (psym) copy(psym); else spinup(); prev = NULL; next = NULL; parent->_notify_cell_created(this); }
// We must be at the merge point which post-dominates 'new_false' and // 'new_true'. Figure out which edges into the RegionNode eventually lead up // to false and which to true. Put in a PhiNode to merge values; plug in // the appropriate false-arm or true-arm values. If some path leads to the // original IF, then insert a Phi recursively. Node *PhaseIdealLoop::spinup( Node *iff_dom, Node *new_false, Node *new_true, Node *use_blk, Node *def, small_cache *cache ) { if (use_blk->is_top()) // Handle dead uses return use_blk; Node *prior_n = (Node*)0xdeadbeef; Node *n = use_blk; // Get path input assert( use_blk != iff_dom, "" ); // Here's the "spinup" the dominator tree loop. Do a cache-check // along the way, in case we've come this way before. while( n != iff_dom ) { // Found post-dominating point? prior_n = n; n = idom(n); // Search higher Node *s = cache->probe( prior_n ); // Check cache if( s ) return s; // Cache hit! } Node *phi_post; if( prior_n == new_false || prior_n == new_true ) { phi_post = def->clone(); phi_post->set_req(0, prior_n ); register_new_node(phi_post, prior_n); } else { // This method handles both control uses (looking for Regions) or data // uses (looking for Phis). If looking for a control use, then we need // to insert a Region instead of a Phi; however Regions always exist // previously (the hash_find_insert below would always hit) so we can // return the existing Region. if( def->is_CFG() ) { phi_post = prior_n; // If looking for CFG, return prior } else { assert( def->is_Phi(), "" ); assert( prior_n->is_Region(), "must be a post-dominating merge point" ); // Need a Phi here phi_post = PhiNode::make_blank(prior_n, def); // Search for both true and false on all paths till find one. for( uint i = 1; i < phi_post->req(); i++ ) // For all paths phi_post->init_req( i, spinup( iff_dom, new_false, new_true, prior_n->in(i), def, cache ) ); Node *t = _igvn.hash_find_insert(phi_post); if( t ) { // See if we already have this one // phi_post will not be used, so kill it _igvn.remove_dead_node(phi_post); phi_post->destruct(); phi_post = t; } else { register_new_node( phi_post, prior_n ); } } } // Update cache everywhere prior_n = (Node*)0xdeadbeef; // Reset IDOM walk n = use_blk; // Get path input // Spin-up the idom tree again, basically doing path-compression. // Insert cache entries along the way, so that if we ever hit this // point in the IDOM tree again we'll stop immediately on a cache hit. while( n != iff_dom ) { // Found post-dominating point? prior_n = n; n = idom(n); // Search higher cache->lru_insert( prior_n, phi_post ); // Fill cache } // End of while not gone high enough return phi_post; }