annotate hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp @ 27682:dbd1c3f92130

8064473: Improved handling of age during object copy in G1 Reviewed-by: brutisso, tschatzl
author sfriberg
date Fri, 14 Nov 2014 15:03:39 +0100
parents 37f75ba502b1
children af9a41999c6e
rev   line source
duke@1 1 /*
stefank@7397 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation.
duke@1 8 *
duke@1 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 13 * accompanied this code).
duke@1 14 *
duke@1 15 * You should have received a copy of the GNU General Public License version
duke@1 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 18 *
trims@5547 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@5547 20 * or visit www.oracle.com if you need additional information or have any
trims@5547 21 * questions.
duke@1 22 *
duke@1 23 */
duke@1 24
stefank@7397 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_AGETABLE_HPP
stefank@7397 26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_AGETABLE_HPP
stefank@7397 27
stefank@7397 28 #include "oops/markOop.hpp"
stefank@7397 29 #include "oops/oop.hpp"
stefank@7397 30 #include "runtime/perfData.hpp"
stefank@7397 31
trims@5547 32 /* Copyright (c) 1992-2009 Oracle and/or its affiliates, and Stanford University.
duke@1 33 See the LICENSE file for license information. */
duke@1 34
duke@1 35 // Age table for adaptive feedback-mediated tenuring (scavenging)
duke@1 36 //
duke@1 37 // Note: all sizes are in oops
duke@1 38
duke@1 39 class ageTable VALUE_OBJ_CLASS_SPEC {
duke@1 40 friend class VMStructs;
duke@1 41
duke@1 42 public:
duke@1 43 // constants
duke@1 44 enum { table_size = markOopDesc::max_age + 1 };
duke@1 45
duke@1 46 // instance variables
duke@1 47 size_t sizes[table_size];
duke@1 48
duke@1 49 // constructor. "global" indicates that this is the global age table
duke@1 50 // (as opposed to gc-thread-local)
duke@1 51 ageTable(bool global = true);
duke@1 52
duke@1 53 // clear table
duke@1 54 void clear();
duke@1 55
duke@1 56 // add entry
duke@1 57 void add(oop p, size_t oop_size) {
sfriberg@27682 58 add(p->age(), oop_size);
sfriberg@27682 59 }
sfriberg@27682 60
sfriberg@27682 61 void add(uint age, size_t oop_size) {
duke@1 62 assert(age > 0 && age < table_size, "invalid age of object");
duke@1 63 sizes[age] += oop_size;
duke@1 64 }
duke@1 65
duke@1 66 // Merge another age table with the current one. Used
duke@1 67 // for parallel young generation gc.
duke@1 68 void merge(ageTable* subTable);
apetrusenko@2009 69 void merge_par(ageTable* subTable);
duke@1 70
duke@1 71 // calculate new tenuring threshold based on age information
jwilhelm@13925 72 uint compute_tenuring_threshold(size_t survivor_capacity);
duke@1 73
duke@1 74 private:
duke@1 75 PerfVariable* _perf_sizes[table_size];
duke@1 76 };
stefank@7397 77
stefank@7397 78 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_AGETABLE_HPP