changeset 4938:26037663c2a6

Merge
author hseigel
date Mon, 08 Jul 2013 16:44:03 -0700
parents ba9dacff9c9d cf9d71d3e474
children e79a9f26ba2e
files
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/allocation.cpp	Mon Jul 08 19:36:22 2013 -0400
+++ b/src/share/vm/memory/allocation.cpp	Mon Jul 08 16:44:03 2013 -0700
@@ -236,10 +236,11 @@
   size_t       _num_used;     // number of chunks currently checked out
   const size_t _size;         // size of each chunk (must be uniform)
 
-  // Our three static pools
+  // Our four static pools
   static ChunkPool* _large_pool;
   static ChunkPool* _medium_pool;
   static ChunkPool* _small_pool;
+  static ChunkPool* _tiny_pool;
 
   // return first element or null
   void* get_first() {
@@ -319,15 +320,18 @@
   static ChunkPool* large_pool()  { assert(_large_pool  != NULL, "must be initialized"); return _large_pool;  }
   static ChunkPool* medium_pool() { assert(_medium_pool != NULL, "must be initialized"); return _medium_pool; }
   static ChunkPool* small_pool()  { assert(_small_pool  != NULL, "must be initialized"); return _small_pool;  }
+  static ChunkPool* tiny_pool()   { assert(_tiny_pool   != NULL, "must be initialized"); return _tiny_pool;   }
 
   static void initialize() {
     _large_pool  = new ChunkPool(Chunk::size        + Chunk::aligned_overhead_size());
     _medium_pool = new ChunkPool(Chunk::medium_size + Chunk::aligned_overhead_size());
     _small_pool  = new ChunkPool(Chunk::init_size   + Chunk::aligned_overhead_size());
+    _tiny_pool   = new ChunkPool(Chunk::tiny_size   + Chunk::aligned_overhead_size());
   }
 
   static void clean() {
     enum { BlocksToKeep = 5 };
+     _tiny_pool->free_all_but(BlocksToKeep);
      _small_pool->free_all_but(BlocksToKeep);
      _medium_pool->free_all_but(BlocksToKeep);
      _large_pool->free_all_but(BlocksToKeep);
@@ -337,6 +341,7 @@
 ChunkPool* ChunkPool::_large_pool  = NULL;
 ChunkPool* ChunkPool::_medium_pool = NULL;
 ChunkPool* ChunkPool::_small_pool  = NULL;
+ChunkPool* ChunkPool::_tiny_pool   = NULL;
 
 void chunkpool_init() {
   ChunkPool::initialize();
@@ -376,6 +381,7 @@
    case Chunk::size:        return ChunkPool::large_pool()->allocate(bytes, alloc_failmode);
    case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes, alloc_failmode);
    case Chunk::init_size:   return ChunkPool::small_pool()->allocate(bytes, alloc_failmode);
+   case Chunk::tiny_size:   return ChunkPool::tiny_pool()->allocate(bytes, alloc_failmode);
    default: {
      void* p = os::malloc(bytes, mtChunk, CALLER_PC);
      if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
@@ -392,6 +398,7 @@
    case Chunk::size:        ChunkPool::large_pool()->free(c); break;
    case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
    case Chunk::init_size:   ChunkPool::small_pool()->free(c); break;
+   case Chunk::tiny_size:   ChunkPool::tiny_pool()->free(c); break;
    default:                 os::free(c, mtChunk);
   }
 }
--- a/src/share/vm/memory/allocation.hpp	Mon Jul 08 19:36:22 2013 -0400
+++ b/src/share/vm/memory/allocation.hpp	Mon Jul 08 16:44:03 2013 -0700
@@ -353,7 +353,8 @@
     slack      = 20,            // suspected sizeof(Chunk) + internal malloc headers
 #endif
 
-    init_size  =  1*K  - slack, // Size of first chunk
+    tiny_size  =  256  - slack, // Size of first chunk (tiny)
+    init_size  =  1*K  - slack, // Size of first chunk (normal aka small)
     medium_size= 10*K  - slack, // Size of medium-sized chunk
     size       = 32*K  - slack, // Default size of an Arena chunk (following the first)
     non_pool_size = init_size + 32 // An initial size which is not one of above
--- a/src/share/vm/runtime/handles.hpp	Mon Jul 08 19:36:22 2013 -0400
+++ b/src/share/vm/runtime/handles.hpp	Mon Jul 08 16:44:03 2013 -0700
@@ -227,7 +227,7 @@
   HandleArea* _prev;          // link to outer (older) area
  public:
   // Constructor
-  HandleArea(HandleArea* prev) {
+  HandleArea(HandleArea* prev) : Arena(Chunk::tiny_size) {
     debug_only(_handle_mark_nesting    = 0);
     debug_only(_no_handle_mark_nesting = 0);
     _prev = prev;