| 72 | |
| 73 | |
| 74 | void Context::pop() { |
| 75 | Assert(getLevel() > 0) << "Cannot pop below level 0"; |
| 76 | |
| 77 | // Notify the (pre-pop) ContextNotifyObj objects |
| 78 | ContextNotifyObj* pCNO = d_pCNOpre; |
| 79 | while(pCNO != NULL) { |
| 80 | // pre-store the "next" pointer in case pCNO deletes itself on notify() |
| 81 | ContextNotifyObj* next = pCNO->d_pCNOnext; |
| 82 | pCNO->contextNotifyPop(); |
| 83 | pCNO = next; |
| 84 | } |
| 85 | |
| 86 | // Grab the top Scope |
| 87 | Scope* pScope = d_scopeList.back(); |
| 88 | |
| 89 | // Restore the previous Scope |
| 90 | d_scopeList.pop_back(); |
| 91 | |
| 92 | // Restore all objects in the top Scope |
| 93 | delete pScope; |
| 94 | |
| 95 | // Pop the memory region |
| 96 | d_pCMM->pop(); |
| 97 | |
| 98 | // Notify the (post-pop) ContextNotifyObj objects |
| 99 | pCNO = d_pCNOpost; |
| 100 | while(pCNO != NULL) { |
| 101 | // pre-store the "next" pointer in case pCNO deletes itself on notify() |
| 102 | ContextNotifyObj* next = pCNO->d_pCNOnext; |
| 103 | pCNO->contextNotifyPop(); |
| 104 | pCNO = next; |
| 105 | } |
| 106 | |
| 107 | Trace("pushpop") << std::string(2 * getLevel(), ' ') << "} Pop [to " |
| 108 | << getLevel() << "] " << this << std::endl; |
| 109 | } |
| 110 | |
| 111 | |
| 112 | void Context::popto(int toLevel) { |