summaryrefslogtreecommitdiffstats
path: root/runtime/intern_table.cc
Commit message (Collapse)AuthorAgeFilesLines
* Don't return null for null utf in AllocFromModifiedUtf8.Mathieu Chartier2014-03-211-4/+4
| | | | | | | | | | If you pass in a null utf string it should not be the same behavior as out of memory. This previously caused serious problems in: https://android-review.googlesource.com/#/c/80768/ Change-Id: I9dfb710b57f6cc91064812f52a3db64254769461
* Avoid marking old class linker and intern table roots during pause.Mathieu Chartier2014-03-041-27/+44
| | | | | | | | | | | | | | | | | | | | 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
* Change root visitor to use Object**.Mathieu Chartier2014-02-181-3/+2
| | | | | | | Simplifies code and improves the performance of root visiting since we usually don't need to check to see if the object moved. Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
* Remove blacklistSebastien Hertz2014-02-171-21/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-9/+10
| | | | | | | Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
* Compacting collector.Mathieu Chartier2013-11-111-5/+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
* resolved conflicts for merge of bb0140e0 to dalvik-devMathieu Chartier2013-09-201-2/+22
|\ | | | | | | Change-Id: I31e0c05c5e917cf3275296a7f65bd8b78ec9b78b
| * Re-enable concurrent system weak sweeping.Mathieu Chartier2013-09-201-2/+22
| | | | | | | | | | | | | | | | | | | | | | 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-3/+5
|\ \ | | | | | | | | | dalvik-dev
| * | Refactor system weak sweeping, add support for modification.Mathieu Chartier2013-09-171-3/+5
| | | | | | | | | | | | | | | | | | Required for moving collectors. Change-Id: Ib97ba4a05af1139f8d388077a15e62bcb9534855
* | | resolved conflicts for merge of 613eae4a to dalvik-devMathieu Chartier2013-09-171-8/+11
|\ \ \ | |/ / |/| / | |/ Change-Id: I61734cbf585decf9a50ba23f008b341d025339ff
| * Fix race in root marking.Mathieu Chartier2013-09-171-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add support for changing roots through the root visitor callback.Mathieu Chartier2013-09-131-4/+4
|/ | | | | | Needed for copying collectors. Change-Id: Icc4a342a57e0cfb79587edb02ef8c85e08808877
* Don't scan image space when starting runtime.Ian Rogers2013-08-231-26/+59
| | | | | | | | | | | | | | | | | 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 up TODO: c++0x, update cpplint.Mathieu Chartier2013-08-161-9/+6
| | | | | | | | | | | | 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
* Fix cpplint whitespace/comments issuesBrian Carlstrom2013-07-261-4/+4
| | | | Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+180
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