# HG changeset patch # User Thomas Wuerthinger # Date 1293138871 -3600 # Node ID 4853c5cad3aab58f569902616231d6192361c174 # Parent 8d88c9ac92470dbca84ac050d8276020eea81166 More deoptmization tracing. diff -r 8d88c9ac9247 -r 4853c5cad3aa c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java Thu Dec 23 18:13:28 2010 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java Thu Dec 23 22:14:31 2010 +0100 @@ -53,6 +53,7 @@ C1XOptions.DetailedAsserts = false; C1XOptions.CommentedAssembly = true; C1XOptions.MethodEndBreakpointGuards = 10; + C1XOptions.ZapStackOnMethodEntry = true; } @Override diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/c1x/c1x_CodeInstaller.cpp --- a/src/share/vm/c1x/c1x_CodeInstaller.cpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp Thu Dec 23 22:14:31 2010 +0100 @@ -350,6 +350,10 @@ reexecute = Interpreter::bytecode_should_reexecute(code); } + if (TraceC1X >= 2) { + tty->print_cr("Recording scope pc_offset=%d bci=%d frame=%d", pc_offset, bci, frame); + } + if (frame != NULL) { jint local_count = CiDebugInfo_Frame::numLocals(frame); jint expression_count = CiDebugInfo_Frame::numStack(frame); diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/code/nmethod.cpp Thu Dec 23 22:14:31 2010 +0100 @@ -1099,6 +1099,12 @@ ScopeDesc* nmethod::scope_desc_at(address pc) { PcDesc* pd = pc_desc_at(pc); +#ifdef ASSERT + if (pd == NULL) { + tty->print_cr(err_msg("Missing scope at relative pc %d of method %s", pc - code_begin(), this->method()->name()->as_C_string())); + print_pcs(); + } +#endif guarantee(pd != NULL, "scope must be present"); return new ScopeDesc(this, pd->scope_decode_offset(), pd->obj_decode_offset(), pd->should_reexecute(), diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/code/nmethod.hpp --- a/src/share/vm/code/nmethod.hpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/code/nmethod.hpp Thu Dec 23 22:14:31 2010 +0100 @@ -579,7 +579,10 @@ // Deopt // Return true is the PC is one would expect if the frame is being deopted. bool is_deopt_pc (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); } - bool is_deopt_entry (address pc) { return pc == deopt_handler_begin(); } + + // (tw) When using C1X, the address might be off by 5 (because this is the size of the call instruction. + // (tw) TODO: Replace this by a more general mechanism. + bool is_deopt_entry (address pc) { return pc == deopt_handler_begin() || (UseC1X && pc == deopt_handler_begin() + 5); } bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } // Accessor/mutator for the original pc of a frame before a frame was deopted. address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/code/pcDesc.cpp --- a/src/share/vm/code/pcDesc.cpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/code/pcDesc.cpp Thu Dec 23 22:14:31 2010 +0100 @@ -40,7 +40,7 @@ void PcDesc::print(nmethod* code) { #ifndef PRODUCT ResourceMark rm; - tty->print_cr("PcDesc(pc=0x%lx offset=%x):", real_pc(code), pc_offset()); + tty->print_cr("PcDesc(pc=0x%lx offset=%d):", real_pc(code), pc_offset()); if (scope_decode_offset() == DebugInformationRecorder::serialized_null) { return; diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/runtime/deoptimization.cpp Thu Dec 23 22:14:31 2010 +0100 @@ -114,6 +114,10 @@ // the vframeArray is created. // + if (TraceDeoptimization) { + tty->print_cr("fetching unroll info"); + } + // Allocate our special deoptimization ResourceMark DeoptResourceMark* dmark = new DeoptResourceMark(thread); assert(thread->deopt_mark() == NULL, "Pending deopt!"); diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/runtime/stackValue.cpp --- a/src/share/vm/runtime/stackValue.cpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/runtime/stackValue.cpp Thu Dec 23 22:14:31 2010 +0100 @@ -114,6 +114,14 @@ val = (oop)NULL; } #endif +#ifndef PRODUCT + if (!val->is_oop()) { + tty->print_cr("found wrong oop %x at location:", val); + sv->print(); + tty->print_cr(""); + tty->print_cr("one less %d; one more %d", (*(((oop *)value_addr) - 1))->is_oop(), (*(((oop *)value_addr) + 1))->is_oop()); + } +#endif Handle h(val); // Wrap a handle around the oop return new StackValue(h); } diff -r 8d88c9ac9247 -r 4853c5cad3aa src/share/vm/runtime/vframe_hp.cpp --- a/src/share/vm/runtime/vframe_hp.cpp Thu Dec 23 18:13:28 2010 +0100 +++ b/src/share/vm/runtime/vframe_hp.cpp Thu Dec 23 22:14:31 2010 +0100 @@ -52,6 +52,12 @@ } } + if (TraceDeoptimization) { + tty->print_cr("bci=%d length=%d", this->bci(), length); + tty->print_cr(err_msg("method name = %s", this->method()->name()->as_C_string())); + tty->print_cr("relative pc=%d", this->fr().pc() - this->nm()->code_begin()); + } + for( int i = 0; i < length; i++ ) { result->add( create_stack_value(scv_list->at(i)) ); }