Skip to content

Commit 63db047

Browse files
Daniel Kroeningtautschnig
Daniel Kroening
authored andcommitted
remove two fields from goto-binary function format
This removes the name of the function in every instruction (it's known from the function that's being read), and an unused field. This also increases version number of goto binary format to 5.
1 parent 4adcfd8 commit 63db047

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/goto-programs/read_bin_goto_object.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Date: June 2006
2020

2121
#include "goto_functions.h"
2222

23-
/// read goto binary format v4
23+
/// read goto binary format v5
2424
/// \par parameters: input stream, symbol_table, functions
2525
/// \return true on error, false otherwise
26-
static bool read_bin_goto_object_v4(
26+
static bool read_bin_goto_object_v5(
2727
std::istream &in,
2828
symbol_tablet &symbol_table,
2929
goto_functionst &functions,
@@ -100,13 +100,11 @@ static bool read_bin_goto_object_v4(
100100
goto_programt::instructiont &instruction=*itarget;
101101

102102
irepconverter.reference_convert(in, instruction.code);
103-
irepconverter.read_string_ref(in); // former function
104103
irepconverter.reference_convert(in, instruction.source_location);
105104
instruction.type = (goto_program_instruction_typet)
106105
irepconverter.read_gb_word(in);
107106
instruction.guard.make_nil();
108107
irepconverter.reference_convert(in, instruction.guard);
109-
irepconverter.read_string_ref(in); // former event
110108
instruction.target_number = irepconverter.read_gb_word(in);
111109
if(instruction.is_target() &&
112110
rev_target_map.insert(
@@ -225,13 +223,14 @@ bool read_bin_goto_object(
225223
case 1:
226224
case 2:
227225
case 3:
226+
case 4:
228227
message.error() <<
229228
"The input was compiled with an old version of "
230229
"goto-cc; please recompile" << messaget::eom;
231230
return true;
232231

233-
case 4:
234-
return read_bin_goto_object_v4(
232+
case 5:
233+
return read_bin_goto_object_v5(
235234
in, symbol_table, functions, irepconverter);
236235
break;
237236

src/goto-programs/write_goto_binary.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Author: CM Wintersteiger
2121

2222
#include <goto-programs/goto_model.h>
2323

24-
/// Writes a goto program to disc, using goto binary format ver 4
25-
bool write_goto_binary_v4(
24+
/// Writes a goto program to disc, using goto binary format ver 5
25+
bool write_goto_binary_v5(
2626
std::ostream &out,
2727
const symbol_tablet &symbol_table,
2828
const goto_functionst &goto_functions,
@@ -97,11 +97,9 @@ bool write_goto_binary_v4(
9797
const goto_programt::instructiont &instruction = *i_it;
9898

9999
irepconverter.reference_convert(instruction.code, out);
100-
irepconverter.write_string_ref(out, fct.first);
101100
irepconverter.reference_convert(instruction.source_location, out);
102101
write_gb_word(out, (long)instruction.type);
103102
irepconverter.reference_convert(instruction.guard, out);
104-
irepconverter.write_string_ref(out, irep_idt()); // former event
105103
write_gb_word(out, instruction.target_number);
106104

107105
write_gb_word(out, instruction.targets.size());
@@ -150,7 +148,7 @@ bool write_goto_binary(
150148
irep_serializationt::ireps_containert irepc;
151149
irep_serializationt irepconverter(irepc);
152150

153-
const int current_goto_version = 4;
151+
const int current_goto_version = 5;
154152
if(version < current_goto_version)
155153
throw invalid_command_line_argument_exceptiont(
156154
"version " + std::to_string(version) + " no longer supported",
@@ -160,7 +158,7 @@ bool write_goto_binary(
160158
"unknown goto binary version " + std::to_string(version),
161159
"supported version = " + std::to_string(current_goto_version));
162160
else
163-
return write_goto_binary_v4(
161+
return write_goto_binary_v5(
164162
out, symbol_table, goto_functions, irepconverter);
165163
}
166164

0 commit comments

Comments
 (0)