summaryrefslogtreecommitdiff
path: root/runtime/runtime_callbacks.cc
Commit message (Collapse)AuthorAgeFilesLines
* Revert^4 "Allow structural redefinition on non-final classes."Alex Light2019-12-111-0/+13
| | | | | | | | | | | | | | This reverts commit 664999a12d6fc8a8ef5c0519b12ec1e8a51bb085. Fixed issues with GC and quickened instructions in parent CLs. Reason for revert: Fixed issues with GC CHECK fail and device SEGVs. Test: ./test.py --host Test: ./test.py --target Bug: 134162467 Bug: 144168550 Change-Id: Ibacddaf45beb72184f97d53d5d048bd442578658
* Revert "Revert^2 "Allow structural redefinition on non-final classes.""Nicolas Geoffray2019-12-031-13/+0
| | | | | | | | | | This reverts commit f1b809ce611e943f926fff97cefe0930226ffcc2. Reason for revert: Tests still fail Bug: 134162467 Bug: 144168550 Change-Id: Icdebc826b8630920b716afbfd6f338a29669fcc2
* Revert^2 "Allow structural redefinition on non-final classes."Alex Light2019-12-021-0/+13
| | | | | | | | | | | | | | | | | | | | | We were incorrectly racing with the rest of the runtime in a couple of places. First we would return an ObjPtr of a newly defined class after holding it over a suspend point. This could lead to DefineClass returning an obsolete class in some cases. We also failed to ensure the class-status was synchronized between the old and new classes during structural redefinition. This could lead to a class appearing to go backwards in status. This reverts commit 88b1c83080afcb2bfb6f781ded1c90fe8f9eab4d. Reason for revert: Fixed issues causing test failures. Test: ./test.py --host Bug: 134162467 Bug: 144168550 Change-Id: I4d0f7718490532f0ef14a9561b8e7000ef292b12
* Revert "Allow structural redefinition on non-final classes."Roland Levillain2019-11-261-13/+0
| | | | | | | | | | | This reverts commit c47040d31cbcd8cddd5fadb552b4f0f6c94b5bd0. Reason for revert: Breaks ART tests (see e.g. b/145197371). Bug: 145197371 Bug: 134162467 Bug: 144168550 Change-Id: Ia8e5788655057e380fc723a38900d26d69cda938
* Allow structural redefinition on non-final classes.Alex Light2019-11-261-0/+13
| | | | | | | | | | | | | | | | This adds support for structurally redefining non-final, non-finalizable classes. The only restriction is that one cannot redefine a class at the same time as any of its supertypes, if a structural redefinition is occurring. The structural redefinition may not remove any fields or methods, change the superclass or change the implemented interfaces. Adding new methods or fields, both static or non-static, public, private, protected, or package-private, is supported. Test: ./test.py --host Bug: 134162467 Bug: 144168550 Change-Id: I32e9e854b3e56270170b10e8f5aba9de8f6bfdfa
* Consolidate updating of reflective Field/Method referencesAlex Light2019-09-271-0/+16
| | | | | | | | | | | | | | | | | | | | Previously we used several different visitors to update Field & Method references for structural redefinition. We also did not visit or update JVMTI based references. This consolidates all the visitors to a single Runtime::VisitReflectiveTargets function with a single ReflectiveTargetVisitor type. This simplifies the code around structural redefinition and ensures that the reflective value holders are in charge of the actual replacement. Support was also added for walking internal openjdkjvmti references for things like field-read/modification events. Test: ./test.py --host Bug: 134162467 Change-Id: Ic5fc1db7db0a30f947a1a67259dc024e149ebd57
* Use unique mutex to synchronize runtime_callbacksAlex Light2019-04-091-22/+55
| | | | | | | | | | | | | | Initially we would use the mutator_lock_ to manage changes to the runtime_callbacks list. Over time this stopped being sufficent. This changes to using an explicit r/w mutex to manage these lists. Since these callbacks are not modified very often we use a single mutex for all of them. Test: ./test.py --host Test: ./art/tools/run-libjdwp-tests.sh --mode=host Bug: 121052811 Change-Id: I3ca44402a5f6290701fa8e28d18e6afe8786214c
* ART: Move dex structs into own headerAndreas Gampe2019-01-021-4/+4
| | | | | | | | | Separating out the structs from DexFile allows them to be forward- declared, which reduces the need to include the dex_file header. Bug: 119869270 Test: m Change-Id: I32dde5a632884bca7435cd584b4a81883de2e7b4
* Emit JVMTI events for LockSupport.parkCharles Munger2018-11-121-0/+20
| | | | | | | | | | | This restores the behavior from when park was implemented with wait/notify, except that the blocker object is used as the monitor rather than the Thread that is parking. Bug: 28845097 Tested: ./test/run-test --jvm 1931 Change-Id: I523d719ca3e49a538c06f48f032b322fb91e147e
* Revert^6 "Ensure that OSR still is possible with jvmti"Alex Light2018-04-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | The instrumentation uninstall could set methods to non-debuggable boot.oat code. This could cause events to be missed due to methods being inlined. We needed to change the path so that we would only have the JIT/interpreter replace methods. We do this by adding a new callback that can be used to determine if a method needs to be debuggable and being more careful about replacing code when this is true. This reverts commit 5f3005c8844d851d7d218b88b5f90d6c9083ce24. This unreverts commit b9ad26d1ed9146b89555d4333021f44eeb831f05. Reason for revert: Fixed issue causing CTS version of test 993 failure. Test: cts-tradefed run cts-dev CtsJvmtiRunTest993HostTestCases Test: ./test.py --host -j50 --all -t 993 Test: ./test.py --host Test: while ./test/run-test --host --jit 1935; do; done Test: while ./test/run-test --host --jit --jvmti-redefine-stress 1935; do; done Test: am start --attach-agent -n com.example.android.displayingbitmaps/.ui.ImageGridActivity Run blur filter. Bug: 76226464 Bug: 77306669 Change-Id: I5068201a03f7613787c66981405499b6499c24e1
* Add support for selecting alternate JDWP implementationsAlex Light2017-12-191-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change JDWP options parsing to take place later and add a -XjdwpProvider:_ option that can be used by the runtime to select an appropriate JDWP provider. The argument is a string. If 'none' is given JDWP will be totally disabled. If 'internal' is given the current internal JDWP implementation is used. If 'default' is given the 'internal' JDWP implementation will currently be used. Other values will be added in the future. Also adds a runtime callback that will be invoked when the runtime wants to start or stop the debugger (namely at the post-zygote fork and just before exit) and check if a debugger is availible. Also add '-XjdwpOptions:_' in preparation for the eventual removal of the existing -Xrunjdwp=_ and -Xagentlib:jdwp=_ as top-level options. All of these options now store their arguments as a std::string to be interpreted by the JDWP implementation as it sees fit. Also change the jdwpOptions to default to transport=dt_android_adb if there is not one specified and it is available. This will make changing the default transport based on the JDWP provider easier. These new options are needed to allow us to support both the old, internal, JDWP implementation as its replacement is tested and verified. This lets us switch between them with little difficulty. We will probably remove one or both of these options once we have confidence that the new jdwp implementation has stuck. Test: ./test.py --host -j50 Test: ./test/run-test --host --debug 001-HelloWorld Test: Manual, flash walleye, debug app Bug: 62821960 Change-Id: Ie31db6b6f7d76a03d4ab8e178fcf298ed0eec203
* Add JVMTI DDMS extension method and event.Alex Light2017-11-141-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Add a new jvmti extension method 'com.android.art.internal.ddm.process_chunk' that can be used to request that the system process a DDMS chunk with a given type and data payload. It returns the processed chunk type and data. Agents can use this to interact with DDMS. Also add a new jvmti extension event 'com.android.art.internal.ddm.publish_chunk' that will be called whenever the system wishes to send an unrequested chunk of data to be processed. This is triggered by code executing 'DdmServer#sendChunk' or by other internal mechanisms. Both of these extensions are provided mainly to aid in the maintenence of backwards compatibility with existing DDMS applications. Generally agents should prefer to use the normal JVMTI events and controls over interpreting DDMS data or calling DDMS functions. Bug: 62821960 Test: ./test.py --host -j50 Test: ./art/tools/run-jdwp-tests.sh --mode=host \ --test org.apache.harmony.jpda.tests.jdwp.DDM.DDMTest Change-Id: I39f22d3d096d12b59713ec7b8b0c08d0d68ff422
* Avoid JVMTI global deoptimization when possibleAlex Light2017-10-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the openjdkjvmti plugin to be more controlled about the situations that it will deoptimize everything. Most notably this makes the plugin deoptimize only individual methods for breakpoints instead of doing a full deoptimization. It also doesn't deoptimize for the JVMTI_EVENT_EXCEPTION method, since our throwing code will always send the appropriate event. Impact: Exoplayer benchmark with breakpointlogger setting a breakpoint on a method that is never called. The agent is the tools/breakpoint-logger agent. 'art' options are for all runs were: --64 -Xusejit:true -Xcompiler-option --debuggable 'art' options for 'Pre change' and 'Post change' runs included: -Xplugin:libopenjdkjvmti.so '-agentpath:libbreakpointlogger.so=Lbenchmarks/common/java/BenchmarkBase;->run()V@0' Clean run (no agent loaded): Running FMP4 x 1 : 53 Running TS x 1 : 144 Running FMP4 x 2500 : 3309 Running TS x 100 : 3584 ExoPlayerBench(RunTime): 6977000.0 us. Pre change: Running FMP4 x 1 : 159 Running TS x 1 : 9395 Running FMP4 x 2500 : 298591 Running TS x 100 : 944447 ExoPlayerBench(RunTime): 1.243226E9 us. Post change: Running FMP4 x 1 : 87 Running TS x 1 : 495 Running FMP4 x 2500 : 2939 Running TS x 100 : 3947 ExoPlayerBench(RunTime): 6979000.0 us. Post change vs clean run is well within margin of error for this benchmark. Test: ./test.py --host -j50 Test: ./art/tools/run-prebuild-libjdwp-tests.sh Bug: 62821960 Bug: 67958496 Change-Id: I63ef04f71c36c34d8534651d0c075921a836ec08
* Ensure that OSR doesn't break local-variable get/setAlex Light2017-09-271-4/+21
| | | | | | | | | | | | | | | We had a bug where we would on-stack replace a method with a modified local variable. Thanks to inlining & load-store elimination of local variable values this could cause the change to the variable to be lost. We fixed this by giving plugins a way to notify the runtime they are interested in a particular method. Bug: 66959663 Bug: 66933582 Test: while ./test/run-test --host --prebuild -O --jit 1935; do; done Test: ./test.py --host -j50 Change-Id: Ic001b8a9d8d0bd9ce292e807752c86a505f85d36
* Add support for JVMTI monitor events.Alex Light2017-09-141-0/+33
| | | | | | | | | | | | | | | | Adds support for the JVMTI can_generate_monitor_events capability and all associated events. This adds support for the JVMTI_EVENT_MONITOR_WAIT, JVMTI_EVENT_MONITOR_WAITED, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, and JVMTI_EVENT_MONITOR_CONTENDED_ENTERED events. Bug: 65558434 Bug: 62821960 Bug: 34415266 Test: ./test.py --host -j50 Change-Id: I0fe8038e6c4249e77d37a67e5056b5d2a94b6f48
* Implement can_generate_native_method_bind capabilityAlex Light2017-04-191-0/+22
| | | | | | | | | | This capability lets one observe and even replace the implementations of native methods when they are bound. Test: ./test.py --host -j40 Bug: 37432636 Change-Id: I2432a8e4da1a677e8011ce495296f4ab9f42eb3e
* Add ClassPreDefine hook.Alex Light2017-01-231-0/+30
| | | | | | | | | | | This hook is called prior to defining a class for the first time. It allows callbacks to modify the dex-file used to load the class if they wish. The event handler is responsible for ensuring that the returned dex-file is set-up correctly. Bug: 31684920 Test: mma -j40 test-art-host Change-Id: Iaed79c1597913148ead795e033a0a10a4ebe6b2b
* ART: Add runtime phase callbackAndreas Gampe2017-01-191-0/+14
| | | | | | | | | Add callback that describes the current runtime phase, one of starting, initialized and death. Add test. Bug: 31684920 Test: m test-art-host-gtest-runtime_callbacks_test Change-Id: I08ae7c45851572f8b3e446c07f0498f66bb032d3
* ART: Add SigQuit CallbackAndreas Gampe2017-01-191-8/+26
| | | | | | | | Add callback being triggered when the runtime handles SigQuit. Bug: 31684920 Test: m test-art-host-gtest-runtime_callbacks_test Change-Id: I23e3b256c654b6078c79b3897439d893ea79d96e
* ART: Add ClassLoadCallbackAndreas Gampe2017-01-191-0/+24
| | | | | | | | | | Add callback for class-load and class-prepare events. Move Dbg over. Add tests. Bug: 31684920 Test: m test-art-host-gtest-runtime_callbacks_test Test: art/tools/run-jdwp-tests.sh --mode=host Change-Id: I871f6b3c54448fd6ece8d9a7571b2042be50d525
* Revert "Revert "ART: Start RuntimeCallbacks""Andreas Gampe2017-01-191-0/+48
| | | | | | | | | | | This reverts commit bf6331a45f730e1f1044af2ce43bceda660ae6fc. Switch to using the mutator lock. Bug: 31684920 Test: m test-art-host-gtest-runtime_callbacks_test Test: art/tools/run-jdwp-tests.sh --mode=host --debug Change-Id: I6ce0f71de2aa9f90cd23cfca7723a793b560b16b
* Revert "ART: Start RuntimeCallbacks"Nicolas Geoffray2017-01-191-48/+0
| | | | | | | | | | | jdwp tests failing with: STDERR> dalvikvm32 E 01-18 23:14:50 12180 12198 thread-inl.h:137] holding "runtime callbacks lock" at point where thread suspension is expected Bug: 31684920 This reverts commit 13093d455b8266338fd713b04261c58e9dc2b164. Change-Id: I94e4154e273d006eecdd485607dcfd96392d6a00
* ART: Start RuntimeCallbacksAndreas Gampe2017-01-181-0/+48
Add a central RuntimeCallbacks structure to handle certain interesting runtime events. In a first iteration, add ThreadLifecycleCallback with ThreadStart and ThreadStop. Move Dbg over to ThreadLifecycleCallback. Add a test. Bug: 31684920 Test: m test-art-host-gtest-runtime_callbacks_test Test: art/tools/run-jdwp-tests.sh --mode=host Change-Id: Ie0f77739a563207bfb4f04374e72dc6935c40b4f