Skip to content

Conversation

@jerhard
Copy link
Member

@jerhard jerhard commented May 31, 2022

With this PR, the incremental data is stored to a single file.

Now, incremental data is kept in-memory, maintained by Serialize.Cache. Data stored on disc can be loaded into memory with load_data, and stored from the cache to disk with store_data.
Retrieving the data from there can be done using a GADT, giving some type safety for the stored data with static type. As the the types for solver and analysis data are determined at run time, they are still kept as Obj.t in the cache.

Closes #357.

jerhard added 2 commits May 31, 2022 17:20
Incremental data is kept in-memory, maintained by Serialize.Cache.
Retrieving the data from there can be done using a GADT.
@jerhard jerhard added the cleanup Refactoring, clean-up label May 31, 2022
@jerhard jerhard requested a review from stilscher May 31, 2022 15:39
@sim642 sim642 self-requested a review May 31, 2022 15:41
Comment on lines 46 to 49
solver_data: Obj.t option ref;
analysis_data: Obj.t option ref;
version_data: MaxIdUtil.max_ids option ref;
cil_file: Cil.file option ref;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of refs, the fields could simply be mutable.

Also, why are they all options? When would we ever have incremental data that doesn't have all four components present? I think we always need all of them (or have none of them), so the whole record could be optional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of refs, the fields could simply be mutable.

Done.

Also, why are they all options? When would we ever have incremental data that doesn't have all four components present? I think we always need all of them (or have none of them), so the whole record could be optional.

The issue is that during the initial analysis, these fields would not all become available at the same time. Namely, the Cil file and the max ids would become available after parsing (in Maingoblint), while the solver and analysis data only becomes availabe after solving the constraint system.

If one were to make the fields in the record non-optional, one would have to drag the cil file and max ids around until all of the data is available, so that one can set them in the record here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could potentially have two different records for the data that was read from the previous run and for the data that one produces in the current run. Then in first record the fields would be non-optional and in the other they would be optional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these fields would not all become available at the same time

Right. At some point this bothered me before, but I think we can keep them optional for now.

At some point it might be useful to have them all in an immutable record that's read and created as a whole, because storing them at different times maybe can cause some inconsistencies during server mode or such. For example, if the new file is parsed and stored, the solving starts but is aborted, then the cache possibly has inconsistent state.

jerhard added 6 commits June 1, 2022 10:55
in some intermediate version of the code refs were used, as they make it possbile to extract the code that obtains the reference to a field into a separate method.
This is no longer needed.
Remove "Request" suffix for variants of the data_query constructor.
…ype.

This way, it can be avoided to do an explicit cast via Obj.obj when querying the AnalysisData.
Copy link
Member

@sim642 sim642 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this, but the code looks like it should.

@jerhard jerhard merged commit af3a084 into master Jun 8, 2022
@jerhard jerhard deleted the issue_357_new branch June 8, 2022 08:18
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Refactoring, clean-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Marshal all data into single file

2 participants