src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp
author kbarrett
Tue, 12 Jun 2018 18:12:59 -0400
changeset 50532 a18c60527166
parent 49722 a47d1e21b3f1
child 50752 9d62da00bf15
permissions -rw-r--r--
8204585: Remove IN_ARCHIVE_ROOT from Access API Summary: Replaced Access API with API on heap. Reviewed-by: jiangli, coleenp, tschatzl Contributed-by: stefan.karlsson@oracle.com, kim.barrett@oracle.com
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
/*
49722
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49592
diff changeset
     2
 * Copyright (c) 2017, 2018 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
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    26
#define SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    27
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    28
#include "gc/g1/g1Allocator.inline.hpp"
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.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    31
#include "gc/g1/g1StringDedup.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    32
#include "gc/g1/g1StringDedupQueue.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    33
#include "gc/shared/preservedMarks.inline.hpp"
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49447
diff changeset
    34
#include "oops/access.inline.hpp"
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49447
diff changeset
    35
#include "oops/compressedOops.inline.hpp"
49722
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49592
diff changeset
    36
#include "oops/oop.inline.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    37
#include "utilities/debug.hpp"
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
inline bool G1FullGCMarker::mark_object(oop obj) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    40
  // Not marking closed archive objects.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    41
  if (G1ArchiveAllocator::is_closed_archive_object(obj)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    42
    return false;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    43
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    44
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    45
  // Try to mark.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    46
  if (!_bitmap->par_mark(obj)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    47
    // Lost mark race.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    48
    return false;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    49
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    50
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    51
  // Marked by us, preserve if needed.
49722
a47d1e21b3f1 8199735: Mark word updates need to use Access API
rkennke
parents: 49592
diff changeset
    52
  markOop mark = obj->mark_raw();
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    53
  if (mark->must_be_preserved(obj) &&
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    54
      !G1ArchiveAllocator::is_open_archive_object(obj)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    55
    preserved_stack()->push(obj, mark);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    56
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    57
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    58
  // Check if deduplicatable string.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    59
  if (G1StringDedup::is_enabled()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    60
    G1StringDedup::enqueue_from_mark(obj, _worker_id);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    61
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    62
  return true;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    63
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    64
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    65
template <class T> inline void G1FullGCMarker::mark_and_push(T* p) {
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49447
diff changeset
    66
  T heap_oop = RawAccess<>::oop_load(p);
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49447
diff changeset
    67
  if (!CompressedOops::is_null(heap_oop)) {
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49447
diff changeset
    68
    oop obj = CompressedOops::decode_not_null(heap_oop);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    69
    if (mark_object(obj)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    70
      _oop_stack.push(obj);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    71
      assert(_bitmap->is_marked(obj), "Must be marked now - map self");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    72
    } else {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    73
      assert(_bitmap->is_marked(obj) || G1ArchiveAllocator::is_closed_archive_object(obj),
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    74
             "Must be marked by other or closed archive object");
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
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    78
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    79
inline bool G1FullGCMarker::is_empty() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    80
  return _oop_stack.is_empty() && _objarray_stack.is_empty();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    81
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    82
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    83
inline bool G1FullGCMarker::pop_object(oop& oop) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    84
  return _oop_stack.pop_overflow(oop) || _oop_stack.pop_local(oop);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    85
}
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
inline void G1FullGCMarker::push_objarray(oop obj, size_t index) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    88
  ObjArrayTask task(obj, index);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    89
  assert(task.is_valid(), "bad ObjArrayTask");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    90
  _objarray_stack.push(task);
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
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    93
inline bool G1FullGCMarker::pop_objarray(ObjArrayTask& arr) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    94
  return _objarray_stack.pop_overflow(arr) || _objarray_stack.pop_local(arr);
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
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    97
inline void G1FullGCMarker::follow_array(objArrayOop array) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    98
  follow_klass(array->klass());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    99
  // Don't push empty arrays to avoid unnecessary work.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   100
  if (array->length() > 0) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   101
    push_objarray(array, 0);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   102
  }
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
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   105
void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   106
  const int len = array->length();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   107
  const int beg_index = index;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   108
  assert(beg_index < len || len == 0, "index too large");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   109
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   110
  const int stride = MIN2(len - beg_index, (int) ObjArrayMarkingStride);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   111
  const int end_index = beg_index + stride;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   112
49447
657893cb281b 8199674: Improve G1 Full GC array marking
sjohanss
parents: 47885
diff changeset
   113
  // Push the continuation first to allow more efficient work stealing.
657893cb281b 8199674: Improve G1 Full GC array marking
sjohanss
parents: 47885
diff changeset
   114
  if (end_index < len) {
657893cb281b 8199674: Improve G1 Full GC array marking
sjohanss
parents: 47885
diff changeset
   115
    push_objarray(array, end_index);
657893cb281b 8199674: Improve G1 Full GC array marking
sjohanss
parents: 47885
diff changeset
   116
  }
657893cb281b 8199674: Improve G1 Full GC array marking
sjohanss
parents: 47885
diff changeset
   117
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   118
  array->oop_iterate_range(mark_closure(), beg_index, end_index);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   119
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   120
  if (VerifyDuringGC) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   121
    _verify_closure.set_containing_obj(array);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   122
    NoHeaderExtendedOopClosure no(&_verify_closure);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   123
    array->oop_iterate_range(&no, beg_index, end_index);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   124
    if (_verify_closure.failures()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   125
      assert(false, "Failed");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   126
    }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   127
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   128
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   129
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   130
inline void G1FullGCMarker::follow_object(oop obj) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   131
  assert(_bitmap->is_marked(obj), "should be marked");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   132
  if (obj->is_objArray()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   133
    // Handle object arrays explicitly to allow them to
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   134
    // be split into chunks if needed.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   135
    follow_array((objArrayOop)obj);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   136
  } else {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   137
    obj->oop_iterate(mark_closure());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   138
    if (VerifyDuringGC) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   139
      if (obj->is_instance() && InstanceKlass::cast(obj->klass())->is_reference_instance_klass()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   140
        return;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   141
      }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   142
      _verify_closure.set_containing_obj(obj);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   143
      obj->oop_iterate_no_header(&_verify_closure);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   144
      if (_verify_closure.failures()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   145
        log_warning(gc, verify)("Failed after %d", _verify_closure._cc);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   146
        assert(false, "Failed");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   147
      }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   148
    }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   149
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   150
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   151
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   152
void G1FullGCMarker::drain_stack() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   153
  do {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   154
    oop obj;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   155
    while (pop_object(obj)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   156
      assert(_bitmap->is_marked(obj), "must be marked");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   157
      follow_object(obj);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   158
    }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   159
    // Process ObjArrays one at a time to avoid marking stack bloat.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   160
    ObjArrayTask task;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   161
    if (pop_objarray(task)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   162
      follow_array_chunk(objArrayOop(task.obj()), task.index());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   163
    }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   164
  } while (!is_empty());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   165
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   166
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   167
inline void G1FullGCMarker::follow_klass(Klass* k) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   168
  oop op = k->klass_holder();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   169
  mark_and_push(&op);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   170
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   171
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   172
inline void G1FullGCMarker::follow_cld(ClassLoaderData* cld) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   173
  _cld_closure.do_cld(cld);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   174
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   175
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   176
#endif