| 564 | } |
| 565 | |
| 566 | bool Context::runShutdownScript ( ) { |
| 567 | DAS_ASSERTF(insideContext==0,"can't run init script on the locked context"); |
| 568 | if ( shutdown ) return false; |
| 569 | shutdown = true; |
| 570 | auto ssz = 16384 + globalInitStackSize; |
| 571 | StackAllocator init_stack(ssz); |
| 572 | SharedStackGuard guard(*this, init_stack); |
| 573 | return runWithCatch([&](){ |
| 574 | vector<SimFunction *> lateShutdown; |
| 575 | for ( int j=0, js=totalFunctions; j!=js && !stopFlags; ++j ) { |
| 576 | auto & pf = functions[j]; |
| 577 | DAS_ASSERTF(pf.debugInfo, "Missing debug info for %s", pf.name); |
| 578 | if ( pf.debugInfo->flags & FuncInfo::flag_shutdown ) { |
| 579 | if ( pf.debugInfo->flags & FuncInfo::flag_late_shutdown ) { |
| 580 | lateShutdown.push_back(&pf); |
| 581 | } else { |
| 582 | callOrFastcall(&pf, nullptr, 0); |
| 583 | } |
| 584 | } |
| 585 | } |
| 586 | if ( !stopFlags && !lateShutdown.empty() ) { |
| 587 | for ( auto pf : lateShutdown ) { |
| 588 | callOrFastcall(pf, nullptr, 0); |
| 589 | if ( stopFlags ) break; |
| 590 | } |
| 591 | } |
| 592 | }); |
| 593 | } |
| 594 | |
| 595 | vector<SimFunction *> Context::findFunctions ( const char * fnname ) const { |
| 596 | vector<SimFunction *> res; |
nothing calls this directly
no test coverage detected