changeset 1807:b918d354830a

6960865: ldc of unloaded class throws an assert in ciTypeFlow Summary: Support java_mirror for unloaded klasses, arrays as well as instances. Simplify ciTypeFlow by removing unused path. Reviewed-by: kvn
author jrose
date Sat, 12 Jun 2010 22:53:43 -0700
parents d93949c5bdcc
children d179e225c164
files src/share/vm/ci/ciInstanceKlass.cpp src/share/vm/ci/ciKlass.cpp src/share/vm/ci/ciTypeFlow.cpp
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/ci/ciInstanceKlass.cpp	Thu Jun 10 13:04:20 2010 -0700
+++ b/src/share/vm/ci/ciInstanceKlass.cpp	Sat Jun 12 22:53:43 2010 -0700
@@ -323,12 +323,10 @@
 // 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;
 }
--- a/src/share/vm/ci/ciKlass.cpp	Thu Jun 10 13:04:20 2010 -0700
+++ b/src/share/vm/ci/ciKlass.cpp	Sat Jun 12 22:53:43 2010 -0700
@@ -192,8 +192,14 @@
 
 // ------------------------------------------------------------------
 // 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();
   )
--- a/src/share/vm/ci/ciTypeFlow.cpp	Thu Jun 10 13:04:20 2010 -0700
+++ b/src/share/vm/ci/ciTypeFlow.cpp	Sat Jun 12 22:53:43 2010 -0700
@@ -712,10 +712,8 @@
     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 {