hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp
author sfriberg
Wed, 02 Sep 2015 09:51:05 +0200
changeset 32608 ef2ec6fac731
parent 32382 8ab915777257
child 32736 755024a84282
permissions -rw-r--r--
8066443: Add G1 support for promotion event Reviewed-by: tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     1
/*
30564
a37d98a1eb54 8071462: Remove G1ParGCAllocator::alloc_buffer_waste
tschatzl
parents: 28213
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     4
 *
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     8
 *
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    14
 *
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    18
 *
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    21
 * questions.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    22
 *
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    23
 */
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    26
#define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    28
#include "gc/g1/dirtyCardQueue.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    29
#include "gc/g1/g1CollectedHeap.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    30
#include "gc/g1/g1CollectorPolicy.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    31
#include "gc/g1/g1OopClosures.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    32
#include "gc/g1/g1RemSet.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    33
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
    34
#include "gc/shared/ageTable.hpp"
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    35
#include "memory/allocation.hpp"
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    36
#include "oops/oop.hpp"
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    37
32378
8dd0e7359751 8133470: Uses of Atomic methods in plab.hpp should be moved to .inline.hpp file
tschatzl
parents: 32377
diff changeset
    38
class G1PLABAllocator;
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    39
class HeapRegion;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    40
class outputStream;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    41
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
    42
class G1ParScanThreadState : public CHeapObj<mtGC> {
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
    43
 private:
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    44
  G1CollectedHeap* _g1h;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    45
  RefToScanQueue*  _refs;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    46
  DirtyCardQueue   _dcq;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    47
  G1SATBCardTableModRefBS* _ct_bs;
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
    48
  G1RemSet*         _g1_rem;
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    49
32185
49a57ff2c3cb 8073052: Rename and clean up the allocation manager hierarchy in g1Allocator.?pp
tschatzl
parents: 31976
diff changeset
    50
  G1PLABAllocator*  _plab_allocator;
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    51
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    52
  ageTable          _age_table;
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    53
  InCSetState       _dest[InCSetState::Num];
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    54
  // Local tenuring threshold.
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    55
  uint              _tenuring_threshold;
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    56
  G1ParScanClosure  _scanner;
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    57
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    58
  int  _hash_seed;
32187
0891f3fa84fc 8133047: Rename G1ParScanThreadState::_queue_num to _worker_id
tschatzl
parents: 32186
diff changeset
    59
  uint _worker_id;
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    60
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    61
  // Map from young-age-index (0 == not young, 1 is youngest) to
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    62
  // surviving words. base is what we get back from the malloc call
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    63
  size_t* _surviving_young_words_base;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    64
  // this points into the array, as we use the first few entries for padding
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    65
  size_t* _surviving_young_words;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    66
32377
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
    67
  // Indicates whether in the last generation (old) there is no more space
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
    68
  // available for allocation.
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
    69
  bool _old_gen_is_full;
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
    70
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    71
#define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t))
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    72
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    73
  DirtyCardQueue& dirty_card_queue()             { return _dcq;  }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    74
  G1SATBCardTableModRefBS* ctbs()                { return _ct_bs; }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    75
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    76
  InCSetState dest(InCSetState original) const {
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    77
    assert(original.is_valid(),
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    78
           err_msg("Original state invalid: " CSETSTATE_FORMAT, original.value()));
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    79
    assert(_dest[original.value()].is_valid_gen(),
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    80
           err_msg("Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value()));
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    81
    return _dest[original.value()];
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    82
  }
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
    83
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
    84
 public:
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
    85
  G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id);
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
    86
  ~G1ParScanThreadState();
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    87
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
    88
  void set_ref_processor(ReferenceProcessor* rp) { _scanner.set_ref_processor(rp); }
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
    89
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    90
#ifdef ASSERT
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
    91
  bool queue_is_empty() const { return _refs->is_empty(); }
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
    92
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    93
  bool verify_ref(narrowOop* ref) const;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    94
  bool verify_ref(oop* ref) const;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    95
  bool verify_task(StarTask ref) const;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    96
#endif // ASSERT
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    97
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents: 28213
diff changeset
    98
  template <class T> void push_on_queue(T* ref);
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
    99
26850
515ff48cf5f0 8036116: Fix thread-id types in G1 remembered set implementations
brutisso
parents: 26837
diff changeset
   100
  template <class T> void update_rs(HeapRegion* from, T* p, uint tid) {
26701
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   101
    // If the new value of the field points to the same region or
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   102
    // is the to-space, we don't need to include it in the Rset updates.
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   103
    if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) {
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   104
      size_t card_index = ctbs()->index_for(p);
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   105
      // If the card hasn't been added to the buffer, do it.
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   106
      if (ctbs()->mark_card_deferred(card_index)) {
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   107
        dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index));
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   108
      }
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   109
    }
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 25483
diff changeset
   110
  }
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   111
32187
0891f3fa84fc 8133047: Rename G1ParScanThreadState::_queue_num to _worker_id
tschatzl
parents: 32186
diff changeset
   112
  uint worker_id() { return _worker_id; }
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   113
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
   114
  // Returns the current amount of waste due to alignment or not being able to fit
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
   115
  // objects within LABs and the undo waste.
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
   116
  virtual void waste(size_t& wasted, size_t& undo_wasted);
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   117
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   118
  size_t* surviving_young_words() {
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
   119
    // We add one to hide entry 0 which accumulates surviving words for
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   120
    // age -1 regions (i.e. non-young ones)
32381
b750fd963056 8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents: 32378
diff changeset
   121
    return _surviving_young_words + 1;
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   122
  }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   123
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   124
 private:
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   125
  #define G1_PARTIAL_ARRAY_MASK 0x2
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   126
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   127
  inline bool has_partial_array_mask(oop* ref) const {
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   128
    return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   129
  }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   130
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   131
  // We never encode partial array oops as narrowOop*, so return false immediately.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   132
  // This allows the compiler to create optimized code when popping references from
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   133
  // the work queue.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   134
  inline bool has_partial_array_mask(narrowOop* ref) const {
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   135
    assert(((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) != G1_PARTIAL_ARRAY_MASK, "Partial array oop reference encoded as narrowOop*");
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   136
    return false;
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   137
  }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   138
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   139
  // Only implement set_partial_array_mask() for regular oops, not for narrowOops.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   140
  // We always encode partial arrays as regular oop, to allow the
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   141
  // specialization for has_partial_array_mask() for narrowOops above.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   142
  // This means that unintentional use of this method with narrowOops are caught
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   143
  // by the compiler.
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   144
  inline oop* set_partial_array_mask(oop obj) const {
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   145
    assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   146
    return (oop*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK);
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   147
  }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   148
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   149
  inline oop clear_partial_array_mask(oop* ref) const {
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   150
    return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   151
  }
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   152
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   153
  inline void do_oop_partial_array(oop* p);
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   154
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   155
  // This method is applied to the fields of the objects that have just been copied.
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
   156
  template <class T> inline void do_oop_evac(T* p, HeapRegion* from);
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   157
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
   158
  template <class T> inline void deal_with_reference(T* ref_to_scan);
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   159
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
   160
  inline void dispatch_reference(StarTask ref);
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   161
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   162
  // Tries to allocate word_sz in the PLAB of the next "generation" after trying to
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   163
  // allocate into dest. State is the original (source) cset state for the object
32377
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
   164
  // that is allocated for. Previous_plab_refill_failed indicates whether previously
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
   165
  // a PLAB refill into "state" failed.
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   166
  // Returns a non-NULL pointer if successful, and updates dest if required.
32377
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
   167
  // Also determines whether we should continue to try to allocate into the various
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
   168
  // generations or just end trying to allocate.
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   169
  HeapWord* allocate_in_next_plab(InCSetState const state,
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   170
                                  InCSetState* dest,
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   171
                                  size_t word_sz,
32377
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
   172
                                  AllocationContext_t const context,
5ee15c417d02 8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents: 32187
diff changeset
   173
                                  bool previous_plab_refill_failed);
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   174
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   175
  inline InCSetState next_state(InCSetState const state, markOop const m, uint& age);
32608
ef2ec6fac731 8066443: Add G1 support for promotion event
sfriberg
parents: 32382
diff changeset
   176
ef2ec6fac731 8066443: Add G1 support for promotion event
sfriberg
parents: 32382
diff changeset
   177
  void report_promotion_event(InCSetState const dest_state,
ef2ec6fac731 8066443: Add G1 support for promotion event
sfriberg
parents: 32382
diff changeset
   178
                              oop const old, size_t word_sz, uint age,
ef2ec6fac731 8066443: Add G1 support for promotion event
sfriberg
parents: 32382
diff changeset
   179
                              HeapWord * const obj_ptr, const AllocationContext_t context) const;
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
   180
 public:
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   181
28213
b0bf57cd1e9d 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents: 27682
diff changeset
   182
  oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   183
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
   184
  void trim_queue();
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   185
25483
962ccf95c515 8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents: 25482
diff changeset
   186
  inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
31976
da45f85bf4e1 8004687: G1: Parallelize object self-forwarding and scanning during an evacuation failure
tschatzl
parents: 30764
diff changeset
   187
da45f85bf4e1 8004687: G1: Parallelize object self-forwarding and scanning during an evacuation failure
tschatzl
parents: 30764
diff changeset
   188
  // An attempt to evacuate "obj" has failed; take necessary steps.
da45f85bf4e1 8004687: G1: Parallelize object self-forwarding and scanning during an evacuation failure
tschatzl
parents: 30764
diff changeset
   189
  oop handle_evacuation_failure_par(oop obj, markOop m);
25482
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   190
};
b69656f26643 8035400: Move G1ParScanThreadState into its own files
tschatzl
parents:
diff changeset
   191
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30568
diff changeset
   192
#endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP