summaryrefslogtreecommitdiffstats
path: root/runtime/intern_table.h
Commit message (Collapse)AuthorAgeFilesLines
* Move image intern table into imageMathieu Chartier2015-06-111-0/+28
| | | | | | | | | | | | | Previously we recreated this intern table during runtime startup. This added 50-100ms of boot time. Fixed bug where we didn't copy over hashcodes into the image. Deleted some stale code. Bug: 20727525 Bug: 19569780 Change-Id: I08959e9aa2a73cedb52f393033e2ffea3a26e76b
* Replace NULL with nullptrMathieu Chartier2015-04-221-1/+1
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Refactor and improve GC root handlingMathieu Chartier2015-04-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | Changed GcRoot to use compressed references. Changed root visiting to use virtual functions instead of function pointers. Changed root visting interface to be an array of roots instead of a single root at a time. Added buffered root marking helper to avoid dispatch overhead. Root marking seems a bit faster on EvaluateAndApplyChanges due to batch marking. Pause times unaffected. Mips64 is untested but might work, maybe. Before: MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us After: MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us Bug: 19264997 Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
* More of the concurrent copying collector.Hiroshi Yamauchi2015-01-231-1/+2
| | | | | Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
* Add hash setMathieu Chartier2014-11-061-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More memory efficient than libcxx since we do not box the values. Change intern table to use new hash set. Clean up intern table by removing const casts and deleting unnecessary code. Changed the class linker to use a hash set, also added a pre-zygote class table. 5 samples of: adb shell stop && adb shell start && sleep 60 && adb shell dumpsys meminfo Before: 165929 kB: Native 175859 kB: Native 168434 kB: Native 166559 kB: Native 169958 kB: Native After: 160972 kB: Native 159439 kB: Native 157204 kB: Native 165093 kB: Native 163039 kB: Native TODO: Add HashTable which is implemented by using a HashSet. TODO: Use for DexFile::find_class_def_misses_. TODO: Investigate using mem maps instead of native heap. Bug: 17808975 Change-Id: I93e376cf6eb9628cf52f4aefdadb6157acfb799a (cherry picked from commit e05d1d5fd86867afc7513b1c546375dba11eee50)
* Add image strings to intern tableMathieu Chartier2014-11-031-12/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we create the runtime, we now add the image strings to the intern table if we are the zygote. This caused some memory bloat, so I added an extra unordered set to the intern table. There is now two unordered sets (hash talbe). One for pre-zygote interns and one for post-zygote interns. This helps since the pre-zygote hash table doesn't get dirtied. Even with adding the image strings, we get total memory savings of around 5-7 MB native PSS after device boot. FB launch Before: 2.20% art::DexFile::FindStringId(char const*) const TotalTime: 2069 TotalTime: 1985 TotalTime: 2088 TotalTime: 2003 TotalTime: 2034 TotalTime: 2049 After boot native PSS: 175585 kB: Native After: 0.27% art::DexFile::FindStringId(char const*) const TotalTime: 1682 TotalTime: 1756 TotalTime: 1825 TotalTime: 1751 TotalTime: 1666 TotalTime: 1813 After boot native PSS: 167089 kB: Native Bug: 18054905 Bug: 16828525 Bug: 17808975 (cherry picked from commit b6e292bf7eac9d73c6b79b1e9b7b87beb02436c9) Change-Id: Ie367f3222f8c4db409ec49c3845276908b51e9c9
* Change intern table to unordered set.Mathieu Chartier2014-09-021-16/+22
| | | | | | | | | | | Intern table active used bytes goes from 430k to 317k on system server. Similar %wise savings on other apps. Bug: 16238192 (cherry picked from commit d910fcef539e12ab181e56ec80684f39c4e95733) Change-Id: Ic70395124435c6f420a77e6d8639404a160f395a
* Add native memory accounting through custom allocator.Mathieu Chartier2014-08-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a custom allocator that lets you pass in a special tag which specifices where the allocation came from. This is used when dumping. The performance overhead is low since each allocation only does a atomic add/sub for each allocation/free. The measurements are dumped to traces.txt during SIGQUIT. Example output: I/art (27274): AllocatorTagHeap active=120 max=120 total=168 I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724 I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608 I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080 I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392 I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044 I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688 I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760 I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136 I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56 I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8 I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156 I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020 I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864 I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320 I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852 Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82 (cherry picked from commit 5369c40f75fdcb1be7a7c06db212ce965c83a164)
* Add GcRoot to clean up and enforce read barriers.Hiroshi Yamauchi2014-07-291-4/+7
| | | | | | | | | | | | | Introduce a value-type wrapper around Object* for GC roots so that 1) we won't have to directly add the read barrier code in many places and 2) we can avoid accidentally bypassing/missing read barriers on GC roots (the GcRoot interface ensures that the read barrier is executed on a read). The jdwp test passed. Bug: 12687968 Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
* Add read barriers for the class and the intern tables.Hiroshi Yamauchi2014-06-131-5/+9
| | | | | | | | | Add read barriers for the strong roots in the intern table and the (strong) roots in the class table to make possible concurrent scanning of them. Bug: 12687968 Change-Id: If6edc33a37e65a8494e66dc3b144138b1530367f
* Add read barriers to the weak roots in the intern table.Hiroshi Yamauchi2014-05-281-2/+18
| | | | | Bug: 12687968 Change-Id: I424f1df76a7e3d7154fb9f3c951c973d19bd640f
* Now we have a proper C++ library, use std::unique_ptr.Ian Rogers2014-05-191-1/+1
| | | | | | | Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-3/+2
| | | | | | | | | | | 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
* Avoid marking old class linker and intern table roots during pause.Mathieu Chartier2014-03-041-13/+16
| | | | | | | | | | | | | | | | | | | | 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
* Remove blacklistSebastien Hertz2014-02-171-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the class initialization blacklist and use transaction to detect and revert class initialization attempting to invoke native method. This only concerns class initialization happening at compilation time when generating an image (like boot.art for the system). In transactional mode, we log every object's field assignment and array update. Therefore we're able to abort a transaction to restore values of fields and array as they were before the transaction starts. We also log changes to the intern string table so we can restore its state prior to transaction start. Since transactional mode only happens at compilation time, we don't need to log all these changes at runtime. In order to reduce the overhead of testing if transactional mode is on/off, we templatize interfaces of mirror::Object and mirror::Array, respectively responsible for setting a field and setting an array element. For various reasons, we skip some specific fields from transaction: - Object's class and array's length must remain unchanged so garbage collector can compute object's size. - Immutable fields only set during class loading: list of fields, method, dex caches, vtables, ... as all classes have been loaded and verified before a transaction occurs. - Object's monitor for performance reason. Before generating the image, we browse the heap to collect objects that need to be written into it. Since the heap may still holds references to unreachable objects due to aborted transactions, we trigger one collection at the end of the class preinitialization phase. Since the transaction is held by the runtime and all compilation threads share the same runtime, we need to ensure only one compilation thread has exclusive access to the runtime. To workaround this issue, we force class initialization phase to run with only one thread. Note this is only done when generating image so application compilation is not impacted. This issue will be addressed in a separate CL. Bug: 9676614 Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
* Add root types and thread id to root visiting.Mathieu Chartier2014-02-111-3/+3
| | | | | | | Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
* resolved conflicts for merge of bb0140e0 to dalvik-devMathieu Chartier2013-09-201-0/+5
|\ | | | | | | Change-Id: I31e0c05c5e917cf3275296a7f65bd8b78ec9b78b
| * Re-enable concurrent system weak sweeping.Mathieu Chartier2013-09-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | Enabled by disallowing new system weaks during the pause and re-allowing it after the system weaks have been swept. Reduces GC pause by ~1ms. Fixes pause regression caused by fix for Bug: 10626133 Change-Id: If49d33e7ef19cb728ed3cef5187acfa53b9b05d8
* | Merge "Refactor system weak sweeping, add support for modification." into ↵Mathieu Chartier2013-09-181-2/+1
|\ \ | |/ |/| | | dalvik-dev
| * Refactor system weak sweeping, add support for modification.Mathieu Chartier2013-09-171-2/+1
| | | | | | | | | | | | Required for moving collectors. Change-Id: Ib97ba4a05af1139f8d388077a15e62bcb9534855
* | Fix race in root marking.Mathieu Chartier2013-09-171-7/+2
|/ | | | | | | | | | | | | | There was a race which caused the class linker / intern table to not become dirty after adding a root. We now guard the is dirty flag by the corresponding locks to prevent this from occuring. This was causing roots to be occasionally missed. Also fixes the bug where we occasionally scan more cards than needed. Bug: 10626133 Change-Id: I0f6e72d92035ff463954d66988ef610ea0df61be
* Don't scan image space when starting runtime.Ian Rogers2013-08-231-5/+0
| | | | | | | | | | | | | | | | | Bug 10432288. Find Classes and Strings from dex caches lazily rather than when the image is loaded. Make class status changes do notifies when there can be waiters. For Class lookup there's a pathology if we always search dex caches and so after 1000 failures move all classes into the class table. Be consistent in using "const char*" for class linker descriptors as this most easily agrees with the type in the dex file. Improve the intern run-test so that it has a case of a literal contained in the image. Modify image_test to allow any valid lock word rather than expecting 0, ideally we wouldn't see inflated monitors but we do due to NotifyAll (see bug 6961405). Change-Id: Ia9bfa748eeccb9b4498784b97c6823141b1f6db8
* 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/+98
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