Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp
38920 views
/*1* Copyright (c) 2001, 2014, 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#include "precompiled.hpp"25#include "utilities/macros.hpp"26#if INCLUDE_ALL_GCS27#include "gc_implementation/shared/immutableSpace.hpp"28#include "memory/universe.hpp"29#include "oops/oop.inline.hpp"30#endif // INCLUDE_ALL_GCS3132void ImmutableSpace::initialize(MemRegion mr) {33HeapWord* bottom = mr.start();34HeapWord* end = mr.end();3536assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end),37"invalid space boundaries");3839_bottom = bottom;40_end = end;41}4243void ImmutableSpace::oop_iterate(ExtendedOopClosure* cl) {44HeapWord* obj_addr = bottom();45HeapWord* t = end();46// Could call objects iterate, but this is easier.47while (obj_addr < t) {48obj_addr += oop(obj_addr)->oop_iterate(cl);49}50}5152void ImmutableSpace::object_iterate(ObjectClosure* cl) {53HeapWord* p = bottom();54while (p < end()) {55cl->do_object(oop(p));56p += oop(p)->size();57}58}5960#ifndef PRODUCT6162void ImmutableSpace::print_short() const {63tty->print(" space " SIZE_FORMAT "K, 100%% used", capacity_in_bytes() / K);64}6566void ImmutableSpace::print() const {67print_short();68tty->print_cr(" [" INTPTR_FORMAT_W(#-6) "," INTPTR_FORMAT_W(#-6) ")", p2i(bottom()), p2i(end()));69}7071#endif7273void ImmutableSpace::verify() {74HeapWord* p = bottom();75HeapWord* t = end();76HeapWord* prev_p = NULL;77while (p < t) {78oop(p)->verify();79prev_p = p;80p += oop(p)->size();81}82guarantee(p == end(), "end of last object must match end of space");83}848586