8171082: [AOT] AOT'd SystemModules.modules() fails to load when too large

Reviewed-by: kvn, redestad
This commit is contained in:
Rickard Bäckman 2017-01-03 08:54:29 +01:00
parent 0f853d0c94
commit 4559d9da01
3 changed files with 7 additions and 5 deletions

View File

@ -295,6 +295,8 @@ void AOTCodeHeap::publish_aot(const methodHandle& mh, AOTMethodData* method_data
// 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;
}

View File

@ -554,7 +554,7 @@ JVMCIEnv::CodeInstallResult CodeInstaller::gather_metadata(Handle target, Handle
_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 @@ JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Hand
_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 @@ int CodeInstaller::estimate_stubs_size(TRAPS) {
}
// 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 @@ JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer,
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;
}

View File

@ -227,7 +227,7 @@ protected:
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);