summaryrefslogtreecommitdiffstats
path: root/runtime/quick_exception_handler.cc
Commit message (Collapse)AuthorAgeFilesLines
* Follow up on CL 151605Sebastien Hertz2015-06-181-3/+4
| | | | | | | | | | | | | | - 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 (cherry picked from commit f795869da0a1fa006fdcdacd8afb6149a63fc1a7) Change-Id: I6b67e288b1db563699161e58ec2e2330d42dd8f5
* Fix nested deoptimization.Mingyao Yang2015-06-181-83/+95
| | | | | | | | | | | | 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 (cherry picked from commit 1f2d3ba6af52cf6f566deb38b7e07735c9a08fb6) Change-Id: I768285792c29e7c3cfcd21e7a2600802506024d8
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-021-27/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a flag to StackVisitor for inlining.Nicolas Geoffray2015-05-111-4/+13
| | | | | | | | | 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
* Check IsReferenceVReg during deoptMathieu Chartier2015-05-081-1/+4
| | | | | | | | | | | 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
* Fix mismatched new[]/delete.Christopher Ferris2015-05-041-1/+2
| | | | | | | Another two cases where a new[] is used but only a delete occurs. Bug: 18202869 Change-Id: If68264807150f3a9783e44ef8823cc366bff8df2
* API change in StackVisitor::GetVReg*.Nicolas Geoffray2015-03-131-13/+58
| | | | | | | | | | - 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
* Compute the right catch location for the debugger.Nicolas Geoffray2015-03-091-6/+4
| | | | | | Also remove tls ThrowLocation, it is not needed anymore. Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9
* Change how we report exceptions to the debugger.Nicolas Geoffray2015-03-031-14/+4
| | | | | | | This is only a refactoring/cleanup. Bug fixes with respect to catch location, and more cleanups will follow. Change-Id: I30d3c6260b0c8f8115a811621397225b88f2063a
* ART: Introduce NO_RETURN, Mark DoLongJump noreturnAndreas Gampe2015-02-231-0/+1
| | | | | | | Add NO_RETURN macro that adds C++11 noreturn attribute. Mark DoLongJump methods as noreturn. Change-Id: Ifde4318e370493237050d4c1349285a0382df23f
* ART: Allow class-loading during deoptAndreas Gampe2015-02-131-12/+16
| | | | | | | | | | When deoptimizing, we might touch code that uses unloaded classes. Bug: 19290147 (cherry picked from commit 44fb719e5f0f5ee7dcf4b1eae703593f1043a169) Change-Id: I5776f08ba366e9742336caba0d6af85f00629afc
* Fix exception handling during deoptimizationSebastien Hertz2015-01-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When interpreting a deoptimized shadow frame, we may start with a pending exception thrown by a previous deoptimized shadow frame (from a previous invoke). Therefore, we need to handle it before executing any instruction, otherwise we execute incorrect code. Because we need the DEX pc of the throwing instruction to find a matching catch handler, we initialize deoptimized shadow frames with the current DEX pc at the time the stack is deoptimized. When we are about to interpret a deoptimized shadow frame, we need to update the shadow frame with the DEX pc of the next instruction to interpret. There are three cases: - if there is no pending exception, this is the instruction following the current one. - if there is a pending exception and we found a matching catch handler, this is the first instruction of this handler. - if there is a pending exception but there is no matching catch handler, we do not execute the deoptimized shadow frame and continue to its caller. The verifier now fails when a method starts with a move-exception instruction. Indeed we cannot start executing a method with a pending exception. Bug: 19057915 Bug: 19041195 Bug: 18607595 Change-Id: I355ac81e6ac098edc7e3cc8c13dbfa24a2969ab2
* Don't allow suspension from FindLocksAtDexPcMathieu Chartier2015-01-061-1/+1
| | | | | | | | | | | | | | | | Transitioning to suspended from runnable sometimes runs dump checkpoints in ThreadStress which can cause deadlocks. This happens since FindLocksAtDexPC runs the verifier which calls AllowThreadSuspension. This results in a blocked thread which holds the monitor lock, and if another thread tries to do a monitor enter, it deadlocks while holding the mutator lock (assuming the GC is suspending all). The fix for avoiding this deadlock is not calling AllowThreadSuspension from FindLocksAtDexPc. Bug: 18576985 Change-Id: I7e5faaf3bbbd5b5f680de95d53c33b5106705b0c
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-2/+2
| | | | | | | | | | | 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
* C++11 related clean-up of DISALLOW_..Ian Rogers2014-10-221-2/+1
| | | | | | | | | | | | | | | | | | Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations with no definitions this prompts better warning messages so deal with these by correcting the code. Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object. Make X86 assembly operand types ValueObjects to fix compilation errors. Tidy the use of iostream and ostream. Avoid making cutils a dependency via mutex-inl.h for tests that link against libart. Push tracing dependencies into appropriate files and mutex.cc. x86 32-bit host symbols size is increased for libarttest, avoid copying this in run-test 115 by using symlinks and remove this test's higher than normal ulimit. Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it returns NULL when the heap is under construction by Runtime. Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
* Make ART compile with GCC -O0 again.Ian Rogers2014-10-161-2/+3
| | | | | | | | | | | | | 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
* Enable -Wunreachable-codeIan Rogers2014-09-301-4/+4
| | | | | | | | Caught bugs in DeoptimizeStackVisitor and assemble_x86 SIB encoding. Add UNREACHABLE macro to document code expected to be unreachable. Bug: 17731047 Change-Id: I2e363fe5b38a1246354d98be18c902a6031c0b9e
* Compile time performance improvements focusing on interpret-only.Ian Rogers2014-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Clean up Handle usage.Mathieu Chartier2014-08-231-3/+3
| | | | | | | | | | | 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
* Handlerize MethodVerifier::mirror_method_.Hiroshi Yamauchi2014-08-221-2/+3
| | | | | | | | | | The method (mirror_method_) wasn't handlerized across some allocation/GC points such as the ResolveType() call in ScanTryCatchBlocks() and the GetReturnType() calls in CodeFlowVerifyInstruction(). Bug: 12687968 Change-Id: I95323de14459eb5a7c4abfcf44f882f86d59be64
* More efficient stack walk in exception throwing.Hiroshi Yamauchi2014-08-131-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | In the exception handling code, we currently walk down the stack twice, once to get the stack height which we use to compute frame IDs (the bottom frame is zero), and once more to find the catch block to jump to. For a deep stack, this could result in very slow exception handling. That is, if have a lot of finally or catch blocks that we end up jumping to in a deep stack, we need to do a lot of catch/rethrow chains. Since we'd need to walk down to the bottom each time to compute frames IDs in each catch/rethrow, we'd need to walk down O(N^2) frames at the worst case. Instead of frames IDs ((the bottom frame is zero), we will use the frame depth (the top frame is zero) and no longer need to walk down the stack just to get the stack height. We walk down O(N) frames. This was what was happening with code.google.gson.functional.CircularReferenceTest. With this change, the test run time went from ~120s down to ~3s on N5 and it no longer crashes due to the thread suspension timeout. Bug: 16800209 Change-Id: Ie815df1e3e8fb9d82e40685d4cc2b8838fd8aa07
* Fix access to long/double stack values from debuggerSebastien Hertz2014-07-171-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Long and double values live in a pair of DEX registers. When we compile DEX code with the Quick compiler, a DEX register either lives in the stack or is promoted to a physical register. In the case of a pair of DEX registers, the Quick compiler assumes both registers live in the same "area": both live in the stack or both are promoted to physical registers. From the debugger, we used to access these values by reading/writing each DEX register separately. However, this does not work when only one DEX register of a pair is promoted and the other lives in the stack. In this case, the compiled code reads from/writes to the stack only. To fix that, the debugger must follow the same rule than the Quick compiler: if both DEX registers are promoted, read/write them from/to physical registers, otherwise read/write them from/to the stack. We add StackVisitor:GetVRegPair and StackVisitor:SetVRegPair for this purpose. We also follow the same rule when deoptimizing. However we need to do that only when we know two consecutive DEX registers are part of a pair (long or double). We know that thanks to the verifier. Bug: 15527793 Change-Id: I04812285ff26ef0129f39792a1cf776f3591ca2d
* Break apart header files.Ian Rogers2014-07-151-0/+1
| | | | | | | | Create libart-gtest for common runtime and compiler gtest routines. Rename CompilerCallbacksImpl that is quick compiler specific. Rename trace clock source constants to not use the overloaded profiler term. Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
* Improve performance of invokevirtual/invokeinterface with embedded imt/vtableMingyao Yang2014-07-111-0/+3
| | | | | | | | | Add an embedded version of imt/vtable into class object. Both tables start at fixed offset within class object so method/entry point can be loaded directly from class object for invokeinterface/invokevirtual. Bug: 8142917 Change-Id: I4240d58cfbe9250107c95c0708c036854c455968
* Fix exception reporting from interpreterSebastien Hertz2014-06-111-4/+17
| | | | | | | | | | | | | | | | | | | | 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
* Change MethodHelper to use a Handle.Mathieu Chartier2014-06-091-10/+13
| | | | | | | | | | | Added ConstHandle to help prevent errors where you modify the value stored in the handle of the caller. Also fixed compaction bugs related to not knowing MethodHelper::GetReturnType can resolve types. This bug was present in interpreter RETURN_OBJECT. Bug: 13077697 Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
* Don't report down-calls as unhandled exceptions.Ian Rogers2014-05-301-12/+174
| | | | | | | | Bug: 15310540 Also, narrow scope of catch/deoptimize stack visitors that are specific to quick exception delivery. Change-Id: Ib13a006ce1347acb93a36b0186550d4c3ec2034b
* ART: Use StackReference in Quick Stack FrameAndreas Gampe2014-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The method reference at the bottom of a quick frame is a stack reference and not a native pointer. This is important for 64b architectures, where the notions do not coincide. Change key methods to have StackReference<mirror::ArtMethod>* parameter instead of mirror::ArtMethod**. Make changes to invoke stubs for 64b archs, change the frame setup for JNI code (both generic JNI and compilers), tie up loose ends. Tested on x86 and x86-64 with host tests. On x86-64, tests succeed with jni compiler activated. x86-64 QCG was not tested. Tested on ARM32 with device tests. Fix ARM64 not saving x19 (used for wSUSPEND) on upcalls. Tested on ARM64 in interpreter-only + generic-jni mode. Fix ARM64 JNI Compiler to work with the CL. Tested on ARM64 in interpreter-only + jni compiler. Change-Id: I77931a0cbadd04d163b3eb8d6f6a6f8740578f13
* Add Handle/HandleScope and delete SirtRef.Mathieu Chartier2014-05-131-5/+6
| | | | | | | | | | | | | | | | Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
* Fix a few 64-bit compilation of 32-bit code issues.Ian Rogers2014-05-011-0/+1
| | | | | | Bug: 13423943 Change-Id: I939389413af0a68c0d95b23cd598b7c42afa4383
* Visit deoptimized shadow frames as rootsSebastien Hertz2014-04-291-5/+1
| | | | | | | | | | | | | | | | During deoptimization, we create shadow frames but do not attach them to the stack until we transition to interpreter mode. If a GC happens before that, these shadow frames are not visited by GC so they may contain stale references. This CL addresses this issue by visiting the shadow frames "under contruction" in Thread::VisitRoots so we correctly update all references they hold. To make them visible, we now save the top shadow frame (the first one created) in the field Thread::tls_ptr_sized_values::deoptimization_shadow_frame. This field will then be cleared when transitioning to interpreter mode. Bug: 14324885 Change-Id: Ib213ddc80f19cfcdfcec6f20acaa7f1a0e9ce2c1
* Refactor exception handling for deoptimizationSebastien Hertz2014-04-251-0/+141
This CL refactors the exception handling (on the quick side) by isolating the search of catch handler and the preparation of deoptimization. We rename the CatchFinder class to QuickExceptionHandler so it's less specific to catch handler search. Finding catch handler happens in QuickExceptionHandler::FindCatch. Since the CatchBlockStackVisitor resolves exception types, it may cause thread suspension and breaks the assertion current thread can't be suspended. Therefore, we place the exception in a SirtRef (while it is detached from the current thread) and remove the thread suspension assertion. Deoptimization now happens in QuickExceptionHandler::DeoptimizeStack. It uses the new DeoptimizeStackVisitor class to create shadow frames. We also add the Thread::GetDeoptimizationException method to get the definition of the fake exception in only one place. Change-Id: I01b19fa72af64329b5c3b6c7f0c3339d2d724978