summaryrefslogtreecommitdiffstats
path: root/runtime/gc/collector/sticky_mark_sweep.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add Handle/HandleScope and delete SirtRef.Mathieu Chartier2014-05-131-1/+1
| | | | | | | | | | | | | | | | Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
* Make allocations report usable size.Ian Rogers2014-02-261-5/+0
| | | | | | | | | | | | | | | 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
* Remove duplicate card pre-cleaning.Mathieu Chartier2014-02-251-2/+0
| | | | | | | Sticky GC was pre-cleaning cards twice since MarkingPhase calls MarkReachableObjects. Change-Id: I61572b79c855bcd02085a1f7ff96dd0089db95fb
* Card pre-cleaning.Mathieu Chartier2014-02-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | We now pre-clean cards before the pause in the concurrent mark sweep collectors. This provides substantial a pause time reduction for GC iterations which have a lot of dirty cards. The only downside is a slight GC time increase for large heaps. Benchmark FormulaEvaluationActions.EvaluateAndApplyChanges: Before: Partial average pause: 5.47ms Sticky average pause: 2.91ms Total GC time: 25.8s After: Partial average pause: 1.98ms Sticky average pause: 1.66ms Total GC time: 27.0s Benchmark score difference in the noise. Change-Id: If9f01f8c1501f122e19432438108d48e723b332e
* Move SwapBitmaps to ContinuousMemMapAllocSpace.Mathieu Chartier2014-02-031-1/+1
| | | | | | | | | | | | | | | | 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
* Add zygote space as its own space type.Mathieu Chartier2014-01-311-2/+2
| | | | | | | | | 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
* Background compaction support.Mathieu Chartier2014-01-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* A custom 'runs-of-slots' memory allocator.Hiroshi Yamauchi2013-11-161-1/+1
| | | | | Bug: 9986565 Change-Id: I0eb73b9458752113f519483616536d219d5f798b
* Compacting collector.Mathieu Chartier2013-11-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Change thread.h to thread-inl.h to pick up missing Thread::Currnet for debug ↵Brian Carlstrom2013-11-061-1/+1
| | | | | | build in master Change-Id: I56a4dd18ec1c212f9dbb73b14c0c0623b23c87bd
* More parallel GC, rewritten parallel mark stack processing.Mathieu Chartier2013-08-161-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Card scanning may now be done in parallel. This speeds up sticky and reduces pause times for all GC types. Speedup on my mako (ritz perf): Average pause time for sticky GC (~250 samples): Without parallel cards scanning enabled: 2.524904215ms Parallel card scanning (num_gc_threads_): 1.552123552ms Throughput (~250 samples): Sticky GC throughput with parallel card scanning: 69MB/s Sticky GC throughput without parallel card scanning: 51MB/s Rewrote the mark stack processing to be LIFO and use a prefetch queue like the non parallel version. Cleaned up some of the logcat printing for the activity manager process state listening. Added unlikely hints to object scanning since arrays and classes are scanned much less often than normal objects. Fixed a bug where the number of GC threads was clamped to 1 due to a bool instead of a size_t. Fixed a race condition when we added references to the reference queues. Sharded the reference queue lock into one lock for each reference type (weak, soft, phatom, finalizer). Changed timing splits to be different for processing gray objects with and without mutators paused since sticky GC does both. Mask out the class bit when visiting fields as an optimization, this is valid since classes are held live by the class linker. Partially completed: Parallel recursive mark + finger. Bug: 10245302 Bug: 9969166 Bug: 9986532 Bug: 9961698 Change-Id: I142d09718c4609b7c2387cb28f517a6983c73288
* Fix up TODO: c++0x, update cpplint.Mathieu Chartier2013-08-161-5/+1
| | | | | | | | | | | | Needed to update cpplint to handle const auto. Fixed a few cpplint errors that were being missed before. Replaced most of the TODO c++0x with ranged based loops. Loops which do not have a descriptive container name have a concrete type instead of auto. Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
* Systrace fixups and refactoring for TimingLoggerAnwar Ghuloum2013-08-091-1/+0
| | | | | | | | | Fixed systrace bounds for timing logger in GC. Refactored CumulativeLogger a bit to allow for multiple identical entries. Added ScopedSplit, now composes with explicit start/end/new splits. Adds some unit tests. Bug: 10036801 Change-Id: If0afb88b48ec3a1e19462ed354babb274a9517a7
* Disable and remove finger.Mathieu Chartier2013-08-031-1/+0
| | | | | | | Finger is useless for multithreaded GC, removing it should provide a slight speed up due to avoided comparison. Change-Id: I7eb7abcbab8d3307807b1086c06d68b2d4bcd2e9
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+66
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