hotspot/src/share/vm/memory/specialized_oop_closures.cpp
author jwilhelm
Fri, 01 Nov 2013 17:09:38 +0100
changeset 21561 c619b1cb4554
parent 7397 5b173b4ca846
permissions -rw-r--r--
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking 7057939: jmap shows MaxNewSize=4GB when Java is using parallel collector Summary: Major cleanup of the collectorpolicy classes Reviewed-by: tschatzl, jcoomes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2001, 2010, 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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "memory/specialized_oop_closures.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "utilities/ostream.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// For keeping stats on effectiveness.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
#if ENABLE_SPECIALIZATION_STATS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
int SpecializationStats::_numCallsAll;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
int SpecializationStats::_numCallsTotal[NUM_Kinds];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
int SpecializationStats::_numCalls_nv[NUM_Kinds];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
int SpecializationStats::_numDoOopCallsTotal[NUM_Kinds];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
int SpecializationStats::_numDoOopCalls_nv[NUM_Kinds];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
void SpecializationStats::clear() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  _numCallsAll = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  for (int k = ik; k < NUM_Kinds; k++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    _numCallsTotal[k] = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    _numCalls_nv[k] = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    _numDoOopCallsTotal[k] = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    _numDoOopCalls_nv[k] = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
void SpecializationStats::print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  const char* header_format = "    %20s %10s %11s %10s";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  const char* line_format   = "    %20s %10d %11d %9.2f%%";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  int all_numCallsTotal =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    _numCallsTotal[ik] + _numCallsTotal[irk] + _numCallsTotal[oa];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  int all_numCalls_nv =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    _numCalls_nv[ik] + _numCalls_nv[irk] + _numCalls_nv[oa];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  gclog_or_tty->print_cr("\nOf %d oop_oop_iterate calls %d (%6.3f%%) are in (ik, irk, oa).",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
                _numCallsAll, all_numCallsTotal,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
                100.0 * (float)all_numCallsTotal / (float)_numCallsAll);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // irk calls are double-counted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  int real_ik_numCallsTotal = _numCallsTotal[ik] - _numCallsTotal[irk];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  int real_ik_numCalls_nv   = _numCalls_nv[ik]   - _numCalls_nv[irk];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  gclog_or_tty->print_cr("");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  gclog_or_tty->print_cr(header_format, "oop_oop_iterate:", "calls", "non-virtual", "pct");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  gclog_or_tty->print_cr(header_format,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
                "----------",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
                "----------",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
                "-----------",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
                "----------");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  gclog_or_tty->print_cr(line_format, "all",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
                all_numCallsTotal,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
                all_numCalls_nv,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
                100.0 * (float)all_numCalls_nv / (float)all_numCallsTotal);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  gclog_or_tty->print_cr(line_format, "ik",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
                real_ik_numCallsTotal, real_ik_numCalls_nv,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
                100.0 * (float)real_ik_numCalls_nv /
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
                (float)real_ik_numCallsTotal);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  gclog_or_tty->print_cr(line_format, "irk",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
                _numCallsTotal[irk], _numCalls_nv[irk],
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
                100.0 * (float)_numCalls_nv[irk] / (float)_numCallsTotal[irk]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  gclog_or_tty->print_cr(line_format, "oa",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
                _numCallsTotal[oa], _numCalls_nv[oa],
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
                100.0 * (float)_numCalls_nv[oa] / (float)_numCallsTotal[oa]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  gclog_or_tty->print_cr("");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  gclog_or_tty->print_cr(header_format, "do_oop:", "calls", "non-virtual", "pct");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  gclog_or_tty->print_cr(header_format,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
                "----------",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
                "----------",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
                "-----------",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                "----------");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  int all_numDoOopCallsTotal =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    _numDoOopCallsTotal[ik] + _numDoOopCallsTotal[irk] + _numDoOopCallsTotal[oa];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  int all_numDoOopCalls_nv =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    _numDoOopCalls_nv[ik] + _numDoOopCalls_nv[irk] + _numDoOopCalls_nv[oa];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  gclog_or_tty->print_cr(line_format, "all",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
                all_numDoOopCallsTotal, all_numDoOopCalls_nv,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
                100.0 * (float)all_numDoOopCalls_nv /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
                (float)all_numDoOopCallsTotal);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  const char* kind_names[] = { "ik", "irk", "oa" };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  for (int k = ik; k < NUM_Kinds; k++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    gclog_or_tty->print_cr(line_format, kind_names[k],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
                  _numDoOopCallsTotal[k], _numDoOopCalls_nv[k],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
                  (_numDoOopCallsTotal[k] > 0 ?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
                   100.0 * (float)_numDoOopCalls_nv[k] /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
                   (float)_numDoOopCallsTotal[k]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                   : 0.0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
#endif  // ENABLE_SPECIALIZATION_STATS
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
#endif  // !PRODUCT