vm: make all_blocks a set of cells
gcc was doing bad things assuming the pointer given to upper_bound was aligneddb4
parent
36d1e0a78c
commit
3868895b56
|
@ -440,7 +440,7 @@ code_block *factor_vm::add_code_block(code_block_type type, cell code_, cell lab
|
|||
method returns, except when compiling words with the non-optimizing
|
||||
compiler at the beginning of bootstrap */
|
||||
this->code->uninitialized_blocks.insert(std::make_pair(compiled,literals.value()));
|
||||
this->code->all_blocks.insert(compiled);
|
||||
this->code->all_blocks.insert((cell)compiled);
|
||||
|
||||
/* next time we do a minor GC, we have to trace this code block, since
|
||||
the fields of the code_block struct might point into nursery or aging */
|
||||
|
|
|
@ -63,7 +63,7 @@ void code_heap::free(code_block *compiled)
|
|||
FACTOR_ASSERT(!uninitialized_p(compiled));
|
||||
points_to_nursery.erase(compiled);
|
||||
points_to_aging.erase(compiled);
|
||||
all_blocks.erase(compiled);
|
||||
all_blocks.erase((cell)compiled);
|
||||
allocator->free(compiled);
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,13 @@ void code_heap::sweep()
|
|||
}
|
||||
|
||||
struct all_blocks_set_verifier {
|
||||
std::set<code_block*> *all_blocks;
|
||||
std::set<cell> *all_blocks;
|
||||
|
||||
all_blocks_set_verifier(std::set<code_block*> *all_blocks) : all_blocks(all_blocks) {}
|
||||
all_blocks_set_verifier(std::set<cell> *all_blocks) : all_blocks(all_blocks) {}
|
||||
|
||||
void operator()(code_block *block, cell size)
|
||||
{
|
||||
FACTOR_ASSERT(all_blocks->find(block) != all_blocks->end());
|
||||
all_blocks->erase(block);
|
||||
FACTOR_ASSERT(all_blocks->find((cell)block) != all_blocks->end());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -117,11 +116,11 @@ void code_heap::verify_all_blocks_set()
|
|||
|
||||
code_block *code_heap::code_block_for_address(cell address)
|
||||
{
|
||||
std::set<code_block*>::const_iterator blocki =
|
||||
std::set<cell>::const_iterator blocki =
|
||||
all_blocks.upper_bound((code_block*)address);
|
||||
FACTOR_ASSERT(blocki != all_blocks.begin());
|
||||
--blocki;
|
||||
code_block* found_block = *blocki;
|
||||
code_block* found_block = (code_block*)*blocki;
|
||||
#ifdef FACTOR_DEBUG
|
||||
if (!((cell)found_block->entry_point() <= address
|
||||
&& address - (cell)found_block->entry_point() < found_block->size()))
|
||||
|
@ -146,7 +145,7 @@ struct all_blocks_set_inserter {
|
|||
|
||||
void operator()(code_block *block, cell size)
|
||||
{
|
||||
code->all_blocks.insert(block);
|
||||
code->all_blocks.insert((cell)block);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ struct code_heap {
|
|||
/* Memory allocator */
|
||||
free_list_allocator<code_block> *allocator;
|
||||
|
||||
std::set<code_block *> all_blocks;
|
||||
std::set<cell> all_blocks;
|
||||
|
||||
/* Keys are blocks which need to be initialized by initialize_code_block().
|
||||
Values are literal tables. Literal table arrays are GC roots until the
|
||||
|
|
Loading…
Reference in New Issue