Skip to content

Commit fdc819f

Browse files
author
Daniel Kroening
committed
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 8ecbec9 commit fdc819f

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/goto-programs/read_bin_goto_object.cpp

Lines changed: 6 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,12 @@ static bool read_bin_goto_object_v4(
100100
goto_programt::instructiont &instruction=*itarget;
101101

102102
irepconverter.reference_convert(in, instruction.code);
103-
instruction.function = irepconverter.read_string_ref(in);
103+
instruction.function = fname;
104104
irepconverter.reference_convert(in, instruction.source_location);
105105
instruction.type = (goto_program_instruction_typet)
106106
irepconverter.read_gb_word(in);
107107
instruction.guard.make_nil();
108108
irepconverter.reference_convert(in, instruction.guard);
109-
irepconverter.read_string_ref(in); // former event
110109
instruction.target_number = irepconverter.read_gb_word(in);
111110
if(instruction.is_target() &&
112111
rev_target_map.insert(
@@ -222,13 +221,14 @@ bool read_bin_goto_object(
222221
case 1:
223222
case 2:
224223
case 3:
224+
case 4:
225225
message.error() <<
226226
"The input was compiled with an old version of "
227227
"goto-cc; please recompile" << messaget::eom;
228228
return true;
229229

230-
case 4:
231-
return read_bin_goto_object_v4(
230+
case 5:
231+
return read_bin_goto_object_v5(
232232
in, symbol_table, functions, irepconverter);
233233
break;
234234

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, instruction.function);
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)