summaryrefslogtreecommitdiffstats
path: root/runtime/gc
Commit message (Collapse)AuthorAgeFilesLines
* Don't allow negative GetFreeMemory.Mathieu Chartier2014-06-271-1/+4
| | | | | | | | | | | | The max allowed footprint is only updated after the GC. But we can still allocate even if bytes_allocated > max_allowed_footprint_. This means that we used to be able to get a negative value if bytes_allocated > max_allowed_footprint_. External bug: https://code.google.com/p/android/issues/detail?id=72221 Change-Id: I4ef9a534e29211786e82cdcb2582c11ab37a348a
* Merge "More advanced timing loggers."Mathieu Chartier2014-06-247-180/+147
|\
| * More advanced timing loggers.Mathieu Chartier2014-06-247-180/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new timing loggers have lower overhead since they only push into a vector. The new format has two types, a start timing and a stop timing. You can thing of these as brackets associated with a timestamp. It uses these to construct various statistics when needed, such as: Total time, exclusive time, and nesting depth. Changed PrettyDuration to have a default of 3 digits after the decimal point. Exaple of a GC dump with exclusive / total times and indenting: I/art (23546): GC iteration timing logger [Exclusive time] [Total time] I/art (23546): 0ms InitializePhase I/art (23546): 0.305ms/167.746ms MarkingPhase I/art (23546): 0ms BindBitmaps I/art (23546): 0ms FindDefaultSpaceBitmap I/art (23546): 0ms/1.709ms ProcessCards I/art (23546): 0.183ms ImageModUnionClearCards I/art (23546): 0.916ms ZygoteModUnionClearCards I/art (23546): 0.610ms AllocSpaceClearCards I/art (23546): 1.373ms AllocSpaceClearCards I/art (23546): 0.305ms/6.318ms MarkRoots I/art (23546): 2.106ms MarkRootsCheckpoint I/art (23546): 0.153ms MarkNonThreadRoots I/art (23546): 4.287ms MarkConcurrentRoots I/art (23546): 43.461ms UpdateAndMarkImageModUnionTable I/art (23546): 0ms/112.712ms RecursiveMark I/art (23546): 112.712ms ProcessMarkStack I/art (23546): 0.610ms/2.777ms PreCleanCards I/art (23546): 0.305ms/0.855ms ProcessCards I/art (23546): 0.153ms ImageModUnionClearCards I/art (23546): 0.610ms ZygoteModUnionClearCards I/art (23546): 0.610ms AllocSpaceClearCards I/art (23546): 0.549ms AllocSpaceClearCards I/art (23546): 0.549ms MarkRootsCheckpoint I/art (23546): 0.610ms MarkNonThreadRoots I/art (23546): 0ms MarkConcurrentRoots I/art (23546): 0.610ms ScanGrayImageSpaceObjects I/art (23546): 0.305ms ScanGrayZygoteSpaceObjects I/art (23546): 0.305ms ScanGrayAllocSpaceObjects I/art (23546): 1.129ms ScanGrayAllocSpaceObjects I/art (23546): 0ms ProcessMarkStack I/art (23546): 0ms/0.977ms (Paused)PausePhase I/art (23546): 0.244ms ReMarkRoots I/art (23546): 0.672ms (Paused)ScanGrayObjects I/art (23546): 0ms (Paused)ProcessMarkStack I/art (23546): 0ms/0.610ms SwapStacks I/art (23546): 0.610ms RevokeAllThreadLocalAllocationStacks I/art (23546): 0ms PreSweepingGcVerification I/art (23546): 0ms/10.621ms ReclaimPhase I/art (23546): 0.610ms/0.702ms ProcessReferences I/art (23546): 0.214ms/0.641ms EnqueueFinalizerReferences I/art (23546): 0.427ms ProcessMarkStack I/art (23546): 0.488ms SweepSystemWeaks I/art (23546): 0.824ms/9.400ms Sweep I/art (23546): 0ms SweepMallocSpace I/art (23546): 0.214ms SweepZygoteSpace I/art (23546): 0.122ms SweepMallocSpace I/art (23546): 6.226ms SweepMallocSpace I/art (23546): 0ms SweepMallocSpace I/art (23546): 2.144ms SweepLargeObjects I/art (23546): 0.305ms SwapBitmaps I/art (23546): 0ms UnBindBitmaps I/art (23546): 0.275ms FinishPhase I/art (23546): GC iteration timing logger: end, 178.971ms Change-Id: Ia55b65609468f212b3cd65cda66b843da42be645
* | Add logging to monitor deflation.Mathieu Chartier2014-06-241-1/+4
|/ | | | Change-Id: I0251ff19e0a3c3b9edc7c7e296f15eb3229f8f7c
* Use reader lock of bulk free lock when not freeing.Mathieu Chartier2014-06-232-8/+5
| | | | | | Should help reduce contention observed in systrace. Change-Id: Iadb81728d4ba797c3a68acea795b15d7f212e89b
* Shared single GC iteration accounting for all GCs.Mathieu Chartier2014-06-2012-350/+346
| | | | | | | | | | | | 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
* Add mark compact collector.Mathieu Chartier2014-06-1915-41/+963
| | | | | | | | | | | | | | | | | | | | | | The mark compact collector is a 4 phase collection, doing a normal full mark_sweep, calculating forwarding addresses of objects in the from space, updating references of objects in the from space, and moving the objects in the from space. Support is diabled by default since it needs to have non movable classes and field arrays. Performance numbers is around 50% as fast. The main advantage that this has over semispace is that the worst case memory usage is 50% since we only need one space isntead of two. TODO: Make field arrays and classes movable. This causes complication since Object::VisitReferences relies on these, so if we update the fields of an object but another future object uses this object to figure out what fields are reference fields it doesn't work. Bug: 14059466 Change-Id: I661ed3b71ad4dde124ef80312c95696b4a5665a1
* Fix systrace logging, total paused time, and bytes saved message.Mathieu Chartier2014-06-173-5/+10
| | | | | | | | | | | 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
* Merge "Fix error with remembered sets creation."Mathieu Chartier2014-06-171-10/+12
|\
| * Fix error with remembered sets creation.Mathieu Chartier2014-06-171-10/+12
| | | | | | | | | | | | | | | | | | | | There was an error where we were not re-creating the remembered sets in PreZygoteFork. This caused a rare check failure due to the stale remembered set occasionally having the same space as the newly created one. Bug: 15680452 Change-Id: Ibfa569e67ad0ff032f3e9696a99b992a18583243
* | Change reference processing to use heap references.Mathieu Chartier2014-06-169-121/+131
|/ | | | | | | Removes several SetReferents for updating moved referents. Cleaned up other aspects of the code. Change-Id: Ibcb4d713fadea617efee7e936352ddf77ff4c370
* Remove deprecated WITH_HOST_DALVIK.Ian Rogers2014-06-107-14/+20
| | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Reduced frequency of blocks for concurrent gc"Mathieu Chartier2014-06-103-21/+27
|\
| * Reduced frequency of blocks for concurrent gcFred Shih2014-06-103-21/+27
| | | | | | | | | | | | | | | | | | | | Immediately return for references that are marked before reference processing without blocking. Soft references are kept in the queue until the reference processor stops preserving, after which, all marked references are removed. Finalizer references will still block on get(). Bug: 15471830 Change-Id: I588fcaef40b79ed7c95a4aa7f4fc2e17ee0c288f
* | Merge "Add locking around boot image generation."Narayan Kamath2014-06-101-1/+12
|\ \ | |/ |/|
| * Add locking around boot image generation.Narayan Kamath2014-06-101-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If zygote aborts due to an error, it will restart and spawn another dex2oat process while the old one is still running. If this happens fast enough, the system will eventually need a kernel reboot since neither the zygote nor dex2oat are killable. This brings boot image generation in line with dex2oat generation, which uses a similar pattern of advisory locking. bug: 15415316 Change-Id: Iaccd274d3d96ab002b04e246ec4b3ef9a422ff7c
* | Fix GetFreeMemory to use fooprint limit instead of max memory.Mathieu Chartier2014-06-092-2/+2
|/ | | | | | | | Based on definitions in: http://developer.android.com/reference/java/lang/Runtime.html Bug: 15507122 Change-Id: I02f34682d7ac2d379a07631b5207b6cfb224da6b
* Add missing initializtaion of last_gc_time_ns_.Mathieu Chartier2014-06-061-0/+1
| | | | | | | Fixes some valgrind warnings. Bug: 15426766 Change-Id: Ibaa78465739bf6919509cf87c72b25c84ed1d12c
* Merge "Change FieldHelper to use a handle."Mathieu Chartier2014-06-061-5/+3
|\
| * Change FieldHelper to use a handle.Mathieu Chartier2014-06-061-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed compaction bugs related to FieldHelper::GetType in: artSet32InstanceFromCode SetFieldValueImpl CheckReceiver Field_set interpreter::DoFieldPut MethodVerifier::VerifyISGet MethodVerifier::VerifyISPut MethodVerifier::VerifyIGetQuick Bug: 13077697 Change-Id: I7de9ded2893b5568d43e4daa86fd135bf5508b72
* | Reduce header files including header files.Ian Rogers2014-06-062-5/+8
|/ | | | | | Main focus is getting heap.h out of runtime.h. Change-Id: I8d13dce8512816db2820a27b24f5866cc871a04b
* Merge "Verify there's no mem map gap for immune region not to break."Hiroshi Yamauchi2014-06-051-0/+11
|\
| * Verify there's no mem map gap for immune region not to break.Hiroshi Yamauchi2014-06-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | This adds code that verifies that there's no memory map gap between the image space and the main space so that the immune region functionality won't silently break. For example, if there's a gap and a large object is allocated in that gap, the large object is incorrectly part of the immune region and the marking breaks. Bug: 14059466 Change-Id: Ie6ed82988d74b6d0562ebbbaac96ee43c15b14a6
* | ART: Heap-allocate buffer in space_bitmap when on 64b archAndreas Gampe2014-06-041-1/+9
| | | | | | | | | | | | | | | | The stack frame size will be above our limit if we stack-allocate a buffer. Bug: 15278350 Change-Id: Ie1a31370538410d47c177f0a6e51879a1fc0752c
* | Print mutexes held in Thread::Dump.Mathieu Chartier2014-06-041-1/+1
| | | | | | | | | | | | | | Should help finding and fixing thread suspend timeout issues. Bug: 15328839 Change-Id: I30a10529cec0716c7571a0318e9f66be54734fd8
* | ART: Add thread safety test for LargeObjectSpaceAndreas Gampe2014-05-301-0/+57
| | | | | | | | | | | | | | Add a test that just calls Alloc and Free repeatedly with multiple threads, checking whether things are really race-free. Change-Id: I39ea9e7449e3354b49c3aa11c27fcfeb07acff9f
* | Change GetFreeMemory to use the growth limit.Mathieu Chartier2014-05-292-2/+2
| | | | | | | | | | | | | | | | | | This makes more sense since it is what the allocator uses. Also fixed somewhere where we were not properly passing in whether or not it was a large object allocation. Bug: 15327879 Change-Id: Ieab7af5427f5cdc2760390186b67e2c96d4bafa7
* | Merge "Use a heap allocated free buffer in MarkSweep::SweepArray()."Hiroshi Yamauchi2014-05-282-1/+15
|\ \ | |/
| * Use a heap allocated free buffer in MarkSweep::SweepArray().Hiroshi Yamauchi2014-05-282-1/+15
| | | | | | | | | | | | | | This is for avoiding a large stack frame size. Bug: 15278350 Change-Id: I63e92c2dd0ad7078fd74ee2392717dc44b431e9a
* | Merge "Don't create bump pointer spaces unless necessary."Mathieu Chartier2014-05-282-8/+6
|\ \ | |/ |/|
| * Don't create bump pointer spaces unless necessary.Mathieu Chartier2014-05-282-8/+6
| | | | | | | | | | | | | | | | | | We now only create these spaces if the foreground or background collector is a moving collector. Bug: 13564922 Bug: 14059466 Change-Id: I9f83c7881bc28423b78d5249c8e8854add91b60c
* | Merge "Allocate large enough space bitmaps for malloc spaces."Hiroshi Yamauchi2014-05-281-6/+8
|\ \
| * | Allocate large enough space bitmaps for malloc spaces.Hiroshi Yamauchi2014-05-231-6/+8
| | | | | | | | | | | | | | | | | | | | | Fix a bug that we don't allocate space bitmaps for a malloc space that are large enough to cover the non-growth-limited capacity. Change-Id: I2e99a70eb8cddc284dffafa2d2afcc2f0c9074c7
* | | Add option to specify compiler executable.Tsu Chiang Chuang2014-05-271-2/+1
| |/ |/| | | | | Change-Id: I973da5e74be5a62461caacbc708288fb95e1b99b
* | Improve invalid large object free dumping.Mathieu Chartier2014-05-231-2/+4
| | | | | | | | | | Bug: 14974497 Change-Id: I30f99d693151ee5ae1f7b3d420519a0b1b21b2f4
* | Add reserve area to allocation stacks.Mathieu Chartier2014-05-234-60/+92
| | | | | | | | | | | | | | | | | | | | | | This fixes an issue with heap verification which was caused when the allocation stack overflowed. This resulted in heap verification failures since we were storing the newly allocated object in a handle scope without having it be live either in the live bitmap or allocation stack. We now push the object in the reserve area before we do a GC due to allocation stack overflow. Change-Id: I83b42c4b3250d7eaab1b49e53066e21c8656a740
* | Add support for jemalloc instead of dlmalloc.Christopher Ferris2014-05-221-1/+7
|/ | | | | Bug: 981363 Change-Id: I226ce3249c0d982eb1a9fdb9d04b25737f77345d
* Fix build.Mathieu Chartier2014-05-211-3/+3
| | | | | | Old Atomic things were rebased over. Change-Id: I437041af3247c316f2a75f5ef4bd35286fc8e2b1
* Merge "Begin migration of art::Atomic to std::atomic."Ian Rogers2014-05-2111-86/+94
|\
| * Begin migration of art::Atomic to std::atomic.Ian Rogers2014-05-2011-86/+94
| | | | | | | | Change-Id: I4858d9cbed95e5ca560956b9dabd976cebe68333
* | Change zygote_creation_lock_ to be member instead of static.Mathieu Chartier2014-05-212-3/+6
| | | | | | | | | | | | | | | | Static variables aren't thread safe and could cause the zygote to be created twice. Bug: 15133494 Change-Id: I65c8f089bed8de93f895b62b3dcff4c936931860
* | Merge "Simplify Class::IsArtFieldClass()."Hiroshi Yamauchi2014-05-211-3/+6
|\ \
| * | Simplify Class::IsArtFieldClass().Hiroshi Yamauchi2014-05-201-3/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the slight glitch that when ImageSpace::VerifyImageAllocations() called in ImageSpace::Create(), the ArtField and ArtMethod class roots weren't set, which were used by DCHECKs in Object::Size(), which VerifyImageAllocations() calls, by delaying the point of the VerifyImageAllocations() call to Runtime::Init() at which point the class linker has set the class roots. To completely disable read barriers from Object::SizeOf(), the ReadBarrierOption template parameter should have been added to Class::GetInstanceField(), which calls GetFieldObject(), when it's called from Class::IsArtFieldClass(). This change fixes this by removing the need for the call, instead of adding the ReadBarrierOption parameter. Bug: 12687968 Change-Id: Ibbecc08f4e3b898851805d690dff8ccac55e94f2
* | Improve heap verification for invalid roots.Mathieu Chartier2014-05-202-47/+54
|/ | | | | | | | | | | The new root verification prints the root type and owner thread id as well as the type of the object. Also a bit of work for planned multi-threaded verification. Bug: 14289301 Change-Id: Ia73c517dc11ec6dd82f3d945604ee3836b3db536
* Now we have a proper C++ library, use std::unique_ptr.Ian Rogers2014-05-1928-94/+91
| | | | | | | Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
* Check and log a to-space overflow explicitly.Hiroshi Yamauchi2014-05-191-0/+1
| | | | | | | Measured no noticeable performance regression with Ritzperf EvaluateAndApplyChanges and -Xgc:SS on Mako. Change-Id: Ib5ab934b867f91789a82ae771b45c95e9d01390c
* Follow up to "Add ISA directory to image and odex pathnames."Brian Carlstrom2014-05-192-4/+4
| | | | Change-Id: I7f08cc3052fbed93a56ccf1ab7675ae8bc129da9
* Merge "Add ISA directory to image and odex pathnames."Brian Carlstrom2014-05-191-2/+8
|\
| * Add ISA directory to image and odex pathnames.Brian Carlstrom2014-05-161-2/+8
| | | | | | | | | | | | Bug: 14882223 Bug: 14694978 Change-Id: Ic1b5ae836b8e91ea461dcd4f3da8e38dc3bec00f
* | Delete ClassHelper and fix compaction bug in GetDirectInterfaceMathieu Chartier2014-05-181-1/+1
|/ | | | | | | | | | | Cleanup helps to prevent compaction bugs. Fixed a fairly serious compaction error caused by calling ClassHelper::GetDirectInterface without handling the case where it causes thread suspension due to ResolveType. Bug: 8981901 Change-Id: I82b3bb6dd48d21eb6ece7aae0733c4a23c2bc408