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;
|
||||
|
||||
gc_bignum(bignum** addr, factor_vm* parent) : addr(addr), parent(parent) {
|
||||
if (*addr)
|
||||
parent->check_data_pointer(*addr);
|
||||
parent->bignum_roots.push_back((cell)addr);
|
||||
parent->bignum_roots.push_back(addr);
|
||||
}
|
||||
|
||||
~gc_bignum() {
|
||||
FACTOR_ASSERT(parent->bignum_roots.back() == (cell)addr);
|
||||
FACTOR_ASSERT(parent->bignum_roots.back() == addr);
|
||||
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() {
|
||||
std::vector<cell>::const_iterator iter = parent->bignum_roots.begin();
|
||||
std::vector<cell>::const_iterator end = parent->bignum_roots.end();
|
||||
std::vector<bignum**>::const_iterator iter =
|
||||
parent->bignum_roots.begin();
|
||||
std::vector<bignum**>::const_iterator end =
|
||||
parent->bignum_roots.end();
|
||||
|
||||
for (; iter < end; iter++) {
|
||||
cell* handle = (cell*)(*iter);
|
||||
|
||||
if (*handle)
|
||||
*handle = (cell)fixup.fixup_data(*(object**)handle);
|
||||
bignum** ref = *iter;
|
||||
*ref = (bignum*)fixup.fixup_data(*ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue