Mercurial > hg > truffle
comparison src/share/vm/runtime/deoptimization.cpp @ 5114:dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
author | Christian Haeubl <christian.haeubl@oracle.com> |
---|---|
date | Mon, 19 Mar 2012 14:43:15 -0700 |
parents | 0ebca2e35ca5 |
children | 34518fd74518 |
comparison
equal
deleted
inserted
replaced
5113:e6a45067e42c | 5114:dad1ac9dba7d |
---|---|
1500 if (ProfileTraps && update_trap_state && trap_mdo.not_null()) { | 1500 if (ProfileTraps && update_trap_state && trap_mdo.not_null()) { |
1501 assert(trap_mdo() == get_method_data(thread, trap_method, false), "sanity"); | 1501 assert(trap_mdo() == get_method_data(thread, trap_method, false), "sanity"); |
1502 uint this_trap_count = 0; | 1502 uint this_trap_count = 0; |
1503 bool maybe_prior_trap = false; | 1503 bool maybe_prior_trap = false; |
1504 bool maybe_prior_recompile = false; | 1504 bool maybe_prior_recompile = false; |
1505 pdata = query_update_method_data(trap_mdo, trap_bci, reason, | 1505 pdata = query_update_method_data(trap_mdo, trap_bci, reason, true, |
1506 //outputs: | 1506 //outputs: |
1507 this_trap_count, | 1507 this_trap_count, |
1508 maybe_prior_trap, | 1508 maybe_prior_trap, |
1509 maybe_prior_recompile); | 1509 maybe_prior_recompile); |
1510 // Because the interpreter also counts null, div0, range, and class | 1510 // Because the interpreter also counts null, div0, range, and class |
1634 | 1634 |
1635 ProfileData* | 1635 ProfileData* |
1636 Deoptimization::query_update_method_data(methodDataHandle trap_mdo, | 1636 Deoptimization::query_update_method_data(methodDataHandle trap_mdo, |
1637 int trap_bci, | 1637 int trap_bci, |
1638 Deoptimization::DeoptReason reason, | 1638 Deoptimization::DeoptReason reason, |
1639 bool update_total_trap_count, | |
1639 //outputs: | 1640 //outputs: |
1640 uint& ret_this_trap_count, | 1641 uint& ret_this_trap_count, |
1641 bool& ret_maybe_prior_trap, | 1642 bool& ret_maybe_prior_trap, |
1642 bool& ret_maybe_prior_recompile) { | 1643 bool& ret_maybe_prior_recompile) { |
1643 uint prior_trap_count = trap_mdo->trap_count(reason); | 1644 bool maybe_prior_trap = false; |
1644 uint this_trap_count = trap_mdo->inc_trap_count(reason); | 1645 bool maybe_prior_recompile = false; |
1645 | 1646 uint this_trap_count = 0; |
1646 // If the runtime cannot find a place to store trap history, | 1647 if (update_total_trap_count) { |
1647 // it is estimated based on the general condition of the method. | 1648 uint prior_trap_count = trap_mdo->trap_count(reason); |
1648 // If the method has ever been recompiled, or has ever incurred | 1649 this_trap_count = trap_mdo->inc_trap_count(reason); |
1649 // a trap with the present reason , then this BCI is assumed | 1650 |
1650 // (pessimistically) to be the culprit. | 1651 // If the runtime cannot find a place to store trap history, |
1651 bool maybe_prior_trap = (prior_trap_count != 0); | 1652 // it is estimated based on the general condition of the method. |
1652 bool maybe_prior_recompile = (trap_mdo->decompile_count() != 0); | 1653 // If the method has ever been recompiled, or has ever incurred |
1654 // a trap with the present reason , then this BCI is assumed | |
1655 // (pessimistically) to be the culprit. | |
1656 maybe_prior_trap = (prior_trap_count != 0); | |
1657 maybe_prior_recompile = (trap_mdo->decompile_count() != 0); | |
1658 } | |
1659 | |
1660 // For reasons which are recorded per bytecode, we check per-BCI data. | |
1653 ProfileData* pdata = NULL; | 1661 ProfileData* pdata = NULL; |
1654 | |
1655 | |
1656 // For reasons which are recorded per bytecode, we check per-BCI data. | |
1657 DeoptReason per_bc_reason = reason_recorded_per_bytecode_if_any(reason); | 1662 DeoptReason per_bc_reason = reason_recorded_per_bytecode_if_any(reason); |
1663 assert(per_bc_reason != NULL || update_total_trap_count, "must be"); | |
1658 if (per_bc_reason != Reason_none) { | 1664 if (per_bc_reason != Reason_none) { |
1659 // Find the profile data for this BCI. If there isn't one, | 1665 // Find the profile data for this BCI. If there isn't one, |
1660 // try to allocate one from the MDO's set of spares. | 1666 // try to allocate one from the MDO's set of spares. |
1661 // This will let us detect a repeated trap at this point. | 1667 // This will let us detect a repeated trap at this point. |
1662 pdata = trap_mdo->allocate_bci_to_data(trap_bci); | 1668 pdata = trap_mdo->allocate_bci_to_data(trap_bci); |
1697 ResourceMark rm; | 1703 ResourceMark rm; |
1698 // Ignored outputs: | 1704 // Ignored outputs: |
1699 uint ignore_this_trap_count; | 1705 uint ignore_this_trap_count; |
1700 bool ignore_maybe_prior_trap; | 1706 bool ignore_maybe_prior_trap; |
1701 bool ignore_maybe_prior_recompile; | 1707 bool ignore_maybe_prior_recompile; |
1708 // Graal uses the total counts to determine if deoptimizations are happening too frequently -> do not adjust total counts | |
1709 bool update_total_counts = IS_GRAAL(false) NOT_GRAAL(true); | |
1702 query_update_method_data(trap_mdo, trap_bci, | 1710 query_update_method_data(trap_mdo, trap_bci, |
1703 (DeoptReason)reason, | 1711 (DeoptReason)reason, |
1712 update_total_counts, | |
1704 ignore_this_trap_count, | 1713 ignore_this_trap_count, |
1705 ignore_maybe_prior_trap, | 1714 ignore_maybe_prior_trap, |
1706 ignore_maybe_prior_recompile); | 1715 ignore_maybe_prior_recompile); |
1707 } | 1716 } |
1708 | 1717 |