History log of /art/openjdkjvmti/transform.cc
Revision Date Author Comments
d3782f304acee54273f551c52f547539c8f4a78b 05-Apr-2018 Alex Light <allight@google.com> Prevent deadlock calling transformation functions in ClassLoad callback.

If an agent called RetransformClasses or RedefineClasses from the
ClassLoad event callback and the class that caused the event is
included the thread would deadlock. This happened because the
verification code would try to wait for the class to be linked but
since the current thread is responsible for doing that this will never
happen. To prevent this from happening we make those functions simply
return JVMTI_ERROR_INTERNAL if they are called on the same thread the
class is being loaded on.

In order to test this we needed to modify the test helper code to keep
track of the current jvmtiEventCallbacks state.

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

(cherry picked from commit 9e7859cb2449d6150b97c7d8ff9646a5405737f8)
Merged-In: I0a196b999a08ec3bf9cdf98357e223f89fdcd666
Change-Id: I0a196b999a08ec3bf9cdf98357e223f89fdcd666
12ee56bcddfd36e254aaf855a80e0fae2b91c97a 12-Feb-2018 Alex Light <allight@google.com> Fix incorrect condition in TransformationFaultHandler

We were incorrectly checking if an iterator was
uninitialized_class_definitions_.end() instead of
initialized_class_definitions_.end(). This caused several tests to
fail when run with redefine-stress because they would cause the
faulting code to resume incorrectly.

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

Bug: 73177368

Change-Id: I9ca86aa4e30f342d73545d1a417bab8a0e817251
fe2a39d1a4297b3eb3bbf5d5af3eae8172b8c4db 05-Feb-2018 Alex Light <allight@google.com> Revert "Temporarily disable lazy class-file-load-hook"

An ASAN failure was caused by a rare interaction between the
fault-handler and updating the internal book-keeping for the
ClassFileLoadHook. When we update the current definition for the
ClassFileLoadHook we check to see if the definition has actually
changed. This causes a read from the previous dex-file buffer. If the
buffer is lazy and the agent never accessed it (very rare outside of
testing) the SEGV will occur within art code in the kRunnable state.
This caused the runtime to think the SEGV was coming from java code
and perform some illegal reads prior to figuring out that the SEGV did
not come from java.

To fix this we simply make sure all the code that can cause the SEGV
occurs while the runtime is in kNative state.

We add an assert for this in the fault handler itself.

Reason for revert: Fixed issue causing ASAN failure with lazy dex-file
load hook.

This reverts commit 37977705dc6cfa3e77299ae97675f80b59f2fcf0.


Bug: 72909916
Test: ./test/testrunner/run-_build_test_target.py -j50 art-asan

Change-Id: I8b2d2fda8092a379e0019db15ec360a5a63d8b3f
ca97ada4ec14373242de2452a6d0c16804007d66 02-Feb-2018 Alex Light <allight@google.com> Change ClassFileLoadHook to lazily compute dex file

Creating a dex file from the quickened or compact-dex'd internal
format for calling the JVMTI ClassFileLoadHook is quite expensive.
This meant that agents could not generally listen for this event
without causing unacceptable performance problems.

Since agents will generally not touch the buffer, needing to
instrument only a handful of classes we will fix this problem by doing
the de-quickening lazily. This is done by mmaping an empty buffer with
PROT_NONE and then filling it in when the program has a SEGV in the
appropriate address range. This should improve the performance of any
agent that listens for the ClassFileLoadHook but does not commonly do
anything to the buffer.

This does have the disadvantage that we can no longer ensure that the
buffer size we pass down in class_data_len might no longer be fully
accurate. Some agents that assert that class_data_len is exactly the
same as the dex-file will need to be updated.

Bug: 72402467
Bug: 72064989
Test: ./test.py --host -j50
Test: ./test.py --host --redefine-stress -j50

Change-Id: I39354837f1417ae10a57c5b42cbb4f38f8a563dc
0225f8e2939a9340cb7dcebfcfe7996a2bd9bce9 31-Jan-2018 David Sehr <sehr@google.com> Revert "Revert "Make libdexfile build independent of runtime dir""

This reverts commit 787784f9effb126b5d0d3dc97d544c4a477b5daf.

Reason for revert: Bot configuration issue.

Change-Id: I6a10bb4a9571f89c7e4dd095f9157e830a44e2de
Bug: 22322814
Test: make -j 50 checkbuild
64e4c145e9301615a339a0981b1bc34fbe78c2f9 30-Jan-2018 Alex Light <allight@google.com> Refactor JVMTI ClassFileLoadHook handling

Make initial load ClassFileLoadHook use the same helper structures as
the retransform path. This makes the system simpler and creates a
single point where changes to the ClassFileLoadHook handling can be
done.

Test: ./test.py --host -j50
Test: ./test.py --redefine-stress --host -j50
Bug: 72064989
Change-Id: I7df9fed267fea497d9efd4f4214506237e63339f
787784f9effb126b5d0d3dc97d544c4a477b5daf 30-Jan-2018 David Sehr <sehr@google.com> Revert "Make libdexfile build independent of runtime dir"

This reverts commit b40b7e73469339a6b667b4a2e2b8690112a74dc9.

Reason for revert: on device libdexfile.so missing

Change-Id: I9bd61a98bef870400580e8c991cb061d3f57fa72
b40b7e73469339a6b667b4a2e2b8690112a74dc9 26-Jan-2018 David Sehr <sehr@google.com> Make libdexfile build independent of runtime dir

Remove libdexfile's dependency on utils.cc and move utf.cc into
/dex. Remove libdexfile's constituent sources from libart and
use libdexfile wherever libart is. Also remove some ART-specific
interfaces. Libdexfile's tests remain to be converted, plus
moving the files to a new directory peer to runtime/.

Bug: 22322814
Test: make -j 50 test-art-host
Change-Id: Ifaf695216e4a0e43d3aa377984d933f7a2a243c2
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
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