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

G1: Unnecessary NULL check in G1KeepAliveClosure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • hotspot
    • gc
    • b33

        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.

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

                Created:
                Updated:
                Resolved: