hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 201 7893b7ce2d8d
parent 189 4248c8e21063
child 235 735f15bdea80
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Feb 21 19:03:44 2008 -0800
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Feb 22 17:55:13 2008 -0800
@@ -1839,7 +1839,25 @@
                                                                         regs);
 
     B = BufferBlob::create(AdapterHandlerEntry::name, &buffer);
-    if (B == NULL)  return -2;          // Out of CodeCache space
+    if (B == NULL) {
+      // CodeCache is full, disable compilation
+      // Ought to log this but compile log is only per compile thread
+      // and we're some non descript Java thread.
+      UseInterpreter = true;
+      if (UseCompiler || AlwaysCompileLoopMethods ) {
+#ifndef PRODUCT
+        warning("CodeCache is full. Compiler has been disabled");
+        if (CompileTheWorld || ExitOnFullCodeCache) {
+          before_exit(JavaThread::current());
+          exit_globals(); // will delete tty
+          vm_direct_exit(CompileTheWorld ? 0 : 1);
+        }
+#endif
+        UseCompiler               = false;
+        AlwaysCompileLoopMethods  = false;
+      }
+      return 0; // Out of CodeCache space (_handlers[0] == NULL)
+    }
     entry->relocate(B->instructions_begin());
 #ifndef PRODUCT
     // debugging suppport