summaryrefslogtreecommitdiffstats
path: root/runtime/gc/collector/garbage_collector.h
Commit message (Collapse)AuthorAgeFilesLines
* Shared single GC iteration accounting for all GCs.Mathieu Chartier2014-06-201-65/+83
| | | | | | | | | | | | 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
* Fix systrace logging, total paused time, and bytes saved message.Mathieu Chartier2014-06-171-1/+1
| | | | | | | | | | | Moved the GC top level systrace logging to be inside of Collector::Run. This prevents cases where we forgot to call it such as background compaction. Fixed a unit error regarding total pause time. Fixed negative bytes saved to use the word "expanded". Bug: 15702709 Change-Id: Ic2991ecad2daa000d0aee9d559b8bc77d8c160aa
* 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
* Add RecordFree to the GarbageCollector interfaceMathieu Chartier2014-05-051-12/+18
| | | | | | | RecordFree now calls the Heap::RecordFree as well as updates the garbage collector's internal bytes freed accounting. Change-Id: I8cb03748b0768e3c8c50ea709572960e6e4ad219
* Enable concurrent sweeping for non-concurrent GC.Mathieu Chartier2014-04-291-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the GarbageCollector to let all of the phases be run by the collector's RunPhases virtual method. This lets the GC decide which phases should be concurrent and reduces how much baked in GC logic resides in GarbageCollector. Enabled concurrent sweeping in the semi space and non concurrent mark sweep GCs. Changed the semi-space collector to have a swap semi spaces boolean which can be changed with a setter. Fixed tests to pass with GSS collector, there was an error related to the large object space limit. Before (EvaluateAndApplyChanges): GSS paused GC time 7.81s/7.81s, score: 3920 After (EvaluateAndApplyChanges): GSS paused GC time 6.94s/7.71s, score: 3900 Benchmark score doesn't go up since the GC happens in the allocating thread. There is a slight reduction in pause times experienced by other threads (0.8s total). Added options for pre sweeping GC heap verification and pre sweeping rosalloc verification. Bug: 14226004 Bug: 14250892 Bug: 14386356 Change-Id: Ib557d0590c1ed82a639d0f0281ba67cf8cae938c
* Reset GC timings after SIGQUIT.Mathieu Chartier2014-04-081-0/+3
| | | | | | | | We now reset the GC timings when a SIGQUIT happens, this is useful for excluding GCs which happen during the initialization of an app when measuring GC performance. Change-Id: I68c79bdb279290c12ae588bc7e95ac24908c157e
* Fix stack overflow slow path error.Mathieu Chartier2014-03-311-1/+1
| | | | | | | | | | The frame size without spill was being passed into the slow path instead of the spill size. This was incorrect since only the spills will have been pushed at the point of the overflow check. Also addressed an other comment. Change-Id: Ic6e455122473a8f796b291d71f945bcf72788662
* Swap allocation stacks in pause.Mathieu Chartier2014-03-281-1/+1
| | | | | | | | | | | | | | | | | This enables us to collect objects allocated during the GC for both sticky, partial, and full GC. This also significantly simplifies GC code. No measured performance impact on benchmarks, but this should slightly increase sticky GC throughput. Changed RevokeRosAllocThreadLocalBuffers to happen at most once per GC. Previously it occured twice if pre-cleaning was enabled. Renamed HandleDirtyObjectsPhase to PausePhase and enabled it for non-concurrent GC. This helps reduce duplicated code which was in both HandleDirtyObjectsPhase for concurrent GC and ReclaimPhase for non-concurrent GC. Change-Id: I533414b5c2cd2800f00724418e0ff90e7fdb0252
* Change sticky GC ergonomics to use GC throughput.Mathieu Chartier2014-03-271-4/+12
| | | | | | | | | | | | | | | | | The old sticky ergonomics used partial/full GC when the bytes until the footprint limit was < min free. This was suboptimal. The new sticky GC ergonomics do partial/full GC when the throughput of the current sticky GC iteration is <= mean throughput of the partial/full GC. Total GC time on FormulaEvaluationActions.EvaluateAndApplyChanges. Before: 26.4s After: 24.8s No benchmark score change measured. Bug: 8788501 Change-Id: I90000305e93fd492a8ef5a06ec9620d830eaf90d
* Revoke rosalloc thread-local buffers at the checkpoint.Hiroshi Yamauchi2014-03-211-1/+2
| | | | | | | | | | | | | | In the mark sweep collector, rosalloc thread-local buffers were revoked during the pause. Now, they are revoked at the thread checkpoint, as opposed to during the pause, which appears to help reduce the pause time. In Ritz MemAllocTest, the average sticky pause time went down ~20% (925 us -> 724 us). Bug: 13394464 Bug: 9986565 Change-Id: I104992a11b46d59264c0b9aa2db82b1ccf2826bc
* Refactor the garbage collector driver (GarbageCollector::Run).Hiroshi Yamauchi2014-03-201-5/+5
| | | | | | Bug: 12687968 Change-Id: Ifc9ee86249f7938f51495ea1498cf0f7853a27e8
* Add timing split for RevokeAllThreadLocalBuffers.Mathieu Chartier2014-03-101-0/+2
| | | | | | This is part of the pause and should be accounted for. Change-Id: I3165324de810e8fab02719098977402a18013da1
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-1/+1
| | | | | | | | | | | Fix clang build errors aswell as restructure locking/mutex code for correct thread safety analysis support. Reorder make dependencies so that host builds build first as they should provide better compilation errors than target. Remove host's use of -fno-omit-frame-pointer as it has no value with correct use of CFI, which we should have. Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
* Improve the generational mode.Hiroshi Yamauchi2014-01-141-1/+3
| | | | | | | | | | | - Turn the compile-time flags for generational mode into a command line flag. - In the generational mode, always collect the whole heap, as opposed to the bump pointer space only, if a collection is an explicit, native allocation-triggered or last attempt one. Change-Id: I7a14a707cc47e6e3aa4a3292db62533409f17563
* Add histogram for GC pause times.Mathieu Chartier2013-11-211-4/+11
| | | | | | | Printed when you dump the GC performance info. Bug: 10855285 Change-Id: I3bf7f958305f97c52cb31c03bdd6218c321575b9
* Fix memory leaks relating to timing logger.Ian Rogers2013-11-141-2/+2
| | | | | | | | | Bug: 11670287. We use pointers to uninitialized values for control-flow in the timing logger code, add TODO comments to clean this up later. Remove base namespace and other bits of tidying. Change-Id: I1e6600a1e92f974c8f58f3a405a4e4abb4d9f80f
* Compacting collector.Mathieu Chartier2013-11-111-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add systrace support to NewTimingLogger, migrate compiler timing logging to ↵Anwar Ghuloum2013-07-251-2/+2
| | | | | | | | | NewTimingLogger Rpleaced old TimingLogger by NewTimingLogger, renamed NewTimingLogger to TimingLogger, added systrace support to TimingLogger. Tests passing, phone booting, systrace working. Change-Id: I2aeffb8bcb7f0fd979d8a2a3a8bcfbaa02413679
* Fix cpplint whitespace/blank_line issuesBrian Carlstrom2013-07-181-1/+0
| | | | Change-Id: Ice937e95e23dd622c17054551d4ae4cebd0ef8a2
* 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/+122
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