src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp

Fri, 12 Jun 2009 16:20:16 -0400

author
tonyp
date
Fri, 12 Jun 2009 16:20:16 -0400
changeset 1246
830ca2573896
parent 1230
215f81b4d9b3
child 1324
15c5903cf9e1
permissions
-rw-r--r--

6850846: G1: extend G1 marking verification
Summary: extend G1 marking verification to use either the "prev" or "next" marking information, as appropriate.
Reviewed-by: johnc, ysr

     1 /*
     2  * Copyright 2001-2009 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // Forward decl
    26 class ConcurrentG1RefineThread;
    27 class G1RemSet;
    29 class ConcurrentG1Refine: public CHeapObj {
    30   ConcurrentG1RefineThread** _threads;
    31   int _n_threads;
    32   // The cache for card refinement.
    33   bool     _use_cache;
    34   bool     _def_use_cache;
    35   size_t _n_periods;
    36   size_t _total_cards;
    37   size_t _total_travs;
    39   unsigned char*  _card_counts;
    40   unsigned _n_card_counts;
    41   const jbyte* _ct_bot;
    42   unsigned* _cur_card_count_histo;
    43   unsigned* _cum_card_count_histo;
    44   jbyte**  _hot_cache;
    45   int      _hot_cache_size;
    46   int      _n_hot;
    47   int      _hot_cache_idx;
    49   // Returns the count of this card after incrementing it.
    50   int add_card_count(jbyte* card_ptr);
    52   void print_card_count_histo_range(unsigned* histo, int from, int to,
    53                                     float& cum_card_pct,
    54                                     float& cum_travs_pct);
    55  public:
    56   ConcurrentG1Refine();
    57   ~ConcurrentG1Refine();
    59   void init(); // Accomplish some initialization that has to wait.
    60   void stop();
    62   // Iterate over the conc refine threads
    63   void threads_do(ThreadClosure *tc);
    65   // If this is the first entry for the slot, writes into the cache and
    66   // returns NULL.  If it causes an eviction, returns the evicted pointer.
    67   // Otherwise, its a cache hit, and returns NULL.
    68   jbyte* cache_insert(jbyte* card_ptr);
    70   // Process the cached entries.
    71   void clean_up_cache(int worker_i, G1RemSet* g1rs);
    73   // Discard entries in the hot cache.
    74   void clear_hot_cache() {
    75     _hot_cache_idx = 0; _n_hot = 0;
    76   }
    78   bool hot_cache_is_empty() { return _n_hot == 0; }
    80   bool use_cache() { return _use_cache; }
    81   void set_use_cache(bool b) {
    82     if (b) _use_cache = _def_use_cache;
    83     else   _use_cache = false;
    84   }
    86   void clear_and_record_card_counts();
    87   void print_final_card_counts();
    89   static size_t thread_num();
    90 };

mercurial