summaryrefslogtreecommitdiff
path: root/runtime/native/dalvik_system_VMStack.cc
AgeCommit message (Collapse)Author
2021-09-04Improve suspension timeout diagnostic and fix raceHans Boehm
Fix a data race on state_and_flags. Since the access was volatile and there are system calls in the loop, this is extremely unlikey to have casused the bug here, but ... So, assuming this is still broken, produce more informative output once we time out. Remove unused argument from SuspendThreadByPeer(). It made the logic more complicated and made it harder to reason about correctness. Remove dead code after LOG(FATAL, ...) Bug: 181778559 Test: TreeHugger, temporarily paste log message into hotter path. Merged-In: I6f3455925b3a3f4726a870150aeb54ea60a38d67 (cherry picked from commit 9d27fbc8ced914f4726187920a7794b07eca3e71) Change-Id: Ia3f04153fb0a4f1b899fb0f68a6121728f89cb91 (cherry picked from commit 116203735734738cbfdffc2163b08b1707089f9c)
2020-05-05Clean up internal stack trace construction.Vladimir Marko
Simplify the code by ignoring active transactions. Writing to fields of a newly allocated object does not need to be recorded as aborting the transaction removes all references to the new object and it's unnecessary to roll back writes to unreachable object's fields. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Change-Id: Ia91d3274398b0ca0f5b0040dcf323921d915b657
2018-10-23ART: Refactor for bugprone-argument-commentAndreas Gampe
Handles runtime. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: Ibc0d5086809d647f0ce4df5452eb84442d27ecf0
2018-09-07ART: Continue adding override annotationsAndreas Gampe
Use Clang-tidy's modernize-use-override to add more annotations. Ignore inferred annotations on destructors. Bug: 32619234 Test: mmma art Change-Id: Ic432c928e398d44df9171e42db04ee19946e6887
2018-05-09ART: Move JNI files to runtime/jni/ .Vladimir Marko
Test: Rely on TreeHugger. Change-Id: I9cae11191ef1567ae9453be498882a7767285140
2018-01-08ART: Add support for VMStack.getAnnotatedStackTraceAndreas Gampe
Add Thread.CreateAnnotatedStackTrace to return an array that contains an AnnotatedStackTraceElement for each stack frame, with the StackTraceElement describing the frame, an array containing all objects that are locked at the described location, and optionally for the top frame an object the thread is blocked on, waiting for or sleeping on. Add a test. Bug: 70538431 Test: m test-art-host Test: art/test/testrunner/testrunner.py -b --host -t 168 Change-Id: I0d92e3d8182c4a592549a6445854816f71afd29e
2017-12-27ART: Refactor VMStack codeAndreas Gampe
Make GetThreadStack generic wrt/ a function being called to generate the stack. In preparation for new code. Bug: 70538431 Test: m test-art-host Change-Id: I7e2b6583b28ad89bc645acdc9549f2f0a25ea055
2017-07-24ART: Include cleanupAndreas Gampe
Let clang-format reorder the header includes. Derived with: * .clang-format: BasedOnStyle: Google IncludeIsMainRegex: '(_test|-inl)?$' * Steps: find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup' git-clang-format -style=file HEAD^ manual inspection git commit -a --amend Test: mmma art Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
2017-07-13Add Jvmti Suspend/ResumeThread functionsAlex Light
Enable the can_suspend jvmti capability and implement all required functionality associated with it. Test: ./test.py --host -j40 Bug: 34415266 Bug: 62821960 Bug: 63579748 Change-Id: I83b92de7f81622e1658114b034918e8295805b6e
2017-06-30Add SuspendReason enum and change Suspension functions.Alex Light
More self-documenting and more type safe. Bug: 62821960 Test: ./test.py Change-Id: Ic7a1ae6a25e687d65f5aa10c1aad54a7b80dd086
2017-06-01ART: Move RegisterNatives helperAndreas Gampe
Move the helper closer to the users. Test: m test-art-host Change-Id: Id05ce5f60af54d0c5aef0c7d8932706c4602fc94
2017-05-30ART: More header cleanup - jni_internal.hAndreas Gampe
Move jni_macros.h to the clients (users of RegisterNativeMethods). Test: mmma art Change-Id: I052ac9f703ec69f0a2df1efcaf9f4a450eb7be1c
2017-02-21jni: Switch to @FastNative for all JNI functions. Deprecate !bang JNI.Igor Murashkin
Switches all (248) methods that previously used !bang JNI in art/libcore to all use @FastNative. Also deprecate !bang JNI since nothing in Android seems to (or should be) using it anymore. This measures to be a 3% startup time improvement in system_server. Test: make test-art-host Bug: 34955272 Change-Id: I0881f401c7660c79f275235362777bfa58241deb
2017-02-14Add a DCHECK in thread::GetPeer.Nicolas Geoffray
Motivated by https://android-review.googlesource.com/#/c/333205/. Test: test-art-host run-jdwp-test.sh Change-Id: I173c060324aa0dc39144db55e3a97e672c012ba8
2017-01-12Avoid suspending heap task thread for getting stack tracesMathieu Chartier
Instead of suspending the heap task thread, GetThreadStack (called by VMStack_fillStackTraceElements and VMStack_getThreadStackTrace) will return an empty thread stack. This fixes possible deadlocks caused by suspending the GC thread and doing allocations for the stack trace. Bug: 28261069 Test: test-art-host Change-Id: I45a0b8ac94a99d6bbcfcdc2b41afadf941ec0138
2016-10-17Move art/native to ObjPtrMathieu Chartier
Bug: 31113334 Test: test-art-host Change-Id: I67eb89cf042c762c6dcd5eb8b008b9a28e9b3319
2016-09-29Clean up ScopedThreadStateChange to use ObjPtrMathieu 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_SHAREDAndreas 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
2015-09-11Add and use ScopedSuspendAllMathieu Chartier
Usage replaces most SuspendAll and ResumeAll calls. Change-Id: I355683a5365876242cea85a656dcb58455f7a294
2015-09-03Add ScopedThreadSuspensionMathieu Chartier
Fixes the TransitionFromRunnableToSuspended and TransitionFromSuspendedToRunnable pattern that was prone to errors. Change-Id: Ie6ae9c0357c83b4fc4899d05dfa0975553170267
2015-07-22Move to newer clang annotationsMathieu Chartier
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
2015-05-29Move mirror::ArtMethod to nativeMathieu Chartier
Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
2015-05-11Add a flag to StackVisitor for inlining.Nicolas Geoffray
The flag tells whether the stack walk needs to include inlined Java frames. This does not do anything just yet, as we're not inlining anyways. Change-Id: I716e25094fe56fa335ca1f9a398c1bcdba478e73
2015-04-21Class.forName(..., ..., null) fixesBrian Carlstrom
- Add test for Class.forName(..., ..., null) - Simplify VMStack.getClosestUserClassLoader based on new behavior of Class.forName(..., ..., null) Change-Id: I6bc470e20fa177e8a3debe55c90a84eef7ef518e
2014-11-12Modify the behavior of thread suspend shootouts.Ian Rogers
The thread doing the suspension doesn't attempt to suspend the other thread unless it knows another thread isn't trying to suspend it. Use the suspend count, and its lock, for this purpose. Re-enable ThreadStress test. Bug: 15446488 Change-Id: Idd34410c7b89d8abd6973e5699a15ca699472c78
2014-11-04ART: More warningsAndreas Gampe
Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
2014-08-28Fix issue with Thread.setName hanging after Thread.startBrian Carlstrom
When suspending a thread by peer the invariant that only attached threads are suspended must be maintained. Add a ThreadList::Contains check which requires making this method non-static. Add some extra thread logging. Bug: 17302037 (cherry picked from commit 37c16453a92bbf1a47f042000318a1b60381017d) Change-Id: I51832785d4b4b431e035318e75635f442e89a1fb
2014-08-14ART: Fix another potential N-th visitor issueAndreas Gampe
Bug: 16867274 (cherry picked from commit ab61295e55c38072095e498053b8f5bebf46ad63) Change-Id: I5466af563032041ef4a547894f40f303871302c6
2014-08-13ART: Tolerate shallow call stack in VMStack_getCallingClassLoaderAndreas Gampe
When the call stack does not have the three methods we expect, the visitor will return a nullptr value. Add a test to JniTest (and refactor the test a little for code reuse). Bug: 16867274 (cherry picked from commit 61bf6a1c80bf797af5d7911ff71fc367fdb36742) Change-Id: I5fb8f91f372a41e0bc11ef9f70640834591afa53
2014-07-17Avoid race in single thread suspension.Ian Rogers
Don't allow more than one concurrent single thread suspension to avoid potential cycles and deadlocks where threads try to suspend each other. Bug: 16364458, 16354227 Change-Id: I907f1d5591a6aa5c241d37d6b4a34f968f98df77
2014-04-02Cleanup transaction supportSebastien Hertz
Updates Thread::CreateInternalStackTrace to support both transactional and non-transactional modes using template. Generalizes non-transactional mode for invariant fields (which are set only once). Removes ArrayLog::VisitRoots as we never create Array logs of ObjectArray. As ObjectArray elements are set using Object::SetFieldObject, they are already recorded in the object logs: the object is the array itself and the offset corresponds to the element index in this array. And also checks we never log ObjectArray in array logs. Fixes location of thrown exception when calling native method during class initialization. Change-Id: Idbc368d3b8292b85ff40bc8a7c559e085477bf89
2014-03-14Refactor reflective method invocation.Ian Rogers
Move invocation code out of JNI internal into reflection, including ArgArray code. Make reflective invocation use the ArgArray to build arguments rather than allocating a jvalue[] and unboxing arguments into that. Move reflection part of jni_internal_test into reflection_test. Make greater use of fast JNI. Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
2014-02-06Object model changes to support 64bit.Ian Rogers
Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
2013-10-20Fast JNI support.Ian Rogers
Use a modifier to signal a native method is a fast JNI method. If the modifier is set then don't perform runnable transitions. Change-Id: I7835b4d837bfdd1cb8e2d54b919c0d5e6cf90499
2013-10-02Inflate contended lock word by suspending owner.Ian Rogers
Bug 6961405. Don't inflate monitors for Notify and NotifyAll. Tidy lock word, handle recursive lock case alongside unlocked case and move assembly out of line (except for ARM quick). Also handle null in out-of-line assembly as the test is quick and the enter/exit code is already a safepoint. To gain ownership of a monitor on behalf of another thread, monitor contenders must not hold the monitor_lock_, so they wait on a condition variable. Reduce size of per mutex contention log. Be consistent in calling thin lock thread ids just thread ids. Fix potential thread death races caused by the use of FindThreadByThreadId, make it invariant that returned threads are either self or suspended now. Code size reduction on ARM boot.oat 0.2%. Old nexus 7 speedup 0.25%, new nexus 7 speedup 1.4%, nexus 10 speedup 2.24%, nexus 4 speedup 2.09% on DeltaBlue. Change-Id: Id52558b914f160d9c8578fdd7fc8199a9598576a
2013-08-13Refactor java.lang.reflect implementationBrian Carlstrom
Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1. Move to ArtMethod/Field instead of AbstractMethod/Field and have java.lang.reflect APIs delegate to ArtMethod/ArtField. Bug: 10014286. Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
2013-07-12Create separate Android.mk for main build targetsBrian Carlstrom
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