summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_interface_java.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-12-20 07:47:04 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-12-20 07:47:04 +0000
commit5a0761ed3cc47405b2c993a285e83f087175ecfa (patch)
tree7475e6db2c5c2daaa58c7d0c396529a568e2ccf6 /compiler-rt/lib/tsan/rtl/tsan_interface_java.h
parentf855bbc2f304ea82859e7c5e0c85b7b04377fc43 (diff)
downloadbcm5719-llvm-5a0761ed3cc47405b2c993a285e83f087175ecfa.tar.gz
bcm5719-llvm-5a0761ed3cc47405b2c993a285e83f087175ecfa.zip
tsan: add Java interface
llvm-svn: 170679
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_interface_java.h')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_interface_java.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface_java.h b/compiler-rt/lib/tsan/rtl/tsan_interface_java.h
new file mode 100644
index 00000000000..1f3afc81527
--- /dev/null
+++ b/compiler-rt/lib/tsan/rtl/tsan_interface_java.h
@@ -0,0 +1,64 @@
+//===-- tsan_interface_java.h -----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of ThreadSanitizer (TSan), a race detector.
+//
+//===----------------------------------------------------------------------===//
+#ifndef TSAN_INTERFACE_JAVA_H
+#define TSAN_INTERFACE_JAVA_H
+
+#ifndef INTERFACE_ATTRIBUTE
+# define INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned long jptr; // NOLINT
+
+
+// Must be called before any other callback from Java.
+void __tsan_java_init(jptr heap_begin, jptr heap_size) INTERFACE_ATTRIBUTE;
+// Must be called when the application exits.
+// Not necessary the last callback (concurrently running threads are OK).
+// Returns exit status or 0 if tsan does not want to override it.
+int __tsan_java_fini() INTERFACE_ATTRIBUTE;
+
+// Callback for memory allocations.
+// May be omitted for allocations that are not subject to data races
+// nor contain synchronization objects (e.g. String).
+void __tsan_java_alloc(jptr ptr, jptr size) INTERFACE_ATTRIBUTE;
+// Callback for memory free.
+// Can be aggregated for several objects (preferably).
+void __tsan_java_free(jptr ptr, jptr size) INTERFACE_ATTRIBUTE;
+// Callback for memory move by GC.
+// Can be aggregated for several objects (preferably).
+// The ranges must not overlap.
+void __tsan_java_move(jptr src, jptr dst, jptr size) INTERFACE_ATTRIBUTE;
+
+// Mutex lock.
+// Addr is any unique address associated with the mutex.
+// Must not be called on recursive reentry.
+// Object.wait() is handled as a pair of unlock/lock.
+void __tsan_java_mutex_lock(jptr addr) INTERFACE_ATTRIBUTE;
+// Mutex unlock.
+void __tsan_java_mutex_unlock(jptr addr) INTERFACE_ATTRIBUTE;
+// Mutex read lock.
+void __tsan_java_mutex_read_lock(jptr addr) INTERFACE_ATTRIBUTE;
+// Mutex read unlock.
+void __tsan_java_mutex_read_unlock(jptr addr) INTERFACE_ATTRIBUTE;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#undef INTERFACE_ATTRIBUTE
+
+#endif // #ifndef TSAN_INTERFACE_JAVA_H
OpenPOWER on IntegriCloud