diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp index 1d0b9243de206a21644db1b8c7fe1a8fa3b76a53..b7ea6eebb26046dad24ebbbde3aec7e6fd9b6ac3 100644 --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1583,7 +1583,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) { ObjectType* obj_type = obj->type()->as_ObjectType(); if (obj_type->is_constant() && !PatchALot) { ciObject* const_oop = obj_type->constant_value(); - if (!const_oop->is_null_object()) { + if (!const_oop->is_null_object() && const_oop->is_loaded()) { if (field->is_constant()) { ciConstant field_val = field->constant_value_of(const_oop); BasicType field_type = field_val.basic_type(); diff --git a/src/share/vm/ci/ciInstance.cpp b/src/share/vm/ci/ciInstance.cpp index 2d29c0dc8e2ce7c8ad85133ac13b5f737bf7cd7b..a74eb04f4a7359178f61db5b6a749f0d8a07996e 100644 --- a/src/share/vm/ci/ciInstance.cpp +++ b/src/share/vm/ci/ciInstance.cpp @@ -60,10 +60,10 @@ ciType* ciInstance::java_mirror_type() { // // Constant value of a field. ciConstant ciInstance::field_value(ciField* field) { - assert(is_loaded() && - field->holder()->is_loaded() && - klass()->is_subclass_of(field->holder()), - "invalid access"); + assert(is_loaded(), "invalid access - must be loaded"); + assert(field->holder()->is_loaded(), "invalid access - holder must be loaded"); + assert(klass()->is_subclass_of(field->holder()), "invalid access - must be subclass"); + VM_ENTRY_MARK; ciConstant result; Handle obj = get_oop();