History log of /art/runtime/jni_env_ext.cc
Revision Date Author Comments
55256cb60e11d4fac71affb4b9760a2931a3598d 22-Dec-2017 Ian Rogers <irogers@google.com> Extensions to check JNI.

Ensure critical lock isn't held when returning from a down-call.
Log a warning if the critical lock is held for a significant period of
time.
Refactor JNIEnvExt to be a class rather than a struct.

Test: mma test-art-host

Change-Id: I4d149cb04d3a7308a22b92b196e51e2f1ae17ede
25651129552c3e9a8c87c68852da43c6069d7a53 25-Sep-2017 Andreas Gampe <agampe@google.com> ART: Refactor IRT:Add

Do not abort on overflow. Return null and an error message. The
caller is responsible for handling this, e.g., by aborting. In a
future CL, this may be used for driving additional GCs.

Additional side effect is the removal of a frame from an abortion
stack trace.

Test: m
Test: m test-art-host
Change-Id: I80b1e0ee396fc69906d051f1b661d7dba222fc6f
b486a98aadc95d80548953410cf23edba62259fa 01-Jun-2017 Andreas Gampe <agampe@google.com> ART: Introduce thread-current-inl.h

Factor out Thread::Current() code into its own -inl file to remove
transitive includes.

This requires at the same time correcting mutex.h, i.e., moving
some functions into mutex-inl.h.

Test: m test-art-host
Change-Id: I88f888b604e0897368d9b483edce6ce4332dd9c9
888310802a72921d5f0aadae501c31215bd5c697 01-Jun-2017 Andreas Gampe <agampe@google.com> ART: Allow unlimited PushLocalFrame

The local reference table is resizable. Allow arbitrary capacity
requests and only fail when the request cannot be satisfied.

Bug: 62223672
Test: m test-art-host
Change-Id: I05183098359c5a33473701e9a0d2a4d6c81bde58
c8089540ccf0f1c43d8db3828f21d489b28a4013 16-Jan-2017 Andreas Gampe <agampe@google.com> ART: Add JNI function table manipulation

Add support for a function table override. This will override the
decision between the regular and the CheckJNI function tables, if
set.

Bug: 34343708
Test: m test-art-host-gtest-jni_internal_test
Change-Id: I0e95b0cbd21f4efdcd8c3d312781d9aeeff54a1e
46ee31b67d7ee1bd085fbc240502053caa3cf8fa 14-Dec-2016 Andreas Gampe <agampe@google.com> ART: Move to libbase StringPrintf

Remove ART's StringPrintf implementation. Fix up clients. Add
missing includes where necessary.

Test: m test-art-host
Change-Id: I564038d5868595ac3bb88d641af1000cea940e5a
9d7ef62b854289632791a83223c1a5a5b3c8fc64 25-Oct-2016 Andreas Gampe <agampe@google.com> ART: Make IndirectReferenceTable resizable

Allow backing table to be resized. This can be used for the local
reference table, where synchronization is not an issue.

Bug: 32125344
Test: m test-art-host
Change-Id: Iae3a933e330026231b17fdde44bcdd99c235dff1
e03662b71bbb4d262af0840bf90ce4fc84750b43 14-Oct-2016 Andreas Gampe <agampe@google.com> ART: Change IndirectReferenceTable

Change cookie structure to allow for more entries. Use a local
hole-count caching scheme. The design is driven by two
considerations. For one, the change is small and mostly local.
The other point is to still allow inlining of functions involved
with JNI transitions.

This change is in preparation for a resizable backing table for
"unlimite" local references.

micro_native tests show changes are in the noise.

Bug: 32125344
Test: m test-art-host
Change-Id: I08ff5d6eaed75d13ec88f469fb0d18328a0eeb70
da0a69edb24122d3d35ce1483c5ab94de919d714 11-Oct-2016 Richard Uhler <ruhler@google.com> Return error message if IndirectReferenceTable construction fails.

Previously if there was an error when constructing the
IndirectReferenceTable, the error message was lost. Now expose and
include the error message when throwing an exception related to
failures to construct the IndirectReferenceTable.

The error message is propagated through JVMEnvExt, JavaVMExt, and
Runtime::Init as well.

Bug: 32013594
Test: Added new 151-OpenFileLimit runtest.
Test: m test-art-host, m test-art-target

Change-Id: I3692f6928c9570358571bce634569d6f14cdeb05
709b070044354d9f47641f273edacaeeb0240ab7 13-Oct-2016 David Sehr <sehr@google.com> Remove mirror:: and ArtMethod deps in utils.{h,cc}

The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance. This episode
finds us removing references to ArtMethod/ArtField/mirror.

One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument. I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful. I have tried to remove as many cases
as possible where it was clear p != nullptr.

Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
a8e3b8622565089ff7eb86363a18214b9b2b7da8 18-Oct-2016 Andreas Gampe <agampe@google.com> ART: Remove IRT cruft

Remove dead code for initial vs maximum table size.

Bug: 32125344
Test: m test-art-host
Change-Id: Ie5806da7f5f3238483da918deca5982f01764466
c4f3925490a73da8dc74884a1deb965d4ecaf14e 06-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move remaining jobject related functions to use ObjPtr

Also added ObjPtr::DownCast.

Bug: 31113334

Test: test-art-host

Change-Id: I59c253211dc435579ffdfd49f856861ab13d262c
bdf7f1c3ab65ccb70f62db5ab31dba060632d458 31-Aug-2016 Andreas Gampe <agampe@google.com> ART: SHARED_REQUIRES to REQUIRES_SHARED

This coincides with the actual attribute name and upstream usage.
Preparation for deferring to libbase.

Test: m
Test: m test-art-host
Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
185d134a3b43ab7529053e965917e0fa74bceba4 11-Aug-2016 Alex Light <allight@google.com> Add basic runtime-plugins support.

This allows one to pass shared-libraries on the command line that the
runtime will load as plugins. They have access to runtime code and can
install hooks to add functionality. Currently the only hook they can
touch is JavaVMExt::AddEnvironmentHook to register a callback for
GetEnv(). More hooks might be added in the future.

Test: ./test/run-test 900
Change-Id: I852b4daf5a3fa71e9888722bc07794632c0e5010
4d87df607a0b86cdf4b2c04f61d72a60d8975ce0 08-Jan-2016 Mathieu Chartier <mathieuc@google.com> Improve handling of daemon threads after runtime shutdown

The main issue comes from the fact that user daemon threads are
allowed to continue running after the runtime has shutdown. They may
still have a JNI env pointer. To prevent crashing if they call into
the env, we replace the function pointers with functions that sleep
forever.

The other issue is that user daemon threads that are blocked in an
ART condition variable may get woken up by another user daemon inside
of Monitor::Notify or by a spurious wakeup (i.e. SIGQUIT). To deal
with this issue, we check the JNI env for shutdown runtime when we
are woken up from a condition variable wait. This check fixes test
132 with --host --gdb --interpreter. Previously this test crashed
since dlclose was somehow causing a spurious futex wakeup.

TODO: Investigate adding a unit test.

Bug: 18577101
Change-Id: I479b38968ee9fbc4ee4b252ee2528787279972cc
4d98c84e6e2a47caf279909edae2b55f9f032288 10-Dec-2015 Andreas Gampe <agampe@google.com> ART: Make trampoline compiler pointer-size-safe

The trampoline compiler uses offsets of runtime structures which
may change with the pointer size.

Add offset tests to jni_internal_test.

Bug: 26071368

(cherry picked from commit da9b763abc712fd6d1e24170a194abfbe795b8cd)

Change-Id: I01d1a3727f46b3015ac677afb5427337c3093402
da9b763abc712fd6d1e24170a194abfbe795b8cd 10-Dec-2015 Andreas Gampe <agampe@google.com> ART: Make trampoline compiler pointer-size-safe

The trampoline compiler uses offsets of runtime structures which
may change with the pointer size.

Add offset tests to jni_internal_test.

Bug: 26071368
Change-Id: I01d1a3727f46b3015ac677afb5427337c3093402
4b8f1ecd3aa5a29ec1463ff88fee9db365f257dc 26-Aug-2015 Roland Levillain <rpl@google.com> Use ATTRIBUTE_UNUSED more.

Use it in lieu of UNUSED(), which had some incorrect uses.

Change-Id: If247dce58b72056f6eea84968e7196f0b5bef4da
5f4a09a54eed55de89e194780214a2acfd2cb431 28-Sep-2015 Andreas Gampe <agampe@google.com> ART: Add CheckJNI lock checking

JNI MonitorEnter and MonitorExit have similar rules to structured
locking. Count locks in CheckJNI mode.

Bug: 23502994
Change-Id: Ie3f53d3aa669a6bd0c7153c50c168116b43764d9
90443477f9a0061581c420775ce3b7eeae7468bc 17-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move to newer clang annotations

Also enable -Wthread-safety-negative.

Changes:
Switch to capabilities and negative capabilities.

Future work:
Use capabilities to implement uninterruptible annotations to work
with AssertNoThreadSuspension.

Bug: 20072211

Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
3f5881fda3606b27e30bf903052c73b03910f90b 08-Apr-2015 Andreas Gampe <agampe@google.com> ART: IRT refactor

IRT creation might fail. Add a path that allows to bypass the aborts
and instead signal validity. Hide this path with a private constructor,
rewrite users to use a static Create method.

Bug: 20110201

Change-Id: I440499c3372cd7557eb970b70ce2c4543da520e4
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
68d8b42ddec39ec0174162d90d4abaa004d1983e 17-Jul-2014 Ian Rogers <irogers@google.com> Wire up check JNI force copy mode.

Increase check JNI checks.
Break apart jni_internal.h in to jni_env_ext.h and java_vm_ext.h.
Fix the abuse of ScopedObjectAccess/annotalysis by ScopedCheck in the case
of VM routines.
Make class loader override and shared library class loader JNI global
references rather than mirror pointers.
Clean-ups to native bridge.

Change-Id: If7c6110b5aade7a402bfb67534af86a7b2cdeb55