summaryrefslogtreecommitdiffstats
path: root/runtime/base/mutex-inl.h
Commit message (Collapse)AuthorAgeFilesLines
* 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-13/+14
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Revert "Tidy gAborting."Nicolas Geoffray2014-12-091-3/+5
| | | | | | | | Creates infinite loop: b/18674776. This reverts commit 015b137efb434528173779bc3ec8d72494456254. Change-Id: I67fe310d2e95ee2ec37bec842be06fb1123b6f4e
* Tidy gAborting.Ian Rogers2014-12-041-5/+3
| | | | | | | Reduce scope to Runtime::Abort and short-cut recursive case earlier. gAborting remains global to avoid two fatal errors in thread and the verifier. Change-Id: Ibc893f891ffee9a763c65cde9507d99083d47b3f
* Avoid some recursive aborting.Ian Rogers2014-11-211-2/+4
| | | | | Bug: 18469797 Change-Id: Ic1889a605a041bdec679ff54f8dce3842d85f2e1
* Mac host doesn't define ART_USE_FUTEXES.Ian Rogers2014-11-061-1/+2
| | | | Change-Id: Ic2c23d267cfd56db58754f45154436a085eeaa78
* Move include of system headers outside namesapce.Chih-Hung Hsieh2014-11-061-4/+6
| | | | | | | | | | This happened to work with old system header files. But with newer glibc 2.15 header files, typedef names such as __u32 and __u64 are included into a namespace and could not be used in other system header files. BUG: 18275923 Change-Id: I7c61270d08a7b1c69cee55a6a23b00372f0f51c8
* C++11 related clean-up of DISALLOW_..Ian Rogers2014-10-221-42/+2
| | | | | | | | | | | | | | | | | | Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations with no definitions this prompts better warning messages so deal with these by correcting the code. Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object. Make X86 assembly operand types ValueObjects to fix compilation errors. Tidy the use of iostream and ostream. Avoid making cutils a dependency via mutex-inl.h for tests that link against libart. Push tracing dependencies into appropriate files and mutex.cc. x86 32-bit host symbols size is increased for libarttest, avoid copying this in run-test 115 by using symlinks and remove this test's higher than normal ulimit. Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it returns NULL when the heap is under construction by Runtime. Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
* Avoid use of std::string where we have const char*.Ian Rogers2014-08-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Removing the ClassHelper caused std::string creation for all calls to Class::GetDescriptor and a significant performance regression. Make the std::string an out argument so the caller can maintain it and its life time while allowing GetDescriptor to return the common const char* case. Don't generate GC maps when compilation is disabled. Remove other uses of std::string that are occuring on critical paths. Use the cheaper SkipClass in CompileMethod in CompilerDriver. Specialize the utf8 as utf16 comparison code for the common shorter byte encoding. Force a bit of inlining, remove some UNLIKELYs (they are prone to pessimizing code), add some LIKELYs. x86-64 host 1-thread interpret-only of 57 apks: Before: 29.539s After: 23.467s Regular compile: Before: 1m35.347s After: 1m20.056s Bug: 16853450 Change-Id: Ic705ea24784bee24ab80084d06174cbf87d557ad
* Remove legacy CAS implementations from mutex.Ian Rogers2014-07-101-13/+16
| | | | | | | | Removes the use of __sync_bool_compare_and_swap and android_atomic_cas and uses intention revealing atomic operations from art::Atomic (which will eventually give way to std::atomic). Change-Id: Iea44e1923f6706ec04b5459fe25427282c189a7e
* Remove deprecated WITH_HOST_DALVIK.Ian Rogers2014-06-101-84/+3
| | | | | | | | | | | | | | | | | | | | | | | Bug: 13751317 Fix the Mac build: - disable x86 selector removal that causes OS/X 10.9 kernel panics, - madvise don't need does zero memory on the Mac, factor into MemMap routine, - switch to the elf.h in elfutils to avoid Linux kernel dependencies, - we can't rely on exclusive_owner_ being available from other pthread libraries so maintain our own when futexes aren't available (we can't rely on the OS/X 10.8 hack any more), - fix symbol naming in assembly code, - work around C library differences, - disable backtrace in DumpNativeStack to avoid a broken libbacktrace dependency, - disable main thread signal handling logic, - align the stack in stub_test, - use $(HOST_SHLIB_SUFFIX) rather than .so in host make file variables. Not all host tests are passing on the Mac with this change. dex2oat works as does running HelloWorld. Change-Id: I5a232aedfb2028524d49daa6397a8e60f3ee40d3
* Reduce header files including header files.Ian Rogers2014-06-061-0/+2
| | | | | | Main focus is getting heap.h out of runtime.h. Change-Id: I8d13dce8512816db2820a27b24f5866cc871a04b
* Extra debug output for a failing lock check.Ian Rogers2014-05-231-1/+1
| | | | Change-Id: If4abae535a875a06f4fa4203e6aabc1169b1f38e
* Move modify_ldt_lock into global lock order.Chao-ying Fu2014-05-221-3/+15
| | | | | | | | | | | | | | | | | Mutex modify_ldt_lock was being removed during runtime shutdown while daemons thread may still detach. Avoid this by placing in global lock order. This fixes cts dalvik vm-tests-tf that hang on some x86 devices. By irogers: also, tidy global locks to agree with enum constants and add extra verification that the global annotalysis order agrees with the LockLevel order. Bumped the oat version and moved the locks as LockLevel additions previously caused entrypoints to be moved. Make unattached lock not handle the default mutex level case by moving the allocated thread ids lock into the global order. Change-Id: I9d03f19d44ea254accf0ceae8022563c77f7a02f Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
* Begin migration of art::Atomic to std::atomic.Ian Rogers2014-05-201-1/+1
| | | | Change-Id: I4858d9cbed95e5ca560956b9dabd976cebe68333
* Move __STDC_FORMAT_MACROS to a cflag.Ian Rogers2014-01-231-1/+0
| | | | | | | | | Current inttypes.h don't define stdint printf formatting characters for C++ but in the future this will change. Rather than #define __STDC_FORMAT_MACROS at the point of inclusion (conventional) pass it as a cflag so there is a single place to remove the #define when conventions change. Change-Id: Ice2fb07e19d8fc06ebc534c903a2d02497c31b3d
* 64bit cleanliness requires PRI*64 macros for stdint types.Ian Rogers2014-01-231-1/+4
| | | | Change-Id: I0cdce36d5f875cdc64cd2db22fd8179916ffa10f
* Compacting collector.Mathieu Chartier2013-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compacting collector is currently similar to semispace. It works by copying objects back and forth between two bump pointer spaces. There are types of objects which are "non-movable" due to current runtime limitations. These are Classes, Methods, and Fields. Bump pointer spaces are a new type of continuous alloc space which have no lock in the allocation code path. When you allocate from these it uses atomic operations to increase an index. Traversing the objects in the bump pointer space relies on Object::SizeOf matching the allocated size exactly. Runtime changes: JNI::GetArrayElements returns copies objects if you attempt to get the backing data of a movable array. For GetArrayElementsCritical, we return direct backing storage for any types of arrays, but temporarily disable the GC until the critical region is completed. Added a new runtime call called VisitObjects, this is used in place of the old pattern which was flushing the allocation stack and walking the bitmaps. Changed image writer to be compaction safe and use object monitor word for forwarding addresses. Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc.. TODO: Enable switching allocators, compacting on background, etc.. Bug: 8981901 Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
* More allocation code optimizations.Hiroshi Yamauchi2013-09-111-0/+126
| | | | | | | | | | | - Inline Class::AllocObject() and Array::Alloc(). - Inline some short Mutex functions and add LIKELY/UNLIKELY to some Mutex functions. - This change improves the Ritz MemAllocTest by ~6% on Nexus 4 and ~10% on host. Bug: 9986565 Change-Id: I1606c74ddb21676cbc1de1a40e9b076fc23eaea4
* Disable lock contention logging by default.Jeff Hao2013-09-091-6/+4
| | | | | | | The verifier runs out of memory with lock contention logging on nakasi. Bug: 10646091 Change-Id: I8ddffdb48d779a20107bae7013cbe92d13dc8bdb
* Add a systrace support for lock contention logging.Hiroshi Yamauchi2013-08-131-0/+9
| | | | | | | | | | - Now several ART executables like oatdump need to link with libcutils as the mutex code is shared among them. - The blocking thread ID and lock owner thread ID are passed to ScopedContentionRecorder in the correct order. Bug: 9986464 Change-Id: Id766de23fbc4af1d8ba2de051595e365b04f5ae7
* Polish the lock contention logging.Hiroshi Yamauchi2013-08-091-14/+10
| | | | | | | | | | - Make the code compilable. - Surround the code with kLogLockContentions instead of #ifdef CONTENTION_LOGGING. - Dump contended locks before never-contended locks for better log readability. - Change the wait time unit from ms to us for better precision. Bug: 9986464 Change-Id: I121c6ccf4424d3e0339b0dcd25e18976b41fe4f3
* Fix cpplint whitespace/comments issuesBrian Carlstrom2013-07-261-1/+1
| | | | Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
* Fix cpplint whitespace/parens issuesBrian Carlstrom2013-07-181-2/+2
| | | | Change-Id: Ifc678d59a8bed24ffddde5a0e543620b17b0aba9
* Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
| | | | Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+187
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81