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

Various fixes/cleanup #487

Merged
merged 10 commits into from
Jul 15, 2023
Merged

Various fixes/cleanup #487

merged 10 commits into from
Jul 15, 2023

Conversation

ThomasHaas
Copy link
Collaborator

@ThomasHaas ThomasHaas commented Jul 13, 2023

This PR adds minor fixes and cleanup:

  • ExecutionStatus is printed as not_exec(...) instead of status(...) to more clearly convey its semantics.
  • ExecutionStatus now can assign to boolean registers. If possible, compilation schemes were updated to use boolean registers. Also, in many cases the ExecutionStatus was removed from compilation cause it served no purpose (it was dead code).
  • Fixed an issue with DirectFunctionCall.copy() where metadata was not copied over. This caused SourceLocation information to get lost.
  • More generally, the Inlining pass preserves more metadata when inlining code. The FunCall and FunRet code annotations have been renamed to FunCallMarker and FunReturnMarker to better distinguish them from actual calls/returns.
  • ThreadCreation now assigns OriginalId (which was previously done after parsing).
  • The logging of RelationAnalysis was cleaned up.
  • Fixed an issue where ExecutionModel would complain about uninitialized registers if they were assigned by a ThreadArgument.
  • Changed witness generation to include threading-related events.

- Add OIds in ThreadCreation
- Copy metadata from call statements into marker events when inlining.
- Fixed ExecutionModel printing warnings for ThreadArguments
- Renamed FunCall/FunRet to FunCallMarker/FunReturnMarker to distinguish them from proper call/return events.
- Made more internals of AbstractEvent private.
Use boolean type register for ExecutionStatus whenever possible.
…elated events.

Increased weighting of po-edges
@@ -89,10 +87,9 @@ public void generateGraphOfExecutionModel(Writer writer, String graphName, Execu
}

private boolean ignore(EventData e) {
return !e.getEvent().hasMetadata(SourceLocation.class) && !e.isInit();
return false; // We ignore no events for now.

Choose a reason for hiding this comment

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

isn't this affection our current witness generation?

Copy link
Collaborator Author

@ThomasHaas ThomasHaas Jul 13, 2023

Choose a reason for hiding this comment

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

Yes, it affects it. The only events that have no source location are the two events used to start/end a thread.
I think we should print them, despite them not having a source location.

You should probably run the code to look at both the new logging output and the generated witnesses.
If you dislike anything about that, I can change it.

Choose a reason for hiding this comment

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

I thought we were ignoring everything instead of not ignoring anything. I will do some manual testing tomorrow and check

Choose a reason for hiding this comment

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

Some addresses get a null representation in graphviz witnesses, see e.g. ticketlock with -DACQ2RX

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, the NULL entries should already have been there before.
It seems we simply do not construct init events for the members of the lock variable, cause Smack fails to init properly.
That problem should already exist on development.

While debugging, I noticed that we now do create a lot of memory objects related to smack internals.
I will try to fix this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I fixed both issues. We now assume that Smack generated correct static initialization code IFF it generated at least one init value. This might be wrong if there is the possibility that Smack generates some but not all initialization of a memory object (i.e., it generates partial initialization).

case "pthread_mutex_destroy":
// TODO: These are skipped for now
VisitorBoogie.logger.warn(
"Skipped call to {} because the function is not supported right now.", funcName);
return true;
case "pthread_exit":
final Expression retVal = (Expression) ctx.call_params().exprs().expr(0).accept(visitor);
visitor.addEvent(EventFactory.newFunctionReturn(retVal));

Choose a reason for hiding this comment

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

is it true that a pthread_exit acts simply as a function return?

Copy link
Collaborator Author

@ThomasHaas ThomasHaas Jul 14, 2023

Choose a reason for hiding this comment

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

In principle it is reversed: a return acts as a pthread_exit I believe. Not that it really matters: both terminate the thread and produce a value that can be read by pthread_join.

Edit: There seems to be a slight difference in practice in that return unwinds the stack while pthread_exit does not, so that scope-allocated stuff is not automatically freed in the latter case (only relevant for C++ I believe?). Either way, semantically return and pthread_exit are identical.

Avoid creating memory for procedure address constants.
RelationAnalysis now logs #Relations and #Axioms
@hernanponcedeleon
Copy link
Owner

LGTM

@hernanponcedeleon hernanponcedeleon merged commit 0f327ea into development_rework Jul 15, 2023
1 check passed
@hernanponcedeleon hernanponcedeleon deleted the fixes branch July 15, 2023 14:41
hernanponcedeleon added a commit that referenced this pull request Jul 15, 2023
Add proper functions #470
Generic Registers #471
Rmw base classes #475
Type Safety #478
Parsing & thread creation #479
Unit tests for thread creation #481
Move memory initialization, inlining, and thread creation from the parser to processing passes #483
Inlining of nondet_int #485
Various fixes/cleanup #487

---------

Co-authored-by: Thomas Haas <[email protected]>
Co-authored-by: René Pascal Maseli <[email protected]>
Co-authored-by: Hernan Ponce de Leon <[email protected]>
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