Add two situations where the cache is pruned on startup, removing all
the cached objects from storage:
1. the version field does not match the current one
2. the model has been changed out of band
The second one is very important as it allows to use the revng2 CLI
while editing the model manually on disk.
Remove a few `Artifact` classes from `revng.support.artifact`. These
were needed to handle the idiosyncrasies of the legacy pipeline. Some of
the logic has been reworked into the ptml code.
Rework the python mixin infrastructure for the model. Mixins are now
specified explicitly instead of using the `ast` module. The mixins are
loaded relative to the generated python file, this allows to have two
models: `revng.model` and `revng.project.model`. The latter is augmented
via mixins to have project-specific facilities such as `get_artifact`
and artifact accessors.
Overhaul the pipeline configuration logic by collapsing all dynamic
configuration options, both for analyses and pipes into a single
dictionary. Change all the interfaces so that there is no longer
distinction between the configuration of an analysis and of pipes.
Expose these options to the command line via `--{name}-configuration`
options for each pipe/analysis that is applicable to the command-line
invocation.
Ignore `OSError`s in `LocalStorageProvider` when rebuilding the list of
files for a given hash, since those paths might have become inaccessible
in the meantime.
Click clamps the output of its help to 80 columns, this makes reading
the help on wider terminals quite annoying. Change the formatter class
used to allow better help output on wider terminals.
Add an additional piece of metadata that states which pipes are used to
compute a specific artifact. This can be used to derive which
configuration options influence the creation of an artifact.
Rework the artifact endpoint, making it similar to the CLI invocation.
It now works on a single artifact and can be made to return both `json`
and `tar` as formats.
Change the `Container.serialize` interface so that it is possible to
supply a list of objects that will be serialized instead of all the ones
in the container.
Add two additional fields to `Artifact`: `defined_locations` and
`preferred_artifacts`. These are pieces of metadata that allow
navigation between multiple PTML-enabled documents.
Add categories in the pipeline, allow an artifact to have a category
specified which allows it to be shown or hidden by default. Adapt the
CLI tools to hide artifacts of the category that don't
`show_by_default=True`.
Since most functions in `pipeline_parser.py` had a lot of redundancy in
the parameters passed, convert all of them to be part of a
`PipelineParser` class which stores all the variables.
Rework which information is transmitted in the pipeline metadata,
avoiding redundancy and moving some information there instead of
returning it every time a request is made.
The `EmitFieldAccesses` pass transforms `clift` by taking pointer-typed
expressions computed via integerr arithmetic with type-safe field
accesses and array accesses.
The transformation is split in three main phases:
1) `PointerArithmetic` computation.
2) `BestTraversal` computation.
3) `FieldAccess` `clift` rewrite.
The high level driver is implemented in the `EmitFieldAccesses` header
and cpp, while the nested 3 phases are implemented respectively in
`PointerArithmetic`, `BestTraversal` and `FieldAccessReplacement`.
The `computerPointerArithmetic` phase is concerned with taking a
pointer-typed `ExpressionOp`, called `PointerToReplace`, and expressing
it in a `BasePointer+Offset` form.
The `computeBestTraversal` phase is concerned with computing the best
traversal of the type pointed to by `BasePointer`, that can be used to
rewrite the pointer arithmetic in `clift` with just field accesses and
array subscripts.
The `replaceFieldAccess` phase takes the `Traversal` computed at the
previous step, and actually rewrites in `clift` the `PointerToReplace`
in terms of field accesses and array accesses w.r.t. the `BasePointer`.
Add the `--analyses` option which allows specifying the list of analyses
to be run before producing the artifact instead of the default initial
auto analysis.
Before this commit the `invalidate` code did invalidate all the objects
but left all the rows in `dependencies` that were paired to the produced
objects except the invalidated paths.
In this commit the logic is changed to be done in 3 steps:
1. SELECT all the objects that need to be invalidated, write down their
rowid
2. Delete all the rows in `dependencies` that were produced in
conjunction to the objects from (1)
3. Remove the objects from the table, returning invalidation data
This guarantees that the database does not accumulate invalidation data
over time due to invalidations.
Change the `get_model` and `set_model` interface of `StorageProvider` so
that it is responsibility of the `StorageProvider` to
serialize/deserialize the model before returning to the caller.
This is in preparation to the model migration being implemented, since
it's now a responsibility of the storage provider to deserialize it it
can trivially re-save it to disk if it is migrated.
Overhaul the logic and method names involved in enabling and disabling
reference caching in `TupleTree<T>`. `TupleTreeReference<T, U>` now
lazily caches the target and will traverse the path only when needed.
Also expose and use these functions in the new pipeline, which should
provide some speedup when executing a `Schedule`.
The functions that take care of running an analysis/analysis list have a
lot of duplication, merge the two into a single function that takes care
of running both.
Fix the code that handles setting the `--format`, `--tar` and `--yaml`
command line options, which incorrectly wrote to the `format` kwargs
instead of the `container_format` one.
Instead of executing `chdir` when using the `-C` option, which is
fragile when other paths are involved, store the option in the click
context and propagate it to the required code paths that require knowing
what the base directory is.