< prev index next >
src/share/vm/oops/constantPool.cpp
Print this page
@@ -190,11 +190,11 @@
void ConstantPool::string_at_put(int which, int obj_index, oop str) {
resolved_references()->obj_at_put(obj_index, str);
}
-void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k) {
+void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, Klass* k) {
ResourceMark rm;
int line_number = -1;
const char * source_file = NULL;
if (JavaThread::current()->has_last_Java_frame()) {
// try to identify the method which called this function.
@@ -205,11 +205,11 @@
if (s != NULL) {
source_file = s->as_C_string();
}
}
}
- if (k() != this_cp->pool_holder()) {
+ if (k != this_cp->pool_holder()) {
// only print something if the classes are different
if (source_file != NULL) {
log_debug(class, resolve)("%s %s %s:%d",
this_cp->pool_holder()->external_name(),
k->external_name(), source_file, line_number);
@@ -251,15 +251,14 @@
Handle mirror_handle;
Symbol* name = entry.get_symbol();
Handle loader (THREAD, this_cp->pool_holder()->class_loader());
Handle protection_domain (THREAD, this_cp->pool_holder()->protection_domain());
- Klass* kk = SystemDictionary::resolve_or_fail(name, loader, protection_domain, true, THREAD);
- KlassHandle k (THREAD, kk);
+ Klass* k = SystemDictionary::resolve_or_fail(name, loader, protection_domain, true, THREAD);
if (!HAS_PENDING_EXCEPTION) {
// preserve the resolved klass from unloading
- mirror_handle = Handle(THREAD, kk->java_mirror());
+ mirror_handle = Handle(THREAD, k->java_mirror());
// Do access check for klasses
verify_constant_pool_resolve(this_cp, k, THREAD);
}
// Failed to resolve class. We must record the errors so that subsequent attempts
@@ -279,17 +278,17 @@
}
}
// Make this class loader depend upon the class loader owning the class reference
ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
- this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
+ this_key->record_dependency(k, CHECK_NULL); // Can throw OOM
// logging for class+resolve.
if (log_is_enabled(Debug, class, resolve)){
trace_class_resolution(this_cp, k);
}
- this_cp->klass_at_put(which, k());
+ this_cp->klass_at_put(which, k);
entry = this_cp->resolved_klass_at(which);
assert(entry.is_resolved() && entry.get_klass()->is_klass(), "must be resolved at this point");
return entry.get_klass();
}
@@ -314,18 +313,17 @@
Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread);
if (k != NULL) {
// Make sure that resolving is legal
EXCEPTION_MARK;
- KlassHandle klass(THREAD, k);
// return NULL if verification fails
- verify_constant_pool_resolve(this_cp, klass, THREAD);
+ verify_constant_pool_resolve(this_cp, k, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
return NULL;
}
- return klass();
+ return k;
} else {
return k;
}
}
}
@@ -453,20 +451,19 @@
int member_index = cache()->entry_at(cpc_index)->constant_pool_index();
return member_index;
}
-void ConstantPool::verify_constant_pool_resolve(const constantPoolHandle& this_cp, KlassHandle k, TRAPS) {
+void ConstantPool::verify_constant_pool_resolve(const constantPoolHandle& this_cp, Klass* k, TRAPS) {
if (k->is_instance_klass() || k->is_objArray_klass()) {
- instanceKlassHandle holder (THREAD, this_cp->pool_holder());
- Klass* elem = k->is_instance_klass() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
- KlassHandle element (THREAD, elem);
+ InstanceKlass* holder = this_cp->pool_holder();
+ Klass* elem = k->is_instance_klass() ? k : ObjArrayKlass::cast(k)->bottom_klass();
// The element type could be a typeArray - we only need the access check if it is
// an reference to another class
- if (element->is_instance_klass()) {
- LinkResolver::check_klass_accessability(holder, element, CHECK);
+ if (elem->is_instance_klass()) {
+ LinkResolver::check_klass_accessability(holder, elem, CHECK);
}
}
}
@@ -690,12 +687,11 @@
log_debug(class, resolve)("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
ref_kind, index, this_cp->method_handle_index_at(index),
callee_index, name->as_C_string(), signature->as_C_string());
}
- Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
- KlassHandle callee(THREAD, k);
+ Klass* callee = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
// Check constant pool method consistency
if ((callee->is_interface() && m_tag.is_method()) ||
((!callee->is_interface() && m_tag.is_interface_method()))) {
ResourceMark rm(THREAD);
@@ -707,11 +703,11 @@
callee->is_interface() ? "CONSTANT_MethodRef" : "CONSTANT_InterfaceMethodRef",
callee->is_interface() ? "CONSTANT_InterfaceMethodRef" : "CONSTANT_MethodRef");
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
}
- KlassHandle klass(THREAD, this_cp->pool_holder());
+ Klass* klass = this_cp->pool_holder();
Handle value = SystemDictionary::link_method_handle_constant(klass, ref_kind,
callee, name, signature,
THREAD);
result_oop = value();
if (HAS_PENDING_EXCEPTION) {
@@ -726,11 +722,11 @@
{ ResourceMark rm(THREAD);
log_debug(class, resolve)("resolve JVM_CONSTANT_MethodType [%d/%d] %s",
index, this_cp->method_type_index_at(index),
signature->as_C_string());
}
- KlassHandle klass(THREAD, this_cp->pool_holder());
+ Klass* klass = this_cp->pool_holder();
Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
result_oop = value();
if (HAS_PENDING_EXCEPTION) {
save_and_throw_exception(this_cp, index, tag, CHECK_NULL);
}
@@ -842,12 +838,11 @@
assert(java_lang_String::is_instance(str), "must be string");
return str;
}
-bool ConstantPool::klass_name_at_matches(instanceKlassHandle k,
- int which) {
+bool ConstantPool::klass_name_at_matches(const InstanceKlass* k, int which) {
// Names are interned, so we can compare Symbol*s directly
Symbol* cp_name = klass_name_at(which);
return (cp_name == k->name());
}
< prev index next >