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

Method::is_accessor should cover getters and setters for all types

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b96

      Description

      The comment for the method says:

        // returns true if the method is an accessor function (setter/getter).
        bool is_accessor() const;

      ...but the implementation only accepts non-(long|double|float) getters:

      bool Method::is_accessor() const {
        if (code_size() != 5) return false;
        if (size_of_parameters() != 1) return false;
        if (java_code_at(0) != Bytecodes::_aload_0 ) return false;
        if (java_code_at(1) != Bytecodes::_getfield) return false;
        if (java_code_at(4) != Bytecodes::_areturn &&
            java_code_at(4) != Bytecodes::_ireturn ) return false;
        return true;
      }

      Method::is_accessor is used in compilers to exempt trivial methods from the usual inlining limits, profiling, and C2 compiles in tiered. There seems to be no reason to skip any setters and/or any types.

      Proof-of-concept change:
        http://cr.openjdk.java.net/~shade/8140650/webrev.00/

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shade Aleksey Shipilev
                Reporter:
                shade Aleksey Shipilev
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: