7177409: Perf regression in JVM_GetClassDeclaredFields after generic signature changes.
authorjiangli
Fri, 22 Jun 2012 14:00:39 -0400
changeset 13101 67539edd246d
parent 13100 a97a0bd28c2e
child 13102 7342fd50f8d7
7177409: Perf regression in JVM_GetClassDeclaredFields after generic signature changes. Summary: In fieldDescriptor::generic_signature() returns NULL immediately if the field has no generic signature. Reviewed-by: dholmes, coleenp, jcoomes
hotspot/src/share/vm/runtime/fieldDescriptor.cpp
hotspot/src/share/vm/runtime/fieldDescriptor.hpp
hotspot/src/share/vm/runtime/reflection.cpp
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Tue Jun 19 21:16:20 2012 -0700
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Fri Jun 22 14:00:39 2012 -0400
@@ -39,6 +39,10 @@
 }
 
 Symbol* fieldDescriptor::generic_signature() const {
+  if (!has_generic_signature()) {
+    return NULL;
+  }
+
   int idx = 0;
   instanceKlass* ik = instanceKlass::cast(field_holder());
   for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp	Tue Jun 19 21:16:20 2012 -0700
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp	Fri Jun 22 14:00:39 2012 -0400
@@ -100,6 +100,7 @@
   bool is_field_access_watched() const    { return access_flags().is_field_access_watched(); }
   bool is_field_modification_watched() const
                                           { return access_flags().is_field_modification_watched(); }
+  bool has_generic_signature() const      { return access_flags().field_has_generic_signature(); }
 
   void set_is_field_access_watched(const bool value) {
     _access_flags.set_is_field_access_watched(value);
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Tue Jun 19 21:16:20 2012 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Fri Jun 22 14:00:39 2012 -0400
@@ -829,7 +829,7 @@
   java_lang_reflect_Field::set_modifiers(rh(), fd->access_flags().as_int() & JVM_RECOGNIZED_FIELD_MODIFIERS);
   java_lang_reflect_Field::set_override(rh(), false);
   if (java_lang_reflect_Field::has_signature_field() &&
-      fd->generic_signature() != NULL) {
+      fd->has_generic_signature()) {
     Symbol*  gs = fd->generic_signature();
     Handle sig = java_lang_String::create_from_symbol(gs, CHECK_NULL);
     java_lang_reflect_Field::set_signature(rh(), sig());