< prev index next >

src/share/vm/gc/g1/g1StringDedup.hpp

Print this page
rev 8362 : [mq]: hotspot
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUP_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUP_HPP
  27 
  28 //
  29 // String Deduplication
  30 //
  31 // String deduplication aims to reduce the heap live-set by deduplicating identical
  32 // instances of String so that they share the same backing character array.
  33 //
  34 // The deduplication process is divided in two main parts, 1) finding the objects to
  35 // deduplicate, and 2) deduplicating those objects. The first part is done as part of
  36 // a normal GC cycle when objects are marked or evacuated. At this time a check is
  37 // applied on each object to check if it is a candidate for deduplication. If so, the
  38 // object is placed on the deduplication queue for later processing. The second part,
  39 // processing the objects on the deduplication queue, is a concurrent phase which
  40 // starts right after the stop-the-wold marking/evacuation phase. This phase is
  41 // executed by the deduplication thread, which pulls deduplication candidates of the
  42 // deduplication queue and tries to deduplicate them.
  43 //
  44 // A deduplication hashtable is used to keep track of all unique character arrays
  45 // used by String objects. When deduplicating, a lookup is made in this table to see
  46 // if there is already an identical character array somewhere on the heap. If so, the


 184   size_t claim_table_partition(size_t partition_size);
 185 
 186   // Applies and returns the result from the is_alive closure, or
 187   // returns true if no such closure was provided.
 188   bool is_alive(oop o) {
 189     if (_is_alive != NULL) {
 190       return _is_alive->do_object_b(o);
 191     }
 192     return true;
 193   }
 194 
 195   // Applies the keep_alive closure, or does nothing if no such
 196   // closure was provided.
 197   void keep_alive(oop* p) {
 198     if (_keep_alive != NULL) {
 199       _keep_alive->do_oop(p);
 200     }
 201   }
 202 };
 203 
 204 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUP_HPP
   1 /*
   2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1STRINGDEDUP_HPP
  26 #define SHARE_VM_GC_G1_G1STRINGDEDUP_HPP
  27 
  28 //
  29 // String Deduplication
  30 //
  31 // String deduplication aims to reduce the heap live-set by deduplicating identical
  32 // instances of String so that they share the same backing character array.
  33 //
  34 // The deduplication process is divided in two main parts, 1) finding the objects to
  35 // deduplicate, and 2) deduplicating those objects. The first part is done as part of
  36 // a normal GC cycle when objects are marked or evacuated. At this time a check is
  37 // applied on each object to check if it is a candidate for deduplication. If so, the
  38 // object is placed on the deduplication queue for later processing. The second part,
  39 // processing the objects on the deduplication queue, is a concurrent phase which
  40 // starts right after the stop-the-wold marking/evacuation phase. This phase is
  41 // executed by the deduplication thread, which pulls deduplication candidates of the
  42 // deduplication queue and tries to deduplicate them.
  43 //
  44 // A deduplication hashtable is used to keep track of all unique character arrays
  45 // used by String objects. When deduplicating, a lookup is made in this table to see
  46 // if there is already an identical character array somewhere on the heap. If so, the


 184   size_t claim_table_partition(size_t partition_size);
 185 
 186   // Applies and returns the result from the is_alive closure, or
 187   // returns true if no such closure was provided.
 188   bool is_alive(oop o) {
 189     if (_is_alive != NULL) {
 190       return _is_alive->do_object_b(o);
 191     }
 192     return true;
 193   }
 194 
 195   // Applies the keep_alive closure, or does nothing if no such
 196   // closure was provided.
 197   void keep_alive(oop* p) {
 198     if (_keep_alive != NULL) {
 199       _keep_alive->do_oop(p);
 200     }
 201   }
 202 };
 203 
 204 #endif // SHARE_VM_GC_G1_G1STRINGDEDUP_HPP
< prev index next >