summaryrefslogtreecommitdiff
path: root/runtime/native/dalvik_system_VMStack.cc
AgeCommit message (Collapse)Author
2024-06-20Change CreateInternalStackTrace to return a mirror::Object. Nicolas Geoffray
It might be called in a context where there isn't a JNI frame (for example when throwing in the runtime). So return a mirror::Object instead of jobject. Test: 107-int-math2 with gcstress Change-Id: I72ea87db8cf5092e636901d1114034e81de13146
2024-04-08Remove use of std::iterator and std::result_of Ryan Prichard
std::iterator was deprecated in C++17. std::result_of was removed in C++20. Bug: 333165689 Test: art_standalone_libartbase_tests Change-Id: Id60f82a0368062416663a20d0b8e9a109fdac9cc
2024-01-15Add visibility attributes in runtime/native Dmitrii Ishcheikin
Don't add visibility attributes in dalvik_system_VMRuntime.{h,cc} for now, because it breaks some apps. Bug: 260881207 Test: launch app from b/319255249 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: I538c4f82a753c71fb9d008762d09ada5e1273427
2024-01-10Revert "Add visibility attributes in runtime/entrypoints and runtime/native" Daniel Chapin
This reverts commit 3d10d9399776f36955bdcd7d75a5e0fe8648d020. Reason for revert: b/319255249 Change-Id: I46c96f5ae78606a7c7c6e2df7368ca1b3362d501
2024-01-05Add visibility attributes in runtime/entrypoints and runtime/native Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: I9481b7d876f6dd3a65cfc825b9b3f475c43131aa
2023-12-20Revert^18 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit 8bc6a58df7046b4d6f4b51eb274c7e60fea396ff. PS1 is identical to https://android-review.git.corp.google.com/c/platform/art/+/2746640 PS2 makes the following changes: - Remove one DCHECK each from the two WaitForFlipFunction variants. The DCHECK could fail if another GC was started in the interim. - Break up the WaitForSuspendBarrier timeout into shorter ones. so we don't time out as easily if our process is frozen. - Include the thread name for ThreadSuspendByThreadIdWarning, since we don't get complete tombstones for some failures. Test: Treehugger, host tests. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 Bug: 295880862 Bug: 294334417 Bug: 301090887 Bug: 313347640 (and more) Change-Id: I12c5c01b1e006baab4ee4148aadbc721723fb89e
2023-12-19Revert^17 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit c6371b52df0da31acc174a3526274417b7aac0a7. Reason for revert: This seems to have two remaining issues: 1. The second DCHECK in WaitForFlipFunction is not completely guaranteed to hold, resulting in failures for 658-fp-read-barrier. 2. WaitForSuspendBarrier seems to time out occasionally, possibly spuriously so. We fail when the futex times out once. That's probably incompatible with the app freezer. We should retry a few times. Change-Id: Ibd8909b31083fc29e6d4f1fcde003d08eb16fc0a
2023-12-19Revert^16 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit a43e67ea1a314e5c6faf77457ffc5ea39c24d4ca. PS1 is identical to aosp/2725875 . PS2 improves static and dynamic lock checking and makes the documentation more precise. ThreadList::Unregister for a thread that wasn't registered becomes fatal; I can't convince myself that any reasonable recovery is possible, and we could otherwise turn an obvious error into a very subtle and potentially dangerous one. Perhaps controversially, we now REQUIRE thread_list_lock_ for IncrementSuspendCount, eventhough that requires a kludge in the one case in which we legitimately don't have it. But after thinking about it, the extra checking and documentation outweighs the kludge, and we may want to consider this elsewhere as well. Added FakeMutexLock to enable the kludge here and elsewhere. PS3 adds some documentation for thread lifetime rules and enforces a sufficient, though in some cases overly strong, set of related restrictions for EnsureFlipFunctionStarted. It ensures that callers conform to this stronger restriction. This required a simplification in StackUtil::GetThreadListStackTraces. PS4 Fix lint issue. Add Thread lifetime DCHECK to WaitForFlipFunction. Rebase to adjust for the fact that aosp/2813551 effectively merged a small piece of this. PS5 Add Thread::VerifyState(). We previouslly checked for kTerminated in a couple of places. That doesn't make sense, since we have no way to tell whether the thread has been deallocated and reallocated at that point. Instead of checking that the state is not kTerminated, just check that it is a sane value. Address some old reviewer comments. Add more output for EnsureFlipFunctionStarted DCHECK. RequestSynchronousCheckpoint now aborts rather than returning false when invoked on a terminated thread. Seeing kTerminated would mean the thread could have been destroyed, and thus this call was unsafe. PS6 Add another VerifyState call to RequestSynchronousCheckpoint. PS7 Rebase and add more ThreadExitFlag tests. PS8 Rebase. Temporary workaround for compile error. PS9 Remove PS8 workaround. Add a version of GetPeerFromOtherThread that expects thread_list_lock_ to be initially held, and relies on ThreadExitFlag to detect terminated threads. Modify several jvmti clients to use this correctly. This effectively includes a fixed version of aosp/2847246. PS10 Work around the fact that GetReferenceKind in ti_heap.cc may call GetPeerFromOtherThread with or without thread_list_lock_. I think this is kind of benign, though it makes reasoning harder, and weakens our debug checking. PS11 Remove extra semicolon. PS12 Add another DCHECK in UnregisterThreadExitFlag. PS13 Minor tweaks to address reviewer comments. PS14 More tweaks to address reviewer comments. PS15 Do not report that a thread exited while its flip-function is still running. PS16 Fix comment typo. Test: Treehugger Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 Bug: 295880862 Bug: 294334417 Bug: 301090887 Bug: 313347640 (and more) Change-Id: I44caa30a0a4da8ab105fedd4d2238f59efc1d675
2023-09-09Revert "Revert^14 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit f9fdd3ce0180972dc8d4f0c8410ea7702828a703. Reason for revert: Very suspicious host-x86_64-debug failure on LUCI. Change-Id: Ia01dd3df8d64d6bc0d12319b06a8380f64a46785
2023-09-09Revert^14 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit 2a52e8a50c3bc9011713a085f058130bb13fd6a6. PS1 is identical to aosp/2710354. PS2 fixes a serious bug in the ThreadExitFlag list handling code. This didn't show up in presubmit because the list rarely contains more than a single element. Added an explicit gtest, and a bunch of DCHECKS around this. PS3 Rebase and fix oat version. Once more. PS4 Weaken CheckEmptyCheckpointFromWeakRefAccess check to allow weak reference access in a checkpoint. This happens via DumpLavaStack -> ... -> MonitorObjectsStackVisitor -> ... -> FindResolvedMethod -> ... -> IsDexFileRegistered. I haven't yet been able to convince myself that this is inherently broken, though it is trickier than I would like. PS5 Move cp_placeholder_mutex_ declaration higher in thread.h. Test: m test-art-host-gtest Change-Id: I66342ef1de27bfa0272702b5e1d3063ef8da7394
2023-08-24Revert "Revert^12 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit 996cbb566a5521ca3b0653007e7921469f58981a. Reason for revert: Some new intermittent master-art-host buildbot failures look related and need investigation. PS2: Fix oat.h merge conflict by not letting the revert touch it. PS3: Correct PS2 to actually bump the version once more instead. Change-Id: I70c46dc4494b585768f36e5074d34645d2fb562a
2023-08-23Revert^12 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit b6f3b439d4f12e89393ba8101eea8671c94ba237. PS1: Identical to aosp/2652371 . PS2: Introduce kSuspensionImmune to disable suspension of a thread that is being relied upon to execute ResumeAll(). This replaces the test in SuspendAll() to check whether the caller was being asked to suspend itself. That test was deadlock-prone, since a SuspendAll request from e.g. the GC to block, and GC progress might be required to resume the thread running the GC. Since SuspendAll() now only loops for a single reason, we no longer need to track why we looped. Reduce the number of iterations in each 129-ThreadGetId thread drammatically. PS3: Address reviewer comments, including fixing a newly introduced bug in CheckSuspend(). Fix 129-GetThreadId by drammatically reducing the iteration count when we appear to be running slowly, which is normally the case for gcstress. Earlier versions of this CL were apparently also failing on this test, but the failure was hidden by other failures. This mostly undoes the PS2 change to this test, now that the failure is better understood. PS4: Rebase. PS5: Fix 129-GetThreadId code formatting. PS6: Address more reviewer comments related to 129-GetThreadId. PS7: Remove DCHECK in EnsureFlipFunctionStarted. It was unsafe, since the thread may no longer be around. Test: Treehugger. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 Bug: 295880862 Bug: 294334417 (and more) Change-Id: I99260fdc4feb9bcdc8b8b566e40912532f1a4937
2023-08-15Revert "Revert^10 "Thread suspension cleanup and deadlock fix"""" Hans Boehm
This reverts commit 2caa640269faabd2455ec29cfe6ad330d442b715. Reason for revert: It looks like there may be some new timeout failures on the master-art-host buildbot. I'll go ahead and generate a revert. Please submit once there are enough failures to investigate. Change-Id: I272e4ac5f4367a12a2eb027e456d789e8fd26ae6
2023-08-14Revert^10 "Thread suspension cleanup and deadlock fix""" Hans Boehm
This reverts commit 63af30b8fe8d4e1dc32db4dcb5e5dae1efdc7f31. master (aosp/2530206) PS1 is identical to aosp/2377951 . master (aosp/2530206) PS2 is a rebase. At this point, master branch was replaced by main, and this CL moved. PS1: Restructure documentation for the IncrementSuspendCount handshake to install a suspend barrier. Document a couple of additional mutator lock assumptions. Add some DCHECKs to check that suspended threads really are suspended. Weaken seq_cst memory order in a couple of places where it really didn't make sense here. Clearly not a correctness fix. Includes a rebase and merge with aosp/2587606. PS2: Another rebase. Fix thumb assembler test to compensate for Thread structure layout changes. PS3: Messy rebase, primarily to handle aosp/2670108, which included both new fixes around this and a few small snippets of this CL. Call EnsureFlipFunctionStarted without a state-and-flags argument only when we actually hold the mutator lock, as promised. PS4: Minor rebase, some lint fixes. PS5: Another minor lint fix that I had missed in PS4. PS6: Fix for RunCheckpoint bug introduced around PS3. Fix expectations in jni_cfi_test to compensate for thread structure layout changes. PS7: In PS3+, EnsureFlipFunctionStarted could access a destroyed "this" thread. Fix that, and make the function static to make this constraint more explicit. (And running a method on a potentially destroyed object just seemed unclean.) PS8: Address reviewer comments. The major issue was that we released the suspend_count_lock too early in FlipThreadRoots, potentially allowing an intervening SuspendAll to block us. The fix involved a very minor extention of the mutex API. PS9: Comment typo fix. PS10: Address new reviewer comments. Rebase. MUST_SLEEP for 129_ThreadGetId debug output. Test: Treehugger. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 (and more) Change-Id: I0f2450e394c03c17eece3698286b2f3e45727967
2023-03-29Revert "Revert^8 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit 221b6c5fcd66d4b6f2626c311d03bde2fb1589f9. Reason for revert: Preemptive revert. Earlier versions have had a tendency to cause subtle breakage. Please do not submit unless something breaks. Change-Id: Iad2a7f920756f365789c422948632f5db5a28fd5
2023-03-29Revert^8 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit c85ae17f8267ac528e58892099dcefcc73bb8a26. PS1: Identical to aosp/2266238 PS2: Address the lint failure that was the primary cause of the revert. Don't print information about what caused a SuspendAll loop unless we actually gathered the information. Restructure thread flip to drop the assumption that certain threads will shortly become Runnable. That added a lot fo complexity and was deadlock-prone. We now simply try to run the flip function both in the target thread when it tries to become runnable again, and in the requesting thread, without paying attention to the target thread's state. The first attempt succeeds. Which means the originating thread will only succeed if the target is still suspended. This adds some complexity to deal with threads terminating in the meantime, but it avoids several issues: 1) RequestSynchronousCheckpoint blocked with thread_list_lock and suspend_count_lock, while waiting for flip_function to become non-null. This made it at best hard to reason about deadlock freedom. Several other functions also had to wait for a null flip_function, complicating the code. 2) Synchronization in FlipThreadRoots was questionable. In order to tell when to treat a thread as previously runnable, it looked at thread state bits that could change asynchronously. AFAICT, this was probably correct under sequential consistency, but not with the actual specified memory ordering. That code was deleted. 3) If a thread was intended to become runnable shortly after the start of the flip, we paused it until all thread flips were completed. This probably occasionally added latency that escaped our measurements. Weaken several assertions involving IsSuspended() to merely claim the thread is not runnable, to be consistent with the above change. The stringer assertion no longer holds in the flip function. Assert that we never suspend while running the GC, to ensure the GC never acts on a thread suspension request, which would likely result in deadlock. Update mutator_gc_coord.md to reflect additional insights about this code. Change the last parameter of DecrementSuspendCount to be a boolean rather than SuspendReason, since we mostly ignore the precise SuspendReason. Add NotifyOnThreadExit mechanism so that we can tell whether a thread exited, even if we release thread_list_lock_. Rewrite RequestSynchronousCheckpoint to take advantage of the above. The new thread-flip code also uses it. Remove now unnecessary checks that we do not suspend with a thread flip in progress. Various secondary changes and simplifications that follow from the above. Reduce DefaultThreadSuspendTimeout to something below ANR timeout. Explicitly ensure that when FlipThreadRoots() returns, all thread flips have completed. Previously that was mostly true, but actually guaranteed by barrier code in the collector. Remove that code. (The old version was hard to fix in light of potential exiting threads.) PS3: Rebase PS4: Fix and complete PS2 changes. PS5: Edit commit message. PS6: Update entry_points_order_test, again. PS7-8: Address many minor reviewer comments. Remove more dead code, including all the IsTransitioningToRunnable stuff. PS9: Slightly messy rebase PS10: Address comments. Most notably: SuspendAll now ensures that the caller is not left with a pending flip function. GetPeerFromOtherThread() sometimes runs the flip function instead of calling mark. The old way would not work for CMC. This makes it no longer const. PS11: Fix a PS10 oversight, mostly in the CMC collector code. PS12: Fix comment and documentation typos. Test: Run host run tests. TreeHugger. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Change-Id: I81e366d4b739c5b48bd3c1509acb90d2a14e18d1
2023-01-06Revert "Revert^6 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit fe9b34f845e8e439b4ae47ae999ef2cfdbd66462. Reason for revert: Breaks full-eng build Change-Id: I230b31809e274740b8fae9358c260787462efe4d
2023-01-06Revert^6 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit 0db9605ec8bd3158f4f0107a511dd09a889c9341. PS1: Identical to aosp/2255904 PS2: Detect and report excessive waiting for a suspend-friendly state. Add internal timeout to 129-ThreadGetId, so that we can print more state information on exit. We explicitly avoid suspending the HeapTaskDaemon to retrieve its stack trace. Fix a race that allowed this to happen anyway (with very low probability). Includes a slightly nontrivial rebase. PS3: Address a couple of minor comments. PS4: Reformatted, as suggested by the upload script, except for tls_ptr_sized_values, where it seemed too likely to cause unnecessary merge conflicts. PS5: SuspendAllInternal does not hold mutator lock, but may take a long time with suspend_all_count_ = 1. Another thread waiting for suspend_all_count_ could sleep many times. Explicitly wait on a condition variable instead. This intentionally has a low kMaxSuspendRetries so that we can see whether it is hit in presubmit. PS6: Adjust kMaxSuspendRetries to a bit lower than the PS3/PS4 version, but much higher than the PS5 debug version. Test: Build and boot AOSP, Treehugger Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Change-Id: I58d63f494a7454e00473b23864f8952abed7bf6f
2022-10-22Revert "Revert^4 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit a23d325152c7cd81ccb426a407f6da280797e61d. Reason for revert: Triggered failures in org.apache.harmony.jpda.tests.jdwp.Events_CombinedEventsTest#testCombinedEvents_05 Change-Id: I0604a60f73a983c92e29827222bfa6158ee043aa
2022-10-21Revert^4 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit ebd76406bf5fa74185998bc29f0f27c20fa2e683. PS1 is identical to aosp/2216806. PS2 in addition converts the RunCheckpoint call used from StackUtil::GetAllStackTraces to RunCheckpointUnchecked to temporarily work around another checkpoint Run() function lock ordering issue. PS3 is a nontrivial rebase. Test: Build and boot AOSP, Treehugger Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Change-Id: I38385e41392652cc30e5e74fd8b93e22088827a5
2022-10-13Revert "Revert^2 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit fd20a745227aa7cae7a08728bb29e5bfce64ea87. Reason for revert: Lots of libartd failures due to new checkpoint lock level check. Change-Id: I0cf88ff893f8743a9a830a49489807d0921199a3
2022-10-12Revert^2 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit 7c8835df16147b9096dd4c9380ab4b5f700ea17d. PS1 is identical to aosp/2171862 . PS2 makes the following significant changes: 1) Avoid inflating locks from the thread dumping checkpoint Run() method. This violates the repeatedly stated claim that checkpoint Run() methods don't suspend threads. This requires that we print object addresses in thread dumps in some cases in which we were previously able to give hashcodes instead. 2) For debug builds, check that we do not acquire a higher level lock in checkpoint Run() methods, thus enforcing that previously stated property. (Lokesh suggested this, and I think it's a great idea. But it requires changes 4-6 below.) 3) Add a bit more justification that RunCheckpoint cannot result in circular suspend requests. 4) For now, allow an explicit override of (2) for ddms code in which it would otherwise fail. This should be fixed later. 5) Raise the level of monitor locks, to correctly reflect the fact that they may be held while much of the runtime is executed. 6) (5) was in conflict with monitor deflation acquiring a monitor lock after acquiring the monitor list lock. But this failure is spurious, both because it is a TryLock acquisition that can't possibly contributed to a deadlock, and secondly because it conflates all monitor locks, and an actual deadlock is probably not possible anyway. Leverage the former and add a facility to avoid checking for safe TryLock calls. (1) Should fix the one failure I managed to debug after the last submission attempt. Hopefully it also accounts for the others. PS3, PS5, PS6: Trivial corrections and cleanups PS4, PS7, PS8: Rebase Test: Build and boot AOSP, Treehugger Bug: 240742796 Bug: 203363895 Bug: 238032384 Change-Id: I80d441ebe21bb30b586131f7d22b7f2797f2c45f
2022-09-10Revert "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit 7c39c86b17c91e651de1fcc0876fe5565e3f5204. Reason for revert: We're see a number of new, somewhat rare, timeouts on multiple tests. Change-Id: Ida9a4f80b64b6fedc16db176a8df9c2e985ef482
2022-09-09Thread suspension cleanup and deadlock fix Hans Boehm
Have SuspendAll check that no other SuspendAlls are running, and have it refuse to start if the invoking thread is also being suspended. This limits us to a single SuspendAll call at a time, but that was almost required anyway. It limits us to a single active SuspendAll-related suspend barrier, a large simplification. It appears to me that this avoids some cyclic suspension scenarios that were previously still possible. Move the deadlock-avoidance checks for flip_function to ModifySuspendCount callers instead of failing there. Make single-thread suspension use suspend barriers to avoid the complexity of having to reaccess the thread data structure from another thread while waiting for it to suspend. Add a new data structure to remember the single thread suspension barriers without allocating memory, This uses a linked list of stack allocated data structures, as in MCS locks. The combination of the above avoids a suspend_barrier data structure that can overflow, and removes any possibility of ModifySuspendCount needing to fail and retry. Recombine ModifySuspendCount and ModifySuspendCountInternal. Simplified barrier decrement in PassActiveSuspendBarriers. Strengthened the relaxed memory order, it was probably wrong. Fix the "ignored" logic in SuspendAllInternal. We only ever ignored self, and ResumeAll didn't support anything else anyway. Explicitly assume that the initiating thread, if not null, is registered. Have SuspendAll and friends only ignore self, which was the only actually used case anyway, and ResumeAll was otherwise wrong. Make flip_function atomic<>, since it could be read while being cleared. Remove the poorly used timed_out parameter from the SuspendThreadByX(). Make IsSuspended read with acquire semantics; we often count on having the target thread suspended after that, including having its prior effects on the Java state visible. The TransitionTo... functions already use acquire/release. Shrink the retry loop in RequestSynchronousCheckpoint. Retrying the whole loop appeared to have no benefit over the smaller loop. Clarify the behavior of RunCheckpoint with respect to the mutator lock. Split up ModifySuspendCount into IncrementSuspendCount and DecrementSuspendCount for improved clarity. This is not quite a semantic no-op since it eliminates some redundant work when decrementing a suspend count to a nonzero value. (Thanks to Mythri for the suggestion.) I could not convince myself that RequestCheckpoint returned false only if the target thread was already suspended; there seemed to be no easy way to preclude the state_and_flags compare-exchange failing for other reasons. Yet callers seemed to assume that property. Change the implementation to make that property clearly true. Various trivial cleanups. This hopefully reduces thread suspension deadlocks in general. We've seen a bunch of other bugs that may have been due to the cyclic suspension issues. At least this should make bug diagnosis easier. Test: ./art/test/testrunner/testrunner.py --host --64 -b Test: Build and boot AOSP Bug: 240742796 Bug: 203363895 Bug: 238032384 Change-Id: Ifc2358dd6489c0b92f4673886c98e45974134941
2021-11-25Always access Thread state and flags as 32-bit location. Vladimir Marko
Rewrite access to Thread's state and flags to use 32-bit atomic operations. Avoid `volatile` accesses that prevent compiler optimizations. Change `ThreadState` and `ThreadFlag` to `enum class`es. Golem results for art-opt-cc (higher is better): linux-ia32 before after NativeDowncallStaticNormal 28.162 35.323 (+25.43%) NativeDowncallStaticNormal6 26.447 32.951 (+24.59%) NativeDowncallStaticNormalRefs6 NativeDowncallVirtualNormal 27.972 35.027 (+25.22%) NativeDowncallVirtualNormal6 26.096 32.131 (+23.13%) NativeDowncallVirtualNormalRefs6 25.922 31.873 (+22.95%) linux-x64 before after NativeDowncallStaticNormal 26.987 34.380 (+27.40%) NativeDowncallStaticNormal6 25.424 31.096 (+22.31%) NativeDowncallStaticNormalRefs6 25.086 30.602 (+21.99%) NativeDowncallVirtualNormal 26.812 33.234 (+23.95%) NativeDowncallVirtualNormal6 25.086 30.617 (+22.05%) NativeDowncallVirtualNormalRefs6 25.086 30.602 (+21.99%) linux-armv7 before after NativeDowncallStaticNormal 7.2394 7.9523 (+9.848%) NativeDowncallStaticNormal6 6.8527 7.4888 (+9.283%) NativeDowncallStaticNormalRefs6 6.3976 6.9444 (+8.547%) NativeDowncallVirtualNormal 7.2081 7.9130 (+9.779%) NativeDowncallVirtualNormal6 6.8527 7.4888 (+9.283%) NativeDowncallVirtualNormalRefs6 6.3168 6.8527 (+8.483%) linux-armv8 before after NativeDowncallStaticNormal 7.0389 7.5973 (+7.933%) NativeDowncallStaticNormal6 6.8527 7.3783 (+7.670%) NativeDowncallStaticNormalRefs6 6.2924 6.8226 (+8.427%) NativeDowncallVirtualNormal 6.8527 7.3783 (+7.670%) NativeDowncallVirtualNormal6 6.5604 7.0423 (+7.344%) NativeDowncallVirtualNormalRefs6 6.1408 6.5329 (+6.386%) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing --interpreter Bug: 172332525 Bug: 143299880 Change-Id: Ib55d457ad8f5d9e1159b681dfd279d1f9cfb2af7
2021-05-25Improve suspension timeout diagnostic and fix race Hans Boehm
Fix a data race on state_and_flags. Since the access was volatile and there are system calls in the loop, this is extremely unlikey to have casused the bug here, but ... So, assuming this is still broken, produce more informative output once we time out. Remove unused argument from SuspendThreadByPeer(). It made the logic more complicated and made it harder to reason about correctness. Remove dead code after LOG(FATAL, ...) Bug: 181778559 Test: TreeHugger, temporarily paste log message into hotter path. Change-Id: I6f3455925b3a3f4726a870150aeb54ea60a38d67
2020-05-05Clean up internal stack trace construction. Vladimir Marko
Simplify the code by ignoring active transactions. Writing to fields of a newly allocated object does not need to be recorded as aborting the transaction removes all references to the new object and it's unnecessary to roll back writes to unreachable object's fields. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Change-Id: Ia91d3274398b0ca0f5b0040dcf323921d915b657
2018-10-23ART: Refactor for bugprone-argument-comment Andreas Gampe
Handles runtime. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: Ibc0d5086809d647f0ce4df5452eb84442d27ecf0
2018-09-07ART: Continue adding override annotations Andreas Gampe
Use Clang-tidy's modernize-use-override to add more annotations. Ignore inferred annotations on destructors. Bug: 32619234 Test: mmma art Change-Id: Ic432c928e398d44df9171e42db04ee19946e6887
2018-05-09ART: Move JNI files to runtime/jni/ . Vladimir Marko
Test: Rely on TreeHugger. Change-Id: I9cae11191ef1567ae9453be498882a7767285140
2018-01-08ART: Add support for VMStack.getAnnotatedStackTrace Andreas Gampe
Add Thread.CreateAnnotatedStackTrace to return an array that contains an AnnotatedStackTraceElement for each stack frame, with the StackTraceElement describing the frame, an array containing all objects that are locked at the described location, and optionally for the top frame an object the thread is blocked on, waiting for or sleeping on. Add a test. Bug: 70538431 Test: m test-art-host Test: art/test/testrunner/testrunner.py -b --host -t 168 Change-Id: I0d92e3d8182c4a592549a6445854816f71afd29e
2017-12-27ART: Refactor VMStack code Andreas Gampe
Make GetThreadStack generic wrt/ a function being called to generate the stack. In preparation for new code. Bug: 70538431 Test: m test-art-host Change-Id: I7e2b6583b28ad89bc645acdc9549f2f0a25ea055
2017-07-24ART: Include cleanup Andreas Gampe
Let clang-format reorder the header includes. Derived with: * .clang-format: BasedOnStyle: Google IncludeIsMainRegex: '(_test|-inl)?$' * Steps: find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup' git-clang-format -style=file HEAD^ manual inspection git commit -a --amend Test: mmma art Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
2017-07-13Add Jvmti Suspend/ResumeThread functions Alex Light
Enable the can_suspend jvmti capability and implement all required functionality associated with it. Test: ./test.py --host -j40 Bug: 34415266 Bug: 62821960 Bug: 63579748 Change-Id: I83b92de7f81622e1658114b034918e8295805b6e
2017-06-30Add SuspendReason enum and change Suspension functions. Alex Light
More self-documenting and more type safe. Bug: 62821960 Test: ./test.py Change-Id: Ic7a1ae6a25e687d65f5aa10c1aad54a7b80dd086
2017-06-01ART: Move RegisterNatives helper Andreas Gampe
Move the helper closer to the users. Test: m test-art-host Change-Id: Id05ce5f60af54d0c5aef0c7d8932706c4602fc94
2017-05-30ART: More header cleanup - jni_internal.h Andreas Gampe
Move jni_macros.h to the clients (users of RegisterNativeMethods). Test: mmma art Change-Id: I052ac9f703ec69f0a2df1efcaf9f4a450eb7be1c
2017-02-21jni: Switch to @FastNative for all JNI functions. Deprecate !bang JNI. Igor Murashkin
Switches all (248) methods that previously used !bang JNI in art/libcore to all use @FastNative. Also deprecate !bang JNI since nothing in Android seems to (or should be) using it anymore. This measures to be a 3% startup time improvement in system_server. Test: make test-art-host Bug: 34955272 Change-Id: I0881f401c7660c79f275235362777bfa58241deb
2017-02-14Add a DCHECK in thread::GetPeer. Nicolas Geoffray
Motivated by https://android-review.googlesource.com/#/c/333205/. Test: test-art-host run-jdwp-test.sh Change-Id: I173c060324aa0dc39144db55e3a97e672c012ba8
2017-01-12Avoid suspending heap task thread for getting stack traces Mathieu Chartier
Instead of suspending the heap task thread, GetThreadStack (called by VMStack_fillStackTraceElements and VMStack_getThreadStackTrace) will return an empty thread stack. This fixes possible deadlocks caused by suspending the GC thread and doing allocations for the stack trace. Bug: 28261069 Test: test-art-host Change-Id: I45a0b8ac94a99d6bbcfcdc2b41afadf941ec0138
2016-10-17Move art/native to ObjPtr Mathieu Chartier
Bug: 31113334 Test: test-art-host Change-Id: I67eb89cf042c762c6dcd5eb8b008b9a28e9b3319
2016-09-29Clean up ScopedThreadStateChange to use ObjPtr Mathieu Chartier
Also fixed inclusion of -inl.h files in .h files by adding scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h Changed AddLocalReference / Decode to use ObjPtr. Changed libartbenchmark to be debug to avoid linkage errors. Bug: 31113334 Test: test-art-host Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
2016-08-30ART: SHARED_REQUIRES to REQUIRES_SHARED Andreas Gampe
This coincides with the actual attribute name and upstream usage. Preparation for deferring to libbase. Test: m Test: m test-art-host Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
2015-09-11Add and use ScopedSuspendAll Mathieu Chartier
Usage replaces most SuspendAll and ResumeAll calls. Change-Id: I355683a5365876242cea85a656dcb58455f7a294
2015-09-03Add ScopedThreadSuspension Mathieu Chartier
Fixes the TransitionFromRunnableToSuspended and TransitionFromSuspendedToRunnable pattern that was prone to errors. Change-Id: Ie6ae9c0357c83b4fc4899d05dfa0975553170267
2015-07-22Move to newer clang annotations Mathieu Chartier
Also enable -Wthread-safety-negative. Changes: Switch to capabilities and negative capabilities. Future work: Use capabilities to implement uninterruptible annotations to work with AssertNoThreadSuspension. Bug: 20072211 Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
2015-05-29Move mirror::ArtMethod to native Mathieu Chartier
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 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
2015-05-11Add a flag to StackVisitor for inlining. Nicolas Geoffray
The flag tells whether the stack walk needs to include inlined Java frames. This does not do anything just yet, as we're not inlining anyways. Change-Id: I716e25094fe56fa335ca1f9a398c1bcdba478e73
2015-04-21Class.forName(..., ..., null) fixes Brian Carlstrom
- Add test for Class.forName(..., ..., null) - Simplify VMStack.getClosestUserClassLoader based on new behavior of Class.forName(..., ..., null) Change-Id: I6bc470e20fa177e8a3debe55c90a84eef7ef518e
2014-11-12Modify the behavior of thread suspend shootouts. Ian Rogers
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