6701024: SAJDI functionality is broken
authorjrose
Wed, 14 May 2008 00:41:06 -0700
changeset 394 c33507c3ac75
parent 393 31d6ce8d9edb
child 395 0123092405e7
child 580 aed902488ae4
6701024: SAJDI functionality is broken Summary: back out sa-related changes to 6652736, use concrete expressions for WKK names in the SA Reviewed-by: never, sundar
hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java
hotspot/src/share/vm/classfile/systemDictionary.hpp
hotspot/src/share/vm/runtime/vmStructs.cpp
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java	Fri May 09 05:26:59 2008 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java	Wed May 14 00:41:06 2008 -0700
@@ -29,27 +29,21 @@
 import sun.jvm.hotspot.oops.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.types.OopField; // resolve ambiguity with oops.OopField
-
-// following needed for on-the-fly field construction:
-import sun.jvm.hotspot.types.basic.BasicOopField;
-import sun.jvm.hotspot.types.basic.BasicTypeDataBase;
 
 public class SystemDictionary {
   private static AddressField dictionaryField;
   private static AddressField sharedDictionaryField;
   private static AddressField placeholdersField;
   private static AddressField loaderConstraintTableField;
-  private static OopField javaSystemLoaderField;
+  private static sun.jvm.hotspot.types.OopField javaSystemLoaderField;
   private static int nofBuckets;
 
-  private static OopField wellKnownKlasses;
-  private static OopField objectKlassField;
-  private static OopField classLoaderKlassField;
-  private static OopField stringKlassField;
-  private static OopField systemKlassField;
-  private static OopField threadKlassField;
-  private static OopField threadGroupKlassField;
+  private static sun.jvm.hotspot.types.OopField objectKlassField;
+  private static sun.jvm.hotspot.types.OopField classLoaderKlassField;
+  private static sun.jvm.hotspot.types.OopField stringKlassField;
+  private static sun.jvm.hotspot.types.OopField systemKlassField;
+  private static sun.jvm.hotspot.types.OopField threadKlassField;
+  private static sun.jvm.hotspot.types.OopField threadGroupKlassField;
 
   static {
     VM.registerVMInitializedObserver(new Observer() {
@@ -69,20 +63,22 @@
     javaSystemLoaderField = type.getOopField("_java_system_loader");
     nofBuckets = db.lookupIntConstant("SystemDictionary::_nof_buckets").intValue();
 
-    wellKnownKlasses = type.getOopField("_well_known_klasses[0]");
-    objectKlassField = findWellKnownKlass("object_klass", type, db);
-    classLoaderKlassField = findWellKnownKlass("classloader_klass", type, db);
-    stringKlassField = findWellKnownKlass("string_klass", type, db);
-    systemKlassField = findWellKnownKlass("system_klass", type, db);
-    threadKlassField = findWellKnownKlass("thread_klass", type, db);
-    threadGroupKlassField = findWellKnownKlass("threadGroup_klass", type, db);
+    objectKlassField = type.getOopField(WK_KLASS("object_klass"));
+    classLoaderKlassField = type.getOopField(WK_KLASS("classloader_klass"));
+    stringKlassField = type.getOopField(WK_KLASS("string_klass"));
+    systemKlassField = type.getOopField(WK_KLASS("system_klass"));
+    threadKlassField = type.getOopField(WK_KLASS("thread_klass"));
+    threadGroupKlassField = type.getOopField(WK_KLASS("threadGroup_klass"));
   }
 
-  private static OopField findWellKnownKlass(String indexName, Type type, TypeDataBase db) {
-    Address wkk = wellKnownKlasses.getStaticFieldAddress();
-    int index = db.lookupIntConstant("SystemDictionary::#"+indexName).intValue();
-    return new BasicOopField((BasicTypeDataBase)db, type, indexName, type,
-                             true, index * db.getAddressSize(), wkk);
+  // This WK functions must follow the definitions in systemDictionary.hpp:
+  private static String WK_KLASS(String name) {
+      //#define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
+      return ("_well_known_klasses[SystemDictionary::"+WK_KLASS_ENUM_NAME(name)+"]");
+  }
+  private static String WK_KLASS_ENUM_NAME(String kname) {
+      //#define WK_KLASS_ENUM_NAME(kname)    kname##_knum
+      return (kname+"_knum");
   }
 
   public Dictionary dictionary() {
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri May 09 05:26:59 2008 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed May 14 00:41:06 2008 -0700
@@ -386,7 +386,7 @@
   #undef WK_KLASS_DECLARE
 
   // Local definition for direct access to the private array:
-  #define WK_KLASS(name) _well_known_klasses[WK_KLASS_ENUM_NAME(name)]
+  #define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
 
   static klassOop box_klass(BasicType t) {
     assert((uint)t < T_VOID+1, "range check");
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri May 09 05:26:59 2008 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed May 14 00:41:06 2008 -0700
@@ -453,7 +453,40 @@
       static_field(SystemDictionary,            _shared_dictionary,                            Dictionary*)                          \
       static_field(SystemDictionary,            _system_loader_lock_obj,                       oop)                                  \
       static_field(SystemDictionary,            _loader_constraints,                           LoaderConstraintTable*)               \
-      static_field(SystemDictionary,            _well_known_klasses[0],                        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(object_klass),                        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(string_klass),                        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(class_klass),                         klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(cloneable_klass),                     klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(classloader_klass),                   klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(serializable_klass),                  klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(system_klass),                        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(throwable_klass),                     klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(threaddeath_klass),                   klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(error_klass),                         klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(exception_klass),                     klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(runtime_exception_klass),             klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(classNotFoundException_klass),        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(noClassDefFoundError_klass),          klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(linkageError_klass),                  klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(ClassCastException_klass),            klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(ArrayStoreException_klass),           klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(virtualMachineError_klass),           klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(OutOfMemoryError_klass),              klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(StackOverflowError_klass),            klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(protectionDomain_klass),              klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(AccessControlContext_klass),          klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(reference_klass),                     klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(soft_reference_klass),                klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(weak_reference_klass),                klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(final_reference_klass),               klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(phantom_reference_klass),             klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(finalizer_klass),                     klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(thread_klass),                        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(threadGroup_klass),                   klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(properties_klass),                    klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(stringBuffer_klass),                  klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(vector_klass),                        klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(hashtable_klass),                     klassOop)                             \
       static_field(SystemDictionary,            _box_klasses[0],                               klassOop)                             \
       static_field(SystemDictionary,            _java_system_loader,                           oop)                                  \
                                                                                                                                      \
@@ -1367,13 +1400,6 @@
                                                                           \
   declare_constant(SystemDictionary::_loader_constraint_size)             \
   declare_constant(SystemDictionary::_nof_buckets)                        \
-  /* these #foo numbers are enums used to index _well_known_klasses: */   \
-  declare_preprocessor_constant("SystemDictionary::#object_klass",       SystemDictionary::WK_KLASS_ENUM_NAME(object_klass)) \
-  declare_preprocessor_constant("SystemDictionary::#classloader_klass",  SystemDictionary::WK_KLASS_ENUM_NAME(classloader_klass)) \
-  declare_preprocessor_constant("SystemDictionary::#string_klass",       SystemDictionary::WK_KLASS_ENUM_NAME(string_klass)) \
-  declare_preprocessor_constant("SystemDictionary::#system_klass",       SystemDictionary::WK_KLASS_ENUM_NAME(system_klass)) \
-  declare_preprocessor_constant("SystemDictionary::#thread_klass",       SystemDictionary::WK_KLASS_ENUM_NAME(thread_klass)) \
-  declare_preprocessor_constant("SystemDictionary::#threadGroup_klass",  SystemDictionary::WK_KLASS_ENUM_NAME(threadGroup_klass)) \
                                                                           \
   /***********************************/                                   \
   /* LoaderConstraintTable constants */                                   \