History log of /art/openjdkjvmti/events.cc
Revision Date Author Comments
ac5fea049d898713bb5802141af2ee3d59ee592d 23-Mar-2018 Alex Light <allight@google.com> Remove unneeded ScopedGCCriticalSections from openjdkjvmti.

We used ScopedGCCriticalSections in many parts of the openjdkjvmti
often unnecessarily.

We removed a totally unneeded GCCriticalSection that was acquired when
modifying the instrumentation listeners.

We also removed RequestGCSafeSynchronousCheckpoint and the change to
use GcRoots instead. We added RequestGCSafeSynchronousCheckpoint as a
way to prevent the GC from running when we are doing some JVMTI
operations on other threads. This could interact with running GCs in
non-trivial ways, potentially causing deadlocks in some situations.
This changes the code to instead use read-barriers and GcRoots to
ensure that we do not read data from the wrong gc space.

In order for this to work correctly we need to make sure that we are
only ever reading the GcRoots from the thread that eventually needs
the reference. This required some re-writing of the checkpoint
closures since they would often just call AddLocalReference on
non-local Thread objects.

Changes to Thread::RequestSynchronousCheckpoint and art::Barrier were
needed in order to allow this all to work since we needed to ensure
that the requesting thread did not suspend as the checkpoint was being
run.

This is a partial revert of commit 7585b91bfc77b8.

Bug: 67838964
Bug: 76003243

Test: use gapid
Test: ./test.py --host -j50
Test: ./art/tools/run-libjdwp-tests.sh --mode=host

Merged-In: I26d871089829639eccb973cecc315194f7bcf681
Change-Id: I26d871089829639eccb973cecc315194f7bcf681
(cherry picked from commit 318afe6c3ac1e734adbd769bbf22b8c7e373e80b)
0e84118e875038ee5e90571489abcde86da3db81 12-Feb-2018 Alex Light <allight@google.com> Revert^6 "Prevent UAF issues caused by static destructors"

This reverts commit 4798222e3b3c22435d0a8d915d272fe67c80bd01.

Reason for revert: Fixed issue in underlying change.

Bug: 69591477
Test: ./test.py --host -j50
Change-Id: I31f0ba00ade607f388e248f287801ff878c7296f
4798222e3b3c22435d0a8d915d272fe67c80bd01 12-Feb-2018 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert^4 "Prevent UAF issues caused by static destructors""

run-test changes cause issues.

Bug: 69591477

This reverts commit e9dc52492979364748e0c39682c0b2e9728ee50c.

Change-Id: I1ee05747cdc9292c6e1ce9f3ed8fc31a3d3fd6b8
e9dc52492979364748e0c39682c0b2e9728ee50c 09-Feb-2018 Alex Light <allight@google.com> Revert^4 "Prevent UAF issues caused by static destructors"

The test 1944 was not very robust and could spuriously fail for
several reasons. Most notably it did not actually check that the exit
value was what we expected and it could cause linker warning messages
to be printed. The first we solved by checking for the exit value
directly. The second cannot be simply solved so we simply filter these
messages out.

This reverts commit 70f4415d0485f67922323557f2657b009f20696d.

Reason for revert: Made test more robust.

Test: ./test.py --host -j50
Bug: 69591477
Change-Id: I8580973e16d63583e0cb80825892b4604c2591b6
70f4415d0485f67922323557f2657b009f20696d 08-Feb-2018 Orion Hodson <oth@google.com> Revert "Revert "Revert "Prevent UAF issues caused by static destructors"""

This reverts commit 6280f87f24c420676bff3fcd3a9698246df366b9.

Reason for revert: test failures

https://build.chromium.org/p/client.art/builders/angler-armv8-ndebug/builds/2415/steps/test%20optimizing/logs/stdio

Change-Id: I857562ae54340956fe83f68ee995b49e1d8416e3
6280f87f24c420676bff3fcd3a9698246df366b9 07-Feb-2018 Alex Light <allight@google.com> Revert "Revert "Prevent UAF issues caused by static destructors""

We were not initializing the frame_pop_enabled field of EventHandler
so it was undefined. If it happened to be true then the FramePop
handlers will never be installed and the FramePop events will never be
triggered.

This reverts commit 6a94cec7343bf006234b62525398c83bb55858eb.

Reason for revert: fixed issue with frame pop

Test: ./test/testrunner/testrunner.py -a --host -t 923
Bug: 69591477

Change-Id: Id47f91a76b6e7c9326e94d7cbdf8c5472bffb58a
2a96fe8541b7179e923b6edd27dfe1b8ceb6988e 23-Jan-2018 Alex Light <allight@google.com> Change envs_lock_ to a ReaderWriterMutex

We were getting a lot of contention on this mutex because it needs to
be held to run through the list of all active environments. Since this
list is only rarely modified we change the lock to a ReaderWriterMutex
and only lock it exclusive when we need to modify it.

Test: Examine systrace of startup with DDMS monitor running.
Bug: 72336488
Change-Id: Ie161b0f9c624384fcf36272c6edb78c4a7164149
9e734c7ab4599d7747a05db0dc73c7b668cb6683 05-Jan-2018 David Sehr <sehr@google.com> Create dex subdirectory

Move all the DexFile related source to a common subdirectory dex/ of
runtime.

Bug: 71361973
Test: make -j 50 test-art-host
Change-Id: I59e984ed660b93e0776556308be3d653722f5223
57943810cfc789da890d73621741729da5feaaf8 07-Dec-2017 Andreas Gampe <agampe@google.com> ART: Replace base/logging with android-base/logging

Replace wherever possible. ART's base/logging is now mainly VLOG
and initialization code that is unnecessary to pull in and makes
changes to verbose logging more painful than they have to be.

Test: m test-art-host
Change-Id: I3e3a4672ba5b621e57590a526c7d1c8b749e4f6e
74c84408ad56606514304c9ecc643bebbf11d73e 30-Nov-2017 Alex Light <allight@google.com> Ensure that updates to the global event mask are atomic

We were setting and testing the global event mask in a way that
allowed races with other threads. This could cause issues if multiple
threads write to the mask at the same time and could cause changes to
the current event state to be missed.

Test: ./test.py --host -j50
Bug: 69657830
Change-Id: I5e2759af598e6179fd25fcbe6b211a9369217156
f6df1b5bf2fe2c0aa330df98326a6f360edadba6 29-Nov-2017 Alex Light <allight@google.com> Ensure single-step always causes global deopt

We were incorrectly failing to globally deopt when the single-step
event is enabled if we have an active Breakpoint event at the same
time. This could cause single-step events to be missed in some
circumstances.

This is likely the cause of some rare flakes in the jdwp tests.

Bug: 69241796
Bug: 69243589

Test: ./test.py --host -j50
Test: ./test/run-test --host \
--with-agent \
'libbreakpointlogger.so=LMain;->main([Ljava/lang/String;)V@0' \
997-single-step

Change-Id: I24750625f0a22e61342b336935e32b0d18e9e4d6
b284f8d775ac32d8109744d94b99da451570beef 21-Nov-2017 Alex Light <allight@google.com> Revert "Revert "Make JVMTI DisposeEnvironment and GetEnv thread safe.""

This reverts commit af9341087aab0146b8323ece156bde8130948465.

We needed to allow TopLockLevel locks to be acquired when the
mutator_lock_ is exclusive held. This is required for spec
conformance. To ensure there are no deadlocks the mutator_lock_ is the
only lock level with this exception and one cannot acquire the
mutator_lock_ when one holds any kTopLockLevel locks.

Reason for revert: Fixed issue causing test 913 failure in art-gc-gss-tlab
Test: ART_DEFAULT_GC_TYPE=GSS \
ART_USE_TLAB=true \
ART_USE_READ_BARRIER=false
./test.py --host -j50
Bug: 69465262

Change-Id: Ic1a4d9bb3ff64382ba7ae22ba27a4f44628ed095
af9341087aab0146b8323ece156bde8130948465 21-Nov-2017 Alex Light <allight@google.com> Revert "Make JVMTI DisposeEnvironment and GetEnv thread safe."

This reverts commit e5a2ae30bdbe379695dc886861b23dce57de0825.

Reason for revert: fails art-gc-gss-tlab column.
Test: None
Bug: 69465262

Change-Id: I70af77297bc7870d281ed8ffb319d144ddb12838
e5a2ae30bdbe379695dc886861b23dce57de0825 18-Nov-2017 Alex Light <allight@google.com> Make JVMTI DisposeEnvironment and GetEnv thread safe.

Previously we were relying on the mutator lock to keep these safe but
it turns out this was not sufficient. We give the list of active
jvmtiEnv's it's own lock to synchronize access.

We also changed it so that during events we would collect all the
environments and callbacks prior to actually calling any of them.
This is required for making sure that we don't hold locks across user
code or potentially miss any environments. This does have implications
for when one is last able to prevent an environment from getting an
event but since the spec is vague about this anyway this is not an
issue. Doing this required a major re-write of our event-dispatch
system.

Test: ./test.py --host -j50
Test: ./art/tools/run-libjdwp-tests.sh --mode=host
Bug: 69465262

Change-Id: I170950db6c6e43b5f3c8bdca1b8d087937070496
8c2b929696cac235e8fd8bf4cae0ca751603b570 09-Nov-2017 Alex Light <allight@google.com> Add JVMTI DDMS extension method and event.

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
0fa1786bdcc333873ed65a1f77a4669d5701ac5e 24-Oct-2017 Alex Light <allight@google.com> Avoid JVMTI global deoptimization when possible

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
373a9b5c718a45ac484afcf4fe6ce84f4bb562b3 18-Oct-2017 Andreas Gampe <agampe@google.com> ART: Depend on libnativehelper headers only

Depend on header-only versions where possible. Move projects
excluding libart to libnativehelper_header_only.

Bug: 65522645
Test: mmma art
Change-Id: I53dd3b2a97e94ee685f72de007ed3858f7f5c6b6
a567deb94cc1cddcd550da327eff2072e89f1939 11-Oct-2017 Alex Light <allight@google.com> Check that classes are loaded before updating entrypoints.

We were trying to update the entrypoints of methods taken from classes
that were not yet loaded. This means we were racing the class-loading
and were sometimes reading methods that had not been fully initialized
yet.

Test: stress --cpu 60
Test: while ./test/run-test --host --jit 1916; do ; done
Bug: 66933582
Change-Id: Ib2aea9c9865f838af525366efa88adecc1744865
9df79b72d1f5fb7fd731761c744eb119d02b45ee 12-Sep-2017 Alex Light <allight@google.com> Cleanup and consolidate JVMTI event code.

Various cleanups around JVMTI event code.

Ensure that we always store and restore exceptions.

Ensure we always give agents a local frame.

Ensure that we have static_asserts to verify that we are calling
events with appropriate types.

Various other improvements.

Test: ./test.py --host -j50

Change-Id: I71937d1575efca5096c9d5218203dc8201e3bb79
e2abbc604ce003c776c00ecf1293796bb4c4ac5a 15-Sep-2017 Andreas Gampe <agampe@google.com> ART: Move kDexNoIndex to dex_file_types.h

Define the constant with the types to allow lowering the dependency
on DexFile.

Test: m
Change-Id: I3c61421db45be96d2057e01b1a7825883d8bd178
77fee87b262e969b29a9ac121a8bcbf87b68d9ce 05-Sep-2017 Alex Light <allight@google.com> Add support for JVMTI monitor events.

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
0a5ec3dde72d93111a1cfe229e4f1888f06a9541 26-Jul-2017 Alex Light <allight@google.com> Don't deoptimize everything with can_access_local_variables

Change the can_access_local_variables setup to not need to deoptimize
everything immediately. Instead ensure all methods are
async-deoptimizable and deoptimize the thread we are examining prior
to examining the stack.

Test: ./test.py --host -j50
Bug: 33616143
Bug: 34414073
Change-Id: I312a4865c09e63a8d3fe3b2d201f1c071fb4305f
9fb1ab1f6bb58bdaccef78bc81b3202d0121e2ed 05-Sep-2017 Alex Light <allight@google.com> Revert "Revert "JVMTI Exception and ExceptionCatch events""

Fixed error where we were incorrectly not updating a ShadowFrame
dex_pc causing deoptimization errors.

Bug: 62821960
Bug: 65049545

Test: ./test.py --host -j50
Test: ./art/tools/run-libcore-tests.sh \
--mode=host --variant-X32 --debug

This reverts commit 959742483885779f106e000df6dd422fc8657931.

Change-Id: I91ab2bc3e645ddf0359c189b19a59a3ecf0d8921
959742483885779f106e000df6dd422fc8657931 04-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "JVMTI Exception and ExceptionCatch events"

Breaks tests.

Bug: 62821960
Bug: 65049545

This reverts commit 798eab03120f6189e8f6aa804d67af1b1d9f00b0.

Change-Id: Ie96903df06bbbe41f288f5b75a5114b142998fac
798eab03120f6189e8f6aa804d67af1b1d9f00b0 23-Aug-2017 Alex Light <allight@google.com> JVMTI Exception and ExceptionCatch events

Add support for the JVMTI can_generate_exception_events capability.
This includes the Exception and ExceptionCatch events and all their
associated behaviors.

Test: ./test.py --host -j50
Bug: 62821960
Bug: 65049545

Change-Id: I21cc8522c01033cdeb47bf34fa433bf04bf7ca5c
e814f9d09c0fb1b678e610780d11ce3577db3599 01-Aug-2017 Alex Light <allight@google.com> JVMTI NotifyFramePop support

Adds support for the JVMTI can_generate_frame_pop_events capability.
This includes the NotifyFramePop function and the FramePop event.

We mark the interpreter shadowframes directly to get the events. This
relies on the fact that we never replace extant shadow-frames on the
interpreter stack to ensure that we can distinguish which jvmti-envs
requested the frame pops.

Test: ./test.py --host -j50
Bug: 34414072
Bug: 62821960
Bug: 65129403

Change-Id: I6e79e39f62fdf79268540c5c1be6311df704cff7
6e1607e247d979a1671a1fd5a98de3f1031fe719 23-Aug-2017 Alex Light <allight@google.com> Rename instrumentation ExceptionCaught to ExceptionThrown

The instrumentation ExceptionCaught event was badly named since it is
actually sent at the time the exception is thrown and is sent even if
the exception is never actually caught. Rename it and associated
methods/fields to ExceptionThrown to more accurately reflect the
event's semantics.

Test: ./test.py --host -j50
Change-Id: I1e9c401ab619259b25928dbf19f62d3fa9573d47
06c42a571358b5e5adb69104b183af8f32f4c07d 26-Jul-2017 Andreas Gampe <agampe@google.com> ART: Move openjdkjvmti to art/

Move libopenjdkjvmti out of the runtime directory. Let's not
pollute the runtime library.

Test: m test-art-host
Change-Id: Idb6b9cebcd61777bd3200437a2ae584a63a4a341