6960865: ldc of unloaded class throws an assert in ciTypeFlow

Support java_mirror for unloaded klasses, arrays as well as instances.  Simplify ciTypeFlow by removing unused path.

Reviewed-by: kvn
This commit is contained in:
John R Rose 2010-06-12 22:53:43 -07:00
parent 9c7b430e11
commit c8359c3738
3 changed files with 9 additions and 7 deletions

View File

@ -323,12 +323,10 @@ ciInstanceKlass* ciInstanceKlass::super() {
// ciInstanceKlass::java_mirror
//
// Get the instance of java.lang.Class corresponding to this klass.
// Cache it on this->_java_mirror.
ciInstance* ciInstanceKlass::java_mirror() {
if (_java_mirror == NULL) {
if (!is_loaded())
_java_mirror = ciEnv::current()->get_unloaded_klass_mirror(this);
else
_java_mirror = ciKlass::java_mirror();
_java_mirror = ciKlass::java_mirror();
}
return _java_mirror;
}

View File

@ -192,8 +192,14 @@ ciKlass* ciKlass::find_klass(ciSymbol* klass_name) {
// ------------------------------------------------------------------
// ciKlass::java_mirror
//
// Get the instance of java.lang.Class corresponding to this klass.
// If it is an unloaded instance or array klass, return an unloaded
// mirror object of type Class.
ciInstance* ciKlass::java_mirror() {
GUARDED_VM_ENTRY(
if (!is_loaded())
return ciEnv::current()->get_unloaded_klass_mirror(this);
oop java_mirror = get_Klass()->java_mirror();
return CURRENT_ENV->get_object(java_mirror)->as_instance();
)

View File

@ -712,10 +712,8 @@ void ciTypeFlow::StateVector::do_ldc(ciBytecodeStream* str) {
ciObject* obj = con.as_object();
if (obj->is_null_object()) {
push_null();
} else if (obj->is_klass()) {
// The type of ldc <class> is java.lang.Class
push_object(outer()->env()->Class_klass());
} else {
assert(!obj->is_klass(), "must be java_mirror of klass");
push_object(obj->klass());
}
} else {