src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 59252 623722a6aeb9
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:
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     1
/*
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     3
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     6
 * published by the Free Software Foundation.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     7
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    12
 * accompanied this code).
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    13
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    17
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    20
 * questions.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    21
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    22
 */
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    23
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    24
#define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    25
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    26
#include "gc/shenandoah/shenandoahAsserts.hpp"
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    27
#include "gc/shenandoah/shenandoahClosures.hpp"
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    28
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
58686
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    29
#include "gc/shenandoah/shenandoahTraversalGC.hpp"
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    30
#include "oops/compressedOops.inline.hpp"
59290
97d13893ec3c 8234748: Clean up atomic and orderAccess includes
stefank
parents: 59252
diff changeset
    31
#include "runtime/atomic.hpp"
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    32
#include "runtime/thread.hpp"
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    33
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    34
ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    35
  _mark_context(ShenandoahHeap::heap()->marking_context()) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    36
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    37
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    38
bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    39
  if (CompressedOops::is_null(obj)) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    40
    return false;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    41
  }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    42
  obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    43
  shenandoah_assert_not_forwarded_if(NULL, obj,
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    44
                                     (ShenandoahHeap::heap()->is_concurrent_mark_in_progress() ||
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    45
                                     ShenandoahHeap::heap()->is_concurrent_traversal_in_progress()));
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    46
  return _mark_context->is_marked(obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    47
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    48
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    49
ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    50
  _mark_context(ShenandoahHeap::heap()->marking_context()) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    51
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    52
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    53
bool ShenandoahIsAliveClosure::do_object_b(oop obj) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    54
  if (CompressedOops::is_null(obj)) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    55
    return false;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    56
  }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    57
  shenandoah_assert_not_forwarded(NULL, obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    58
  return _mark_context->is_marked(obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    59
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    60
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    61
BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    62
  return ShenandoahHeap::heap()->has_forwarded_objects() ?
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    63
         reinterpret_cast<BoolObjectClosure*>(&_fwd_alive_cl) :
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    64
         reinterpret_cast<BoolObjectClosure*>(&_alive_cl);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    65
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    66
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    67
ShenandoahUpdateRefsClosure::ShenandoahUpdateRefsClosure() :
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    68
  _heap(ShenandoahHeap::heap()) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    69
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    70
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    71
template <class T>
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    72
void ShenandoahUpdateRefsClosure::do_oop_work(T* p) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    73
  T o = RawAccess<>::oop_load(p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    74
  if (!CompressedOops::is_null(o)) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    75
    oop obj = CompressedOops::decode_not_null(o);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    76
    _heap->update_with_forwarded_not_null(p, obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    77
  }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    78
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    79
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    80
void ShenandoahUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    81
void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    82
58686
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    83
ShenandoahTraversalUpdateRefsClosure::ShenandoahTraversalUpdateRefsClosure() :
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    84
  _heap(ShenandoahHeap::heap()),
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    85
  _traversal_set(ShenandoahHeap::heap()->traversal_gc()->traversal_set()) {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    86
  assert(_heap->is_traversal_mode(), "Why we here?");
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    87
}
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    88
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    89
template <class T>
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    90
void ShenandoahTraversalUpdateRefsClosure::do_oop_work(T* p) {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    91
  T o = RawAccess<>::oop_load(p);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    92
  if (!CompressedOops::is_null(o)) {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    93
    oop obj = CompressedOops::decode_not_null(o);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    94
    if (_heap->in_collection_set(obj) || _traversal_set->is_in((HeapWord*)obj)) {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    95
      obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    96
      RawAccess<IS_NOT_NULL>::oop_store(p, obj);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    97
    } else {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    98
      shenandoah_assert_not_forwarded(p, obj);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
    99
    }
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
   100
  }
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
   101
}
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
   102
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
   103
void ShenandoahTraversalUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
   104
void ShenandoahTraversalUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58177
diff changeset
   105
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   106
ShenandoahEvacuateUpdateRootsClosure::ShenandoahEvacuateUpdateRootsClosure() :
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   107
  _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   108
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   109
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   110
template <class T>
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   111
void ShenandoahEvacuateUpdateRootsClosure::do_oop_work(T* p) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   112
  assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   113
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   114
  T o = RawAccess<>::oop_load(p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   115
  if (! CompressedOops::is_null(o)) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   116
    oop obj = CompressedOops::decode_not_null(o);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   117
    if (_heap->in_collection_set(obj)) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   118
      shenandoah_assert_marked(p, obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   119
      oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
58177
4932dce35882 8230841: Remove oopDesc::equals()
pliden
parents: 57533
diff changeset
   120
      if (resolved == obj) {
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   121
        resolved = _heap->evacuate_object(obj, _thread);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   122
      }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   123
      RawAccess<IS_NOT_NULL>::oop_store(p, resolved);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   124
    }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   125
  }
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   126
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   127
void ShenandoahEvacuateUpdateRootsClosure::do_oop(oop* p) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   128
  do_oop_work(p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   129
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   130
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   131
void ShenandoahEvacuateUpdateRootsClosure::do_oop(narrowOop* p) {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   132
  do_oop_work(p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   133
}
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   134
57533
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   135
ShenandoahEvacUpdateOopStorageRootsClosure::ShenandoahEvacUpdateOopStorageRootsClosure() :
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   136
  _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   137
}
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   138
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   139
void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   140
  assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   141
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   142
  oop obj = RawAccess<>::oop_load(p);
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   143
  if (! CompressedOops::is_null(obj)) {
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   144
    if (_heap->in_collection_set(obj)) {
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   145
      shenandoah_assert_marked(p, obj);
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   146
      oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
58177
4932dce35882 8230841: Remove oopDesc::equals()
pliden
parents: 57533
diff changeset
   147
      if (resolved == obj) {
57533
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   148
        resolved = _heap->evacuate_object(obj, _thread);
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   149
      }
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   150
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 58686
diff changeset
   151
      Atomic::cmpxchg(p, obj, resolved);
57533
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   152
    }
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   153
  }
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   154
}
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   155
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   156
void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(narrowOop* p) {
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   157
  ShouldNotReachHere();
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   158
}
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   159
54687
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   160
#ifdef ASSERT
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   161
template <class T>
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   162
void ShenandoahAssertNotForwardedClosure::do_oop_work(T* p) {
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   163
  T o = RawAccess<>::oop_load(p);
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   164
  if (!CompressedOops::is_null(o)) {
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   165
    oop obj = CompressedOops::decode_not_null(o);
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   166
    shenandoah_assert_not_forwarded(p, obj);
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   167
  }
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   168
}
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   169
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   170
void ShenandoahAssertNotForwardedClosure::do_oop(narrowOop* p) { do_oop_work(p); }
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   171
void ShenandoahAssertNotForwardedClosure::do_oop(oop* p)       { do_oop_work(p); }
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   172
#endif
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   173
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   174
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP