1323 xtty->begin_head("uncommon_trap thread='" UINTX_FORMAT"' %s",
1324 os::current_thread_id(),
1325 format_trap_request(buf, sizeof(buf), trap_request));
1326 nm->log_identity(xtty);
1327 }
1328 Symbol* class_name = NULL;
1329 bool unresolved = false;
1330 if (unloaded_class_index >= 0) {
1331 constantPoolHandle constants (THREAD, trap_method->constants());
1332 if (constants->tag_at(unloaded_class_index).is_unresolved_klass()) {
1333 class_name = constants->klass_name_at(unloaded_class_index);
1334 unresolved = true;
1335 if (xtty != NULL)
1336 xtty->print(" unresolved='1'");
1337 } else if (constants->tag_at(unloaded_class_index).is_symbol()) {
1338 class_name = constants->symbol_at(unloaded_class_index);
1339 }
1340 if (xtty != NULL)
1341 xtty->name(class_name);
1342 }
1343 if (xtty != NULL && trap_mdo != NULL) {
1344 // Dump the relevant MDO state.
1345 // This is the deopt count for the current reason, any previous
1346 // reasons or recompiles seen at this point.
1347 int dcnt = trap_mdo->trap_count(reason);
1348 if (dcnt != 0)
1349 xtty->print(" count='%d'", dcnt);
1350 ProfileData* pdata = trap_mdo->bci_to_data(trap_bci);
1351 int dos = (pdata == NULL)? 0: pdata->trap_state();
1352 if (dos != 0) {
1353 xtty->print(" state='%s'", format_trap_state(buf, sizeof(buf), dos));
1354 if (trap_state_is_recompiled(dos)) {
1355 int recnt2 = trap_mdo->overflow_recompile_count();
1356 if (recnt2 != 0)
1357 xtty->print(" recompiles2='%d'", recnt2);
1358 }
1359 }
1360 }
1361 if (xtty != NULL) {
1362 xtty->stamp();
1363 xtty->end_head();
1801 decoded_state = trap_state_set_recompiled(decoded_state, recomp_flag);
1802 // If the state re-encodes properly, format it symbolically.
1803 // Because this routine is used for debugging and diagnostics,
1804 // be robust even if the state is a strange value.
1805 size_t len;
1806 if (decoded_state != trap_state) {
1807 // Random buggy state that doesn't decode??
1808 len = jio_snprintf(buf, buflen, "#%d", trap_state);
1809 } else {
1810 len = jio_snprintf(buf, buflen, "%s%s",
1811 trap_reason_name(reason),
1812 recomp_flag ? " recompiled" : "");
1813 }
1814 if (len >= buflen)
1815 buf[buflen-1] = '\0';
1816 return buf;
1817 }
1818
1819
1820 //--------------------------------statics--------------------------------------
1821 const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = {
1822 // Note: Keep this in sync. with enum DeoptReason.
1823 "none",
1824 "null_check",
1825 "null_assert",
1826 "range_check",
1827 "class_check",
1828 "array_check",
1829 "intrinsic",
1830 "bimorphic",
1831 "unloaded",
1832 "uninitialized",
1833 "unreached",
1834 "unhandled",
1835 "constraint",
1836 "div0_check",
1837 "age",
1838 "predicate",
1839 "loop_limit_check",
1840 "speculate_class_check",
1841 "speculate_null_check",
1842 "rtm_state_change"
1843 };
1844 const char* Deoptimization::_trap_action_name[Action_LIMIT] = {
1845 // Note: Keep this in sync. with enum DeoptAction.
1846 "none",
1847 "maybe_recompile",
1848 "reinterpret",
1849 "make_not_entrant",
1850 "make_not_compilable"
1851 };
1852
1853 const char* Deoptimization::trap_reason_name(int reason) {
1854 if (reason == Reason_many) return "many";
1855 if ((uint)reason < Reason_LIMIT)
1856 return _trap_reason_name[reason];
1857 static char buf[20];
1858 sprintf(buf, "reason%d", reason);
1859 return buf;
1860 }
1861 const char* Deoptimization::trap_action_name(int action) {
1862 if ((uint)action < Action_LIMIT)
1863 return _trap_action_name[action];
1864 static char buf[20];
1865 sprintf(buf, "action%d", action);
1866 return buf;
1867 }
1868
1869 // This is used for debugging and diagnostics, including LogFile output.
1870 const char* Deoptimization::format_trap_request(char* buf, size_t buflen,
1871 int trap_request) {
1872 jint unloaded_class_index = trap_request_index(trap_request);
1873 const char* reason = trap_reason_name(trap_request_reason(trap_request));
1874 const char* action = trap_action_name(trap_request_action(trap_request));
1875 size_t len;
1876 if (unloaded_class_index < 0) {
1877 len = jio_snprintf(buf, buflen, "reason='%s' action='%s'",
1878 reason, action);
1879 } else {
1880 len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'",
1881 reason, action, unloaded_class_index);
|
1323 xtty->begin_head("uncommon_trap thread='" UINTX_FORMAT"' %s",
1324 os::current_thread_id(),
1325 format_trap_request(buf, sizeof(buf), trap_request));
1326 nm->log_identity(xtty);
1327 }
1328 Symbol* class_name = NULL;
1329 bool unresolved = false;
1330 if (unloaded_class_index >= 0) {
1331 constantPoolHandle constants (THREAD, trap_method->constants());
1332 if (constants->tag_at(unloaded_class_index).is_unresolved_klass()) {
1333 class_name = constants->klass_name_at(unloaded_class_index);
1334 unresolved = true;
1335 if (xtty != NULL)
1336 xtty->print(" unresolved='1'");
1337 } else if (constants->tag_at(unloaded_class_index).is_symbol()) {
1338 class_name = constants->symbol_at(unloaded_class_index);
1339 }
1340 if (xtty != NULL)
1341 xtty->name(class_name);
1342 }
1343 if (xtty != NULL && trap_mdo != NULL && (int)reason < (int)MethodData::_trap_hist_limit) {
1344 // Dump the relevant MDO state.
1345 // This is the deopt count for the current reason, any previous
1346 // reasons or recompiles seen at this point.
1347 int dcnt = trap_mdo->trap_count(reason);
1348 if (dcnt != 0)
1349 xtty->print(" count='%d'", dcnt);
1350 ProfileData* pdata = trap_mdo->bci_to_data(trap_bci);
1351 int dos = (pdata == NULL)? 0: pdata->trap_state();
1352 if (dos != 0) {
1353 xtty->print(" state='%s'", format_trap_state(buf, sizeof(buf), dos));
1354 if (trap_state_is_recompiled(dos)) {
1355 int recnt2 = trap_mdo->overflow_recompile_count();
1356 if (recnt2 != 0)
1357 xtty->print(" recompiles2='%d'", recnt2);
1358 }
1359 }
1360 }
1361 if (xtty != NULL) {
1362 xtty->stamp();
1363 xtty->end_head();
1801 decoded_state = trap_state_set_recompiled(decoded_state, recomp_flag);
1802 // If the state re-encodes properly, format it symbolically.
1803 // Because this routine is used for debugging and diagnostics,
1804 // be robust even if the state is a strange value.
1805 size_t len;
1806 if (decoded_state != trap_state) {
1807 // Random buggy state that doesn't decode??
1808 len = jio_snprintf(buf, buflen, "#%d", trap_state);
1809 } else {
1810 len = jio_snprintf(buf, buflen, "%s%s",
1811 trap_reason_name(reason),
1812 recomp_flag ? " recompiled" : "");
1813 }
1814 if (len >= buflen)
1815 buf[buflen-1] = '\0';
1816 return buf;
1817 }
1818
1819
1820 //--------------------------------statics--------------------------------------
1821 const char* Deoptimization::_trap_reason_name[] = {
1822 // Note: Keep this in sync. with enum DeoptReason.
1823 "none",
1824 "null_check",
1825 "null_assert",
1826 "range_check",
1827 "class_check",
1828 "array_check",
1829 "intrinsic",
1830 "bimorphic",
1831 "unloaded",
1832 "uninitialized",
1833 "unreached",
1834 "unhandled",
1835 "constraint",
1836 "div0_check",
1837 "age",
1838 "predicate",
1839 "loop_limit_check",
1840 "speculate_class_check",
1841 "speculate_null_check",
1842 "rtm_state_change",
1843 "tenured"
1844 };
1845 const char* Deoptimization::_trap_action_name[] = {
1846 // Note: Keep this in sync. with enum DeoptAction.
1847 "none",
1848 "maybe_recompile",
1849 "reinterpret",
1850 "make_not_entrant",
1851 "make_not_compilable"
1852 };
1853
1854 const char* Deoptimization::trap_reason_name(int reason) {
1855 // Check that every reason has a name
1856 STATIC_ASSERT(sizeof(_trap_reason_name)/sizeof(const char*) == Reason_LIMIT);
1857
1858 if (reason == Reason_many) return "many";
1859 if ((uint)reason < Reason_LIMIT)
1860 return _trap_reason_name[reason];
1861 static char buf[20];
1862 sprintf(buf, "reason%d", reason);
1863 return buf;
1864 }
1865 const char* Deoptimization::trap_action_name(int action) {
1866 // Check that every action has a name
1867 STATIC_ASSERT(sizeof(_trap_action_name)/sizeof(const char*) == Action_LIMIT);
1868
1869 if ((uint)action < Action_LIMIT)
1870 return _trap_action_name[action];
1871 static char buf[20];
1872 sprintf(buf, "action%d", action);
1873 return buf;
1874 }
1875
1876 // This is used for debugging and diagnostics, including LogFile output.
1877 const char* Deoptimization::format_trap_request(char* buf, size_t buflen,
1878 int trap_request) {
1879 jint unloaded_class_index = trap_request_index(trap_request);
1880 const char* reason = trap_reason_name(trap_request_reason(trap_request));
1881 const char* action = trap_action_name(trap_request_action(trap_request));
1882 size_t len;
1883 if (unloaded_class_index < 0) {
1884 len = jio_snprintf(buf, buflen, "reason='%s' action='%s'",
1885 reason, action);
1886 } else {
1887 len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'",
1888 reason, action, unloaded_class_index);
|