diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp index 0c3f32bcdab4cdc078a18bbe2638dc3c9d8d54ea..fbda48f2f112f30c7889d0a3acae37cf80807e04 100644 --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -3495,9 +3495,6 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, BlockBeg if (profile_calls()) { profile_call(recv, holder_known ? callee->holder() : NULL); } - if (profile_inlined_calls()) { - profile_invocation(callee, copy_state_before()); - } } // Introduce a new callee continuation point - if the callee has @@ -3571,6 +3568,10 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, BlockBeg append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args)); } + if (profile_inlined_calls()) { + profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI)); + } + BlockBegin* callee_start_block = block_at(0); if (callee_start_block != NULL) { assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header"); diff --git a/src/share/vm/c1/c1_Instruction.hpp b/src/share/vm/c1/c1_Instruction.hpp index 44022c261e7e5b321b234eab47155e20f718c592..9f9de6a14e351b4de999af94666890c32e169324 100644 --- a/src/share/vm/c1/c1_Instruction.hpp +++ b/src/share/vm/c1/c1_Instruction.hpp @@ -501,6 +501,7 @@ class Instruction: public CompilationResourceObj { virtual RoundFP* as_RoundFP() { return NULL; } virtual ExceptionObject* as_ExceptionObject() { return NULL; } virtual UnsafeOp* as_UnsafeOp() { return NULL; } + virtual ProfileInvoke* as_ProfileInvoke() { return NULL; } virtual void visit(InstructionVisitor* v) = 0; diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp index f9099e940f7b3cf8aa922e8837413ea29b7e3a72..0491d71565ecae1f1f0cf57ab79ad1d909406d5b 100644 --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -429,7 +429,7 @@ CodeEmitInfo* LIRGenerator::state_for(Instruction* x, ValueStack* state, bool ig // all locals are dead on exit from the synthetic unlocker liveness.clear(); } else { - assert(x->as_MonitorEnter(), "only other case is MonitorEnter"); + assert(x->as_MonitorEnter() || x->as_ProfileInvoke(), "only other cases are MonitorEnter and ProfileInvoke"); } } if (!liveness.is_valid()) { diff --git a/src/share/vm/runtime/simpleThresholdPolicy.cpp b/src/share/vm/runtime/simpleThresholdPolicy.cpp index d132c0e96b26a9a2654bd95185edb6352f2d8889..232da70b07771e6ba78dea4984d8590b40d839cc 100644 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp @@ -30,6 +30,27 @@ #include "runtime/simpleThresholdPolicy.inline.hpp" #include "code/scopeDesc.hpp" + +void SimpleThresholdPolicy::print_counters(const char* prefix, methodHandle mh) { + int invocation_count = mh->invocation_count(); + int backedge_count = mh->backedge_count(); + methodDataHandle mdh = mh->method_data(); + int mdo_invocations = 0, mdo_backedges = 0; + int mdo_invocations_start = 0, mdo_backedges_start = 0; + if (mdh() != NULL) { + mdo_invocations = mdh->invocation_count(); + mdo_backedges = mdh->backedge_count(); + mdo_invocations_start = mdh->invocation_count_start(); + mdo_backedges_start = mdh->backedge_count_start(); + } + tty->print(" %stotal: %d,%d %smdo: %d(%d),%d(%d)", prefix, + invocation_count, backedge_count, prefix, + mdo_invocations, mdo_invocations_start, + mdo_backedges, mdo_backedges_start); + tty->print(" %smax levels: %d,%d", prefix, + mh->highest_comp_level(), mh->highest_osr_comp_level()); +} + // Print an event. void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { @@ -38,8 +59,6 @@ void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodH ttyLocker tty_lock; tty->print("%lf: [", os::elapsedTime()); - int invocation_count = mh->invocation_count(); - int backedge_count = mh->backedge_count(); switch(type) { case CALL: tty->print("call"); @@ -82,23 +101,9 @@ void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodH print_specific(type, mh, imh, bci, level); if (type != COMPILE) { - methodDataHandle mdh = mh->method_data(); - int mdo_invocations = 0, mdo_backedges = 0; - int mdo_invocations_start = 0, mdo_backedges_start = 0; - if (mdh() != NULL) { - mdo_invocations = mdh->invocation_count(); - mdo_backedges = mdh->backedge_count(); - mdo_invocations_start = mdh->invocation_count_start(); - mdo_backedges_start = mdh->backedge_count_start(); - } - tty->print(" total: %d,%d mdo: %d(%d),%d(%d)", - invocation_count, backedge_count, - mdo_invocations, mdo_invocations_start, - mdo_backedges, mdo_backedges_start); - tty->print(" max levels: %d,%d", - mh->highest_comp_level(), mh->highest_osr_comp_level()); + print_counters("", mh); if (inlinee_event) { - tty->print(" inlinee max levels: %d,%d", imh->highest_comp_level(), imh->highest_osr_comp_level()); + print_counters("inlinee ", imh); } tty->print(" compilable: "); bool need_comma = false; diff --git a/src/share/vm/runtime/simpleThresholdPolicy.hpp b/src/share/vm/runtime/simpleThresholdPolicy.hpp index 5aad121c3ecb780a1bdd98d551909719ae6f2803..1cff0c6cd6716c734627b4fc44cc1199c19c4811 100644 --- a/src/share/vm/runtime/simpleThresholdPolicy.hpp +++ b/src/share/vm/runtime/simpleThresholdPolicy.hpp @@ -55,7 +55,7 @@ class SimpleThresholdPolicy : public CompilationPolicy { // loop_event checks if a method should be OSR compiled at a different // level. CompLevel loop_event(methodOop method, CompLevel cur_level); - + void print_counters(const char* prefix, methodHandle mh); protected: int c1_count() const { return _c1_count; } int c2_count() const { return _c2_count; } diff --git a/test/compiler/6792161/Test6792161.java b/test/compiler/6792161/Test6792161.java index 0f99d8589523194c8852ecbf6ac4d92979e54941..ac3843c1b7248bf52e05ca83ee4b383281d66c4b 100644 --- a/test/compiler/6792161/Test6792161.java +++ b/test/compiler/6792161/Test6792161.java @@ -27,7 +27,7 @@ * @bug 6792161 * @summary assert("No dead instructions after post-alloc") * - * @run main/othervm -Xcomp -XX:MaxInlineSize=120 Test6792161 + * @run main/othervm/timeout=300 -Xcomp -XX:MaxInlineSize=120 Test6792161 */ import java.lang.reflect.Constructor;