< prev index next >
src/share/vm/ci/ciEnv.cpp
Print this page
*** 424,434 ****
if (sym->byte_at(0) == '[') {
fail_type = _unloaded_ciobjarrayklass;
} else {
fail_type = _unloaded_ciinstance_klass;
}
! KlassHandle found_klass;
{
ttyUnlocker ttyul; // release tty lock to avoid ordering problems
MutexLocker ml(Compile_lock);
Klass* kls;
if (!require_local) {
--- 424,434 ----
if (sym->byte_at(0) == '[') {
fail_type = _unloaded_ciobjarrayklass;
} else {
fail_type = _unloaded_ciinstance_klass;
}
! Klass* found_klass;
{
ttyUnlocker ttyul; // release tty lock to avoid ordering problems
MutexLocker ml(Compile_lock);
Klass* kls;
if (!require_local) {
*** 436,446 ****
KILL_COMPILE_ON_FATAL_(fail_type));
} else {
kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain,
KILL_COMPILE_ON_FATAL_(fail_type));
}
! found_klass = KlassHandle(THREAD, kls);
}
// If we fail to find an array klass, look again for its element type.
// The element type may be available either locally or via constraints.
// In either case, if we can find the element type in the system dictionary,
--- 436,446 ----
KILL_COMPILE_ON_FATAL_(fail_type));
} else {
kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain,
KILL_COMPILE_ON_FATAL_(fail_type));
}
! found_klass = kls;
}
// If we fail to find an array klass, look again for its element type.
// The element type may be available either locally or via constraints.
// In either case, if we can find the element type in the system dictionary,
*** 465,490 ****
// Now make an array for it
return ciObjArrayKlass::make_impl(elem_klass);
}
}
! if (found_klass() == NULL && !cpool.is_null() && cpool->has_preresolution()) {
// Look inside the constant pool for pre-resolved class entries.
for (int i = cpool->length() - 1; i >= 1; i--) {
if (cpool->tag_at(i).is_klass()) {
Klass* kls = cpool->resolved_klass_at(i);
if (kls->name() == sym) {
! found_klass = KlassHandle(THREAD, kls);
break;
}
}
}
}
! if (found_klass() != NULL) {
// Found it. Build a CI handle.
! return get_klass(found_klass());
}
if (require_local) return NULL;
// Not yet loaded into the VM, or not governed by loader constraints.
--- 465,490 ----
// Now make an array for it
return ciObjArrayKlass::make_impl(elem_klass);
}
}
! if (found_klass == NULL && !cpool.is_null() && cpool->has_preresolution()) {
// Look inside the constant pool for pre-resolved class entries.
for (int i = cpool->length() - 1; i >= 1; i--) {
if (cpool->tag_at(i).is_klass()) {
Klass* kls = cpool->resolved_klass_at(i);
if (kls->name() == sym) {
! found_klass = kls;
break;
}
}
}
}
! if (found_klass != NULL) {
// Found it. Build a CI handle.
! return get_klass(found_klass);
}
if (require_local) return NULL;
// Not yet loaded into the VM, or not governed by loader constraints.
*** 510,534 ****
ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
int index,
bool& is_accessible,
ciInstanceKlass* accessor) {
EXCEPTION_CONTEXT;
! KlassHandle klass; // = NULL;
Symbol* klass_name = NULL;
if (cpool->tag_at(index).is_symbol()) {
klass_name = cpool->symbol_at(index);
} else {
// Check if it's resolved if it's not a symbol constant pool entry.
! klass = KlassHandle(THREAD, ConstantPool::klass_at_if_loaded(cpool, index));
// Try to look it up by name.
! if (klass.is_null()) {
klass_name = cpool->klass_name_at(index);
}
}
! if (klass.is_null()) {
// Not found in constant pool. Use the name to do the lookup.
ciKlass* k = get_klass_by_name_impl(accessor,
cpool,
get_symbol(klass_name),
false);
--- 510,534 ----
ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
int index,
bool& is_accessible,
ciInstanceKlass* accessor) {
EXCEPTION_CONTEXT;
! Klass* klass = NULL;
Symbol* klass_name = NULL;
if (cpool->tag_at(index).is_symbol()) {
klass_name = cpool->symbol_at(index);
} else {
// Check if it's resolved if it's not a symbol constant pool entry.
! klass = ConstantPool::klass_at_if_loaded(cpool, index);
// Try to look it up by name.
! if (klass == NULL) {
klass_name = cpool->klass_name_at(index);
}
}
! if (klass == NULL) {
// Not found in constant pool. Use the name to do the lookup.
ciKlass* k = get_klass_by_name_impl(accessor,
cpool,
get_symbol(klass_name),
false);
*** 546,565 ****
return k;
}
// Check for prior unloaded klass. The SystemDictionary's answers
// can vary over time but the compiler needs consistency.
! ciSymbol* name = get_symbol(klass()->name());
ciKlass* unloaded_klass = check_get_unloaded_klass(accessor, name);
if (unloaded_klass != NULL) {
is_accessible = false;
return unloaded_klass;
}
// It is known to be accessible, since it was found in the constant pool.
is_accessible = true;
! return get_klass(klass());
}
// ------------------------------------------------------------------
// ciEnv::get_klass_by_index
//
--- 546,565 ----
return k;
}
// Check for prior unloaded klass. The SystemDictionary's answers
// can vary over time but the compiler needs consistency.
! ciSymbol* name = get_symbol(klass->name());
ciKlass* unloaded_klass = check_get_unloaded_klass(accessor, name);
if (unloaded_klass != NULL) {
is_accessible = false;
return unloaded_klass;
}
// It is known to be accessible, since it was found in the constant pool.
is_accessible = true;
! return get_klass(klass);
}
// ------------------------------------------------------------------
// ciEnv::get_klass_by_index
//
*** 709,723 ****
Symbol* name,
Symbol* sig,
Bytecodes::Code bc,
constantTag tag) {
EXCEPTION_CONTEXT;
! KlassHandle h_accessor(THREAD, accessor);
! KlassHandle h_holder(THREAD, holder);
! LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
methodHandle dest_method;
! LinkInfo link_info(h_holder, name, sig, h_accessor, LinkInfo::needs_access_check, tag);
switch (bc) {
case Bytecodes::_invokestatic:
dest_method =
LinkResolver::resolve_static_call_or_null(link_info);
break;
--- 709,721 ----
Symbol* name,
Symbol* sig,
Bytecodes::Code bc,
constantTag tag) {
EXCEPTION_CONTEXT;
! LinkResolver::check_klass_accessability(accessor, holder, KILL_COMPILE_ON_FATAL_(NULL));
methodHandle dest_method;
! LinkInfo link_info(holder, name, sig, accessor, LinkInfo::needs_access_check, tag);
switch (bc) {
case Bytecodes::_invokestatic:
dest_method =
LinkResolver::resolve_static_call_or_null(link_info);
break;
< prev index next >