Path: blob/master/src/hotspot/share/gc/shared/ageTable.hpp
40957 views
/*1* Copyright (c) 1997, 2021, 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_GC_SHARED_AGETABLE_HPP25#define SHARE_GC_SHARED_AGETABLE_HPP2627#include "oops/markWord.hpp"28#include "oops/oop.hpp"29#include "runtime/perfDataTypes.hpp"3031/* Copyright (c) 1992, 2021, Oracle and/or its affiliates, and Stanford University.32See the LICENSE file for license information. */3334// Age table for adaptive feedback-mediated tenuring (scavenging)35//36// Note: all sizes are in oops3738class AgeTable {39friend class VMStructs;4041public:42// constants43enum { table_size = markWord::max_age + 1 };4445// instance variables46size_t sizes[table_size];4748// constructor. "global" indicates that this is the global age table49// (as opposed to gc-thread-local)50AgeTable(bool global = true);5152// clear table53void clear();5455// add entry56inline void add(oop p, size_t oop_size);5758void add(uint age, size_t oop_size) {59assert(age > 0 && age < table_size, "invalid age of object");60sizes[age] += oop_size;61}6263// Merge another age table with the current one. Used64// for parallel young generation gc.65void merge(AgeTable* subTable);6667// Calculate new tenuring threshold based on age information.68uint compute_tenuring_threshold(size_t desired_survivor_size);69void print_age_table(uint tenuring_threshold);7071private:7273PerfVariable* _perf_sizes[table_size];74};7576#endif // SHARE_GC_SHARED_AGETABLE_HPP777879