Skip to content

Use irept instead of symbol_exprt in java_lambda_method_handlest [blocks: #2310] #3286

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 2 commits into from
Nov 10, 2018

Conversation

tautschnig
Copy link
Collaborator

A java_lambda_method_handlest really is just a collection of identifiers - there
is no need to put them into a symbol_exprt, instead the identifier can directly
be used as the id of an irept. This reduces the memory footprint, but more
importantly avoids a warning of using a deprecated symbol_exprt constructor.
This warning is well placed, because those symbol_exprt would never have a type
set, which makes them invalid symbol_exprt anyway.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@tautschnig tautschnig force-pushed the lambda_method_handles branch from 6a6ca5a to 6d99326 Compare November 7, 2018 07:39
@tautschnig tautschnig changed the title Use irept instead of symbol_exprt in java_lambda_method_handlest Use irept instead of symbol_exprt in java_lambda_method_handlest [blocks: #2310] Nov 7, 2018
@tautschnig tautschnig force-pushed the lambda_method_handles branch from 6d99326 to 75b935c Compare November 7, 2018 08:25
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: 6d99326).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90526786
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.

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: 75b935c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90530732

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: 193bb15).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90579104
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.

Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

On the face of it seems reasonable - but some thought went in to this so would like the time to properly consider and check with TG as I don't recall why we opted for symbol_exprt here

@tautschnig tautschnig assigned thk123 and unassigned tautschnig Nov 8, 2018
@tautschnig
Copy link
Collaborator Author

@thk123 +1 for careful evaluation with TG, please do re-assign as appropriate.

@tautschnig tautschnig force-pushed the lambda_method_handles branch from 193bb15 to 592db89 Compare November 9, 2018 10: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.

⚠️
Diffblue compatibility check is currently unavailable.
Please create manual bump.
(cbmc commit: 592db89).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90843000

@tautschnig tautschnig force-pushed the lambda_method_handles branch from 592db89 to 2e2a8a3 Compare November 9, 2018 12:58
Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

So this is fine - I think we will revisit this - this is as far as lambdas get at the moment (i.e. they still don't work) - it might be it makes sense to put a bespoke

class lambda_method_handlet : public irept
{
  irep_idt lambda_identifier() const;
  code_tyept lambda_type() const;
  // lambda type?
}

but lets wait until we know what we need rather than second guessing it.

The only thing I might suggest now is typedef lamdba_method_handle_identifiert as an irept so more obvious that it isn't a tree of stuff, just a name. In fact, would:

class lambda_method_handle_identifiert : private irept
{
public:
  explicit lambda_method_handle_identifiert(const irep_idt &identifier) : irept(identifier)
  lambda_identifier() const { return id(); }
}

be a good immediate solution? (i.e. using private inheritance to essentially make this behave like an irep_idt)

Anyway - it's fine as it is until we know what we do with the data next.

@thk123
Copy link
Contributor

thk123 commented Nov 9, 2018

I made a manual bump but I don't expect it to break anything (and indeed Joel-bot linked to a passing build) https://github.com/diffblue/test-gen/pull/2458

@tautschnig
Copy link
Collaborator Author

Why would you suggest private inheritance here? I think the one with public inheritance would work fine, though. Just not entirely sure whether it's worth the effort if you are about to rewrite some of this anyway?

@thk123
Copy link
Contributor

thk123 commented Nov 9, 2018

Well "about to" is probably pushing it! Happy for it to go in as is 🙂

I'm not sure about private inheritance - there is nothing specific to this case that means it should be used over any other irep-inheriting class, but I think it might be a good idea:

AFAICT it would forbid direct irep manipulation (a major source of bugs/refactoring pain when people just add random sub trees and extra data inconsistently) to make them behave more like properly typed C++ classes, but wouldn't have any performance impact or require any major restructuring (only need to remove direct irep access - but these probably should be removed anyway).

@thk123
Copy link
Contributor

thk123 commented Nov 9, 2018

TG bump has passed

@tautschnig tautschnig force-pushed the lambda_method_handles branch from 2e2a8a3 to 49d4914 Compare November 9, 2018 17:07
@tautschnig
Copy link
Collaborator Author

@thk123 I've gone the coward's route and only included your suggestion as a comment rather than changing the code at this point. I hope that's ok?

@tautschnig tautschnig assigned tautschnig and unassigned thk123 Nov 9, 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: 49d4914).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90890870
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.

A java_lambda_method_handlest really is just a collection of identifiers - there
is no need to put them into a symbol_exprt, instead the identifier can directly
be used as the id of an irept. This reduces the memory footprint, but more
importantly avoids a warning of using a deprecated symbol_exprt constructor.
This warning is well placed, because those symbol_exprt would never have a type
set, which makes them invalid symbol_exprt anyway.
@tautschnig tautschnig force-pushed the lambda_method_handles branch from 49d4914 to 68d7791 Compare November 10, 2018 08:39
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: 68d7791).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90938940

@tautschnig tautschnig merged commit e24e948 into diffblue:develop Nov 10, 2018
@tautschnig tautschnig deleted the lambda_method_handles branch November 10, 2018 09:53
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.

7 participants