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

Improve handling of bounds in message contexts #844

Closed
treiher opened this issue Nov 10, 2021 · 0 comments · Fixed by #889
Closed

Improve handling of bounds in message contexts #844

treiher opened this issue Nov 10, 2021 · 0 comments · Fixed by #889
Assignees
Labels
generator Related to generator package (SPARK code generation)

Comments

@treiher
Copy link
Collaborator

treiher commented Nov 10, 2021

The current semantics of the bounds of message context makes using the contexts unnecessary cumbersome. In several use cases, Last must be explicitly set to ensure correct behavior. It should be possible to improve the usability by distinguishing between different kinds of bounds:

  • First, Last: Limit usable range of buffer
    • Fix after initialization (especially important when serializing/parsing an inner message)
  • Verified_Last (formerly Message_Last): Position of last bit of last verified field
    • Set to First - 1 on context initialization
    • Increased after setting or verifying field
    • Set to First - 1 on reset or write
  • Written_Last: Position of last bit containing parsable data
    • Set to First - 1 or Last on context initialization
    • Increased or kept after writing data into context
    • Set to First - 1 on reset
    • Set to Verified_Last when setting field

Invariants

  • Verified_Last <= Written_Last
  • First - 1 <= Verified_Last <= Last
  • First - 1 <= Written_Last <= Last

This is just a design concept. It must be verified whether this concept is suitable for all use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Related to generator package (SPARK code generation)
Projects
None yet
1 participant