src/share/vm/c1/c1_Compiler.cpp

Print this page
rev 4657 : replaced guarantee() with vm_exit_out_of_memory() to provide a graceful
shutdown if insufficient memory for the code cache is specified with
-XX:ReservedCodeCacheSize=

@@ -39,10 +39,11 @@
 #include "memory/resourceArea.hpp"
 #include "prims/nativeLookup.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/sharedRuntime.hpp"
+#include "utilities/debug.hpp"
 
 volatile int Compiler::_runtimes = uninitialized;
 
 Compiler::Compiler() {
 }

@@ -82,11 +83,15 @@
   // NMethodSizeLimit plus some extra space for constants.
   int code_buffer_size = Compilation::desired_max_code_buffer_size() +
     Compilation::desired_max_constant_size();
   BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
                                         code_buffer_size);
-  guarantee(blob != NULL, "must create initial code buffer");
+  if (blob == NULL) {
+    vm_exit_out_of_memory(code_buffer_size, OOM_MALLOC_ERROR,
+                          err_msg("Compiler1 temporary CodeBuffer.\n"
+                                  "# Try to increase -XX:ReservedCodeCacheSize=.\n"));
+  }
   return blob;
 }
 
 
 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {