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

Rename Node_Array::Size()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 21
    • hotspot
    • b20
    • generic
    • generic

      Node_List inherits Node_Array, so it inherits uint Size() const.

      To resolve naming conflict, Node_List uses size() (with little s) and keep Size() to return its capacity. I don't think it's a good practice to use capital initial to distinct two functions. In particular they have different meanings.

      I'd hide name Size in Node_List. It turns out there are 4 instances does use Node_list::Size() and they are all legit.

      * For target hotspot_variant-server_libjvm_gtest_objs_BUILD_GTEST_LIBJVM_link:
      /local/home/xxinliu/Devel/jdk/src/hotspot/share/opto/loopnode.cpp:4471: error: undefined reference to ‘Node_List::Size() const’
      /local/home/xxinliu/Devel/jdk/src/hotspot/share/opto/loopnode.cpp:4546: error: undefined reference to ‘Node_List::Size() const’
      /local/home/xxinliu/Devel/jdk/src/hotspot/share/opto/loopnode.cpp:6359: error: undefined reference to ‘Node_List::Size() const’
      /local/home/xxinliu/Devel/jdk/src/hotspot/share/opto/output.cpp:3075: error: undefined reference to ‘Node_List::Size() const’

      One option is rename Node_Array::Size() to max(). this can avoid confusing names.
      Alternatively, we could provide capacity() in Node_list and replace Node_List::Size() with it.

            xliu Xin Liu
            xliu Xin Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: