diff src/share/vm/runtime/arguments.cpp @ 11109:7ac80525ece9

8015635: Crash when specifying very large code cache size Summary: Limit the size of the code cache to at most 2G when arguments are checked; added regression test Reviewed-by: kvn, twisti
author anoll
date Tue, 09 Jul 2013 11:48:05 +0200
parents 8b789ce47503
children dec841e0c9aa
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Mon Jul 08 14:15:02 2013 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Tue Jul 09 11:48:05 2013 +0200
@@ -1855,8 +1855,13 @@
                 "please refer to the release notes for the combinations "
                 "allowed\n");
     status = false;
+  } else if (ReservedCodeCacheSize > 2*G) {
+    // Code cache size larger than MAXINT is not supported.
+    jio_fprintf(defaultStream::error_stream(),
+                "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
+                (2*G)/M);
+    status = false;
   }
-
   return status;
 }
 
@@ -2239,8 +2244,13 @@
                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
                 min_code_cache_size/K);
     status = false;
+  } else if (ReservedCodeCacheSize > 2*G) {
+    // Code cache size larger than MAXINT is not supported.
+    jio_fprintf(defaultStream::error_stream(),
+                "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
+                (2*G)/M);
+    status = false;
   }
-
   return status;
 }