Skip to content

JBMC: CProver.getCurrentThreadID:()I conversion fix #2561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CORE
A.class
--function 'A.me:()V' --java-threading --cp `../../../../scripts/format_classpath.sh . ../../../src/java_bytecode/library/core-models.jar`
--function 'A.me:()V' --java-threading --cp `../../../../scripts/format_classpath.sh . ../../../src/java_bytecode/library/core-models.jar` --lazy-methods
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ static void instrument_start_thread(
/// \param f_code: function call to CProver.endThread:(I)V
/// \param [out] code: resulting transformation
/// \param symbol_table: a symbol table
static void instrument_endThread(
static void instrument_end_thread(
const code_function_callt &f_code,
codet &code,
symbol_tablet symbol_table)
const symbol_tablet &symbol_table)
{
PRECONDITION(f_code.arguments().size() == 1);

Expand Down Expand Up @@ -388,10 +388,10 @@ static void instrument_endThread(
/// \param f_code: function call to CProver.getCurrentThreadID:()I
/// \param [out] code: resulting transformation
/// \param symbol_table: a symbol table
static void instrument_getCurrentThreadID(
static void instrument_get_current_thread_id(
const code_function_callt &f_code,
codet &code,
symbol_tablet symbol_table)
symbol_tablet &symbol_table)
{
PRECONDITION(f_code.arguments().size() == 0);

Expand Down Expand Up @@ -502,14 +502,23 @@ void convert_threadblock(symbol_tablet &symbol_table)
const code_function_callt &f_code = to_code_function_call(code);
const std::string &f_name = expr2java(f_code.function(), ns);
if(f_name == "org.cprover.CProver.startThread:(I)V")
cb = std::bind(instrument_start_thread, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
cb = std::bind(
instrument_start_thread,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3);
else if(f_name == "org.cprover.CProver.endThread:(I)V")
cb = std::bind(&instrument_endThread, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
cb = std::bind(
&instrument_end_thread,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3);
else if(f_name == "org.cprover.CProver.getCurrentThreadID:()I")
cb = std::bind(&instrument_getCurrentThreadID, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
cb = std::bind(
&instrument_get_current_thread_id,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3);

if(cb)
expr_replacement_map.insert({expr, cb});
Expand Down