< prev index next > src/hotspot/share/oops/constantPool.cpp
Print this page
#include "memory/universe.hpp"
#include "oops/array.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/cpCache.inline.hpp"
#include "oops/fieldStreams.inline.hpp"
+ #include "oops/flatArrayKlass.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/klass.inline.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
+ #include "oops/refArrayOop.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/atomicAccess.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp"
}
// Use a CAS for multithreaded access
oop ConstantPool::set_resolved_reference_at(int index, oop new_result) {
assert(oopDesc::is_oop_or_null(new_result), "Must be oop");
! return resolved_references()->replace_if_null(index, new_result);
}
// Create resolved_references array and mapping array for original cp indexes
// The ldc bytecode was rewritten to have the resolved reference array index so need a way
// to map it back for resolving and some unlikely miscellaneous uses.
}
// Use a CAS for multithreaded access
oop ConstantPool::set_resolved_reference_at(int index, oop new_result) {
assert(oopDesc::is_oop_or_null(new_result), "Must be oop");
! return refArrayOopDesc::cast(resolved_references())->replace_if_null(index, new_result);
}
// Create resolved_references array and mapping array for original cp indexes
// The ldc bytecode was rewritten to have the resolved reference array index so need a way
// to map it back for resolving and some unlikely miscellaneous uses.
break;
#ifndef PRODUCT
case JVM_CONSTANT_Class:
case JVM_CONSTANT_UnresolvedClass:
case JVM_CONSTANT_UnresolvedClassInError:
! // All of these should have been reverted back to ClassIndex before calling
// this function.
ShouldNotReachHere();
#endif
}
}
break;
#ifndef PRODUCT
case JVM_CONSTANT_Class:
case JVM_CONSTANT_UnresolvedClass:
case JVM_CONSTANT_UnresolvedClassInError:
! // All of these should have been reverted back to Unresolved before calling
// this function.
ShouldNotReachHere();
#endif
}
}
}
if (src_k->is_objArray_klass()) {
src_k = ObjArrayKlass::cast(src_k)->bottom_klass();
assert(!src_k->is_objArray_klass(), "sanity");
+ assert(src_k->is_instance_klass() || src_k->is_typeArray_klass(), "Sanity check");
}
if (src_k->is_typeArray_klass()) {
type = "prim";
} else {
mirror_handle = Handle(THREAD, k->java_mirror());
// Do access check for klasses
verify_constant_pool_resolve(this_cp, k, THREAD);
}
+ #ifdef DEBUG
+ if (!HAS_PENDING_EXCEPTION && k->is_objArray_klass()) {
+ Klass* bottom_klass = ObjArrayKlass::cast(k)->bottom_klass();
+ assert(bottom_klass != nullptr, "Should be set");
+ assert(bottom_klass->is_instance_klass() || bottom_klass->is_typeArray_klass(), "Sanity check");
+ }
+ #endif
+
// Failed to resolve class. We must record the errors so that subsequent attempts
// to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
if (HAS_PENDING_EXCEPTION) {
save_and_throw_exception(this_cp, cp_index, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);
// If CHECK_NULL above doesn't return the exception, that means that
< prev index next >