Skip to content

Commit 3a84988

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 69a3cc4 commit 3a84988

File tree

10 files changed

+15
-19
lines changed

10 files changed

+15
-19
lines changed
-557 Bytes
Binary file not shown.
-358 Bytes
Binary file not shown.
-676 Bytes
Binary file not shown.
-395 Bytes
Binary file not shown.
-5.6 KB
Binary file not shown.
-5.69 KB
Binary file not shown.

regression/goto-diff/syntactic-diff1/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
2-
b.gb
3-
a.gb
2+
b.c
3+
a.c
44
// Enable multi-line checking
55
activate-multi-line-match
66
EXIT=0

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: 7 additions & 10 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,17 +148,16 @@ bool write_goto_binary(
150148
irep_serializationt::ireps_containert irepc;
151149
irep_serializationt irepconverter(irepc);
152150

153-
const int current_goto_version = 4;
154-
if(version < current_goto_version)
151+
if(version < GOTO_BINARY_VERSION)
155152
throw invalid_command_line_argument_exceptiont(
156153
"version " + std::to_string(version) + " no longer supported",
157-
"supported version = " + std::to_string(current_goto_version));
158-
else if(version > current_goto_version)
154+
"supported version = " + std::to_string(GOTO_BINARY_VERSION));
155+
else if(version > GOTO_BINARY_VERSION)
159156
throw invalid_command_line_argument_exceptiont(
160157
"unknown goto binary version " + std::to_string(version),
161-
"supported version = " + std::to_string(current_goto_version));
158+
"supported version = " + std::to_string(GOTO_BINARY_VERSION));
162159
else
163-
return write_goto_binary_v4(
160+
return write_goto_binary_v5(
164161
out, symbol_table, goto_functions, irepconverter);
165162
}
166163

src/goto-programs/write_goto_binary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Author: CM Wintersteiger
1212
#ifndef CPROVER_GOTO_PROGRAMS_WRITE_GOTO_BINARY_H
1313
#define CPROVER_GOTO_PROGRAMS_WRITE_GOTO_BINARY_H
1414

15-
#define GOTO_BINARY_VERSION 4
15+
#define GOTO_BINARY_VERSION 5
1616

1717
#include <iosfwd>
1818
#include <string>

0 commit comments

Comments
 (0)