duke@435: /* xdono@631: * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: // All heaps contains a "permanent generation," containing permanent duke@435: // (reflective) objects. This is like a regular generation in some ways, duke@435: // but unlike one in others, and so is split apart. duke@435: duke@435: class Generation; duke@435: class GenRemSet; duke@435: class CSpaceCounters; duke@435: duke@435: // PermGen models the part of the heap duke@435: duke@435: class PermGen : public CHeapObj { duke@435: friend class VMStructs; duke@435: protected: duke@435: size_t _capacity_expansion_limit; // maximum expansion allowed without a twisti@1040: // full gc occurring duke@435: apetrusenko@574: HeapWord* mem_allocate_in_gen(size_t size, Generation* gen); apetrusenko@574: duke@435: public: duke@435: enum Name { duke@435: MarkSweepCompact, MarkSweep, ConcurrentMarkSweep duke@435: }; duke@435: duke@435: // Permanent allocation (initialized) duke@435: virtual HeapWord* mem_allocate(size_t size) = 0; duke@435: duke@435: // Mark sweep support duke@435: virtual void compute_new_size() = 0; duke@435: duke@435: // Ideally, we would use MI (IMHO) but we'll do delegation instead. duke@435: virtual Generation* as_gen() const = 0; duke@435: duke@435: virtual void oop_iterate(OopClosure* cl) { duke@435: Generation* g = as_gen(); duke@435: assert(g != NULL, "as_gen() NULL"); duke@435: g->oop_iterate(cl); duke@435: } duke@435: duke@435: virtual void object_iterate(ObjectClosure* cl) { duke@435: Generation* g = as_gen(); duke@435: assert(g != NULL, "as_gen() NULL"); duke@435: g->object_iterate(cl); duke@435: } duke@435: duke@435: // Performance Counter support duke@435: virtual void update_counters() { duke@435: Generation* g = as_gen(); duke@435: assert(g != NULL, "as_gen() NULL"); duke@435: g->update_counters(); duke@435: } duke@435: };