forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make new LIFO path exploration the default
This commits adds the "lifo" strategy, which explores program paths using depth-first search. This is now the default strategy due to its favourable memory consumption compared to other strategies; tests on a few benchmarks show that its memory usage is basically constant and comparable to regular model-checking, since this strategy finishes paths as quickly as possible rather than saving them for later.
- Loading branch information
Showing
2 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,39 @@ Author: Kareem Khazem <[email protected]> | |
#include <util/exit_codes.h> | ||
#include <util/make_unique.h> | ||
|
||
// _____________________________________________________________________________ | ||
// path_lifot | ||
|
||
path_storaget::patht &path_lifot::private_peek() | ||
{ | ||
last_peeked = paths.end(); | ||
--last_peeked; | ||
return paths.back(); | ||
} | ||
|
||
void path_lifot::push( | ||
const path_storaget::patht &next_instruction, | ||
const path_storaget::patht &jump_target) | ||
{ | ||
paths.push_back(next_instruction); | ||
paths.push_back(jump_target); | ||
} | ||
|
||
void path_lifot::private_pop() | ||
{ | ||
PRECONDITION(last_peeked != paths.end()); | ||
paths.erase(last_peeked); | ||
last_peeked = paths.end(); | ||
} | ||
|
||
std::size_t path_lifot::size() const | ||
{ | ||
return paths.size(); | ||
} | ||
|
||
// _____________________________________________________________________________ | ||
// path_fifot | ||
|
||
path_storaget::patht &path_fifot::private_peek() | ||
{ | ||
return paths.front(); | ||
|
@@ -36,6 +69,9 @@ std::size_t path_fifot::size() const | |
return paths.size(); | ||
} | ||
|
||
// _____________________________________________________________________________ | ||
// path_strategy_choosert | ||
|
||
std::string path_strategy_choosert::show_strategies() const | ||
{ | ||
std::stringstream ss; | ||
|
@@ -69,10 +105,19 @@ void path_strategy_choosert::set_path_strategy_options( | |
|
||
path_strategy_choosert::path_strategy_choosert() | ||
: strategies( | ||
{{"fifo", | ||
{{"lifo", | ||
{" lifo next instruction is pushed before\n" | ||
" goto target; paths are popped in\n" | ||
" last-in, first-out order. Explores\n" | ||
" the program tree depth-first.\n", | ||
[]() { // NOLINT(whitespace/braces) | ||
return util_make_unique<path_lifot>(); | ||
}}}, | ||
{"fifo", | ||
{" fifo next instruction is pushed before\n" | ||
" goto target; paths are popped in\n" | ||
" first-in, first-out order\n", | ||
" first-in, first-out order. Explores\n" | ||
" the program tree breadth-first.\n", | ||
[]() { // NOLINT(whitespace/braces) | ||
return util_make_unique<path_fifot>(); | ||
}}}}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters