summaryrefslogtreecommitdiffstats
path: root/runtime/gc/heap.cc
Commit message (Collapse)AuthorAgeFilesLines
* Replace ObjectSet with LargeObjectBitmap.Mathieu Chartier2014-04-171-20/+16
| | | | | | | | | | | | | | | | | | | | | | | 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
* Decrease target utilization for foreground apps.Mathieu Chartier2014-04-161-11/+25
| | | | | | | | | | GC time in FormulaEvaluationActions.EvaluateAndApplyChanges goes from 26.1s to 23.2s. Benchmark score goes down ~50 in FormulaEvaluationActions.EvaluateAndApplyChanges, and up ~50 in GenericCalcActions.MemAllocTest. Bug: 8788501 Change-Id: I412af1205f8b67e70a12237c990231ea62167bc0
* Less confusing heap transition message.Mathieu Chartier2014-04-151-8/+1
| | | | | | | The heap transition message now just says how long the transition took and up to how much memory was saved (it can still be negative). Change-Id: If421dcc2aa9cc40740b858dcc2ff1b8e595f9a40
* Merge "Refactor space bitmap to support different alignments."Mathieu Chartier2014-04-141-12/+13
|\
| * Refactor space bitmap to support different alignments.Mathieu Chartier2014-04-141-12/+13
| | | | | | | | | | | | | | | | | | | | | | 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
* | Reduce bump pointer space capacity.Mathieu Chartier2014-04-141-2/+7
|/ | | | | Bug: 14058912 Change-Id: I7ae53e667539530d56ca2f5d10214e69c9c994e2
* Fix hammerhead phone boot on master.Mathieu Chartier2014-04-111-1/+1
| | | | | | Wasn't failing on AOSP. Change-Id: I8e531bf7493d36dc2667afeaf3133ce8560a2ce1
* Fix heap verification with SS/GSS.Mathieu Chartier2014-04-111-0/+2
| | | | | | | | | | Since I had removed the SwapSemiSpaces it was trying to verify references in the from space of the semispace collector, which isn't necessarily valid. Bug: 13989162 Change-Id: I8e0b7119a1a53d63f2c71ecdb276290eda5bae07
* Merge "Fix an occasional ThreadStress crash."Hiroshi Yamauchi2014-04-111-4/+5
|\
| * Fix an occasional ThreadStress crash.Hiroshi Yamauchi2014-04-111-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Also, fix the NativeAllocations test for the case with the GSS collector as the default GC. Since kGcCauseForAlloc (incorrect) was being passed into the collector instead of kGcCauseForNativeAlloc (correct) from Heap::RegisterNativeAllocation(), the GCC collector never invoked a whole heap collection which was necessary to do sufficent finalizations to pass the test. Bug: 13988451 Bug: 11650816 Change-Id: Ib02f061751cd777e0d3bfa81b29e04a874dc58a0
* | Clean-up heap spaces.Mathieu Chartier2014-04-111-175/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix race condition in TransitionCollector.Mathieu Chartier2014-04-101-0/+7
|/ | | | | | | | | | There was a race condition where if multiple threads were calling TransitionCollector it could cause a crash due to an invalid collector transition if another thread did the collector transition before the SuspendAll. Bug: 13929101 Change-Id: I8c162a83c1f53d0cbdefab62b0a5bcbb151d6c42
* Add mean GC duration to DumpGcPerformanceInfo.Mathieu Chartier2014-04-091-3/+4
| | | | Change-Id: Ibd68e9d8cae71d0ceb769fc975f1148287e9ca4a
* Merge "Adjust sticky GC ergonomics."Mathieu Chartier2014-04-091-1/+5
|\
| * Adjust sticky GC ergonomics.Mathieu Chartier2014-04-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Added an adjustment factor that causes sticky GC to occur more often. Currently, we adjust the throughput by 5 / 4 comapred to the non sticky GC. This improves the MemAllocTest score by 50-100. I believe this happens since the sticky GC uses less memory bandwidth than partial/full GC. No benchmark score regression on EvaluateAndApplyChanges though total GC time is increased by ~0.5s. Bug: 13818507 Change-Id: Ic721a1bff069ddaf8acc55e776b8bc26e171d46e
* | Merge "GSS: Fix the bump pointer space only collection."Hiroshi Yamauchi2014-04-091-4/+2
|\ \ | |/ |/|
| * GSS: Fix the bump pointer space only collection.Hiroshi Yamauchi2014-04-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes b/13912464 where the clear soft reference behavior accidentally disabled the bump pointer space only collection. Changed the collector name so that the GC logs would indicate the generational mode and the collection mode. Peformance enhancement: instead of triggering the whole heap collection every 5 collections, count the bytes promoted since the last whole heap collection and use it to decide when to trigger the whole heap collection. This improves MemAllocTest by 5-10% (N4 and host). Bug: 13912464 Bug: 11650816 Bug: 9986565 Change-Id: I653a0dca62a8b54adf69abe2940a41eac70f809b
* | Reset GC timings after SIGQUIT.Mathieu Chartier2014-04-081-1/+2
| | | | | | | | | | | | | | | | 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
* | Add monitor deflation.Mathieu Chartier2014-04-071-15/+23
|/ | | | | | | | | | | We now deflate the monitors when we perform a heap trim. This causes a pause but it shouldn't matter since we should be in a state where we don't care about pauses. Memory savings are hard to measure. Fixed integer overflow bug in GetEstimatedLastIterationThroughput. Bug: 13733906 Change-Id: I4e0e68add02e7f43370b3a5ea763d6fe8a5b212c
* Merge "Fix running with DlMalloc instead of RosAlloc."Mathieu Chartier2014-04-011-2/+1
|\
| * Fix running with DlMalloc instead of RosAlloc.Mathieu Chartier2014-04-011-2/+1
| | | | | | | | | | | | | | Bug: 13748830 Bug: 13744490 Change-Id: Ieec97cf58ebf9864a40ee85aae582cdcf3f27c0c
* | Make the support code for read barriers a bit more general.Hiroshi Yamauchi2014-03-311-5/+7
|/ | | | | | | Add an option for Baker in addition to Brooks. Bug: 12687968 Change-Id: I8a31db817ff6686c72951b6534f588228e270b11
* Fix non concurrent mark sweep ergonomics.Mathieu Chartier2014-03-281-1/+17
| | | | | | | | | | | | | | | | | Previously we would continue to do sticky GC until the sticky GC did not free enough memory for the allocation, this was excessive since it could do one sticky GC per allocation. The new logic uses the next GC type before trying all the GCs in the plan. Before memalloc benchmark (non concurrent mark sweep): Total time spent in GC: 11.212701s Score: 7790 After: Total time spent in GC: 9.422676s Score: 6870 Change-Id: Iba75b70ea825ef3fd4b3e064d4f12c2fe5a3b176
* Merge "Refactor some GC code."Mathieu Chartier2014-03-281-0/+14
|\
| * Refactor some GC code.Mathieu Chartier2014-03-281-0/+14
| | | | | | | | | | | | | | | | Reduced amount of code in mark sweep / semi space by moving common logic to garbage_collector.cc. Cleaned up mod union tables and deleted an unused implementation. Change-Id: I4bcc6ba41afd96d230cfbaf4d6636f37c52e37ea
* | Merge "An empty collector skeleton for a read barrier-based collector."Hiroshi Yamauchi2014-03-281-6/+19
|\ \ | |/ |/|
| * An empty collector skeleton for a read barrier-based collector.Hiroshi Yamauchi2014-03-271-6/+19
| | | | | | | | | | | | Bug: 12687968 Change-Id: Ic2a3a7b9943ca64e7f60f4d6ed552a316ea4a6f3
* | Change sticky GC ergonomics to use GC throughput.Mathieu Chartier2014-03-271-21/+34
|/ | | | | | | | | | | | | | | | | 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
* Add valgrind support to large object map space.Mathieu Chartier2014-03-261-0/+2
| | | | | | | Added valgrind support to large object map space. Bug: 7392044 Change-Id: I1456f46414e1fa59ebcc2190ec00576dae26d623
* Add GC mode for stressing testing heap transitions.Mathieu Chartier2014-03-251-0/+9
| | | | | | | | The stress testing mode does repeated heap transitions when the heap gets a process state update. In between each transition, the heap waits for a specified number of time. Change-Id: Ie3f43835e539fa8da147f77b4623a432a0d858c2
* Add missing debugger root visiting.Mathieu Chartier2014-03-251-3/+4
| | | | | Bug: 13634574 Change-Id: I2a76f6c43f1d0ad1922f06deb40a71ff651129fd
* Refactor object reference visiting logic.Mathieu Chartier2014-03-241-28/+33
| | | | | | | Refactored the reference visiting logic to be in mirror::Object instead of MarkSweep. Change-Id: I773249478dc463d83b465e85c2402320488577c0
* Refactor and optimize GC code.Mathieu Chartier2014-03-241-6/+7
| | | | | | | | | | | | | | | | | | | | Fixed the reference cache mod union table, and re-enabled it by default. Added a boolean flag to count how many null objects, immune, fast path, slow path objects we marked. Slight speedup in mark stack processing, large speedup in image mod union table scanning. EvaluateAndApplyChanges Before: Process mark stack time for full GC only: 12.464089s, 12.357870s, 12.538028s Time spent marking mod image union table ~240ms. After: Process mark stack time: 12.299375s, 12.217142s, 12.187076s Time spent marking mod image union table ~40ms. TODO: Refactor reference visiting logic into mirror::Object. Change-Id: I91889ded9d3f2bf127bc0051c1b1ff77e792e94f
* Revoke rosalloc thread-local buffers at the checkpoint.Hiroshi Yamauchi2014-03-211-0/+14
| | | | | | | | | | | | | | 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
* Merge "Refactor the garbage collector driver (GarbageCollector::Run)."Hiroshi Yamauchi2014-03-211-12/+7
|\
| * Refactor the garbage collector driver (GarbageCollector::Run).Hiroshi Yamauchi2014-03-201-12/+7
| | | | | | | | | | | | Bug: 12687968 Change-Id: Ifc9ee86249f7938f51495ea1498cf0f7853a27e8
* | Fix RecordFree to take signed parameters.Mathieu Chartier2014-03-201-2/+6
|/ | | | | | | | | | RecordFree can get negative bytes allocated when background compaction foreground transitions occur. This caused a DCHECK to fail on debug builds. Also did some refactoring in PreProcessReferences. Bug: 13568814 Change-Id: I57543f1c78544a94f1d241459698b736dba8cfa8
* Add soft reference pre processing.Mathieu Chartier2014-03-201-9/+21
| | | | | | | | | | | | | | | | | Soft reference pre-processing does soft reference preservation with mutators running. After this is done, it does another pass with mutators paused in the ProcessReference code. This helps lower pauses since most preserved soft references have their referents recursive marked outside the pause. Changed ergonomics to have non sticky collectors always clear the soft references. Maps pauses ~10ms -> ~3ms on Nexus 4. Bug: 13421927 Change-Id: I1370f7bb6934034869aa5afca0c377876267aa8e
* Use the card table to speed up the GSS collector.Hiroshi Yamauchi2014-03-141-3/+74
| | | | | | | | | | | | | Scan only dirty cards, as opposed to the whole space, to find references from the non-moving spaces to the bump pointer spaces at bump pointer space only collections. With this change, the Ritz MemAllocTest speeds up by 8-10% on host and 2-3% on N4. The Ritz EvaluateFibonacci speeds up by 8% and its average pause time is reduced by 43% on N4. Bug: 11650816 Change-Id: I1eefe75776bc37e24673b301ffa65a25f9bd4cde
* Refactor reflective method invocation.Ian Rogers2014-03-141-11/+10
| | | | | | | | | | Move invocation code out of JNI internal into reflection, including ArgArray code. Make reflective invocation use the ArgArray to build arguments rather than allocating a jvalue[] and unboxing arguments into that. Move reflection part of jni_internal_test into reflection_test. Make greater use of fast JNI. Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
* Refactor reference code into mirror namespace.Mathieu Chartier2014-03-141-66/+12
| | | | | | Added two new files: mirror/reference.h and mirror/reference-inl.h. Change-Id: Ibe3ff6379aef7096ff130594535b7f7c0b7dabce
* Fix heap trimming logic.Mathieu Chartier2014-03-131-9/+16
| | | | | | | | | | | The new heap trimming logic introduced in the c/84301 was not very good since the heap trim would get avoided since the daemon thread was coming to the heap trimming code before the scheduled time. The new logic is to do the heap trim if the last heap trim occurred more than kHeapTrimWait ns ago. Change-Id: I9d0e6766bf0c68e5f7fb15fb059140e1f1264216
* Put the post zygote non-moving space next to the malloc space.Hiroshi Yamauchi2014-03-111-14/+41
| | | | | | | | | | | | | | | | | | | | This change fixes the following problem with the GSS collector: if the post zygote non-moving space happens to be located after the bump pointer spaces, the bump pointer space is treated wrongfully as an immune space. The reasons are 1) the immune space is represented by a simple address range and 2) the GSS collector treats the post zygote non-moving space as an immune space at a bump pointer space only collection. In addition, this change makes it a reality that all the non-moving spaces are adjacent, which we tend to assume in the code (eg. the notion of the immune space represented by a simple address range.) This should help avoid potential confusions in the future. Fix a DCHECK failure where usable_size isn't set properly when -XX:UseTLAB is used. Change-Id: I585920e433744a390f87e9a25bef6114b2a4623f
* Add more VerifyObject calls.Mathieu Chartier2014-03-071-0/+7
| | | | | | | | | | | Added verify object calls to SirtRef, IndirectReferenceTable, ReferenceTable. Removed un-needed verify object in ScopedObjectAccess / DecodeJObject since object sources are handled. Bug: 12934910 Change-Id: I55a46a8ea61fed2a77526eda27fd2cce97a9b125
* Defer heap transitions to heap trimming daemon.Mathieu Chartier2014-03-061-24/+77
| | | | | | | This fixes the case where quick back and forth process state changes would cause a lot of heap transitions. Change-Id: Ia5be792edcf26079b2aa23b9c115f6b0a9a39a1c
* Disable compaction for jni workarounds.Mathieu Chartier2014-03-061-0/+10
| | | | | | | Compaction can't work when jni workarounds is enabled. Also some other refactoring. Change-Id: Ia7b0f2b39c79f5a0a5f50874d823b950ab02a0c3
* Fix valgrind gtests and memory leaks.Mathieu Chartier2014-03-051-1/+1
| | | | | | | All tests pass other than image_test which passes if some bad reads are disabled (buzbee working on this). Change-Id: Ifd6b6e3aed0bc867703b6e818353a9f296609422
* Avoid marking old class linker and intern table roots during pause.Mathieu Chartier2014-03-041-3/+3
| | | | | | | | | | | | | | | | | | | | The new root visiting logic has a concept of a root log which holds new roots which were added since the start of the GC. This is an optimization since it lets us only mark these newly added roots during the pause (or pre-cleaning) since the other roots intern table and class linker roots were marked concurrently at the start of the GC. Before (EvaluateAndApplyChanges): MarkConcurrentRoots: Sum: 605.193ms After: MarkConcurrentRoots: Sum: 271.858ms This should also reduce pathological GC pauses which used to be able to happen when the intern table or class linker became "dirty" during the concurrent GC. Change-Id: I433fab021f2c339d50c35aaae7161a50a0901dec
* Merge "Fix SafePrettyTypeOf to never call VerifyObject."Mathieu Chartier2014-03-041-4/+4
|\
| * Fix SafePrettyTypeOf to never call VerifyObject.Mathieu Chartier2014-03-031-4/+4
| | | | | | | | | | | | | | Calling VerifyObject from the segfault handler caused another segfault. Change-Id: I459646594d830cbb110a4ac2bac25a7b90794854