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

[Nestmates] Cleanup instanceKlass.cpp

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 12
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b17

      Description

      John writes:

      [1] There's a typo "accesss" in InstanceKlass::has_nestmate_access_to.

      [2] The loop in InstanceKlass::has_nest_member should exit after the
      first encounter where name == k->name(), since there's no more
      work to do there.

      [3] It occurs to me that this loop (looking for name == k->name()) could
      be improved slightly by first inspecting the resolution state of
      _constants->klass_name_at(cp_index). If it's already resolved,
      then there's no need to mess with names; a pointer comparison
      will finish the job. That's probably a common occurrence, since
      nest member checks tend to happen after classes are resolved.

      [4] I read all the nestmate query code in jvm.cpp and instanceKlass.cpp,
      found it read well. I had one point of confusion, though, which makes
      me suggest a tweak next time you touch that code: The query
      ik->nest_members() looks parallel to ik->nest_host(), but n_m is
      just unvalidated indexes and n_h is validated. I suppose the
      thing could be named nest_member_indexes, but that seems like
      overkill. But a comment in instanceKlass.hpp on nest_members
      and nest_host_index might say clearly that the data in those
      slots are not validated.

        Attachments

          Activity

            People

            Assignee:
            dholmes David Holmes
            Reporter:
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: