RFR: 8292674: ReportJNIFatalError should print all java frames [v3]

David Holmes dholmes at openjdk.org
Thu Dec 8 00:38:13 UTC 2022


> When JNI reports errors and warnings and produces a stack trace, we need to see the exact Java code that was being executed. The existing `JavaThread::print_stack` that is used is only for platform/carrier threads and doesn't show any mounted virtual thread. So we introduce a new `JavaThread::print_virtual_stack_on` method to print the mounted virtual thread's stack, and we add `JavaThread::print_jni_stack` as a utility for JNI to call that dispatches to the appropriate function based on the thread type.
> 
> The existing test `hotspot/jtreg/runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java` was modified to test regular and virtual threads, and to expect to see the specific stack frame of the Java native method.
> 
> Additional manual testing of the JNI `FatalError` method was done by direct fault injection in modified JDK code.
> 
> Sanity testing: Oracle tiers 1-4 (to include our -Xcheck:jni run in tier4)
> 
> Thanks,
> David

David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'master' into 8292674-ReportJNIFatalError-v2
 - Changed RegisterMap to include process_frame and update, for object monitor examination.
   Updated stack printing for exception checks.
 - 8292674: ReportJNIFatalError should print all java frames

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/11503/files
  - new: https://git.openjdk.org/jdk/pull/11503/files/fa1d7b0c..f4fd2893

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11503&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11503&range=01-02

  Stats: 85869 lines in 1440 files changed: 40908 ins; 36431 del; 8530 mod
  Patch: https://git.openjdk.org/jdk/pull/11503.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11503/head:pull/11503

PR: https://git.openjdk.org/jdk/pull/11503


More information about the hotspot-dev mailing list