summaryrefslogtreecommitdiffstats
path: root/runtime/intern_table.cc
Commit message (Collapse)AuthorAgeFilesLines
* Move image intern table into imageMathieu Chartier2015-06-111-17/+63
| | | | | | | | | | | | | 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
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 (cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33) Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d Fix some ArtMethod related bugs Added root visiting for runtime methods, not currently required since the GcRoots in these methods are null. Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes --trace run-tests 005, 044. Fixed optimizing compiler bug where we used a normal stack location instead of double on ARM64, this fixes the debuggable tests. TODO: Fix JDWP tests. Bug: 19264997 Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3 ART: Fix casts for 64-bit pointers on 32-bit compiler. Bug: 19264997 Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457 Fix JDWP tests after ArtMethod change Fixes Throwable::GetStackDepth for exception event detection after internal stack trace representation change. Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of proxy method. Bug: 19264997 Change-Id: I363e293796848c3ec491c963813f62d868da44d2 Fix accidental IMT and root marking regression Was always using the conflict trampoline. Also included fix for regression in GC time caused by extra roots. Most of the regression was IMT. Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to detached thread. EvaluateAndApplyChanges: From ~2500 -> ~1980 GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots Bug: 19264997 Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0 Fix bogus image test assert Previously we were comparing the size of the non moving space to size of the image file. Now we properly compare the size of the image space against the size of the image file. Bug: 19264997 Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a [MIPS64] Fix art_quick_invoke_stub argument offsets. ArtMethod reference's size got bigger, so we need to move other args and leave enough space for ArtMethod* and 'this' pointer. This fixes mips64 boot. Bug: 19264997 Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
* 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
* Improve performance of HashSetnikolay serdjuk2015-04-211-5/+5
| | | | | | | | Don't pollute hash table with duplicates. Check for existing value before storing a new one. Change-Id: If43ea5e98a3f3ba187b8dea66f3712ec62bd3f60 Signed-off-by: nikolay serdjuk <nikolay.y.serdjuk@intel.com>
* Fix CC root visiting bugMathieu Chartier2015-04-071-1/+2
| | | | | | Also some cleanup. Change-Id: Ia3de8f2d409770be3619ec116e8b06ecd82338fe
* Refactor and improve GC root handlingMathieu Chartier2015-04-061-6/+7
| | | | | | | | | | | | | | | | | | | | | | 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-0/+8
| | | | | Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
* Print more info in MarkSweep::VerifyRootMathieu Chartier2015-01-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Refactored old root callback to use a new class called RootInfo. RootInfo contains all the relevant info related to the root associated with the callback. The MarkSweep::VerifyRoot function now uses this info to print the StackVisitor's described location if the GC root is of the type kRootJavaFrame. Some other cleanup. Example output: E/art (12167): Tried to mark 0x123 not contained by any spaces E/art (12167): Attempting see if it's a bad root E/art (12167): Found invalid root: 0x123 with type RootJavaFrame E/art (12167): Location=Visiting method 'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0) vreg=0 (cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a) Bug: 18588862 Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
* Don't call AddImageStringsToTable or MoveImageClassesToClassTable if running ↵Mathieu Chartier2014-11-171-0/+1
| | | | | | | | | | | | | | | imageless If we fail to create the image we use imageless running, this was breaking AddImageStringsToTable since we didn't check for this case. Added a check which avoids calling AddImageStringsToTable and MoveImageClassesToClassTable if we don't have an image. Bug: 18412472 (cherry picked from commit ab1953f35880f94752e1fcde3f6b3f0d3532125b) Change-Id: Ida18e1fcd04d752d55923e65c3122c0ac0bde728
* Add hash setMathieu Chartier2014-11-061-73/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* ART: More warningsAndreas Gampe2014-11-041-3/+3
| | | | | | | Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-1/+2
| | | | | | | | | | | Fix associated errors about unused paramenters and implict sign conversions. For sign conversion this was largely in the area of enums, so add ostream operators for the effected enums and fix tools/generate-operator-out.py. Tidy arena allocation code and arena allocated data types, rather than fixing new and delete operators. Remove dead code. Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
* Add image strings to intern tableMathieu Chartier2014-11-031-53/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add missing read barriers to intern table.Mathieu Chartier2014-09-021-6/+5
| | | | | | Also deleted GcRoot::Assign. Change-Id: Ib1ea739cf79c72fc92a8628cd9095c11b660e018
* Change intern table to unordered set.Mathieu Chartier2014-09-021-72/+78
| | | | | | | | | | | 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 GcRoot to clean up and enforce read barriers.Hiroshi Yamauchi2014-07-291-28/+24
| | | | | | | | | | | | | 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-16/+20
| | | | | | | | | 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-15/+40
| | | | | Bug: 12687968 Change-Id: I424f1df76a7e3d7154fb9f3c951c973d19bd640f
* Fix InternTable::Lookup()/Remove() for hash code collisions.Vladimir Marko2014-05-221-2/+4
| | | | | | | | | | | | | | | | When we have a hash code collision but the string is not yet in the intern table, the old Lookup() would iterate until the end of the table, i.e. it was up to linear in the size of the table rather than linear in the number of colliding hash codes. And though the multimap::find() is implemented in terms of lower_bound() in the standard library we're using, this requirement doesn't seem to be in the C++ standard. It was therefore wrong to assume that we will iterate across all hits when starting from the iterator returned by find(). Change-Id: Ie24aaea6e55750a7aafbed24b136878c5dba66eb
* Now we have a proper C++ library, use std::unique_ptr.Ian Rogers2014-05-191-1/+2
| | | | | | | Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
* Compatibility layer to transition from UniquePtr to std::unique_ptr.Ian Rogers2014-05-151-1/+1
| | | | | | | | | Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr, for the host switch to std::unique_ptr. For now the type remains called UniquePtr. Make dalvik compile with clang on the host, move its build to C++11. Change-Id: I5ba8d2757904bc089ed62047ea03de3c0853fb12
* 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