414369a2e3f23e1408fc1cbf4f623014bd95cb8f |
|
04-May-2015 |
Mathieu Chartier <mathieuc@google.com> |
Add some more DISALLOW_COPY_AND_ASSIGN May help prevent bugs maybe. (cherry picked from commit 3130cdf29eb203be0c38d1107a65d920ec39c106) Change-Id: Ie73d469dfcd078492ecb3aa28682b42707221202
|
3130cdf29eb203be0c38d1107a65d920ec39c106 |
|
04-May-2015 |
Mathieu Chartier <mathieuc@google.com> |
Add some more DISALLOW_COPY_AND_ASSIGN May help prevent bugs maybe. Change-Id: Ie73d469dfcd078492ecb3aa28682b42707221202
|
4460a84be92b5a94ecfb5c650aef4945ab849c93 |
|
09-Mar-2015 |
Hiroshi Yamauchi <yamauchi@google.com> |
Rosalloc thread local allocation path without a cas. Speedup on N4: MemAllocTest 3044 -> 2396 (~21% reduction) BinaryTrees 4101 -> 2929 (~26% reduction) Bug: 9986565 Change-Id: Ia1d1a37b9e001f903c3c056e8ec68fc8c623a78b
|
2cd334ae2d4287216523882f0d298cf3901b7ab1 |
|
09-Jan-2015 |
Hiroshi Yamauchi <yamauchi@google.com> |
More of the concurrent copying collector. Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
|
13735955f39b3b304c37d2b2840663c131262c18 |
|
08-Oct-2014 |
Ian Rogers <irogers@google.com> |
stdint types all the way! Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
|
38c488bcd41ba632a646d7a1d790ec71a2fcf6fa |
|
16-Jul-2014 |
Mathieu Chartier <mathieuc@google.com> |
Recycle mem-maps for collector transitions. 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 (cherry picked from commit b363f666883860d40823d5528df3c98c897f74f4) Change-Id: I62877cfa24ec944a6f34ffac30334f454a8002fd
|
b76cac637691c29daa9c44e493b5bc26346ed116 |
|
23-Jul-2014 |
Mathieu Chartier <mathieuc@google.com> |
Revert "Revert "Disable adding main and non moving spaces to immune region in GSS"" This reverts commit f85c2fb317399ab540854cd7551ac47690366543.
|
b363f666883860d40823d5528df3c98c897f74f4 |
|
16-Jul-2014 |
Mathieu Chartier <mathieuc@google.com> |
Recycle mem-maps for collector transitions. 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
|
f85c2fb317399ab540854cd7551ac47690366543 |
|
22-Jul-2014 |
Mathieu Chartier <mathieuc@google.com> |
Revert "Disable adding main and non moving spaces to immune region in GSS" Bug: 16399257 This reverts commit be0562fb14e6754ee932b8d9c97e2a6df3a91119. Change-Id: I29e07a8fa1e972990e5bf1ddf8c9a3538ea5f9cf
|
be0562fb14e6754ee932b8d9c97e2a6df3a91119 |
|
14-Jul-2014 |
Mathieu Chartier <mathieuc@google.com> |
Disable adding main and non moving spaces to immune region in GSS Disabled adding the main and non moving space to the immune region. This will enable us to recycle bump pointer spaces for malloc space -> malloc space compaction as well as collector transitions. Also added logic for falling back to the non moving space, we may copy objects there. Refactored mod union table logic into MarkReachableObjects. No measurable performance benefit or regression. Bug: 14059466 Bug: 16291259 (cherry picked from commit 4c13a3ff475f206c4d0a86ee2595c45392fd942f) Change-Id: I858b4fbddca888e164052ad247565a0bdbea68b5
|
4c13a3ff475f206c4d0a86ee2595c45392fd942f |
|
14-Jul-2014 |
Mathieu Chartier <mathieuc@google.com> |
Disable adding main and non moving spaces to immune region in GSS Disabled adding the main and non moving space to the immune region. This will enable us to recycle bump pointer spaces for malloc space -> malloc space compaction as well as collector transitions. Also added logic for falling back to the non moving space, we may copy objects there. Refactored mod union table logic into MarkReachableObjects. No measurable performance benefit or regression. Bug: 14059466 Bug: 16291259 Change-Id: If663d9fdbde943b988173b7f6ac844e5f78a0327
|
be2a1df15a31a5223ee9af3015a00c31d2ad2e10 |
|
10-Jul-2014 |
Ian Rogers <irogers@google.com> |
Fix GC to use art::Atomic rather than compiler intrinsics. Changes to SpaceBitmap::AtomicTestAndSet and Space::end_. Space::end_ is made atomic rather than volatile to fully capture all its uses multi-threaded or not uses. Change-Id: I3058964b8ad90a8c253b3d7f75585f63ca2fb5e3
|
10fb83ad7442c8cf3356a89ec918e0786f110981 |
|
16-Jun-2014 |
Mathieu Chartier <mathieuc@google.com> |
Shared single GC iteration accounting for all GCs. Previously, each garbage collector had data that was only used during collection. Since only one collector can be running at any given time, we can make this data be shared between all collectors. This reduces memory usage since we don't need to have redundant information for each GC types. Also reduced how much code is required to sweep spaces. Bug: 9969166 Change-Id: I31caf0ee4d572f75e0c66863fe7db12c08ae08e7
|
700a402244a1a423da4f3ba8032459f4b65fa18f |
|
20-May-2014 |
Ian Rogers <irogers@google.com> |
Now we have a proper C++ library, use std::unique_ptr. Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
|
507dfdd147c97bfbadebfd63584d094b6a4e7b47 |
|
16-May-2014 |
Ian Rogers <irogers@google.com> |
Compatibility layer to transition from UniquePtr to std::unique_ptr. Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr, for the host switch to std::unique_ptr. For now the type remains called UniquePtr. Make dalvik compile with clang on the host, move its build to C++11. Change-Id: I5ba8d2757904bc089ed62047ea03de3c0853fb12
|
0651d41e41341fb2e9ef3ee41dc1f1bfc832dbbb |
|
29-Apr-2014 |
Mathieu Chartier <mathieuc@google.com> |
Add thread unsafe allocation methods to spaces. Used by SS/GSS collectors since these run with mutators suspended and only allocate from a single thread. Added AllocThreadUnsafe to BumpPointerSpace and RosAllocSpace. Added AllocThreadUnsafe which uses current runs as thread local runs for a thread unsafe allocation. Added code to revoke current runs which are the same idx as thread local runs. Changed: The number of thread local runs in each thread is now the the number of thread local runs in RosAlloc instead of the number of size brackets. Total GC time / time on EvaluateAndApplyChanges. TLAB SS: Before: 36.7s / 7254 After: 16.1s / 4837 TLAB GSS: Before: 6.9s / 3973 After: 5.7s / 3778 Bug: 8981901 Change-Id: Id1d264ade3799f431bf7ebbdcca6146aefbeb632
|
bbd695c71e0bf518f582e84524e1cdeb3de3896c |
|
16-Apr-2014 |
Mathieu Chartier <mathieuc@google.com> |
Replace ObjectSet with LargeObjectBitmap. Speeds up large object marking since large objects no longer required a lock. Changed the GCs to use the heap bitmap for marking objects which aren't in the fast path. This eliminates the need for a MarkLargeObject function. Maps before (10 GC iterations): Mean partial time: 180ms Mean sticky time: 151ms Maps after: Mean partial time: 161ms Mean sticky time: 101ms Note: the GC durations are long due to recent ergonomic changes and because the fast bulk free hasn't yet been enabled. Over 50% of the GC time is spent in RosAllocSpace::FreeList. Bug: 13571028 Change-Id: Id8f94718aeaa13052672ccbae1e8edf77d653f62
|
a8e8f9c0a8e259a807d7b99a148d14104c24209d |
|
09-Apr-2014 |
Mathieu Chartier <mathieuc@google.com> |
Refactor space bitmap to support different alignments. Required for: Using space bitmaps instead of std::set in mod union table + remembered set. Using a bitmap instead of set for large object marking. Bug: 13571028 Change-Id: Id024e9563d4ca4278f79607cdb2f81895121b113
|
31f441464c0c8f840aba37e236ad133f30308d70 |
|
08-Apr-2014 |
Mathieu Chartier <mathieuc@google.com> |
Clean-up heap spaces. We now use the CMS collector instead of the semispace collector when the phone is booting. We still perform compaction during the zygote space creation. This reduces time spent in GC by ~2s during boot and doesn't affect zygote space size. Changed the space creation logic to create the temp space when a background transition occurs. Added a flag to each space which is true if you are allowed to move objects that are within this space. Removed SwapSemiSpaces call from the semi space collector, it is now the job of the caller to do this with threads suspended. This simplifies the logic in the zygote compaction / heap transition code since these do not copy from one semispace to another. Added Space::Clear to RosAllocSpace and DlMallocSpace. This greatly simplifies the code used for collector transitions. Time spent in GC creating zygote space: Before: 3.4s, After: 1.28s No change in zygote space size. Bug: 13878055 Change-Id: I700348ab7d5bf3aa537c0cd70c0fed09aa4b0623
|
15d3402bbf8265eb1165694da2e4117eb128f3bc |
|
27-Feb-2014 |
Mathieu Chartier <mathieuc@google.com> |
Add custom SIGSEGV handler to help find heap corruption. The new signal handler prints heap diagnostics when you get a SIGSEGV. Added a fault message member in runtime which is modifiable by Runtime::SetFaultMessage. When you get a SIGSEGV it will print out whatever is stored in this string as well as the normal information. This is useful for debugging heap corruption since it lets you see which threads were in which methods when the last GC occured. Added some smarter object dumping logic when the faulting address is in the heap. Bug: 12934910 Change-Id: Ia72be2c39f70ad711cbd746d66fad2b617d5d29f
|
6fac447555dc94a935b78198479cce645c837b89 |
|
26-Feb-2014 |
Ian Rogers <irogers@google.com> |
Make allocations report usable size. Work-in-progress to allow arrays to fill usable size. Bug: 13028925. Use C++11's override keyword on GCC >= 2.7 to ensure that we override GC and allocator methods. Move initial mirror::Class set up into a Functor so that all allocated objects have non-zero sizes. Use this property to assert that all objects are never larger than their usable size. Other bits of GC related clean-up, missing initialization, missing use of const, hot methods in .cc files, "unimplemented" functions that fail at runtime in header files, reducing header file includes, move valgrind's space into its own files, reduce number of array allocation routines. Change-Id: Id5760041a2d7f94dcaf17ec760f6095ec75dadaa
|
ef7d42fca18c16fbaf103822ad16f23246e2905d |
|
06-Jan-2014 |
Ian Rogers <irogers@google.com> |
Object model changes to support 64bit. Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
|
1f3b5358b28a83f0929bdd8ce738f06908677fb7 |
|
03-Feb-2014 |
Mathieu Chartier <mathieuc@google.com> |
Move SwapBitmaps to ContinuousMemMapAllocSpace. Moved the SwapBitmaps function to ContinuousMemMapAllocSpace since the zygote space uses this function during full GC. Fixed a place where we were casting a ZygoteSpace to a MallocSpace, somehow this didn't cause any issues in non-debug builds. Moved the CollectGarbage in PreZygoteFork before the lock to prevent an occasional lock level violation caused by attempting to enqueue java lang references with the a lock. Bug: 12876255 Change-Id: I77439e46d5b26b37724bdcee3a0948410f1b0eb4
|
a1602f28c0e3127ad511712d4b08db89737ae901 |
|
14-Jan-2014 |
Mathieu Chartier <mathieuc@google.com> |
Add zygote space as its own space type. Helps prevent errors caused from doing invalid operations on the old alloc space. Removed some duplicated code in mark_sweep.cc and semi_space.cc. Change-Id: I67a772cab30d698744c918aad581053f282a4a99
|
db7f37d57b6ac83abe6815d0cd5c50701b6be821 |
|
10-Jan-2014 |
Mathieu Chartier <mathieuc@google.com> |
Refactor large object sweeping. Moved basic sweeping logic into large_object_space.cc. Renamed SpaceSetMap -> ObjectSet. Change-Id: I938c1f29f69b0682350347da2bd5de021c0e0224
|
e6da9af8dfe0a3e3fbc2be700554f6478380e7b9 |
|
16-Dec-2013 |
Mathieu Chartier <mathieuc@google.com> |
Background compaction support. When the process state changes to a state which does not perceives jank, we copy from the main free-list backed allocation space to the bump pointer space and enable the semispace allocator. When we transition back to foreground, we copy back to a free-list backed space. Create a seperate non-moving space which only holds non-movable objects. This enables us to quickly wipe the current alloc space (DlMalloc / RosAlloc) when we transition to background. Added multiple alloc space support to the sticky mark sweep GC. Added a -XX:BackgroundGC option which lets you specify which GC to use for background apps. Passing in -XX:BackgroundGC=SS makes the heap compact the heap for apps which do not perceive jank. Results: Simple background foreground test: 0. Reboot phone, unlock. 1. Open browser, click on home. 2. Open calculator, click on home. 3. Open calendar, click on home. 4. Open camera, click on home. 5. Open clock, click on home. 6. adb shell dumpsys meminfo PSS Normal ART: Sample 1: 88468 kB: Dalvik 3188 kB: Dalvik Other Sample 2: 81125 kB: Dalvik 3080 kB: Dalvik Other PSS Dalvik: Total PSS by category: Sample 1: 81033 kB: Dalvik 27787 kB: Dalvik Other Sample 2: 81901 kB: Dalvik 28869 kB: Dalvik Other PSS ART + Background Compaction: Sample 1: 71014 kB: Dalvik 1412 kB: Dalvik Other Sample 2: 73859 kB: Dalvik 1400 kB: Dalvik Other Dalvik other reduction can be explained by less deep allocation stacks / less live bitmaps / less dirty cards. TODO improvements: Recycle mem-maps which are unused in the current state. Not hardcode 64 MB capacity of non movable space (avoid returning linear alloc nightmares). Figure out ways to deal with low virtual address memory problems. Bug: 8981901 Change-Id: Ib235d03f45548ffc08a06b8ae57bf5bada49d6f3
|
692fafd9778141fa6ef0048c9569abd7ee0253bf |
|
30-Nov-2013 |
Mathieu Chartier <mathieuc@google.com> |
Thread local bump pointer allocator. Added a thread local allocator to the heap, each thread has three pointers which specify the thread local buffer: start, cur, and end. When the remaining space in the thread local buffer isn't large enough for the allocation, the allocator allocates a new thread local buffer using the bump pointer allocator. The bump pointer space had to be modified to accomodate thread local buffers. These buffers are called "blocks", where a block is a buffer which contains a set of adjacent objects. Blocks aren't necessarily full and may have wasted memory towards the end. Blocks have an 8 byte header which specifies their size and is required for traversing bump pointer spaces. Memory usage is in between full bump pointer and ROSAlloc since madvised memory limits wasted ram to an average of 1/2 page per block. Added a runtime option -XX:UseTLAB which specifies whether or not to use the thread local allocator. Its a NOP if the garbage collector is not the semispace collector. TODO: Smarter block accounting to prevent us reading objects until we either hit the end of the block or GetClass() == null which signifies that the block isn't 100% full. This would provide a slight speedup to BumpPointerSpace::Walk. Timings: -XX:HeapMinFree=4m -XX:HeapMaxFree=8m -Xmx48m ritzperf memalloc: Dalvik -Xgc:concurrent: 11678 Dalvik -Xgc:noconcurrent: 6697 -Xgc:MS: 5978 -Xgc:SS: 4271 -Xgc:CMS: 4150 -Xgc:SS -XX:UseTLAB: 3255 Bug: 9986565 Bug: 12042213 Change-Id: Ib7e1d4b199a8199f3b1de94b0a7b6e1730689cad
|
7410f29b4dae223befac036ea567d7f33351dad1 |
|
24-Nov-2013 |
Mathieu Chartier <mathieuc@google.com> |
Fix dumpsys meminfo <pid>. Added a case for BumpPointerSpaces. Confirmed working non-debug. Should also work in debug builds. Bug: 11830794 Change-Id: I12053ff16eec403dcd4a780e13095e3212a77132
|
cf58d4adf461eb9b8e84baa8019054c88cd8acc6 |
|
26-Sep-2013 |
Hiroshi Yamauchi <yamauchi@google.com> |
A custom 'runs-of-slots' memory allocator. Bug: 9986565 Change-Id: I0eb73b9458752113f519483616536d219d5f798b
|
590fee9e8972f872301c2d16a575d579ee564bee |
|
13-Sep-2013 |
Mathieu Chartier <mathieuc@google.com> |
Compacting collector. 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
|
be031fff278799984166ec866c2dd202447e0f23 |
|
09-Oct-2013 |
Hiroshi Yamauchi <yamauchi@google.com> |
Remove four counter increments out of the allocation path. - This change removes the four allocation counters (the number of bytes allocated, the number of objects allocated, the number of bytes allocated ever, the number of objects allocated ever) from the dlmalloc space allocation path. Now those counter values are computed on the fly based on a combination of the two new counters that are incremented by the GC side (the number of bytes freed ever and the number of objects freed ever) and mspace_inspect_all() calls. - This results in a 1-2% speedup (though with some noise) in Ritz MemAllocTest on Nexus 4. Bug: 9986565 Change-Id: Id9a8e05a745ac1e5ea7a2b5fd9319814a9d4af13
|
0f72e4136aecaf6976fdb55916bbd7b6d5c9c77b |
|
07-Sep-2013 |
Mathieu Chartier <mathieuc@google.com> |
Improve heap verification. Re-enabled checking the allocation stack for heap verification. Added tracking of recent frees in DlMallocSpace if debug spaces is enabled. This is useful when you have heap corruption caused by a live object referencing a recently freed object. Added various other sanity checks in the GC. Bug: 10626133 Change-Id: I5ada11966336ae9a06615b16f4b933f05b5d0c32
|
50b2928501fe489c108472e7648ec98cdca62e10 |
|
30-Jul-2013 |
Hiroshi Yamauchi <yamauchi@google.com> |
Improve the allocation speed. - Improves the Ritz MemAllocTest benchmark result by ~500 ms (or ~5%) on Nexus 4. - Move the memset() call that zeroes the allocated memory out of the lock region. - De-virtualize/Inline the allocation call chains into Heap::AllocObject(). - Turn Heap::measure_allocation_time_ into a static const variable. - Surround the VerifyObject() call with kIsDebugBuild. Bug: 9986565 Change-Id: Ib70b6d051a80ec329788b30256565561f031da2a
|
7934ac288acfb2552bb0b06ec1f61e5820d924a4 |
|
26-Jul-2013 |
Brian Carlstrom <bdc@google.com> |
Fix cpplint whitespace/comments issues Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
|
fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d |
|
17-Jul-2013 |
Brian Carlstrom <bdc@google.com> |
Fix multiple inclusion guards to match new pathnames Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
|
8784462d9590e4fcd06813d3a9c7ba08bf556b2e |
|
17-Jul-2013 |
Ian Rogers <irogers@google.com> |
Remove declaration of undefined method. Change-Id: I8b7bec33e4bc9082d6bbf005475c67afbe6d2913
|
7940e44f4517de5e2634a7e07d58d0fb26160513 |
|
12-Jul-2013 |
Brian Carlstrom <bdc@google.com> |
Create separate Android.mk for main build targets 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
|