summaryrefslogtreecommitdiffstats
path: root/runtime/oat.cc
Commit message (Collapse)AuthorAgeFilesLines
* ART: Clean up arm64 kNumberOfXRegisters usage.Vladimir Marko2015-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | Avoid undefined behavior for arm64 stemming from 1u << 32 in loops with upper bound kNumberOfXRegisters. Create iterators for enumerating bits in an integer either from high to low or from low to high and use them for <arch>Context::FillCalleeSaves() on all architectures. Refactor runtime/utils.{h,cc} by moving all bit-fiddling functions to runtime/base/bit_utils.{h,cc} (together with the new bit iterators) and all time-related functions to runtime/base/time_utils.{h,cc}. Improve test coverage and fix some corner cases for the bit-fiddling functions. Bug: 13925192 (cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0) Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
* Fix debuggable compiler flag detection for secondary dex filesSebastien Hertz2015-05-191-3/+12
| | | | | | | | | | | | | | | | | | 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: Show invalid oat header cause in error messageAndreas Gampe2014-12-151-2/+32
| | | | | | | | | | | Include the IsValid failure cause in the error message of opening an oat file. Make oat magic and version constexpr so we can have static_asserts over the lengths. Bug: 17187621 Change-Id: I8cef1c6cc9cb2faa052167a3437e81b4c2cbefa7
* Remove portable.Elliott Hughes2014-12-121-63/+3
| | | | Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
* Move dexCacheStrings from ArtMethod to ClassMathieu Chartier2014-11-251-1/+1
| | | | | | | | | | | | Adds one load for const strings which are not direct. Saves >= 60KB of memory avg per app. Image size: -350KB. Bug: 17643507 Change-Id: I2d1a3253d9de09682be9bc6b420a29513d592cc8 (cherry picked from commit f521f423b66e952f746885dd9f6cf8ef2788955d)
* Fix oatwriter code dedupingMathieu Chartier2014-11-251-1/+1
| | | | | | | | | | | Now that the GC maps are part of the oat method header they need to be checked in CodeOffsetsKeyComparator. Bug: 18523556 Change-Id: I539a6e7216166342b22515c1e2cf831dad32e41e (cherry picked from commit 4cdf4508903d13fd0f9fba5690aeac1b368db81b)
* Delete ArtMethod gc_map_ fieldMathieu Chartier2014-11-241-26/+10
| | | | | | | | | | | Moved the gc_map field from OatMethod to OatQuickMethodHeader. Deleted the ArtMethod gc_map_ field. Bug: 17643507 Change-Id: Ifa0470c3e4c2f8a319744464d94c6838b76b3d48 (cherry picked from commit 807140048f82a2b87ee5bcf337f23b6a3d1d5269)
* Fix ordering of fields with the same name.Vladimir Marko2014-11-171-1/+1
| | | | | | | | | | | | While the Java language doesn't allow multiple fields with the same name in a single class (excluding fields from super classes), the bytecode specification permits it and tools such as proguard actually generate them. Define the order of these fields by their dex file index and relax the check of field ordering to permit identical names. Bug: 18211592 Change-Id: I1dee9b2b669a6ea180a2d3a41030efb2aed53950
* Merge "Fix LinkFieldsComparator."Vladimir Marko2014-11-141-1/+1
|\
| * Fix LinkFieldsComparator.Vladimir Marko2014-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | Define order for primitive types with the same sizes. Previously, the comparator would consider the fields equal so the order would depend on std::sort() implementation. Changing the STL implementation could silently change the field offsets. (And, unlike std::stable_sort(), the std::sort() doesn't even need to be deterministic.) Change-Id: I91fa562f82447606aced64643bea8c70784766b5
* | Instruction set features for ARM64, MIPS and X86.Ian Rogers2014-11-131-1/+3
|/ | | | | | | | | | | | | Also, refactor how feature strings are handled so they are additive or subtractive. Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler rather than #ifdefs that wouldn't have worked in cross-compilation. Add SIMD features for x86/x86-64 proposed in: https://android-review.googlesource.com/#/c/112370/ Bug: 18056890 Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
* Delete unused imtable fieldMathieu Chartier2014-11-101-1/+1
| | | | | | | | Bug: 17643507 Change-Id: I1fc7ca2d3bdf1810bcc3b46f867b68a4a6d28ed3 (cherry picked from commit f2d556401ec1d82fec31c0b29d712de18d838282
* Don't enable ARM_R4_SUSPEND_FLAG.Ian Rogers2014-11-051-1/+1
| | | | | | Bug: 17953517 Change-Id: I4578f1ffbfc987d5d178c7586b6bb99882ed19bb
* ART: Add support for patching and loading OAT files compiled with PICIgor Murashkin2014-10-271-0/+6
| | | | | | | | | | | | * Images (.art) compiled with pic now have a new field added. * isDexOptNeeded will now skip patch-ing for apps compiled PIC * First-boot patching now only copies boot.art, boot.oat is linked As a result, all system preopted dex files (with --compile-pic) no longer take up any space in /data/dalvik-cache/<isa>. Bug: 18035729 Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
* Support hard float on arm in optimizing compiler.Nicolas Geoffray2014-10-271-1/+1
| | | | | | Also bump oat version, needed after latest hard float switch. Change-Id: Idf5acfb36c07e74acff00edab998419a3c6b2965
* Refactor quick entrypointsIan Rogers2014-10-201-1/+1
| | | | | | | | | | | Remove FinishCalleeSaveFrameSetup. Assembly routines write down anchor into TLS as well as placing runtime method in callee save frame. Simplify artSet64InstanceFromCode by not computing the referrer from the stack in the C++ code. Move assembly offset tests next to constant declaration and tidy arch_test. Change-Id: Iededeebc05e54a1e2bb7bb3572b8ba012cffa1c8
* Make ART compile with GCC -O0 again.Ian Rogers2014-10-161-6/+6
| | | | | | | | | | | | | 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
* Some optimizations for the array alloc path.Hiroshi Yamauchi2014-09-251-1/+1
| | | | | | | | | | | | | | | | | - Force Array::Alloc() to be inlined. - Simplify the array size overflow check. - Turn fill_usable into a template parameter. - Remove a branch in Array::DataOffset() and avoid Primitive::ComponentSize(), which has a switch, in the array alloc path. - Strength reductions in the array size computation by using component size shifts instead of component sizes. Store component size shift in the upper 16 bits of primitive_type field. - Speedup: ~4% (3435->3284) in MemAllocTest on N4. Bug: 9986565 Change-Id: I4b142ffac4ab8b5b915836f1660a949d6442344c
* Implement method calls using relative BL on ARM.Vladimir Marko2014-09-251-1/+1
| | | | | | | | | | Store the linker patches with each CompiledMethod instead of keeping them in CompilerDriver. Reorganize oat file creation to apply the patches as we're writing the method code. Add framework for platform-specific relative call patches in the OatWriter. Implement relative call patches for ARM. Change-Id: Ie2effb3d92b61ac8f356140eba09dc37d62290f8
* Reduced memory usage of primitive fields smaller than 4-bytesFred Shih2014-08-251-1/+1
| | | | | | | | | | 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
* Reduce stack usage for overflow checksDave Allison2014-08-131-1/+1
| | | | | | | | | | | | | | | | | This reduces the stack space reserved for overflow checks to 12K, split into an 8K gap and a 4K protected region. GC needs over 8K when running in a stack overflow situation. Also prevents signal runaway by detecting a signal inside code that resulted from a signal handler invokation. And adds a max signal count to the SignalTest to prevent it running forever. Also reduces the number of iterations for the InterfaceTest as this was taking (almost) forever with the --trace option on run-test. Bug: 15435566 Change-Id: Id4fd46f22d52d42a9eb431ca07948673e8fda694
* Runtime can now be set to require relocationAlex Light2014-07-221-2/+29
| | | | | | | | | | | | | | Add a pair of runtime flags -Xrelocate and -Xnorelocate that can force the runtime to require that all files that are run are relocated, to prevent attacks based on the known art base address. Add support for running patchoat on oat files compiled without an image. Change run-test to have new --prebuild and --relocate flags. Bug: 15358152 Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
* Revert "Revert "ART: Key-Value Store in Oat header""Andreas Gampe2014-07-111-14/+129
| | | | | | | | | | | This reverts commit 452bee5da9811f62123978e142bd67b385e9ff82. Heap-allocate a couple of objects in dex2oat to avoid large frame size. Includes fixes originally in 100596 and 100605. Change-Id: Id51a44198c973c91f0a3f87b9d992a5dc110c6f8
* Add missing class initialization during compilation and testsSebastien Hertz2014-07-101-1/+1
| | | | | | | | | | | | | | | | | Adds missing class initialization during compilation and tests, especially java.lang.Class. Otherwise, we'd be able to execute code while the referring class is not initialized or initializing. Also adds mirror::Class::AssertInitializedOrInitializingInThread method to check class initialization when entering the interpreter: the called method's declaring class must either be initialized or be initializing by the current thread (other threads must be waiting for the class initialization to complete holding its lock). Note we only do this check in debug build. Bump oat version to force compilation. Bug: 15899971 Change-Id: I9a4edd3739a3ca4cf1c4929dcbb44cdf7a1ca1fe
* Revert "ART: Key-Value Store in Oat header"Nicolas Geoffray2014-07-091-130/+15
| | | | | | | | Broke arm64 build. This reverts commit c87d27b25994da8670d82a8f7bad6327b693bfff. Change-Id: I4c2ade295d2b5aa77fc3ad810e0e859629a5bf09
* ART: Key-Value Store in Oat headerAndreas Gampe2014-07-081-15/+130
| | | | | | | | | | | Allows the storage of string-string pairs in the oat header. The first significant use of this is storing the implicit-check flags, so that an oat file can be rejected if it doesn't agree with the current runtime. Bump the oat version as the header structure changes. Change-Id: I15a1c16886e6b8fa7b881c918c19c1efa5c7c00f
* AArch64: Add memcmp16() for Arm64; ensure xSELF not clobberedSerban Constantinescu2014-06-301-1/+1
| | | | | | | | | | | | | | | | | This patch modifies memcmp() to memcmp16(). Please note that this implementation of memcmp16() is based on the bionic's memcmp(). However, to reflect a recent specification change, the file has been modified to respect the new String.compareTo() behavior. A test for memcmp16() has been added. The string_compareto test in stub_test has been changed to invoke __memcmp16 in assembly stubs. Add artIsAssignableFromCode to the list of native downcalls to store and reload x18. Remove CheckSuspendFromCode, as it is unused. Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com> Change-Id: Ie0b5425ecfb62906d29a5d02e84c7e07ffb34a11
* Fix exception reporting from interpreterSebastien Hertz2014-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | To comply with JDWP exception report rules, we must report an exception at the location of the throw (or the first instruction encountered after a native call). To do this, we use the CatchLocationFinder visitor to look for a catch handler until we reach a native frame or the top frame. Because interpreter handles pending exception on a method-by-method basis, we need a flag to remember we already reported the exception and avoid reporting it multiple times when unwinding methods. The drawback is we need to maintain the state of this flag. We clear it when the exception is cleared. In the case we temporarily clear the exception (when finding a catch handler for instance), we restore the flag to its previous value at the same time we restore the pending exception. Bump oat version to force recompilation because we modify Thread offsets. Bug: 14402770 Change-Id: Ic059c58f80b2023b118038301f8f0a24f1e18241
* ART: Move __memcmp16 from Bionic to ARTAndreas Gampe2014-06-101-1/+1
| | | | | | | | | | | | Handle __memcmp16 / MemCmp16 in ART. Import assembly implementations for arm and mips from Bionic. Use a generic C version for all other platforms. Removes the memcmp16 quick entrypoint, as it is never used. Bump the oat version and update thread.cc and checks to reflect the structural change. Change-Id: I54a5a1da2a0a43ef271c8aeda0bf2276b8b11ac6
* ART: Fix forbidden thread state change in interpreterAndreas Gampe2014-06-041-1/+1
| | | | | | | | | | | | While loading a type for assignability, it might happen that it's not available yet locally and must be resolved. Formerly, we disallowed a state change to ensure no GC taking place while a new shadow frame has not been pushed on the stack yet. As a fix, allow a "shadow frame under construction" in the thread, which is visited during GC. Change-Id: I973487a46b0e9e21fd6d49099d713b58f06d3b45
* Fix interpreter entrypoint initialization in the imageSebastien Hertz2014-06-021-1/+1
| | | | | | | | | | Sets the interpreter_to_interpreter_bridge entrypoint if the method is not compiled. This avoids the slow path through Quick compiler's world.i Bumps oat version to force recompilation of image. Bug: 15098601 Change-Id: I08f7dfce26ecc5ca88bdf21187b2909c0c069596
* Switch on implicit checks and bump oat version to force recompilationDave Allison2014-05-301-1/+1
| | | | | | | This switches on the compiler's implicit null pointer and stack overflow checks. These use signals Change-Id: I7b536784bbca5f07e30379881a1eea6ab4c258ac
* Art compiler: remove unnecessary sqrt callbuzbee2014-05-271-1/+1
| | | | | | | | | | For reasons lost in the mists of time, the Dalvik JIT tested the results of an inlined sqrt for NaN on Arm targets, and then called an out-of-line routine to recompute if true. The Quick compiler inherited this behavior. It is not necessary, and the CL purges it (along with the out-of-line sqrt entrypoint). Change-Id: I8c8fa6feacf9b7c3b9e190dfc6f728932fd948c6
* Move modify_ldt_lock into global lock order.Chao-ying Fu2014-05-221-1/+1
| | | | | | | | | | | | | | | | | Mutex modify_ldt_lock was being removed during runtime shutdown while daemons thread may still detach. Avoid this by placing in global lock order. This fixes cts dalvik vm-tests-tf that hang on some x86 devices. By irogers: also, tidy global locks to agree with enum constants and add extra verification that the global annotalysis order agrees with the LockLevel order. Bumped the oat version and moved the locks as LockLevel additions previously caused entrypoints to be moved. Make unattached lock not handle the default mutex level case by moving the allocated thread ids lock into the global order. Change-Id: I9d03f19d44ea254accf0ceae8022563c77f7a02f Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
* Move quick frame info to OatQuickMethodHeader.Vladimir Marko2014-05-131-14/+8
| | | | | | | | | | | | | | | Rename OatMethodHeader to OatQuickMethodHeader, move frame info from OatMethodOffsets to OatQuickMethodHeader. Retrieve the info from other places for non-quick methods (portable compiled bytecode or jni stub, generic jni, runtime, abstract and proxy). This change has a libcore/ companion CL "Remove ArtMethod's quick fields for frame size and spills." https://android-review.googlesource.com/94164 Bug: 11767815 Change-Id: I0e31a7875d76732e1ec479c86b9b5ca01203507f
* Bump oat version to force recompile.Dave Allison2014-05-091-1/+1
| | | | | Bug: 14661374 Change-Id: I9492419c848a198909e0085358a45d7f4146630d
* Bump oat version again to force recompileDave Allison2014-05-091-1/+1
| | | | | | | | Bug: 4674743 (cherry picked from commit 36a69e7d133d4d056e00962f275ee5b4959f9e93) Change-Id: I65f30a86abeca58bed74f4bd0f6e1e32c6f3dec8
* Up OAT version to force recompileDave Allison2014-05-081-1/+1
| | | | | | | | Bug: 14638347 (cherry picked from commit f582426e819830242706308601610132fca602ce) Change-Id: Ic86c1f0affa109b80bc1e8e85ee353db1c087bbd
* Use WaitHoldingLocks in ReferenceProcessor::GetReferent.Mathieu Chartier2014-05-081-1/+1
| | | | | | | | The caller may be holding other locks, so we must use this or else we get bad mutexes held errors. Also added a lock level for the reference processor. Change-Id: I364a303a4106982bd9bfaac5b116cea1638ea6d3
* Add finalizer references from the entrypoints.Mathieu Chartier2014-05-011-1/+1
| | | | | | | | | | | | | | | | | | We now have an invariant where we never allocate finalizable objects with the Initialized or Resolved entrypoints. This speeds up allocation by only doing the check in the slow path. Before: MemAllocTest: 3625, 3707, 3641 EvaluateAndApplyChanges: 3448, 3421, 3413 After: MemAllocTest: 3164, 3109, 3135 EvaluateAndApplyChanges: 3272, 3299, 3353 Bug: 14078487 Change-Id: I2b0534af3e7c75ea5e5257cf3647744f7abfb74e
* Move mapping table and vmap table offsets to OatMethodHeader.Vladimir Marko2014-04-251-10/+9
| | | | | | | | | This change has a libcore/ companion CL "Remove ArtMethod's quick fields mapping table and vmap table." https://android-review.googlesource.com/91254 Bug: 11767815 Change-Id: I46ce2067e1ecd915da3890606498e31ffc332813
* Separate maps from code in oat file.Vladimir Marko2014-04-221-1/+11
| | | | | | | | | Write all GC maps first, then all mapping tables and then all vmap tables and only then align the offset to page size and write all method code chunks with headers. Bug: 11767815 Change-Id: Ic83555c8303c5be119afc43e95e58c0a32ff2a4f
* Revert "Revert "Revert "Use trampolines for calls to helpers"""Dave Allison2014-04-091-1/+1
| | | | | | This reverts commit f9487c039efb4112616d438593a2ab02792e0304. Change-Id: Id48a4aae4ecce73db468587967968a3f7618b700
* Revert "Revert "Use trampolines for calls to helpers""Dave Allison2014-04-091-1/+1
| | | | | | | | | This reverts commit 081f73e888b3c246cf7635db37b7f1105cf1a2ff. Change-Id: Ibd777f8ce73cf8ed6c4cb81d50bf6437ac28cb61 Conflicts: compiler/dex/quick/mir_to_lir.h
* Add r4 as promotable register if implicit suspend checksDave Allison2014-04-021-1/+1
| | | | | | | | | If we are doing implicit suspend checks we should be able to use r4 as a target for promotion. Also bump OAT version Change-Id: Ia27d14ece3b3259dbb74bcf89feaa9da2cda6db8
* Fix stack overflow for mutual recursion.Brian Carlstrom2014-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There was an error where we would have a pc that was in the method which generated the stack overflow. This didn't work however because the stack overflow check was before we stored the method in the stack. The result was that the stack overflow handler had a PC which wasnt necessarily in the method at the top of the stack. This is now fixed by always restoring the link register before branching to the throw entrypoint. Slight code size regression on ARM/Mips (unmeasured). Regression on ARM is 4 bytes of code per stack overflow check. Some of this regression is mitigated by having one less GC safepoint. Also adds test case for StackOverflowError issue (from bdc). Tests passing: ARM, X86, Mips Phone booting: ARM Bug: https://code.google.com/p/android/issues/detail?id=66411 Bug: 12967914 Change-Id: I96fe667799458b58d1f86671e051968f7be78d5d (cherry-picked from c0f96d03a1855fda7d94332331b94860404874dd)
* Implicit null/suspend checks (oat version bump)Dave Allison2014-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability to use SEGV signals to throw NullPointerException exceptions from Java code rather than having the compiler generate explicit comparisons and branches. It does this by using sigaction to trap SIGSEGV and when triggered makes sure it's in compiled code and if so, sets the return address to the entry point to throw the exception. It also uses this signal mechanism to determine whether to check for thread suspension. Instead of the compiler generating calls to a function to check for threads being suspended, the compiler will now load indirect via an address in the TLS area. To trigger a suspend, the contents of this address are changed from something valid to 0. A SIGSEGV will occur and the handler will check for a valid instruction pattern before invoking the thread suspension check code. If a user program taps SIGSEGV it will prevent our signal handler working. This will cause a failure in the runtime. There are two signal handlers at present. You can control them individually using the flags -implicit-checks: on the runtime command line. This takes a string parameter, a comma separated set of strings. Each can be one of: none switch off null null pointer checks suspend suspend checks all all checks So to switch only suspend checks on, pass: -implicit-checks:suspend There is also -explicit-checks to provide the reverse once we change the default. For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar The default is -implicit-checks:none There is also a property 'dalvik.vm.implicit_checks' whose value is the same string as the command option. The default is 'none'. For example to switch on null checks using the option: setprop dalvik.vm.implicit_checks null It only works for ARM right now. Bumps OAT version number due to change to Thread offsets. Bug: 13121132 Change-Id: If743849138162f3c7c44a523247e413785677370
* Fix oatdump for apps.Dave Allison2014-03-121-1/+2
| | | | | | | | This fixes the assertion failure for the interpreter to interpreter bridge offset when dumping an app. Bug: 13433669 Change-Id: Ic405ef7e43b849573a27db2ffa570e87b80c6af7
* Bump oat version due to InstructionSet enum renumbering in change:Brian Carlstrom2014-03-071-1/+1
| | | | | | | | | | | | | | | | | commit ed8dd492e43cbaaa435c4892447072c84dbaf2dc Author: Serban Constantinescu <serban.constantinescu@arm.com> Date: Tue Feb 11 14:15:10 2014 +0000 AArch64: Add ARM64 Assembler This patch adds the ARM64 Assembler and ManagedRegister backend. The implementation of the Arm64Assembler class is based on VIXL (a programmatic A64 Assembler - see external/vixl ). Change-Id: I842fd574637a953c19631eedf26f6c70d9ed7f9e Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com> Change-Id: I9e689b0a3586d996135f2c12265704ee139c9e4f
* Initial changes towards Generic JNI optionAndreas Gampe2014-03-031-3/+23
| | | | | | | | Some initial changes that lead to an UNIMPLEMENTED. Works by not compiling for JNI right now and tracking native methods which have neither quick nor portable code. Uses new trampoline. Change-Id: I5448654044eb2717752fd7359f4ef8bd5c17be6e