8164091: VM fails during startup with "assert(resolved_method->method_holder()->is_linked()) failed: must be linked"

Don't throw java_lang_VirtualMachineError during VM initialization.

Reviewed-by: zmajo, dlong, dholmes
This commit is contained in:
Tobias Hartmann 2016-08-17 08:19:06 +02:00
parent 72dcc9193e
commit be08874935
2 changed files with 19 additions and 4 deletions

View file

@ -54,6 +54,7 @@
#include "runtime/compilationPolicy.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/init.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/relocator.hpp"
#include "runtime/sharedRuntime.hpp"
@ -1015,7 +1016,14 @@ address Method::make_adapters(methodHandle mh, TRAPS) {
// so making them eagerly shouldn't be too expensive.
AdapterHandlerEntry* adapter = AdapterHandlerLibrary::get_adapter(mh);
if (adapter == NULL ) {
THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters");
if (!is_init_completed()) {
// Don't throw exceptions during VM initialization because java.lang.* classes
// might not have been initialized, causing problems when constructing the
// Java exception object.
vm_exit_during_initialization("Out of space in CodeCache for adapters");
} else {
THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters");
}
}
if (mh->is_shared()) {