summaryrefslogtreecommitdiff
path: root/runtime/quick_exception_handler.cc
AgeCommit message (Collapse)Author
2017-01-30Merge "Revert "Revert "Make --debuggable rely on JIT code."""Nicolas Geoffray
2017-01-30Revert "Revert "Make --debuggable rely on JIT code.""Nicolas Geoffray
Fixed by https://android-review.googlesource.com/#/c/330165/ This reverts commit 81356645157af44152c7b7db383596b5cf3479b5. Change-Id: Ifb74e1cc90ab6dea621f7f54a00b540d6ccd0cf6
2017-01-30Merge "Revert "Make --debuggable rely on JIT code.""Vladimir Marko
2017-01-30Revert "Make --debuggable rely on JIT code."Vladimir Marko
Breaks 137-cfi with ART_TEST_RUN_TEST_DEBUGGABLE=true This reverts commit a0619e25aacf8b8074132f4951f75fdbcfd42925. bug: 28769520 Change-Id: Ifd7b8fc7c9b72c0a523fd57c4b1b80edd3547caa
2017-01-30Merge "Make --debuggable rely on JIT code."Nicolas Geoffray
2017-01-30Make --debuggable rely on JIT code.Nicolas Geoffray
Removes -Xfully-deoptable in the process, which was added as a temporary workaround until this CL. Partial revert of https://android-review.googlesource.com/#/c/302232/ Makes things consistent with existing infrastructure: - Parse the --debuggable from the compiler options, just like --compiler-filter. - Add DEBUG_JAVA_DEBUGGABLE, passed by the zygote, for debuggable apps. - Java debuggable now solely relies on JIT for simplicity. - Debugging under userdebug for non-java-debuggable apps is still best effort. Test: test-art-host, jdwp bug: 28769520 Change-Id: Id0593aacd85b9780da97f20914a50943957c858f
2017-01-27Remove alignment bits in between stack mapsMathieu Chartier
Saves 0.65% of boot.oat size, probably similar on apps. Added BitMemoryRegion to avoid requiring adding state to StackMap. Added test to memory_region_test. Test: clean-oat-host && test-art-host Bug: 34621054 Change-Id: I40279c59e262bd5e3c6a9135f83e22b5b6900d68
2017-01-10Move most of art::Thread to ObjPtrMathieu Chartier
Bug: 31113334 Test: test-art-host Change-Id: I73d0de3c875d3ec3d732034fdc961dae79ef4070
2016-10-18Remove mirror:: and ArtMethod deps in utils.{h,cc}David Sehr
The latest chapter in the ongoing saga of attempting to dump a DEX file without having to start a whole runtime instance. This episode finds us removing references to ArtMethod/ArtField/mirror. One aspect of this change that I would like to call out specfically is that the utils versions of the "Pretty*" functions all were written to accept nullptr as an argument. I have split these functions up as follows: 1) an instance method, such as PrettyClass that obviously requires this != nullptr. 2) a static method, that behaves the same way as the util method, but calls the instance method if p != nullptr. This requires using a full class qualifier for the static methods, which isn't exactly beautiful. I have tried to remove as many cases as possible where it was clear p != nullptr. Bug: 22322814 Test: test-art-host Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
2016-09-26ART: Use libbase loggingAndreas Gampe
Move most of our logging infrastructure over to system/core/base. Retain VLOG. Using unified Android infrastructure has two main advantages. First, it reduces the complexity/maintenance burden in ART. Second, it allows to detach logging for the cases where we do not want or need a runtime, e.g., dexdump, the disassembler, etc. As a part of the latter, libbase is also supported for all hosts (including Windows). From a developer viewpoint, there are minor behavior changes for the LOG statements (see above), but otherwise usage is the same. Explicit severity enum items are in the android::base namespace now. Bug: 31338270 Test: m test-art-host Change-Id: I5abcb2f45f5b03d49951874c48544f72a283a91b
2016-09-14Separate annotations from dexfile reading.David Sehr
Bug: 22322814 Change-Id: I867d66da407dd80394a10d19903ebbc1ec3986ff Test: test-art
2016-09-02Clean up some includes.Vladimir Marko
Remove some unnecessary includes from header files, replace others with forward references and add includes to source files as needed. Reduce dependency on stack.h by pulling StackReference<> out to its own file. Test: m test-art-host Change-Id: I0fb182145e328870cbd918b0ef6ae2950223c1b2
2016-08-30ART: SHARED_REQUIRES to REQUIRES_SHAREDAndreas Gampe
This coincides with the actual attribute name and upstream usage. Preparation for deferring to libbase. Test: m Test: m test-art-host Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
2016-08-01ART: Convert pointer size to enumAndreas Gampe
Move away from size_t to dedicated enum (class). Bug: 30373134 Bug: 30419309 Test: m test-art-host Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
2016-05-26Partial fragment deoptimizationMingyao Yang
We used to do either single frame deoptimization, or full fragment deoptimization which deoptimizes all the frames in a fragment. This change allows some methods to be not deoptimizeable, likely due to some kind of optimization. So we need another deoptimization mode that unwinds partial fragment. Deoptimizations are now generalized into either full or partial fragment. A full fragment deoptimization will deopt all frames in the fragment, and then returns from the invoke stub to enter interpreter. A partial fragment deoptimization will deopt a single frame, or all frames up to the method that's not deoptimizeable, and then jumps to the interpreter bridge. Currently code not deoptimizeable is the code in boot image since the code may not be compiled with debuggable flag. Bug: 28769520 Change-Id: I875c694791cc8ebd5121abcd92ce7b0db95aca38
2016-04-29Merge "Fix google-explicit-constructor warnings."Chih-hung Hsieh
2016-04-29Fix google-explicit-constructor warnings.Chih-Hung Hsieh
Bug: 28341362 Change-Id: Ic7e236a7f58c4021a3f8fb4536a6457d262fe62e
2016-04-28Split profile recording from jit compilationCalin Juravle
We still use ProfileInfo objects to record profile information. That gives us the flexibility to add the inline caches in the future and the convenience of the already implemented GC. If UseJIT is false and SaveProfilingInfo true, we will only record the ProfileInfo and never launch compilation tasks. Bug: 27916886 (cherry picked from commit e5de54cfab5f14ba0b8ff25d8d60901c7021943f) Change-Id: I68afc181d71447895fb12346c1806e99bcab1de2
2016-04-01Merge "Pack stack map entries on bit level to save space."Calin Juravle
2016-03-31Pack stack map entries on bit level to save space.David Srbecky
Use only the minimum number of bits required to store stack map data. For example, if native_pc needs 5 bits and dex_pc needs 3 bits, they will share the first byte of the stack map entry. The header is changed to store bit offsets of the fields rather than byte sizes. Offsets also make it easier to access later fields without calculating sum of all previous sizes. All of the header fields are byte sized or encoded as ULEB128 instead of the previous fixed size encoding. This shrinks it by about half. It saves 3.6 MB from non-debuggable boot.oat (AOSP). It saves 3.1 MB from debuggable boot.oat (AOSP). It saves 2.8 MB (of 99.4 MB) from /system/framework/arm/ (GOOG). It saves 1.0 MB (of 27.8 MB) from /system/framework/oat/arm/ (GOOG). Field loads from stackmaps seem to get around 10% faster. (based on the time it takes to load all stackmap entries from boot.oat) Bug: 27640410 Change-Id: I8bf0996b4eb24300c1b0dfc6e9d99fe85d04a1b7
2016-03-28ART: Clean up verifierAndreas Gampe
Clean up verifier post-Quick. Change-Id: I0b05e10dd06edd228fe2068c8afffc4b7d7fdffa
2016-02-25Merge "Implement << operator for DexRegisterLocation::Kind."David Srbecky
2016-02-25Implement << operator for DexRegisterLocation::Kind.David Srbecky
This makes it comparable in DCHECK_EQ and similar methods. Change-Id: I6b5b237be89325850ae6860d011fd6741189ab01
2016-02-19Fix braino in single frame deopt.Nicolas Geoffray
handler_method_header_ is actually the OatQuickMethodHeader of the caller of the method that is deoptimizing (as we will resume at its call site). We should use the OatQuickMethodHeader of the method that is deoptimizing and pass it to the code cache to invalidate the method. Change-Id: I2b61a96b8415e9477e3ac902c54a314aeb0811a0
2016-02-17Be a bit smarter with JIT code triggering deoptimization.Nicolas Geoffray
Do not re-use an OSR method that triggered deoptimization. Also add a stack overflow check before doing OSR. bug:27094810 Change-Id: I6ff6a7fb9b3df9b7c0ff37e3610595efa70ad067
2016-01-08Don't encode a DexRegisterMap if there is no live register.Nicolas Geoffray
Change-Id: I76a291e6a0ac37f0590d16c7f5b866115588bc55
2015-12-04Inline monomorphic calls.Nicolas Geoffray
Change-Id: If38171c2dc7d4a4378df5d050afc4fff4499c98f
2015-10-28ART: Fix deopt from optimized code under inliningDavid Brazdil
Deoptimization of inlined frames would use the outer method's vreg map, thus starting interpreter in bogus state. Bug: 25331616 Change-Id: I1d4aefc731bb1386f3e6186a89b59981836480b3
2015-10-22Do not run the verifier when deopting optimized frames.Nicolas Geoffray
The stack maps contain all the required information. Change-Id: I709e72b3de0d76a4203a3a004f093071e7865642
2015-10-20Remove ArtCode.Nicolas Geoffray
- Instead use OatQuickMethodHeader. - Various cleanups now that we don't have all those ArtMethod -> ArtCode -> OatQuickMethodHeader indirections. As a consequence of this cleanup, exception handling got a bit faster. ParserCombinators benchmark (exception intensive) on x64: (lower is better) Before: ParserCombinators(RunTime): 1062500.0 us. After: ParserCombinators(RunTime): 833000.0 us. Change-Id: Idac917b6f1b0dc254ad68fb3781cd61bccadb0f3
2015-10-13Add an abstraction over a compiled code.Nicolas Geoffray
That's just step 1, moving code-related functions of ArtMethod to another class. That class is only a wrapper on an ArtMethod, but will be changed to be a wrapper around compiled code. Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6
2015-09-28ART: Single-frame deoptAndreas Gampe
Add deoptimization of a single frame. Works by removing the managed code frame and jumping into the quick-to-interpreter bridge, and the bridge understanding a stored ShadowFrame. We need a separate fixup pass. For x86, we leave the return address on the stack so we don't need to push it there. Bug: 21611912 Change-Id: I06625685ced8b054244f8685ab50b238a705b9d2
2015-09-17Deoptimization support in optimizing compiler for setting local valuesMingyao Yang
Due to compiler optimizations, we may not always be able to update the value of a local variable in a compiled frame (like a variable seen as constant by the compiler). To avoid that situation, we simply deoptimize compiled frames updated by the debugger so they are executed by the interpreter with the updated value. When the debugger attempts to set a local variable (actually a DEX register or a pair of registers) in a compiled frame, we allocate a ShadowFrame associated to that frame (using its frame id) and set the new value in that ShadowFrame. When we know we are about to continue the execution of the compiled frame, we deoptimize the stack using the preallocated ShadowFrame (instead of creating a new one). We initialize it with the current value of all DEX registers except the ones that have been set by the debugger. Therefore, the ShadowFrame represent the runtime context modified by the debugger. Bumps oat version to force recompilation. Bug: 19944235 Change-Id: I0ebe6241264f7a3be0f14ee4516c1f7436e04da6
2015-09-15Merge "Cleanup thread access in StackVisitor"Sebastien Hertz
2015-09-15ART: Fix 004-ReferenceMap run testDavid Brazdil
This patch adds a new option to ArtMethod::ToNativeQuickPc to select the order of iteration over stack maps. The method is only used by the runtime to find native_pc of catch blocks, but also by the 004-ReferenceMap test which uses it to find native_pc of a safepoint. Change-Id: Idb2b34aabf1ac7249c30a00806af7d63d7e682dd
2015-09-15Revert "Revert "ART: Register allocation and runtime support for try/catch""David Brazdil
The original CL triggered b/24084144 which has been fixed by Ib72e12a018437c404e82f7ad414554c66a4c6f8c. This reverts commit 659562aaf133c41b8d90ec9216c07646f0f14362. Change-Id: Id8980436172457d0fcb276349c4405f7c4110a55
2015-09-15Cleanup thread access in StackVisitorSebastien Hertz
Adds method StackVisitor::GetThread to give access to the visited Thread* so we no longer need to copy that pointer in subclasses. Also adds a few missing const and DISALLOW_COPY_AND_ASSIGN. Change-Id: I57649ee7742ef4ef1e01447ac2fbb66f977b22eb
2015-09-14Revert "ART: Register allocation and runtime support for try/catch"David Brazdil
Breaks libcore test org.apache.harmony.security.tests.java.security.KeyStorePrivateKeyEntryTest#testGetCertificateChain. Need to investigate. This reverts commit b022fa1300e6d78639b3b910af0cf85c43df44bb. Change-Id: Ib24d3a80064d963d273e557a93469c95f37b1f6f
2015-09-14ART: Register allocation and runtime support for try/catchDavid Brazdil
This patch completes a series of CLs that add support for try/catch in the Optimizing compiler. With it, Optimizing can compile all methods containing try/catch, provided they don't contain catch loops. Future work will focus on improving performance of the generated code. SsaLivenessAnalysis was updated to propagate liveness information of instructions live at catch blocks, and to keep location information on instructions which may be caught by catch phis. RegisterAllocator was extended to spill values used after catch, and to allocate spill slots for catch phis. Catch phis generated for the same vreg share a spill slot as the raw value must be the same. Location builders and slow paths were updated to reflect the fact that throwing an exception may not lead to escaping the method. Instruction code generators are forbidden from using of implicit null checks in try blocks as live registers need to be saved before handing over to the runtime. CodeGenerator emits a stack map for each catch block, storing locations of catch phis. CodeInfo and StackMapStream recognize this new type of stack map and store them separate from other stack maps to avoid dex_pc conflicts. After having found the target catch block to deliver an exception to, QuickExceptionHandler looks up the dex register maps at the throwing instruction and the catch block and copies the values over to their respective locations. The runtime-support approach was selected because it allows for the best performance in the normal control-flow path, since no propagation of catch phi values is necessary until the exception is thrown. In addition, it also greatly simplifies the register allocation phase. ConstantHoisting was removed from LICMTest because it instantiated (now abstract) HConstant and was bogus anyway (constants are always in the entry block). Change-Id: Ie31038ad8e3ee0c13a5bbbbaf5f0b3e532310e4e
2015-09-10Support deoptimization on exceptionSebastien Hertz
Allows to deoptimize when an exception is being thrown. We only deoptimize if an executable frame (starting from the catch handler) needs to be executed with the interpreter. Before executing deoptimized frames, the exception is restored. The interpreter starts by handling this exception at the point of the throwing instruction. Bug: 23714835 Change-Id: I0c5f7d4b257644acf12210aae8e5b6bb0f4af1f7
2015-08-24Update instrumentation stack after exception eventSebastien Hertz
If instrumentation is updated on an exception event, we must update the instrumentation stack (to remove all frames that will be unwound by the exception) before doing the long jump. Bug: 23471864 Change-Id: Ic91552bb7280c54bcc58b7ba03a17040b0b0f5ef
2015-07-22Move to newer clang annotationsMathieu Chartier
Also enable -Wthread-safety-negative. Changes: Switch to capabilities and negative capabilities. Future work: Use capabilities to implement uninterruptible annotations to work with AssertNoThreadSuspension. Bug: 20072211 Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
2015-06-09Follow up on CL 151605Sebastien Hertz
- Fixes return type of StackedShadowFrameRecord::GetType - Makes StackedShadowFrameType an enum class (scoped enum) - Moves DeoptimizationReturnValueRecord and StackedShadowFrameRecord to thread.cc file and use forward declaration in thread.h header - Fixes tools/generate-operator-out.py for scoped enum classes. Bug: 20845490 Change-Id: I6b67e288b1db563699161e58ec2e2330d42dd8f5
2015-06-08Fix nested deoptimization.Mingyao Yang
Handle nested deoptimization cases. Create a stacked shadow frame records to keep track of deoptimization shadow frames. Shadow frames under construction can be tracked in the same stack. Bug: 20845490 Change-Id: I768285792c29e7c3cfcd21e7a2600802506024d8
2015-05-29Move mirror::ArtMethod to nativeMathieu Chartier
Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
2015-05-11Add a flag to StackVisitor for inlining.Nicolas Geoffray
The flag tells whether the stack walk needs to include inlined Java frames. This does not do anything just yet, as we're not inlining anyways. Change-Id: I716e25094fe56fa335ca1f9a398c1bcdba478e73
2015-05-08Check IsReferenceVReg during deoptMathieu Chartier
Required since the quick GC maps may not agree with the verifier ones. Without this check we may copy stale object references into the shadow frame. (cherry picked from commit f00baf56ef647684888a407dbb6adadd704a2039) Bug: 20736048 Change-Id: I7783c8a8ee45cf601b08b4c38f1dec7f7d11380c
2015-05-04Fix mismatched new[]/delete.Christopher Ferris
Another two cases where a new[] is used but only a delete occurs. Bug: 18202869 Change-Id: If68264807150f3a9783e44ef8823cc366bff8df2
2015-03-13API change in StackVisitor::GetVReg*.Nicolas Geoffray
- Remove GetVReg() and SetVReg() that were expecting to always succeed. - Change Quick-only methods to take a FromQuickCode suffix. - Change deopt to use dead values when GetVReg does not succeed: the optimizing compiler will not have a location for uninitialized Dex registers and potentially dead registers. Change-Id: Ida05773a97aff8aa69e0caf42ea961f80f854b77
2015-03-09Compute the right catch location for the debugger.Nicolas Geoffray
Also remove tls ThrowLocation, it is not needed anymore. Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9