-
Notifications
You must be signed in to change notification settings - Fork 274
DOC-43: Documentation of GOTO model (de)serialisation. #2802
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
Conversation
src/goto-programs/README.md
Outdated
The content of the written stream will have this strucutre: | ||
- The header: | ||
- A magic number: byte `0x7f` followed by 3 characters `GBF`. | ||
- A version number written in the 7-bit encoding. Currently, only version `4` is supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could a link explaining "7-bit encoding" be provided? It's used a lot below.
src/goto-programs/README.md
Outdated
- The string `s.mode`. | ||
- The string `s.pretty_name`. | ||
- The number `0` in the 7-bit encoding. | ||
- The flags word in the 7-bit encoding. The bits in the flags word correspond to the following `bool` fields (from the most significant bit): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use "Boolean" instead of "bool
".
src/goto-programs/README.md
Outdated
- The array of individual function with bodies. Each written function has this structure: | ||
- The string with the name of the function. | ||
- The number of instructions in the body of the function in the 7-bit encoding. | ||
- The array of individual instruction in function's body. Each written instruction `I` has this structure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
individual instruction_s_
src/goto-programs/README.md
Outdated
|
||
An important propery of the serialisation is that each serialised `irept` | ||
instance occurs in the stream exactly once. Namely, in the position of | ||
its first serialisation query. All other such queries save only hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only a hash
src/goto-programs/README.md
Outdated
the [previous subsection](\ref subsection-goto-binary-serialisation). | ||
The process of the deserialisation does not involve any seeking in the file. | ||
The content is read linearly from the beginning to the end. `irept` instances | ||
and their string constats are deserialised into the memory only once at their |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/constats/constants/
src/goto-programs/README.md
Outdated
The process of the deserialisation does not involve any seeking in the file. | ||
The content is read linearly from the beginning to the end. `irept` instances | ||
and their string constats are deserialised into the memory only once at their | ||
first occurreces in the stream. All subsequent deserialisation queries are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/occurreces/occurrence/
src/goto-programs/README.md
Outdated
- `elf_reader.h` | ||
- `elf_reader.cpp` | ||
|
||
\subsubsection subsection-goto-binary-deserialisation-from-mac-o-fat-image Deserialisation from Mac-O fat image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's "mach-o", not "mac-o" (multiple instances below as well)
src/util/README.md
Outdated
\subsubsection irep-serialization-numbers Serialization of Numbers | ||
|
||
A number is serialiased in 7-bit encoding. For example. given a 2-byte | ||
number in base 2, like `10101010 01010101`, then it is save in 3 bytes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is is save_d_
src/util/README.md
Outdated
number in base 2, like `10101010 01010101`, then it is save in 3 bytes, | ||
where each byte takes only 7 bits from the number, reading from the | ||
left. The 8th bit in each output byte is set to 1 except in the last | ||
byte, where the bit is 0. That 0 bit indicates the end of the end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate "the end"
src/goto-programs/README.md
Outdated
@@ -377,3 +377,181 @@ This stage concludes the *analysis-independent* program transformations. | |||
\subsubsection goto-program-example-1-section Unsigned mult (unsigned a, unsigned b) { int acc, i; for (i = 0; i < b; i++) acc += a; return acc; } | |||
|
|||
To be documented. | |||
|
|||
|
|||
\section section-goto-binary Binary Represenration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Representation
src/goto-programs/README.md
Outdated
|
||
To serialise a `goto_modelt` instance `gm` to a stream `ostr` call the function `write_goto_binary`, e.g. `write_goto_binary(ostr, gm)`. | ||
|
||
The content of the written stream will have this strucutre: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
structure
src/goto-programs/README.md
Outdated
its first serialisation query. All other such queries save only hash | ||
code (i.e. reference) of the `irept` instance. | ||
|
||
The similar strategy is used for serialisation of string constants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A similar
src/goto-programs/README.md
Outdated
The similar strategy is used for serialisation of string constants | ||
shared amongst `irept` instances. Such a string is fully saved only in | ||
the first serialisation query of an `irept` instance it appears in and | ||
all other queries only save its integer has code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as code?
src/goto-programs/README.md
Outdated
- `read_bin_goto_object.h` | ||
- `read_bin_goto_object.cpp` | ||
|
||
First two modules are responsible for location of the stream with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first two
src/goto-programs/README.md
Outdated
|
||
First two modules are responsible for location of the stream with the | ||
serialised data within a passed file. And the remaining two modules | ||
perform the actual deserialisation of `goto_modelt` instance from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of a
src/goto-programs/README.md
Outdated
\subsubsection subsection-goto-binary-is-binary-file Checking file type | ||
|
||
You can use function `is_goto_binary` to check whether a passed file contains | ||
a sederialised `goto_modelt` instance or not. This is done by checking the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deserialised
src/util/README.md
Outdated
characters `0` and `\\` are escaped by writing additional `\\` | ||
before them. | ||
|
||
This is implmented in the function `write_gb_string` and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefix function with class name so that it is linked by doxygen
Requested updates are available. |
@marek-trtik, please rebase. |
988e26c
to
b25bdfe
Compare
@peterschrammel Done. |
@marek-trtik Would you mind squashing your commits? Then this one should be ready to be merged. |
b25bdfe
to
6cd614b
Compare
@tautschnig Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 6cd614b).
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
No description provided.