Skip to content

Move generic information from decorated pointers to decorated tags #4114

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
Feb 11, 2019

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Feb 7, 2019

java_generic_parametert is reimplemented as a plain pointer to a decorated struct_tag_typet (currently always a java.lang.Object, but that will change when we support bounded generics). java_generic_typet is reimplemented as a plain pointer to the existing type java_generic_struct_tag_typet, which already expressed nested superclasses and now also specifies references.

The existing types (subclasses of java_reference_typet) are retained, but do not store any data themselves and simply forward their accessors to the underlying tag, meaning no changes are needed to existing code.

This means that a pointer is once again just a pointer, and can be removed and reapplied
without risking losing information. On the other hand tags now carry decorations more often
(they already played this role when expressing a superclass, which is implemented as a nested
struct), so ns.follow returns a type missing its decorations -- however this is hopefully
a small risk, as code using the decorated-pointer implementation would already need to know
that following the pointer, never mind the tag at the end of it, could lose information.

@smowton
Copy link
Contributor Author

smowton commented Feb 7, 2019

I've prototyped this with test-gen btw and seems all tests pass with no changes to its code

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

@smowton smowton force-pushed the smowton/cleanup/generics-on-tags branch from 4195069 to dd3afa1 Compare February 8, 2019 09:11
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: dd3afa1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100212017

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.

🎉 for not having decorated pointers!

IREP_ID_TWO(C_java_generics_class_type, #java_generics_class_type)
IREP_ID_TWO(C_java_implicitly_generic_class_type, #java_implicitly_generic_class_type)
IREP_ID_TWO(C_java_generic_symbol, #java_generic_symbol)
IREP_ID_TWO(generic_types, #generic_types)
IREP_ID_TWO(generic_types, generic_types)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be IREP_ID_ONE now?

@smowton
Copy link
Contributor Author

smowton commented Feb 8, 2019

@kroening can I take your thumbs-up for an approval?

@tautschnig
Copy link
Collaborator

@smowton clang-format seems unhappy.

This means that a pointer is once again just a pointer, and can be removed and reapplied
without risking losing information. On the other hand tags now carry decorations more often
(they already played this role when expressing a superclass, which is implemented as a nested
struct), so `ns.follow` returns a type missing its decorations -- however this is hopefully
a small risk, as code using the decorated-pointer implementation would already need to know
that following the pointer, never mind the tag at the end of it, could lose information.
@smowton smowton force-pushed the smowton/cleanup/generics-on-tags branch from f0bc22f to 6887863 Compare February 11, 2019 09:58
@smowton
Copy link
Contributor Author

smowton commented Feb 11, 2019

It appears clang-format was flagging stuff that had nothing to do with this PR? I've rebased to see if that fixes things, will merge if/when CI passes.

@tautschnig
Copy link
Collaborator

It appears clang-format was flagging stuff that had nothing to do with this PR?

I've seen that quite a lot already, but admittedly never investigated properly. It does seem to happen when there are a lot of PRs in flight.

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

@smowton smowton merged commit 7eb2862 into diffblue:develop Feb 11, 2019
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.

6 participants