| 112 | } |
| 113 | |
| 114 | void |
| 115 | REG::Exp::dispose(void) { |
| 116 | Region region; |
| 117 | Support::DynamicStack<Exp*,Region> todo(region); |
| 118 | todo.push(this); |
| 119 | while (!todo.empty()) { |
| 120 | Exp* e = todo.pop(); |
| 121 | switch (e->type) { |
| 122 | case ET_OR: |
| 123 | case ET_CONC: |
| 124 | if ((e->data.kids[1] != nullptr) && (--e->data.kids[1]->use_cnt == 0)) |
| 125 | todo.push(e->data.kids[1]); |
| 126 | // fall through |
| 127 | case ET_STAR: |
| 128 | if ((e->data.kids[0] != nullptr) && (--e->data.kids[0]->use_cnt == 0)) |
| 129 | todo.push(e->data.kids[0]); |
| 130 | default: ; |
| 131 | } |
| 132 | heap.rfree(e); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | forceinline void |
| 137 | REG::Exp::inc(Exp* e) { |