1 /* |
1 /* |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
512 Handle exception(thread, JNIHandles::resolve_non_null(receiver)); |
512 Handle exception(thread, JNIHandles::resolve_non_null(receiver)); |
513 java_lang_Throwable::fill_in_stack_trace(exception); |
513 java_lang_Throwable::fill_in_stack_trace(exception); |
514 JVM_END |
514 JVM_END |
515 |
515 |
516 |
516 |
517 JVM_ENTRY(jint, JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable)) |
517 JVM_ENTRY(void, JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray stackTrace)) |
518 JVMWrapper("JVM_GetStackTraceDepth"); |
518 JVMWrapper("JVM_GetStackTraceElements"); |
519 oop exception = JNIHandles::resolve(throwable); |
519 Handle exception(THREAD, JNIHandles::resolve(throwable)); |
520 return java_lang_Throwable::get_stack_trace_depth(exception, THREAD); |
520 objArrayOop st = objArrayOop(JNIHandles::resolve(stackTrace)); |
521 JVM_END |
521 objArrayHandle stack_trace(THREAD, st); |
522 |
522 // Fill in the allocated stack trace |
523 |
523 java_lang_Throwable::get_stack_trace_elements(exception, stack_trace, CHECK); |
524 JVM_ENTRY(jobject, JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)) |
|
525 JVMWrapper("JVM_GetStackTraceElement"); |
|
526 JvmtiVMObjectAllocEventCollector oam; // This ctor (throughout this module) may trigger a safepoint/GC |
|
527 oop exception = JNIHandles::resolve(throwable); |
|
528 oop element = java_lang_Throwable::get_stack_trace_element(exception, index, CHECK_NULL); |
|
529 return JNIHandles::make_local(env, element); |
|
530 JVM_END |
524 JVM_END |
531 |
525 |
532 |
526 |
533 // java.lang.StackWalker ////////////////////////////////////////////////////// |
527 // java.lang.StackWalker ////////////////////////////////////////////////////// |
534 |
528 |