# HG changeset patch # User rehn # Date 1462825335 -7200 # Node ID b495d1cfe673b2de73829e81848cada5b0cb9577 # Parent 6a4902a969d34000b2a58f3bba49e633724c3477 8153535: Convert TraceRedefineClasses to Unified Logging Reviewed-by: rprotacio, coleenp diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp Mon May 09 22:22:15 2016 +0200 @@ -27,12 +27,12 @@ #include "interp_masm_aarch64.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "logging/log.hpp" #include "oops/arrayOop.hpp" #include "oops/markOop.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" @@ -1450,7 +1450,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { get_method(c_rarg1); call_VM_leaf( CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Mon May 09 22:22:15 2016 +0200 @@ -31,9 +31,9 @@ #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interp_masm.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_aarch64.inline.hpp" @@ -1781,7 +1781,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { // protect the args we've loaded save_args(masm, total_c_args, c_arg, out_regs); __ mov_metadata(c_rarg1, method()); diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Mon May 09 22:22:15 2016 +0200 @@ -33,7 +33,6 @@ #include "interpreter/interp_masm.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_ppc.inline.hpp" diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Mon May 09 22:22:15 2016 +0200 @@ -26,13 +26,13 @@ #include "interp_masm_sparc.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "logging/log.hpp" #include "oops/arrayOop.hpp" #include "oops/markOop.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "oops/methodCounters.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" @@ -2645,7 +2645,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), G2_thread, Lmethod); diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Mon May 09 22:22:15 2016 +0200 @@ -28,9 +28,9 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_sparc.inline.hpp" @@ -2450,7 +2450,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { // create inner frame __ save_frame(0); __ mov(G2_thread, L7_thread_cache); diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/x86/vm/interp_masm_x86.cpp --- a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp Mon May 09 22:22:15 2016 +0200 @@ -26,12 +26,12 @@ #include "interp_masm_x86.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "logging/log.hpp" #include "oops/arrayOop.hpp" #include "oops/markOop.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" @@ -1953,7 +1953,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { NOT_LP64(get_thread(rthread);) get_method(rarg); call_VM_leaf( diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Mon May 09 22:22:15 2016 +0200 @@ -29,9 +29,9 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_x86.inline.hpp" @@ -1953,7 +1953,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { __ mov_metadata(rax, method()); __ call_VM_leaf( CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon May 09 22:22:15 2016 +0200 @@ -32,9 +32,9 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_x86.inline.hpp" @@ -2322,7 +2322,7 @@ } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { // protect the args we've loaded save_args(masm, total_c_args, c_arg, out_regs); __ mov_metadata(c_rarg1, method()); diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp --- a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp Mon May 09 22:22:15 2016 +0200 @@ -31,7 +31,6 @@ #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_zero.inline.hpp" diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/classfile/dictionary.cpp --- a/hotspot/src/share/vm/classfile/dictionary.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/classfile/dictionary.cpp Mon May 09 22:22:15 2016 +0200 @@ -31,7 +31,6 @@ #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/orderAccess.inline.hpp" #include "utilities/hashtable.inline.hpp" diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/classfile/javaClasses.cpp --- a/hotspot/src/share/vm/classfile/javaClasses.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Mon May 09 22:22:15 2016 +0200 @@ -45,7 +45,6 @@ #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "oops/typeArrayOop.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/code/nmethod.cpp Mon May 09 22:22:15 2016 +0200 @@ -36,10 +36,10 @@ #include "compiler/directivesParser.hpp" #include "compiler/disassembler.hpp" #include "interpreter/bytecode.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/methodData.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiImpl.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.inline.hpp" @@ -2001,15 +2001,18 @@ Method* method = deps.method_argument(0); for (int j = 0; j < dependee_methods->length(); j++) { if (dependee_methods->at(j) == method) { - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x01000000, - ("Found evol dependency of nmethod %s.%s(%s) compile_id=%d on method %s.%s(%s)", - _method->method_holder()->external_name(), - _method->name()->as_C_string(), - _method->signature()->as_C_string(), compile_id(), - method->method_holder()->external_name(), - method->name()->as_C_string(), - method->signature()->as_C_string())); + if (log_is_enabled(Debug, redefine, class, nmethod)) { + ResourceMark rm; + log_debug(redefine, class, nmethod) + ("Found evol dependency of nmethod %s.%s(%s) compile_id=%d on method %s.%s(%s)", + _method->method_holder()->external_name(), + _method->name()->as_C_string(), + _method->signature()->as_C_string(), + compile_id(), + method->method_holder()->external_name(), + method->name()->as_C_string(), + method->signature()->as_C_string()); + } if (TraceDependencies || LogCompilation) deps.log_dependency(dependee); return true; diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/interpreter/oopMapCache.cpp --- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp Mon May 09 22:22:15 2016 +0200 @@ -24,10 +24,10 @@ #include "precompiled.hpp" #include "interpreter/oopMapCache.hpp" +#include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/handles.inline.hpp" #include "runtime/signature.hpp" @@ -469,10 +469,12 @@ if (!_array[i].is_empty() && _array[i].method()->is_old()) { // Cache entry is occupied by an old redefined method and we don't want // to pin it down so flush the entry. - RC_TRACE(0x08000000, ("flush: %s(%s): cached entry @%d", - _array[i].method()->name()->as_C_string(), - _array[i].method()->signature()->as_C_string(), i)); - + if (log_is_enabled(Debug, redefine, class, oopmap)) { + ResourceMark rm; + log_debug(redefine, class, oopmap) + ("flush: %s(%s): cached entry @%d", + _array[i].method()->name()->as_C_string(), _array[i].method()->signature()->as_C_string(), i); + } _array[i].flush(); } } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/logging/logTag.hpp --- a/hotspot/src/share/vm/logging/logTag.hpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/logging/logTag.hpp Mon May 09 22:22:15 2016 +0200 @@ -32,23 +32,28 @@ // (The tags 'all', 'disable' and 'help' are special tags that can // not be used in log calls, and should not be listed below.) #define LOG_TAG_LIST \ - LOG_TAG(alloc) \ + LOG_TAG(add) \ LOG_TAG(age) \ + LOG_TAG(alloc) \ LOG_TAG(arguments) \ + LOG_TAG(annotation) \ LOG_TAG(barrier) \ LOG_TAG(biasedlocking) \ LOG_TAG(bot) \ + LOG_TAG(breakpoint) \ LOG_TAG(census) \ LOG_TAG(class) \ LOG_TAG(classhisto) \ LOG_TAG(cleanup) \ LOG_TAG(compaction) \ LOG_TAG(constraints) \ + LOG_TAG(constantpool) \ LOG_TAG(coops) \ LOG_TAG(cpu) \ LOG_TAG(cset) \ LOG_TAG(data) \ LOG_TAG(defaultmethods) \ + LOG_TAG(dump) \ LOG_TAG(ergo) \ LOG_TAG(exceptions) \ LOG_TAG(exit) \ @@ -57,6 +62,7 @@ LOG_TAG(heap) \ LOG_TAG(humongous) \ LOG_TAG(ihop) \ + LOG_TAG(iklass) \ LOG_TAG(init) \ LOG_TAG(itables) \ LOG_TAG(jni) \ @@ -65,13 +71,20 @@ LOG_TAG(load) /* Trace all classes loaded */ \ LOG_TAG(loader) \ LOG_TAG(logging) \ + LOG_TAG(mark) \ LOG_TAG(marking) \ + LOG_TAG(methodcomparator) \ + LOG_TAG(metadata) \ LOG_TAG(metaspace) \ LOG_TAG(mmu) \ LOG_TAG(modules) \ LOG_TAG(monitorinflation) \ LOG_TAG(monitormismatch) \ + LOG_TAG(nmethod) \ + LOG_TAG(normalize) \ LOG_TAG(objecttagging) \ + LOG_TAG(obsolete) \ + LOG_TAG(oopmap) \ LOG_TAG(os) \ LOG_TAG(pagesize) \ LOG_TAG(path) \ @@ -81,9 +94,11 @@ LOG_TAG(preorder) /* Trace all classes loaded in order referenced (not loaded) */ \ LOG_TAG(protectiondomain) /* "Trace protection domain verification" */ \ LOG_TAG(ref) \ + LOG_TAG(redefine) \ LOG_TAG(refine) \ LOG_TAG(region) \ LOG_TAG(remset) \ + LOG_TAG(purge) \ LOG_TAG(resolve) \ LOG_TAG(safepoint) \ LOG_TAG(scavenge) \ @@ -95,6 +110,8 @@ LOG_TAG(stats) \ LOG_TAG(stringdedup) \ LOG_TAG(stringtable) \ + LOG_TAG(stackmap) \ + LOG_TAG(subclass) \ LOG_TAG(survivor) \ LOG_TAG(sweep) \ LOG_TAG(task) \ @@ -102,6 +119,8 @@ LOG_TAG(thread) \ LOG_TAG(tlab) \ LOG_TAG(time) \ + LOG_TAG(timer) \ + LOG_TAG(update) \ LOG_TAG(unload) /* Trace unloading of classes */ \ LOG_TAG(verification) \ LOG_TAG(verify) \ diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/memory/universe.cpp Mon May 09 22:22:15 2016 +0200 @@ -55,7 +55,6 @@ #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/typeArrayKlass.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/commandLineFlagConstraintList.hpp" diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/oops/cpCache.cpp --- a/hotspot/src/share/vm/oops/cpCache.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/oops/cpCache.cpp Mon May 09 22:22:15 2016 +0200 @@ -25,12 +25,12 @@ #include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/rewriter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" #include "oops/cpCache.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodHandles.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/handles.inline.hpp" @@ -438,17 +438,14 @@ // match old_method so need an update // NOTE: can't use set_f2_as_vfinal_method as it asserts on different values _f2 = (intptr_t)new_method; - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("cpc vf-entry update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, constantpool) + ("cpc vf-entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } return true; } @@ -465,17 +462,14 @@ if (_f1 == old_method) { _f1 = new_method; - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("cpc entry update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, constantpool) + ("cpc entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } return true; } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/oops/instanceKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlass.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Mon May 09 22:22:15 2016 +0200 @@ -53,7 +53,6 @@ #include "oops/symbol.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiRedefineClasses.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "prims/methodComparator.hpp" #include "runtime/atomic.inline.hpp" @@ -2574,17 +2573,17 @@ assert(old_method != new_method, "sanity check"); default_methods()->at_put(index, new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s", - external_name(), - old_method->method_holder()->external_name())); + log_info(redefine, class, update) + ("adjust: klassname=%s default methods from name=%s", + external_name(), old_method->method_holder()->external_name()); *trace_name_printed = true; } - RC_TRACE(0x00100000, ("default method update: %s(%s) ", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, vtables) + ("default method update: %s(%s) ", + new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } } } @@ -3353,8 +3352,8 @@ ClassLoaderData* loader_data = ik->class_loader_data(); assert(loader_data != NULL, "should never be null"); - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000200, ("purge: %s: previous versions", ik->external_name())); + ResourceMark rm; + log_trace(redefine, class, iklass, purge)("%s: previous versions", ik->external_name()); // previous versions are linked together through the InstanceKlass InstanceKlass* pv_node = ik->previous_versions(); @@ -3372,8 +3371,7 @@ // are executing. Unlink this previous_version. // The previous version InstanceKlass is on the ClassLoaderData deallocate list // so will be deallocated during the next phase of class unloading. - RC_TRACE(0x00000200, ("purge: previous version " INTPTR_FORMAT " is dead", - p2i(pv_node))); + log_trace(redefine, class, iklass, purge)("previous version " INTPTR_FORMAT " is dead", p2i(pv_node)); // For debugging purposes. pv_node->set_is_scratch_class(); pv_node->class_loader_data()->add_to_deallocate_list(pv_node); @@ -3383,8 +3381,7 @@ version++; continue; } else { - RC_TRACE(0x00000200, ("purge: previous version " INTPTR_FORMAT " is alive", - p2i(pv_node))); + log_trace(redefine, class, iklass, purge)("previous version " INTPTR_FORMAT " is alive", p2i(pv_node)); assert(pvcp->pool_holder() != NULL, "Constant pool with no holder"); guarantee (!loader_data->is_unloading(), "unloaded classes can't be on the stack"); live_count++; @@ -3396,8 +3393,7 @@ // longer running. Array* method_refs = pv_node->methods(); if (method_refs != NULL) { - RC_TRACE(0x00000200, ("purge: previous methods length=%d", - method_refs->length())); + log_trace(redefine, class, iklass, purge)("previous methods length=%d", method_refs->length()); for (int j = 0; j < method_refs->length(); j++) { Method* method = method_refs->at(j); @@ -3409,11 +3405,9 @@ } else { assert (method->is_obsolete() || method->is_running_emcp(), "emcp method cannot run after emcp bit is cleared"); - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000200, + log_trace(redefine, class, iklass, purge) ("purge: %s(%s): prev method @%d in version @%d is alive", - method->name()->as_C_string(), - method->signature()->as_C_string(), j, version)); + method->name()->as_C_string(), method->signature()->as_C_string(), j, version); } } } @@ -3422,9 +3416,9 @@ pv_node = pv_node->previous_versions(); version++; } - RC_TRACE(0x00000200, - ("purge: previous version stats: live=%d, deleted=%d", live_count, - deleted_count)); + log_trace(redefine, class, iklass, purge) + ("previous version stats: live=%d, deleted=%d", + live_count, deleted_count); } } @@ -3459,9 +3453,9 @@ method->signature() == m_signature) { // The current RedefineClasses() call has made all EMCP // versions of this method obsolete so mark it as obsolete - RC_TRACE(0x00000400, - ("add: %s(%s): flush obsolete method @%d in version @%d", - m_name->as_C_string(), m_signature->as_C_string(), k, j)); + log_trace(redefine, class, iklass, add) + ("%s(%s): flush obsolete method @%d in version @%d", + m_name->as_C_string(), m_signature->as_C_string(), k, j); method->set_is_obsolete(); break; @@ -3493,9 +3487,9 @@ assert(Thread::current()->is_VM_thread(), "only VMThread can add previous versions"); - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000400, ("adding previous version ref for %s, EMCP_cnt=%d", - scratch_class->external_name(), emcp_method_count)); + ResourceMark rm; + log_trace(redefine, class, iklass, add) + ("adding previous version ref for %s, EMCP_cnt=%d", scratch_class->external_name(), emcp_method_count); // Clean out old previous versions purge_previous_versions(this); @@ -3511,7 +3505,7 @@ // we don't need to add this as a previous version. ConstantPool* cp_ref = scratch_class->constants(); if (!cp_ref->on_stack()) { - RC_TRACE(0x00000400, ("add: scratch class not added; no methods are running")); + log_trace(redefine, class, iklass, add)("scratch class not added; no methods are running"); // For debugging purposes. scratch_class->set_is_scratch_class(); scratch_class->class_loader_data()->add_to_deallocate_list(scratch_class()); @@ -3534,17 +3528,17 @@ // method may exit. If so, we would set a breakpoint in a method that // is never reached, but this won't be noticeable to the programmer. old_method->set_running_emcp(true); - RC_TRACE(0x00000400, ("add: EMCP method %s is on_stack " INTPTR_FORMAT, - old_method->name_and_sig_as_C_string(), p2i(old_method))); + log_trace(redefine, class, iklass, add) + ("EMCP method %s is on_stack " INTPTR_FORMAT, old_method->name_and_sig_as_C_string(), p2i(old_method)); } else if (!old_method->is_obsolete()) { - RC_TRACE(0x00000400, ("add: EMCP method %s is NOT on_stack " INTPTR_FORMAT, - old_method->name_and_sig_as_C_string(), p2i(old_method))); + log_trace(redefine, class, iklass, add) + ("EMCP method %s is NOT on_stack " INTPTR_FORMAT, old_method->name_and_sig_as_C_string(), p2i(old_method)); } } } // Add previous version if any methods are still running. - RC_TRACE(0x00000400, ("add: scratch class added; one of its methods is on_stack")); + log_trace(redefine, class, iklass, add)("scratch class added; one of its methods is on_stack"); assert(scratch_class->previous_versions() == NULL, "shouldn't have a previous version"); scratch_class->link_previous_versions(previous_versions()); link_previous_versions(scratch_class()); diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/oops/klassVtable.cpp --- a/hotspot/src/share/vm/oops/klassVtable.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/oops/klassVtable.cpp Mon May 09 22:22:15 2016 +0200 @@ -34,7 +34,6 @@ #include "oops/method.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" #include "utilities/copy.hpp" @@ -887,19 +886,17 @@ updated_default = adjust_default_method(index, old_method, new_method); } - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s", - klass()->external_name(), - old_method->method_holder()->external_name())); + log_info(redefine, class, update) + ("adjust: klassname=%s for methods from name=%s", + klass()->external_name(), old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string(), - updated_default ? "true" : "false")); + log_debug(redefine, class, update, vtables) + ("vtable method update: %s(%s), updated default = %s", + new_method->name()->as_C_string(), new_method->signature()->as_C_string(), updated_default ? "true" : "false"); } } } @@ -1205,17 +1202,14 @@ ime->initialize(new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00200000, ("itable method update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_trace(redefine, class, update, itables) + ("itable method update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } } } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/prims/jvmtiImpl.cpp --- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp Mon May 09 22:22:15 2016 +0200 @@ -303,11 +303,10 @@ if (method->is_running_emcp() && method->name() == m_name && method->signature() == m_signature) { - RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)", - meth_act == &Method::set_breakpoint ? "sett" : "clear", - method->name()->as_C_string(), - method->signature()->as_C_string())); - + ResourceMark rm; + log_debug(redefine, class, breakpoint) + ("%sing breakpoint in %s(%s)", meth_act == &Method::set_breakpoint ? "sett" : "clear", + method->name()->as_C_string(), method->signature()->as_C_string()); (method->*meth_act)(_bci); break; } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Mon May 09 22:22:15 2016 +0200 @@ -32,6 +32,7 @@ #include "gc/shared/gcLocker.hpp" #include "interpreter/oopMapCache.hpp" #include "interpreter/rewriter.hpp" +#include "logging/logStream.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" @@ -94,7 +95,9 @@ // Start timer after all the sanity checks; not quite accurate, but // better than adding a bunch of stop() calls. - RC_TIMER_START(_timer_vm_op_prologue); + if (log_is_enabled(Info, redefine, class, timer)) { + _timer_vm_op_prologue.start(); + } // We first load new class versions in the prologue, because somewhere down the // call chain it is required that the current thread is a Java thread. @@ -111,11 +114,11 @@ } // Free os::malloc allocated memory in load_new_class_version. os::free(_scratch_classes); - RC_TIMER_STOP(_timer_vm_op_prologue); + _timer_vm_op_prologue.stop(); return false; } - RC_TIMER_STOP(_timer_vm_op_prologue); + _timer_vm_op_prologue.stop(); return true; } @@ -128,8 +131,7 @@ // a shared class. We do the remap during the doit() phase of // the safepoint to be safer. if (!MetaspaceShared::remap_shared_readonly_as_readwrite()) { - RC_TRACE_WITH_THREAD(0x00000001, thread, - ("failed to remap shared readonly space to readwrite, private")); + log_info(redefine, class, load)("failed to remap shared readonly space to readwrite, private"); _res = JVMTI_ERROR_INTERNAL; return; } @@ -161,9 +163,9 @@ // check_class() is optionally called for product bits, but is // always called for non-product bits. #ifdef PRODUCT - if (RC_TRACE_ENABLED(0x00004000)) { + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { #endif - RC_TRACE_WITH_THREAD(0x00004000, thread, ("calling check_class")); + log_trace(redefine, class, obsolete, metadata)("calling check_class"); CheckClass check_class(thread); ClassLoaderDataGraph::classes_do(&check_class); #ifdef PRODUCT @@ -178,19 +180,19 @@ // Reset the_class_oop to null for error printing. _the_class_oop = NULL; - if (RC_TRACE_ENABLED(0x00000004)) { + if (log_is_enabled(Info, redefine, class, timer)) { // Used to have separate timers for "doit" and "all", but the timer // overhead skewed the measurements. jlong doit_time = _timer_rsc_phase1.milliseconds() + _timer_rsc_phase2.milliseconds(); jlong all_time = _timer_vm_op_prologue.milliseconds() + doit_time; - RC_TRACE(0x00000004, ("vm_op: all=" UINT64_FORMAT - " prologue=" UINT64_FORMAT " doit=" UINT64_FORMAT, all_time, - _timer_vm_op_prologue.milliseconds(), doit_time)); - RC_TRACE(0x00000004, + log_info(redefine, class, timer) + ("vm_op: all=" UINT64_FORMAT " prologue=" UINT64_FORMAT " doit=" UINT64_FORMAT, + all_time, _timer_vm_op_prologue.milliseconds(), doit_time); + log_info(redefine, class, timer) ("redefine_single_class: phase1=" UINT64_FORMAT " phase2=" UINT64_FORMAT, - _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds())); + _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds()); } } @@ -305,14 +307,14 @@ // both new_name_ref_i and new_signature_ref_i will both be 0. // In that case, all we are appending is the current entry. if (new_name_ref_i != name_ref_i) { - RC_TRACE(0x00080000, + log_trace(redefine, class, constantpool) ("NameAndType entry@%d name_ref_index change: %d to %d", - *merge_cp_length_p, name_ref_i, new_name_ref_i)); + *merge_cp_length_p, name_ref_i, new_name_ref_i); } if (new_signature_ref_i != signature_ref_i) { - RC_TRACE(0x00080000, + log_trace(redefine, class, constantpool) ("NameAndType entry@%d signature_ref_index change: %d to %d", - *merge_cp_length_p, signature_ref_i, new_signature_ref_i)); + *merge_cp_length_p, signature_ref_i, new_signature_ref_i); } (*merge_cp_p)->name_and_type_at_put(*merge_cp_length_p, @@ -361,14 +363,13 @@ } if (klass_ref_i != new_klass_ref_i) { - RC_TRACE(0x00080000, ("%s entry@%d class_index changed: %d to %d", - entry_name, *merge_cp_length_p, klass_ref_i, new_klass_ref_i)); + log_trace(redefine, class, constantpool) + ("%s entry@%d class_index changed: %d to %d", entry_name, *merge_cp_length_p, klass_ref_i, new_klass_ref_i); } if (name_and_type_ref_i != new_name_and_type_ref_i) { - RC_TRACE(0x00080000, + log_trace(redefine, class, constantpool) ("%s entry@%d name_and_type_index changed: %d to %d", - entry_name, *merge_cp_length_p, name_and_type_ref_i, - new_name_and_type_ref_i)); + entry_name, *merge_cp_length_p, name_and_type_ref_i, new_name_and_type_ref_i); } if (scratch_i != *merge_cp_length_p) { @@ -386,9 +387,8 @@ int new_ref_i = find_or_append_indirect_entry(scratch_cp, ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_ref_i != ref_i) { - RC_TRACE(0x00080000, - ("MethodType entry@%d ref_index change: %d to %d", - *merge_cp_length_p, ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("MethodType entry@%d ref_index change: %d to %d", *merge_cp_length_p, ref_i, new_ref_i); } (*merge_cp_p)->method_type_index_at_put(*merge_cp_length_p, new_ref_i); if (scratch_i != *merge_cp_length_p) { @@ -407,9 +407,8 @@ int new_ref_i = find_or_append_indirect_entry(scratch_cp, ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_ref_i != ref_i) { - RC_TRACE(0x00080000, - ("MethodHandle entry@%d ref_index change: %d to %d", - *merge_cp_length_p, ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("MethodHandle entry@%d ref_index change: %d to %d", *merge_cp_length_p, ref_i, new_ref_i); } (*merge_cp_p)->method_handle_index_at_put(*merge_cp_length_p, ref_kind, new_ref_i); if (scratch_i != *merge_cp_length_p) { @@ -432,14 +431,13 @@ int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_bs_i != old_bs_i) { - RC_TRACE(0x00080000, - ("InvokeDynamic entry@%d bootstrap_method_attr_index change: %d to %d", - *merge_cp_length_p, old_bs_i, new_bs_i)); + log_trace(redefine, class, constantpool) + ("InvokeDynamic entry@%d bootstrap_method_attr_index change: %d to %d", + *merge_cp_length_p, old_bs_i, new_bs_i); } if (new_ref_i != old_ref_i) { - RC_TRACE(0x00080000, - ("InvokeDynamic entry@%d name_and_type_index change: %d to %d", - *merge_cp_length_p, old_ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("InvokeDynamic entry@%d name_and_type_index change: %d to %d", *merge_cp_length_p, old_ref_i, new_ref_i); } (*merge_cp_p)->invoke_dynamic_at_put(*merge_cp_length_p, new_bs_i, new_ref_i); @@ -516,9 +514,8 @@ int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_ref_i != old_ref_i) { - RC_TRACE(0x00080000, - ("operands entry@%d bootstrap method ref_index change: %d to %d", - _operands_cur_length, old_ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("operands entry@%d bootstrap method ref_index change: %d to %d", _operands_cur_length, old_ref_i, new_ref_i); } Array* merge_ops = (*merge_cp_p)->operands(); @@ -539,9 +536,9 @@ merge_cp_length_p, THREAD); merge_ops->at_put(new_base++, new_arg_ref_i); if (new_arg_ref_i != old_arg_ref_i) { - RC_TRACE(0x00080000, - ("operands entry@%d bootstrap method argument ref_index change: %d to %d", - _operands_cur_length, old_arg_ref_i, new_arg_ref_i)); + log_trace(redefine, class, constantpool) + ("operands entry@%d bootstrap method argument ref_index change: %d to %d", + _operands_cur_length, old_arg_ref_i, new_arg_ref_i); } } if (old_bs_i != _operands_cur_length) { @@ -586,14 +583,13 @@ // Shrink the merge_cp operands merge_cp->shrink_operands(_operands_cur_length, CHECK); - if (RC_TRACE_ENABLED(0x00040000)) { + if (log_is_enabled(Trace, redefine, class, constantpool)) { // don't want to loop unless we are tracing int count = 0; for (int i = 1; i < _operands_index_map_p->length(); i++) { int value = _operands_index_map_p->at(i); if (value != -1) { - RC_TRACE_WITH_THREAD(0x00040000, THREAD, - ("operands_index_map[%d]: old=%d new=%d", count, i, value)); + log_trace(redefine, class, constantpool)("operands_index_map[%d]: old=%d new=%d", count, i, value); count++; } } @@ -795,9 +791,9 @@ } } } - RC_TRACE(0x00008000, ("Method matched: new: %s [%d] == old: %s [%d]", - k_new_method->name_and_sig_as_C_string(), ni, - k_old_method->name_and_sig_as_C_string(), oi)); + log_trace(redefine, class, normalize) + ("Method matched: new: %s [%d] == old: %s [%d]", + k_new_method->name_and_sig_as_C_string(), ni, k_old_method->name_and_sig_as_C_string(), oi); // advance to next pair of methods ++oi; ++ni; @@ -832,8 +828,8 @@ return JVMTI_ERROR_OUT_OF_MEMORY; } } - RC_TRACE(0x00008000, ("Method added: new: %s [%d]", - k_new_method->name_and_sig_as_C_string(), ni)); + log_trace(redefine, class, normalize) + ("Method added: new: %s [%d]", k_new_method->name_and_sig_as_C_string(), ni); ++ni; // advance to next new method break; case deleted: @@ -846,8 +842,8 @@ // deleted methods must be private return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED; } - RC_TRACE(0x00008000, ("Method deleted: old: %s [%d]", - k_old_method->name_and_sig_as_C_string(), oi)); + log_trace(redefine, class, normalize) + ("Method deleted: old: %s [%d]", k_old_method->name_and_sig_as_C_string(), oi); ++oi; // advance to next old method break; default: @@ -973,11 +969,9 @@ instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop); Symbol* the_class_sym = the_class->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000001, THREAD, + log_debug(redefine, class, load) ("loading name=%s kind=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), _class_load_kind, - os::available_memory() >> 10)); + the_class->external_name(), _class_load_kind, os::available_memory() >> 10); ClassFileStream st((u1*)_class_defs[i].class_bytes, _class_defs[i].class_byte_count, @@ -1011,9 +1005,7 @@ if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, ("parse_stream exception: '%s'", - ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("parse_stream exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_UnsupportedClassVersionError()) { @@ -1037,9 +1029,7 @@ the_class->link_class(THREAD); if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, ("link_class exception: '%s'", - ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("link_class exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1075,9 +1065,7 @@ if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("verify_byte_codes exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("verify_byte_codes exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1090,9 +1078,7 @@ res = merge_cp_and_rewrite(the_class, scratch_class, THREAD); if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("merge_cp_and_rewrite exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("merge_cp_and_rewrite exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1110,10 +1096,8 @@ if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("verify_byte_codes post merge-CP exception: '%s'", - ex_name->as_C_string())); + log_info(redefine, class, load, exceptions) + ("verify_byte_codes post merge-CP exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1130,9 +1114,8 @@ } if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("Rewriter::rewrite or link_methods exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions) + ("Rewriter::rewrite or link_methods exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1141,10 +1124,8 @@ } } - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000001, THREAD, - ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), os::available_memory() >> 10)); + log_debug(redefine, class, load) + ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", the_class->external_name(), os::available_memory() >> 10); } return JVMTI_ERROR_NONE; @@ -1152,7 +1133,7 @@ // Map old_index to new_index as needed. scratch_cp is only needed -// for RC_TRACE() calls. +// for log calls. void VM_RedefineClasses::map_index(const constantPoolHandle& scratch_cp, int old_index, int new_index) { if (find_new_index(old_index) != 0) { @@ -1168,8 +1149,8 @@ _index_map_p->at_put(old_index, new_index); _index_map_count++; - RC_TRACE(0x00040000, ("mapped tag %d at index %d to %d", - scratch_cp->tag_at(old_index).value(), old_index, new_index)); + log_trace(redefine, class, constantpool) + ("mapped tag %d at index %d to %d", scratch_cp->tag_at(old_index).value(), old_index, new_index); } // end map_index() @@ -1188,7 +1169,7 @@ _operands_index_map_p->at_put(old_index, new_index); _operands_index_map_count++; - RC_TRACE(0x00040000, ("mapped bootstrap specifier at index %d to %d", old_index, new_index)); + log_trace(redefine, class, constantpool)("mapped bootstrap specifier at index %d to %d", old_index, new_index); } // end map_index() @@ -1219,9 +1200,7 @@ return false; // robustness } - RC_TRACE_WITH_THREAD(0x00010000, THREAD, - ("old_cp_len=%d, scratch_cp_len=%d", old_cp->length(), - scratch_cp->length())); + log_info(redefine, class, constantpool)("old_cp_len=%d, scratch_cp_len=%d", old_cp->length(), scratch_cp->length()); { // Pass 0: @@ -1273,8 +1252,7 @@ // merge_cp_len should be the same as old_cp->length() at this point // so this trace message is really a "warm-and-breathing" message. - RC_TRACE_WITH_THREAD(0x00020000, THREAD, - ("after pass 0: merge_cp_len=%d", *merge_cp_length_p)); + log_debug(redefine, class, constantpool)("after pass 0: merge_cp_len=%d", *merge_cp_length_p); int scratch_i; // index into scratch_cp { @@ -1339,9 +1317,9 @@ } } - RC_TRACE_WITH_THREAD(0x00020000, THREAD, + log_debug(redefine, class, constantpool) ("after pass 1a: merge_cp_len=%d, scratch_i=%d, index_map_len=%d", - *merge_cp_length_p, scratch_i, _index_map_count)); + *merge_cp_length_p, scratch_i, _index_map_count); if (scratch_i < scratch_cp->length()) { // Pass 1b: @@ -1377,9 +1355,9 @@ CHECK_0); } - RC_TRACE_WITH_THREAD(0x00020000, THREAD, + log_debug(redefine, class, constantpool) ("after pass 1b: merge_cp_len=%d, scratch_i=%d, index_map_len=%d", - *merge_cp_length_p, scratch_i, _index_map_count)); + *merge_cp_length_p, scratch_i, _index_map_count); } finalize_operands_merge(*merge_cp_p, THREAD); @@ -1468,8 +1446,7 @@ return JVMTI_ERROR_INTERNAL; } - RC_TRACE_WITH_THREAD(0x00010000, THREAD, - ("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count)); + log_info(redefine, class, constantpool)("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count); if (_index_map_count == 0) { // there is nothing to map between the new and merged constant pools @@ -1508,15 +1485,14 @@ cp_cleaner.add_scratch_cp(scratch_cp()); } } else { - if (RC_TRACE_ENABLED(0x00040000)) { + if (log_is_enabled(Trace, redefine, class, constantpool)) { // don't want to loop unless we are tracing int count = 0; for (int i = 1; i < _index_map_p->length(); i++) { int value = _index_map_p->at(i); if (value != -1) { - RC_TRACE_WITH_THREAD(0x00040000, THREAD, - ("index_map[%d]: old=%d new=%d", count, i, value)); + log_trace(redefine, class, constantpool)("index_map[%d]: old=%d new=%d", count, i, value); count++; } } @@ -1653,9 +1629,7 @@ } if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("rewrite_cp_refs_in_method exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("rewrite_cp_refs_in_method exception: '%s'", ex_name->as_C_string()); // Need to clear pending exception here as the super caller sets // the JVMTI_ERROR_INTERNAL if the returned value is false. CLEAR_PENDING_EXCEPTION; @@ -1715,14 +1689,12 @@ if (!StressLdcRewrite && new_index <= max_jubyte) { // The new value can still use ldc instead of ldc_w // unless we are trying to stress ldc -> ldc_w rewriting - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), - p2i(bcp), cp_index, new_index)); + log_trace(redefine, class, constantpool) + ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), p2i(bcp), cp_index, new_index); *(bcp + 1) = new_index; } else { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("%s->ldc_w@" INTPTR_FORMAT " old=%d, new=%d", - Bytecodes::name(c), p2i(bcp), cp_index, new_index)); + log_trace(redefine, class, constantpool) + ("%s->ldc_w@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), p2i(bcp), cp_index, new_index); // the new value needs ldc_w instead of ldc u_char inst_buffer[4]; // max instruction size is 4 bytes bcp = (address)inst_buffer; @@ -1781,9 +1753,8 @@ int new_index = find_new_index(cp_index); if (new_index != 0) { // the original index is mapped so update w/ new value - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), - p2i(bcp), cp_index, new_index)); + log_trace(redefine, class, constantpool) + ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c),p2i(bcp), cp_index, new_index); // Rewriter::rewrite_method() uses put_native_u2() in this // situation because it is reusing the constant pool index // location for a native index into the ConstantPoolCache. @@ -1823,8 +1794,7 @@ return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("class_annotations length=%d", class_annotations->length())); + log_debug(redefine, class, annotation)("class_annotations length=%d", class_annotations->length()); int byte_i = 0; // byte index into class_annotations return rewrite_cp_refs_in_annotations_typeArray(class_annotations, byte_i, @@ -1846,8 +1816,7 @@ if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for num_annotations field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for num_annotations field")); + log_debug(redefine, class, annotation)("length() is too small for num_annotations field"); return false; } @@ -1855,15 +1824,13 @@ annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("num_annotations=%d", num_annotations)); + log_debug(redefine, class, annotation)("num_annotations=%d", num_annotations); int calc_num_annotations = 0; for (; calc_num_annotations < num_annotations; calc_num_annotations++) { if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, byte_i_ref, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad annotation_struct at %d", calc_num_annotations)); + log_debug(redefine, class, annotation)("bad annotation_struct at %d", calc_num_annotations); // propagate failure back to caller return false; } @@ -1891,8 +1858,7 @@ AnnotationArray* annotations_typeArray, int &byte_i_ref, TRAPS) { if ((byte_i_ref + 2 + 2) > annotations_typeArray->length()) { // not enough room for smallest annotation_struct - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for annotation_struct")); + log_debug(redefine, class, annotation)("length() is too small for annotation_struct"); return false; } @@ -1903,9 +1869,8 @@ annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_index=%d num_element_value_pairs=%d", type_index, - num_element_value_pairs)); + log_debug(redefine, class, annotation) + ("type_index=%d num_element_value_pairs=%d", type_index, num_element_value_pairs); int calc_num_element_value_pairs = 0; for (; calc_num_element_value_pairs < num_element_value_pairs; @@ -1913,8 +1878,7 @@ if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for another element_name_index, let alone // the rest of another component - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for element_name_index")); + log_debug(redefine, class, annotation)("length() is too small for element_name_index"); return false; } @@ -1922,13 +1886,11 @@ annotations_typeArray, byte_i_ref, "element_name_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("element_name_index=%d", element_name_index)); + log_debug(redefine, class, annotation)("element_name_index=%d", element_name_index); if (!rewrite_cp_refs_in_element_value(annotations_typeArray, byte_i_ref, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad element_value at %d", calc_num_element_value_pairs)); + log_debug(redefine, class, annotation)("bad element_value at %d", calc_num_element_value_pairs); // propagate failure back to caller return false; } @@ -1953,7 +1915,7 @@ u2 old_cp_index = Bytes::get_Java_u2(cp_index_addr); u2 new_cp_index = find_new_index(old_cp_index); if (new_cp_index != 0) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("mapped old %s=%d", trace_mesg, old_cp_index)); + log_debug(redefine, class, annotation)("mapped old %s=%d", trace_mesg, old_cp_index); Bytes::put_Java_u2(cp_index_addr, new_cp_index); old_cp_index = new_cp_index; } @@ -1988,14 +1950,13 @@ if ((byte_i_ref + 1) > annotations_typeArray->length()) { // not enough room for a tag let alone the rest of an element_value - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a tag")); + log_debug(redefine, class, annotation)("length() is too small for a tag"); return false; } u1 tag = annotations_typeArray->at(byte_i_ref); byte_i_ref++; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("tag='%c'", tag)); + log_debug(redefine, class, annotation)("tag='%c'", tag); switch (tag) { // These BaseType tag values are from Table 4.2 in VM spec: @@ -2017,8 +1978,7 @@ if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for a const_value_index - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a const_value_index")); + log_debug(redefine, class, annotation)("length() is too small for a const_value_index"); return false; } @@ -2026,8 +1986,7 @@ annotations_typeArray, byte_i_ref, "const_value_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("const_value_index=%d", const_value_index)); + log_debug(redefine, class, annotation)("const_value_index=%d", const_value_index); } break; case 'e': @@ -2036,8 +1995,7 @@ if ((byte_i_ref + 4) > annotations_typeArray->length()) { // not enough room for a enum_const_value - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a enum_const_value")); + log_debug(redefine, class, annotation)("length() is too small for a enum_const_value"); return false; } @@ -2049,9 +2007,8 @@ annotations_typeArray, byte_i_ref, "const_name_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_name_index=%d const_name_index=%d", type_name_index, - const_name_index)); + log_debug(redefine, class, annotation) + ("type_name_index=%d const_name_index=%d", type_name_index, const_name_index); } break; case 'c': @@ -2060,8 +2017,7 @@ if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for a class_info_index - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a class_info_index")); + log_debug(redefine, class, annotation)("length() is too small for a class_info_index"); return false; } @@ -2069,8 +2025,7 @@ annotations_typeArray, byte_i_ref, "class_info_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("class_info_index=%d", class_info_index)); + log_debug(redefine, class, annotation)("class_info_index=%d", class_info_index); } break; case '@': @@ -2087,8 +2042,7 @@ { if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for a num_values field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a num_values field")); + log_debug(redefine, class, annotation)("length() is too small for a num_values field"); return false; } @@ -2097,14 +2051,13 @@ u2 num_values = Bytes::get_Java_u2((address) annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("num_values=%d", num_values)); + log_debug(redefine, class, annotation)("num_values=%d", num_values); int calc_num_values = 0; for (; calc_num_values < num_values; calc_num_values++) { if (!rewrite_cp_refs_in_element_value( annotations_typeArray, byte_i_ref, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad nested element_value at %d", calc_num_values)); + log_debug(redefine, class, annotation)("bad nested element_value at %d", calc_num_values); // propagate failure back to caller return false; } @@ -2113,7 +2066,7 @@ } break; default: - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("bad tag=0x%x", tag)); + log_debug(redefine, class, annotation)("bad tag=0x%x", tag); return false; } // end decode tag field @@ -2132,8 +2085,7 @@ return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("fields_annotations length=%d", fields_annotations->length())); + log_debug(redefine, class, annotation)("fields_annotations length=%d", fields_annotations->length()); for (int i = 0; i < fields_annotations->length(); i++) { AnnotationArray* field_annotations = fields_annotations->at(i); @@ -2145,8 +2097,7 @@ int byte_i = 0; // byte index into field_annotations if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad field_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad field_annotations at %d", i); // propagate failure back to caller return false; } @@ -2172,8 +2123,7 @@ int byte_i = 0; // byte index into method_annotations if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad method_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad method_annotations at %d", i); // propagate failure back to caller return false; } @@ -2210,8 +2160,7 @@ if (method_parameter_annotations->length() < 1) { // not enough room for a num_parameters field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a num_parameters field at %d", i)); + log_debug(redefine, class, annotation)("length() is too small for a num_parameters field at %d", i); return false; } @@ -2220,15 +2169,13 @@ u1 num_parameters = method_parameter_annotations->at(byte_i); byte_i++; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("num_parameters=%d", num_parameters)); + log_debug(redefine, class, annotation)("num_parameters=%d", num_parameters); int calc_num_parameters = 0; for (; calc_num_parameters < num_parameters; calc_num_parameters++) { if (!rewrite_cp_refs_in_annotations_typeArray( method_parameter_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad method_parameter_annotations at %d", calc_num_parameters)); + log_debug(redefine, class, annotation)("bad method_parameter_annotations at %d", calc_num_parameters); // propagate failure back to caller return false; } @@ -2264,8 +2211,7 @@ if (!rewrite_cp_refs_in_element_value( method_default_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad default element_value at %d", i)); + log_debug(redefine, class, annotation)("bad default element_value at %d", i); // propagate failure back to caller return false; } @@ -2285,8 +2231,7 @@ return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("class_type_annotations length=%d", class_type_annotations->length())); + log_debug(redefine, class, annotation)("class_type_annotations length=%d", class_type_annotations->length()); int byte_i = 0; // byte index into class_type_annotations return rewrite_cp_refs_in_type_annotations_typeArray(class_type_annotations, @@ -2304,8 +2249,7 @@ return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("fields_type_annotations length=%d", fields_type_annotations->length())); + log_debug(redefine, class, annotation)("fields_type_annotations length=%d", fields_type_annotations->length()); for (int i = 0; i < fields_type_annotations->length(); i++) { AnnotationArray* field_type_annotations = fields_type_annotations->at(i); @@ -2317,8 +2261,7 @@ int byte_i = 0; // byte index into field_type_annotations if (!rewrite_cp_refs_in_type_annotations_typeArray(field_type_annotations, byte_i, "field_info", THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad field_type_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad field_type_annotations at %d", i); // propagate failure back to caller return false; } @@ -2341,14 +2284,12 @@ continue; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("methods type_annotations length=%d", method_type_annotations->length())); + log_debug(redefine, class, annotation)("methods type_annotations length=%d", method_type_annotations->length()); int byte_i = 0; // byte index into method_type_annotations if (!rewrite_cp_refs_in_type_annotations_typeArray(method_type_annotations, byte_i, "method_info", THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad method_type_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad method_type_annotations at %d", i); // propagate failure back to caller return false; } @@ -2374,8 +2315,7 @@ if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { // not enough room for num_annotations field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for num_annotations field")); + log_debug(redefine, class, annotation)("length() is too small for num_annotations field"); return false; } @@ -2383,15 +2323,13 @@ type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("num_type_annotations=%d", num_annotations)); + log_debug(redefine, class, annotation)("num_type_annotations=%d", num_annotations); int calc_num_annotations = 0; for (; calc_num_annotations < num_annotations; calc_num_annotations++) { if (!rewrite_cp_refs_in_type_annotation_struct(type_annotations_typeArray, byte_i_ref, location_mesg, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad type_annotation_struct at %d", calc_num_annotations)); + log_debug(redefine, class, annotation)("bad type_annotation_struct at %d", calc_num_annotations); // propagate failure back to caller return false; } @@ -2399,10 +2337,9 @@ assert(num_annotations == calc_num_annotations, "sanity check"); if (byte_i_ref != type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("read wrong amount of bytes at end of processing " - "type_annotations_typeArray (%d of %d bytes were read)", - byte_i_ref, type_annotations_typeArray->length())); + log_debug(redefine, class, annotation) + ("read wrong amount of bytes at end of processing type_annotations_typeArray (%d of %d bytes were read)", + byte_i_ref, type_annotations_typeArray->length()); return false; } @@ -2479,15 +2416,14 @@ if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { // not enough room for a target_type let alone the rest of a type_annotation - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a target_type")); + log_debug(redefine, class, annotation)("length() is too small for a target_type"); return false; } u1 target_type = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("target_type=0x%.2x", target_type)); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("location=%s", location_mesg)); + log_debug(redefine, class, annotation)("target_type=0x%.2x", target_type); + log_debug(redefine, class, annotation)("location=%s", location_mesg); // Skip over target_info switch (target_type) { @@ -2505,17 +2441,14 @@ // } // if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_parameter_target")); + log_debug(redefine, class, annotation)("length() is too small for a type_parameter_target"); return false; } u1 type_parameter_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_parameter_target: type_parameter_index=%d", - type_parameter_index)); + log_debug(redefine, class, annotation)("type_parameter_target: type_parameter_index=%d", type_parameter_index); } break; case 0x10: @@ -2531,8 +2464,7 @@ // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a supertype_target")); + log_debug(redefine, class, annotation)("length() is too small for a supertype_target"); return false; } @@ -2540,8 +2472,7 @@ type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("supertype_target: supertype_index=%d", supertype_index)); + log_debug(redefine, class, annotation)("supertype_target: supertype_index=%d", supertype_index); } break; case 0x11: @@ -2559,8 +2490,7 @@ // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_parameter_bound_target")); + log_debug(redefine, class, annotation)("length() is too small for a type_parameter_bound_target"); return false; } @@ -2569,9 +2499,8 @@ u1 bound_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_parameter_bound_target: type_parameter_index=%d, bound_index=%d", - type_parameter_index, bound_index)); + log_debug(redefine, class, annotation) + ("type_parameter_bound_target: type_parameter_index=%d, bound_index=%d", type_parameter_index, bound_index); } break; case 0x13: @@ -2589,8 +2518,7 @@ // empty_target { // } // - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("empty_target")); + log_debug(redefine, class, annotation)("empty_target"); } break; case 0x16: @@ -2604,17 +2532,15 @@ // } // if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a formal_parameter_target")); + log_debug(redefine, class, annotation)("length() is too small for a formal_parameter_target"); return false; } u1 formal_parameter_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("formal_parameter_target: formal_parameter_index=%d", - formal_parameter_index)); + log_debug(redefine, class, annotation) + ("formal_parameter_target: formal_parameter_index=%d", formal_parameter_index); } break; case 0x17: @@ -2628,8 +2554,7 @@ // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a throws_target")); + log_debug(redefine, class, annotation)("length() is too small for a throws_target"); return false; } @@ -2637,8 +2562,7 @@ type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("throws_target: throws_type_index=%d", throws_type_index)); + log_debug(redefine, class, annotation)("throws_target: throws_type_index=%d", throws_type_index); } break; case 0x40: @@ -2661,8 +2585,7 @@ // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { // not enough room for a table_length let alone the rest of a localvar_target - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a localvar_target table_length")); + log_debug(redefine, class, annotation)("length() is too small for a localvar_target table_length"); return false; } @@ -2670,16 +2593,14 @@ type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("localvar_target: table_length=%d", table_length)); + log_debug(redefine, class, annotation)("localvar_target: table_length=%d", table_length); int table_struct_size = 2 + 2 + 2; // 3 u2 variables per table entry int table_size = table_length * table_struct_size; if ((byte_i_ref + table_size) > type_annotations_typeArray->length()) { // not enough room for a table - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a table array of length %d", table_length)); + log_debug(redefine, class, annotation)("length() is too small for a table array of length %d", table_length); return false; } @@ -2698,8 +2619,7 @@ // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a catch_target")); + log_debug(redefine, class, annotation)("length() is too small for a catch_target"); return false; } @@ -2707,8 +2627,7 @@ type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("catch_target: exception_table_index=%d", exception_table_index)); + log_debug(redefine, class, annotation)("catch_target: exception_table_index=%d", exception_table_index); } break; case 0x43: @@ -2731,8 +2650,7 @@ // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a offset_target")); + log_debug(redefine, class, annotation)("length() is too small for a offset_target"); return false; } @@ -2740,8 +2658,7 @@ type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("offset_target: offset=%d", offset)); + log_debug(redefine, class, annotation)("offset_target: offset=%d", offset); } break; case 0x47: @@ -2769,8 +2686,7 @@ // } // if ((byte_i_ref + 3) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_argument_target")); + log_debug(redefine, class, annotation)("length() is too small for a type_argument_target"); return false; } @@ -2780,14 +2696,12 @@ u1 type_argument_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_argument_target: offset=%d, type_argument_index=%d", - offset, type_argument_index)); + log_debug(redefine, class, annotation) + ("type_argument_target: offset=%d, type_argument_index=%d", offset, type_argument_index); } break; default: - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("unknown target_type")); + log_debug(redefine, class, annotation)("unknown target_type"); #ifdef ASSERT ShouldNotReachHere(); #endif @@ -2814,24 +2728,21 @@ if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { // not enough room for a path_length let alone the rest of the type_path - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_path")); + log_debug(redefine, class, annotation)("length() is too small for a type_path"); return false; } u1 path_length = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_path: path_length=%d", path_length)); + log_debug(redefine, class, annotation)("type_path: path_length=%d", path_length); int calc_path_length = 0; for (; calc_path_length < path_length; calc_path_length++) { if ((byte_i_ref + 1 + 1) > type_annotations_typeArray->length()) { // not enough room for a path - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for path entry %d of %d", - calc_path_length, path_length)); + log_debug(redefine, class, annotation) + ("length() is too small for path entry %d of %d", calc_path_length, path_length); return false; } @@ -2840,14 +2751,13 @@ u1 type_argument_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, + log_debug(redefine, class, annotation) ("type_path: path[%d]: type_path_kind=%d, type_argument_index=%d", - calc_path_length, type_path_kind, type_argument_index)); + calc_path_length, type_path_kind, type_argument_index); if (type_path_kind > 3 || (type_path_kind != 3 && type_argument_index != 0)) { // not enough room for a path - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("inconsistent type_path values")); + log_debug(redefine, class, annotation)("inconsistent type_path values"); return false; } } @@ -2883,8 +2793,7 @@ u2 number_of_entries = Bytes::get_Java_u2(stackmap_p); stackmap_p += 2; - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("number_of_entries=%u", number_of_entries)); + log_debug(redefine, class, stackmap)("number_of_entries=%u", number_of_entries); // walk through each stack_map_frame u2 calc_number_of_entries = 0; @@ -3084,16 +2993,14 @@ u2 cpool_index = Bytes::get_Java_u2(stackmap_p_ref); u2 new_cp_index = find_new_index(cpool_index); if (new_cp_index != 0) { - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("mapped old cpool_index=%d", cpool_index)); + log_debug(redefine, class, stackmap)("mapped old cpool_index=%d", cpool_index); Bytes::put_Java_u2(stackmap_p_ref, new_cp_index); cpool_index = new_cp_index; } stackmap_p_ref += 2; - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("frame_i=%u, frame_type=%u, cpool_index=%d", frame_i, - frame_type, cpool_index)); + log_debug(redefine, class, stackmap) + ("frame_i=%u, frame_type=%u, cpool_index=%d", frame_i, frame_type, cpool_index); } break; // Uninitialized_variable_info { @@ -3106,8 +3013,7 @@ break; default: - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("frame_i=%u, frame_type=%u, bad tag=0x%x", frame_i, frame_type, tag)); + log_debug(redefine, class, stackmap)("frame_i=%u, frame_type=%u, bad tag=0x%x", frame_i, frame_type, tag); ShouldNotReachHere(); break; } // end switch (tag) @@ -3157,29 +3063,25 @@ jshort cur_index = fs.name_index(); jshort new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-name_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-name_index change: %d to %d", cur_index, new_index); fs.set_name_index(new_index); } cur_index = fs.signature_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-signature_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-signature_index change: %d to %d", cur_index, new_index); fs.set_signature_index(new_index); } cur_index = fs.initval_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-initval_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-initval_index change: %d to %d", cur_index, new_index); fs.set_initval_index(new_index); } cur_index = fs.generic_signature_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-generic_signature change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-generic_signature change: %d to %d", cur_index, new_index); fs.set_generic_signature_index(new_index); } } // end for each field @@ -3196,22 +3098,19 @@ } int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("inner_class_info change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("inner_class_info change: %d to %d", cur_index, new_index); iter.set_inner_class_info_index(new_index); } cur_index = iter.outer_class_info_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("outer_class_info change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("outer_class_info change: %d to %d", cur_index, new_index); iter.set_outer_class_info_index(new_index); } cur_index = iter.inner_name_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("inner_name change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("inner_name change: %d to %d", cur_index, new_index); iter.set_inner_name_index(new_index); } } // end for each inner class @@ -3225,23 +3124,20 @@ int new_index = find_new_index(method->name_index()); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("method-name_index change: %d to %d", method->name_index(), - new_index)); + log_trace(redefine, class, constantpool) + ("method-name_index change: %d to %d", method->name_index(), new_index); method->set_name_index(new_index); } new_index = find_new_index(method->signature_index()); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("method-signature_index change: %d to %d", - method->signature_index(), new_index)); + log_trace(redefine, class, constantpool) + ("method-signature_index change: %d to %d", method->signature_index(), new_index); method->set_signature_index(new_index); } new_index = find_new_index(method->generic_signature_index()); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("method-generic_signature_index change: %d to %d", - method->generic_signature_index(), new_index)); + log_trace(redefine, class, constantpool) + ("method-generic_signature_index change: %d to %d", method->generic_signature_index(), new_index); method->set_generic_signature_index(new_index); } @@ -3255,8 +3151,7 @@ int cur_index = cext_table[j].class_cp_index; int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("cext-class_cp_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("cext-class_cp_index change: %d to %d", cur_index, new_index); cext_table[j].class_cp_index = (u2)new_index; } } // end for each checked exception table entry @@ -3274,8 +3169,7 @@ int cur_index = ex_table.catch_type_index(j); int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("ext-klass_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("ext-klass_index change: %d to %d", cur_index, new_index); ex_table.set_catch_type_index(j, new_index); } } // end for each exception table entry @@ -3292,23 +3186,19 @@ int cur_index = lv_table[j].name_cp_index; int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("lvt-name_cp_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("lvt-name_cp_index change: %d to %d", cur_index, new_index); lv_table[j].name_cp_index = (u2)new_index; } cur_index = lv_table[j].descriptor_cp_index; new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("lvt-descriptor_cp_index change: %d to %d", cur_index, - new_index)); + log_trace(redefine, class, constantpool)("lvt-descriptor_cp_index change: %d to %d", cur_index, new_index); lv_table[j].descriptor_cp_index = (u2)new_index; } cur_index = lv_table[j].signature_cp_index; new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("lvt-signature_cp_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("lvt-signature_cp_index change: %d to %d", cur_index, new_index); lv_table[j].signature_cp_index = (u2)new_index; } } // end for each local variable table entry @@ -3332,13 +3222,6 @@ bool trace_name_printed = false; InstanceKlass *the_class = InstanceKlass::cast(_the_class_oop); - // Very noisy: only enable this call if you are trying to determine - // that a specific class gets found by this routine. - // RC_TRACE macro has an embedded ResourceMark - // RC_TRACE_WITH_THREAD(0x00100000, THREAD, - // ("adjust check: name=%s", k->external_name())); - // trace_name_printed = true; - // If the class being redefined is java.lang.Object, we need to fix all // array class vtables also if (k->is_array_klass() && _the_class_oop == SystemDictionary::Object_klass()) { @@ -3576,9 +3459,11 @@ // With tracing we try not to "yack" too much. The position of // this trace assumes there are fewer obsolete methods than // EMCP methods. - RC_TRACE(0x00000100, ("mark %s(%s) as obsolete", - old_method->name()->as_C_string(), - old_method->signature()->as_C_string())); + if (log_is_enabled(Trace, redefine, class, obsolete, mark)) { + ResourceMark rm; + log_trace(redefine, class, obsolete, mark) + ("mark %s(%s) as obsolete", old_method->name()->as_C_string(), old_method->signature()->as_C_string()); + } } old_method->set_is_old(); } @@ -3596,14 +3481,15 @@ // With tracing we try not to "yack" too much. The position of // this trace assumes there are fewer obsolete methods than // EMCP methods. - RC_TRACE(0x00000100, ("mark deleted %s(%s) as obsolete", - old_method->name()->as_C_string(), - old_method->signature()->as_C_string())); + if (log_is_enabled(Trace, redefine, class, obsolete, mark)) { + ResourceMark rm; + log_trace(redefine, class, obsolete, mark) + ("mark deleted %s(%s) as obsolete", old_method->name()->as_C_string(), old_method->signature()->as_C_string()); + } } assert((emcp_method_count + obsolete_count) == _old_methods->length(), "sanity check"); - RC_TRACE(0x00000100, ("EMCP_cnt=%d, obsolete_cnt=%d", emcp_method_count, - obsolete_count)); + log_trace(redefine, class, obsolete, mark)("EMCP_cnt=%d, obsolete_cnt=%d", emcp_method_count, obsolete_count); return emcp_method_count; } @@ -3866,7 +3752,10 @@ Klass* scratch_class_oop, TRAPS) { HandleMark hm(THREAD); // make sure handles from this call are freed - RC_TIMER_START(_timer_rsc_phase1); + + if (log_is_enabled(Info, redefine, class, timer)) { + _timer_rsc_phase1.start(); + } instanceKlassHandle scratch_class(scratch_class_oop); @@ -4083,8 +3972,10 @@ // keep track of previous versions of this class the_class->add_previous_version(scratch_class, emcp_method_count); - RC_TIMER_STOP(_timer_rsc_phase1); - RC_TIMER_START(_timer_rsc_phase2); + _timer_rsc_phase1.stop(); + if (log_is_enabled(Info, redefine, class, timer)) { + _timer_rsc_phase2.start(); + } // Adjust constantpool caches and vtables for all classes // that reference methods of the evolved class. @@ -4104,25 +3995,20 @@ the_class->oop_map_cache()->flush_obsolete_entries(); } - // increment the classRedefinedCount field in the_class and in any - // direct and indirect subclasses of the_class - increment_class_counter((InstanceKlass *)the_class(), THREAD); - - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000001, THREAD, - ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), - java_lang_Class::classRedefinedCount(the_class_mirror), - os::available_memory() >> 10)); - { ResourceMark rm(THREAD); + // increment the classRedefinedCount field in the_class and in any + // direct and indirect subclasses of the_class + increment_class_counter((InstanceKlass *)the_class(), THREAD); + log_info(redefine, class, load) + ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", + the_class->external_name(), java_lang_Class::classRedefinedCount(the_class_mirror), os::available_memory() >> 10); Events::log_redefinition(THREAD, "redefined class name=%s, count=%d", the_class->external_name(), java_lang_Class::classRedefinedCount(the_class_mirror)); } - RC_TIMER_STOP(_timer_rsc_phase2); + _timer_rsc_phase2.stop(); } // end redefine_single_class() @@ -4136,8 +4022,7 @@ if (class_oop != _the_class_oop) { // _the_class_oop count is printed at end of redefine_single_class() - RC_TRACE_WITH_THREAD(0x00000008, THREAD, - ("updated count in subclass=%s to %d", ik->external_name(), new_count)); + log_debug(redefine, class, subclass)("updated count in subclass=%s to %d", ik->external_name(), new_count); } for (Klass *subk = ik->subklass(); subk != NULL; @@ -4159,11 +4044,10 @@ ResourceMark rm(_thread); if (k->vtable_length() > 0 && !k->vtable()->check_no_old_or_obsolete_entries()) { - if (RC_TRACE_ENABLED(0x00004000)) { - RC_TRACE_WITH_THREAD(0x00004000, _thread, - ("klassVtable::check_no_old_or_obsolete_entries failure" - " -- OLD or OBSOLETE method found -- class: %s", - k->signature_name())); + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { + log_trace(redefine, class, obsolete, metadata) + ("klassVtable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: %s", + k->signature_name()); k->vtable()->dump_vtable(); } no_old_methods = false; @@ -4176,11 +4060,10 @@ // an itable should never contain old or obsolete methods if (ik->itable_length() > 0 && !ik->itable()->check_no_old_or_obsolete_entries()) { - if (RC_TRACE_ENABLED(0x00004000)) { - RC_TRACE_WITH_THREAD(0x00004000, _thread, - ("klassItable::check_no_old_or_obsolete_entries failure" - " -- OLD or OBSOLETE method found -- class: %s", - ik->signature_name())); + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { + log_trace(redefine, class, obsolete, metadata) + ("klassItable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: %s", + ik->signature_name()); ik->itable()->dump_itable(); } no_old_methods = false; @@ -4190,11 +4073,10 @@ if (ik->constants() != NULL && ik->constants()->cache() != NULL && !ik->constants()->cache()->check_no_old_or_obsolete_entries()) { - if (RC_TRACE_ENABLED(0x00004000)) { - RC_TRACE_WITH_THREAD(0x00004000, _thread, - ("cp-cache::check_no_old_or_obsolete_entries failure" - " -- OLD or OBSOLETE method found -- class: %s", - ik->signature_name())); + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { + log_trace(redefine, class, obsolete, metadata) + ("cp-cache::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: %s", + ik->signature_name()); ik->constants()->cache()->dump_cache(); } no_old_methods = false; @@ -4203,10 +4085,10 @@ // print and fail guarantee if old methods are found. if (!no_old_methods) { - if (RC_TRACE_ENABLED(0x00004000)) { + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { dump_methods(); } else { - tty->print_cr("INFO: use the '-XX:TraceRedefineClasses=16384' option " + log_trace(redefine, class)("Use the '-Xlog:redefine+class*:' option " "to see more info about the following guarantee() failure."); } guarantee(false, "OLD and/or OBSOLETE method(s) found"); @@ -4216,54 +4098,60 @@ void VM_RedefineClasses::dump_methods() { int j; - RC_TRACE(0x00004000, ("_old_methods --")); + log_trace(redefine, class, dump)("_old_methods --"); for (j = 0; j < _old_methods->length(); ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _old_methods->at(j); - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_new_methods --")); + log_trace(redefine, class, dump)("_new_methods --"); for (j = 0; j < _new_methods->length(); ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _new_methods->at(j); - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_matching_(old/new)_methods --")); + log_trace(redefine, class, dump)("_matching_methods --"); for (j = 0; j < _matching_methods_length; ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _matching_old_methods[j]; - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(); + log_stream.cr(); + m = _matching_new_methods[j]; - RC_TRACE_NO_CR(0x00004000, (" (%5d) ", m->vtable_index())); - m->access_flags().print_on(tty); - tty->cr(); + log_stream.print(" (%5d) ", m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_deleted_methods --")); + log_trace(redefine, class, dump)("_deleted_methods --"); for (j = 0; j < _deleted_methods_length; ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _deleted_methods[j]; - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_added_methods --")); + log_trace(redefine, class, dump)("_added_methods --"); for (j = 0; j < _added_methods_length; ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _added_methods[j]; - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp Mon May 09 22:22:15 2016 +0200 @@ -30,7 +30,6 @@ #include "memory/resourceArea.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/vm_operations.hpp" // Introduction: diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp --- a/hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp Mon May 09 17:36:13 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP -#define SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP - -// RedefineClasses tracing support via the TraceRedefineClasses -// option. A bit is assigned to each group of trace messages. -// Groups of messages are individually selectable. We have to use -// decimal values on the command line since the command option -// parsing logic doesn't like non-decimal numerics. The HEX values -// are used in the actual RC_TRACE() calls for sanity. To achieve -// the old cumulative behavior, pick the level after the one in -// which you are interested and subtract one, e.g., 33554431 will -// print every tracing message. -// -// 0x00000000 | 0 - default; no tracing messages -// 0x00000001 | 1 - name each target class before loading, after -// loading and after redefinition is completed -// 0x00000002 | 2 - print info if parsing, linking or -// verification throws an exception -// 0x00000004 | 4 - print timer info for the VM operation -// 0x00000008 | 8 - print subclass counter updates -// 0x00000010 | 16 - unused -// 0x00000020 | 32 - unused -// 0x00000040 | 64 - unused -// 0x00000080 | 128 - unused -// 0x00000100 | 256 - previous class weak reference addition -// 0x00000200 | 512 - previous class weak reference mgmt during -// class unloading checks (GC) -// 0x00000400 | 1024 - previous class weak reference mgmt during -// add previous ops (GC) -// 0x00000800 | 2048 - previous class breakpoint mgmt -// 0x00001000 | 4096 - detect calls to obsolete methods -// 0x00002000 | 8192 - fail a guarantee() in addition to detection -// 0x00004000 | 16384 - detect old/obsolete methods in metadata -// 0x00008000 | 32768 - old/new method matching/add/delete -// 0x00010000 | 65536 - impl details: CP size info -// 0x00020000 | 131072 - impl details: CP merge pass info -// 0x00040000 | 262144 - impl details: CP index maps -// 0x00080000 | 524288 - impl details: modified CP index values -// 0x00100000 | 1048576 - impl details: vtable updates -// 0x00200000 | 2097152 - impl details: itable updates -// 0x00400000 | 4194304 - impl details: constant pool cache updates -// 0x00800000 | 8388608 - impl details: methodComparator info -// 0x01000000 | 16777216 - impl details: nmethod evolution info -// 0x02000000 | 33554432 - impl details: annotation updates -// 0x04000000 | 67108864 - impl details: StackMapTable updates -// 0x08000000 | 134217728 - impl details: OopMapCache updates -// 0x10000000 | 268435456 - unused -// 0x20000000 | 536870912 - unused -// 0x40000000 | 1073741824 - unused -// 0x80000000 | 2147483648 - unused - -// Macro for checking if TraceRedefineClasses has a specific bit -// enabled. Returns true if the bit specified by level is set. -#define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0) - -// Macro for checking if TraceRedefineClasses has one or more bits -// set in a range of bit values. Returns true if one or more bits -// is set in the range from low..high inclusive. Assumes that low -// and high are single bit values. -// -// ((high << 1) - 1) -// Yields a mask that removes bits greater than the high bit value. -// This algorithm doesn't work with highest bit. -// ~(low - 1) -// Yields a mask that removes bits lower than the low bit value. -#define RC_TRACE_IN_RANGE(low, high) \ -(((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0) - -// Note: The ResourceMark is to cleanup resource allocated args. -// The "do {...} while (0)" is so we can use semi-colon at end of RC_TRACE(). -#define RC_TRACE(level, args) do { \ - if (RC_TRACE_ENABLED(level)) { \ - ResourceMark rm; \ - tty->print("RedefineClasses-0x%x: ", level); \ - tty->print_cr args; \ - } \ -} while (0) - -#define RC_TRACE_NO_CR(level, args) do { \ - if (RC_TRACE_ENABLED(level)) { \ - ResourceMark rm; \ - tty->print("RedefineClasses-0x%x: ", level); \ - tty->print args; \ - } \ -} while (0) - -#define RC_TRACE_WITH_THREAD(level, thread, args) do { \ - if (RC_TRACE_ENABLED(level)) { \ - ResourceMark rm(thread); \ - tty->print("RedefineClasses-0x%x: ", level); \ - tty->print_cr args; \ - } \ -} while (0) - -#define RC_TRACE_MESG(args) do { \ - ResourceMark rm; \ - tty->print("RedefineClasses: "); \ - tty->print_cr args; \ -} while (0) - -// Timer support macros. Only do timer operations if timer tracing is enabled. -// The "do {...} while (0)" is so we can use semi-colon at end of the macro. -#define RC_TIMER_START(t) do { \ - if (RC_TRACE_ENABLED(0x00000004)) { \ - t.start(); \ - } \ -} while (0) -#define RC_TIMER_STOP(t) do { \ - if (RC_TRACE_ENABLED(0x00000004)) { \ - t.stop(); \ - } \ -} while (0) - -#endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/prims/methodComparator.cpp --- a/hotspot/src/share/vm/prims/methodComparator.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/prims/methodComparator.cpp Mon May 09 22:22:15 2016 +0200 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodComparator.hpp" #include "runtime/handles.inline.hpp" #include "utilities/globalDefinitions.hpp" @@ -39,10 +38,12 @@ if (old_method->code_size() != new_method->code_size()) return false; if (check_stack_and_locals_size(old_method, new_method) != 0) { - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00800000, ("Methods %s non-comparable with diagnosis %d", - old_method->name()->as_C_string(), - check_stack_and_locals_size(old_method, new_method))); + if (log_is_enabled(Debug, redefine, class, methodcomparator)) { + ResourceMark rm; + log_debug(redefine, class, methodcomparator) + ("Methods %s non-comparable with diagnosis %d", + old_method->name()->as_C_string(), check_stack_and_locals_size(old_method, new_method)); + } return false; } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/prims/methodHandles.cpp --- a/hotspot/src/share/vm/prims/methodHandles.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/prims/methodHandles.cpp Mon May 09 22:22:15 2016 +0200 @@ -38,7 +38,6 @@ #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/methodHandles.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/javaCalls.hpp" #include "runtime/timerTrace.hpp" @@ -1084,17 +1083,15 @@ java_lang_invoke_MemberName::set_vmtarget(mem_name, new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("MemberName method update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, constantpool) + ("MemberName method update: %s(%s)", + new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } } } diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Mon May 09 22:22:15 2016 +0200 @@ -420,6 +420,7 @@ { "TraceMonitorInflation", LogLevel::Debug, true, LOG_TAGS(monitorinflation) }, { "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepoint, cleanup) }, { "TraceJVMTIObjectTagging", LogLevel::Debug, true, LOG_TAGS(jvmti, objecttagging) }, + { "TraceRedefineClasses", LogLevel::Info, false, LOG_TAGS(redefine, class) }, { NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) } }; @@ -804,7 +805,9 @@ } strncat(tagset_buffer, LogTag::name(tagSet[i]), max_tagset_len - strlen(tagset_buffer)); } - + if (!alf.exactMatch) { + strncat(tagset_buffer, "*", max_tagset_len - strlen(tagset_buffer)); + } log_warning(arguments)("-XX:%s%s is deprecated. Will use -Xlog:%s=%s instead.", (on) ? "+" : "-", name, @@ -865,6 +868,11 @@ Flag* flag; // this scanf pattern matches both strings (handled here) and numbers (handled later)) + AliasedLoggingFlag alf = catch_logging_aliases(name, true); + if (alf.alias_name != NULL) { + LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5); + return true; + } real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); if (real_name == NULL) { return false; diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/runtime/globals.hpp Mon May 09 22:22:15 2016 +0200 @@ -1418,10 +1418,6 @@ product(bool, StressLdcRewrite, false, \ "Force ldc -> ldc_w rewrite during RedefineClasses") \ \ - product(uintx, TraceRedefineClasses, 0, \ - "Trace level for JVMTI RedefineClasses") \ - range(0, 0xFFFFFFFF) \ - \ /* change to false by default sometime after Mustang */ \ product(bool, VerifyMergedCPBytecodes, true, \ "Verify bytecodes after RedefineClasses constant pool merging") \ diff -r 6a4902a969d3 -r b495d1cfe673 hotspot/src/share/vm/runtime/sharedRuntime.cpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Mon May 09 17:36:13 2016 +0000 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Mon May 09 22:22:15 2016 +0200 @@ -46,7 +46,6 @@ #include "oops/oop.inline.hpp" #include "prims/forte.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodHandles.hpp" #include "prims/nativeLookup.hpp" #include "runtime/arguments.hpp" @@ -603,27 +602,18 @@ } // The interpreter code to call this tracing function is only -// called/generated when TraceRedefineClasses has the right bits -// set. Since obsolete methods are never compiled, we don't have +// called/generated when UL is on for redefine, class and has the right level +// and tags. Since obsolete methods are never compiled, we don't have // to modify the compilers to generate calls to this function. // JRT_LEAF(int, SharedRuntime::rc_trace_method_entry( JavaThread* thread, Method* method)) - assert(RC_TRACE_IN_RANGE(0x00001000, 0x00002000), "wrong call"); - if (method->is_obsolete()) { // We are calling an obsolete method, but this is not necessarily // an error. Our method could have been redefined just after we // fetched the Method* from the constant pool. - - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00001000, thread, - ("calling obsolete method '%s'", - method->name_and_sig_as_C_string())); - if (RC_TRACE_ENABLED(0x00002000)) { - // this option is provided to debug calls to obsolete methods - guarantee(false, "faulting at call to an obsolete method."); - } + ResourceMark rm; + log_trace(redefine, class, obsolete)("calling obsolete method '%s'", method->name_and_sig_as_C_string()); } return 0; JRT_END