vm: only verify all_blocks set if it's invalid

Verifying on every sample is way too slow to be practical when debugging bootstrap.
db4
Joe Groff 2011-12-12 19:04:56 -08:00
parent 4870ac8f1d
commit 4bbb2f5b72
1 changed files with 9 additions and 5 deletions

View File

@ -94,16 +94,20 @@ void code_heap::verify_all_blocks_set()
code_block *code_heap::code_block_for_address(cell address)
{
#ifdef FACTOR_DEBUG
verify_all_blocks_set();
#endif
std::set<code_block*>::const_iterator blocki =
all_blocks.upper_bound((code_block*)address);
FACTOR_ASSERT(blocki != all_blocks.begin());
--blocki;
code_block* found_block = *blocki;
FACTOR_ASSERT((cell)found_block->entry_point() <= address
&& address - (cell)found_block->entry_point() < found_block->size());
#ifdef FACTOR_DEBUG
if (!((cell)found_block->entry_point() <= address
&& address - (cell)found_block->entry_point() < found_block->size()))
{
std::cerr << "invalid block found in all_blocks set!" << std::endl;
verify_all_blocks_set();
FACTOR_ASSERT(false);
}
#endif
return found_block;
}