Skip to content
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

Improved memory handling #639

Merged
merged 15 commits into from
Mar 20, 2024
Merged

Improved memory handling #639

merged 15 commits into from
Mar 20, 2024

Conversation

ThomasHaas
Copy link
Collaborator

@ThomasHaas ThomasHaas commented Mar 16, 2024

This PR improves handling all around memory, partially addressing the needs of #136:

  • MemoryObject now has anallocationSite (an Alloc event) which is non-null for dynamic allocations.
  • MemoryObject.address is gone (the MemoryObject itself already represents an address).
  • Alloc is now a proper core event (also moved to the core package) and does not get replaced by Local anymore (the alias analysis has been adapted to support this).
  • ProgramEncoder.encodeMemory now assigns actual addresses to memory objects. For now, it still generates a static memory layout (i.e., fixed addresses) but now it is also possible to encode complex memory layouts (in particular dynamic one's).
  • MemoryObject does not automatically add initial values for static allocations. This is responsibility of the parser frontend: ProgramBuilder will now explicitly add init values for litmus tests.
  • MemoryAllocation does not distinguish between litmus and non-litmus code anymore. It always only generates init events for explicitly initialized events. As above, responsibility of generating initial values is in the parser rather than the allocation pass.
  • There is some minor cleanup
    -- MemoryObject.cVar is now just MemoryObject.name to be more general.
    -- MemoryObject.isAtomic is gone since it was unused.
    -- MemoryObject.index is renamed to MemoryObject.id (it was never an index to anything)

As far as I see, the only step that is missing to support dynamically-sized allocations is extending MemoryObject.size to be a proper Expression (as discussed in #136).
The biggest obstacle to this change is the current alias analysis. However, I think the new one in #616 might have an easier time supporting dynamic sizes.

Minor refactor in MemoryObject
…sses)

- The ProgramEncoder now encodes the memory layout
- Renamed MemoryObject.cVar to MemoryObject.name (more general)
- Allocs are not replaced by Local events anymore (they are core events now)
- Adapted FieldSensitiveAndersen to understand new Alloc events.
- Allocs are now core events and do not get replaced anymore.
- Adapted FieldSensitiveAndersen to understand new Alloc events.
@ThomasHaas ThomasHaas changed the base branch from master to development March 16, 2024 17:19
- Removed litmus distinction in MemoryAllocation
…we still use integers in practice)

- Removed automatic initialization for static MemoryObjects. Instead, the ProgramBuilder will do so explicitly when building from litmus code.
…ariables.

- Use helper method makeZero in ProgramBuilder
- Minor improvements in Alloc
@hernanponcedeleon hernanponcedeleon merged commit 33cc9af into development Mar 20, 2024
1 check passed
@hernanponcedeleon hernanponcedeleon deleted the memoryObject_rework branch March 20, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants