hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp
author jwilhelm
Thu, 03 Oct 2013 21:36:29 +0200
changeset 20398 b206c580c45f
parent 17852 59b05e1db547
child 20282 7f9cbdf89af2
permissions -rw-r--r--
8025852: Remove unnecessary setters in collector policy classes Summary: Use instance variables directly within the collector policy classes and remove unused setters. Reviewed-by: tschatzl, jcoomes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
     2
 * Copyright (c) 2002, 2012, 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: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
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: 670
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: 6248
diff changeset
    25
#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    26
#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    28
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    29
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    30
#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
    31
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    32
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    33
#include "memory/iterator.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    34
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
inline void PSScavenge::save_to_space_top_before_gc() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  _to_space_top_before_gc = heap->young_gen()->to_space()->top();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    40
template <class T> inline bool PSScavenge::should_scavenge(T* p) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    41
  T heap_oop = oopDesc::load_heap_oop(p);
17852
59b05e1db547 8015486: PSScavenge::is_obj_in_young is unnecessarily slow with UseCompressedOops
stefank
parents: 13728
diff changeset
    42
  return PSScavenge::is_obj_in_young(heap_oop);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    45
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    46
inline bool PSScavenge::should_scavenge(T* p, MutableSpace* to_space) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  if (should_scavenge(p)) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    48
    oop obj = oopDesc::load_decode_heap_oop_not_null(p);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    // Skip objects copied to to_space since the scavenge started.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    50
    HeapWord* const addr = (HeapWord*)obj;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    return addr < to_space_top_before_gc() || addr >= to_space->end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    56
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    57
inline bool PSScavenge::should_scavenge(T* p, bool check_to_space) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  if (check_to_space) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    59
    ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    return should_scavenge(p, heap->young_gen()->to_space());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  return should_scavenge(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// Attempt to "claim" oop at p via CAS, push the new obj if successful
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
// This version tests the oop* to make sure it is within the heap before
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// attempting marking.
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
    68
template <class T, bool promote_immediately>
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm,
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    70
                                                   T*                  p) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    71
  assert(should_scavenge(p, true), "revisiting object?");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    73
  oop o = oopDesc::load_decode_heap_oop_not_null(p);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    74
  oop new_obj = o->is_forwarded()
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    75
        ? o->forwardee()
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
    76
        : pm->copy_to_survivor_space<promote_immediately>(o);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    77
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    78
#ifndef PRODUCT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    79
  // This code must come after the CAS test, or it will print incorrect
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    80
  // information.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    81
  if (TraceScavenge &&  o->is_forwarded()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    82
    gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    83
       "forwarding",
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    84
       new_obj->klass()->internal_name(), o, new_obj, new_obj->size());
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    85
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    86
#endif
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    87
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    88
  oopDesc::encode_store_heap_oop_not_null(p, new_obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  // We cannot mark without test, as some code passes us pointers
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    91
  // that are outside the heap. These pointers are either from roots
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
    92
  // or from metadata.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    93
  if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) &&
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      Universe::heap()->is_in_reserved(p)) {
17852
59b05e1db547 8015486: PSScavenge::is_obj_in_young is unnecessarily slow with UseCompressedOops
stefank
parents: 13728
diff changeset
    95
    if (PSScavenge::is_obj_in_young(new_obj)) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    96
      card_table()->inline_write_ref_field_gc(p, new_obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
   100
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   101
template<bool promote_immediately>
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   102
class PSRootsClosure: public OopClosure {
8728
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   103
 private:
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   104
  PSPromotionManager* _promotion_manager;
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   105
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   106
 protected:
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   107
  template <class T> void do_oop_work(T *p) {
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   108
    if (PSScavenge::should_scavenge(p)) {
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   109
      // We never card mark roots, maybe call a func without test?
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   110
      PSScavenge::copy_and_push_safe_barrier<T, promote_immediately>(_promotion_manager, p);
8728
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   111
    }
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   112
  }
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   113
 public:
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   114
  PSRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   115
  void do_oop(oop* p)       { PSRootsClosure::do_oop_work(p); }
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   116
  void do_oop(narrowOop* p) { PSRootsClosure::do_oop_work(p); }
8728
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   117
};
3f1bcd33068e 6962931: move interned strings out of the perm gen
jcoomes
parents: 7397
diff changeset
   118
11753
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   119
typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure;
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   120
typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure;
c9e420473a11 7144296: PS: Optimize nmethods processing
iveresov
parents: 8921
diff changeset
   121
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   122
// Scavenges a single oop in a Klass.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   123
class PSScavengeFromKlassClosure: public OopClosure {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   124
 private:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   125
  PSPromotionManager* _pm;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   126
  // Used to redirty a scanned klass if it has oops
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   127
  // pointing to the young generation after being scanned.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   128
  Klass*             _scanned_klass;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   129
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   130
  PSScavengeFromKlassClosure(PSPromotionManager* pm) : _pm(pm), _scanned_klass(NULL) { }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   131
  void do_oop(narrowOop* p) { ShouldNotReachHere(); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   132
  void do_oop(oop* p)       {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   133
    ParallelScavengeHeap* psh = ParallelScavengeHeap::heap();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   134
    assert(!psh->is_in_reserved(p), "GC barrier needed");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   135
    if (PSScavenge::should_scavenge(p)) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   136
      assert(!Universe::heap()->is_in_reserved(p), "Not from meta-data?");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   137
      assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   138
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   139
      oop o = *p;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   140
      oop new_obj;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   141
      if (o->is_forwarded()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   142
        new_obj = o->forwardee();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   143
      } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   144
        new_obj = _pm->copy_to_survivor_space</*promote_immediately=*/false>(o);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   145
      }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   146
      oopDesc::encode_store_heap_oop_not_null(p, new_obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   147
17852
59b05e1db547 8015486: PSScavenge::is_obj_in_young is unnecessarily slow with UseCompressedOops
stefank
parents: 13728
diff changeset
   148
      if (PSScavenge::is_obj_in_young(new_obj)) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   149
        do_klass_barrier();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   150
      }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   151
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   152
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   153
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   154
  void set_scanned_klass(Klass* klass) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   155
    assert(_scanned_klass == NULL || klass == NULL, "Should always only handling one klass at a time");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   156
    _scanned_klass = klass;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   157
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   158
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   159
 private:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   160
  void do_klass_barrier() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   161
    assert(_scanned_klass != NULL, "Should not be called without having a scanned klass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   162
    _scanned_klass->record_modified_oops();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   163
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   164
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   165
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   166
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   167
// Scavenges the oop in a Klass.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   168
class PSScavengeKlassClosure: public KlassClosure {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   169
 private:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   170
  PSScavengeFromKlassClosure _oop_closure;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   171
 protected:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   172
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   173
  PSScavengeKlassClosure(PSPromotionManager* pm) : _oop_closure(pm) { }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   174
  void do_klass(Klass* klass) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   175
    // If the klass has not been dirtied we know that there's
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   176
    // no references into  the young gen and we can skip it.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   177
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   178
#ifndef PRODUCT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   179
    if (TraceScavenge) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   180
      ResourceMark rm;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   181
      gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass %p, %s, dirty: %s",
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   182
                             klass,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   183
                             klass->external_name(),
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   184
                             klass->has_modified_oops() ? "true" : "false");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   185
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   186
#endif
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   187
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   188
    if (klass->has_modified_oops()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   189
      // Clean the klass since we're going to scavenge all the metadata.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   190
      klass->clear_modified_oops();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   191
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   192
      // Setup the promotion manager to redirty this klass
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   193
      // if references are left in the young gen.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   194
      _oop_closure.set_scanned_klass(klass);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   195
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   196
      klass->oops_do(&_oop_closure);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   197
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   198
      _oop_closure.set_scanned_klass(NULL);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   199
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   200
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   201
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11753
diff changeset
   202
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
   203
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_INLINE_HPP