Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/javaClasses.cpp @ 17475:6795fcebbf42
Merge
author | chegar |
---|---|
date | Mon, 21 Oct 2013 14:08:09 +0100 |
parents | 07f8c2a453f8 |
children | 096c224171c4 d8d1b22b1809 9428a0b94204 |
comparison
equal
deleted
inserted
replaced
17474:6fa574bfd32a | 17475:6795fcebbf42 |
---|---|
1374 // Get strings and string lengths | 1374 // Get strings and string lengths |
1375 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror())); | 1375 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror())); |
1376 const char* klass_name = holder->external_name(); | 1376 const char* klass_name = holder->external_name(); |
1377 int buf_len = (int)strlen(klass_name); | 1377 int buf_len = (int)strlen(klass_name); |
1378 | 1378 |
1379 // pushing to the stack trace added one. | 1379 // The method id may point to an obsolete method, can't get more stack information |
1380 Method* method = holder->method_with_idnum(method_id); | 1380 Method* method = holder->method_with_idnum(method_id); |
1381 if (method == NULL) { | |
1382 char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64); | |
1383 // This is what the java code prints in this case - added Redefined | |
1384 sprintf(buf, "\tat %s.null (Redefined)", klass_name); | |
1385 return buf; | |
1386 } | |
1387 | |
1381 char* method_name = method->name()->as_C_string(); | 1388 char* method_name = method->name()->as_C_string(); |
1382 buf_len += (int)strlen(method_name); | 1389 buf_len += (int)strlen(method_name); |
1383 | 1390 |
1384 char* source_file_name = NULL; | 1391 char* source_file_name = NULL; |
1385 if (version_matches(method, version)) { | 1392 if (version_matches(method, version)) { |
1771 | 1778 |
1772 oop element = java_lang_StackTraceElement::create(mirror, method, version, bci, CHECK_0); | 1779 oop element = java_lang_StackTraceElement::create(mirror, method, version, bci, CHECK_0); |
1773 return element; | 1780 return element; |
1774 } | 1781 } |
1775 | 1782 |
1776 oop java_lang_StackTraceElement::create(Handle mirror, int method_id, int version, int bci, TRAPS) { | 1783 oop java_lang_StackTraceElement::create(Handle mirror, int method_id, |
1784 int version, int bci, TRAPS) { | |
1777 // Allocate java.lang.StackTraceElement instance | 1785 // Allocate java.lang.StackTraceElement instance |
1778 Klass* k = SystemDictionary::StackTraceElement_klass(); | 1786 Klass* k = SystemDictionary::StackTraceElement_klass(); |
1779 assert(k != NULL, "must be loaded in 1.4+"); | 1787 assert(k != NULL, "must be loaded in 1.4+"); |
1780 instanceKlassHandle ik (THREAD, k); | 1788 instanceKlassHandle ik (THREAD, k); |
1781 if (ik->should_be_initialized()) { | 1789 if (ik->should_be_initialized()) { |
1788 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror())); | 1796 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror())); |
1789 const char* str = holder->external_name(); | 1797 const char* str = holder->external_name(); |
1790 oop classname = StringTable::intern((char*) str, CHECK_0); | 1798 oop classname = StringTable::intern((char*) str, CHECK_0); |
1791 java_lang_StackTraceElement::set_declaringClass(element(), classname); | 1799 java_lang_StackTraceElement::set_declaringClass(element(), classname); |
1792 | 1800 |
1801 Method* method = holder->method_with_idnum(method_id); | |
1802 // Method on stack may be obsolete because it was redefined so cannot be | |
1803 // found by idnum. | |
1804 if (method == NULL) { | |
1805 // leave name and fileName null | |
1806 java_lang_StackTraceElement::set_lineNumber(element(), -1); | |
1807 return element(); | |
1808 } | |
1809 | |
1793 // Fill in method name | 1810 // Fill in method name |
1794 Method* method = holder->method_with_idnum(method_id); | |
1795 oop methodname = StringTable::intern(method->name(), CHECK_0); | 1811 oop methodname = StringTable::intern(method->name(), CHECK_0); |
1796 java_lang_StackTraceElement::set_methodName(element(), methodname); | 1812 java_lang_StackTraceElement::set_methodName(element(), methodname); |
1797 | 1813 |
1798 if (!version_matches(method, version)) { | 1814 if (!version_matches(method, version)) { |
1799 // The method was redefined, accurate line number information isn't available | 1815 // The method was redefined, accurate line number information isn't available |