summaryrefslogtreecommitdiffstats
path: root/runtime/class_linker.h
Commit message (Collapse)AuthorAgeFilesLines
* ART: Prune FindArrayClass cache in image writerAndreas Gampe2015-06-031-0/+4
| | | | | | | | | | The ClassLinker cache speeds up FindArrayClass requests, but all entries are roots. It is possible that an entry is a non-image class when creating the boot image, artificially keeping the class around. Bug: 21596650 Change-Id: Ief9b439945d0e293a3cb5dcddfeb189b5e174f06
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-021-47/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix for potential moving GC bugs around proxy class.Hiroshi Yamauchi2015-05-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Handlerize proxy_class which is live across multiple allocation points in ClassLinker::CreateProxyClass(). - In ClassLinker::CreateProxyClass(), insert a proxy class into the class table before creating ArtFields for it (and update it later in LinkClass()) because the field roots (ArtField::declaring_class_) won't be updated by GC unless the class is in the class table. If GC happens before they are updated by FixupTemporaryDeclaringClass() from LinkClass(), FixupTemporaryDeclaringClass() may not update the field roots correctly because the old class may already be moved but the fields roots may not. Reduce a window of time where the fields roots could be stale. - In ClassLinker::LinkClass(), directly wrap a new class in a handle to avoid a window of time where new_class may be potentially stale. - Print more diagnostic info about the holder of the field upon a mark sweep invalid ref crash. - Add an additional sanity check in Field::GetArtField(). Bug: 20557050 Change-Id: I9ad32d304922da96b7e1fad262d97de21cbac776
* Fix debuggable compiler flag detection for secondary dex filesSebastien Hertz2015-05-191-0/+7
| | | | | | | | | | | | | | | | | | Compiles secondary dex files like the primary dex file: if it has been compiled with the --debuggable flag, compile secondary dex files with the --debuggable flag too. Therefore, dex files loaded at runtime are compiled the same way as dex files compiled at install time on the classpath (excluding the boot image that is not compiled debuggable). Also adds debuggable key in the oat header and bump the oat version. Bug: 20944228 (cherry picked from commit 0de1133ba600f299b3d67938f650720d9f859eb2) Change-Id: If6b2236e7fe547cc421f57b573043748018d3ae0
* ART: Check for duplicate classes when loading oat filesAndreas Gampe2015-04-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Oat files are usually produced standalone, and the compilers take advantage of any information they get. It is thus possible that when compile-time and runtime class-path are not the same, classes are resolved differently and optimized code is incorrect. This is a very conservative check, scanning the complete class tables of dex files. In case any duplicate class is found, the new oat file will be rejected and the original dex files will be used in interpreted mode. A possible refinement to this is actual tracking of the compile-time class-path instead. That is however significantly complicated by the DexFile API and the non-standard uses it allows. An alternative for both optimized code and correct resolution is native multidex. Apps should switch to multidex and benefit from the optimization as well as the shift of all compile time to install time. Split APKs are currently compiled separately, but it is a goal to change that install flow to simulated multidex. Change-Id: Ib9e0db5091e060e3bb2c0e5e6c007430becbfc21
* ART: Fix re-throwing failures of non-convention errorsAndreas Gampe2015-04-221-0/+6
| | | | | | | | | | | | While it is convention that Throwable subclasses should have a constructor with a String argument, that is not rigorously enforced. So if a static initializer throws an error that omits that constructor, we must not provide a message when trying to throw again. Bug: 20495321 Bug: 20497840 Change-Id: Ia4334fa24223750f90a8f2732f1eb1e738575e8d
* Replace NULL with nullptrMathieu Chartier2015-04-221-3/+3
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Add AbstractMethod, Constructor, MethodMathieu Chartier2015-04-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moves functionality to ART from libcore. Precursor to moving ArtMethods to native. Mostly performance improvements. N5 perf before (irrelevant results removed): Class_getConstructor 962.87 =========== Class_getDeclaredMethod 2394.37 ============================ Class_getMethod 2509.20 ============================== Class_newInstance 1999.81 ======================= Method_invokeI 1439.02 ================= Method_invokePreBoxedI 1415.82 ================ Method_invokeStaticI 1456.24 ================= Method_invokeStaticPreBoxedI 1427.32 ================= Method_invokeStaticV 814.47 ========= Method_invokeV 816.56 ========= After: benchmark ns linear runtime Class_getConstructor 1302.04 ================ Class_getDeclaredMethod 1459.01 ================== Class_getMethod 1560.40 =================== Class_newInstance 2029.94 ========================= Method_invokeI 1312.89 ================ Method_invokePreBoxedI 1255.01 =============== Method_invokeStaticI 1289.13 =============== Method_invokeStaticPreBoxedI 1196.52 ============== Method_invokeStaticV 790.82 ========= Method_invokeV 791.73 ========= Performance improvements are more than just fixing regressions introduced in: http://android-review.googlesource.com/#/c/146069/ Bug: 19264997 Change-Id: Ife79c469fdb09f30e3aefcfc3e0ce5ed32303fce
* ART: Make the PathClassLoader fast-path recursiveAndreas Gampe2015-04-141-5/+9
| | | | | | | | | | Allow an arbitrary nesting of path class-loaders. This will also handle the fake java.lang.BootClassLoader as a class-loader object correctly (which is of some importance to compile-time initialization). Bug: 19781184 Bug: 19542228 Change-Id: I61f0249cf4ec8df08a83ccbd29bcf067619c28c0
* Move ArtField to nativeMathieu Chartier2015-04-101-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add linear alloc. Moved ArtField to be native object. Changed image writer to put ArtFields after the mirror section. Savings: 2MB on low ram devices 4MB on normal devices Total PSS measurements before (normal N5, 95s after shell start): Image size: 7729152 bytes 23112 kB: .NonMoving 23212 kB: .NonMoving 22868 kB: .NonMoving 23072 kB: .NonMoving 22836 kB: .NonMoving 19618 kB: .Zygote 19850 kB: .Zygote 19623 kB: .Zygote 19924 kB: .Zygote 19612 kB: .Zygote Avg: 42745.4 kB After: Image size: 7462912 bytes 17440 kB: .NonMoving 16776 kB: .NonMoving 16804 kB: .NonMoving 17812 kB: .NonMoving 16820 kB: .NonMoving 18788 kB: .Zygote 18856 kB: .Zygote 19064 kB: .Zygote 18841 kB: .Zygote 18629 kB: .Zygote 3499 kB: .LinearAlloc 3408 kB: .LinearAlloc 3424 kB: .LinearAlloc 3600 kB: .LinearAlloc 3436 kB: .LinearAlloc Avg: 39439.4 kB No reflection performance changes. Bug: 19264997 Bug: 17643507 Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
* 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
* Store OatDexFile instead of OatFile in DexFile.Richard Uhler2015-04-021-13/+0
| | | | | | | | This requires moving OatDexFile out of the OatFile class so that a forward class declaration can be used for OatDexFile. Bug: 19071355 Change-Id: Ibda85b78d0577e9e81073090616fc0f2fa526be3
* Add AccessibleObject and Field to mirrorMathieu Chartier2015-03-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main motivation is to remove all the functionality / field access on java side to ArtField. Also comes with some reflection speedups / slowdowns. Summary results: getDeclaredField/getField are slower mostly due to JNI overhead. However, there is a large speedup in getInt, setInt, GetInstanceField, and GetStaticField. Before timings (N5 --compiler-filter=everything): benchmark ns linear runtime Class_getDeclaredField 782.86 === Class_getField 832.77 === Field_getInt 160.17 = Field_setInt 195.88 = GetInstanceField 3214.38 ============== GetStaticField 6809.49 ============================== After: Class_getDeclaredField 1068.15 ============ Class_getField 1180.00 ============== Field_getInt 121.85 = Field_setInt 139.98 = GetInstanceField 1986.15 ======================= GetStaticField 2523.63 ============================== Bug: 19264997 Change-Id: Ic0d0fc1b56b95cd6d60f8e76f19caeaa23045c77
* ART: PathClassLoader for compilerAndreas Gampe2015-03-271-0/+5
| | | | | | | | | | | | | | | | | | | | Use an actual PathClassLoader when compiling apps, instead of a side structure and cutout. This CL sets up a minimal object 'cluster' that recreates the Java side of a regular ClassLoader such that the Class-Linker will recognize it and use the internal native fast-path. This CL removes the now unnecessary compile-time-classpath and replaces it with a single 'compiling-the-boot-image' flag in the compiler callbacks. Note: This functionality is *only* intended for the compiler, as the objects have not been completely initialized. Bug: 19781184 Change-Id: I7f36af12dd7852d21281110a25c119e8c0669c1d
* Clean up hash setMathieu Chartier2015-03-181-3/+3
| | | | | | | Added vertical whitespace, const iterators, made some functions const. Change-Id: I188dc0384a98d6dae2822f0ac38b740f2356c23d
* Create OatFileAssistant class for assisting with oat files.Richard Uhler2015-03-091-90/+17
| | | | | | | | | | | | | | | The oat file assistant is used for determining whether dex2oat or patchoat is needed, for running dex2oat or patchoat as needed to make an oat file up to date, and to load dex files associated with a given dex location. The introduction of the OatFileAssistant class is meant to clean up and consolidate code related to the management of oat files that was duplicated and spread across dalvik_system_DexFile.cc and class_linker.cc. Bug: 11301553 Change-Id: I0c16027b9bae4570c2c50faa9c14f581c0cbafb8
* Use unique_ptr to track ownership of dex files.Richard Uhler2015-01-131-2/+3
| | | | | Bug: 18809837 Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
* Remove portable.Elliott Hughes2014-12-121-16/+1
| | | | Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
* Add pointer size logic to InitFromImageInterpretOnlyMathieu Chartier2014-12-051-0/+3
| | | | | | | | | | | Previously we didn't have this logic which broke dex2oat if passed --runtime-option -Xint flag. Also we now no longer call InitFromImageInterpretOnlyCallback if we are the compiler. Bug: 18631640 Change-Id: Ie84fceeb85cabeeec7a5fedefd73dd919cca8e5e
* JDWP: fix breakpoint for method in the imageSebastien Hertz2014-12-041-0/+4
| | | | | | | | | | | | | | | | When we set a breakpoint in a compiled method, we deoptimize it by changing its entrypoint so it is executed with the interpreter. However, methods in the image can be called with their direct code pointer, ignoring the updated entrypoint. In that case, the method is not executed with the interpreter and we miss the breakpoint. This CL avoids that situation by forcing a full deoptimization so everything runs with the interpreter. However, if the image has been compiled in PIC mode, we keep using selective deoptimization because direct code pointer is not used in this mode. Bug: 17965285 Change-Id: Icaf8cbb7fe9ad01d36f7378c59d50d9ce42ae57f
* Avoid JNI call with pending OOME.Ian Rogers2014-11-191-2/+2
| | | | | | | | If EnsureResolved fails with an exception then FindClassInPathClassLoader may fall-through to a call to NewStringUTF with a pending exception. Bug: 15446488 Change-Id: I007f7bee7c50aa588d0b1c776da67a38314dc897
* Change 64 bit ArtMethod fields to be pointer sizedMathieu Chartier2014-11-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Changed the 64 bit entrypoint and gc map fields in ArtMethod to be pointer sized. This saves a large amount of memory on 32 bit systems. Reduces ArtMethod size by 16 bytes on 32 bit. Total number of ArtMethod on low memory mako: 169957 Image size: 49203 methods -> 787248 image size reduction. Zygote space size: 1070 methods -> 17120 size reduction. App methods: ~120k -> 2 MB savings. Savings per app on low memory mako: 125K+ per app (less active apps -> more image methods per app). Savings depend on how often the shared methods are on dirty pages vs shared. TODO in another CL, delete gc map field from ArtMethod since we should be able to get it from the Oat method header. Bug: 17643507 Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8 (cherry picked from commit e832e64a7e82d7f72aedbd7d798fb929d458ee8f)
* Add hash map, reduce excessive hashingMathieu Chartier2014-11-071-5/+6
| | | | | | | | | | | | | | | | | | | | | | | Changed the class def index to use a HashMap instead of unordered_map so that we can use FindWithHash to reduce how often we need to compute hashes. Fixed a bug in ClassLinker::UpdateClass where we didn't properly handle classes with the same descriptor but different class loaders. Introduced by previous CL. Before (fb launch): 1.74% art::ComputeModifiedUtf8Hash(char const*) After: 0.95% art::ComputeModifiedUtf8Hash(char const*) Bug: 18054905 Bug: 16828525 Change-Id: Iba2ee37c9837289e0ea187800ba4af322225a994 (cherry picked from commit 564ff985184737977aa26c485d0c1a413e530705)
* Add hash setMathieu Chartier2014-11-061-11/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-5/+3
| | | | | | | | | | | 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
* ART: Add pic flag to oat header storeAndreas Gampe2014-10-271-3/+2
| | | | | | | Add the compile-time PIC flag to the oat-header key-value store. Ignore image offset and patch delta when loading PIC oat files. Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
* Optimize method linkingMathieu Chartier2014-10-271-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added more inlining, removed imt array allocation and replaced it with a handle scope. Removed some un-necessary handle scopes. Added logic to base interface method tables from the superclass so that we dont need to reconstruct for every interface (large win). Facebook launch Dalvik KK MR2: TotalTime: 3165 TotalTime: 3652 TotalTime: 3143 TotalTime: 3298 TotalTime: 3212 TotalTime: 3211 Facebook launch TOT before: WaitTime: 3702 WaitTime: 3616 WaitTime: 3616 WaitTime: 3687 WaitTime: 3742 WaitTime: 3767 After optimizations: WaitTime: 2903 WaitTime: 2953 WaitTime: 2918 WaitTime: 2940 WaitTime: 2879 WaitTime: 2792 LinkInterfaceMethods no longer one of the hottest methods, new list: 4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>) 3.07% art::DexFile::FindClassDef(char const*) const 2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int) 2.90% art::DexFile::FindStringId(char const*) const Bug: 18054905 Bug: 16828525 (cherry picked from commit 1fb463e42cf1d67595cff66d19c0f99e3046f4c4) Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321
* Make ART compile with GCC -O0 again.Ian Rogers2014-10-161-76/+72
| | | | | | | | | | | | | Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on architecture. Add to instruction_set_test to warn when InstructionSetFeatures don't agree with ones from system properties, AT_HWCAP and /proc/cpuinfo. Clean-up class linker entry point logic to not return entry points but to test whether the passed code is the particular entrypoint. This works around image trampolines that replicate entrypoints. Bug: 17993736 Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
* stdint types all the way!Ian Rogers2014-10-091-1/+1
| | | | Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
* Simplify instance reference offsets.Ian Rogers2014-10-091-2/+0
| | | | | | | Don't encode Object's class. Use trailing rather than leading zeroes to give offset position. Change-Id: I1ae74e7a01f63696429644adf81cdf6ee58832fe
* ART: Fix some -Wpedantic errorsAndreas Gampe2014-09-291-1/+1
| | | | | | | | | | | | | | | | Remove extra semicolons. Dollar signs in C++ identifiers are an extension. Named variadic macros are an extension. Binary literals are a C++14 feature. Enum re-declarations are not allowed. Overflow. Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
* ART: Rename Handle hierarchyAndreas Gampe2014-09-151-50/+49
| | | | | | | Bring the names in line with normal OO principles: ConstHandle becomes Handle, and Handle becomes MutableHandle. Change-Id: I0f018eb7ba28bc422e3a23dd73a6cbe6fc2d2044
* Compile time performance improvements focusing on interpret-only.Ian Rogers2014-09-121-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce virtual method dispatch in the method verifier and make more code inline-able. Add a StringPiece with const char* equality operator to avoid redundant StringPieces and strlens. Remove back link from register line to verifier and pass as argument to reduce size of RegisterLine. Remove instruction length from instruction flags and compute from the instruction, again to reduce size. Add suspend checks to resolve and verify to allow for more easy monitor inflation and reduce contention on Locks::thread_list_suspend_thread_lock_. Change ThrowEarlierClassFailure to throw pre-allocated exception. Avoid calls to Thread::Current() by passing self. Template specialize IsValidClassName. Make ANR reporting with SIGQUIT run using checkpoints rather than suspending all threads. This makes the stack/lock analysis less lock error prone. Extra Barrier assertions and condition variable time out is now returned as a boolean both from Barrier and ConditionVariable::Wait. 2 threaded host x86-64 interpret-only numbers from 341 samples: Before change: Avg 176.137ms 99% CI 3.468ms to 1060.770ms After change: Avg 139.163% 99% CI 3.027ms to 838.257ms Reduction in average compile time after change is 20.9%. Slow-down without change is 26.5%. Bug: 17471626 - Fix bug where RegTypeCache::JavaLangObject/String/Class/Throwable could return unresolved type when class loading is disabled. Bug: 17398101 Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
* Add fast path to VMClassLoader.findLoadedClassMathieu Chartier2014-09-111-0/+6
| | | | | | | | | | | | | | | | | | | VMClassLoader.findLoadedClass now calls FindClassInPathClassLoader as a fast path. Exclusive time results (trace view maps launch): Before: nativeFillInStackTrace 1.4% defineClassNative 1.2% findLoadedClass 0.2% After: nativeFillInStackTrace 0.5% defineClassNative 0.0% findLoadedClass 0.9% (cherry picked from commit 194116c836080de14245a3a7c4617d07b8abf8cf) Change-Id: I63fd7b4bccb71789e92bd39d1d3f9d0de22535de
* ART: Correctly make methods preverifiedAndreas Gampe2014-09-111-0/+5
| | | | | | | | Bug: 16828525 (cherry picked from commit df1532b9ba0cda2d00b78fbdef461f8a6cf8a737) Change-Id: I66756348b2aa50e41dacca59769b6810a91c73b0
* Merge "Remove reference_static_offsets used for iterating through class ↵Mingyao Yang2014-09-101-4/+1
|\ | | | | | | static fields."
| * Remove reference_static_offsets used for iterating through class static fields.Mingyao Yang2014-09-101-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Since static fields are contiguous in class object and there is no need to traverse super classes, it's not meaningful to use reference_static_offsets. Also especially with embedded vtable/imt, static field offset can't be encoded with an unsigned integer anyway. A corresponding change is made to Class.java to remove the member field. Bug: 16236588 Change-Id: I1fde3cd9efce884945876f0658c63d992164fd94
* | Improve dex location canonicalization-related performance.Vladimir Marko2014-09-101-7/+8
|/ | | | | | | | | | | | | | | | | | | Eagerly add canonical dex file locations to the OatFile's primary lookup map in Setup(). This moves the boot.oat work from every app startup to the zygote initialization. Since we always ended up initializing the canonical location map anyway due to the way that we're loading dex files, the lazy initialization didn't save anything. Clean up dex file name canonicalization to make sure we free() the memory returned by realpath() rather than using std::unique_ptr<> with the default deleter. Avoid some unnecessary duplicate OatDexFile lookups. Bug: 16828525 Bug: 17346103 Change-Id: Id8fbc8992f62996138eb2006a0046c6529747c09
* Avoid recomputing the dex checksum during class loadingCalin Juravle2014-09-051-2/+11
| | | | | | | | | | | Thread the already computed checksum to VerifyOatAndDexFileChecksums and LoadMultiDexFilesFromOatFile to avoid recomputing it. Bug:17346103 (cherry picked from commit ca3459398018360d9968a52eebf727df085caf83) Change-Id: Ie244efaca55b9e7c814b35feec7fce11fab3856d
* VisitClassesWithoutClassesLock isn't safe if classes move.Ian Rogers2014-09-031-27/+30
| | | | | | | | Which they do, so avoid by doing an array allocation. Also, tidy member variables to the end of ClassLinker. Remove unnecessary mutable. Tidy and fix a locks required/excluded. Change-Id: I2404a9e7a1ea997d68ab1206f97d2a20dffbda06
* Remove abuse of mirror::Object* to reference special values.Ian Rogers2014-09-031-0/+3
| | | | | | | | | | | | | Remove kInvalidIndirectRefObject, kClearedJniWeakGlobal and ObjectRegistry::kInvalidObject. Handle error conditions by passing in or returning an error value. GetObjectRefType is simplified to be faster and not return invalid references that are not expected according to the spec. Adjust check JNI and jni_internal_test appropriately. Fix cases in the debugger/JDWP of out arguments being passed by reference. Bug: 17376993 Change-Id: I3ce8a28c01827e163f4dc288449959464da788b1
* Pre-allocate the NoClassDefFoundError to be thrown for boot classes.Ian Rogers2014-09-021-1/+1
| | | | | | | Bring over a Dalvik "optimization". Bug: 12804658 Bug: 16853450 Change-Id: I6419de7bd2ba18d91479cb52489104954f5c4524
* Reduce and speed-up class def searches.Ian Rogers2014-09-021-3/+1
| | | | | | | | | | | | | | | | | | | | Use the class linker for descriptor lookups from the compile driver so that dex caches are populated. Reduce the scope of functions for scanning class paths to just the class linker where they are performed. If we see more than a threshold number of find class def misses on a dex file lazily compute an index, so that future lookups are constant time (part of the collection code is taken from https://android-review.googlesource.com/#/c/103865/3). Note that we take a lazy approach so that we don't serialize on loading dex files, this avoids the reason the index was removed in 8b2c0b9abc3f520495f4387ea040132ba85cae69. Remove an implicit and unnecessary std::string creation for PrintableString. Single threaded interpret-only dex2oat performance is improved by roughly 10%. Bug: 16853450 Change-Id: Icf72df76b0a4328f2a24075e81f4ff267b9401f4
* Add native memory accounting through custom allocator.Mathieu Chartier2014-08-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Filling hole between subclass and superclass.Fred Shih2014-08-281-13/+0
| | | | | | | | | | | Subclasses no longer need to be 4-byte aligned at the end. Any gaps between a superclass and its subclasses will be filled in by halfword or byte fields if possible. Refactored the alignment and shuffling methods to use a priority queue in order to reduce the amount of logic when laying out objects. Change-Id: Ifed71af534e0c5e77bb14555c44b973fe66df6da
* Remove an intermediate field array in ClassLinker::InitializeClass.Hiroshi Yamauchi2014-08-251-5/+0
| | | | | | | | This improves on CL 105090 by removing the need for the intermediate field array by iterating two iterators in parallel. Bug: 12687968 Change-Id: I32d4570948a9d39ccb1c20a02e18b48f15ed0738
* Reduced memory usage of primitive fields smaller than 4-bytesFred Shih2014-08-251-0/+13
| | | | | | | | | | Reduced memory used by byte and boolean fields from 4 bytes down to a single byte and shorts and chars down to two bytes. Fields are now arranged as Reference followed by decreasing component sizes, with fields shuffled forward as needed. Bug: 8135266 Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
* Merge "Support running without a boot image."Brian Carlstrom2014-08-251-2/+2
|\
| * Support running without a boot image.Alex Light2014-08-251-2/+2
| | | | | | | | | | | | Bug: 17000769 Change-Id: I6404d5050c8a2f4ee6e70d58532eb25ee9de248e
* | Clean up Handle usage.Mathieu Chartier2014-08-231-48/+50
| | | | | | | | | | | | | | | | | | | | | | Prefer using ConstHandle instead of Handle as function arguments since you can't assign new references to ConstHandle which helps prevent bugs. Changed NullHandle to be a ConstHandle so that you can never modify it to be a non null reference. Change-Id: I81cb979f6f8d5b49e5614966a2caf28c3701dd4f