hotspot/src/share/vm/gc/g1/g1StringDedup.hpp
author tschatzl
Wed, 25 Nov 2015 14:43:29 +0100
changeset 34300 6075c1e0e913
parent 30764 fec48bf5a827
child 40655 9f644073d3a0
permissions -rw-r--r--
8136679: JFR event for adaptive IHOP Reviewed-by: tbenson, mgerdin, sangheki, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29680
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     4
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     8
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    13
 * accompanied this code).
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    14
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    18
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    21
 * questions.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    22
 *
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    23
 */
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29680
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1STRINGDEDUP_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29680
diff changeset
    26
#define SHARE_VM_GC_G1_G1STRINGDEDUP_HPP
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    27
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    28
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    29
// String Deduplication
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    30
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    31
// String deduplication aims to reduce the heap live-set by deduplicating identical
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    32
// instances of String so that they share the same backing character array.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    33
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    34
// The deduplication process is divided in two main parts, 1) finding the objects to
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    35
// deduplicate, and 2) deduplicating those objects. The first part is done as part of
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    36
// a normal GC cycle when objects are marked or evacuated. At this time a check is
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    37
// applied on each object to check if it is a candidate for deduplication. If so, the
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    38
// object is placed on the deduplication queue for later processing. The second part,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    39
// processing the objects on the deduplication queue, is a concurrent phase which
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    40
// starts right after the stop-the-wold marking/evacuation phase. This phase is
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    41
// executed by the deduplication thread, which pulls deduplication candidates of the
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    42
// deduplication queue and tries to deduplicate them.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    43
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    44
// A deduplication hashtable is used to keep track of all unique character arrays
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    45
// used by String objects. When deduplicating, a lookup is made in this table to see
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    46
// if there is already an identical character array somewhere on the heap. If so, the
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    47
// String object is adjusted to point to that character array, releasing the reference
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    48
// to the original array allowing it to eventually be garbage collected. If the lookup
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    49
// fails the character array is instead inserted into the hashtable so that this array
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    50
// can be shared at some point in the future.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    51
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    52
// Candidate selection
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    53
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    54
// An object is considered a deduplication candidate if all of the following
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    55
// statements are true:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    56
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    57
// - The object is an instance of java.lang.String
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    58
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    59
// - The object is being evacuated from a young heap region
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    60
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    61
// - The object is being evacuated to a young/survivor heap region and the
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    62
//   object's age is equal to the deduplication age threshold
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    63
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    64
//   or
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    65
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    66
//   The object is being evacuated to an old heap region and the object's age is
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    67
//   less than the deduplication age threshold
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    68
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    69
// Once an string object has been promoted to an old region, or its age is higher
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    70
// than the deduplication age threshold, is will never become a candidate again.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    71
// This approach avoids making the same object a candidate more than once.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    72
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    73
// Interned strings are a bit special. They are explicitly deduplicated just before
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    74
// being inserted into the StringTable (to avoid counteracting C2 optimizations done
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    75
// on string literals), then they also become deduplication candidates if they reach
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    76
// the deduplication age threshold or are evacuated to an old heap region. The second
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    77
// attempt to deduplicate such strings will be in vain, but we have no fast way of
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    78
// filtering them out. This has not shown to be a problem, as the number of interned
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    79
// strings is usually dwarfed by the number of normal (non-interned) strings.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    80
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    81
// For additional information on string deduplication, please see JEP 192,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    82
// http://openjdk.java.net/jeps/192
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    83
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    84
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    85
#include "memory/allocation.hpp"
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    86
#include "oops/oop.hpp"
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 24093
diff changeset
    87
#include "runtime/atomic.hpp"
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    88
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    89
class OopClosure;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    90
class BoolObjectClosure;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    91
class ThreadClosure;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    92
class outputStream;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    93
class G1StringDedupTable;
29680
e5203ed6d805 8074037: Refactor the G1GCPhaseTime logging to make it easier to add new phases
brutisso
parents: 25351
diff changeset
    94
class G1GCPhaseTimes;
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    95
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    96
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    97
// Main interface for interacting with string deduplication.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    98
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
    99
class G1StringDedup : public AllStatic {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   100
private:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   101
  // Single state for checking if both G1 and string deduplication is enabled.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   102
  static bool _enabled;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   103
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   104
  // Candidate selection policies, returns true if the given object is
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   105
  // candidate for string deduplication.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   106
  static bool is_candidate_from_mark(oop obj);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   107
  static bool is_candidate_from_evacuation(bool from_young, bool to_young, oop obj);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   108
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   109
public:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   110
  // Returns true if both G1 and string deduplication is enabled.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   111
  static bool is_enabled() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   112
    return _enabled;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   113
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   114
24093
095cc0a63ed9 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 23472
diff changeset
   115
  // Initialize string deduplication.
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   116
  static void initialize();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   117
24093
095cc0a63ed9 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 23472
diff changeset
   118
  // Stop the deduplication thread.
095cc0a63ed9 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 23472
diff changeset
   119
  static void stop();
095cc0a63ed9 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 23472
diff changeset
   120
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   121
  // Immediately deduplicates the given String object, bypassing the
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   122
  // the deduplication queue.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   123
  static void deduplicate(oop java_string);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   124
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   125
  // Enqueues a deduplication candidate for later processing by the deduplication
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   126
  // thread. Before enqueuing, these functions apply the appropriate candidate
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   127
  // selection policy to filters out non-candidates.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   128
  static void enqueue_from_mark(oop java_string);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   129
  static void enqueue_from_evacuation(bool from_young, bool to_young,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   130
                                      unsigned int queue, oop java_string);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   131
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   132
  static void oops_do(OopClosure* keep_alive);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   133
  static void unlink(BoolObjectClosure* is_alive);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   134
  static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive,
29680
e5203ed6d805 8074037: Refactor the G1GCPhaseTime logging to make it easier to add new phases
brutisso
parents: 25351
diff changeset
   135
                                bool allow_resize_and_rehash, G1GCPhaseTimes* phase_times = NULL);
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   136
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   137
  static void threads_do(ThreadClosure* tc);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   138
  static void print_worker_threads_on(outputStream* st);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   139
  static void verify();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   140
};
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   141
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   142
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   143
// This closure encapsulates the state and the closures needed when scanning
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   144
// the deduplication queue and table during the unlink_or_oops_do() operation.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   145
// A single instance of this closure is created and then shared by all worker
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   146
// threads participating in the scan. The _next_queue and _next_bucket fields
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   147
// provide a simple mechanism for GC workers to claim exclusive access to a
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   148
// queue or a table partition.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   149
//
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   150
class G1StringDedupUnlinkOrOopsDoClosure : public StackObj {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   151
private:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   152
  BoolObjectClosure*  _is_alive;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   153
  OopClosure*         _keep_alive;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   154
  G1StringDedupTable* _resized_table;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   155
  G1StringDedupTable* _rehashed_table;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   156
  size_t              _next_queue;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   157
  size_t              _next_bucket;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   158
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   159
public:
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   160
  G1StringDedupUnlinkOrOopsDoClosure(BoolObjectClosure* is_alive,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   161
                                     OopClosure* keep_alive,
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   162
                                     bool allow_resize_and_rehash);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   163
  ~G1StringDedupUnlinkOrOopsDoClosure();
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   164
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   165
  bool is_resizing() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   166
    return _resized_table != NULL;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   167
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   168
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   169
  G1StringDedupTable* resized_table() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   170
    return _resized_table;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   171
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   172
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   173
  bool is_rehashing() {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   174
    return _rehashed_table != NULL;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   175
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   176
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   177
  // Atomically claims the next available queue for exclusive access by
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   178
  // the current thread. Returns the queue number of the claimed queue.
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 24093
diff changeset
   179
  size_t claim_queue();
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   180
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   181
  // Atomically claims the next available table partition for exclusive
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   182
  // access by the current thread. Returns the table bucket number where
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   183
  // the claimed partition starts.
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 24093
diff changeset
   184
  size_t claim_table_partition(size_t partition_size);
23472
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   185
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   186
  // Applies and returns the result from the is_alive closure, or
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   187
  // returns true if no such closure was provided.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   188
  bool is_alive(oop o) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   189
    if (_is_alive != NULL) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   190
      return _is_alive->do_object_b(o);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   191
    }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   192
    return true;
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   193
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   194
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   195
  // Applies the keep_alive closure, or does nothing if no such
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   196
  // closure was provided.
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   197
  void keep_alive(oop* p) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   198
    if (_keep_alive != NULL) {
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   199
      _keep_alive->do_oop(p);
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   200
    }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   201
  }
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   202
};
35e93890ed88 8029075: String deduplication in G1
pliden
parents:
diff changeset
   203
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29680
diff changeset
   204
#endif // SHARE_VM_GC_G1_G1STRINGDEDUP_HPP