Skip to content

Cleanups before splitting java_bytecode_parsert #5105

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

Conversation

NathanJPhillips
Copy link
Contributor

Non-behavioural changes in preparation for major refactoring of java_bytecode_parsert into separate load and parse stages.

  • 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.
  • N/A The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • N/A 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).
  • N/A 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.

Moved pool_entryt typedef earlier to use it in two more places
Use existing functions is_java_array_tag and java_array_element_type
Changed control flow to remove redundant check
result <<= 8;
result |= in->get();
result <<= 8u;
result |= static_cast<u1>(in->get());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we try to use narrow_cast in this situation

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'm just making it unsigned.

#define ACC_STRICT 0x0800u
#define ACC_SYNTHETIC 0x1000u
#define ACC_ANNOTATION 0x2000u
#define ACC_ENUM 0x4000u
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this block was better before

Copy link
Contributor Author

@NathanJPhillips NathanJPhillips Sep 12, 2019

Choose a reason for hiding this comment

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

I agree. I ran it through clang-format because I added the u unsigned postfix. Should I undo that? 🔔

#define ACC_ABSTRACT 0x0400u
#define ACC_SYNTHETIC 0x1000u
#define ACC_ANNOTATION 0x2000u
#define ACC_ENUM 0x4000u
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this block looked better before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🔔

@@ -1565,8 +1565,13 @@ class reference_typet:public pointer_typet
template <>
inline bool can_cast_type<reference_typet>(const typet &type)
{
return can_cast_type<pointer_typet>(type) && type.get_bool(ID_C_reference) &&
!type.get(ID_width).empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you think it's better to move this check to validation? You could add a reason to the commit message.

A reference type without a width is still a reference type, it's just an invalid one.
Rather than the cast failing, a DATA_INVARIANT should be put on this property.
Mostly relate to signed/unsigned mismatch and passing as const reference
@NathanJPhillips NathanJPhillips merged commit fcbbb59 into diffblue:develop Sep 13, 2019
@NathanJPhillips NathanJPhillips deleted the cleanup/pre-split-parser branch September 13, 2019 11:36
@owen-mc-diffblue
Copy link
Contributor

@NathanJPhillips You didn't address @smowton 's comment that you should use clang-format off to avoid reformatting those two big blocks. Was that an oversight or did you choose not to take the suggestion?

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

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.

4 participants