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

Remove unnecessary weak_oops_do call in adjust weak roots phase

XMLWordPrintable

    • gc
    • b20

      In `G1FullGCAdjustTask`, the following code is for updating pointers to the new locations of objects. This is after ref-processing phase, so discovered lists are empty; all elements are either dropped or pushed onto the pending list. Therefore, the `weak_oops_do` call is a no-op.

      ```
        // Adjust the weak roots.
        if (!Atomic::cmpxchg(&_references_done, false, true)) {
          G1CollectedHeap::heap()->ref_processor_stw()->weak_oops_do(&_adjust);
        }

        AlwaysTrueClosure always_alive;
        _weak_proc_task.work(worker_id, &always_alive, &_adjust);
      ```

      The Serial and Parallel collector also have the same issue, in `genCollectedHeap.cpp` and `psParallelCompact.cpp` respectively.

            ayang Albert Yang
            ayang Albert Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: