diff src/share/vm/c1x/c1x_Compiler.cpp @ 1941:79d04223b8a5

Added caching for resolved types and resolved fields. This is crucial, because the local load elimination will lead to wrong results, if field equality (of two RiField objects with the same object and the same RiType) is not given. The caching makes sure that the default equals implementation is sufficient.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 28 Dec 2010 18:33:26 +0100
parents 48bbaead8b6c
children 00bc9eaf0e24
line wrap: on
line diff
--- a/src/share/vm/c1x/c1x_Compiler.cpp	Mon Dec 27 20:35:47 2010 +0100
+++ b/src/share/vm/c1x/c1x_Compiler.cpp	Tue Dec 28 18:33:26 2010 +0100
@@ -117,7 +117,7 @@
     return createHotSpotTypeResolved(klass, name, CHECK_NULL);
   } else {
     symbolOop name = ((ciKlass *) type)->name()->get_symbolOop();
-    return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(name, THREAD), VmIds::add<klassOop>(accessor()), THREAD);
+    return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(name, THREAD), THREAD);
   }
 }
 
@@ -133,10 +133,13 @@
 }
 
 oop C1XCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) {
+  if (klass->c1x_mirror() != NULL) {
+    return klass->c1x_mirror();
+  }
+
   instanceKlass::cast(HotSpotTypeResolved::klass())->initialize(CHECK_NULL);
   oop obj = instanceKlass::cast(HotSpotTypeResolved::klass())->allocate_instance(CHECK_NULL);
 
-  HotSpotTypeResolved::set_vmId(obj, VmIds::add(klass, VmIds::CLASS));
   HotSpotTypeResolved::set_javaMirror(obj, klass->java_mirror());
   HotSpotTypeResolved::set_name(obj, name());
   HotSpotTypeResolved::set_accessFlags(obj, klass->access_flags().as_int());
@@ -158,6 +161,8 @@
   HotSpotTypeResolved::set_hasSubclass(obj, false);
   HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false);
 
+  klass->set_c1x_mirror(obj);
+
   return obj;
 }