Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shared/copyFailedInfo.hpp
38920 views
/*1* Copyright (c) 2012, 2013, 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#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_COPYFAILEDINFO_HPP25#define SHARE_VM_GC_IMPLEMENTATION_SHARED_COPYFAILEDINFO_HPP2627#include "runtime/thread.hpp"28#include "utilities/globalDefinitions.hpp"2930class CopyFailedInfo : public CHeapObj<mtGC> {31size_t _first_size;32size_t _smallest_size;33size_t _total_size;34uint _count;3536public:37CopyFailedInfo() : _first_size(0), _smallest_size(0), _total_size(0), _count(0) {}3839virtual void register_copy_failure(size_t size) {40if (_first_size == 0) {41_first_size = size;42_smallest_size = size;43} else if (size < _smallest_size) {44_smallest_size = size;45}46_total_size += size;47_count++;48}4950virtual void reset() {51_first_size = 0;52_smallest_size = 0;53_total_size = 0;54_count = 0;55}5657bool has_failed() const { return _count != 0; }58size_t first_size() const { return _first_size; }59size_t smallest_size() const { return _smallest_size; }60size_t total_size() const { return _total_size; }61uint failed_count() const { return _count; }62};6364class PromotionFailedInfo : public CopyFailedInfo {65OSThread* _thread;6667public:68PromotionFailedInfo() : CopyFailedInfo(), _thread(NULL) {}6970void register_copy_failure(size_t size) {71CopyFailedInfo::register_copy_failure(size);72if (_thread == NULL) {73_thread = Thread::current()->osthread();74} else {75assert(_thread == Thread::current()->osthread(), "The PromotionFailedInfo should be thread local.");76}77}7879void reset() {80CopyFailedInfo::reset();81_thread = NULL;82}8384OSThread* thread() const { return _thread; }85};8687class EvacuationFailedInfo : public CopyFailedInfo {};8889#endif /* SHARE_VM_GC_IMPLEMENTATION_SHARED_COPYFAILEDINFO_HPP */909192