summaryrefslogtreecommitdiff
path: root/openjdkjvm
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2021-05-06 00:19:19 +0100
committerRoland Levillain <rpl@google.com>2021-06-01 17:07:07 +0000
commitc3854243a9e3de6e5ac3a25d31439e8cf40af1bf (patch)
tree62dcecef493b433c06723791099d0666ed3ddcf0 /openjdkjvm
parent81764e5790bc9d234ac8823ed46d3c3f670f387b (diff)
Introduce `art::FastExit` to replace all uses of `quick_exit` in ART.
No longer use `quick_exit(3)` in ART, as it does not play well with Clang's code coverage instrumentation (see b/187935521 and b/186576313). Replace all its uses with a new routine, `art::FastExit`, calling either `exit(3)` when ART is built with Clang's code coverage instrumentation (in order to dump coverage profiles when the program terminates) or `_exit(2)` otherwise (to exit quickly). Function `art::FastExit` is implemented as part of the `art_libartbase_headers` header library, so that it can be used easily in `dalvikvm`. (cherry picked from commit bdf1737bd17132525bcfdc778663123b61e97fa3) Test: mmma art Test: ART tests Bug: 186576313 Bug: 187935521 Change-Id: I7b4f86f6f0e7b12814684ecea73a2ed0ef994395 Merged-In: I7b4f86f6f0e7b12814684ecea73a2ed0ef994395
Diffstat (limited to 'openjdkjvm')
-rw-r--r--openjdkjvm/OpenjdkJvm.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/openjdkjvm/OpenjdkJvm.cc b/openjdkjvm/OpenjdkJvm.cc
index 18078abdad..d64086d43c 100644
--- a/openjdkjvm/OpenjdkJvm.cc
+++ b/openjdkjvm/OpenjdkJvm.cc
@@ -35,7 +35,6 @@
#include <dlfcn.h>
#include <limits.h>
#include <stdio.h>
-#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -46,6 +45,7 @@
#include "../../libcore/ojluni/src/main/native/jvm.h" // TODO(narayan): fix it
#include "base/macros.h"
+#include "base/fast_exit.h"
#include "common_throws.h"
#include "gc/heap.h"
#include "handle_scope-inl.h"
@@ -315,10 +315,8 @@ JNIEXPORT __attribute__((noreturn)) void JVM_Exit(jint status) {
LOG(INFO) << "System.exit called, status: " << status;
art::Runtime::Current()->CallExitHook(status);
// Unsafe to call exit() while threads may still be running. They would race
- // with static destructors. However, have functions registered with
- // `at_quick_exit` (for instance LLVM's code coverage profile dumping routine)
- // be called before exiting.
- quick_exit(status);
+ // with static destructors.
+ art::FastExit(status);
}
JNIEXPORT jstring JVM_NativeLoad(JNIEnv* env,