VM: change type of bignum_roots and remove unnecessary not-null checks
Declaring bignum_roots to contain bignum** instead of cell avoids some superfluous casts. Casting it to cell is wrong because the items in it are never tagged. And due to a earlier commit, bignum_roots will never contain NULL:s so checking for them is not needed.db4
parent
8ac3b80173
commit
a6e0867b22
|
@ -35,13 +35,12 @@ struct gc_bignum {
|
||||||
factor_vm* parent;
|
factor_vm* parent;
|
||||||
|
|
||||||
gc_bignum(bignum** addr, factor_vm* parent) : addr(addr), parent(parent) {
|
gc_bignum(bignum** addr, factor_vm* parent) : addr(addr), parent(parent) {
|
||||||
if (*addr)
|
|
||||||
parent->check_data_pointer(*addr);
|
parent->check_data_pointer(*addr);
|
||||||
parent->bignum_roots.push_back((cell)addr);
|
parent->bignum_roots.push_back(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
~gc_bignum() {
|
~gc_bignum() {
|
||||||
FACTOR_ASSERT(parent->bignum_roots.back() == (cell)addr);
|
FACTOR_ASSERT(parent->bignum_roots.back() == addr);
|
||||||
parent->bignum_roots.pop_back();
|
parent->bignum_roots.pop_back();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,14 +186,14 @@ template <typename Fixup> void slot_visitor<Fixup>::visit_data_roots() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Fixup> void slot_visitor<Fixup>::visit_bignum_roots() {
|
template <typename Fixup> void slot_visitor<Fixup>::visit_bignum_roots() {
|
||||||
std::vector<cell>::const_iterator iter = parent->bignum_roots.begin();
|
std::vector<bignum**>::const_iterator iter =
|
||||||
std::vector<cell>::const_iterator end = parent->bignum_roots.end();
|
parent->bignum_roots.begin();
|
||||||
|
std::vector<bignum**>::const_iterator end =
|
||||||
|
parent->bignum_roots.end();
|
||||||
|
|
||||||
for (; iter < end; iter++) {
|
for (; iter < end; iter++) {
|
||||||
cell* handle = (cell*)(*iter);
|
bignum** ref = *iter;
|
||||||
|
*ref = (bignum*)fixup.fixup_data(*ref);
|
||||||
if (*handle)
|
|
||||||
*handle = (cell)fixup.fixup_data(*(object**)handle);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ struct factor_vm {
|
||||||
themselves here. See data_roots.hpp and code_roots.hpp */
|
themselves here. See data_roots.hpp and code_roots.hpp */
|
||||||
|
|
||||||
std::vector<cell*> data_roots;
|
std::vector<cell*> data_roots;
|
||||||
std::vector<cell> bignum_roots;
|
std::vector<bignum**> bignum_roots;
|
||||||
std::vector<code_root*> code_roots;
|
std::vector<code_root*> code_roots;
|
||||||
|
|
||||||
/* Debugger */
|
/* Debugger */
|
||||||
|
|
Loading…
Reference in New Issue