hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp
author stefank
Tue, 24 Jun 2014 16:20:15 +0200
changeset 25356 4a4a482298a6
parent 23539 6382fd0ea303
permissions -rw-r--r--
8046670: Make CMS metadata aware closures applicable for other collectors Reviewed-by: ehelin, mgerdin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 18996
diff changeset
     2
 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3913
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3913
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: 3913
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/genOopClosures.hpp"
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    29
#include "memory/iterator.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
/////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// Closures used by ConcurrentMarkSweepGeneration's collector
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
/////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class ConcurrentMarkSweepGeneration;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class CMSBitMap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class CMSMarkStack;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class CMSCollector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class MarkFromRootsClosure;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class Par_MarkFromRootsClosure;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    41
// Decode the oop and call do_oop on it.
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    42
#define DO_OOP_WORK_DEFN \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    43
  void do_oop(oop obj);                                   \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    44
  template <class T> inline void do_oop_work(T* p) {      \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    45
    T heap_oop = oopDesc::load_heap_oop(p);               \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    46
    if (!oopDesc::is_null(heap_oop)) {                    \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    47
      oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);       \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    48
      do_oop(obj);                                        \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    49
    }                                                     \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    50
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    51
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    52
// TODO: This duplication of the MetadataAwareOopClosure class is only needed
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    53
//       because some CMS OopClosures derive from OopsInGenClosure. It would be
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    54
//       good to get rid of them completely.
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    55
class MetadataAwareOopsInGenClosure: public OopsInGenClosure {
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    56
  KlassToOopClosure _klass_closure;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    57
 public:
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    58
  MetadataAwareOopsInGenClosure() {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    59
    _klass_closure.initialize(this);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    60
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    61
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    62
  virtual bool do_metadata()    { return do_metadata_nv(); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    63
  inline  bool do_metadata_nv() { return true; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    64
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    65
  virtual void do_klass(Klass* k);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    66
  void do_klass_nv(Klass* k);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    67
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    68
  virtual void do_class_loader_data(ClassLoaderData* cld);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    69
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    70
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    71
class MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    72
 private:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    73
  const MemRegion _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    74
  CMSBitMap*      _bitMap;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    75
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    76
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
 public:
3913
e049e6b81e11 6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents: 3912
diff changeset
    78
  MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    79
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    80
  virtual void do_oop(narrowOop* p);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    83
class Par_MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
18996
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    84
 private:
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    85
  const MemRegion _span;
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    86
  CMSBitMap*      _bitMap;
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    87
 protected:
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    88
  DO_OOP_WORK_DEFN
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    89
 public:
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    90
  Par_MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    91
  virtual void do_oop(oop* p);
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    92
  virtual void do_oop(narrowOop* p);
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    93
};
05c86e558c94 6412968: CMS Long initial mark pauses
jmasa
parents: 13728
diff changeset
    94
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// A variant of the above used in certain kinds of CMS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
// marking verification.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
    97
class MarkRefsIntoVerifyClosure: public MetadataAwareOopsInGenClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    98
 private:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    99
  const MemRegion _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   100
  CMSBitMap*      _verification_bm;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   101
  CMSBitMap*      _cms_bm;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   102
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   103
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  MarkRefsIntoVerifyClosure(MemRegion span, CMSBitMap* verification_bm,
3913
e049e6b81e11 6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents: 3912
diff changeset
   106
                            CMSBitMap* cms_bm);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   107
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   108
  virtual void do_oop(narrowOop* p);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   111
// The non-parallel version (the parallel version appears further below).
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   112
class PushAndMarkClosure: public MetadataAwareOopClosure {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   113
 private:
3690
dba50b88bd50 6798898: CMS: bugs related to class unloading
jmasa
parents: 1605
diff changeset
   114
  CMSCollector* _collector;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   115
  MemRegion     _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   116
  CMSBitMap*    _bit_map;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   117
  CMSBitMap*    _mod_union_table;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   118
  CMSMarkStack* _mark_stack;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   119
  bool          _concurrent_precleaning;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   120
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   121
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  PushAndMarkClosure(CMSCollector* collector,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
                     MemRegion span,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
                     ReferenceProcessor* rp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
                     CMSBitMap* bit_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
                     CMSBitMap* mod_union_table,
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   128
                     CMSMarkStack* mark_stack,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   129
                     bool concurrent_precleaning);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   130
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   131
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   132
  inline void do_oop_nv(oop* p)       { PushAndMarkClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   133
  inline void do_oop_nv(narrowOop* p) { PushAndMarkClosure::do_oop_work(p); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   136
// In the parallel case, the bit map and the
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
// reference processor are currently all shared. Access to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
// these shared mutable structures must use appropriate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// synchronization (for instance, via CAS). The marking stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
// used in the non-parallel case above is here replaced with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
// an OopTaskQueue structure to allow efficient work stealing.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   142
class Par_PushAndMarkClosure: public MetadataAwareOopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   143
 private:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   144
  CMSCollector* _collector;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   145
  MemRegion     _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   146
  CMSBitMap*    _bit_map;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   147
  OopTaskQueue* _work_queue;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   148
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   149
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  Par_PushAndMarkClosure(CMSCollector* collector,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
                         MemRegion span,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
                         ReferenceProcessor* rp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
                         CMSBitMap* bit_map,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   155
                         OopTaskQueue* work_queue);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   156
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   157
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   158
  inline void do_oop_nv(oop* p)       { Par_PushAndMarkClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   159
  inline void do_oop_nv(narrowOop* p) { Par_PushAndMarkClosure::do_oop_work(p); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
// The non-parallel version (the parallel version appears further below).
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   163
class MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   164
 private:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   165
  MemRegion          _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   166
  CMSBitMap*         _bit_map;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   167
  CMSMarkStack*      _mark_stack;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   168
  PushAndMarkClosure _pushAndMarkClosure;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   169
  CMSCollector*      _collector;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   170
  Mutex*             _freelistLock;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   171
  bool               _yield;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  // Whether closure is being used for concurrent precleaning
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   173
  bool               _concurrent_precleaning;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   174
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   175
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  MarkRefsIntoAndScanClosure(MemRegion span,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
                             ReferenceProcessor* rp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
                             CMSBitMap* bit_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
                             CMSBitMap* mod_union_table,
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   181
                             CMSMarkStack* mark_stack,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
                             CMSCollector* collector,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
                             bool should_yield,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
                             bool concurrent_precleaning);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   185
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   186
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   187
  inline void do_oop_nv(oop* p)       { MarkRefsIntoAndScanClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   188
  inline void do_oop_nv(narrowOop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   189
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  void set_freelistLock(Mutex* m) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    _freelistLock = m;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  inline void do_yield_check();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  void do_yield_work();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  bool take_from_overflow_list();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22234
diff changeset
   200
// In this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
// stack and the bitMap are shared, so access needs to be suitably
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22234
diff changeset
   202
// synchronized. An OopTaskQueue structure, supporting efficient
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22234
diff changeset
   203
// work stealing, replaces a CMSMarkStack for storing grey objects.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   204
class Par_MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   205
 private:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   206
  MemRegion              _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   207
  CMSBitMap*             _bit_map;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   208
  OopTaskQueue*          _work_queue;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   209
  const uint             _low_water_mark;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   210
  Par_PushAndMarkClosure _par_pushAndMarkClosure;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   211
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   212
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  Par_MarkRefsIntoAndScanClosure(CMSCollector* collector,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
                                 MemRegion span,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
                                 ReferenceProcessor* rp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
                                 CMSBitMap* bit_map,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   218
                                 OopTaskQueue* work_queue);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   219
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   220
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   221
  inline void do_oop_nv(oop* p)       { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   222
  inline void do_oop_nv(narrowOop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   223
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  void trim_queue(uint size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
// This closure is used during the concurrent marking phase
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
// following the first checkpoint. Its use is buried in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
// the closure MarkFromRootsClosure.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   230
class PushOrMarkClosure: public MetadataAwareOopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   231
 private:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   232
  CMSCollector*   _collector;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   233
  MemRegion       _span;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   234
  CMSBitMap*      _bitMap;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   235
  CMSMarkStack*   _markStack;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   236
  HeapWord* const _finger;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   237
  MarkFromRootsClosure* const
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   238
                  _parent;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   239
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   240
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  PushOrMarkClosure(CMSCollector* cms_collector,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
                    MemRegion span,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
                    CMSBitMap* bitMap,
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   245
                    CMSMarkStack* markStack,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   246
                    HeapWord* finger,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
                    MarkFromRootsClosure* parent);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   248
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   249
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   250
  inline void do_oop_nv(oop* p)       { PushOrMarkClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   251
  inline void do_oop_nv(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); }
3696
9e5d9b5e1049 4957990: Perm heap bloat in JVM
ysr
parents: 3690
diff changeset
   252
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  // Deal with a stack overflow condition
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  void handle_stack_overflow(HeapWord* lost);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  inline void do_yield_check();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
// A parallel (MT) version of the above.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
// This closure is used during the concurrent marking phase
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
// following the first checkpoint. Its use is buried in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
// the closure Par_MarkFromRootsClosure.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   263
class Par_PushOrMarkClosure: public MetadataAwareOopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   264
 private:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   265
  CMSCollector*    _collector;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  MemRegion        _whole_span;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  MemRegion        _span;        // local chunk
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  CMSBitMap*       _bit_map;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  OopTaskQueue*    _work_queue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  CMSMarkStack*    _overflow_stack;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  HeapWord*  const _finger;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  HeapWord** const _global_finger_addr;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   273
  Par_MarkFromRootsClosure* const
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   274
                   _parent;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   275
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   276
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  Par_PushOrMarkClosure(CMSCollector* cms_collector,
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   279
                        MemRegion span,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   280
                        CMSBitMap* bit_map,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   281
                        OopTaskQueue* work_queue,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   282
                        CMSMarkStack* mark_stack,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   283
                        HeapWord* finger,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   284
                        HeapWord** global_finger_addr,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   285
                        Par_MarkFromRootsClosure* parent);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   286
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   287
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   288
  inline void do_oop_nv(oop* p)       { Par_PushOrMarkClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   289
  inline void do_oop_nv(narrowOop* p) { Par_PushOrMarkClosure::do_oop_work(p); }
3696
9e5d9b5e1049 4957990: Perm heap bloat in JVM
ysr
parents: 3690
diff changeset
   290
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  // Deal with a stack overflow condition
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  void handle_stack_overflow(HeapWord* lost);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  inline void do_yield_check();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
// For objects in CMS generation, this closure marks
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
// given objects (transitively) as being reachable/live.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
// This is currently used during the (weak) reference object
1605
6b43d186eb8d 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents: 390
diff changeset
   300
// processing phase of the CMS final checkpoint step, as
6b43d186eb8d 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents: 390
diff changeset
   301
// well as during the concurrent precleaning of the discovered
6b43d186eb8d 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents: 390
diff changeset
   302
// reference lists.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   303
class CMSKeepAliveClosure: public MetadataAwareOopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   304
 private:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   305
  CMSCollector* _collector;
390
2e094c1be4af 6662086: 6u4+, 7b11+: CMS never clears referents when -XX:+ParallelRefProcEnabled
ysr
parents: 360
diff changeset
   306
  const MemRegion _span;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  CMSMarkStack* _mark_stack;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  CMSBitMap*    _bit_map;
1605
6b43d186eb8d 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents: 390
diff changeset
   309
  bool          _concurrent_precleaning;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   310
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   311
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  CMSKeepAliveClosure(CMSCollector* collector, MemRegion span,
1605
6b43d186eb8d 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents: 390
diff changeset
   314
                      CMSBitMap* bit_map, CMSMarkStack* mark_stack,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   315
                      bool cpc);
1605
6b43d186eb8d 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents: 390
diff changeset
   316
  bool    concurrent_precleaning() const { return _concurrent_precleaning; }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   317
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   318
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   319
  inline void do_oop_nv(oop* p)       { CMSKeepAliveClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   320
  inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   323
class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   324
 private:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   325
  CMSCollector* _collector;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  MemRegion     _span;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  OopTaskQueue* _work_queue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  CMSBitMap*    _bit_map;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   329
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   330
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  CMSInnerParMarkAndPushClosure(CMSCollector* collector,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
                                MemRegion span, CMSBitMap* bit_map,
3690
dba50b88bd50 6798898: CMS: bugs related to class unloading
jmasa
parents: 1605
diff changeset
   334
                                OopTaskQueue* work_queue);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   335
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   336
  virtual void do_oop(narrowOop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   337
  inline void do_oop_nv(oop* p)       { CMSInnerParMarkAndPushClosure::do_oop_work(p); }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   338
  inline void do_oop_nv(narrowOop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
// A parallel (MT) version of the above, used when
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
// reference processing is parallel; the only difference
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
// is in the do_oop method.
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   344
class CMSParKeepAliveClosure: public MetadataAwareOopClosure {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   345
 private:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  MemRegion     _span;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  OopTaskQueue* _work_queue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  CMSBitMap*    _bit_map;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   349
  CMSInnerParMarkAndPushClosure
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   350
                _mark_and_push;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  const uint    _low_water_mark;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
  void trim_queue(uint max);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   353
 protected:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   354
  DO_OOP_WORK_DEFN
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  CMSParKeepAliveClosure(CMSCollector* collector, MemRegion span,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   357
                         CMSBitMap* bit_map, OopTaskQueue* work_queue);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   358
  virtual void do_oop(oop* p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   359
  virtual void do_oop(narrowOop* p);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   361
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   362
#endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP