< prev index next >
src/hotspot/share/oops/instanceKlass.cpp
Print this page
*** 641,651 ****
// abort if someone beat us to the initialization
if (!is_not_initialized()) return; // note: not equivalent to is_initialized()
ClassState old_state = init_state();
! link_class_impl(true, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
// Abort if linking the class throws an exception.
// Use a test to avoid redundantly resetting the state if there's
--- 641,651 ----
// abort if someone beat us to the initialization
if (!is_not_initialized()) return; // note: not equivalent to is_initialized()
ClassState old_state = init_state();
! link_class_impl(THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
// Abort if linking the class throws an exception.
// Use a test to avoid redundantly resetting the state if there's
*** 679,693 ****
assert(is_initialized(), "sanity check");
}
}
! bool InstanceKlass::verify_code(bool throw_verifyerror, TRAPS) {
// 1) Verify the bytecodes
! Verifier::Mode mode =
! throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
! return Verifier::verify(this, mode, should_verify_class(), THREAD);
}
// Used exclusively by the shared spaces dump mechanism to prevent
// classes mapped into the shared regions in new VMs from appearing linked.
--- 679,691 ----
assert(is_initialized(), "sanity check");
}
}
! bool InstanceKlass::verify_code(TRAPS) {
// 1) Verify the bytecodes
! return Verifier::verify(this, should_verify_class(), THREAD);
}
// Used exclusively by the shared spaces dump mechanism to prevent
// classes mapped into the shared regions in new VMs from appearing linked.
*** 698,722 ****
}
void InstanceKlass::link_class(TRAPS) {
assert(is_loaded(), "must be loaded");
if (!is_linked()) {
! link_class_impl(true, CHECK);
}
}
// Called to verify that a class can link during initialization, without
// throwing a VerifyError.
bool InstanceKlass::link_class_or_fail(TRAPS) {
assert(is_loaded(), "must be loaded");
if (!is_linked()) {
! link_class_impl(false, CHECK_false);
}
return is_linked();
}
! bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
if (DumpSharedSpaces && is_in_error_state()) {
// This is for CDS dumping phase only -- we use the in_error_state to indicate that
// the class has failed verification. Throwing the NoClassDefFoundError here is just
// a convenient way to stop repeat attempts to verify the same (bad) class.
//
--- 696,720 ----
}
void InstanceKlass::link_class(TRAPS) {
assert(is_loaded(), "must be loaded");
if (!is_linked()) {
! link_class_impl(CHECK);
}
}
// Called to verify that a class can link during initialization, without
// throwing a VerifyError.
bool InstanceKlass::link_class_or_fail(TRAPS) {
assert(is_loaded(), "must be loaded");
if (!is_linked()) {
! link_class_impl(CHECK_false);
}
return is_linked();
}
! bool InstanceKlass::link_class_impl(TRAPS) {
if (DumpSharedSpaces && is_in_error_state()) {
// This is for CDS dumping phase only -- we use the in_error_state to indicate that
// the class has failed verification. Throwing the NoClassDefFoundError here is just
// a convenient way to stop repeat attempts to verify the same (bad) class.
//
*** 754,772 ****
);
return false;
}
InstanceKlass* ik_super = InstanceKlass::cast(super_klass);
! ik_super->link_class_impl(throw_verifyerror, CHECK_false);
}
// link all interfaces implemented by this class before linking this class
Array<InstanceKlass*>* interfaces = local_interfaces();
int num_interfaces = interfaces->length();
for (int index = 0; index < num_interfaces; index++) {
InstanceKlass* interk = interfaces->at(index);
! interk->link_class_impl(throw_verifyerror, CHECK_false);
}
// in case the class is linked in the process of linking its superclasses
if (is_linked()) {
return true;
--- 752,770 ----
);
return false;
}
InstanceKlass* ik_super = InstanceKlass::cast(super_klass);
! ik_super->link_class_impl(CHECK_false);
}
// link all interfaces implemented by this class before linking this class
Array<InstanceKlass*>* interfaces = local_interfaces();
int num_interfaces = interfaces->length();
for (int index = 0; index < num_interfaces; index++) {
InstanceKlass* interk = interfaces->at(index);
! interk->link_class_impl(CHECK_false);
}
// in case the class is linked in the process of linking its superclasses
if (is_linked()) {
return true;
*** 792,802 ****
//
if (!is_linked()) {
if (!is_rewritten()) {
{
! bool verify_ok = verify_code(throw_verifyerror, THREAD);
if (!verify_ok) {
return false;
}
}
--- 790,800 ----
//
if (!is_linked()) {
if (!is_rewritten()) {
{
! bool verify_ok = verify_code(THREAD);
if (!verify_ok) {
return false;
}
}
< prev index next >