8152468: PrintMiscellaneous in constantPool should use classresolve logging.
authormockner
Mon, 11 Apr 2016 11:33:52 -0400
changeset 37451 ab07c0e0b05c
parent 37444 16caac2c1d9b
child 37452 99a20ba84625
8152468: PrintMiscellaneous in constantPool should use classresolve logging. Summary: some instances of PrintMiscellaneous have ben replaced by classresolve logging. Reviewed-by: coleenp, rprotacio
hotspot/src/share/vm/oops/constantPool.cpp
hotspot/test/runtime/logging/ClassResolutionTest.java
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Mon Apr 11 09:39:49 2016 +0000
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Mon Apr 11 11:33:52 2016 -0400
@@ -283,8 +283,9 @@
   this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
 
   // logging for classresolve tag.
-  trace_class_resolution(this_cp, k);
-
+  if (log_is_enabled(Debug, classresolve)){
+    trace_class_resolution(this_cp, k);
+  }
   this_cp->klass_at_put(which, k());
   entry = this_cp->resolved_klass_at(which);
   assert(entry.is_resolved() && entry.get_klass()->is_klass(), "must be resolved at this point");
@@ -340,9 +341,7 @@
   int cache_index = decode_cpcache_index(which, true);
   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
     // FIXME: should be an assert
-    if (PrintMiscellaneous && (Verbose||WizardMode)) {
-      tty->print_cr("bad operand %d in:", which); cpool->print();
-    }
+    log_debug(classresolve)("bad operand %d in:", which); cpool->print();
     return NULL;
   }
   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
@@ -672,10 +671,11 @@
       int callee_index             = this_cp->method_handle_klass_index_at(index);
       Symbol*  name =      this_cp->method_handle_name_ref_at(index);
       Symbol*  signature = this_cp->method_handle_signature_ref_at(index);
-      if (PrintMiscellaneous)
-        tty->print_cr("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
-                      ref_kind, index, this_cp->method_handle_index_at(index),
-                      callee_index, name->as_C_string(), signature->as_C_string());
+      { ResourceMark rm(THREAD);
+        log_debug(classresolve)("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
+                              ref_kind, index, this_cp->method_handle_index_at(index),
+                              callee_index, name->as_C_string(), signature->as_C_string());
+      }
       KlassHandle callee;
       { Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
         callee = KlassHandle(THREAD, k);
@@ -694,10 +694,11 @@
   case JVM_CONSTANT_MethodType:
     {
       Symbol*  signature = this_cp->method_type_signature_at(index);
-      if (PrintMiscellaneous)
-        tty->print_cr("resolve JVM_CONSTANT_MethodType [%d/%d] %s",
-                      index, this_cp->method_type_index_at(index),
-                      signature->as_C_string());
+      { ResourceMark rm(THREAD);
+        log_debug(classresolve)("resolve JVM_CONSTANT_MethodType [%d/%d] %s",
+                              index, this_cp->method_type_index_at(index),
+                              signature->as_C_string());
+      }
       KlassHandle klass(THREAD, this_cp->pool_holder());
       Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
       result_oop = value();
--- a/hotspot/test/runtime/logging/ClassResolutionTest.java	Mon Apr 11 09:39:49 2016 +0000
+++ b/hotspot/test/runtime/logging/ClassResolutionTest.java	Mon Apr 11 11:33:52 2016 -0400
@@ -51,7 +51,8 @@
         };
 
         public static void main(String... args) throws Exception {
-            Thing1Handler.getThingNumber();
+            int x = Thing1Handler.getThingNumber();
+            System.out.println("ThingNumber: "+Integer.toString(x));
         }
     }
 
@@ -62,6 +63,7 @@
                                                                   ClassResolutionTestMain.class.getName());
         OutputAnalyzer o = new OutputAnalyzer(pb.start());
         o.shouldContain("[classresolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1");
+        o.shouldContain("[classresolve] resolve JVM_CONSTANT_MethodHandle");
 
         // (2) classresolve should turn off.
         pb = ProcessTools.createJavaProcessBuilder("-Xlog:classresolve=debug",