src/hotspot/share/gc/shenandoah/shenandoahNormalMode.cpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 55587 4644b3155fce
child 59296 9186be5c78ba
permissions -rw-r--r--
8234748: Clean up atomic and orderAccess includes Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55587
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     1
/*
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     3
 *
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     6
 * published by the Free Software Foundation.
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     7
 *
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    12
 * accompanied this code).
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    13
 *
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    17
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    18
 * or visit www.oracle.com if you need additional information or have any
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    19
 * questions.
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    20
 *
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    21
 */
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    22
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    23
#include "precompiled.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    24
#include "gc/shenandoah/shenandoahNormalMode.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    25
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    26
#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    27
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    28
#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    29
#include "logging/log.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    30
#include "logging/logTag.hpp"
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    31
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    32
void ShenandoahNormalMode::initialize_flags() const {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    33
  SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    34
  SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    35
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    36
  // Final configuration checks
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    37
  SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    38
  SHENANDOAH_CHECK_FLAG_SET(ShenandoahSATBBarrier);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    39
  SHENANDOAH_CHECK_FLAG_SET(ShenandoahKeepAliveBarrier);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    40
  SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    41
  SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier);
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    42
}
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    43
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    44
ShenandoahHeuristics* ShenandoahNormalMode::initialize_heuristics() const {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    45
  if (ShenandoahGCHeuristics != NULL) {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    46
    if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    47
      return new ShenandoahAggressiveHeuristics();
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    48
    } else if (strcmp(ShenandoahGCHeuristics, "static") == 0) {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    49
      return new ShenandoahStaticHeuristics();
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    50
    } else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    51
      return new ShenandoahAdaptiveHeuristics();
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    52
    } else if (strcmp(ShenandoahGCHeuristics, "compact") == 0) {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    53
      return new ShenandoahCompactHeuristics();
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    54
    } else {
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    55
      vm_exit_during_initialization("Unknown -XX:ShenandoahGCHeuristics option");
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    56
    }
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    57
  }
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    58
  ShouldNotReachHere();
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    59
  return NULL;
4644b3155fce 8226757: Shenandoah: Make traversal and passive modes explicit
rkennke
parents:
diff changeset
    60
}