src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 59270 d5a1c6545a2b
permissions -rw-r--r--
8234748: Clean up atomic and orderAccess includes Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     1
/*
54006
a421bdf22394 8219613: Use NonJavaThread PtrQueues
kbarrett
parents: 53244
diff changeset
     2
 * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     3
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     6
 * published by the Free Software Foundation.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     7
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    12
 * accompanied this code).
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    13
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    17
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    20
 * questions.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    21
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    22
 */
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    23
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
    24
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
    25
#define SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    26
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    27
#include "gc/shared/accessBarrierSupport.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    28
#include "gc/shared/barrierSet.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    29
#include "gc/shenandoah/shenandoahHeap.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    30
#include "gc/shenandoah/shenandoahSATBMarkQueueSet.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    31
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    32
class ShenandoahBarrierSetAssembler;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    33
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    34
class ShenandoahBarrierSet: public BarrierSet {
54848
5d8c5c7bca95 8223767: Shenandoah fails to build on Solaris x86_64
dsamersoff
parents: 54425
diff changeset
    35
public:
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    36
  enum ArrayCopyStoreValMode {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    37
    NONE,
55015
738285c4d1e1 8224667: Shenandoah: Post-LRB cleanup
rkennke
parents: 54848
diff changeset
    38
    RESOLVE_BARRIER,
738285c4d1e1 8224667: Shenandoah: Post-LRB cleanup
rkennke
parents: 54848
diff changeset
    39
    EVAC_BARRIER
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    40
  };
54848
5d8c5c7bca95 8223767: Shenandoah fails to build on Solaris x86_64
dsamersoff
parents: 54425
diff changeset
    41
private:
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    42
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    43
  ShenandoahHeap* _heap;
58059
baa4dd528de0 8221361: Eliminate two-phase initialization for PtrQueueSet classes
kbarrett
parents: 55681
diff changeset
    44
  BufferNode::Allocator _satb_mark_queue_buffer_allocator;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    45
  ShenandoahSATBMarkQueueSet _satb_mark_queue_set;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    46
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    47
public:
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    48
  ShenandoahBarrierSet(ShenandoahHeap* heap);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    49
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    50
  static ShenandoahBarrierSetAssembler* assembler();
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    51
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    52
  inline static ShenandoahBarrierSet* barrier_set() {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    53
    return barrier_set_cast<ShenandoahBarrierSet>(BarrierSet::barrier_set());
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    54
  }
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    55
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    56
  static ShenandoahSATBMarkQueueSet& satb_mark_queue_set() {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    57
    return barrier_set()->_satb_mark_queue_set;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    58
  }
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    59
58985
5606867a5e6e 8233339: Shenandoah: Centralize load barrier decisions into ShenandoahBarrierSet
zgu
parents: 58710
diff changeset
    60
  static bool need_load_reference_barrier(DecoratorSet decorators, BasicType type);
5606867a5e6e 8233339: Shenandoah: Centralize load barrier decisions into ShenandoahBarrierSet
zgu
parents: 58710
diff changeset
    61
  static bool use_load_reference_barrier_native(DecoratorSet decorators, BasicType type);
5606867a5e6e 8233339: Shenandoah: Centralize load barrier decisions into ShenandoahBarrierSet
zgu
parents: 58710
diff changeset
    62
  static bool need_keep_alive_barrier(DecoratorSet decorators, BasicType type);
5606867a5e6e 8233339: Shenandoah: Centralize load barrier decisions into ShenandoahBarrierSet
zgu
parents: 58710
diff changeset
    63
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    64
  void print_on(outputStream* st) const;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    65
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    66
  bool is_a(BarrierSet::Name bsn);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    67
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    68
  bool is_aligned(HeapWord* hw);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    69
58218
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    70
  template <class T> void
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    71
  write_ref_array_pre_work(T* src, T* dst, size_t count, bool dest_uninitialized);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    72
58218
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    73
  inline void arraycopy_pre(oop* src, oop* dst, size_t count);
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    74
  inline void arraycopy_pre(narrowOop* src, narrowOop* dst, size_t count);
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    75
  inline void arraycopy_update(oop* src, size_t count);
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    76
  inline void arraycopy_update(narrowOop* src, size_t count);
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
    77
  inline void clone_barrier(oop src);
58334
f642ad5c655f 8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents: 58219
diff changeset
    78
  void clone_barrier_runtime(oop src);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    79
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    80
  virtual void on_thread_create(Thread* thread);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    81
  virtual void on_thread_destroy(Thread* thread);
54006
a421bdf22394 8219613: Use NonJavaThread PtrQueues
kbarrett
parents: 53244
diff changeset
    82
  virtual void on_thread_attach(Thread* thread);
a421bdf22394 8219613: Use NonJavaThread PtrQueues
kbarrett
parents: 53244
diff changeset
    83
  virtual void on_thread_detach(Thread* thread);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    84
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    85
  static inline oop resolve_forwarded_not_null(oop p);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    86
  static inline oop resolve_forwarded(oop p);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    87
59270
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    88
  template <DecoratorSet decorators, typename T>
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    89
  inline void satb_barrier(T* field);
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    90
  inline void satb_enqueue(oop value);
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    91
  inline void storeval_barrier(oop obj);
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    92
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    93
  template <DecoratorSet decorators>
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    94
  inline void keep_alive_if_weak(oop value);
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    95
  inline void keep_alive_if_weak(DecoratorSet decorators, oop value);
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    96
  inline void keep_alive_barrier(oop value);
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    97
d5a1c6545a2b 8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents: 59252
diff changeset
    98
  inline void enqueue(oop obj);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    99
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   100
  oop load_reference_barrier(oop obj);
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   101
  oop load_reference_barrier_not_null(oop obj);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   102
58219
bc0648405d67 8231087: Shenandoah: Self-fixing load reference barriers for C1/C2
rkennke
parents: 58218
diff changeset
   103
  oop load_reference_barrier_mutator(oop obj, oop* load_addr);
bc0648405d67 8231087: Shenandoah: Self-fixing load reference barriers for C1/C2
rkennke
parents: 58218
diff changeset
   104
  oop load_reference_barrier_mutator(oop obj, narrowOop* load_addr);
bc0648405d67 8231087: Shenandoah: Self-fixing load reference barriers for C1/C2
rkennke
parents: 58218
diff changeset
   105
bc0648405d67 8231087: Shenandoah: Self-fixing load reference barriers for C1/C2
rkennke
parents: 58218
diff changeset
   106
  template <class T>
bc0648405d67 8231087: Shenandoah: Self-fixing load reference barriers for C1/C2
rkennke
parents: 58218
diff changeset
   107
  oop load_reference_barrier_mutator_work(oop obj, T* load_addr);
bc0648405d67 8231087: Shenandoah: Self-fixing load reference barriers for C1/C2
rkennke
parents: 58218
diff changeset
   108
58710
ff3eab78554f 8232674: Fix build and rename ShenandoahBarrierSet::oop_load_from_native_barrier
shade
parents: 58693
diff changeset
   109
  oop load_reference_barrier_native(oop obj, oop* load_addr);
ff3eab78554f 8232674: Fix build and rename ShenandoahBarrierSet::oop_load_from_native_barrier
shade
parents: 58693
diff changeset
   110
  oop load_reference_barrier_native(oop obj, narrowOop* load_addr);
ff3eab78554f 8232674: Fix build and rename ShenandoahBarrierSet::oop_load_from_native_barrier
shade
parents: 58693
diff changeset
   111
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   112
private:
58218
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
   113
  template <class T>
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
   114
  inline void arraycopy_pre_work(T* src, T* dst, size_t count);
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
   115
  template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
   116
  inline void arraycopy_work(T* src, size_t count);
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
   117
  template <class T>
0d7877278adf 8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents: 58059
diff changeset
   118
  inline void arraycopy_update_impl(T* src, size_t count);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   119
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   120
  oop load_reference_barrier_impl(oop obj);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   121
58710
ff3eab78554f 8232674: Fix build and rename ShenandoahBarrierSet::oop_load_from_native_barrier
shade
parents: 58693
diff changeset
   122
  template <class T>
ff3eab78554f 8232674: Fix build and rename ShenandoahBarrierSet::oop_load_from_native_barrier
shade
parents: 58693
diff changeset
   123
  oop load_reference_barrier_native_impl(oop obj, T* load_addr);
ff3eab78554f 8232674: Fix build and rename ShenandoahBarrierSet::oop_load_from_native_barrier
shade
parents: 58693
diff changeset
   124
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   125
public:
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   126
  // Callbacks for runtime accesses.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   127
  template <DecoratorSet decorators, typename BarrierSetT = ShenandoahBarrierSet>
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   128
  class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   129
    typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   130
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   131
  public:
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   132
    // Heap oop accesses. These accessors get resolved when
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   133
    // IN_HEAP is set (e.g. when using the HeapAccess API), it is
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   134
    // an oop_* overload, and the barrier strength is AS_NORMAL.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   135
    template <typename T>
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   136
    static oop oop_load_in_heap(T* addr);
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   137
    static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   138
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   139
    template <typename T>
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   140
    static void oop_store_in_heap(T* addr, oop value);
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   141
    static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   142
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   143
    template <typename T>
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
   144
    static oop oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value);
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
   145
    static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   146
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   147
    template <typename T>
59251
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 58985
diff changeset
   148
    static oop oop_atomic_xchg_in_heap(T* addr, oop new_value);
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 58985
diff changeset
   149
    static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   150
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   151
    template <typename T>
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   152
    static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   153
                                      arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   154
                                      size_t length);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   155
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   156
    // Clone barrier support
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   157
    static void clone_in_heap(oop src, oop dst, size_t size);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   158
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   159
    // Needed for loads on non-heap weak references
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   160
    template <typename T>
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   161
    static oop oop_load_not_in_heap(T* addr);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   162
55681
7b671e6b0d5b 8225483: Shenandoah: Enhance native access barrier
zgu
parents: 55654
diff changeset
   163
    // Used for catching bad stores
7b671e6b0d5b 8225483: Shenandoah: Enhance native access barrier
zgu
parents: 55654
diff changeset
   164
    template <typename T>
7b671e6b0d5b 8225483: Shenandoah: Enhance native access barrier
zgu
parents: 55654
diff changeset
   165
    static void oop_store_not_in_heap(T* addr, oop value);
7b671e6b0d5b 8225483: Shenandoah: Enhance native access barrier
zgu
parents: 55654
diff changeset
   166
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   167
    template <typename T>
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
   168
    static oop oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   169
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54383
diff changeset
   170
    template <typename T>
59251
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 58985
diff changeset
   171
    static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   172
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   173
  };
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   174
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   175
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   176
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   177
template<>
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   178
struct BarrierSet::GetName<ShenandoahBarrierSet> {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   179
  static const BarrierSet::Name value = BarrierSet::ShenandoahBarrierSet;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   180
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   181
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   182
template<>
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   183
struct BarrierSet::GetType<BarrierSet::ShenandoahBarrierSet> {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   184
  typedef ::ShenandoahBarrierSet type;
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   185
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   186
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
   187
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP