Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/java.cpp @ 15694:7b999df1dabc
ensure Graal C++ shutdown routines are called exactly once during VM shutdown
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 15 May 2014 22:43:44 +0200 |
parents | 063ec2920d21 |
children | 66a9286203a2 |
comparison
equal
deleted
inserted
replaced
15693:807090ddbbf2 | 15694:7b999df1dabc |
---|---|
460 #define BEFORE_EXIT_NOT_RUN 0 | 460 #define BEFORE_EXIT_NOT_RUN 0 |
461 #define BEFORE_EXIT_RUNNING 1 | 461 #define BEFORE_EXIT_RUNNING 1 |
462 #define BEFORE_EXIT_DONE 2 | 462 #define BEFORE_EXIT_DONE 2 |
463 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN; | 463 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN; |
464 | 464 |
465 #ifdef GRAAL | |
466 #ifdef COMPILERGRAAL | |
467 if (GraalCompiler::instance() != NULL) { | |
468 GraalCompiler::instance()->shutdown(); | |
469 } | |
470 #endif | |
471 VMToCompiler::shutdownRuntime(); | |
472 #endif | |
473 | |
474 // Note: don't use a Mutex to guard the entire before_exit(), as | 465 // Note: don't use a Mutex to guard the entire before_exit(), as |
475 // JVMTI post_thread_end_event and post_vm_death_event will run native code. | 466 // JVMTI post_thread_end_event and post_vm_death_event will run native code. |
476 // A CAS or OSMutex would work just fine but then we need to manipulate | 467 // A CAS or OSMutex would work just fine but then we need to manipulate |
477 // thread state for Safepoint. Here we use Monitor wait() and notify_all() | 468 // thread state for Safepoint. Here we use Monitor wait() and notify_all() |
478 // for synchronization. | 469 // for synchronization. |
490 case BEFORE_EXIT_DONE: | 481 case BEFORE_EXIT_DONE: |
491 return; | 482 return; |
492 } | 483 } |
493 } | 484 } |
494 | 485 |
486 #ifdef GRAAL | |
487 #ifdef COMPILERGRAAL | |
488 if (GraalCompiler::instance() != NULL) { | |
489 GraalCompiler::instance()->shutdown(); | |
490 } | |
491 #endif | |
492 VMToCompiler::shutdownRuntime(); | |
493 #endif | |
494 | |
495 // The only difference between this and Win32's _onexit procs is that | 495 // The only difference between this and Win32's _onexit procs is that |
496 // this version is invoked before any threads get killed. | 496 // this version is invoked before any threads get killed. |
497 ExitProc* current = exit_procs; | 497 ExitProc* current = exit_procs; |
498 while (current != NULL) { | 498 while (current != NULL) { |
499 ExitProc* next = current->next(); | 499 ExitProc* next = current->next(); |