< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page
rev 12504 : imported patch 8162104-use-is_in_cset-instead-of-obj_in_cs
   1 /*
   2  * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2346     // heap_region_containing() should successfully
2347     // return the containing region.
2348     HeapRegion* hr = heap_region_containing(p);
2349     return hr->is_in(p);
2350   } else {
2351     return false;
2352   }
2353 }
2354 
2355 #ifdef ASSERT
2356 bool G1CollectedHeap::is_in_exact(const void* p) const {
2357   bool contains = reserved_region().contains(p);
2358   bool available = _hrm.is_available(addr_to_region((HeapWord*)p));
2359   if (contains && available) {
2360     return true;
2361   } else {
2362     return false;
2363   }
2364 }
2365 #endif
2366 
2367 bool G1CollectedHeap::obj_in_cs(oop obj) {
2368   HeapRegion* r = _hrm.addr_to_region((HeapWord*) obj);
2369   return r != NULL && r->in_collection_set();
2370 }
2371 
2372 // Iteration functions.
2373 
2374 // Applies an ExtendedOopClosure onto all references of objects within a HeapRegion.
2375 
2376 class IterateOopClosureRegionClosure: public HeapRegionClosure {
2377   ExtendedOopClosure* _cl;
2378 public:
2379   IterateOopClosureRegionClosure(ExtendedOopClosure* cl) : _cl(cl) {}
2380   bool doHeapRegion(HeapRegion* r) {
2381     if (!r->is_continues_humongous()) {
2382       r->oop_iterate(_cl);
2383     }
2384     return false;
2385   }
2386 };
2387 
2388 // Iterates an ObjectClosure over all objects within a HeapRegion.
2389 
2390 class IterateObjectClosureRegionClosure: public HeapRegionClosure {


   1 /*
   2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2346     // heap_region_containing() should successfully
2347     // return the containing region.
2348     HeapRegion* hr = heap_region_containing(p);
2349     return hr->is_in(p);
2350   } else {
2351     return false;
2352   }
2353 }
2354 
2355 #ifdef ASSERT
2356 bool G1CollectedHeap::is_in_exact(const void* p) const {
2357   bool contains = reserved_region().contains(p);
2358   bool available = _hrm.is_available(addr_to_region((HeapWord*)p));
2359   if (contains && available) {
2360     return true;
2361   } else {
2362     return false;
2363   }
2364 }
2365 #endif





2366 
2367 // Iteration functions.
2368 
2369 // Applies an ExtendedOopClosure onto all references of objects within a HeapRegion.
2370 
2371 class IterateOopClosureRegionClosure: public HeapRegionClosure {
2372   ExtendedOopClosure* _cl;
2373 public:
2374   IterateOopClosureRegionClosure(ExtendedOopClosure* cl) : _cl(cl) {}
2375   bool doHeapRegion(HeapRegion* r) {
2376     if (!r->is_continues_humongous()) {
2377       r->oop_iterate(_cl);
2378     }
2379     return false;
2380   }
2381 };
2382 
2383 // Iterates an ObjectClosure over all objects within a HeapRegion.
2384 
2385 class IterateObjectClosureRegionClosure: public HeapRegionClosure {


< prev index next >