src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2008, 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/_binaryTreeDictionary.cpp.incl"





  27 
  28 ////////////////////////////////////////////////////////////////////////////////
  29 // A binary tree based search structure for free blocks.
  30 // This is currently used in the Concurrent Mark&Sweep implementation.
  31 ////////////////////////////////////////////////////////////////////////////////
  32 
  33 TreeChunk* TreeChunk::as_TreeChunk(FreeChunk* fc) {
  34   // Do some assertion checking here.
  35   return (TreeChunk*) fc;
  36 }
  37 
  38 void TreeChunk::verifyTreeChunkList() const {
  39   TreeChunk* nextTC = (TreeChunk*)next();
  40   if (prev() != NULL) { // interior list node shouldn'r have tree fields
  41     guarantee(embedded_list()->parent() == NULL && embedded_list()->left() == NULL &&
  42               embedded_list()->right()  == NULL, "should be clear");
  43   }
  44   if (nextTC != NULL) {
  45     guarantee(as_TreeChunk(nextTC->prev()) == this, "broken chain");
  46     guarantee(nextTC->size() == size(), "wrong size");


   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/concurrentMarkSweep/binaryTreeDictionary.hpp"
  27 #include "gc_implementation/shared/allocationStats.hpp"
  28 #include "gc_implementation/shared/spaceDecorator.hpp"
  29 #include "memory/space.inline.hpp"
  30 #include "runtime/globals.hpp"
  31 #include "utilities/ostream.hpp"
  32 
  33 ////////////////////////////////////////////////////////////////////////////////
  34 // A binary tree based search structure for free blocks.
  35 // This is currently used in the Concurrent Mark&Sweep implementation.
  36 ////////////////////////////////////////////////////////////////////////////////
  37 
  38 TreeChunk* TreeChunk::as_TreeChunk(FreeChunk* fc) {
  39   // Do some assertion checking here.
  40   return (TreeChunk*) fc;
  41 }
  42 
  43 void TreeChunk::verifyTreeChunkList() const {
  44   TreeChunk* nextTC = (TreeChunk*)next();
  45   if (prev() != NULL) { // interior list node shouldn'r have tree fields
  46     guarantee(embedded_list()->parent() == NULL && embedded_list()->left() == NULL &&
  47               embedded_list()->right()  == NULL, "should be clear");
  48   }
  49   if (nextTC != NULL) {
  50     guarantee(as_TreeChunk(nextTC->prev()) == this, "broken chain");
  51     guarantee(nextTC->size() == size(), "wrong size");