summaryrefslogtreecommitdiff
path: root/runtime/monitor_test.cc
AgeCommit message (Collapse)Author
2024-01-25Add visibility attributes in runtime/m* Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Ice9204277b257c6e3c25adb690bddfd834d24689
2024-01-02Refactoring of ThreadPool Nicolas Geoffray
Introduce AbstractThreadPool for managing threads, and a subclass ThreadPool for handling a regular task queue. This is to prepare for a custom JIT thread pool with multiple queues. Test: test.py Change-Id: I180032d14b8946ea6787252bd4fe4c89409e089b
2023-03-16Use global `jobject`s in `MonitorTest`. Vladimir Marko
Using `Handle<>` across multiple threads in inherently racy as seen in a recent crash in automated testing. Test: m test-art-host-gtest Bug: 267366638 Change-Id: Ibcc8581481cc9878900d1c064788559bf0b1b1c7
2022-10-14ART: Speed up some gtests. Vladimir Marko
Avoid creating `Runtime` or create the `Runtime` with a boot image to make the test setup faster. Test: m test-art-host-gtest Test: run-gtests.sh Change-Id: I3f09de81491402442f1704d25bb06de995d8a3ca
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
2018-10-29Modernise code to use std::make_unique Yi Kong
Generated by clang-tidy. Test: m checkbuild Change-Id: Idb24960d9326c0d94ab5d04b18deb0894d23da9f
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-08-28Use 'final' and 'override' specifiers directly in ART. Roland Levillain
Remove all uses of macros 'FINAL' and 'OVERRIDE' and replace them with 'final' and 'override' specifiers. Remove all definitions of these macros as well, which were located in these files: - libartbase/base/macros.h - test/913-heaps/heaps.cc - test/ti-agent/ti_macros.h ART is now using C++14; the 'final' and 'override' specifiers have been introduced in C++11. Test: mmma art Change-Id: I256c7758155a71a2940ef2574925a44076feeebf
2018-03-05Move most of runtime/base to libartbase/base David Sehr
Enforce the layering that code in runtime/base should not depend on runtime by separating it into libartbase. Some of the code in runtime/base depends on the Runtime class, so it cannot be moved yet. Also, some of the tests depend on CommonRuntimeTest, which itself needs to be factored (in a subsequent CL). Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
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-21ART: Move FillHeap to CommonRuntimeTest Andreas Gampe
Refactor common functionality. Clean up the code. Test: m test-art-host-gtest-monitor_test Test: m test-art-host-gtest-reg_type_test Change-Id: Ia8b678ab0a84ac76ee162dbc202d3363e9e9c02f
2017-02-14ART: Add operator == and != with nullptr to Handle Andreas Gampe
Get it in line with ObjPtr and prettify our code. Test: m Change-Id: I1322e2a9bc7a85d7f2441034a19bf4d807b81a0e
2016-11-03ART: Make Handle trivially-copyable Andreas Gampe
Use default copy constructor and copy assignment to make Handle trivially copyable. Do the same for MutableHandle. Fix up unused Handle warnings. Add asserts in the HandleScope test. Bug: 32619234 Test: m test-art-host Change-Id: I151f0bdbeeb131a6fc5c44610f345663ebe96c09
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
2016-07-29Revert "Revert "Use try lock to fix class resolution race"" Mathieu Chartier
Fix possible deadlock in EnsureResolved caused by interaction with GC. Since we were sleeping while holding the mutator lock, it could block thread suspension. This would deadlock if the thread that had locked h_class is already suspended since we would spin forever and not make progress. Bug: 27417671 Bug: 30500547 Test: test-art-host ART_TEST_GC_STRESS=true This reverts commit 69bf969c055c31a75d17ea92aeee756042678114. Change-Id: Id8750df065dc3b9ef7dc874f2eb2cc2c58e5d1eb
2016-07-29Revert "Use try lock to fix class resolution race" Mathieu Chartier
This reverts commit a704eda0078989a73cac111ed309aca50d2e289b. Bug: 27417671 Bug: 30500547 Change-Id: Ieea05236b9e61c722660cd9497c9d55d13ccd010
2016-07-27Use try lock to fix class resolution race Mathieu Chartier
There was some possible deadlocks related to EnsureResolved caused by acquiring an object lock. Scenario: Thread 1 acquires lock on obj1 Thread 1 begins to resolve / initialize class1 Thread 1 blocks since it sees that class1 is already being resolved and gets preempted before it can acquire the object lock on class1 Thread 2 finishes resolving and initializing class1 and locks class1 Thread 2 blocks attempting to lock obj1 Thread 1 blocks attempting to lock class1 Deadlock Fixed the deadlock by changing EnsureResolved to use a try lock for the unresolved case. Added a test. Test: Device boot, test-art-host, monitor_test Bug: 27417671 Change-Id: Ic6e1c3ca6f45490cf8a7bf8e137dee71ac83ff64
2015-09-03Add ScopedThreadSuspension Mathieu Chartier
Fixes the TransitionFromRunnableToSuspended and TransitionFromSuspendedToRunnable pattern that was prone to errors. Change-Id: Ie6ae9c0357c83b4fc4899d05dfa0975553170267
2015-08-28Fix some HandleScope bugs and add corresponding checks Mathieu Chartier
Some places were creating or destroying handle scopes without holding the mutator lock. This can cause GC crashes if thread roots are being marked or hprof dumps to also fail. Also added checks to catch some of these errors. Bug: 23468617 Change-Id: I1a2d615923484cfc25014967656775c445aa3f1f
2015-08-12Remove unnecessary `explicit` qualifiers on constructors. Roland Levillain
Change-Id: Id12e392ad50f66a6e2251a68662b7959315dc567
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-26ART: Clean up arm64 kNumberOfXRegisters usage. Vladimir Marko
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 Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
2015-04-22Replace NULL with nullptr Mathieu Chartier
Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
2015-04-13ART: Clean up includes. Vladimir Marko
Reduce dependencies to improve incremental build times. Break up circular dependency involving class_linker-inl.h. Change-Id: I4be742c5c2b5cd9855beea86630fd68aab76b0db
2015-01-15ART: Allow scoped adjustments to log verbosity Andreas Gampe
Add ScopedLogSeverity to adjust the logging level. Suppress warnings by default in gtests. Suppress errors in instances where errors are expected. Change-Id: If3ef865813e9505ab60bc90baed63ff11d90afbb
2014-11-04ART: More warnings Andreas Gampe
Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
2014-09-15ART: Rename Handle hierarchy Andreas Gampe
Bring the names in line with normal OO principles: ConstHandle becomes Handle, and Handle becomes MutableHandle. Change-Id: I0f018eb7ba28bc422e3a23dd73a6cbe6fc2d2044
2014-07-15Break apart header files. Ian Rogers
Create libart-gtest for common runtime and compiler gtest routines. Rename CompilerCallbacksImpl that is quick compiler specific. Rename trace clock source constants to not use the overloaded profiler term. Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
2014-07-07ART: Update Monitor::Wait so it releases monitor_lock_ before throwing an ↵ Elena Sayapina
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>