36 #include "classfile/symbolTable.hpp" |
36 #include "classfile/symbolTable.hpp" |
37 #include "classfile/systemDictionary.hpp" |
37 #include "classfile/systemDictionary.hpp" |
38 #include "classfile/vmSymbols.hpp" |
38 #include "classfile/vmSymbols.hpp" |
39 #include "gc/shared/collectedHeap.inline.hpp" |
39 #include "gc/shared/collectedHeap.inline.hpp" |
40 #include "interpreter/bytecode.hpp" |
40 #include "interpreter/bytecode.hpp" |
|
41 #include "interpreter/bytecodeUtils.hpp" |
41 #include "jfr/jfrEvents.hpp" |
42 #include "jfr/jfrEvents.hpp" |
42 #include "logging/log.hpp" |
43 #include "logging/log.hpp" |
43 #include "memory/heapShared.hpp" |
44 #include "memory/heapShared.hpp" |
44 #include "memory/oopFactory.hpp" |
45 #include "memory/oopFactory.hpp" |
45 #include "memory/referenceType.hpp" |
46 #include "memory/referenceType.hpp" |
529 |
530 |
530 |
531 |
531 |
532 |
532 // java.lang.Throwable ////////////////////////////////////////////////////// |
533 // java.lang.Throwable ////////////////////////////////////////////////////// |
533 |
534 |
534 |
|
535 JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver)) |
535 JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver)) |
536 JVMWrapper("JVM_FillInStackTrace"); |
536 JVMWrapper("JVM_FillInStackTrace"); |
537 Handle exception(thread, JNIHandles::resolve_non_null(receiver)); |
537 Handle exception(thread, JNIHandles::resolve_non_null(receiver)); |
538 java_lang_Throwable::fill_in_stack_trace(exception); |
538 java_lang_Throwable::fill_in_stack_trace(exception); |
539 JVM_END |
539 JVM_END |
540 |
540 |
|
541 // java.lang.NullPointerException /////////////////////////////////////////// |
|
542 |
|
543 JVM_ENTRY(jstring, JVM_GetExtendedNPEMessage(JNIEnv *env, jthrowable throwable)) |
|
544 if (!ShowCodeDetailsInExceptionMessages) return NULL; |
|
545 |
|
546 oop exc = JNIHandles::resolve_non_null(throwable); |
|
547 |
|
548 Method* method; |
|
549 int bci; |
|
550 if (!java_lang_Throwable::get_top_method_and_bci(exc, &method, &bci)) { |
|
551 return NULL; |
|
552 } |
|
553 if (method->is_native()) { |
|
554 return NULL; |
|
555 } |
|
556 |
|
557 stringStream ss; |
|
558 bool ok = BytecodeUtils::get_NPE_message_at(&ss, method, bci); |
|
559 if (ok) { |
|
560 oop result = java_lang_String::create_oop_from_str(ss.base(), CHECK_0); |
|
561 return (jstring) JNIHandles::make_local(env, result); |
|
562 } else { |
|
563 return NULL; |
|
564 } |
|
565 JVM_END |
541 |
566 |
542 // java.lang.StackTraceElement ////////////////////////////////////////////// |
567 // java.lang.StackTraceElement ////////////////////////////////////////////// |
543 |
568 |
544 |
569 |
545 JVM_ENTRY(void, JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable)) |
570 JVM_ENTRY(void, JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable)) |