changeset 3444:634b8615a6ba

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
author jiangli
date Fri, 22 Jun 2012 14:00:39 -0400
parents f7baf26515fc
children 06320b1578cb
files src/share/vm/runtime/fieldDescriptor.cpp src/share/vm/runtime/fieldDescriptor.hpp src/share/vm/runtime/reflection.cpp
diffstat 3 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/fieldDescriptor.cpp	Tue Jun 19 21:16:20 2012 -0700
+++ b/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/src/share/vm/runtime/fieldDescriptor.hpp	Tue Jun 19 21:16:20 2012 -0700
+++ b/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/src/share/vm/runtime/reflection.cpp	Tue Jun 19 21:16:20 2012 -0700
+++ b/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());