summaryrefslogtreecommitdiffstats
path: root/runtime/base
Commit message (Collapse)AuthorAgeFilesLines
* Merge "ART: Bitvector extensions for dumping and size handling"Vladimir Marko2014-04-282-16/+72
|\
| * ART: Bitvector extensions for dumping and size handlingJean Christophe Beyler2014-04-242-16/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | - Added dumping functions and the ensure size and clear function. - Fixed a bug in union where if a bit is not set in the source, an buffer overflow can occur later down. Change-Id: Iff40529f3a8970a1ce2dd5c591f659f71924dea3 Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com> Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com> Signed-off-by: Yixin Shou <yixin.shou@intel.com> Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com> Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
* | Enable reading page map without lock in RosAlloc::BulkFreeMathieu Chartier2014-04-251-11/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enabling this flag greatly reduces how much time was spent in the GC. It was not done previously since it was regressing MemAllocTest. With these RosAlloc changes, the benchmark score no longer regresses after we enable the flag. Changed Run::AllocSlot to only have one mode of allocation. The new mode is finding the first free bit in the bitmap. This was previously the slow path but is now the fast path. Some optimizations which enabled this include always having the alloc bitmap bits which correspond to invalid slots be set to 1. This prevents us from needing a bound check since we will never end up allocating there. Changed revoking thread local buffer to point to an invalid run. The invalid run is just a run which always has all the allocation bits set to 1. When a thread attempts to do a thread local allocation from here it will always fail and go slow path. This eliminates the need for a null check for revoked runs. Changed zeroing of memory to happen during free, AllocPages should always return zeroed memory. Added prefetching which happens when we allocate a run. Some refactoring to reduce duplicated code. Ergonomics changes: Changed kStickyGcThroughputAdjustment to 1.0, this helps reduce GC time. Measurements (3 samples per benchmark): Before: MemAllocTest scores: 3463, 3445, 3431 EvaluateAndApplyChanges score | total GC time Iter 1: 3485, 23.602436s Iter 2: 3434, 22.499882s Iter 3: 3483, 23.253274s After: MemAllocTest scores: 3495, 3417, 3409 EvaluateAndApplyChanges score | total GC time: Iter 1: 3375, 17.463462s Iter 2: 3358, 16.185188s Iter 3: 3367, 15.822312s Bug: 8788501 Bug: 11790317 Bug: 9986565 Change-Id: Ifd273a054824028dabed27c07c081dde1816f93c
* Merge "Avoid allocating OatFile::OatClass on the heap."Vladimir Marko2014-04-223-38/+46
|\
| * Avoid allocating OatFile::OatClass on the heap.Vladimir Marko2014-04-143-38/+46
| | | | | | | | | | | | | | | | | | | | Avoid allocating a BitVector for OatFile::OatClass::bitmap_ with kOatClassSomeCompiled methods. That makes the OatClass copy-constructible as it doesn't own any memory. We use that in OatFile::OatDexFile::GetOatClass() to return the result by value thus avoiding one or two heap allocations per call. Change-Id: Ic7098109028a5b49e39ef626f877de86e732ed18
* | Add an option to specify a list of methods for LIR dumping.Mingyao Yang2014-04-182-0/+5
| | | | | | | | | | | | | | | | | | An example would be: --runtime-arg -verbose-methods:Array.checkRange32,Array.checkRange64 or "-verbose-methods:void Array.checkRange32,void Array.checkRange64" Change-Id: I61c1eb3b2eb4b24126a9264261c27889d53cc6bd
* | Long support in optimizing compiler.Nicolas Geoffray2014-04-162-0/+119
|/ | | | | | | | | - Add stack locations to the Location class. - Change logic of parameter passing/setup by setting the location of such instructions the ones for the calling convention. Change-Id: I4730ad58732813dcb9c238f44f55dfc0baa18799
* Add monitor deflation.Mathieu Chartier2014-04-071-0/+1
| | | | | | | | | | | We now deflate the monitors when we perform a heap trim. This causes a pause but it shouldn't matter since we should be in a state where we don't care about pauses. Memory savings are hard to measure. Fixed integer overflow bug in GetEstimatedLastIterationThroughput. Bug: 13733906 Change-Id: I4e0e68add02e7f43370b3a5ea763d6fe8a5b212c
* Merge "Remove use of pthread_cond_timedwait_monotonic."Narayan Kamath2014-03-311-5/+9
|\
| * Remove use of pthread_cond_timedwait_monotonic.Narayan Kamath2014-03-201-5/+9
| | | | | | | | | | | | | | | | | | Use posix compliant pthread_condattr_setclock instead. Also, remove usage of HAVE_TIMEDWAIT_MONOTONIC and replace it with a specific reference to the only supported platform that doesn't have it. Change-Id: I933f05c5b4965bab88ccd8e3e26c91549ed4184d
* | Refactor some GC code.Mathieu Chartier2014-03-281-11/+6
| | | | | | | | | | | | | | | | Reduced amount of code in mark sweep / semi space by moving common logic to garbage_collector.cc. Cleaned up mod union tables and deleted an unused implementation. Change-Id: I4bcc6ba41afd96d230cfbaf4d6636f37c52e37ea
* | Change sticky GC ergonomics to use GC throughput.Mathieu Chartier2014-03-273-21/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old sticky ergonomics used partial/full GC when the bytes until the footprint limit was < min free. This was suboptimal. The new sticky GC ergonomics do partial/full GC when the throughput of the current sticky GC iteration is <= mean throughput of the partial/full GC. Total GC time on FormulaEvaluationActions.EvaluateAndApplyChanges. Before: 26.4s After: 24.8s No benchmark score change measured. Bug: 8788501 Change-Id: I90000305e93fd492a8ef5a06ec9620d830eaf90d
* | Refactor deoptimization support in debuggerSebastien Hertz2014-03-262-8/+1
|/ | | | | | | | | | | | | | | | | This CL prepares breakpoint support for inlined methods where we'll have to deoptimize everything. We move deoptimization-related information to Dbg class only (deoptimization request queue, full deoptimization event count and deoptimization lock). We replace MethodInstrumentionRequest by DeoptimizationRequest. This is used to know which kind of deoptimization is required for a particular event. It also simplifies lock ordering a bit during event setup: we no longer need to hold the deoptimization lock while holding the breakpoint lock. Moreover, the deoptimization lock should be held only after the event list lock. Bug: 12187616 Change-Id: Iff13f004adaeb25e5d609238bacce0b9720510e6
* Implement FINAL/OVERRIDE for clang.Ian Rogers2014-03-131-1/+1
| | | | | | | | | | Separate declaration from definition in certain places to work-around issues with clang. Remove bogus lock annotation at definition in compilers.cc that is already present at the declaration. Remove duplicate definition of ClassReference. Change-Id: I5368057bb36319a259110b2198610d9d2b2e5041
* Fix tests for 64bAndreas Gampe2014-03-121-1/+10
| | | | | | These tests make assumptions about pointer sizes. Change-Id: Idfd410144393d716ae176a6e9a51c5b414e0888e
* Fix BitVector::SetInitialBits().Vladimir Marko2014-03-112-0/+20
| | | | Change-Id: Iad3699d76ad69536aa4810329f5863bc995f6551
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-064-77/+264
| | | | | | | | | | | 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
* Make allocations report usable size.Ian Rogers2014-02-261-0/+9
| | | | | | | | | | | | | | | Work-in-progress to allow arrays to fill usable size. Bug: 13028925. Use C++11's override keyword on GCC >= 2.7 to ensure that we override GC and allocator methods. Move initial mirror::Class set up into a Functor so that all allocated objects have non-zero sizes. Use this property to assert that all objects are never larger than their usable size. Other bits of GC related clean-up, missing initialization, missing use of const, hot methods in .cc files, "unimplemented" functions that fail at runtime in header files, reducing header file includes, move valgrind's space into its own files, reduce number of array allocation routines. Change-Id: Id5760041a2d7f94dcaf17ec760f6095ec75dadaa
* Split up CommonTest into CommonRuntimeTest and CommonCompilerTestBrian Carlstrom2014-02-264-8/+7
| | | | Change-Id: I8dcf6b29a5aecd445f1a3ddb06386cf81dbc9c70
* Merge "Update to the BitVector Implementation"Bill Buzbee2014-02-102-27/+193
|\
| * Update to the BitVector ImplementationJean Christophe Beyler2014-01-172-27/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IsBitSet: - If the index requested is above the size, return false. ClearBit: - If the index requested is above the size, ignore. Added SameBitsSet: - Check the bits set disregarding size and expandable. Intersect and Union: - removed the requirement of same size. - handles case where the sizes are not the same. Added Subtract between BitVectors. SetInitialBits: - Now requests expansion if above the bits available. - Clears upper bits. Added GetHighestBitSet. ClearBit: - If we clear above the size, it is fine, it has not been set yet. Copy: - Supposes it is well allocated. - It used to just copy what was available in destination without checking source's size. - Now actually allocate the destination to make sure it holds enough space. - Set parameter to const. General: - Moved sizeof(uint32_t) to sizeof(*storage_) for future maintenance. Change-Id: Iebb214632482c46807deca957f5b6dc892a61a84
* | Object model changes to support 64bit.Ian Rogers2014-02-069-39/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
* | Fix multi-line hex dumping and add unit test.Ian Rogers2014-01-305-111/+230
| | | | | | | | Change-Id: I7657018fef5d9c17410a9a634db275555f180014
* | Move __STDC_FORMAT_MACROS to a cflag.Ian Rogers2014-01-231-1/+0
| | | | | | | | | | | | | | | | | | Current inttypes.h don't define stdint printf formatting characters for C++ but in the future this will change. Rather than #define __STDC_FORMAT_MACROS at the point of inclusion (conventional) pass it as a cflag so there is a single place to remove the #define when conventions change. Change-Id: Ice2fb07e19d8fc06ebc534c903a2d02497c31b3d
* | Merge "64bit cleanliness requires PRI*64 macros for stdint types."Ian Rogers2014-01-231-1/+4
|\ \
| * | 64bit cleanliness requires PRI*64 macros for stdint types.Ian Rogers2014-01-231-1/+4
| |/ | | | | | | Change-Id: I0cdce36d5f875cdc64cd2db22fd8179916ffa10f
* | Fix 64bit issues in logging code.Ian Rogers2014-01-231-14/+21
|/ | | | Change-Id: Ia73d0141348b3f74a9949012b0060dd4acb5e3b8
* Tidy up memory barriers.Ian Rogers2013-12-203-36/+35
| | | | Change-Id: I937ea93e6df1835ecfe2d4bb7d84c24fe7fc097b
* Don't rely on gcc extensionsBernhard Rosenkränzer2013-12-121-0/+7
| | | | | | | | | | | | | | Make the code more compatible with different compilers. clang doesn't allow extra static qualifiers on template specializations, const qualifiers on function types, or inline attributes on lambda functions, and is more picky about casting away constness with reinterpret_cast. These modifications are compatible with both gcc and clang. Change-Id: I739b10df2780bec537827a13679fd2bcc2cc7188 Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
* Merge "Define missing static constexpr variables"Mathieu Chartier2013-12-121-0/+2
|\
| * Define missing static constexpr variablesMark Mendell2013-12-111-0/+2
| | | | | | | | | | | | | | | | | | This will prevent link errors when undefined symbols when compiling at -O0. Normally, this isn't a problem, but causes failure when compiling at -O0 to maximize debugability Change-Id: Iafe187b6b9344fead1bbc73004e376fad821756b Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
* | Enable moving classes.Mathieu Chartier2013-12-102-4/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Slight reduction in Zygote size, memory savings are in the noise. Before: Zygote size: 8739224 After: Zygote size: 8733568 Fixed a bug where we didn't set the concurrent start bytes after switching the allocator from bump pointer to ROSAlloc in the zygote. This caused excessive memory usage. Added the method verifiers as roots to fix an issue caused by RegTypes holding a Class*. Added logic to clear card table in the SemiSpace collector, this reduces DalvikOther from ~2400k -> ~1760k when using the SemiSpace collector. Added a missing lock to the timing loggers which caused a rare one time crash in std::set. Bug: 11771255 Bug: 8499494 Bug: 10802951 Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
* Merge "[MIPS] Enable futex support"Elliott Hughes2013-11-261-1/+1
|\
| * [MIPS] Enable futex supportChris Dearman2013-11-141-1/+1
| | | | | | | | Change-Id: I4095d889229fe1b96f7b276d7952b3578c8fcd6d
* | Fix dumpsys meminfo <pid>.Mathieu Chartier2013-11-251-1/+3
| | | | | | | | | | | | | | | | Added a case for BumpPointerSpaces. Confirmed working non-debug. Should also work in debug builds. Bug: 11830794 Change-Id: I12053ff16eec403dcd4a780e13095e3212a77132
* | Add histogram for GC pause times.Mathieu Chartier2013-11-212-2/+3
| | | | | | | | | | | | | | Printed when you dump the GC performance info. Bug: 10855285 Change-Id: I3bf7f958305f97c52cb31c03bdd6218c321575b9
* | Fix histogram test.Mathieu Chartier2013-11-201-5/+5
| | | | | | | | | | | | | | The test compares outputted strings for some reason. Forgot to run it earlier. Change-Id: I9eed08350d0122614cb2e18ca7195e5dc0832da6
* | Improve histogram and timing logger dumping.Mathieu Chartier2013-11-204-24/+52
| | | | | | | | | | | | | | | | | | | | | | We now dump the sum (total time) of each histogram as well as previous stats. This is useful for the GC since the same split can occur multiple times per GC iteration. Also did a few memory optimizations by changing the map in the cumulative loggers to be a set. Bug: 11789200 Change-Id: I67bcc5384200924c8dc5d9eebcff077ce72b7e57
* | LEB128 tests and performance measurements.Ian Rogers2013-11-144-22/+22
| | | | | | | | Change-Id: I1850a2ff9225cfab8f896619c212b1b55f03ae94
* | Fix memory leaks relating to timing logger.Ian Rogers2013-11-143-58/+48
| | | | | | | | | | | | | | | | | | Bug: 11670287. We use pointers to uninitialized values for control-flow in the timing logger code, add TODO comments to clean this up later. Remove base namespace and other bits of tidying. Change-Id: I1e6600a1e92f974c8f58f3a405a4e4abb4d9f80f
* | Use a UniquePtr to clean up global logging std::string*s.Ian Rogers2013-11-131-11/+14
| | | | | | | | | | | | | | This makes valgrind happier. Bug: 11670287 Change-Id: I957b94cdc177665e66b069e4d2b2b8d0a4b589c8
* | Fix remaining mips build issues.Mathieu Chartier2013-11-121-3/+3
| | | | | | | | | | | | Missed a few things in mutex.cc. Change-Id: I1c3acfc5faa2511490170199c03ab74c1f23022a
* | Fix portable + mips build.Mathieu Chartier2013-11-121-5/+0
| | | | | | | | Change-Id: Ia200e582b04c84973281e12331777351feb8a401
* | Compacting collector.Mathieu Chartier2013-11-115-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Change thread.h to thread-inl.h to pick up missing Thread::Currnet for debug ↵Brian Carlstrom2013-11-062-2/+2
| | | | | | | | | | | | build in master Change-Id: I56a4dd18ec1c212f9dbb73b14c0c0623b23c87bd
* | Support hardware divide instructionDave Allison2013-11-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 11299025 Uses sdiv for division and a combo of sdiv, mul and sub for modulus. Only does this on processors that are capable of the sdiv instruction, as determined by the build system. Also provides a command line arg --instruction-set-features= to allow cross compilation. Makefile adds the --instruction-set-features= arg to build-time dex2oat runs and defaults it to something obtained from the target architecture. Provides a GetInstructionSetFeatures() function on CompilerDriver that can be queried for various features. The only feature supported right now is hasDivideInstruction(). Also adds a few more instructions to the ARM disassembler b/11535253 is an addition to this CL to be done later. Change-Id: Ia8aaf801fd94bc71e476902749cf20f74eba9f68
* | Omit OatMethodOffsets for classes without compiled codeBrian Carlstrom2013-10-285-0/+548
| | | | | | | | Change-Id: If0d290f4aebc778ff12d8fed017c270ad2ac3220
* | Throw IOException at source of failing to open a dex file.Ian Rogers2013-10-213-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before is: java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) Suppressed: java.lang.ClassNotFoundException: GCBench at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 1 more Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found ... 5 more And after is: java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex at dalvik.system.DexFile.openDexFile(Native Method) at dalvik.system.DexFile.<init>(DexFile.java:80) at dalvik.system.DexFile.<init>(DexFile.java:59) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235) at dalvik.system.DexPathList.<init>(DexPathList.java:113) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48) at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38) at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128) at java.lang.ClassLoader.access$000(ClassLoader.java:65) at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81) at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137) Suppressed: java.lang.ClassNotFoundException: GCBench at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 1 more Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found ... 5 more Also, move dex file verifier messages out of logs. In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller scope. Bug 11301553. Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
* | Inflate contended lock word by suspending owner.Ian Rogers2013-10-022-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 6961405. Don't inflate monitors for Notify and NotifyAll. Tidy lock word, handle recursive lock case alongside unlocked case and move assembly out of line (except for ARM quick). Also handle null in out-of-line assembly as the test is quick and the enter/exit code is already a safepoint. To gain ownership of a monitor on behalf of another thread, monitor contenders must not hold the monitor_lock_, so they wait on a condition variable. Reduce size of per mutex contention log. Be consistent in calling thin lock thread ids just thread ids. Fix potential thread death races caused by the use of FindThreadByThreadId, make it invariant that returned threads are either self or suspended now. Code size reduction on ARM boot.oat 0.2%. Old nexus 7 speedup 0.25%, new nexus 7 speedup 1.4%, nexus 10 speedup 2.24%, nexus 4 speedup 2.09% on DeltaBlue. Change-Id: Id52558b914f160d9c8578fdd7fc8199a9598576a
* | More allocation code optimizations.Hiroshi Yamauchi2013-09-112-134/+134
|/ | | | | | | | | | | - Inline Class::AllocObject() and Array::Alloc(). - Inline some short Mutex functions and add LIKELY/UNLIKELY to some Mutex functions. - This change improves the Ritz MemAllocTest by ~6% on Nexus 4 and ~10% on host. Bug: 9986565 Change-Id: I1606c74ddb21676cbc1de1a40e9b076fc23eaea4