src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 52907 7cc17c043ce0
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
     2
 * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     4
 *
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     8
 *
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    13
 * accompanied this code).
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    14
 *
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5076
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5076
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5076
diff changeset
    21
 * questions.
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    22
 *
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    23
 */
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
    25
#ifndef SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
    26
#define SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5918
diff changeset
    27
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    28
#include "classfile/javaClasses.inline.hpp"
46502
116a09d8f142 8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp
tschatzl
parents: 36580
diff changeset
    29
#include "gc/parallel/parMarkBitMap.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    30
#include "gc/parallel/psCompactionManager.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    31
#include "gc/parallel/psParallelCompact.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    32
#include "gc/shared/taskqueue.inline.hpp"
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49041
diff changeset
    33
#include "oops/access.inline.hpp"
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 47580
diff changeset
    34
#include "oops/arrayOop.inline.hpp"
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49041
diff changeset
    35
#include "oops/compressedOops.inline.hpp"
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 47580
diff changeset
    36
#include "oops/objArrayOop.inline.hpp"
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
    37
#include "oops/oop.inline.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
    38
#include "utilities/debug.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
    39
#include "utilities/globalDefinitions.hpp"
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 30556
diff changeset
    40
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    41
class PCMarkAndPushClosure: public OopClosure {
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    42
private:
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    43
  ParCompactionManager* _compaction_manager;
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    44
public:
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    45
  PCMarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    46
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    47
  template <typename T> void do_oop_nv(T* p)      { _compaction_manager->mark_and_push(p); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    48
  virtual void do_oop(oop* p)                     { do_oop_nv(p); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    49
  virtual void do_oop(narrowOop* p)               { do_oop_nv(p); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    50
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    51
  // This closure provides its own oop verification code.
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    52
  debug_only(virtual bool should_verify_oops()    { return false; })
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    53
};
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    54
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    55
class PCIterateMarkAndPushClosure: public MetadataVisitingOopIterateClosure {
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    56
private:
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    57
  ParCompactionManager* _compaction_manager;
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    58
public:
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    59
  PCIterateMarkAndPushClosure(ParCompactionManager* cm, ReferenceProcessor* rp) : MetadataVisitingOopIterateClosure(rp), _compaction_manager(cm) { }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    60
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    61
  template <typename T> void do_oop_nv(T* p)      { _compaction_manager->mark_and_push(p); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    62
  virtual void do_oop(oop* p)                     { do_oop_nv(p); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    63
  virtual void do_oop(narrowOop* p)               { do_oop_nv(p); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    64
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    65
  void do_klass_nv(Klass* k)                      { _compaction_manager->follow_klass(k); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    66
  void do_cld_nv(ClassLoaderData* cld)            { _compaction_manager->follow_class_loader(cld); }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    67
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    68
  // This closure provides its own oop verification code.
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    69
  debug_only(virtual bool should_verify_oops()    { return false; })
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    70
};
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
    71
51292
0538a5cdb474 8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents: 50752
diff changeset
    72
inline bool ParCompactionManager::steal(int queue_num, oop& t) {
0538a5cdb474 8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents: 50752
diff changeset
    73
  return stack_array()->steal(queue_num, t);
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 30556
diff changeset
    74
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 30556
diff changeset
    75
51292
0538a5cdb474 8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents: 50752
diff changeset
    76
inline bool ParCompactionManager::steal_objarray(int queue_num, ObjArrayTask& t) {
0538a5cdb474 8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents: 50752
diff changeset
    77
  return _objarray_queues->steal(queue_num, t);
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 30556
diff changeset
    78
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 30556
diff changeset
    79
51292
0538a5cdb474 8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents: 50752
diff changeset
    80
inline bool ParCompactionManager::steal(int queue_num, size_t& region) {
0538a5cdb474 8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents: 50752
diff changeset
    81
  return region_array()->steal(queue_num, region);
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 30556
diff changeset
    82
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5918
diff changeset
    83
30556
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
    84
inline void ParCompactionManager::push(oop obj) {
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
    85
  _marking_stack.push(obj);
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
    86
}
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
    87
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    88
void ParCompactionManager::push_objarray(oop obj, size_t index)
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    89
{
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    90
  ObjArrayTask task(obj, index);
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    91
  assert(task.is_valid(), "bad ObjArrayTask");
5918
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    92
  _objarray_stack.push(task);
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff changeset
    93
}
5918
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    94
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    95
void ParCompactionManager::push_region(size_t index)
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    96
{
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    97
#ifdef ASSERT
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    98
  const ParallelCompactData& sd = PSParallelCompact::summary_data();
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
    99
  ParallelCompactData::RegionData* const region_ptr = sd.region(index);
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
   100
  assert(region_ptr->claimed(), "must be claimed");
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
   101
  assert(region_ptr->_pushed++ == 0, "should only be pushed once");
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
   102
#endif
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
   103
  region_stack()->push(index);
73b96456819a 6957084: simplify TaskQueue overflow handling
jcoomes
parents: 5547
diff changeset
   104
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5918
diff changeset
   105
30556
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   106
template <typename T>
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   107
inline void ParCompactionManager::mark_and_push(T* p) {
49592
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49041
diff changeset
   108
  T heap_oop = RawAccess<>::oop_load(p);
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49041
diff changeset
   109
  if (!CompressedOops::is_null(heap_oop)) {
77fb0be7d19f 8199946: Move load/store and encode/decode out of oopDesc
stefank
parents: 49041
diff changeset
   110
    oop obj = CompressedOops::decode_not_null(heap_oop);
30556
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   111
    assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap");
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   112
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   113
    if (mark_bitmap()->is_unmarked(obj) && PSParallelCompact::mark_obj(obj)) {
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   114
      push(obj);
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   115
    }
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   116
  }
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   117
}
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   118
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   119
inline void ParCompactionManager::follow_klass(Klass* klass) {
52907
7cc17c043ce0 8214972: Uses of klass_holder() except GC need to apply GC barriers
coleenp
parents: 52119
diff changeset
   120
  oop holder = klass->class_loader_data()->holder_no_keepalive();
30556
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   121
  mark_and_push(&holder);
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   122
}
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   123
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   124
inline void ParCompactionManager::FollowStackClosure::do_void() {
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   125
  _compaction_manager->follow_marking_stacks();
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   126
}
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   127
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   128
template <typename T>
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   129
inline void follow_array_specialized(objArrayOop obj, int index, ParCompactionManager* cm) {
30151
c7cdaa576875 8076456: Remove unnecessary oopDesc::klass() calls
stefank
parents: 30150
diff changeset
   130
  const size_t len = size_t(obj->length());
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   131
  const size_t beg_index = size_t(index);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   132
  assert(beg_index < len || len == 0, "index too large");
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   133
50676
8c0a5b51559b 8203030: Zero s390 31 bit size_t type conflicts in shared code
chrisphi
parents: 49592
diff changeset
   134
  const size_t stride = MIN2(len - beg_index, (size_t)ObjArrayMarkingStride);
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   135
  const size_t end_index = beg_index + stride;
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 47580
diff changeset
   136
  T* const base = (T*)obj->base_raw();
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   137
  T* const beg = base + beg_index;
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   138
  T* const end = base + end_index;
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   139
36580
79b269100c92 8151101: Improve UseParallelGC parallelization of object array processing
jmasa
parents: 35877
diff changeset
   140
  if (end_index < len) {
79b269100c92 8151101: Improve UseParallelGC parallelization of object array processing
jmasa
parents: 35877
diff changeset
   141
    cm->push_objarray(obj, end_index); // Push the continuation.
79b269100c92 8151101: Improve UseParallelGC parallelization of object array processing
jmasa
parents: 35877
diff changeset
   142
  }
79b269100c92 8151101: Improve UseParallelGC parallelization of object array processing
jmasa
parents: 35877
diff changeset
   143
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   144
  // Push the non-NULL elements of the next stride on the marking stack.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   145
  for (T* e = beg; e < end; e++) {
30556
750fee2bdb45 8078345: Move PSParallelCompact::mark_and_push to ParCompactionManager
stefank
parents: 30151
diff changeset
   146
    cm->mark_and_push<T>(e);
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   147
  }
29792
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   148
}
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   149
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   150
inline void ParCompactionManager::follow_array(objArrayOop obj, int index) {
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   151
  if (UseCompressedOops) {
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   152
    follow_array_specialized<narrowOop>(obj, index, this);
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   153
  } else {
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   154
    follow_array_specialized<oop>(obj, index, this);
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 29792
diff changeset
   155
  }
29792
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   156
}
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   157
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   158
inline void ParCompactionManager::update_contents(oop obj) {
52119
88916200bdd7 8211447: Replace oop_pc_update_pointers with oop_iterate and closure
lkorinth
parents: 52118
diff changeset
   159
  if (!obj->klass()->is_typeArray_klass()) {
88916200bdd7 8211447: Replace oop_pc_update_pointers with oop_iterate and closure
lkorinth
parents: 52118
diff changeset
   160
    PCAdjustPointerClosure apc(this);
88916200bdd7 8211447: Replace oop_pc_update_pointers with oop_iterate and closure
lkorinth
parents: 52118
diff changeset
   161
    obj->oop_iterate(&apc);
88916200bdd7 8211447: Replace oop_pc_update_pointers with oop_iterate and closure
lkorinth
parents: 52118
diff changeset
   162
  }
29792
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   163
}
8c6fa07f0869 8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents: 7397
diff changeset
   164
52118
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   165
inline void ParCompactionManager::follow_class_loader(ClassLoaderData* cld) {
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   166
  PCMarkAndPushClosure mark_and_push_closure(this);
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   167
  cld->oops_do(&mark_and_push_closure, true);
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   168
}
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   169
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   170
inline void ParCompactionManager::follow_contents(oop obj) {
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   171
  assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked");
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   172
  if (obj->is_objArray()) {
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   173
    follow_array(objArrayOop(obj), 0);
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   174
  } else {
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   175
    PCIterateMarkAndPushClosure cl(this, PSParallelCompact::ref_processor());
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   176
    obj->oop_iterate(&cl);
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   177
  }
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   178
}
49f627781c2a 8211446: Replace oop_pc_follow_contents with oop_iterate and closure
lkorinth
parents: 51292
diff changeset
   179
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
   180
#endif // SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP