< prev index next >

src/share/vm/runtime/deoptimization.cpp

Print this page
rev 8847 : 8140482: Various minor code improvements (runtime)
Reviewed-by: dholmes, coleenp, sspitsyn, dsamersoff


1844     return trap_state + recompile_bit;     // the condition is already true
1845   } else if (trap_state == 0) {
1846     return reason + recompile_bit;          // no condition has yet been true
1847   } else {
1848     return DS_REASON_MASK + recompile_bit;  // fall to state lattice bottom
1849   }
1850 }
1851 //-----------------------trap_state_is_recompiled------------------------------
1852 bool Deoptimization::trap_state_is_recompiled(int trap_state) {
1853   return (trap_state & DS_RECOMPILE_BIT) != 0;
1854 }
1855 //-----------------------trap_state_set_recompiled-----------------------------
1856 int Deoptimization::trap_state_set_recompiled(int trap_state, bool z) {
1857   if (z)  return trap_state |  DS_RECOMPILE_BIT;
1858   else    return trap_state & ~DS_RECOMPILE_BIT;
1859 }
1860 //---------------------------format_trap_state---------------------------------
1861 // This is used for debugging and diagnostics, including LogFile output.
1862 const char* Deoptimization::format_trap_state(char* buf, size_t buflen,
1863                                               int trap_state) {

1864   DeoptReason reason      = trap_state_reason(trap_state);
1865   bool        recomp_flag = trap_state_is_recompiled(trap_state);
1866   // Re-encode the state from its decoded components.
1867   int decoded_state = 0;
1868   if (reason_is_recorded_per_bytecode(reason) || reason == Reason_many)
1869     decoded_state = trap_state_add_reason(decoded_state, reason);
1870   if (recomp_flag)
1871     decoded_state = trap_state_set_recompiled(decoded_state, recomp_flag);
1872   // If the state re-encodes properly, format it symbolically.
1873   // Because this routine is used for debugging and diagnostics,
1874   // be robust even if the state is a strange value.
1875   size_t len;
1876   if (decoded_state != trap_state) {
1877     // Random buggy state that doesn't decode??
1878     len = jio_snprintf(buf, buflen, "#%d", trap_state);
1879   } else {
1880     len = jio_snprintf(buf, buflen, "%s%s",
1881                        trap_reason_name(reason),
1882                        recomp_flag ? " recompiled" : "");
1883   }




1844     return trap_state + recompile_bit;     // the condition is already true
1845   } else if (trap_state == 0) {
1846     return reason + recompile_bit;          // no condition has yet been true
1847   } else {
1848     return DS_REASON_MASK + recompile_bit;  // fall to state lattice bottom
1849   }
1850 }
1851 //-----------------------trap_state_is_recompiled------------------------------
1852 bool Deoptimization::trap_state_is_recompiled(int trap_state) {
1853   return (trap_state & DS_RECOMPILE_BIT) != 0;
1854 }
1855 //-----------------------trap_state_set_recompiled-----------------------------
1856 int Deoptimization::trap_state_set_recompiled(int trap_state, bool z) {
1857   if (z)  return trap_state |  DS_RECOMPILE_BIT;
1858   else    return trap_state & ~DS_RECOMPILE_BIT;
1859 }
1860 //---------------------------format_trap_state---------------------------------
1861 // This is used for debugging and diagnostics, including LogFile output.
1862 const char* Deoptimization::format_trap_state(char* buf, size_t buflen,
1863                                               int trap_state) {
1864   assert(buflen > 0, "sanity");
1865   DeoptReason reason      = trap_state_reason(trap_state);
1866   bool        recomp_flag = trap_state_is_recompiled(trap_state);
1867   // Re-encode the state from its decoded components.
1868   int decoded_state = 0;
1869   if (reason_is_recorded_per_bytecode(reason) || reason == Reason_many)
1870     decoded_state = trap_state_add_reason(decoded_state, reason);
1871   if (recomp_flag)
1872     decoded_state = trap_state_set_recompiled(decoded_state, recomp_flag);
1873   // If the state re-encodes properly, format it symbolically.
1874   // Because this routine is used for debugging and diagnostics,
1875   // be robust even if the state is a strange value.
1876   size_t len;
1877   if (decoded_state != trap_state) {
1878     // Random buggy state that doesn't decode??
1879     len = jio_snprintf(buf, buflen, "#%d", trap_state);
1880   } else {
1881     len = jio_snprintf(buf, buflen, "%s%s",
1882                        trap_reason_name(reason),
1883                        recomp_flag ? " recompiled" : "");
1884   }


< prev index next >