< prev index next >

src/share/vm/memory/metachunk.hpp

Print this page
rev 11935 : 8166804: Convert TestMetachunk_test to GTest
Reviewed-by: duke
   1 /*
   2  * Copyright (c) 2012, 2013, 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  *


  78 };
  79 
  80 //  Metachunk - Quantum of allocation from a Virtualspace
  81 //    Metachunks are reused (when freed are put on a global freelist) and
  82 //    have no permanent association to a SpaceManager.
  83 
  84 //            +--------------+ <- end    --+       --+
  85 //            |              |             |         |
  86 //            |              |             | free    |
  87 //            |              |             |         |
  88 //            |              |             |         | size | capacity
  89 //            |              |             |         |
  90 //            |              | <- top   -- +         |
  91 //            |              |             |         |
  92 //            |              |             | used    |
  93 //            |              |             |         |
  94 //            |              |             |         |
  95 //            +--------------+ <- bottom --+       --+
  96 
  97 class Metachunk : public Metabase<Metachunk> {
  98   friend class TestMetachunk;
  99   // The VirtualSpaceNode containing this chunk.
 100   VirtualSpaceNode* _container;
 101 
 102   // Current allocation top.
 103   MetaWord* _top;
 104 
 105   DEBUG_ONLY(bool _is_tagged_free;)
 106 
 107   MetaWord* initial_top() const { return (MetaWord*)this + overhead(); }
 108   MetaWord* top() const         { return _top; }
 109 
 110  public:
 111   // Metachunks are allocated out of a MetadataVirtualSpace and
 112   // and use some of its space to describe itself (plus alignment
 113   // considerations).  Metadata is allocated in the rest of the chunk.
 114   // This size is the overhead of maintaining the Metachunk within
 115   // the space.
 116 
 117   // Alignment of each allocation in the chunks.
 118   static size_t object_alignment();


   1 /*
   2  * Copyright (c) 2012, 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  *


  78 };
  79 
  80 //  Metachunk - Quantum of allocation from a Virtualspace
  81 //    Metachunks are reused (when freed are put on a global freelist) and
  82 //    have no permanent association to a SpaceManager.
  83 
  84 //            +--------------+ <- end    --+       --+
  85 //            |              |             |         |
  86 //            |              |             | free    |
  87 //            |              |             |         |
  88 //            |              |             |         | size | capacity
  89 //            |              |             |         |
  90 //            |              | <- top   -- +         |
  91 //            |              |             |         |
  92 //            |              |             | used    |
  93 //            |              |             |         |
  94 //            |              |             |         |
  95 //            +--------------+ <- bottom --+       --+
  96 
  97 class Metachunk : public Metabase<Metachunk> {
  98   friend class MetachunkTest;
  99   // The VirtualSpaceNode containing this chunk.
 100   VirtualSpaceNode* _container;
 101 
 102   // Current allocation top.
 103   MetaWord* _top;
 104 
 105   DEBUG_ONLY(bool _is_tagged_free;)
 106 
 107   MetaWord* initial_top() const { return (MetaWord*)this + overhead(); }
 108   MetaWord* top() const         { return _top; }
 109 
 110  public:
 111   // Metachunks are allocated out of a MetadataVirtualSpace and
 112   // and use some of its space to describe itself (plus alignment
 113   // considerations).  Metadata is allocated in the rest of the chunk.
 114   // This size is the overhead of maintaining the Metachunk within
 115   // the space.
 116 
 117   // Alignment of each allocation in the chunks.
 118   static size_t object_alignment();


< prev index next >