# HG changeset patch # User Roland Schatz # Date 1386066340 -3600 # Node ID 51e97f88c7711aadc9bf62fa458a4e9eb7fa1302 # Parent dca16b3416abe508a8219b483cc303a60683e66e Profile deoptimizations of OSR methods separately. diff -r dca16b3416ab -r 51e97f88c771 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue Dec 03 11:10:16 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue Dec 03 11:25:40 2013 +0100 @@ -1145,6 +1145,7 @@ @HotSpotVMConstant(name = "Deoptimization::Reason_constraint") @Stable public int deoptReasonConstraint; @HotSpotVMConstant(name = "Deoptimization::Reason_loop_limit_check") @Stable public int deoptReasonLoopLimitCheck; @HotSpotVMConstant(name = "Deoptimization::Reason_aliasing") @Stable public int deoptReasonAliasing; + @HotSpotVMConstant(name = "Deoptimization::Reason_LIMIT") @Stable public int deoptReasonOSROffset; @HotSpotVMConstant(name = "Deoptimization::Action_none") @Stable public int deoptActionNone; @HotSpotVMConstant(name = "Deoptimization::Action_maybe_recompile") @Stable public int deoptActionMaybeRecompile; diff -r dca16b3416ab -r 51e97f88c771 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Dec 03 11:10:16 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Dec 03 11:25:40 2013 +0100 @@ -95,6 +95,11 @@ return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; } + public int getOSRDeoptimizationCount(DeoptimizationReason reason) { + int reasonIndex = runtime().getHostProviders().getMetaAccess().convertDeoptReason(reason); + return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; + } + public HotSpotMethodDataAccessor getNormalData(int position) { if (position >= normalDataSize) { return null; diff -r dca16b3416ab -r 51e97f88c771 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Tue Dec 03 11:10:16 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Tue Dec 03 11:25:40 2013 +0100 @@ -95,7 +95,7 @@ @Override public int getDeoptimizationCount(DeoptimizationReason reason) { - return methodData.getDeoptimizationCount(reason); + return methodData.getDeoptimizationCount(reason) + methodData.getOSRDeoptimizationCount(reason); } private void findBCI(int targetBCI, boolean searchExtraData) { diff -r dca16b3416ab -r 51e97f88c771 src/share/vm/oops/methodData.hpp --- a/src/share/vm/oops/methodData.hpp Tue Dec 03 11:10:16 2013 +0100 +++ b/src/share/vm/oops/methodData.hpp Tue Dec 03 11:25:40 2013 +0100 @@ -1900,7 +1900,11 @@ // Whole-method sticky bits and flags enum { +#ifdef GRAAL + _trap_hist_limit = 18, // decoupled from Deoptimization::Reason_LIMIT +#else _trap_hist_limit = 17, // decoupled from Deoptimization::Reason_LIMIT +#endif _trap_hist_mask = max_jubyte, _extra_data_count = 4 // extra DataLayout headers, for trap history }; // Public flag values @@ -1910,7 +1914,11 @@ uint _nof_overflow_traps; // trap count, excluding _trap_hist union { intptr_t _align; +#ifdef GRAAL + u1 _array[2*_trap_hist_limit]; +#else u1 _array[_trap_hist_limit]; +#endif } _trap_hist; // Support for interprocedural escape analysis, from Thomas Kotzmann. diff -r dca16b3416ab -r 51e97f88c771 src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp Tue Dec 03 11:10:16 2013 +0100 +++ b/src/share/vm/runtime/deoptimization.cpp Tue Dec 03 11:25:40 2013 +0100 @@ -1618,6 +1618,9 @@ bool maybe_prior_trap = false; bool maybe_prior_recompile = false; pdata = query_update_method_data(trap_mdo, trap_bci, reason, true, +#ifdef GRAAL + nm->is_compiled_by_graal() && nm->is_osr_method(), +#endif //outputs: this_trap_count, maybe_prior_trap, @@ -1752,6 +1755,9 @@ int trap_bci, Deoptimization::DeoptReason reason, bool update_total_trap_count, +#ifdef GRAAL + bool is_osr, +#endif //outputs: uint& ret_this_trap_count, bool& ret_maybe_prior_trap, @@ -1760,8 +1766,14 @@ bool maybe_prior_recompile = false; uint this_trap_count = 0; if (update_total_trap_count) { - uint prior_trap_count = trap_mdo->trap_count(reason); - this_trap_count = trap_mdo->inc_trap_count(reason); + uint idx = reason; +#ifdef GRAAL + if (is_osr) { + idx += Reason_LIMIT; + } +#endif + uint prior_trap_count = trap_mdo->trap_count(idx); + this_trap_count = trap_mdo->inc_trap_count(idx); // If the runtime cannot find a place to store trap history, // it is estimated based on the general condition of the method. @@ -1826,6 +1838,9 @@ query_update_method_data(trap_mdo, trap_bci, (DeoptReason)reason, update_total_counts, +#ifdef GRAAL + false, +#endif ignore_this_trap_count, ignore_maybe_prior_trap, ignore_maybe_prior_recompile); diff -r dca16b3416ab -r 51e97f88c771 src/share/vm/runtime/deoptimization.hpp --- a/src/share/vm/runtime/deoptimization.hpp Tue Dec 03 11:10:16 2013 +0100 +++ b/src/share/vm/runtime/deoptimization.hpp Tue Dec 03 11:25:40 2013 +0100 @@ -378,6 +378,9 @@ int trap_bci, DeoptReason reason, bool update_total_trap_count, +#ifdef GRAAL + bool is_osr, +#endif //outputs: uint& ret_this_trap_count, bool& ret_maybe_prior_trap,