summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_interface_java.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/tsan/rtl to .cppNico Weber2019-08-011-267/+0
| | | | | | Like r367463, but for tsan/rtl. llvm-svn: 367564
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* tsan: add new mutex annotationsDmitry Vyukov2017-03-261-7/+7
| | | | | | | | | | | | | | There are several problems with the current annotations (AnnotateRWLockCreate and friends): - they don't fully support deadlock detection (we need a hook _before_ mutex lock) - they don't support insertion of random artificial delays to perturb execution (again we need a hook _before_ mutex lock) - they don't support setting extended mutex attributes like read/write reentrancy (only "linker init" was bolted on) - they don't support setting mutex attributes if a mutex don't have a "constructor" (e.g. static, Java, Go mutexes) - they don't ignore synchronization inside of lock/unlock operations which leads to slowdown and false negatives The new annotations solve of the above problems. See tsan_interface.h for the interface specification and comments. Reviewed in https://reviews.llvm.org/D31093 llvm-svn: 298809
* tsan: allow Java VM iterate over allocated objectsDmitry Vyukov2016-12-141-0/+17
| | | | | | | | | | | | Objects may move during the garbage collection, and JVM needs to notify ThreadAnalyzer about that. The new function __tsan_java_find eliminates the need to maintain these objects both in ThreadAnalyzer and JVM. Author: Alexander Smundak (asmundak) Reviewed in https://reviews.llvm.org/D27720 llvm-svn: 289682
* tsan: change tsan/Go interface for obtaining the current ProcessorDmitry Vyukov2016-04-271-1/+1
| | | | | | | | | | | | | | | Current interface assumes that Go calls ProcWire/ProcUnwire to establish the association between thread and proc. With the wisdom of hindsight, this interface does not work very well. I had to sprinkle Go scheduler with wire/unwire calls, and any mistake leads to hard to debug crashes. This is not something one wants to maintian. Fortunately, there is a simpler solution. We can ask Go runtime as to what is the current Processor, and that question is very easy to answer on Go side. Switch to such interface. llvm-svn: 267703
* tsan: split thread into logical and physical stateDmitry Vyukov2016-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This is reincarnation of http://reviews.llvm.org/D17648 with the bug fix pointed out by Adhemerval (zatrazz). Currently ThreadState holds both logical state (required for race-detection algorithm, user-visible) and physical state (various caches, most notably malloc cache). Move physical state in a new Process entity. Besides just being the right thing from abstraction point of view, this solves several problems: Cache everything on P level in Go. Currently we cache on a mix of goroutine and OS thread levels. This unnecessary increases memory consumption. Properly handle free operations in Go. Frees are issue by GC which don't have goroutine context. As the result we could not do anything more than just clearing shadow. For example, we leaked sync objects and heap block descriptors. This will allow to get rid of libc malloc in Go (now we have Processor context for internal allocator cache). This in turn will allow to get rid of dependency on libc entirely. Potentially we can make Processor per-CPU in C++ mode instead of per-thread, which will reduce resource consumption. The distinction between Thread and Processor is currently used only by Go, C++ creates Processor per OS thread, which is equivalent to the current scheme. llvm-svn: 267678
* tsan: revert r262037Dmitry Vyukov2016-02-261-1/+1
| | | | | | Broke aarch64 and darwin bots. llvm-svn: 262046
* tsan: split thread into logical and physical stateDmitry Vyukov2016-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | Currently ThreadState holds both logical state (required for race-detection algorithm, user-visible) and physical state (various caches, most notably malloc cache). Move physical state in a new Process entity. Besides just being the right thing from abstraction point of view, this solves several problems: 1. Cache everything on P level in Go. Currently we cache on a mix of goroutine and OS thread levels. This unnecessary increases memory consumption. 2. Properly handle free operations in Go. Frees are issue by GC which don't have goroutine context. As the result we could not do anything more than just clearing shadow. For example, we leaked sync objects and heap block descriptors. 3. This will allow to get rid of libc malloc in Go (now we have Processor context for internal allocator cache). This in turn will allow to get rid of dependency on libc entirely. 4. Potentially we can make Processor per-CPU in C++ mode instead of per-thread, which will reduce resource consumption. The distinction between Thread and Processor is currently used only by Go, C++ creates Processor per OS thread, which is equivalent to the current scheme. llvm-svn: 262037
* tsan: add acquire/release functions to java interfaceDmitry Vyukov2014-12-221-0/+30
| | | | | | they are required to handle synchronization on volatile/final fields llvm-svn: 224697
* [TSan] Use StackTrace from sanitizer_common where applicableAlexey Samsonov2014-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change removes `__tsan::StackTrace` class. There are now three alternatives: # Lightweight `__sanitizer::StackTrace`, which doesn't own a buffer of PCs. It is used in functions that need stack traces in read-only mode, and helps to prevent unnecessary allocations/copies (e.g. for StackTraces fetched from StackDepot). # `__sanitizer::BufferedStackTrace`, which stores buffer of PCs in a constant array. It is used in TraceHeader (non-Go version) # `__tsan::VarSizeStackTrace`, which owns buffer of PCs, dynamically allocated via TSan internal allocator. Test Plan: compiler-rt test suite Reviewers: dvyukov, kcc Reviewed By: kcc Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D6004 llvm-svn: 221194
* tsan: allow memory overlap in __tsan_java_moveDmitry Vyukov2014-07-081-2/+10
| | | | | | JVM actually moves memory between overlapping ranges. llvm-svn: 212560
* tsan: add __tsan_java_finalize interface functionDmitry Vyukov2014-06-271-0/+6
| | | | | | | It is required to prevent false positives between object ctor and finalizer, as otherwise they look completely unsynchronized. llvm-svn: 211829
* tsan: refactor storage of meta information for heap blocks and sync objectsDmitry Vyukov2014-05-291-133/+13
| | | | | | | | | | | | | | | The new storage (MetaMap) is based on direct shadow (instead of a hashmap + per-block lists). This solves a number of problems: - eliminates quadratic behaviour in SyncTab::GetAndLock (https://code.google.com/p/thread-sanitizer/issues/detail?id=26) - eliminates contention in SyncTab - eliminates contention in internal allocator during allocation of sync objects - removes a bunch of ad-hoc code in java interface - reduces java shadow from 2x to 1/2x - allows to memorize heap block meta info for Java and Go - allows to cleanup sync object meta info for Go - which in turn enabled deadlock detector for Go llvm-svn: 209810
* tsan: deobfuscate global ctx variableDmitry Vyukov2014-03-201-1/+1
| | | | llvm-svn: 204327
* tsan: remove in_rtl counterDmitry Vyukov2013-12-241-4/+0
| | | | | | | | This is intended to address the following problem. Episodically we see CHECK-failures when recursive interceptors call back into user code. Effectively we are not "in_rtl" at this point, but it's very complicated and fragile to properly maintain in_rtl property. Instead get rid of it. It was used mostly for sanity CHECKs, which basically never uncover real problems. Instead introduce ignore_interceptors flag, which is used in very few narrow places to disable recursive interceptors (e.g. during runtime initialization). llvm-svn: 197979
* tsan: ignore interceptors coming from specified librariesDmitry Vyukov2013-10-031-13/+0
| | | | | | | | | | | | | LibIgnore allows to ignore all interceptors called from a particular set of dynamic libraries. LibIgnore remembers all "called_from_lib" suppressions from the provided SuppressionContext; finds code ranges for the libraries; and checks whether the provided PC value belongs to the code ranges. Also make malloc and friends interceptors use SCOPED_INTERCEPTOR_RAW instead of SCOPED_TSAN_INTERCEPTOR, because if they are called from an ignored lib, then must call our internal allocator instead of libc malloc. llvm-svn: 191897
* tsan: ignore all interceptors coming directly from JVMDmitry Vyukov2013-09-211-0/+14
| | | | llvm-svn: 191152
* tsan: consistently use return pc as top frame pcDmitry Vyukov2013-06-171-1/+2
| | | | | | | always substract 1 from the top pc this allows to get correct stacks with -O2 llvm-svn: 184112
* tsan: introduce recursive mutex lock/unlock java interfaceDmitry Vyukov2013-05-171-0/+24
| | | | | | this is required to handle Object.Wait() llvm-svn: 182088
* [Sanitizer] update style checker script and fix namespace style warningsAlexey Samsonov2013-01-301-1/+1
| | | | llvm-svn: 173910
* tsan: fix Java memory move operations and add the testDmitry Vyukov2012-12-211-10/+23
| | | | llvm-svn: 170891
* tsan: update mutex table for javaDmitry Vyukov2012-12-211-5/+3
| | | | llvm-svn: 170884
* tsan: java: move shadow memory on GC compactionDmitry Vyukov2012-12-211-7/+28
| | | | llvm-svn: 170882
* tsan: java interface implementation skeletonDmitry Vyukov2012-12-201-2/+229
| | | | llvm-svn: 170707
* tsan: add java interface implementation stubDmitry Vyukov2012-12-201-0/+46
llvm-svn: 170681
OpenPOWER on IntegriCloud