summaryrefslogtreecommitdiff
path: root/runtime/intern_table.cc
Commit message (Collapse)AuthorAgeFilesLines
* Make some hash/equals operators inline.Vladimir Marko2021-03-041-49/+3
| | | | | | | | | | | | | Namely class descriptor hash/equals in ClassTable and string hash/equals in InternTable. This should reduce reliance on ThinLTO for performance. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 179799979 Bug: 179837605 Change-Id: Ie513b2312d30e1b52efefd705a26d13035789e4a
* Avoid an unnecessary ComputeModifiedUtf8Hash().Vladimir Marko2021-02-081-5/+5
| | | | | | | | | | | | | The DescriptorHashPair already has the hash as the member `second`, so avoid recalculating it in release mode. Also split "HashEquals" classes into separate "Hash" and "Equals" classes to disambiguate their operators in traces. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 175869411 Change-Id: I87cbe613778c7d310ba5c2bf437729244780472c
* Rewrite intern table construction in ImageWriter.Vladimir Marko2021-01-281-24/+0
| | | | | | | | | | | | | | | | | | | | | | Make sure that intern tables in images are at maximum load factor (full) and make that maximum load factor independent of runtime parameters. As we pre-allocate an intern table buffer of the right size in ImageWriter, we also avoid unnecessary resizing of the temporary intern table. Instead of using InternTable::LookupStrong() for intern lookup, access the internal non-boot image intern table directly. This avoids unnecessary lookups in boot image intern tables and the intern table lock is locked only once instead of locking for each StringId in input dex files. Remove obsolete comment related to patchoat relocations. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: boots. Bug: 175869411 Change-Id: Ie74e1ac1b1b1d25add74edd38b7e1d70b6654ee3
* GC-independent image layout.Vladimir Marko2019-06-271-0/+5
| | | | | | | | | | | | | | | | Make sure we visit objects in a defined order, independent of their order in the heap. The new order depends only on dex file contents and contents of initialized classes, thus any non-determinism would have to be contributed by the class initialization itself rather than GC. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 26687569 Change-Id: I62521322289a22eb13faae526ba2c3589e6ab381
* Do not force-intern Strings in images.Vladimir Marko2019-06-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Interning all image Strings breaks the reference equality semantics. See android.net.Uri.NOT_CACHED for an example where it goes against the intent of the Java code. Instead, only put interned strings (weakly and strongly) to the image intern tables. Since image interns are referenced as long as the image is memory, we can promote weak interns to strong interns. Doing this before the image layout helps ImageWriter::CalculateNewObjectOffsets() which would not have previously found weak interns. Added a regression test that relies on better initialization of app image classes, so it shall be "active" only after an improvement in that area. (This can be checked by commenting out the NoClinitInDependency() check in CompilerDriver's InitializeClassVisitor::TryInitializeClass().) Bug: 134746125 Test: 176-app-image-string Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Change-Id: I51fa1edf953c9060c41f39812f3ba27f12b02801
* Track what intern tables are from boot imagesMathieu Chartier2018-11-011-25/+25
| | | | | | | | | | Goal: Use this to make it faster to do collision checks between app image intern tables against the non boot image intern tables. Bug: 116059983 Test: test-art-host Change-Id: I7a2305167335da5b6685822894f7985970e99053
* ART: Do some include-what-you-useAndreas Gampe2018-10-291-0/+1
| | | | | | | | | Help with transitive includes. In preparation for new specialized headers reducing transitivity. Bug: 118385392 Test: mmma art Change-Id: Ie79afda4e09191428c2b4c2f20a7e3352c01c1e9
* Add extra handling for loading intern tablesMathieu Chartier2018-10-151-40/+0
| | | | | | | | | | | | | | | Add an extra pass to fix up the app image intern table using a visitor. This visitor records if there are any image conflicts and avoids the image fixup phase if there are none. Added logic to bulk add the image intern table to the boot image. Will add optimizations later. Bug: 116059983 Test: test-art-host Change-Id: I50a6fdaf9c9a049a3d120e88d63fe7da8c9a298c
* Use HashSet<std::string> instead of unordered_set<>.Vladimir Marko2018-06-211-9/+9
| | | | | | | | | | | | | | | Change the default parameters for HashSet<std::string> to allow passing StringPiece as a key, avoiding an unnecessary allocation. Use the HashSet<std::string> instead of std::unordered_set<std::string>. Rename HashSet<> functions that mirror std::unordered_multiset<> to lower-case. Fix CompilerDriver::LoadImageClasses() to avoid using invalidated iterator. Test: m test-art-host-gtest Test: testrunner.py --host Change-Id: I7f8b82ee0b07befc5a0ee1c420b08a2068ad931e
* Make duplicate intern string check be debug onlyMathieu Chartier2018-02-221-1/+1
| | | | | | | | | | This check was expensive and costing up to 300ms per dex2oat invocation. Disabling the check reduces OTA/first boot time by ~10-20s for low preopt devices. Test: test-art-host Bug: 70934104 Change-Id: I7ed0a0d098bc725c6fbb24318b73816506c2deec
* Revert "Revert "Make libdexfile build independent of runtime dir""David Sehr2018-01-311-1/+1
| | | | | | | | | | This reverts commit 787784f9effb126b5d0d3dc97d544c4a477b5daf. Reason for revert: Bot configuration issue. Change-Id: I6a10bb4a9571f89c7e4dd095f9157e830a44e2de Bug: 22322814 Test: make -j 50 checkbuild
* Revert "Make libdexfile build independent of runtime dir"David Sehr2018-01-301-1/+1
| | | | | | | | This reverts commit b40b7e73469339a6b667b4a2e2b8690112a74dc9. Reason for revert: on device libdexfile.so missing Change-Id: I9bd61a98bef870400580e8c991cb061d3f57fa72
* Make libdexfile build independent of runtime dirDavid Sehr2018-01-301-1/+1
| | | | | | | | | | | | Remove libdexfile's dependency on utils.cc and move utf.cc into /dex. Remove libdexfile's constituent sources from libart and use libdexfile wherever libart is. Also remove some ART-specific interfaces. Libdexfile's tests remain to be converted, plus moving the files to a new directory peer to runtime/. Bug: 22322814 Test: make -j 50 test-art-host Change-Id: Ifaf695216e4a0e43d3aa377984d933f7a2a243c2
* Clean up ImageHeader section getters.Vladimir Marko2017-09-051-1/+1
| | | | | | Test: m art-test-host-gtest Test: testrunner.py --host Change-Id: Iaea7ce6f9bc3ff3c6d9bb6fb598aa62333ebf30c
* ART: Include cleanupAndreas Gampe2017-07-241-2/+2
| | | | | | | | | | | | | | | | | | | Let clang-format reorder the header includes. Derived with: * .clang-format: BasedOnStyle: Google IncludeIsMainRegex: '(_test|-inl)?$' * Steps: find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup' git-clang-format -style=file HEAD^ manual inspection git commit -a --amend Test: mmma art Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
* ART: Small class-inl.h cleanupAndreas Gampe2017-06-051-0/+1
| | | | | | | | Remove unnecessary class_linker-inl.h include, and fix up all transitives (mainly gc_root-inl.h). Also clean up reference.h. Test: m test-art-host Change-Id: I47bd6edcfe4a23821e37a6e6fa8cca91d0d2d226
* ART: More header cleanupsAndreas Gampe2017-06-051-0/+1
| | | | | | | Pull out more dependencies through forward declarations. Test: m test-art-host Change-Id: I7d86726928937f788b956ec9eac91532d66d57ae
* Fix incorrect string hash value extension during cross-compilation.Alexey Grebenkin2016-12-201-1/+3
| | | | | | | | | | | | Previouly, having a 32-bit Android device and a 64-bit host to compile boot.oat could lead to an interning table be fulfilled using one hash function and be worked with using another hash function (which is caused by sign extension). Target case is any string with a negative .GetHashCode(). Test: test-art-host-gtest-intern_table_test Change-Id: I3f417e1ac990ef681f0651160292130e9b3632f0
* Merge "Make empty checkpoint work while weak ref access is disabled."Hiroshi Yamauchi2016-11-111-1/+0
|\
| * Make empty checkpoint work while weak ref access is disabled.Hiroshi Yamauchi2016-11-091-1/+0
| | | | | | | | | | | | | | | | | | | | Fix a potential race on PushOntoMarkStack for CC by running an empty checkpoint (while weak ref access is disabled). Bug: 32508093 Bug: 12687968 Test: test-art-host with CC/CMS, libartd boot with N9, Ritz EAAC. Change-Id: I3749bb525e7734804307ee16262355f3fc730312
* | Fix spin waiting for weak ref access in the intern table for CC.Hiroshi Yamauchi2016-11-031-1/+2
| | | | | | | | | | | | Bug: 32637633 Test: test-art-host with CC Change-Id: I8f0f9f5ca24687f688318ea5cafcbb7f6597448c
* | Move intern table to ObjPtrMathieu Chartier2016-10-311-32/+37
|/ | | | | | | | | | | | | Also moved StringLog to use a GcRoot. Also removed read barriers from lookup to prevent making weak strings strongly live more often than necessary. Bug: 31113334 Test: clean-oat-host && test-art-host CC baker Change-Id: I05586e125d5dfed8d184890468fd398c79f32619
* Do not write empty class table and intern table to image.Vladimir Marko2016-10-141-58/+1
| | | | | | | | And remove dead ClassLinker and InternTable code that would be erroneously triggered by not writing the tables. Test: m test-art-host Change-Id: I2520daa8d1231e16112d44e364a72d782fa32527
* Try to avoid allocation when interning strings.Vladimir Marko2016-09-061-1/+7
| | | | | | | | | This speeds up const-string operations when there are hash conflicts in the DexCache string array and prevents throwing OOME when the String has been previously allocated. Test: Run ART test suite on host and Nexus 6. Change-Id: Iaea46869d1f84bfc53c07659151203fc747e9643
* creating workflow for mirror::String compressionjessicahandojo2016-08-231-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | All-ASCII String characters are stored in 8-bit blocks instead of 16-bit. The compression has not taken place, but all workflow are in the code already (changing kUseStringCompression in string.h file to TRUE will enable the feature) Notes: Feature works on interpreter only without optimizing Test art: m ART_TEST_INTERPRETER=true ART_TEST_OPTIMIZING=false test-art-host Also tested with String tests from libcore/: 1. libcore.java.lang.StringTest 2. libcore.java.lang.StringBufferTest 3. libcore.java.lang.StringBuilderTest 4. libcore.java.lang.OldStringTest 5. libcore.java.lang.OldStringBufferTest Memory improvement is 33% (from 6.03% to 4.03%, total String memory from all apps per total memory of all apps) measured on Angler with Hprof tools Bug: 31040547 Change-Id: I9cc92c265ebf1305fc06b5fc33efd83797660cce
* Change hash set to use noexceptMathieu Chartier2016-04-061-1/+5
| | | | | | | | | | | | | Otherwise it uses copy constructor instead of move constructor in some cases (like std::vector). Reduces shared dirty native by around 350k. Bug: 27860101 (cherry picked from commit 5ef868c8332db11bb90284887a7f676f5dbef373) Change-Id: I0311fa530fc2436630abebfdac2cad375eb4d691
* Optimizing: Improve const-string code generation.Vladimir Marko2016-03-291-0/+36
| | | | | | | | | | | | | | | | | | | | | | | For strings in the boot image, use either direct pointers or pc-relative addresses. For other strings, use PC-relative access to the dex cache arrays for AOT and direct address of the string's dex cache slot for JIT. For aosp_flounder-userdebug: - 32-bit boot.oat: -692KiB (-0.9%) - 64-bit boot.oat: -948KiB (-1.1%) - 32-bit dalvik cache total: -900KiB (-0.9%) - 64-bit dalvik cache total: -3672KiB (-1.5%) (contains more files than the 32-bit dalvik cache) For aosp_flounder-userdebug forced to compile PIC: - 32-bit boot.oat: -380KiB (-0.5%) - 64-bit boot.oat: -928KiB (-1.0%) - 32-bit dalvik cache total: -468KiB (-0.4%) - 64-bit dalvik cache total: -1928KiB (-0.8%) (contains more files than the 32-bit dalvik cache) Bug: 26884697 Change-Id: Iec7266ce67e6fedc107be78fab2e742a8dab2696
* Remove GetImageRoots read barrier for image relocationMathieu Chartier2016-01-261-0/+1
| | | | | | | | Fixes CC assertion that failed if an app image was loaded when the GC was running. Bug: 26786304 Change-Id: I47bea7b4b947332b57be2e2db604c2c25d92b7e2
* Revert "Revert "Load app images""Mathieu Chartier2016-01-251-8/+17
| | | | | | | | This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c. Bug: 22858531 Change-Id: Ide00bf3a73a02cba3bb364177204ad1b13f70295
* Revert "Load app images"Nicolas Geoffray2016-01-231-17/+8
| | | | | | | | | | Fails when a method is duplicated (see test 097-duplicate-method) Bug: 22858531 This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46. Change-Id: Ib30ae5be00cc568e799290be6b3c8f29cbbe4c20
* Load app imagesMathieu Chartier2016-01-221-8/+17
| | | | | | | | | | | | | | | | | | | Support in-place patching of the app image based on boot image location and app oat location. Only loads for art run test so far since we do not automatically generate app images for app installs. N5 maps launch time (~200 runs): Before: 930ms After: 878.18ms After + image class table: 864.57ms TODO: Oatdump support. Store class loaders as class roots in image. Bug: 22858531 Change-Id: I9cbc645645e62ea2ed1ad8e139e91af7d88514c1
* Address some intern table commentsMathieu Chartier2016-01-061-23/+25
| | | | Change-Id: I7ffaa463272015c2924ba03e006041daee498ad4
* Re-enable adding intern table to imageMathieu Chartier2016-01-061-90/+100
| | | | | | | | | | Changed intern table to have a stack of tables similarily to ClassTable. Adding an image intern table adds to the front of the intern table stack. Also some cleanup. Bug: 26317072 Change-Id: I7bbf9485b5dbbbf3707fed21e29de3beccfb8705
* Dex2oat support for multiple oat file and image file outputs.Jeff Hao2015-12-231-15/+18
| | | | | | | | Multiple changes to dex2oat and the runtime to support a --multi-image option. This generates a separate oat file and image file output for each dex file input. Change-Id: Ie1d6f0b8afa8aed5790065b8c2eb177990c60129
* Image space cleanup for app imagesMathieu Chartier2015-11-111-1/+1
| | | | | | | | | | Removed Heap::GetImageSpace, added Heap::GetBootImageSpace. Generalized some logic in the class linker for image spaces. Bug: 22858531 Change-Id: Ib3e12bb061a247e232d3dc93b0d6b35eb3a34d25
* Change hash table load factorsMathieu Chartier2015-10-161-0/+8
| | | | | | | | | | | | | | | Changed class table and intern table load factors to query the runtime. The runtime returns load factors based on whether or not we are a low ram device. DescriptorEquals time for class linking goes from 10% -> 1.2% for compiling GmsCore with interpret only. Added test. Bug: 24917584 Change-Id: Iaaf5d2eab1b0c2d188d299e4bc1852cdb3801173
* Merge "ART: Move DexCache arrays to native."Vladimir Marko2015-09-041-3/+2
|\
| * ART: Move DexCache arrays to native.Vladimir Marko2015-09-031-3/+2
| | | | | | | | | | | | | | This CL has a companion CL in libcore/ https://android-review.googlesource.com/162985 Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
* | Add ScopedThreadSuspensionMathieu Chartier2015-09-031-6/+6
| | | | | | | | | | | | | | Fixes the TransitionFromRunnableToSuspended and TransitionFromSuspendedToRunnable pattern that was prone to errors. Change-Id: Ie6ae9c0357c83b4fc4899d05dfa0975553170267
* | Some fixes for the CC collector.Hiroshi Yamauchi2015-09-031-7/+1
|/ | | | | | | | | | | | | | | - Remove a DCHECK in DisableMarkingCheckpoint, which caused occasional (false) failures. - Check the thread-local GetWeakRefAccessEnabled in boxed lambdas weak access. - Add missing BroadcastForNewAllocationRecords and BroadcastForNewWeakBoxedLambdas. The lack of the former caused occasional deadlocks in the ddmc test. - Remove the 'ensure system weaks disallowed' calls, which weren't useful and dead. Bug: 12687968 Change-Id: I33850c8d12e6e1a3aed1c2bb18eba263cbab76e8
* Address some comments and clean upMathieu Chartier2015-08-041-10/+18
| | | | Change-Id: I538cf204f1c89d5fc81f8fc5e5800fcf1cf87359
* Change intern table to not use WaitHoldingLocksMathieu Chartier2015-07-171-31/+64
| | | | | Bug: 22423014 Change-Id: I9e16b8cb4def72fff73f1783a182877105feb7aa
* Clean up GC callbacks to be virtual methodsMathieu Chartier2015-07-141-7/+8
| | | | Change-Id: Ia08034a4e5931c4fcb329c3bd3c4b1f301135735
* Thread-local mark stacks for the CC collector.Hiroshi Yamauchi2015-07-131-1/+9
| | | | | | | | | | | | | | | | | | | | | | | Thread-local mark stacks are assigned to mutators where they push references in read barriers to reduce the (CAS) synchronization cost in a global mark stack/queue. We step through three mark stack modes (thread-local, shared, GC-exclusive) and use per-thread flags to disable/enable system weak accesses (only for the CC collector) instead of the existing global one to safely perform the marking phase. The reasons are 1) thread-local mark stacks for mutators need to be revoked using a checkpoint to avoid races (incorrectly leaving a reference on mark stacks) when terminating marking, and 2) we can’t use a checkpoint while system weak accesses are disabled (or a deadlock would happen). More details are described in the code comments. Performance improvements in Ritzperf EAAC: a ~2.8% improvement (13290->12918) in run time and a ~23% improvement (51.6s->39.8s) in the total GC time on N5. Bug: 12687968 Change-Id: I5d234d7e48bf115cd773d38bdb62ad24ce9116c7
* 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. (cherry picked from commit fac3a390a247fe33d4873773d742aad4cc100118) Bug: 20727525 Bug: 19569780 Change-Id: I08959e9aa2a73cedb52f393033e2ffea3a26e76b
* Move mirror::ArtMethod to nativeMathieu Chartier2015-05-291-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 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
* 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