src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.inline.hpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 55760 bf8128faace1
permissions -rw-r--r--
8234748: Clean up atomic and orderAccess includes Reviewed-by: dholmes
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
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHPARALLELCLEANING_INLINE_HPP
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    25
#define SHARE_GC_SHENANDOAH_SHENANDOAHPARALLELCLEANING_INLINE_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/shared/weakProcessor.inline.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    28
#include "gc/shenandoah/shenandoahHeap.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    29
#include "gc/shenandoah/shenandoahParallelCleaning.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    30
#include "gc/shenandoah/shenandoahUtils.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    31
#include "runtime/thread.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    32
#include "runtime/safepoint.hpp"
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    33
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    34
template<typename IsAlive, typename KeepAlive>
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    35
ShenandoahParallelWeakRootsCleaningTask<IsAlive, KeepAlive>::ShenandoahParallelWeakRootsCleaningTask(IsAlive* is_alive,
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    36
                                                                                                     KeepAlive* keep_alive,
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    37
                                                                                                     uint num_workers) :
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    38
  AbstractGangTask("Parallel Weak Root Cleaning Task"),
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    39
  _weak_processing_task(num_workers),
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    40
  _is_alive(is_alive), _keep_alive(keep_alive) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    41
  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
    42
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    43
  if (ShenandoahStringDedup::is_enabled()) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    44
    StringDedup::gc_prologue(false);
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    45
  }
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    46
}
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    47
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    48
template<typename IsAlive, typename KeepAlive>
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    49
ShenandoahParallelWeakRootsCleaningTask<IsAlive, KeepAlive>::~ShenandoahParallelWeakRootsCleaningTask() {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    50
  if (StringDedup::is_enabled()) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    51
    StringDedup::gc_epilogue();
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    52
  }
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    53
}
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    54
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    55
template<typename IsAlive, typename KeepAlive>
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    56
void ShenandoahParallelWeakRootsCleaningTask<IsAlive, KeepAlive>::work(uint worker_id) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    57
  _weak_processing_task.work<IsAlive, KeepAlive>(worker_id, _is_alive, _keep_alive);
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    58
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    59
  if (ShenandoahStringDedup::is_enabled()) {
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    60
    ShenandoahStringDedup::parallel_oops_do(_is_alive, _keep_alive, worker_id);
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    61
  }
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    62
}
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    63
bf8128faace1 8227866: Shenandoah: Split weak root processing and class unloading in parallel cleaning task
zgu
parents:
diff changeset
    64
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHPARALLELCLEANING_INLINE_HPP