0N/A/*
0N/A * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
2362N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
2362N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
2362N/A *
0N/A */
0N/A
0N/A#include "precompiled.hpp"
0N/A#ifndef SERIALGC
0N/A#include "gc_implementation/shared/immutableSpace.hpp"
0N/A#include "memory/universe.hpp"
3171N/A#include "oops/oop.inline.hpp"
0N/A#endif
0N/A
0N/Avoid ImmutableSpace::initialize(MemRegion mr) {
0N/A HeapWord* bottom = mr.start();
0N/A HeapWord* end = mr.end();
0N/A
0N/A assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end),
0N/A "invalid space boundaries");
0N/A
0N/A _bottom = bottom;
0N/A _end = end;
0N/A}
0N/A
0N/Avoid ImmutableSpace::oop_iterate(OopClosure* cl) {
1693N/A HeapWord* obj_addr = bottom();
1693N/A HeapWord* t = end();
1693N/A // Could call objects iterate, but this is easier.
1693N/A while (obj_addr < t) {
3171N/A obj_addr += oop(obj_addr)->oop_iterate(cl);
3171N/A }
3171N/A}
3171N/A
3171N/Avoid ImmutableSpace::object_iterate(ObjectClosure* cl) {
3171N/A HeapWord* p = bottom();
3171N/A while (p < end()) {
3171N/A cl->do_object(oop(p));
3171N/A p += oop(p)->size();
3171N/A }
0N/A}
0N/A
0N/A#ifndef PRODUCT
0N/A
0N/Avoid ImmutableSpace::print_short() const {
0N/A tty->print(" space " SIZE_FORMAT "K, 100%% used", capacity_in_bytes() / K);
0N/A}
0N/A
0N/Avoid ImmutableSpace::print() const {
0N/A print_short();
0N/A tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end());
0N/A}
0N/A
0N/A#endif
0N/A
0N/Avoid ImmutableSpace::verify() {
0N/A HeapWord* p = bottom();
3171N/A HeapWord* t = end();
0N/A HeapWord* prev_p = NULL;
0N/A while (p < t) {
0N/A oop(p)->verify();
0N/A prev_p = p;
0N/A p += oop(p)->size();
0N/A }
0N/A guarantee(p == end(), "end of last object must match end of space");
0N/A}
0N/A