summaryrefslogtreecommitdiff
path: root/runtime/java_vm_ext.cc
AgeCommit message (Collapse)Author
2018-05-09ART: Move JNI files to runtime/jni/ . Vladimir Marko
Test: Rely on TreeHugger. Change-Id: I9cae11191ef1567ae9453be498882a7767285140
2018-03-23ART: Simplify atomic.h Orion Hodson
Prefer std::atomic operations over wrappers in atomic.h. Exceptions are cases that relate to the Java data memory operations and CAS operations. Bug: 71621075 Test: art/test.py --host -j32 Test: art/test.py --target --64 -j4 Change-Id: I9a157e9dede852c1b2aa67d22e3e604a68a9ef1c
2018-01-05Create dex subdirectory David Sehr
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
2018-01-03ART: Clean up library loading Andreas Gampe
Retrieve the library path from the classloader before attempting to load, instead of getting it passed down. This allows unifying said loading behavior for follow-up changes. Fix up test code to support the new required data in classloader objects. Bug: 70901841 Test: m test-art-host Test: device boots Change-Id: Iaccaeb56422877abac9f7fe6f5a17364c8adf4ca
2018-01-02ART: Refactor Agent into Agent and AgentSpec Andreas Gampe
Separate configuration/loading and runtime state. Test: m test-art-host Change-Id: I69bb91e13ef10b9e1ce313f45b0b809b913d8e10
2017-12-22Extensions to check JNI. Ian Rogers
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
2017-10-25ART: Depend on libnativehelper headers only Andreas Gampe
Depend on header-only versions where possible. Move projects excluding libart to libnativehelper_header_only. Bug: 65522645 Test: mmma art Change-Id: I53dd3b2a97e94ee685f72de007ed3858f7f5c6b6
2017-10-11ART: Fix allocation tracking Andreas Gampe
Follow-up to commit 1b35b469e0e8a70d9fd3f6c22d7e828b044c0df8. Bug: 67044702 Test: m test-art-host Change-Id: Ie1149c9070ba9dbf07988d4634f20012318704f0
2017-10-04ART: Add allocation tracking to JNI global refs Andreas Gampe
Add allocation tracking to global references. When the reference table's free capacity falls under an adjustable value, enable tracking so as to help tracking down possibly-leaky allocations. Bug: 67044702 Test: m test-art-host Change-Id: Ic17d6ebbad895b54c5ac63558027e04aef2b14c1
2017-09-25ART: Refactor IRT:Add Andreas Gampe
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
2017-09-19ART: Improve double-JNI-load exception message Andreas Gampe
Try to print the involved classloaders. The code is suboptimal and will not cache any intermediates, as this is an unexpected failure - but aids in debugging application issues. Add a test for the behavior of duplicate library loading in separate classloaders. For ART, add a rough test for the pattern of the error message. Bug: 65574359 Test: m test-art-host Test: art/test/testrunner/testrunner.py -b --host -t 004-JniTest Change-Id: I6c6c7726a79172f39153d4a458eba4fb3e8e85b0
2017-09-19ART: Fix incorrect logging Andreas Gampe
Print the string, not the pointer. Bug: 65574359 Test: m test-art-host Test: manual Change-Id: I6031de8b74359844584f8ca90ad91be665148f7a
2017-07-18art: use proper nativehelper headers Steven Moreland
libnativeheader exports headers under nativeheader. These were available before incorrectly as global headers in order to give access to jni.h. Test: modules using art find headers Bug: 63762847 Change-Id: I5c820d677e94e07b2859e78610bc997fe51b41dc
2017-06-05ART: Remove old object_callbacks.h includes Andreas Gampe
Remove unused includes. Test: m Change-Id: I70c227d32c6900904e186b975d1f2131b718d93d
2017-06-02Avoid holding mutator lock while calling dlsym Mathieu Chartier
Paranoid that dlsym might not always terminate quickly. The fix is to go to suspended before calling FindNativeMethodInternal. Bug: 62235781 Test: test-art-host Change-Id: I4323b580ffb582521ce94d8c90476e6db12bfe4a
2017-06-02ART: Introduce thread-current-inl.h Andreas Gampe
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
2017-05-30ART: Clean up heap headers Andreas Gampe
Use more forward declarations for accounting structures and spaces. Factor out structs to reduce header surface. Remove heap include where unnecessary. Fix up transitive users. Move some debug-only code out of line. Test: m test-art-host Change-Id: I16db4aaa803f39e155ce6e1b0778b7e393dcbb17
2017-04-21ART: Clean up art_method.h Andreas Gampe
Clean up the header. Fix up other headers including the -inl file, in an effort to prune the include graph. Fix broken transitive includes by making includes explicit. Introduce new -inl files for method handles and reference visiting. Test: source build/envsetup.sh && lunch aosp_angler-userdebug && mmma art Test: source build/envsetup.sh && lunch aosp_mips64-userdebug && mmma art Change-Id: I8f60f1160c2a702fdf3598149dae38f6fa6bc851
2017-04-20Agent libraries need to be searched for JNI functions Alex Light
This makes agent libraries the option of last resort for native method implementations. This will allow one to not need to manually link all native methods in an agent library. Bug: 37522517 Bug: 37432636 Test: ./test.py --host -j40 Change-Id: I5ad78a15e7e2799d2a877c5d603342899e2a1bd1
2017-04-10Revert "Avoid JNI usage error when JNI_OnLoad throws" Igor Murashkin
This reverts commit d111f90a386f7bad1474189390fce7a8d1ff1ab5. Change-Id: Ia8461946088644e41e0f2e14d7e806a70dec41ab
2017-04-07Avoid JNI usage error when JNI_OnLoad throws Daniel Colascione
Test: included Change-Id: I534de714fad2cfb9b53d66da11ade0e5142cb819
2017-03-23Revert^2: "Make sigchain actually own the signal chain."" Josh Gao
This reverts commit 33dca562d5ed9f52f63ced2334c066333ca073e9. Bug: http://b/36205469 Bug: http://b/36262089 Original-Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111 Change-Id: I1267be72c32ed73d1079a572d0b8907556526dde
2017-03-18Revert "Make sigchain actually own the signal chain." Jin Qian
This reverts commit 7600fa9234e02cf5108a3a82babf3d3ab82fcddd. Change-Id: Ia46db2a7df0c0ac07107a8db06f42ff1afd4a97e
2017-03-17Make sigchain actually own the signal chain. Josh Gao
sigchain exists to make sure that art's signal handler is at the front, but it currently does this by putting the fault manager in the actual signal handler slot and having that handler call into sigchain when it doesn't want to handle a signal. sigchain also has a "special signal handler" (used for native bridge) that runs before user handlers, but after ART's. Move maintenance of the signal chain into sigchain itself, and use the same mechanism to handle the ART handler and the native bridge handler. Also, clean up some bugs: - InvokeUserSignalHandler was using the wrapper sigprocmask instead of the actual one. - Use SIG_SETMASK instead of SIG_BLOCK between calling handlers, in case one of the handlers changes the signal mask. - Correctly handle sigaction without SA_SIGINFO. Bug: http://b/36205469 Bug: http://b/36262089 Test: NPE with dalvikvm with/without TEST_NESTED_SIGNAL defined (arm/aarch64) Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111
2017-02-10Fix the empty checkpoint timeout. Hiroshi Yamauchi
The problem happens when a thread is indirectly blocked on a mutex that another thread holds and is blocked on a weak ref access. Add a way to do a dummy wakeup on a thread that's blocked on a mutex so that the thread will respond to the empty checkpoint request. Do this for the mutexes that are expected to be held when a weak ref is accessed. Add a check that detects an unexpected case. Bug: 33006388 Bug: 12687968 Test: test-art-host. Change-Id: Iefec69b9a21aa25a928cb31fcf4fb872f867a8c2
2017-01-06Don't need to block in AddWeakGlobalRef and MonitorList::Add under CC. Hiroshi Yamauchi
CMS needs this to block because an object allocated during the GC won't be marked and concurrent reference processing would incorrectly clear the JNI weak ref or the monitor list weak. But CC doesn't because of the to-space invariant, that is, when a mutator tries to create a JNI weak ref or a monitor for an object, it must be already marked and the concurrent reference processing wouldn't incorrectly clear it. Bug: 34128900 Bug: 12687968 Test: test-art-host with CC. Change-Id: Ia87bf8ed9e604900df5ecb450c89b0ac222bef32
2016-12-15ART: Move to libbase StringPrintf Andreas Gampe
Remove ART's StringPrintf implementation. Fix up clients. Add missing includes where necessary. Test: m test-art-host Change-Id: I564038d5868595ac3bb88d641af1000cea940e5a
2016-11-09Make empty checkpoint work while weak ref access is disabled. Hiroshi Yamauchi
Fix a potential race on PushOntoMarkStack for CC by running an empty checkpoint (while weak ref access is disabled). Bug: 32508093 Bug: 12687968 Test: test-art-host with CC/CMS, libartd boot with N9, Ritz EAAC. Change-Id: I3749bb525e7734804307ee16262355f3fc730312
2016-10-26Merge "Always call into native loader when loading a native library" Dimitry Ivanov
2016-10-24ART: Make IndirectReferenceTable resizable Andreas Gampe
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
2016-10-24ART: Change IndirectReferenceTable Andreas Gampe
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
2016-10-24ART: Clean up IndirectReferenceTable Andreas Gampe
Introduce constants and move some functions into the IndirectReferenceTable class. Slightly change IndirectRef encoding to be more obvious (and slighly more optimized when decoding). Bug: 32125344 Test: m test-art-host Change-Id: I05819eccb733b611de582fb8d7151f1a110c305a
2016-10-24Always call into native loader when loading a native library Zhenhua WANG
Namespace semantic has been enabled at native bridge side. And, native loader wraps both dynamic linker and native bridge. ART on longer calls native bridge directly when it loads a native library, but still remembers whether native bridge is needed for each library. Bug: http://b/28242460 Test: make -j4 test-art-target && make -j32 test-art-host Change-Id: I5eae4b7d492d9a476343301506d7028ed2a18e90 Signed-off-by: Zhenhua WANG <zhenhua.wang@intel.com>
2016-10-20Merge "Return error message if IndirectReferenceTable construction fails." Treehugger Robot
2016-10-19Merge "Remove mirror:: and ArtMethod deps in utils.{h,cc}" David Sehr
2016-10-19Return error message if IndirectReferenceTable construction fails. Richard Uhler
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
2016-10-18Remove mirror:: and ArtMethod deps in utils.{h,cc} David Sehr
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
2016-10-17ART: Remove IRT cruft Andreas Gampe
Remove dead code for initial vs maximum table size. Bug: 32125344 Test: m test-art-host Change-Id: Ie5806da7f5f3238483da918deca5982f01764466
2016-10-14ART: Make JNI global and weak global locks global Andreas Gampe
Add them to Locks. Give the JNI global table lock a lock level, close to the weak global JNI references. Bug: 31684578 Test: m test-art-host Change-Id: I3857a3b0be69b16811d9999096b2c42e7a25d227
2016-10-06Move remaining jobject related functions to use ObjPtr Mathieu Chartier
Also added ObjPtr::DownCast. Bug: 31113334 Test: test-art-host Change-Id: I59c253211dc435579ffdfd49f856861ab13d262c
2016-10-05ObjPtr misc cleanup Mathieu Chartier
Check for subtypes in constructor. Remove various calls to MakeObjPtr and ObjPtr::Ptr. Bug: 31113334 Test: test-art-host Change-Id: I8d680d514ea52cd64fc4f7c2e988926bc726174e
2016-10-05Change indirect reference table to use ObjPtr Mathieu Chartier
Bug: 31113334 Test: test-art-host Change-Id: I340fdf430897ebd790ea4e35f94bcee776e98445
2016-10-04Rename ObjPtr::Decode to ObjPtr::Ptr Mathieu Chartier
Done to prevent ambiguity with ScopedObjectAccess::Decode. Bug: 31113334 Test: test-art-host Change-Id: I07a2497cc9cf66386311798933547471987fc316
2016-09-29Clean up ScopedThreadStateChange to use ObjPtr Mathieu Chartier
Also fixed inclusion of -inl.h files in .h files by adding scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h Changed AddLocalReference / Decode to use ObjPtr. Changed libartbenchmark to be debug to avoid linkage errors. Bug: 31113334 Test: test-art-host Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
2016-08-30ART: SHARED_REQUIRES to REQUIRES_SHARED Andreas Gampe
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
2016-08-11Add basic runtime-plugins support. Alex Light
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
2016-06-20ART: Use null for the BootClassLoader in LoadLibrary Andreas Gampe
We must translate the fake BootClassLoader object to the internally used null when loading libraries. Bug: 29449194 Test: test-art-host (cherry picked from commit f7e0db0ce1170b88043f7eb6afcc93c861c4611d) Change-Id: I823d34e209149b5b96529a423c60a1d77bf8e9d1
2016-06-13Revert "Revert "Revert "Revert "Revert "Revert some flaky unloading""""" Alex Light
With go/aog/238641 this should pass on the buildbots again. Bug: 28406866 This reverts commit 7dbf20abe99eb6c1d9c137e592c2025af725fa06. Change-Id: I1038fe454491488fd561f5fce2e51a27487dce20
2016-06-08Revert "Revert "Revert "Revert "Revert some flaky unloading"""" Alex Light
Fugu is still unhappy Bug: 28406866 This reverts commit 340f486aa0126facb67494449b5c2ee46a1a75e6. Change-Id: I45fc77f924d991669d27b99c1458b2def8692664
2016-06-08Revert "Revert "Revert "Revert some flaky unloading""" Alex Light
Ensure that all threads are in the JNI code before destroying the runtime. Bug: 28406866 This reverts commit b2716bbf321293ddbd0b96f0ea999794b0e9b09b. Change-Id: I7f6189a9d0d8a1bf7af5535026804bc2183466c9