8171082: [AOT] AOT'd SystemModules.modules() fails to load when too large
authorrbackman
Tue, 03 Jan 2017 08:54:29 +0100
changeset 43416 f8c241512446
parent 43415 55cd866a84e9
child 43417 90c1f522d37e
8171082: [AOT] AOT'd SystemModules.modules() fails to load when too large Reviewed-by: kvn, redestad
hotspot/src/share/vm/aot/aotCodeHeap.cpp
hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp
--- a/hotspot/src/share/vm/aot/aotCodeHeap.cpp	Mon Jan 02 00:26:40 2017 -0800
+++ b/hotspot/src/share/vm/aot/aotCodeHeap.cpp	Tue Jan 03 08:54:29 2017 +0100
@@ -295,6 +295,8 @@
     // When the AOT compiler compiles something big we fail to generate metadata
     // in CodeInstaller::gather_metadata. In that case the scopes_pcs_begin == scopes_pcs_end.
     // In all successful cases we always have 2 entries of scope pcs.
+    log_info(aot, class, resolve)("Failed to load %s (no metadata available)", mh->name_and_sig_as_C_string());
+    _code_to_aot[code_id]._state = invalid;
     return;
   }
 
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Mon Jan 02 00:26:40 2017 -0800
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Tue Jan 03 08:54:29 2017 +0100
@@ -554,7 +554,7 @@
   _constants = buffer.consts();
 
   initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
-  JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, CHECK_OK);
+  JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, false, CHECK_OK);
   if (result != JVMCIEnv::ok) {
     return result;
   }
@@ -587,7 +587,7 @@
   _constants = buffer.consts();
 
   initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
-  JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, CHECK_OK);
+  JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, true, CHECK_OK);
   if (result != JVMCIEnv::ok) {
     return result;
   }
@@ -726,7 +726,7 @@
 }
 
 // perform data and call relocation on the CodeBuffer
-JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, TRAPS) {
+JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, bool check_size, TRAPS) {
   HandleMark hm;
   objArrayHandle sites = this->sites();
   int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
@@ -738,7 +738,7 @@
   int stubs_size = estimate_stubs_size(CHECK_OK);
   int total_size = round_to(_code_size, buffer.insts()->alignment()) + round_to(_constants_size, buffer.consts()->alignment()) + round_to(stubs_size, buffer.stubs()->alignment());
 
-  if (total_size > JVMCINMethodSizeLimit) {
+  if (check_size && total_size > JVMCINMethodSizeLimit) {
     return JVMCIEnv::code_too_large;
   }
 
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Mon Jan 02 00:26:40 2017 -0800
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Tue Jan 03 08:54:29 2017 +0100
@@ -227,7 +227,7 @@
   int estimate_stubs_size(TRAPS);
 
   // perform data and call relocation on the CodeBuffer
-  JVMCIEnv::CodeInstallResult initialize_buffer(CodeBuffer& buffer, TRAPS);
+  JVMCIEnv::CodeInstallResult initialize_buffer(CodeBuffer& buffer, bool check_size, TRAPS);
 
   void assumption_NoFinalizableSubclass(Handle assumption);
   void assumption_ConcreteSubtype(Handle assumption);