# HG changeset patch # User anoll # Date 1398681552 -7200 # Node ID e0a77b91da68b1fedd56e2f896ad69419686ff42 # Parent 3636afd5ec1a6d5d5818d8ac22a98d737487c3f1 8040085: dtrace/jsdt tests crash on solaris. found an unadvertised bad scavengable oop in the code cache Summary: Add CodeCache::add_scavenge_root_nmethod(this) to the dtrace-constructor of nmethod Reviewed-by: roland, iveresov diff -r 3636afd5ec1a -r e0a77b91da68 src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Fri May 02 16:44:54 2014 -0700 +++ b/src/share/vm/code/nmethod.cpp Mon Apr 28 12:39:12 2014 +0200 @@ -771,7 +771,11 @@ _hotness_counter = NMethodSweeper::hotness_counter_reset_val(); code_buffer->copy_values_to(this); - debug_only(verify_scavenge_root_oops()); + if (ScavengeRootsInCode && detect_scavenge_root_oops()) { + CodeCache::add_scavenge_root_nmethod(this); + Universe::heap()->register_nmethod(this); + } + DEBUG_ONLY(verify_scavenge_root_oops();) CodeCache::commit(this); } diff -r 3636afd5ec1a -r e0a77b91da68 src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp Fri May 02 16:44:54 2014 -0700 +++ b/src/share/vm/runtime/sharedRuntime.cpp Mon Apr 28 12:39:12 2014 +0200 @@ -2690,19 +2690,20 @@ JRT_END #ifdef HAVE_DTRACE_H -// Create a dtrace nmethod for this method. The wrapper converts the -// java compiled calling convention to the native convention, makes a dummy call -// (actually nops for the size of the call instruction, which become a trap if -// probe is enabled). The returns to the caller. Since this all looks like a -// leaf no thread transition is needed. - +/** + * Create a dtrace nmethod for this method. The wrapper converts the + * Java-compiled calling convention to the native convention, makes a dummy call + * (actually nops for the size of the call instruction, which become a trap if + * probe is enabled), and finally returns to the caller. Since this all looks like a + * leaf, no thread transition is needed. + */ nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) { ResourceMark rm; nmethod* nm = NULL; if (PrintCompilation) { ttyLocker ttyl; - tty->print("--- n%s "); + tty->print("--- n "); method->print_short_name(tty); if (method->is_static()) { tty->print(" (static)");