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

G1: Unnecessary NULL check in G1KeepAliveClosure

    XMLWordPrintable

    Details

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

      Backports

        Description

        The null check in the following code is not necessary:

        class G1KeepAliveClosure: public OopClosure {
          ...
          void do_oop(oop* p) {
            oop obj = *p;

            G1CollectedHeap::in_cset_state_t cset_state = _g1->in_cset_state(obj);
            if (obj == NULL || cset_state == G1CollectedHeap::InNeither) {
              return;
            }

        As Thomas pointed out, G1KeepAliveClosure is only called from JNIHandleBlock::weak_oops_do which already filters out NULL values.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                tonyp Tony Printezis
                Reporter:
                tonyp Tony Printezis
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: