summaryrefslogtreecommitdiffstats
path: root/runtime/monitor.cc
Commit message (Collapse)AuthorAgeFilesLines
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 (cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33) Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d Fix some ArtMethod related bugs Added root visiting for runtime methods, not currently required since the GcRoots in these methods are null. Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes --trace run-tests 005, 044. Fixed optimizing compiler bug where we used a normal stack location instead of double on ARM64, this fixes the debuggable tests. TODO: Fix JDWP tests. Bug: 19264997 Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3 ART: Fix casts for 64-bit pointers on 32-bit compiler. Bug: 19264997 Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457 Fix JDWP tests after ArtMethod change Fixes Throwable::GetStackDepth for exception event detection after internal stack trace representation change. Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of proxy method. Bug: 19264997 Change-Id: I363e293796848c3ec491c963813f62d868da44d2 Fix accidental IMT and root marking regression Was always using the conflict trampoline. Also included fix for regression in GC time caused by extra roots. Most of the regression was IMT. Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to detached thread. EvaluateAndApplyChanges: From ~2500 -> ~1980 GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots Bug: 19264997 Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0 Fix bogus image test assert Previously we were comparing the size of the non moving space to size of the image file. Now we properly compare the size of the image space against the size of the image file. Bug: 19264997 Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a [MIPS64] Fix art_quick_invoke_stub argument offsets. ArtMethod reference's size got bigger, so we need to move other args and leave enough space for ArtMethod* and 'this' pointer. This fixes mips64 boot. Bug: 19264997 Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
* ART: Clean up arm64 kNumberOfXRegisters usage.Vladimir Marko2015-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | Avoid undefined behavior for arm64 stemming from 1u << 32 in loops with upper bound kNumberOfXRegisters. Create iterators for enumerating bits in an integer either from high to low or from low to high and use them for <arch>Context::FillCalleeSaves() on all architectures. Refactor runtime/utils.{h,cc} by moving all bit-fiddling functions to runtime/base/bit_utils.{h,cc} (together with the new bit iterators) and all time-related functions to runtime/base/time_utils.{h,cc}. Improve test coverage and fix some corner cases for the bit-fiddling functions. Bug: 13925192 (cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0) Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
* Replace NULL with nullptrMathieu Chartier2015-04-221-46/+47
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* API change in StackVisitor::GetVReg*.Nicolas Geoffray2015-03-131-2/+5
| | | | | | | | | | - Remove GetVReg() and SetVReg() that were expecting to always succeed. - Change Quick-only methods to take a FromQuickCode suffix. - Change deopt to use dead values when GetVReg does not succeed: the optimizing compiler will not have a location for uninitialized Dex registers and potentially dead registers. Change-Id: Ida05773a97aff8aa69e0caf42ea961f80f854b77
* Remove ThrowLocation.Nicolas Geoffray2015-03-101-6/+3
| | | | | | | Note that this is a cleanup change, and has no functionality change. The ThrowLocation had no use anymore. Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
* Compute the right catch location for the debugger.Nicolas Geoffray2015-03-091-1/+1
| | | | | | Also remove tls ThrowLocation, it is not needed anymore. Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9
* Reserve bits in the lock word for read barriers.Hiroshi Yamauchi2015-03-031-39/+69
| | | | | | | | | This prepares for the CC collector to use the standard object header model by storing the read barrier state in the lock word. Bug: 19355854 Bug: 12687968 Change-Id: Ia7585662dd2cebf0479a3e74f734afe5059fb70f
* More of the concurrent copying collector.Hiroshi Yamauchi2015-01-231-0/+7
| | | | | Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
* Fix compaction unsafe DescribeWaitMathieu Chartier2015-01-221-1/+4
| | | | | | | | Fixes a crash that was seen once in automated tests, PrettyTypeOf was accessing a stale object which had moved during IdentityHashCode due to thin lock inflation causing suspension. Change-Id: I105aa9a09d4e8c9091b9a60e508ef71e613f1eed
* Fix frequent gcstress ThreadStress crashMathieu Chartier2015-01-061-8/+3
| | | | | | | | | | Calling IdentityHashCode before PrettyTypeOf was causing occasional stale root errors since IdentityHashCode can cause thread suspension. Cleaned up VisitLocks. Bug: 18766916 Change-Id: I7679539877e48a8c9aadb8a34718404ebce98d25
* Add systrace events to monitors and thread suspensionMathieu Chartier2014-12-171-1/+10
| | | | | | | | | Added systrace events to SuspendThreadByPeer, SuspendThreadByThreadId and monitor contention. Bug: 18379850 Bug: 17470248 Change-Id: I29eaf97c67361a6c6b437940b8729600d78696df
* Modify the behavior of thread suspend shootouts.Ian Rogers2014-11-121-2/+0
| | | | | | | | | | The thread doing the suspension doesn't attempt to suspend the other thread unless it knows another thread isn't trying to suspend it. Use the suspend count, and its lock, for this purpose. Re-enable ThreadStress test. Bug: 15446488 Change-Id: Idd34410c7b89d8abd6973e5699a15ca699472c78
* am 78a32333: Merge "ART: More warnings"Andreas Gampe2014-11-051-4/+4
|\ | | | | | | | | * commit '78a3233313260665fe82ba56257855e043bca3d4': ART: More warnings
| * ART: More warningsAndreas Gampe2014-11-041-4/+4
| | | | | | | | | | | | | | Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
* | am 3e3364e2: Merge "Tidy logging code not using UNIMPLEMENTED."Ian Rogers2014-10-281-2/+2
|\| | | | | | | | | * commit '3e3364e267117462894e0c3b7d9b413b25d28057': Tidy logging code not using UNIMPLEMENTED.
| * Tidy logging code not using UNIMPLEMENTED.Ian Rogers2014-10-241-2/+2
| | | | | | | | Change-Id: I7a79c1671a6ff8b2040887133b3e0925ef9a3cfe
| * Fix monitor visit for class initializerSebastien Hertz2014-09-091-6/+0
| | | | | | | | | | | | | | | | | | | | | | We do not hold class object's lock when invoking class initializer. Therefore it is wrong to visit it when looking for monitors owned by a thread. Bug: 17377924 (cherry picked from commit 6d06f1b34322d91226c9dcd61e53c2b6731f8bb6) Change-Id: I9a18c421297608dc3109624111f9fea021a16d24
| * Using the correct time for wait_start_ms when lock contention logging is enabledXin Guan2014-08-221-1/+1
| | | | | | | | | | | | Bug: 17208457 Change-Id: I35555e0acf3b37bb3776a62c64d59ae93403b237 (cherry picked from commit b894a19dfd668b6779de939cf5265b7e409d8809)
| * Merge "ART: Do not recursively abort when visiting locks in a bad state"Andreas Gampe2014-08-161-2/+11
| |\
| | * ART: Do not recursively abort when visiting locks in a bad stateAndreas Gampe2014-08-181-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids a nested abort in VisitLocks. Bug: 17080621, 16382675 (cherry picked from commit 760172c3ccd6e75f6f1a89d8006934e8ffb1303e) Change-Id: Id604976ac9dcac0e319fb25cab4d2cbc98d7ee24
* | | am b9001abf: Add extra logging for lock contentionMathieu Chartier2014-10-031-0/+9
|\ \ \ | | | | | | | | | | | | | | | | * commit 'b9001abff3a45f1ae90536da7dd1ec28a6ae0174': Add extra logging for lock contention
| * | | Add extra logging for lock contentionMathieu Chartier2014-10-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we get contention which is longer than kLongWaitMs (= 100ms) we log to logcat. Example output: W/art ( 9960): Long monitor contention event with owner method=void com.android.server.am.BroadcastQueue.processNextBroadcast(boolean) from BroadcastQueue.java:542 waiters=1 for 243ms Bug: 17787391 Change-Id: Id1f92d9c41ec909d221871ecc2ff6181dcec2ed4
* | | | am 652984e4: am 77c318d5: Merge "Fix monitor visit for class initializer" ↵Sebastien Hertz2014-09-091-6/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | into lmp-dev * commit '652984e4b32d06344fae8cad52524d4de7ac5c79': Fix monitor visit for class initializer
| * | | Fix monitor visit for class initializerSebastien Hertz2014-09-081-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not hold class object's lock when invoking class initializer. Therefore it is wrong to visit it when looking for monitors owned by a thread. Bug: 17377924 Change-Id: I7fddcdb9a554301e040c571971eec9be6cba5eda
* | | | am 1d4b6eff: am 1e4fbd8b: Merge "Using the correct time for wait_start_ms ↵Ian Rogers2014-08-221-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | when lock contention logging is enabled" into lmp-dev * commit '1d4b6eff25aa29cbbf4d216d65349e1ad38f962e': Using the correct time for wait_start_ms when lock contention logging is enabled
| * | | Using the correct time for wait_start_ms when lock contention logging is enabledXin Guan2014-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | Bug: 17208457 Change-Id: I35555e0acf3b37bb3776a62c64d59ae93403b237
* | | | am d75383af: am 5e8a63ae: Merge "ART: Do not recursively abort when visiting ↵Andreas Gampe2014-08-181-2/+11
|\| | | | |/ / |/| | | | | | | | | | | | | | locks in a bad state" into lmp-dev * commit 'd75383af2f0843ecd2f493fd64b4eb38630c6071': ART: Do not recursively abort when visiting locks in a bad state
| * | ART: Do not recursively abort when visiting locks in a bad stateAndreas Gampe2014-08-171-2/+11
| | | | | | | | | | | | | | | | | | | | | This avoids a nested abort in VisitLocks. Bug: 17080621, 16382675 Change-Id: Id604976ac9dcac0e319fb25cab4d2cbc98d7ee24
| * | Make Monitor::Wait more robust to spurious Inflate failures.Ian Rogers2014-08-151-26/+23
| |/ | | | | | | | | Bug: 17062710 Change-Id: Ife5f6b335caacc70cab543cd568676d277d3beb6
* | Tidy up monitor comments.Ian Rogers2014-08-151-34/+0
| | | | | | | | Change-Id: Ib9d993f964ba6e2bec1979b486c26d3920a4a40c
* | Make Monitor::Wait more robust to spurious Inflate failures.Ian Rogers2014-08-151-26/+23
|/ | | | | | Bug: 17062710 Change-Id: Ife5f6b335caacc70cab543cd568676d277d3beb6 (cherry picked from commit 6f22fc166ed6c11cad229bff442c064e704de101)
* Add GcRoot to clean up and enforce read barriers.Hiroshi Yamauchi2014-07-291-4/+4
| | | | | | | | | | | | | Introduce a value-type wrapper around Object* for GC roots so that 1) we won't have to directly add the read barrier code in many places and 2) we can avoid accidentally bypassing/missing read barriers on GC roots (the GcRoot interface ensures that the read barrier is executed on a read). The jdwp test passed. Bug: 12687968 Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
* ART: Clean up API after change 102631Andreas Gampe2014-07-251-1/+3
| | | | | | | | | This adds an abort_on_error parameter to GetCurrentMethod, which is by default true. This restores all previous behavior, except for monitor installation, where it follows 101639. Bug: 16556938 Change-Id: I9a12b9a21ccb9f558c86236bb58d15ff2fafaec0
* Recycle mem-maps for collector transitions.Mathieu Chartier2014-07-221-2/+2
| | | | | | | | | | | | | | | | | | | | We now create spaces when we need them for collector transitions or homogeneous compaction by recycling mem maps. Change the bump pointer space size to be as large as the heap capacity instead of 1/2 heap capacity like it used to be. For GSS, bump pointer spaces are set to 32MB currently. Changed GSS to have main space == non moving space since we don't need to copy from the main space. Fixes GC stress tests 074, 096. Fixed test 080 oom throw with -Xmx2m for GC stress test, this was broken since it was allocating a 4 MB array before starting the OOM process. Bug: 14059466 Bug: 16406852 Change-Id: I62877cfa24ec944a6f34ffac30334f454a8002fd
* Avoid race in single thread suspension.Ian Rogers2014-07-171-0/+2
| | | | | | | | Don't allow more than one concurrent single thread suspension to avoid potential cycles and deadlocks where threads try to suspend each other. Bug: 16364458, 16354227 Change-Id: I907f1d5591a6aa5c241d37d6b4a34f968f98df77
* Remove object_utils.h.Ian Rogers2014-07-161-1/+0
| | | | | | | | | Break into object_lock, field_helper and method_helper. Clean up header files following this. Also tidy some of the Handle code in response to compiler errors when resolving the changes in this CL. Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
* Use sched_yield in Monitor::MonitorEnter.Mathieu Chartier2014-07-151-1/+5
| | | | | | | | | | | | | | | | | | | Previously we used NanoSleep(1000), but this was unreliable. It could result in waiting for >= 40ms instead of 1us. Since this was in a loop it was especially bad if the GC was trying to suspend all the threads when we were sleeping. This resulted in thread suspension occasionally taking longer than a second. Results on the provided picasso-sample app on Nexus 5: Longest GC pause before: ~1.5s. Longest GC pause after: <5ms. Also added a warning if thread suspension takes longer than a threshold (currently 5ms). Bug: 16307460 External bug: https://code.google.com/p/android-developer-preview/issues/detail?id=367 Change-Id: I3c2a9636357e255f38634615101eff8ca84e632f
* Make CAS operations in Object use art::Atomic.Ian Rogers2014-07-101-2/+2
| | | | | | Make naming consistent with art::Atomic. Change-Id: If3abdb019ef8b53bd809e3fef3fd5248aeb27e9a
* Use memory chunks for monitors on LP64Andreas Gampe2014-07-101-12/+45
| | | | | | | | | | | | | | Monitor IDs in lock words are only 30b. On a 32b system that works fine, as memory is usually aligned enough that shifting works out. On 64b systems, the virtual memory space is too large for that. This adds memory chunks into which we allocate the monitors so that we have base_addr + offset and can use the offset as the monitor ID. To allow for relatively compact but growable storage, we use a list of chunks. Added a global lock for the monitor pool. Change-Id: I0e290c4914a2556e0b2eef9902422d7c4dcf536d
* ART: Update Monitor::Wait so it releases monitor_lock_ before throwing an ↵Elena Sayapina2014-07-071-3/+4
| | | | | | | | | | | | | exception Thread should release monitor_lock_ Mutex (which guards shared structures behind Java monitor) in Monitor::Wait before throwing any exception. Otherwise the thread may be suspended by GC during that time still holding the lock. This may cause deadlock during GC in case some other thread needs to acquire the monitor_lock_. The other thread can't be suspended by GC then waiting for exclusive lock and "thread suspend timeout" occurs. Change-Id: Id02f45052e1cfc01e676a43434125817564d7874 Signed-off-by: Elena Sayapina <elena.v.sayapina@intel.com>
* Add logging to monitor deflation.Mathieu Chartier2014-06-241-5/+14
| | | | Change-Id: I0251ff19e0a3c3b9edc7c7e296f15eb3229f8f7c
* Change MethodHelper to use a Handle.Mathieu Chartier2014-06-091-6/+4
| | | | | | | | | | | Added ConstHandle to help prevent errors where you modify the value stored in the handle of the caller. Also fixed compaction bugs related to not knowing MethodHelper::GetReturnType can resolve types. This bug was present in interpreter RETURN_OBJECT. Bug: 13077697 Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
* Clean up and augment Atomic class. Replace QuasiAtomic MemBars.Hans Boehm2014-06-061-1/+1
| | | | | | | | | | | | | | | | | | Add a number of missing C++11 operations to Atomic class. Invoke the 64 bit routines in QuasiAtomic when necessary. Replace QuasiAtomic membars with fences that correspond to C++11 fences. QuasiAtomic was moved to the top of the file. Only fence implementations actually changed. This replaces some buggy uses of MembarStoreStore, as reported in b/14685856 . Avoid some redundant fences for long volatile operations. Incompletely converts low-level memory access operations to Atomic. Change-Id: Iea828431a0cea46540eb74fcaa02071cab6fdcda
* Merge "Revert "Revert "Fix an outstanding compaction bug in interpreter."""Mathieu Chartier2014-05-231-1/+1
|\
| * Revert "Revert "Fix an outstanding compaction bug in interpreter.""Mathieu Chartier2014-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | Fixed the generic trampoline to not use ToJObject when unnecessary. Bug: 15167269 This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459. Change-Id: I0525d0e0f3afb753c770e1572070a0fa22b02271
* | Make the specification of when we need precise constants more precise.Ian Rogers2014-05-231-1/+1
|/ | | | | | | | | Means that oatdump output showing values for deoptimization actually reflects what we see at runtime. Also, doesn't do precise in the case of determining methods and fields for the quickened case, which may be an occasional performance win. Change-Id: I62c7fb244f7996ba9d52e7a7ce75c046b663fa17
* Merge "Revert "Fix an outstanding compaction bug in interpreter.""Mathieu Chartier2014-05-221-1/+1
|\
| * Revert "Fix an outstanding compaction bug in interpreter."Mathieu Chartier2014-05-221-1/+1
| | | | | | | | | | | | This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582. Change-Id: I48036306130d5ccfec683d0dc3e9a642a02ee9c1
* | Move SetMonitorEnterObject outside of blocked thread state change.Mathieu Chartier2014-05-221-2/+2
| | | | | | | | | | | | | | | | | | | | Race condition: Thread is suspended in monitor kBlocked, GC decides to run the checkpoint on it. The GC sees that the object is non null, and goes to mark it, but then the thread does SetMonitorObject(nullptr). Which causes a null object to be marked. Change-Id: Ie8a5074112947ec07d01ccb813ca2c1bb9ac7066
* | Merge "Fix an outstanding compaction bug in interpreter."Mathieu Chartier2014-05-221-1/+1
|\|