src/share/vm/gc_implementation/g1/heapRegionSeq.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, 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  *
  23  */
  24 
  25 #include "incls/_precompiled.incl"
  26 #include "incls/_heapRegionSeq.cpp.incl"


  27 
  28 // Local to this file.
  29 
  30 static int orderRegions(HeapRegion** hr1p, HeapRegion** hr2p) {
  31   if ((*hr1p)->end() <= (*hr2p)->bottom()) return -1;
  32   else if ((*hr2p)->end() <= (*hr1p)->bottom()) return 1;
  33   else if (*hr1p == *hr2p) return 0;
  34   else {
  35     assert(false, "We should never compare distinct overlapping regions.");
  36   }
  37   return 0;
  38 }
  39 
  40 HeapRegionSeq::HeapRegionSeq(const size_t max_size) :
  41   _alloc_search_start(0),
  42   // The line below is the worst bit of C++ hackery I've ever written
  43   // (Detlefs, 11/23).  You should think of it as equivalent to
  44   // "_regions(100, true)": initialize the growable array and inform it
  45   // that it should allocate its elem array(s) on the C heap.
  46   //


   1 /*
   2  * Copyright (c) 2001, 2010, 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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc_implementation/g1/heapRegionSeq.hpp"
  28 #include "memory/allocation.hpp"
  29 
  30 // Local to this file.
  31 
  32 static int orderRegions(HeapRegion** hr1p, HeapRegion** hr2p) {
  33   if ((*hr1p)->end() <= (*hr2p)->bottom()) return -1;
  34   else if ((*hr2p)->end() <= (*hr1p)->bottom()) return 1;
  35   else if (*hr1p == *hr2p) return 0;
  36   else {
  37     assert(false, "We should never compare distinct overlapping regions.");
  38   }
  39   return 0;
  40 }
  41 
  42 HeapRegionSeq::HeapRegionSeq(const size_t max_size) :
  43   _alloc_search_start(0),
  44   // The line below is the worst bit of C++ hackery I've ever written
  45   // (Detlefs, 11/23).  You should think of it as equivalent to
  46   // "_regions(100, true)": initialize the growable array and inform it
  47   // that it should allocate its elem array(s) on the C heap.
  48   //