summaryrefslogtreecommitdiffstats
path: root/runtime/instrumentation.h
Commit message (Collapse)AuthorAgeFilesLines
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-021-46/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Support multiple instrumentation clientsSebastien Hertz2015-05-071-13/+35
| | | | | | | | | | | | | | Changes Instrumentation::ConfigureStubs to support multiple clients that need different levels of instrumenation. A client is identified by a string key used to save the desired instrumentation level. Also adds regression gtest instrumentation_test and some cleanup. Bug: 19829329 (cherry picked from commit 0462c4c87c39db6cfcd338f323844738109ac3c9) Change-Id: I1fc24a86fcb7cb46d4be806895376c25cc0a0b3c
* ART: Streaming trace modeAndreas Gampe2015-04-151-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a streaming mode for tracing. Streaming uses a buffer of 16KB and writes to the output when that buffer gets full. Streaming mode can be enabled with -Xmethod-trace-stream and is currently not exposed otherwise. Add a python script that can parse the streaming format, which simply contains strings for newly encountered threads and methods inline, and create output that can be used with traceview. Add Trace::Pause and Trace::Abort, which can pause and abort tracing. Abort is different from Stop in that it does not write the data. Add code to the zygote hooks JNI implementation that pauses tracing before the fork, making sure that a child cannot clobber the parent's data. Add code to the zygote hooks JNI implementation that aborts old tracing and starts new tracing in the child after the fork. Currently base the output on the pid. This will not work on an unmodified device, as the profiles directory is not generally writable, but we do not have enough information at that point. Consider a scheme that restarts tracing later. Change-Id: I93c7bf87e35af582bdfdd3ecc7c52454514220dd
* Move ArtField to nativeMathieu Chartier2015-04-101-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* Remove ThrowLocation.Nicolas Geoffray2015-03-101-1/+0
| | | | | | | Note that this is a cleanup change, and has no functionality change. The ThrowLocation had no use anymore. Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
* Compute the right catch location for the debugger.Nicolas Geoffray2015-03-091-6/+2
| | | | | | Also remove tls ThrowLocation, it is not needed anymore. Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9
* Revert "Revert "Add JIT""Mathieu Chartier2015-02-241-7/+30
| | | | | | | | Added missing EntryPointToCodePointer. This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399. Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
* Revert "Add JIT"Nicolas Geoffray2015-02-241-30/+7
| | | | | | | | | | | | | | | 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
* Add JITMathieu Chartier2015-02-231-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Follow up on CL 123650Sebastien Hertz2015-01-211-1/+1
| | | | Change-Id: If575fdb9cc73e312e222e6853890e8dacd83b284
* Remove portable.Elliott Hughes2014-12-121-6/+1
| | | | Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
* Fix oatdump to use OatHeader pointer sizeMathieu Chartier2014-11-211-1/+1
| | | | | | | Bug: 18473190 Change-Id: If505b4f62105899f4f1257d3bccda3e6eb0dcd7c (cherry picked from commit c934e483ceabbd589422beea1fa35f5182ecfa99)
* Instruction set features for ARM64, MIPS and X86.Ian Rogers2014-11-131-1/+1
| | | | | | | | | | | | | 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
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-7/+8
| | | | | | | | | | | 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
* Fix broken runtime SetStatsEnabled logicMathieu Chartier2014-09-261-5/+9
| | | | | | | | | | | | | | | Previously, Runtime::SetStatsEnabled wouldn't take stats_enabled_ into account when deciding whether or not to increment / decrement teh stats enabled counter. This resulted in counter underflows and other errors which caused some CTS tests to fail. Also added some locking to prevent race conditions. Bug: 17360878 (cherry picked from commit a98ffd745bbecb2e84a492194950c0b94966546b) Change-Id: I21d241a58d35bd6a607aa2305c6da81720bd0886
* Avoid suspending for alloc trace enabling when already suspended.Jeff Hao2014-09-171-5/+5
| | | | | | | | Bug: 17499772 (cherry picked from commit 1d6ee090fddd4bfd35c304d6ceb929d5c529dfcc) Change-Id: Id09809c476c685f0a197ee75bb08638931364efd
* Reduce lock contention when debuggingSebastien Hertz2014-09-021-17/+18
| | | | | | | | | | | | | | | Uses a ReaderWriterMutex for the breakpoint lock to reduce contention during debugging session. Also adds missing thread safety annotations on fields and methods related to instrumentation and debugging. Bug: 16814665 Bug: 11667502 (cherry picked from commit 59d9d668d4f4286813afe2b4e7c6db839222ce96) Change-Id: I5f1156da8c6cc8316d6db16e6cfb2470fe289ad3
* Optimized instrumentation listener handlingDaniel Mihalyi2014-08-181-4/+8
| | | | | | | | | | | | | Some instrumentation listener lists may be modified while iterating over the list to deliver an instrumentation event. Therefore the previous implementation copied the list of listeners before starting the iteration. This new implementation only copies the list of instrumentation listeners when the list is changed. Instances of the list are reference counted using std::shared_ptr<>. Change-Id: I1b84db1f2042836dc1110925243f49e5790156d6
* Add GcRoot to clean up and enforce read barriers.Hiroshi Yamauchi2014-07-291-1/+3
| | | | | | | | | | | | | Introduce a value-type wrapper around Object* for GC roots so that 1) we won't have to directly add the read barrier code in many places and 2) we can avoid accidentally bypassing/missing read barriers on GC roots (the GcRoot interface ensures that the read barrier is executed on a read). The jdwp test passed. Bug: 12687968 Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
* Add read barriers for the GC roots in Instrumentation.Hiroshi Yamauchi2014-07-211-4/+23
| | | | | Bug: 12687968 Change-Id: I324e2f950ce4500b0e00722044af3a9c82487b23
* Fix exception reporting from interpreterSebastien Hertz2014-06-111-0/+4
| | | | | | | | | | | | | | | | | | | | 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: Add instrumentation stubs for ARM64 and X86-64Andreas Gampe2014-06-091-2/+3
| | | | | | | | | | | | Adds instrumentation stubs necessary for debugger support. Refactors MethodAndCode to a top-level TwoWordReturn. A function having a return type of TwoWordReturn will return its two-word content, either 2x32b or 2x64b, in two registers according to the architecture's ABI. Bug: 15443938 Change-Id: Id7e1fbd4ad8eb6f29e23d48903c76f77b28d981a
* Reduce header files including header files.Ian Rogers2014-06-061-4/+4
| | | | | | Main focus is getting heap.h out of runtime.h. Change-Id: I8d13dce8512816db2820a27b24f5866cc871a04b
* Register debugger for interesting instrumentation events onlySebastien Hertz2014-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids the overhead of notifying events (like method entry/exit, field read/write, ...) from the interpreter when they are not requested on the JDWP side. It also avoids burning JDWP ids for objects and classes before we find out we do not need to report the event. When we register a JDWP event (like a breakpoint), we add the debugger as a listener for the corresponding instrumentation event (like kDexPcChanged). On the other hand, when a JDWP event is cleared, we remove the debugger as a listener for the corresponding instrumentation event. To control we add/remove the debugger as listener only once per instrumentation event, we use reference counting. Like deoptimization, we can update instrumentation listeners only when when all mutator threads are suspended. To add or remove the debugger as listener, we extend the support of deoptimization requests to a more general support dealing with instrumentation requests. We add kRegisterForEvent and kUnregisterForEvent request kinds, respectively to add or remove the debugger as a listener for a given instrumentation event. Note: we will rename the related classes, methods, ... to avoid pollution in the code review. This CL also fixes Instrumentation::IsActive to take field read/write events into account. Bug: 14401699 Bug: 14826953 Change-Id: Ic896469e82a8589de419ebea4b9dc3116925f3ab
* Prepare field watchpoint supportSebastien Hertz2014-04-151-5/+62
| | | | | | | | | | | | | Adds field read/write events in the instrumentation. The debugger now registers as a listener for these events so JDWP field access and field modification events can be reported. This CL will be followed by another one to report these events from the interpreter. Therefore no JDWP field access and field modification events can be sent for now. Bug: 8267708 Change-Id: If2a93eb590805567d69015c83cce9cd2ab712cbd
* Support inlining with breakpointSebastien Hertz2014-03-271-2/+7
| | | | | | | | | | | | | | When installing/uninstalling a breakpoint in a method, we fully or selectively deoptimize/undeoptimize depending on whether the method can be inlined. When the method can be inlined, it requires full deoptimization. Otherwise, it only requires selective deoptimization. We add sanity check to control we are in a consistent state each time we add or remove a breakpoint. We also add some comments to better describe the process of deoptimization for breakpoint. Bug: 12187616 Change-Id: Id15adc6e5e2fe783c83c925cbcd19ae02431b7e0
* Refactor deoptimization support in debuggerSebastien Hertz2014-03-261-2/+2
| | | | | | | | | | | | | | | | | This CL prepares breakpoint support for inlined methods where we'll have to deoptimize everything. We move deoptimization-related information to Dbg class only (deoptimization request queue, full deoptimization event count and deoptimization lock). We replace MethodInstrumentionRequest by DeoptimizationRequest. This is used to know which kind of deoptimization is required for a particular event. It also simplifies lock ordering a bit during event setup: we no longer need to hold the deoptimization lock while holding the breakpoint lock. Moreover, the deoptimization lock should be held only after the event list lock. Bug: 12187616 Change-Id: Iff13f004adaeb25e5d609238bacce0b9720510e6
* Add missing debugger root visiting.Mathieu Chartier2014-03-251-17/+15
| | | | | Bug: 13634574 Change-Id: I2a76f6c43f1d0ad1922f06deb40a71ff651129fd
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-1/+1
| | | | | | | | | | | Fix clang build errors aswell as restructure locking/mutex code for correct thread safety analysis support. Reorder make dependencies so that host builds build first as they should provide better compilation errors than target. Remove host's use of -fno-omit-frame-pointer as it has no value with correct use of CFI, which we should have. Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
* Fix valgrind gtests and memory leaks.Mathieu Chartier2014-03-051-0/+4
| | | | | | | All tests pass other than image_test which passes if some bad reads are disabled (buzbee working on this). Change-Id: Ifd6b6e3aed0bc867703b6e818353a9f296609422
* Guard entrypoint changing by runtime shutdown lock.Mathieu Chartier2014-03-031-3/+5
| | | | | | | | | | | | There was a race when we changed the allocation entrypoints where a new thread would be starting (Thread::Init) and initialize to the wrong entrypoints. Guarding allocation entrypoint changing with the runtime shutdown lock fixes this race condition since Thread::Init is only called with the runtime shutdown lock held. Bug: 13250963 Change-Id: I8eb209c124b6bf17020de874e1b0083f158b8200
* Fix the bug that some compiled code was invoked with -Xint.Hiroshi Yamauchi2014-02-281-0/+4
| | | | | | | | Some compiled code (probably static methods) is still being invoked with -Xint. Added an assert to detect this case. Bug: 13250375 Change-Id: Iecfe8ef40c6c326962593db78e6e1d9f1c93842e
* Fix deoptimization deadlockSebastien Hertz2014-02-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fixes a deadlock occuring during undeoptimization on debugging session end. Before disconnecting debugger, we must unregister all requested events. We take the event list lock to browse all these events. Some of them (as METHOD_EXIT) may have activated deoptimization so we need to undeoptimize. During this process, we restore all original entrypoints of every method in the stack and notify method exit events to the instrumentation listener (see method InstrumentationLister::MethodExited). In our case, the instrumentation listener is the debugger. It takes the event list lock (to browse the event list and see if this event must be posted) but hangs waiting for it. Since it's already holding the event list lock (which is not recursive), it ends up in a deadlock situation. This CL fixes the way we prevent from posting method enter/exit events during the process of deoptimization/undeoptimization. We now explicitly set a flag indicating if deoptimization is enabled (by the debugger). Also removes unused field in InstallStackVisitor class and remove debugger as listener before disabling deoptimization to ensure it does not receive any event when disconnecting. Change-Id: I49a2ae43e86cf29094f4b462bfa754d7740d3e97
* Object model changes to support 64bit.Ian Rogers2014-02-061-14/+15
| | | | | | | | | | | | | | | | | | | | | | | Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
* Selective deoptimization.Sebastien Hertz2014-01-131-4/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the instrumentation to allow selective deoptimization. Separate instrumentation listener registration from stubs configuration. A listener is now responsible for configuring the appropriate stubs. - The method tracing listener installs instrumentation entry/exit stubs or the interpreter depending on the accuracy of events we want (controlled by kDeoptimizeForAccurateMethodEntryExitListeners). - The debugger registers itself as an instrumentation listener but does not modify methods entrypoints. It only does this on demand when deoptimizing one method or all the methods. The selective deoptimization is used for breakpoint only. When a breakpoint is requested, the debugger deoptimizes this method by setting its entrypoint to the interpreter stub. As several breakpoints can be set on the same method, we deoptimize only once. When the last breakpoint on a method is removed, we reoptimize it by restoring the original entrypoints. The full deoptimization is used for method entry, method exit and single-step events. When one of these events is requested, we force eveything to run with the interpreter (except native and proxy methods). When the last of these events is removed, we restore all methods entrypoints except those which are currently deoptimized. Deoptimizing a method requires all mutator threads be suspended in order to walk each thread's stack and ensure no code is actually executing while we modify methods entrypoints. Suspending all the threads requires to not hold any lock. In the debugger, we deoptimize/undeoptimize when the JDWP event list changes (add or remove a breakpoint for instance). During the update, we need to hold the JDWP event list lock. This means we cannot suspend all the threads at this time. In order to deal with these constraints, we support a queue of deoptimization requests. When an event needs selective/full deoptimization/undeoptimization, we save its request in the queue. Once we release the JDWP event list lock, we suspend all the threads, process this queue and finally resume all the threads. This is done in Dbg::ManageDeoptimization. Note: threads already suspended before doing this remain suspended so we don't "break" debugger suspensions. When we deoptimize one method or every method, we need to browse each thread's stack to install instrumentation exit PC as return PC and save information in the instrumentation stack frame. Now we can deoptimize multiple times during the execution of an application, we need to preserve exisiting instrumentation frames (which is the result of a previous deoptimization). This require to push new instrumentation frames before existing ones so we don't corrupt the instrumentation stack frame while walking the stack. Bug: 11538162 Change-Id: I477142df17edf2dab8ac5d879daacc5c08a67c39
* Refactor allocation entrypoints.Mathieu Chartier2013-11-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for switching entrypoints during runtime. Enables addition of new allocators with out requiring significant copy paste. Slight speedup on ritzperf probably due to more inlining. TODO: Ensuring that the entire allocation path is inlined so that the switch statement in the allocation code is optimized out. Rosalloc measurements: 4583 4453 4439 4434 4751 After change: 4184 4287 4131 4335 4097 Change-Id: I1352a3cbcdf6dae93921582726324d91312df5c9
* Merge "Propagate 'this_object' for method unwind event." into dalvik-devSebastien Hertz2013-11-191-2/+3
|\
| * Propagate 'this_object' for method unwind event.Sebastien Hertz2013-11-191-2/+3
| | | | | | | | | | | | Propagates the 'this_object' to InstrumentationListener::MethodUnwind callback. Change-Id: I12561f1a611b8399b94e669f9b8a6eaaf1a58631
* | Fix missing class initialization during instrumentation.Sebastien Hertz2013-11-151-2/+0
|/ | | | | | | | | | | | | | | | | | | | | Static methods (except the <clinit>) all point to the resolution trampoline to handle class initialization. When we enable instrumentation, we update the entry point to the instrumentation stub. But doing so makes us miss the call into the trampoline. This CL fixes this issue by leaving the resolution trampoline. Once a method's class is initialized, we update all its static methods' entry point. When instrumentation is enabled, this entry point becomes the instrumentation entry stub. This also allows to post method enter events in the right order during static invokes. First, we get into the trampoline which call the method's class <clinit> method and post the corresponding "method enter" event. Then we get into the instrumentation entry stub of the static method being called and post the corresponding "method enter" event before getting into its code. Bug: 11686442 Change-Id: I202db921225c8be0b2191074d09b0ba40f9248b2
* Fix oatdump and valgrind.Ian Rogers2013-11-061-2/+11
| | | | | | | | | | | | Bug: 11531382 Move allocation instrumentation out of runtime into instrumentation. Don't attempt to suspend threads in unstarted runtimes. Make indentation support sputc returning eof, on which it will sync and try again. A further failure likely means the disk is full. Move the dump-oat output directory to be art as now there's too much output to fit all the dump-oat data in our standard /tmp. Change-Id: I8ea848ace318552c180e2efa46570288ff1ca62c
* Improve interpreter handler table management.Sebastien Hertz2013-10-171-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | We still have two handlers table: - the "main" table which holds execution handlers of each instruction, - the "alternative" table which holds handlers supporting instrumentation before jumping to the corresponding instruction handler from the "main" table. Instrumentation holds the index of the handler table the interpreter must use. This index is represented by the InterpreterHandlerTable enum and is stored in the Instrumentation::interpreter_handler_table_ field. Interpreter's current handler table update happens: - on backward branch - after invoke - when throwing exception. In the case of the backward branch and exception, we only update the table if any thread's flags is set. This allows to only do one test for handling thread suspension and handler table update. This CL also removes the local variable "instrumentation". Every handler which needs it will get it from Runtime::Current()->GetInstrumentation(). Change-Id: Id886ea7ebf3dac1285f0ca701c098aee7ebaab8d
* Load shadow frame's this object only upon instrumentation.Sebastien Hertz2013-09-171-1/+1
| | | | | | | | | | | | | | | | | | We used to load the shadow frame's this object when entering the interpreter and push it into thread's SIRT to make it visible to garbage collector. But it is only used by instrumentation listeners. We now move this load at each place an instrumentation listener is called. This avoids loading it when instrumentation is disabled. This also allows to remove the SIRT reference and the push/pop management it implies when entering/exiting the interpreter. The performance improvement is 6% in average on our benchmarks suite. This CL also makes method Instrumentation::ExceptionCaughtEvent const so we can use a "const instrumentation::Instrumentation*" object in interpreter. Change-Id: I2caccba9a906f244c8057b24031250f9824cc711
* Refactor java.lang.reflect implementationBrian Carlstrom2013-08-131-26/+26
| | | | | | | | | | | Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1. Move to ArtMethod/Field instead of AbstractMethod/Field and have java.lang.reflect APIs delegate to ArtMethod/ArtField. Bug: 10014286. Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
* am fc0e3219: Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
|\ | | | | | | | | * commit 'fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d': Fix multiple inclusion guards to match new pathnames
| * Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
| | | | | | | | Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
* | Fixes to instrumentation for debug build and interpreter.Jeff Hao2013-07-171-1/+1
|/ | | | | | | | | | | | - Stub uninstall will put back the interpreter entry point if Xint mode is specified. - Copy method entry and exit listeners before iterating over them to prevent problems that occur when they are modified during iteration. - Corrected checks from WalkStack and AssertPcIsWithinCode to handle instrumented code since they are used to remove the stubs. Change-Id: Ib0e2b421e6b56d520e4643699624dd80ee5148e3
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+293
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81