Skip to content

Commit

Permalink
8330464: hserr generic events - add entry for the before_exit calls
Browse files Browse the repository at this point in the history
Backport-of: 45ed97f15b96071e5d6b6d21e8f0129eda5aa447
  • Loading branch information
MBaesken committed May 23, 2024
1 parent 20da646 commit d986096
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/hotspot/share/runtime/java.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#include "sanitizers/leak.hpp"
#include "services/memTracker.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
#include "utilities/vmError.hpp"
Expand Down Expand Up @@ -395,6 +396,8 @@ void before_exit(JavaThread* thread, bool halt) {
#define BEFORE_EXIT_DONE 2
static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;

Events::log(thread, "Before exit entered");

// Note: don't use a Mutex to guard the entire before_exit(), as
// JVMTI post_thread_end_event and post_vm_death_event will run native code.
// A CAS or OSMutex would work just fine but then we need to manipulate
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,10 +823,10 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {

// Threads::destroy_vm() is normally called from jni_DestroyJavaVM() when
// the program falls off the end of main(). Another VM exit path is through
// vm_exit() when the program calls System.exit() to return a value or when
// there is a serious error in VM. The two shutdown paths are not exactly
// the same, but they share Shutdown.shutdown() at Java level and before_exit()
// and VM_Exit op at VM level.
// vm_exit(), when the program calls System.exit() to return a value, or when
// there is a serious error in VM.
// These two separate shutdown paths are not exactly the same, but they share
// Shutdown.shutdown() at Java level and before_exit() and VM_Exit op at VM level.
//
// Shutdown sequence:
// + Shutdown native memory tracking if it is on
Expand Down

1 comment on commit d986096

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.