-
Notifications
You must be signed in to change notification settings - Fork 273
Replace fresh_java_symbol in object factory #4457
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
Replace fresh_java_symbol in object factory #4457
Conversation
All variations of Allocating a global creates a static-lifetime symbol and with it an allocation of memory that lives as long as the program Allocating a local creates a non-static-lifetime symbol, which itself doesn't embody memory, but the DECL / code_declt instruction that is also created allocates memory that lives as long as the function containing it (in practice when we do this in __CPROVER__start that memory lives as long as the program) Allocating using the actual ALLOCATE instruction produces a fresh block of memory every time it is executed; since we don't implement |
@antlechner Doxygen failure:
|
We have access to an allocate_objectst instance that stores most of the information we need and also automatically takes care of variable declarations, so we don't have to worry about creating a code_declt after every new symbol creation.
8f820ec
to
1c57732
Compare
@owen-jones-diffblue I added Doxygen for the new parameter. |
@antlechner There still is a difference, and it isn't all that different from dynamic execution: statically allocated objects will get an entry in the symbol table (e.g., you will find them in |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 1c57732).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106785302
@tautschnig Thank you, that clarifies things a lot. I had thought about this only from a CBMC/JBMC perspective and hadn't considered other related tools. I'll try to find time to document these differences in |
It looks to me like
allocate_objectst
, which is a relatively new class, is supposed to take care of all kinds of variable and memory allocations for both Java and C now. It seems likely that we will eventually want to replace all calls tofresh_java_symbol
with calls toallocate_objectst::allocate_automatic_local_object
.I am not 100% sure if this is really the intention behind the new class, which is why am making the change in the object factory only for now, and hoping to get some comments from reviewers to clarify if this should be done elsewhere as well.
A related question is the naming of the methods of
allocate_objectst
: all of them start withallocate_...
, while only the dynamic version corresponds to anALLOCATE
in the GOTO program; the others just create new variable symbols but don't allocate any memory. I found this quite confusing, is there a good reason behind the common name?Any advice on this would be appreciated.