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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • None
    • b96

      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/

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

              Created:
              Updated:
              Resolved: