Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8370031

Make RegMask copy constructor explicit and replace RegMask operator= with named function

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 26
    • hotspot

      The RegMask copy constructor is currently non-explicit. Making it explicit catches a few probably unintended register mask copies in the below methods.
      - Matcher::divI_proj_mask
      - Matcher::modI_proj_mask
      - Matcher::divL_proj_mask
      - Matcher::modL_proj_mask
      These methods could and should return a const RegMask&, but instead (implicitly) construct a new RegMask. Making the copy constructor explicit guarantees we catch and do not introduce similar cases in the future.

      RegMask additionally relies on overloading operator= for deep copy assignment, which somewhat conflicts with the HotSpot coding style ("Avoid most operator overloading, preferring named functions"). We should replace the overloaded operator= with a named function.

            dlunden Daniel Lunden
            dlunden Daniel Lunden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: