src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp
author stefank
Thu, 09 May 2019 14:28:30 +0200
changeset 54786 ebf733a324d4
parent 53244 9807daeb47c4
child 57777 90ead0febf56
child 58678 9cf78a70fa4f
permissions -rw-r--r--
8223624: Cleanup includes of universe.hpp Reviewed-by: coleenp, lkorinth
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52200
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     4
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     8
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    13
 * accompanied this code).
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    14
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    18
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    21
 * questions.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    22
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    23
 */
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52200
diff changeset
    25
#ifndef SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52200
diff changeset
    26
#define SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    27
52200
38ecfe5dc351 8212698: Minor g1 #include changes and memoryService.hpp copyright date update
phh
parents: 52062
diff changeset
    28
#include "gc/g1/g1Allocator.inline.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    29
#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    30
#include "gc/g1/g1FullGCMarker.inline.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    31
#include "gc/g1/g1FullGCOopClosures.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    32
#include "gc/g1/heapRegionRemSet.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    33
#include "memory/iterator.inline.hpp"
54786
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 53244
diff changeset
    34
#include "memory/universe.hpp"
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47885
diff changeset
    35
#include "oops/access.inline.hpp"
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47885
diff changeset
    36
#include "oops/compressedOops.inline.hpp"
49722
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49607
diff changeset
    37
#include "oops/oop.inline.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    38
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    39
template <typename T>
50752
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    40
inline void G1MarkAndPushClosure::do_oop_work(T* p) {
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    41
  _marker->mark_and_push(p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    42
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    43
50752
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    44
inline void G1MarkAndPushClosure::do_oop(oop* p) {
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    45
  do_oop_work(p);
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    46
}
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    47
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    48
inline void G1MarkAndPushClosure::do_oop(narrowOop* p) {
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    49
  do_oop_work(p);
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    50
}
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    51
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    52
inline bool G1MarkAndPushClosure::do_metadata() {
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    53
  return true;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    54
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    55
50752
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    56
inline void G1MarkAndPushClosure::do_klass(Klass* k) {
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    57
  _marker->follow_klass(k);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    58
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    59
50752
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    60
inline void G1MarkAndPushClosure::do_cld(ClassLoaderData* cld) {
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    61
  _marker->follow_cld(cld);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    62
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    63
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49592
diff changeset
    64
template <class T> inline void G1AdjustClosure::adjust_pointer(T* p) {
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47885
diff changeset
    65
  T heap_oop = RawAccess<>::oop_load(p);
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47885
diff changeset
    66
  if (CompressedOops::is_null(heap_oop)) {
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49592
diff changeset
    67
    return;
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    68
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    69
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 47885
diff changeset
    70
  oop obj = CompressedOops::decode_not_null(heap_oop);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    71
  assert(Universe::heap()->is_in(obj), "should be in heap");
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 50752
diff changeset
    72
  if (G1ArchiveAllocator::is_archived_object(obj)) {
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49592
diff changeset
    73
    // We never forward archive objects.
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49592
diff changeset
    74
    return;
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    75
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    76
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    77
  oop forwardee = obj->forwardee();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    78
  if (forwardee == NULL) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    79
    // Not forwarded, return current reference.
49722
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49607
diff changeset
    80
    assert(obj->mark_raw() == markOopDesc::prototype_for_object(obj) || // Correct mark
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49607
diff changeset
    81
           obj->mark_raw()->must_be_preserved(obj) || // Will be restored by PreservedMarksSet
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49607
diff changeset
    82
           (UseBiasedLocking && obj->has_bias_pattern_raw()), // Will be restored by BiasedLocking
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    83
           "Must have correct prototype or be preserved, obj: " PTR_FORMAT ", mark: " PTR_FORMAT ", prototype: " PTR_FORMAT,
49722
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49607
diff changeset
    84
           p2i(obj), p2i(obj->mark_raw()), p2i(markOopDesc::prototype_for_object(obj)));
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    85
    return;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    86
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    87
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49592
diff changeset
    88
  // Forwarded, just update.
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49592
diff changeset
    89
  assert(Universe::heap()->is_in_reserved(forwardee), "should be in object space");
50728
9375184cec98 8205459: Rename Access API flag decorators
kbarrett
parents: 49722
diff changeset
    90
  RawAccess<IS_NOT_NULL>::oop_store(p, forwardee);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    91
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    92
50752
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    93
inline void G1AdjustClosure::do_oop(oop* p)       { do_oop_work(p); }
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50728
diff changeset
    94
inline void G1AdjustClosure::do_oop(narrowOop* p) { do_oop_work(p); }
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    95
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    96
inline bool G1IsAliveClosure::do_object_b(oop p) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    97
  return _bitmap->is_marked(p) || G1ArchiveAllocator::is_closed_archive_object(p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    98
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    99
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   100
template<typename T>
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   101
inline void G1FullKeepAliveClosure::do_oop_work(T* p) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   102
  _marker->mark_and_push(p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   103
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   104
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52200
diff changeset
   105
#endif // SHARE_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP