]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: only verify all_blocks set if it's invalid
authorJoe Groff <arcata@gmail.com>
Tue, 13 Dec 2011 03:04:56 +0000 (19:04 -0800)
committerJoe Groff <arcata@gmail.com>
Tue, 13 Dec 2011 03:04:56 +0000 (19:04 -0800)
Verifying on every sample is way too slow to be practical when debugging bootstrap.

vm/code_heap.cpp

index 8ac29fd6b51a588ede425dcf1a8228b03ba6ff3b..b7f45a206f75b3d5f8c320b405ad61114a845bdd 100755 (executable)
@@ -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;
 }