Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp
38920 views
/*1* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "gc_implementation/g1/g1HRPrinter.hpp"26#include "gc_implementation/g1/heapRegion.hpp"27#include "utilities/ostream.hpp"2829PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC3031const char* G1HRPrinter::action_name(ActionType action) {32switch(action) {33case Alloc: return "ALLOC";34case AllocForce: return "ALLOC-FORCE";35case Retire: return "RETIRE";36case Reuse: return "REUSE";37case CSet: return "CSET";38case EvacFailure: return "EVAC-FAILURE";39case Cleanup: return "CLEANUP";40case PostCompaction: return "POST-COMPACTION";41case Commit: return "COMMIT";42case Uncommit: return "UNCOMMIT";43default: ShouldNotReachHere();44}45// trying to keep the Windows compiler happy46return NULL;47}4849const char* G1HRPrinter::region_type_name(RegionType type) {50switch (type) {51case Unset: return NULL;52case Eden: return "Eden";53case Survivor: return "Survivor";54case Old: return "Old";55case SingleHumongous: return "SingleH";56case StartsHumongous: return "StartsH";57case ContinuesHumongous: return "ContinuesH";58default: ShouldNotReachHere();59}60// trying to keep the Windows compiler happy61return NULL;62}6364const char* G1HRPrinter::phase_name(PhaseType phase) {65switch (phase) {66case StartGC: return "StartGC";67case EndGC: return "EndGC";68case StartFullGC: return "StartFullGC";69case EndFullGC: return "EndFullGC";70default: ShouldNotReachHere();71}72// trying to keep the Windows compiler happy73return NULL;74}7576#define G1HR_PREFIX " G1HR"7778void G1HRPrinter::print(ActionType action, RegionType type,79HeapRegion* hr, HeapWord* top) {80const char* action_str = action_name(action);81const char* type_str = region_type_name(type);82HeapWord* bottom = hr->bottom();8384if (type_str != NULL) {85if (top != NULL) {86gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT " " PTR_FORMAT,87action_str, type_str, bottom, top);88} else {89gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT,90action_str, type_str, bottom);91}92} else {93if (top != NULL) {94gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT " " PTR_FORMAT,95action_str, bottom, top);96} else {97gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT,98action_str, bottom);99}100}101}102103void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {104const char* action_str = action_name(action);105106gclog_or_tty->print_cr(G1HR_PREFIX " %s [" PTR_FORMAT "," PTR_FORMAT "]",107action_str, bottom, end);108}109110void G1HRPrinter::print(PhaseType phase, size_t phase_num) {111const char* phase_str = phase_name(phase);112gclog_or_tty->print_cr(G1HR_PREFIX " #%s " SIZE_FORMAT, phase_str, phase_num);113}114115116