src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp
author zgu
Sat, 13 Jul 2019 12:15:17 -0400
changeset 55760 bf8128faace1
permissions -rw-r--r--
8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task Reviewed-by: rkennke
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55760
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     1
/*
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     3
 *
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     6
 * published by the Free Software Foundation.
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     7
 *
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    12
 * accompanied this code).
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    13
 *
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    17
 *
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    20
 * questions.
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    21
 *
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    22
 */
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    23
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    24
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    25
#include "precompiled.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    26
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    27
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    28
#include "gc/shenandoah/shenandoahCodeRoots.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    29
#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    30
#include "gc/shenandoah/shenandoahParallelCleaning.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    31
#include "runtime/safepoint.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    32
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    33
ShenandoahClassUnloadingTask::ShenandoahClassUnloadingTask(BoolObjectClosure* is_alive,
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    34
                                                           uint num_workers,
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    35
                                                           bool unloading_occurred) :
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    36
  AbstractGangTask("Parallel Class Unloading Task"),
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    37
  _unloading_occurred(unloading_occurred),
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    38
  _code_cache_task(num_workers, is_alive, unloading_occurred),
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    39
  _klass_cleaning_task() {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    40
  assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    41
}
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    42
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    43
void ShenandoahClassUnloadingTask::work(uint worker_id) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    44
  ShenandoahEvacOOMScope scope;
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    45
  _code_cache_task.work(worker_id);
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    46
  // Clean all klasses that were not unloaded.
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    47
  // The weak metadata in klass doesn't need to be
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    48
  // processed if there was no unloading.
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    49
  if (_unloading_occurred) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    50
    _klass_cleaning_task.work();
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    51
  }
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    52
}