duke@435: /* xdono@631: * Copyright 2001-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: # include "incls/_precompiled.incl" duke@435: # include "incls/_immutableSpace.cpp.incl" duke@435: duke@435: void ImmutableSpace::initialize(MemRegion mr) { duke@435: HeapWord* bottom = mr.start(); duke@435: HeapWord* end = mr.end(); duke@435: duke@435: assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end), duke@435: "invalid space boundaries"); duke@435: duke@435: _bottom = bottom; duke@435: _end = end; duke@435: } duke@435: duke@435: void ImmutableSpace::oop_iterate(OopClosure* cl) { duke@435: HeapWord* obj_addr = bottom(); duke@435: HeapWord* t = end(); duke@435: // Could call objects iterate, but this is easier. duke@435: while (obj_addr < t) { duke@435: obj_addr += oop(obj_addr)->oop_iterate(cl); duke@435: } duke@435: } duke@435: duke@435: void ImmutableSpace::object_iterate(ObjectClosure* cl) { duke@435: HeapWord* p = bottom(); duke@435: while (p < end()) { duke@435: cl->do_object(oop(p)); duke@435: p += oop(p)->size(); duke@435: } duke@435: } duke@435: duke@435: #ifndef PRODUCT duke@435: duke@435: void ImmutableSpace::print_short() const { duke@435: tty->print(" space " SIZE_FORMAT "K, 100%% used", capacity_in_bytes() / K); duke@435: } duke@435: duke@435: void ImmutableSpace::print() const { duke@435: print_short(); duke@435: tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end()); duke@435: } duke@435: duke@435: #endif duke@435: iveresov@625: void ImmutableSpace::verify(bool allow_dirty) { duke@435: HeapWord* p = bottom(); duke@435: HeapWord* t = end(); duke@435: HeapWord* prev_p = NULL; duke@435: while (p < t) { duke@435: oop(p)->verify(); duke@435: prev_p = p; duke@435: p += oop(p)->size(); duke@435: } duke@435: guarantee(p == end(), "end of last object must match end of space"); duke@435: }