src/share/vm/gc_implementation/g1/g1HRPrinter.cpp

Sat, 07 Nov 2020 10:30:02 +0800

author
aoqi
date
Sat, 07 Nov 2020 10:30:02 +0800
changeset 10026
8c95980d0b66
parent 9448
73d689add964
permissions
-rw-r--r--

Added tag mips-jdk8u275-b01 for changeset d3b4d62f391f

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #include "precompiled.hpp"
aoqi@0 26 #include "gc_implementation/g1/g1HRPrinter.hpp"
aoqi@0 27 #include "gc_implementation/g1/heapRegion.hpp"
aoqi@0 28 #include "utilities/ostream.hpp"
aoqi@0 29
aoqi@0 30 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
aoqi@0 31
aoqi@0 32 const char* G1HRPrinter::action_name(ActionType action) {
aoqi@0 33 switch(action) {
aoqi@0 34 case Alloc: return "ALLOC";
aoqi@0 35 case AllocForce: return "ALLOC-FORCE";
aoqi@0 36 case Retire: return "RETIRE";
aoqi@0 37 case Reuse: return "REUSE";
aoqi@0 38 case CSet: return "CSET";
aoqi@0 39 case EvacFailure: return "EVAC-FAILURE";
aoqi@0 40 case Cleanup: return "CLEANUP";
aoqi@0 41 case PostCompaction: return "POST-COMPACTION";
aoqi@0 42 case Commit: return "COMMIT";
aoqi@0 43 case Uncommit: return "UNCOMMIT";
aoqi@0 44 default: ShouldNotReachHere();
aoqi@0 45 }
aoqi@0 46 // trying to keep the Windows compiler happy
aoqi@0 47 return NULL;
aoqi@0 48 }
aoqi@0 49
aoqi@0 50 const char* G1HRPrinter::region_type_name(RegionType type) {
aoqi@0 51 switch (type) {
aoqi@0 52 case Unset: return NULL;
aoqi@0 53 case Eden: return "Eden";
aoqi@0 54 case Survivor: return "Survivor";
aoqi@0 55 case Old: return "Old";
aoqi@0 56 case SingleHumongous: return "SingleH";
aoqi@0 57 case StartsHumongous: return "StartsH";
aoqi@0 58 case ContinuesHumongous: return "ContinuesH";
aoqi@0 59 default: ShouldNotReachHere();
aoqi@0 60 }
aoqi@0 61 // trying to keep the Windows compiler happy
aoqi@0 62 return NULL;
aoqi@0 63 }
aoqi@0 64
aoqi@0 65 const char* G1HRPrinter::phase_name(PhaseType phase) {
aoqi@0 66 switch (phase) {
aoqi@0 67 case StartGC: return "StartGC";
aoqi@0 68 case EndGC: return "EndGC";
aoqi@0 69 case StartFullGC: return "StartFullGC";
aoqi@0 70 case EndFullGC: return "EndFullGC";
aoqi@0 71 default: ShouldNotReachHere();
aoqi@0 72 }
aoqi@0 73 // trying to keep the Windows compiler happy
aoqi@0 74 return NULL;
aoqi@0 75 }
aoqi@0 76
aoqi@0 77 #define G1HR_PREFIX " G1HR"
aoqi@0 78
aoqi@0 79 void G1HRPrinter::print(ActionType action, RegionType type,
aoqi@0 80 HeapRegion* hr, HeapWord* top) {
aoqi@0 81 const char* action_str = action_name(action);
aoqi@0 82 const char* type_str = region_type_name(type);
aoqi@0 83 HeapWord* bottom = hr->bottom();
aoqi@0 84
aoqi@0 85 if (type_str != NULL) {
aoqi@0 86 if (top != NULL) {
kevinw@9327 87 gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT " " PTR_FORMAT,
aoqi@0 88 action_str, type_str, bottom, top);
aoqi@0 89 } else {
kevinw@9327 90 gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT,
aoqi@0 91 action_str, type_str, bottom);
aoqi@0 92 }
aoqi@0 93 } else {
aoqi@0 94 if (top != NULL) {
kevinw@9327 95 gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT " " PTR_FORMAT,
aoqi@0 96 action_str, bottom, top);
aoqi@0 97 } else {
kevinw@9327 98 gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT,
aoqi@0 99 action_str, bottom);
aoqi@0 100 }
aoqi@0 101 }
aoqi@0 102 }
aoqi@0 103
aoqi@0 104 void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {
aoqi@0 105 const char* action_str = action_name(action);
aoqi@0 106
kevinw@9327 107 gclog_or_tty->print_cr(G1HR_PREFIX " %s [" PTR_FORMAT "," PTR_FORMAT "]",
aoqi@0 108 action_str, bottom, end);
aoqi@0 109 }
aoqi@0 110
aoqi@0 111 void G1HRPrinter::print(PhaseType phase, size_t phase_num) {
aoqi@0 112 const char* phase_str = phase_name(phase);
kevinw@9327 113 gclog_or_tty->print_cr(G1HR_PREFIX " #%s " SIZE_FORMAT, phase_str, phase_num);
aoqi@0 114 }

mercurial