summaryrefslogtreecommitdiffstats
path: root/runtime/class_linker.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add AbstractMethod, Constructor, MethodMathieu Chartier2015-04-211-112/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Remove suspend point from field loading"Mathieu Chartier2015-04-141-3/+3
|\
| * Remove suspend point from field loadingMathieu Chartier2015-04-141-3/+3
| | | | | | | | | | | | | | | | | | The error was that we had a partially constructed field array when we got suspended by moving GC. This caused the already allocated fields to not get updated, and be stale roots the next GC. Fixes test 125 with GSS collector. Change-Id: I7278def915f540b6a9d12677a6ba61637f5949a2
* | ART: Make the PathClassLoader fast-path recursiveAndreas Gampe2015-04-141-80/+118
|/ | | | | | | | | | 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-208/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-14/+17
| | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Store OatDexFile instead of OatFile in DexFile."Richard Uhler2015-04-031-35/+15
|\
| * Store OatDexFile instead of OatFile in DexFile.Richard Uhler2015-04-021-35/+15
| | | | | | | | | | | | | | | | 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
* | Use specific exception class to abort transactionSebastien Hertz2015-04-031-1/+1
|/ | | | | | | | | | | | | | | We used to throw a java.lang.InternalError when aborting a transaction (when preinitializing image classes at compilation time). We now use dedicated class dalvik.system.TransactionAbortError that is only thrown by the compiler to abort a transaction. This class has constructors taking a java.lang.Throwable "cause" so we can wrap exceptions causing the transaction to abort (for instance class java.lang.ClassNotFoundException) and give more information about the cause of the transaction abort. Bug: 20019689 Change-Id: I019a72a1c754d8bba6a7ad6bb0f02e4fd6668622
* Add AccessibleObject and Field to mirrorMathieu Chartier2015-03-291-14/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Use instrumented Alloc in Class-LinkerAndreas Gampe2015-03-271-3/+3
| | | | | | | To support Valgrind over dex2oat and gtests, CreatePathClassLoader must use instrumented allocation. Change-Id: I9dc2d009d37bec598c5de67688ebf9810da6e899
* Merge "ART: PathClassLoader for compiler"Andreas Gampe2015-03-281-35/+105
|\
| * ART: PathClassLoader for compilerAndreas Gampe2015-03-271-35/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix ClassLinker::MayBeCalledWithDirectCodePointer for JITMathieu Chartier2015-03-261-0/+4
|/ | | | | | | | | | | | | Currently, we don't know if another method has a direct code pointer or not. This should fix the case where breakpoints occasionally don't work with JIT. The JIT now also checks that a method doesn't have any breakpoints before starting to compile it. Bug: 17950037 Change-Id: I17cfe874fe4825beba23903a5053d5cb27e106cb
* Fix 003-omnibus-opcodes flaky failures with GSS GC.Hiroshi Yamauchi2015-03-191-50/+50
| | | | | | | | Fix a moving GC bug in Class::SetStatus(). Bug: 19828874 Change-Id: I6bef49a7ce964e8a7e316f282aaf1b8544efe76d
* Clean up hash setMathieu Chartier2015-03-181-3/+3
| | | | | | | Added vertical whitespace, const iterators, made some functions const. Change-Id: I188dc0384a98d6dae2822f0ac38b740f2356c23d
* Merge "Remove ThrowLocation."Nicolas Geoffray2015-03-101-10/+6
|\
| * Remove ThrowLocation.Nicolas Geoffray2015-03-101-10/+6
| | | | | | | | | | | | | | Note that this is a cleanup change, and has no functionality change. The ThrowLocation had no use anymore. Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
* | Create OatFileAssistant class for assisting with oat files.Richard Uhler2015-03-091-875/+53
|/ | | | | | | | | | | | | | | 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
* Compute the right catch location for the debugger.Nicolas Geoffray2015-03-091-9/+9
| | | | | | Also remove tls ThrowLocation, it is not needed anymore. Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9
* Merge "Follow-up 128393"Sebastien Hertz2015-03-031-2/+2
|\
| * Follow-up 128393Sebastien Hertz2015-03-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Avoids false warning when initializing the exception's class by marking the transaction aborted after throwing the InternalError exception. Also uses VLOG(compiler) to print the warning since it's only useful when investigating ahead-of-time class initialization. Bug: 19202032 Change-Id: I3c53639cbb888086ad345d668d1e5b73c5aaf861
* | Merge "ART: Move DexFile vector to Java array"Andreas Gampe2015-03-021-5/+6
|\ \ | |/ |/|
| * ART: Move DexFile vector to Java arrayAndreas Gampe2015-02-241-5/+6
| | | | | | | | | | | | | | | | To avoid having native vectors only referenced by Java objects, which look like leaks to Valgrind, use a Java array to store references to native DexFile objects. Change-Id: If3c2b31b9d0914ed1965cfd5e3fdb94ea41b1477
* | Fix JIT for vmdebug test 99Mathieu Chartier2015-02-251-11/+11
| | | | | | | | | | | | | | | | Test was flaky due to JIT re-compiliation after deoptimization resulting in some invalid PC offsets. Bug: 17950037 Change-Id: I276c84c918579259ce47ef873892c3c5dcf0c977
* | Revert "Revert "Add JIT""Mathieu Chartier2015-02-241-45/+57
| | | | | | | | | | | | | | | | Added missing EntryPointToCodePointer. This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399. Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
* | Merge "Revert "Add JIT""Nicolas Geoffray2015-02-241-57/+45
|\ \
| * | Revert "Add JIT"Nicolas Geoffray2015-02-241-57/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sorry, run-test crashes on target: 0-05 12:15:51.633 I/DEBUG (27995): Abort message: 'art/runtime/mirror/art_method.cc:349] Check failed: PcIsWithinQuickCode(reinterpret_cast<uintptr_t>(code), pc) java.lang.Throwable java.lang.Throwable.fillInStackTrace() pc=71e3366b code=0x71e3362d size=ad000000' 10-05 12:15:51.633 I/DEBUG (27995): r0 00000000 r1 0000542b r2 00000006 r3 00000000 10-05 12:15:51.633 I/DEBUG (27995): r4 00000006 r5 b6f9addc r6 00000002 r7 0000010c 10-05 12:15:51.633 I/DEBUG (27995): r8 b63fe1e8 r9 be8e1418 sl b6427400 fp b63fcce0 10-05 12:15:51.633 I/DEBUG (27995): ip 0000542b sp be8e1358 lr b6e9a27b pc b6e9c280 cpsr 40070010 10-05 12:15:51.633 I/DEBUG (27995): Bug: 17950037 This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4. Change-Id: I6f88849bc6f2befed0c0aaa0b7b2a08c967a83c3
* | | Merge "Add JIT"Mathieu Chartier2015-02-241-45/+57
|\ \ \ | |/ / | | / | |/ |/|
| * Add JITMathieu Chartier2015-02-231-45/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently disabled by default unless -Xjit is passed in. The proposed JIT is a method JIT which works by utilizing interpreter instrumentation to request compilation of hot methods async during runtime. JIT options: -Xjit / -Xnojit -Xjitcodecachesize:N -Xjitthreshold:integervalue The JIT has a shared copy of a compiler driver which is accessed by worker threads to compile individual methods. Added JIT code cache and data cache, currently sized at 2 MB capacity by default. Most apps will only fill a small fraction of this cache however. Added support to the compiler for compiling interpreter quickened byte codes. Added test target ART_TEST_JIT=TRUE and --jit for run-test. TODO: Clean up code cache. Delete compiled methods after they are added to code cache. Add more optimizations related to runtime checks e.g. direct pointers for invokes. Add method recompilation. Move instrumentation to DexFile to improve performance and reduce memory usage. Bug: 17950037 Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
* | ART: Allow the execution to stop if the compilation fails via an optionJean Christophe Beyler2015-02-231-3/+8
|/ | | | | | | | | | | | | | | | | | | | | The current implementation continues the execution of the application if dex2oat fails by relying on the interpreter. This patch adds a -Xno-dex-file-fallback option to stop the default behavior. This can be used two-fold. First, one can enforce that a runtime only starts with a boot image. A follow-up patch will ensure that dex2oat (for apps) and patchoat in general request that mode and close gracefully otherwise. Second, this can be used for testing and debugging purposes, as it ensures that compiler failures & aborts are not silently ignored. Add testing. Bug: 19100590 Change-Id: Iaf07b5ccf00942ca8a8ec8687599320a3ddbc089 Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
* Merge "ART: Ensure order of field gaps"Andreas Gampe2015-02-191-2/+2
|\
| * ART: Ensure order of field gapsAndreas Gampe2015-02-191-2/+2
| | | | | | | | | | | | | | | | Disambiguate field gaps of same size by starting offset. That will make the priority queue stable. Bug: 19413180 Change-Id: I6302a8bbdc590af7e9ec4f332c386c375fa8d8cd
* | Merge "ART: Templatize IsInt & IsUint"Andreas Gampe2015-02-191-3/+3
|\ \ | |/ |/|
| * ART: Templatize IsInt & IsUintAndreas Gampe2015-02-181-3/+3
| | | | | | | | | | | | Ensure that things are used correctly. Change-Id: I76f082b32dcee28bbfb4c519daa401ac595873b3
* | ART: Make run-tests more verboseAndreas Gampe2015-02-171-2/+2
|/ | | | | | | | | Make run-tests log ERROR level on host. Adjust some internal LOG(ERROR) to LOG(WARNING). Add check scripts to adjust for other LOG(ERROR) messages. Bug: 18713034 Change-Id: I2a3e055baa6a0e31f106364c300c20963a59ed94
* ART: Add more details to LinkageErrorAndreas Gampe2015-02-131-19/+49
| | | | | | | | Add the classes or method details that fail during linking to enable better diagnosis of problems. Bug: 19294695 Change-Id: Ifab48bc182cd801d44d3aead2168028f27043be0
* Merge "Fix HasSameSignatureWithDifferentClassLoaders()."Vladimir Marko2015-02-101-4/+8
|\
| * Fix HasSameSignatureWithDifferentClassLoaders().Vladimir Marko2015-02-101-4/+8
| | | | | | | | | | | | | | Add a missing handle and make sure that the handle's Get() is sequenced after the call that can cause GC. Change-Id: I3c0479650c40ceb803bfbf658238aeea8e4b0a1a
* | Handle variable size of methods properly between 32 and 64 bit.Jeff Hao2015-02-051-2/+4
|/ | | | | Bug: 19100762 Change-Id: I62358905fa882284d0201ed3c1e97e1286ccec5f
* Fix transaction abortingSebastien Hertz2015-02-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During compilation, a java.lang.InternalError is used to indicate that class initialization failed and the enclosing transaction should be aborted and the changes rolled back. However there is nothing preventing the code executed from a class initializer from catching that exception (like catching Throwable and ignore it). Therefore we may return from the class initializer with no pending exception, even if the transaction was aborted, and not rollback the changes properly. To fix this, we now rely on the new Transaction::aborted_ field to know whether a transaction aborted. When returning from the class initializer without pending exception, we now check wether we aborted the enclosing transaction. If that's the case, we set the status of the class to kStatusError and throw a new java.lang.InternalError with the original abort message. This CL also contains some cleanup: - Renames Transaction::Abort to Transaction::Rollback which is less ambiguous and more reflect what is done. - Moves the code throwing the java.lang.InternalError exception into the Transaction::ThrowInternalError method so we do not duplicate code. Now we may abort transaction more than once (because we may have caught the java.lang.InternalError then execute code causing new transaction abort), we only keep the first abort message to throw the exception. - Updates transaction_test with more cases and more checks. - Bumps oat version to force recompilation with this fix. Bug: 19202032 Change-Id: Iedc6969528a68bbdf3123146e990df4dbc57834b
* More of the concurrent copying collector.Hiroshi Yamauchi2015-01-231-3/+0
| | | | | Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
* Merge "Update instrumentation stubs on resolved classes"Sebastien Hertz2015-01-211-4/+12
|\
| * Update instrumentation stubs on resolved classesSebastien Hertz2015-01-191-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We cannot update methods of a class in the process of being loaded. We need it to be fully resolved (kStatusResolved) so we can access its complete structure (including method index) and the compiled code from the oat file. We ensure that by skipping classes that are not resolved yet when we update instrumentation (with all threads suspended). The entrypoints will be updated when the class gets resolved by the ClassLinker. We also do not update method entrypoints of erroneous classes (kStatusError) because we cannot execute code for these methods. This situation can happen when the debugger requests an event that will cause a full deoptimization (like a METHOD_ENTRY event) while we are loading a new class. Because we suspend all threads to update instrumentation, we may visit a class that is being loaded but not yet resolved. Bug: 19012386 Bug: 18766029 Change-Id: I5a645dfaf5c25dcf4282c1aaeb24f1b6333baa37
* | Clean up the locks around Heap::VisitObjects().Hiroshi Yamauchi2015-01-201-1/+0
|/ | | | | | | | This is so that we could support suspending all threads when visiting objects in the presence of a concurrent, moving collector. Bug: 12687968 Change-Id: Icc8e60630465afde948ebc6ea91d4ebaff5d7837
* Print more info in MarkSweep::VerifyRootMathieu Chartier2015-01-151-12/+10
| | | | | | | | | | | | | | | | | | | | | | | 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
* ART: Simple structural class checkAndreas Gampe2015-01-141-0/+170
| | | | | | | | | | | | | | | | | | | Adds a simple check to class-loading when the embedded dex file in an oat file and the dex file on the class path where we found the class do not match. We require that the number of methods and fields do not change, as that will almost certainly mean that quickened and other compiled offsets are wrong now. This is a reasonably lightweight change, but we should investigate a full comparison including name and type of members. Bug: 17937814 Bug: 18708951 (cherry picked from commit 15a33b3f88546bce85dcb9d28caf200da51154d7) Change-Id: Icb9638bebd369ab23822817f4a97c8dd8625fea5
* Use unique_ptr to track ownership of dex files.Richard Uhler2015-01-131-23/+17
| | | | | Bug: 18809837 Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
* Remove portable.Elliott Hughes2014-12-121-132/+12
| | | | Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc