factor/vm/code_roots.hpp

22 lines
372 B
C++
Raw Normal View History

namespace factor {
2009-11-02 19:11:12 -05:00
struct code_root {
cell value;
bool valid;
factor_vm* parent;
2009-11-02 19:11:12 -05:00
void push() { parent->code_roots.push_back(this); }
2009-11-02 19:11:12 -05:00
code_root(cell value, factor_vm* parent)
: value(value), valid(true), parent(parent) {
push();
}
2009-11-02 19:11:12 -05:00
~code_root() {
FACTOR_ASSERT(parent->code_roots.back() == this);
parent->code_roots.pop_back();
}
2009-11-02 19:11:12 -05:00
};
}