summaryrefslogtreecommitdiffstats
path: root/runtime/indirect_reference_table.cc
Commit message (Collapse)AuthorAgeFilesLines
* Don't dump stack when deleting an invalid local refMathieu Chartier2015-07-301-1/+5
| | | | | Bug: 21724724 Change-Id: Ifa99df9ee9f3265038a0c0f7944e834e42c498d4
* Add more info for attempting to delete non-JNI local referenceMathieu Chartier2015-06-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we print the stack trace of the method which tried to remove the non-JNI local reference. Added test, example output: Attempt to remove non-JNI local reference, dumping thread "main" prio=5 tid=1 Runnable | group="main" sCount=0 dsCount=0 obj=0x12c2b400 self=0xf878af28 | sysTid=32662 nice=0 cgrp=default sched=0/0 handle=0xf73df700 | state=R schedstat=( 154297228 636505 121 ) utm=5 stm=10 core=11 HZ=100 | stack=0xff6f2000-0xff6f4000 stackSize=7MB | held mutexes= "mutator lock"(shared held) native: #00 pc 00455a7f /out/host/linux-x86/lib/libartd.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::ArtMethod*, void*)+191) native: #01 pc 00425d79 /out/host/linux-x86/lib/libartd.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+473) native: #02 pc 0028c555 /out/host/linux-x86/lib/libartd.so (art::IndirectReferenceTable::Remove(unsigned int, void*)+421) native: #03 pc 003319c8 /out/host/linux-x86/lib/libartd.so (art::JNI::DeleteLocalRef(_JNIEnv*, _jobject*)+56) native: #04 pc 0012db14 /out/host/linux-x86/lib/libartd.so (art::CheckJNI::DeleteRef(char const*, _JNIEnv*, _jobject*, art::IndirectRefKind)+292) native: #05 pc 00122176 /out/host/linux-x86/lib/libartd.so (art::CheckJNI::DeleteLocalRef(_JNIEnv*, _jobject*)+54) native: #06 pc 00005724 /out/host/linux-x86/lib/libarttest.so (Java_Main_removeLocalObject+36) native: #07 pc 00004d6e /tmp/test-32506/dalvik-cache/x86/tmp@mathieuc@test-32506@004-JniTest.jar@classes.dex (void Main.removeLocalObject(java.lang.Object)+130) at Main.removeLocalObject(Native method) at Main.testRemoveLocalObject(Main.java:118) at Main.main(Main.java:37) Bug: 20683465 Change-Id: I56b99c77ae7020cabf1aaeb1d5317b1d5ba940e5
* Only print IRT remove local warning if CheckJNI is enabledMathieu Chartier2015-04-291-4/+10
| | | | | | | | | | Less spammy. (cherry picked from commit c5adebc9327bd5ca223a5faf99d904cc202a1627) Bug: 17405090 Change-Id: Ib78d0d7bc31a88182cb9d85ddba9b469bd50324b
* Replace NULL with nullptrMathieu Chartier2015-04-221-10/+7
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Fix valgrind testsMathieu Chartier2015-04-141-1/+4
| | | | | | Delete large objects in space destructor. Also some cleanup. Change-Id: I4c4e90149841a156b7a3236201b37683e14890fb
* ART: IRT refactorAndreas Gampe2015-04-091-4/+17
| | | | | | | | | | 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
* Fix CC root visiting bugMathieu Chartier2015-04-071-1/+1
| | | | | | Also some cleanup. Change-Id: Ia3de8f2d409770be3619ec116e8b06ecd82338fe
* Refactor and improve GC root handlingMathieu Chartier2015-04-061-9/+3
| | | | | | | | | | | | | | | | | | | | | | Changed GcRoot to use compressed references. Changed root visiting to use virtual functions instead of function pointers. Changed root visting interface to be an array of roots instead of a single root at a time. Added buffered root marking helper to avoid dispatch overhead. Root marking seems a bit faster on EvaluateAndApplyChanges due to batch marking. Pause times unaffected. Mips64 is untested but might work, maybe. Before: MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us After: MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us Bug: 19264997 Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
* Add support for .bss section in oat files.Vladimir Marko2015-03-021-1/+1
| | | | Change-Id: I779b80b8139d9afdc28373f8c68edff5df7726ce
* Print more info in MarkSweep::VerifyRootMathieu Chartier2015-01-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Refactored old root callback to use a new class called RootInfo. RootInfo contains all the relevant info related to the root associated with the callback. The MarkSweep::VerifyRoot function now uses this info to print the StackVisitor's described location if the GC root is of the type kRootJavaFrame. Some other cleanup. Example output: E/art (12167): Tried to mark 0x123 not contained by any spaces E/art (12167): Attempting see if it's a bad root E/art (12167): Found invalid root: 0x123 with type RootJavaFrame E/art (12167): Location=Visiting method 'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0) vreg=0 (cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a) Bug: 18588862 Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
* Trim reference tables when we trim the heapMathieu Chartier2014-11-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Before: System server: virtual shared shared private private size RSS PSS clean dirty clean dirty # object 2200 300 229 0 80 0 220 77 /dev/ashmem/dalvik-indirect ref table (deleted) Location: 1896 128 102 0 28 0 100 39 /dev/ashmem/dalvik-indirect ref table (deleted) After: virtual shared shared private private size RSS PSS clean dirty clean dirty # object System server: 2216 64 64 0 0 0 64 79 /dev/ashmem/dalvik-indirect ref table (deleted) Location: 2120 48 48 0 0 0 48 67 /dev/ashmem/dalvik-indirect ref table (deleted) No pause time regression measured in memalloc test. (cherry picked from commit 84dc99d2fa67e5dff018685661cb2bff62132989) Change-Id: I80d9bd3b98e888fa8f77d03df69f8479ed209986
* C++11 related clean-up of DISALLOW_..Ian Rogers2014-10-221-5/+5
| | | | | | | | | | | | | | | | | | Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations with no definitions this prompts better warning messages so deal with these by correcting the code. Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object. Make X86 assembly operand types ValueObjects to fix compilation errors. Tidy the use of iostream and ostream. Avoid making cutils a dependency via mutex-inl.h for tests that link against libart. Push tracing dependencies into appropriate files and mutex.cc. x86 32-bit host symbols size is increased for libarttest, avoid copying this in run-test 115 by using symlinks and remove this test's higher than normal ulimit. Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it returns NULL when the heap is under construction by Runtime. Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
* Reduce IndirectReferenceTable memory usageMathieu Chartier2014-09-251-54/+27
| | | | | | | | | | | | | | | | | | Changed the slot side table and the main table to be a single table, reduced number of slots per reference from 4 to 3 to make the IrtEntry a power of 2 size. Before: 20848 kB: Dalvik Other After: 16760 kB: Dalvik Other Bug: 17643507 (cherry picked from commit a1de6b93426cfc66a64eb1b57303348aab5e766d) Change-Id: I362475235a887c60eff6870bb10051a6be3d5814
* Address read barrier issue with cl/106467Hiroshi Yamauchi2014-09-091-4/+11
| | | | | | | And tidy/add a check. Bug: 12687968 Change-Id: If63dc0d9d0a0ce5f2eeb81734ff8f4307865f67d
* Remove abuse of mirror::Object* to reference special values.Ian Rogers2014-09-031-4/+0
| | | | | | | | | | | | | Remove kInvalidIndirectRefObject, kClearedJniWeakGlobal and ObjectRegistry::kInvalidObject. Handle error conditions by passing in or returning an error value. GetObjectRefType is simplified to be faster and not return invalid references that are not expected according to the spec. Adjust check JNI and jni_internal_test appropriately. Fix cases in the debugger/JDWP of out arguments being passed by reference. Bug: 17376993 Change-Id: I3ce8a28c01827e163f4dc288449959464da788b1
* Wire up check JNI force copy mode.Ian Rogers2014-08-081-1/+2
| | | | | | | | | | | | 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
* Add GcRoot to clean up and enforce read barriers.Hiroshi Yamauchi2014-07-291-16/+18
| | | | | | | | | | | | | Introduce a value-type wrapper around Object* for GC roots so that 1) we won't have to directly add the read barrier code in many places and 2) we can avoid accidentally bypassing/missing read barriers on GC roots (the GcRoot interface ensures that the read barrier is executed on a read). The jdwp test passed. Bug: 12687968 Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
* Runtime can now be set to require relocationAlex Light2014-07-221-0/+1
| | | | | | | | | | | | | | Add a pair of runtime flags -Xrelocate and -Xnorelocate that can force the runtime to require that all files that are run are relocated, to prevent attacks based on the known art base address. Add support for running patchoat on oat files compiled without an image. Change run-test to have new --prebuild and --relocate flags. Bug: 15358152 Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
* Add more read barriers for JNI roots.Hiroshi Yamauchi2014-06-201-5/+2
| | | | | | | | | | | | | To make it possible to concurrently scan the JNI global roots (that is, the roots visited by JavaVMExt::VisitRoots()), add read barriers to the indirect reference table and the reference table. Also, add read barriers to the jmethodID/jfieldID decode routines (ScopedObjectAccessAlreadyRunnable::DecodeField/DecodeMethod) so that we can concurrently handle (encoded) fields and methods. Bug: 12687968 Change-Id: I3df4e4e622a572ff0ea8d44b2dc70a4d6b3ba058
* Add read barriers for the class and the intern tables.Hiroshi Yamauchi2014-06-131-1/+1
| | | | | | | | | Add read barriers for the strong roots in the intern table and the (strong) roots in the class table to make possible concurrent scanning of them. Bug: 12687968 Change-Id: If6edc33a37e65a8494e66dc3b144138b1530367f
* Add read barriers for the weak roots in the JNI weak globals.Hiroshi Yamauchi2014-05-291-5/+16
| | | | | Bug: 12687968 Change-Id: Ic265a0e162e8cc9edc4ab7fa34f8afd5ce968d08
* Add Handle/HandleScope and delete SirtRef.Mathieu Chartier2014-05-131-4/+4
| | | | | | | | | | | | | | | | Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
* Add lockless SynchronizedGet for indirect reference table.Mathieu Chartier2014-05-051-100/+19
| | | | | | | | | | Used for decoding global references without holding locks. Results on JniCallback: Before: 615ms (3 samples). After: 585ms (3 samples). Change-Id: Ifcac8d0359cf658d87f695c6eb869d148af002e5
* Remove support for app JNI workarounds.Ian Rogers2014-04-221-11/+2
| | | | Change-Id: I4396df7e93fcace4b5b19c2c387e5c30089182a6
* Fix tests to pass with VerifyObject.Mathieu Chartier2014-03-071-1/+3
| | | | | | | A SIRT ref with a null class was causing object verification problems in space_test. Change-Id: I95cfc3da5e0fec0155387f75612b0a3f26f6d3c9
* Add more VerifyObject calls.Mathieu Chartier2014-03-071-0/+9
| | | | | | | | | | | Added verify object calls to SirtRef, IndirectReferenceTable, ReferenceTable. Removed un-needed verify object in ScopedObjectAccess / DecodeJObject since object sources are handled. Bug: 12934910 Change-Id: I55a46a8ea61fed2a77526eda27fd2cce97a9b125
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-0/+26
| | | | | | | | | | | Fix clang build errors aswell as restructure locking/mutex code for correct thread safety analysis support. Reorder make dependencies so that host builds build first as they should provide better compilation errors than target. Remove host's use of -fno-omit-frame-pointer as it has no value with correct use of CFI, which we should have. Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
* Disable compaction for jni workarounds.Mathieu Chartier2014-03-061-2/+2
| | | | | | | Compaction can't work when jni workarounds is enabled. Also some other refactoring. Change-Id: Ia7b0f2b39c79f5a0a5f50874d823b950ab02a0c3
* Change root visitor to use Object**.Mathieu Chartier2014-02-181-1/+1
| | | | | | | Simplifies code and improves the performance of root visiting since we usually don't need to check to see if the object moved. Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
* Add root types and thread id to root visiting.Mathieu Chartier2014-02-111-2/+3
| | | | | | | Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
* Change IndirectReferenceTable::Add null DCHECK to CHECK.Mathieu Chartier2013-12-191-1/+1
| | | | Change-Id: I7d3582bd5ef75c7fef6a94c0e4f1fea38fc8b526
* Add support for changing roots through the root visitor callback.Mathieu Chartier2013-09-131-7/+9
| | | | | | Needed for copying collectors. Change-Id: Icc4a342a57e0cfb79587edb02ef8c85e08808877
* Fix up TODO: c++0x, update cpplint.Mathieu Chartier2013-08-161-3/+2
| | | | | | | | | | | | Needed to update cpplint to handle const auto. Fixed a few cpplint errors that were being missed before. Replaced most of the TODO c++0x with ranged based loops. Loops which do not have a descriptive container name have a concrete type instead of auto. Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
* Fix NewLocalRef to use AddLocalReference.Elliott Hughes2013-07-291-1/+1
| | | | | Bug: 10026664 Change-Id: I06f8f75a92f73b3b58fa767c0d08d1b736f7d5b5
* Fix cpplint whitespace/comments issuesBrian Carlstrom2013-07-261-1/+1
| | | | Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+330
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81