diff src/share/vm/code/codeCache.hpp @ 8864:3c786355ffb4

8009026: [parfait] Null pointer deference in hotspot/src/share/vm/code/nmethod.cpp Summary: add guarantee() to nmethod constructor and checks to ensure CodeCache has space before allocation Reviewed-by: kvn
author morris
date Sat, 23 Mar 2013 06:22:07 -0700
parents 9deda4d8e126
children ebb32c4589f3 a7fb14888912
line wrap: on
line diff
--- a/src/share/vm/code/codeCache.hpp	Fri Mar 22 13:35:31 2013 -0400
+++ b/src/share/vm/code/codeCache.hpp	Sat Mar 23 06:22:07 2013 -0700
@@ -156,6 +156,11 @@
   static address  low_bound()                    { return (address) _heap->low_boundary(); }
   static address  high_bound()                   { return (address) _heap->high_boundary(); }
 
+  static bool has_space(int size) {
+    // Always leave some room in the CodeCache for I2C/C2I adapters
+    return largest_free_block() > (CodeCacheMinimumFreeSpace + size);
+  }
+
   // Profiling
   static address first_address();                // first address used for CodeBlobs
   static address last_address();                 // last  address used for CodeBlobs