src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.cpp
author zgu
Wed, 27 Nov 2019 11:52:57 -0500
changeset 59296 9186be5c78ba
parent 57995 d8f22418ca99
permissions -rw-r--r--
8228720: Shenandoah: Implementation of concurrent class unloading Reviewed-by: rkennke
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     1
/*
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     3
 *
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     6
 * published by the Free Software Foundation.
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     7
 *
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    12
 * accompanied this code).
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    13
 *
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    17
 *
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    20
 * questions.
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    21
 *
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    22
 */
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    23
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    24
#include "precompiled.hpp"
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    25
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    26
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    27
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    28
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    29
bool ShenandoahConcurrentRoots::can_do_concurrent_roots() {
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    30
  // Don't support traversal GC at this moment
57995
d8f22418ca99 8230483: Shenandoah: consistently disable concurrent roots for Traversal mode
zgu
parents: 55428
diff changeset
    31
  return !ShenandoahHeap::heap()->is_traversal_mode();
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    32
}
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    33
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    34
bool ShenandoahConcurrentRoots::should_do_concurrent_roots() {
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    35
  return can_do_concurrent_roots() &&
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    36
         !ShenandoahHeap::heap()->is_stw_gc_in_progress();
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents:
diff changeset
    37
}
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    38
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    39
bool ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    40
#if defined(X86) && !defined(SOLARIS)
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    41
  return ShenandoahCodeRootsStyle == 2 &&
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    42
         ClassUnloading &&
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    43
         strcmp(ShenandoahGCMode, "traversal") != 0;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    44
#else
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    45
  return false;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    46
#endif
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    47
}
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    48
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    49
bool ShenandoahConcurrentRoots::should_do_concurrent_class_unloading() {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    50
  return can_do_concurrent_class_unloading() &&
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    51
         !ShenandoahHeap::heap()->is_stw_gc_in_progress();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 57995
diff changeset
    52
}