Skip to content

Class and function documentation for goto-symex-target [DOC-79] #3393

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

Merged
merged 1 commit into from
Dec 3, 2018

Conversation

xbauch
Copy link
Contributor

@xbauch xbauch commented Nov 13, 2018

Adding class and function documentation to goto-symex/symex_target. {h,cpp} and goto-symex/symex_target_equation.{h,cpp}.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link

@majakusber majakusber left a comment

Choose a reason for hiding this comment

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

Generally looks good, a lot of useful docs added! I have mostly minor suggestions for formatting (sorry for all the fruits 🙂 first I wanted to mark all the places for the recurring comments with them but it's too much), here is a summary:

  • use imperative mood in function docs,
  • indent the overflowing lines by two spaces for better readability,
  • move docs of interface functions to headers,
  • I would suggest calling the guards preconditions and reformulating the sentence a bit (see 🍓).
    There are few other comments but nothing too big.

/// \param guard: condition to take this read event
/// \param ssa_rhs: variable to be read from
/// \param atomic_section_id: ID of the atomic section in which this read
/// takes place

Choose a reason for hiding this comment

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

⛏️ Indent by 2 spaces for better readability. 🍌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, and hopefully all the bananas.

Copy link

@majakusber majakusber Nov 15, 2018

Choose a reason for hiding this comment

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

Thanks, I think only one space is added now but that's probably enough 🙂 (maybe you ran into the same mistake I sometimes make - hitting tab right after the /// results in adding one space only but hitting tab at the place where text starts one space after the /// indents by 2 spaces then)

Copy link
Contributor

@allredj allredj left a 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: c0b43da).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91244044

@@ -91,6 +91,11 @@ void goto_symext::symex_assign(
}
}

/// Store the \c what expression as the first unassigned 0th operand of the
Copy link
Member

Choose a reason for hiding this comment

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

I personally find what easier to read.

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about using \p to also make clear this refers to a parameter (and not just some arbitrary code)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (throughout the PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A swapped backslash-c with back-ticks throughout the PR.

@@ -91,6 +91,11 @@ void goto_symext::symex_assign(
}
}

/// Store the \c what expression as the first unassigned 0th operand of the
/// \c lhs.
/// \param lhs non-symbol pointed-to expression
Copy link
Member

Choose a reason for hiding this comment

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

lhs: Non-... according to coding style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, here and elsewhere.

/// \c lhs.
/// \param lhs non-symbol pointed-to expression
/// \param what the expression to be added to the \c lhs
/// \return the resulting expression
Copy link
Member

Choose a reason for hiding this comment

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

\return The... according to coding style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also done.

/// \param guard: condition to take this read event
/// \param ssa_rhs: variable to be read from
/// \param atomic_section_id: ID of the atomic section in which this read
/// takes place
Copy link
Member

Choose a reason for hiding this comment

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

It would increase readability to indent here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -91,6 +91,11 @@ void goto_symext::symex_assign(
}
}

/// Store the \c what expression as the first unassigned 0th operand of the
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about using \p to also make clear this refers to a parameter (and not just some arbitrary code)?

@@ -17,6 +17,9 @@ Author: Daniel Kroening, [email protected]
class ssa_exprt;
class symbol_exprt;

/// Base class for symbolic execution. Intended as a position identifier in the
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is a "position identifier?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if we have an established term to refer to program location. To the best of my understanding symex_targett has a similar purpose to const_target which is an iterator into a list of instructions. I tried rewording the description a bit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I see, actually a symex_targett is very different (although by now I'm not even sure it is a meaningful interface anymore, because we leak out symex_target_equationt all over the place). A symex_targett is the interface of the target container for symbolic execution to record its symbolic steps into. As far as I am aware, symex_target_equationt is the only implementation of that interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope you won't mind if I quote/paraphrase the above for the description.

Copy link
Member

Choose a reason for hiding this comment

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

symex_target_equationt is the only implementation of that interface.

Yes, afaik.

Copy link
Contributor

@allredj allredj left a 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: c3b447b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91500113

@xbauch
Copy link
Contributor Author

xbauch commented Nov 15, 2018

I think I've addressed all the @svorenova @peterschrammel and @tautschnig comments.

Copy link

@majakusber majakusber left a comment

Choose a reason for hiding this comment

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

Looks good to go, I just have one question about four functions without doc. But because this is already much better than what it was before I won't block the merge.

/// \param cond: Condition represented by this constraint
/// \param msg: The message associated with this constraint
/// \param source: Pointer to location in the input GOTO program of this
/// constraint

Choose a reason for hiding this comment

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

❓ I asked this before but it may have gotten lost - why are the last four functions below not documented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Copy link
Contributor

@allredj allredj left a 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: 7d77198).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91549113

@peterschrammel
Copy link
Member

@xbauch, can you squash the commits please?

@xbauch
Copy link
Contributor Author

xbauch commented Nov 16, 2018

Squashed.

Copy link
Contributor

@allredj allredj left a 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: fffc954).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91638896

@xbauch xbauch assigned peterschrammel and unassigned xbauch Nov 19, 2018
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

🚫
This PR failed Diffblue compatibility checks (cbmc commit: e399467).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93174124
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

@tautschnig
Copy link
Collaborator

@xbauch Could you please rebase to make sure the bot is re-triggered as the past failure was likely caused by unrelated problems?

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

A couple of suggestions and requests for changes below, but nothing blocking. The biggest item is using \copydoc to avoid duplicating the same text when functions are just implementations of an interface. In those cases please make sure the documentation genuinely was the same, else merge any missing bits into the documentation of the interface.

/// Store the \p what expression as the first unassigned 0th operand of the
/// \p lhs.
/// \param lhs: Non-symbol pointed-to expression
/// \param what: The expression to be added to the \c lhs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// \param what: The expression to be added to the \c lhs
/// \param what: The expression to be added to the \p lhs

@@ -391,6 +391,11 @@ class goto_symext
guardt &,
assignment_typet);

/// Store the \p what expression as the first unassigned 0th operand of the
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is an "unassigned" operand?

@@ -17,6 +17,9 @@ Author: Daniel Kroening, [email protected]
class ssa_exprt;
class symbol_exprt;

/// The interface of the target _container_ for symbolic execution to record its
/// symbolic steps into. Presently, symex_target_equationt is the only
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// symbolic steps into. Presently, symex_target_equationt is the only
/// symbolic steps into. Presently, \ref symex_target_equationt is the only

@@ -26,6 +29,9 @@ class symex_targett

virtual ~symex_targett() { }

/// Identifies source in the context of symbolic execution. Thread number
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might have to rethink the naming here - this really is a generalisation of the program counter with some additional context. But that's not for this PR.

@@ -65,21 +71,46 @@ class symex_targett
GUARD,
};

// read event
/// Read from a shared variable `ssa_rhs` (which will thus become a
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// Read from a shared variable `ssa_rhs` (which will thus become a
/// Read from a shared variable \p ssa_rhs (which will thus become a

/// \param guard: Precondition for this read event
/// \param ssa_rhs: Variable to be read from
/// \param atomic_section_id: ID of the atomic section in which this read
/// takes place
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// takes place
/// takes place (if any)

virtual void shared_read(
const exprt &guard,
const ssa_exprt &ssa_rhs,
unsigned atomic_section_id,
const sourcet &source)=0;

// write event
/// Write to a shared variable `ssa_rhs` (which will thus become a
/// left-hand side as well): we effectively assign a value from this thread
Copy link
Collaborator

Choose a reason for hiding this comment

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

As is done in the implementation, please rename "ssa_rhs" to "ssa_object" and then remove the parts in parentheses - this always was a left-hand side, it's not actually becoming one here.

/// \param guard: Precondition for this write event
/// \param ssa_rhs: Variable to be written to
/// \param atomic_section_id: ID of the atomic section in which this write
/// takes place
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// takes place
/// takes place (if any)

@@ -29,26 +29,55 @@ class decision_proceduret;
class namespacet;
class prop_convt;

/// Inheriting the interface of symex_targett this class represents the SSA
/// form of the input program as a list of SSA_stept. It further extends the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// form of the input program as a list of SSA_stept. It further extends the
/// form of the input program as a list of \ref SSA_stept. It further extends the

/// \param ssa_object: Variable to be read from
/// \param atomic_section_id: ID of the atomic section in which this read
/// takes place
/// \param source: Pointer to location in the input GOTO program of this read
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here and below: use \copydoc

@xbauch xbauch force-pushed the docu/symex_target branch from e399467 to cf97e60 Compare December 3, 2018 10:17
1) Document the symex_target interface.
2) Document the symex_target_equation
   -- Mostly SSA_stept and the transformations into it.
@xbauch xbauch force-pushed the docu/symex_target branch from cf97e60 to bff5bf4 Compare December 3, 2018 11:26
Copy link
Contributor

@allredj allredj left a 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: bff5bf4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93351125

@xbauch xbauch merged commit 38c8afe into diffblue:develop Dec 3, 2018
@xbauch xbauch deleted the docu/symex_target branch June 10, 2019 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants