summaryrefslogtreecommitdiff
path: root/runtime/stack.cc
AgeCommit message (Collapse)Author
2024-10-17Separate kRuntimeISA/kRuntimeQuickCodeISA Chris Jones
Currently ART has an implicit assumption that the ISA of the quick code (e.g.: app code) that is targeted to be run by ART will be the same as the machine that runs ART itself (e.g.: runtime code). This assumption is made by having a single value (kRuntimeISA) representing both of these types of code. Instead kRuntimeISA is split into two values so that it is possible to target the case where these two ISAs don't match, for example: in simulator mode. The two values are as follows. - kRuntimeISA: - Must match the ISA of the machine that ART will be run on. This ISA will be used for the native context, native stack frame and native ABI. - kRuntimeQuickCodeISA: - The ISA that ART will generate quick code for, i.e.: that java code will be compiled to. This ISA will be used for the quick context, quick stack frame and quick ABI. Therefore replace kRuntimeISA with kRuntimeQuickCodeISA where the semantics of quick code ISA is expected, not the ISA of the machine the code is running on. Also hardcode ISA for ISA specific QuickArgumentFrameInfo classes. Authors: Artem Serov <artem.serov@linaro.org> Artem Serov <artem.serov@arm.com> Chris Jones <christopher.jones@arm.com> Test: test.py --host --target Change-Id: Ibe6f3e27179f3baa49a8de89686341df0dcf16f5
2024-08-29Add some debugging code for b/361916648. Nicolas Geoffray
Bug: 361916648 Test: test.py Change-Id: I451d186a13fb3754d2e16948183c22c765f544b0
2024-03-26Rename enums.h/.cc to pointer_size.h/.cc. Santiago Aboy Solanes
It was the only enum in the file Bug: 329378408 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: If0e385324afa3685f648135ba9b60e6bc79ba0ed
2024-03-21Reuse boot JNI stub for native methods (reland). hangl
Different native methods can share the same JNI stub as long as they have the same flag and shorty. Boot images loaded by zygote contain lots of JNI stubs that already compiled, so we can reuse them for native methods loaded later. For those methods having a matching JNI stub, we no longer need the GenericJNI and following JIT/AOT, which will bring an increase in program speed. Since there are many optimizations in JniCompile, we can also optimize the "shorty equals" criteria for some archs to let more methods find their matching stubs. Test performance improvement: run a simple addOne(Object, int) native method for multiple times at startup (microsecond, lower is better): Number of runs before after 5000 398.70 124.94 10000 792.21 234.23 50000 3919.20 1065.30 Test feature coverage: start and run the app for 30 seconds (top 10 apps in Chinese market, the closer to 100% the better): (count of native methods that reuse boot JNI stub / total count of app native methods = percentage) app1: 1055/1206 = 87.48% app2: 765/884 = 86.54% app3: 1267/1414 = 89.60% app4: 1577/1759 = 89.65% app5: 1698/1860 = 91.29% app6: 2528/2787 = 90.71% app7: 1058/1218 = 86.86% app8: 952/1092 = 87.18% app9: 1343/1483 = 90.56% app10: 2990/3492 = 85.62% This relands commit c8b6e26aa56bb6761bb781d1095b36f84c4c65d4. Reason for reland: - Fix the stack unwind issue of Thumb2. - We never use AOT code in debuggable. So restrict this optimization only to non-debuggable. - The original CL has conflict with aosp/2988923. That other CL is relanded so we can reland after resolving the conflict. Test: m test-art-host-gtest Test: run-gtest.sh Test: testrunner.py --host --all-debuggable Test: testrunner.py --target --all-debuggable Bug: 288983053 Change-Id: If7ba92d8a5f4bb9903b407d4f625e085de80cad7
2024-03-08Revert "Reuse boot JNI stub for native methods" Nicolas Geoffray
This reverts commit c8b6e26aa56bb6761bb781d1095b36f84c4c65d4. Bug: 288983053 Reason for revert: Failure on luci bots. Change-Id: Ieae0f47f2114efbfcb0bc4d8ffb0868001c22653
2024-03-07Reuse boot JNI stub for native methods hangl
Different native methods can share the same JNI stub as long as they have the same flag and shorty. Boot images loaded by zygote contain lots of JNI stubs that already compiled, so we can reuse them for native methods loaded later. For those methods having a matching JNI stub, we no longer need the GenericJNI and following JIT/AOT, which will bring an increase in program speed. Since there are many optimizations in JniCompile, we also optimize the "shorty equals" criteria for some archs to let more methods find their matching stubs. Test performance improvement: run a simple addOne(Object, int) native method for multiple times at startup (microsecond, lower is better): Number of runs before after 5000 398.70 124.94 10000 792.21 234.23 50000 3919.20 1065.30 Test feature coverage: start and run the app for 30 seconds (top 10 apps in Chinese market, higher percentage is better): (count of native methods that reuse boot JNI stub / total count of app native methods = percentage) app1: 1055/1206 = 87.48% app2: 765/884 = 86.54% app3: 1267/1414 = 89.60% app4: 1577/1759 = 89.65% app5: 1698/1860 = 91.29% app6: 2528/2787 = 90.71% app7: 1058/1218 = 86.86% app8: 952/1092 = 87.18% app9: 1343/1483 = 90.56% app10: 2990/3492 = 85.62% Test: m test-art-host-gtest Test: testrunner.py --host Test: run-gtest.sh Test: testrunner.py --target Bug: 288983053 Change-Id: I72f27bcfcd4d4a360bd5d9478b8f7687f087e431
2024-01-31Add visibility attributes in runtime/s* Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Ib074e7b5ab0725fea5640ed7deaac3452fc27864
2024-01-19Move files related to compiled code into oat/ directory Dmitrii Ishcheikin
Test: art/test.py -b --host Change-Id: Icedd3a82c6bca5147c3bc9dc50de5a729003d66f
2023-07-25Ensure flip function is executed before another thread accesses stack Lokesh Gidra
Currently, it's possible that some thread running checkpoint or Thread::GetPeerFromOtherThread accesses another thread's thread-local data structures while the flip function is pending. This would result in accessing from-space referenes. Test: art/test/testrunner/testrunner.py --host Bug: 263557041 Change-Id: Ib79fe7155f1e1345c72aa39f2a6eb742ed1265f1
2023-03-29Revert "Revert^8 "Thread suspension cleanup and deadlock fix"" Hans Boehm
This reverts commit 221b6c5fcd66d4b6f2626c311d03bde2fb1589f9. Reason for revert: Preemptive revert. Earlier versions have had a tendency to cause subtle breakage. Please do not submit unless something breaks. Change-Id: Iad2a7f920756f365789c422948632f5db5a28fd5
2023-03-29Revert^8 "Thread suspension cleanup and deadlock fix" Hans Boehm
This reverts commit c85ae17f8267ac528e58892099dcefcc73bb8a26. PS1: Identical to aosp/2266238 PS2: Address the lint failure that was the primary cause of the revert. Don't print information about what caused a SuspendAll loop unless we actually gathered the information. Restructure thread flip to drop the assumption that certain threads will shortly become Runnable. That added a lot fo complexity and was deadlock-prone. We now simply try to run the flip function both in the target thread when it tries to become runnable again, and in the requesting thread, without paying attention to the target thread's state. The first attempt succeeds. Which means the originating thread will only succeed if the target is still suspended. This adds some complexity to deal with threads terminating in the meantime, but it avoids several issues: 1) RequestSynchronousCheckpoint blocked with thread_list_lock and suspend_count_lock, while waiting for flip_function to become non-null. This made it at best hard to reason about deadlock freedom. Several other functions also had to wait for a null flip_function, complicating the code. 2) Synchronization in FlipThreadRoots was questionable. In order to tell when to treat a thread as previously runnable, it looked at thread state bits that could change asynchronously. AFAICT, this was probably correct under sequential consistency, but not with the actual specified memory ordering. That code was deleted. 3) If a thread was intended to become runnable shortly after the start of the flip, we paused it until all thread flips were completed. This probably occasionally added latency that escaped our measurements. Weaken several assertions involving IsSuspended() to merely claim the thread is not runnable, to be consistent with the above change. The stringer assertion no longer holds in the flip function. Assert that we never suspend while running the GC, to ensure the GC never acts on a thread suspension request, which would likely result in deadlock. Update mutator_gc_coord.md to reflect additional insights about this code. Change the last parameter of DecrementSuspendCount to be a boolean rather than SuspendReason, since we mostly ignore the precise SuspendReason. Add NotifyOnThreadExit mechanism so that we can tell whether a thread exited, even if we release thread_list_lock_. Rewrite RequestSynchronousCheckpoint to take advantage of the above. The new thread-flip code also uses it. Remove now unnecessary checks that we do not suspend with a thread flip in progress. Various secondary changes and simplifications that follow from the above. Reduce DefaultThreadSuspendTimeout to something below ANR timeout. Explicitly ensure that when FlipThreadRoots() returns, all thread flips have completed. Previously that was mostly true, but actually guaranteed by barrier code in the collector. Remove that code. (The old version was hard to fix in light of potential exiting threads.) PS3: Rebase PS4: Fix and complete PS2 changes. PS5: Edit commit message. PS6: Update entry_points_order_test, again. PS7-8: Address many minor reviewer comments. Remove more dead code, including all the IsTransitioningToRunnable stuff. PS9: Slightly messy rebase PS10: Address comments. Most notably: SuspendAll now ensures that the caller is not left with a pending flip function. GetPeerFromOtherThread() sometimes runs the flip function instead of calling mark. The old way would not work for CMC. This makes it no longer const. PS11: Fix a PS10 oversight, mostly in the CMC collector code. PS12: Fix comment and documentation typos. Test: Run host run tests. TreeHugger. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Change-Id: I81e366d4b739c5b48bd3c1509acb90d2a14e18d1
2023-01-16We no longer use instrumentation stubs remove the support code Mythri Alle
Remove the code to handle instrumentation stubs. We no longer use them. Bug: 206029744 Test: art/test.py Change-Id: I2b7eabf80bd34989314c0d2b299d7b1b35de0b85
2022-12-15Remove an incorrect debug check due to removal of instrumentation stubs Mythri Alle
When validating frames during a stack walk we get the current frame information for quick frames to do some checks. When the current_oat_method_header is a nullptr we get it based on the method type. For native methods, this means that the frame is of GenericJniTrampoline. We added a check there that the available code for the method should be either GenericJniTrampoline or JITed code (because we might have JITed JNI Stubs after the invocation). We didn't expect oat code there. This was true when we used instrumentation stubs for debug / tracing support. Instrumentation stubs were installed which would run necessary entry / exit hooks and then fetch and run oat code. With the removal of instrumentation stubs we install GenericJniTrampoline when necessary. When instrumentation is no longer necessary we install the most optimized code available for the method which could be oat code. So it is possible to see oat code even when running a GenericJniTrampoline. We could expand the DCHECK by expecting oat code as well but I think that may not add much value there. Bug: 206029744 Test: art/testrunner.py -t 602 Change-Id: I8c2cc4dc854c238458480948ecd926960b9f1242
2022-10-07Runtime implementation of try catch inlining Santiago Aboy Solanes
The main differences in the runtime are: 1) We now use a list of dex_pcs to find the correct catch handler instead of a single dex pc 2) We now need to restore vregs of the whole frame, which may be an inline frame. Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I95d2f32088e1d420c83962a1693be18f3b63f8b4
2022-07-27Improve stack walk debug dumps. Artem Serov
Adds extra prints during stack walks for kDebugStackWalk mode, including printing Thread id, shadow frame methods. Test: doesn't affect production build. Test: 530-checker-peel-unroll with kDebugStackWalk. Change-Id: I2db8036c4539a845b83b05f26d54dea2fb17f9f7
2022-07-20Fix unused-but-set-variable warnings Yi Kong
Test: presubmit Bug: 197240255 Change-Id: I3c089f4882044a03b550f484264beaf1f57bc17e
2022-05-27Add more verbose log message when stack map isn't found. David Srbecky
Also enable the check in release build. Bug: 206556383 Test: Make the check always fail and observe the log message Change-Id: Ie077677275aff0a1c55a7751f4506830830cbf68
2022-05-14Reland^3 "Don't use AOT code for native methods for java debuggable runtime" Mythri Alle
This reverts commit fb1b08cbb9c6ac149d75de16c14fdaa8b68baaa4. Reason for revert: Reland after a fix. We had to update untagging in jni_dlsym_lookup_stub as well. Change-Id: Id936e9e60f9e87e96f1a9a79cd2118631ad1616b
2022-05-12Revert "Reland^2 "Don't use AOT code for native methods for java debuggable ↵ Mythri Alle
runtime"" This reverts commit 5da52cd20ea0d24b038ae20c6c96aa22ac3a24a0. Reason for revert: https://ci.chromium.org/ui/p/art/builders/ci/host-x86_64-cdex-fast/5172/overview Change-Id: I9cebbaa145810547531a90af9da7961c0b6255d1
2022-05-12Reland^2 "Don't use AOT code for native methods for java debuggable runtime" Mythri Alle
This reverts commit 570ade8a6600d368a9e24b64cfa0a1907929166a. Reason for revert: Relanding after a fix for failures. The original cl breaks the invariant that we would always use AOT code for native methods if there is AOT code. This invariant is necessary to get the header when walking the stack. This CL fixes it by not relying on the invariant but instead tagging the sp to differentiate between JIT and AOT code in debuggable runtimes. Non-debuggable runtimes still have the invariant. Change-Id: I5141281f04202d41988021d53bfe30a48bc4db9c
2022-01-13Remove useless check in stack walker. Nicolas Geoffray
It's been superseded by the preceeding call ArtMethod::GetOatQuickMethodHeader for a while now. Test: test.py Change-Id: Ic769f650a9e58dd43509cf7256b0297f4f539391
2021-12-21Reland "More entrypoint handling cleanup." Nicolas Geoffray
This reverts commit 8cedd8b45854cb971510a435909573a5855092d2. Reason for revert: Fixed test Change-Id: I551912891b65cac9927dcdb89033113f290d913c
2021-12-20Revert "More entrypoint handling cleanup." Nicolas Geoffray
This reverts commit 67e48ecc200bee6e4ac784c97446bb949fb20a9e. Reason for revert: Test failure on target. Change-Id: I94c96db18f79d7e214435b3e475586d8c5d0ab58
2021-12-20More entrypoint handling cleanup. Nicolas Geoffray
- Move entrypoint initialization to instrumentation class. - Move logic to know whether we should stay in the switch interpreter in the interpreter itself. Test: test.py Change-Id: I7e434ad0609b48c86ee601421d099934e8cd4d80
2021-12-14Reland "Simplify and document entrypoint toggling in instrumentation." Nicolas Geoffray
This reverts commit 677d9eff19ef66eceb30324ec876dc8ba3a306e6. Reason for revert: other instrumentation fixes got in. Change-Id: I01f6896521ce7bf5497523f616c5288f29c50120
2021-12-07Revert "Simplify and document entrypoint toggling in instrumentation." Nicolas Geoffray
This reverts commit 76ec6f6562229033b2fecc08c01bef58a9488c92. Reason for revert: Test failure Change-Id: Ibb14e7a2830276b4f0a68b7025f9c394041e52d6
2021-12-07Simplify and document entrypoint toggling in instrumentation. Nicolas Geoffray
Test: test.py, run-libjdwp-test Change-Id: I51d39cc868d7b56b043e9e5de6abb550810b2234
2021-11-09Revert^2 "Add support for calling entry / exit hooks directly from JIT code"" Mythri Alle
This reverts commit 72be14ed06b76cd0e83392145cec9025ff43d174. Reason for revert: A reland of commit 2d4feeb67912d64b9e980e6687794826a5c22f9d with a fix for no-image tests Change-Id: I79f719f0d4d9b903db301a1636fde5689da35a29
2021-11-01Revert "Add support for calling entry / exit hooks directly from JIT code" Mythri Alle
This reverts commit 2d4feeb67912d64b9e980e6687794826a5c22f9d. Reason for revert: This breaks no-image tests. Example failure: https://android-build.googleplex.com/builds/submitted/7871904/art-no-image/latest/view/logs/build_error.log Change-Id: I0f97c672c2d48f125931171ee1041a7c1cf20127
2021-11-01Add support for calling entry / exit hooks directly from JIT code Mythri Alle
The idea of this CL is to avoid maintaining the instrumentation stack and manipulating the return addresses on the stack to call the entry / exit hooks. This Cl only addresses this for JITed code. In follow up CLs, we will extend this to others (native, nterp). Once we have everything in place we could remove the complexity of instrumentation stack. This CL introduces new nodes (HMethodEntry / HMethodExit(Void)) that generate code to call the trace entry / exit hooks when instrumentation_stubs are installed. Currently these are introduced for JITed code in debuggable mode. The entry / exit hooks roughly do the same this as instrumentation entry / exit points. We also extend the JITed frame slots by adding a ShouldDeoptimize slot. This will be used to force deoptimization of frames when requested by jvmti (for ex: structural re-definition). Test: art/testrunner.py Change-Id: Id4aa439731d214a8d2b820a67e75415ca1d5424e
2021-02-23Do not create HandleScope for JNI transitions. Vladimir Marko
We previously crated a HandleScope in the JNI transition frame to hold references passed as jobject (jclass, etc.) to the native function and these references were actually spilled twice during the transition. We now construct the jobject as a pointer to the reference spilled in the reserved out vreg area in the caller's frame. And the jclass for static methods is just a pointer to the method's declaring class. This reduces the amount of work required in the JNI transition, both on entry (in compiled stubs) and exit (in JniMethodEnd*). Some additional work is required when GC visits references of a native method as we need to walk over the method's shorty which was unnecessary for a HandleScope. Also fix Thread::InitStackHwm() to calculate correct stack size needed by the new Thread::IsJniTransitionReference(). The results for StringToBytesBenchmark on blueline little cores running at fixed frequency 1420800 are approximately arm64 (medians from 3 runs) before after timeGetBytesAscii EMPTY 447.33 436.86 timeGetBytesIso88591 EMPTY 440.52 431.13 timeGetBytesUtf8 EMPTY 432.31 409.82 arm (medians from 3 runs) before after timeGetBytesAscii EMPTY 500.53 490.87 timeGetBytesIso88591 EMPTY 496.45 495.30 timeGetBytesUtf8 EMPTY 488.84 472.68 Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --host --gcstress Test: testrunner.py --host --jit-on-first-use Test: testrunner.py --host --jit-on-first-use --gcstress Test: run-gtests.sh Test: testrunner.py --target --optimizing Test: boots. Bug: 172332525 Change-Id: I658f9d87071587b3e89f31c65feca976a11e9cc2
2020-09-24Don't store copied methods in BSS. Nicolas Geoffray
Otherwise, we can end up in a state where the method on the stack is unrelated to the receiver. Also fix a comment related to GetCanonicalMethod and StackVisitor::ValidateFrame. Test: 810-checker-invoke-super-default Change-Id: I3030e4af6059f7a4a7a1f046f2aabae8ce9057da
2020-09-02Fix bug in StackVisitor::GetVReg. Nicolas Geoffray
Floats can be stored in core registers within compiled code, so use the representation returned by the stack maps to know which register to read a value. Bug: 147572335 Test: 457-regs Change-Id: Ibe6642f2fae8206f2c230006ae85d73b47501c3b
2020-07-28Inclusive language fixes Orion Hodson
Based on: https://source.android.com/setup/contribute/respectful-code #inclusivefixit Bug: 161336379 Bug: 161896447 Test: art/test.py --host --64 Change-Id: I02c96aa477c4be6af8384222f1f111cc7ae1eeac
2020-07-28More inclusive language in the runtime David Srbecky
Test: m Bug: 161896447 Bug: 161850439 Bug: 161336379 Change-Id: Iabc29fa43b4b5a403699d6bca95e9a2cb8945d77
2020-06-26Increment hotness in nterp when doing lookups. Nicolas Geoffray
Test: test.py Test: google/perf/app-transition/app-transition-to-recents Bug: 112676029 Bug: 157402634 Change-Id: Ibe08720b442c5050062db1104be2d3a62641e629
2020-02-19Allow late lookup for @CriticalNative methods. Vladimir Marko
Test: Add and enable tests in 178-app-image-native-method Test: Add and enable tests in jni_compiler_test Test: Manually step through the new stub in GDB and check that backtrace works at various points. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 112189621 Change-Id: If094e5062acbb99eefa88f2afb4815f93730cb82
2020-02-14Remove MIPS support from runtime/. Vladimir Marko
Test: aosp_taimen-userdebug boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 147346243 Change-Id: If1fc8be94caa69f734438d7a1f4c715addfd8876
2020-02-12Rewrite GenericJNI frame setup. Vladimir Marko
Move the handle scope out of the managed frame, move the register values to load to the bottom of the reserved area and pass the hidden argument to @CriticalNative methods to prepare for implementing late lookup. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --interp-ac Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing --interp-ac Bug: 112189621 Change-Id: I4672176f9627bcbebafebb3dda0d02b8108e1329
2020-02-05Code cleanup around exception handling and stack walking. Nicolas Geoffray
- Remove unused code setting the method and dex pc below an upcall. - Clear cur_oat_quick_method_header when stack walking to be consistent in having a runtime method and a null oat method header. Test: test.py Change-Id: I87672d193eb2e62add3ae7b8a42f2202e8eb927c
2020-02-04Adjust CHECK on instrumentation stack. Nicolas Geoffray
When installing the instrumentation stack, it may be that we hit a resolution stub at the bottom of the call stack. This means the instrumentation stack will have an instrumentation frame with a runtime method, when the actual stack will replace this method with the actual ArtMethod being called. Adjust CHECK in stack walking to not assume methods match with the instrumentation stack when seeing a runtime method. Bug: 72608560 Test: ./art/test/run-test --host --dev --runtime-option -verbose:deopt,plugin --prebuild --compact-dex-level fast --jit --no-relocate --create-runner --runtime-option -Xjitthreshold:0 --no-relocate --gcstress --runtime-option -Xcheck:jni 2001-virtual-structural-multithread Test: art/tools/parallel_run.py -j80 /tmp/path/runit.sh --out failure.txt Change-Id: Ic208fa52f4d8b14838b21022744e048e3ca7d093
2020-01-31Replace instrumention id with stack pointers. Nicolas Geoffray
Replace instrumentation ids for instrumentation frames, which are inherently broken (see b/72608560), and use stack addresses instead to properly identify which frames to pop / unwind. Bug: 72608560 Bug: 148166031 Test: ./art/test/testrunner/testrunner.py --trace --debuggable --ndebuggable --optimizing --interpreter --jit --debug --ndebug -j32 Test: run-libjdwp-tests.sh Test: 2011-stack-walk-concurrent-instrument Test: ./art/test/run-test --host --dev --runtime-option -verbose:deopt,plugin --prebuild --compact-dex-level fast --jit --no-relocate --create-runner --runtime-option -Xcheck:jni 1965-get-set-local-primitive-no-tables art/tools/parallel_run.py -j80 /tmp/path/to/runit.sh --out failure.txt Change-Id: I71f6e55b9da608796cd3142b147f7b50bbd292ec
2020-01-28Implement GetVRegLong for nterp. Nicolas Geoffray
Test: 543-env-long-ref Bug: 112676029 Change-Id: I17c1573fbe892b5aa219d804f11b69961bc150d5
2020-01-22Revert "Fix stack-walking race" Alex Light
This reverts commit 721e40283793649b4750c05da4fe972bd372f7f9. Reason for revert: Wanted more discussion. Test: none Bug: 72608560 Bug: 29259363 Bug: 148166031 Change-Id: Id0fb201018a0d0bdca11d51ec156a41d6d7fe4ae
2020-01-22Fix stack-walking race Alex Light
During stack walking it was possible for a walking thread to race with the InstrumentationInstallStack. In this case the stack changes made by InstrumentationInstallStack could cause the other thread to incorrectly parse the stack data-structures, leading to failures/crashes. To fix this we increment an ID whenever instrumentation changes the instrumentation stack. Other stack-walkers then check this id and restart whenever it changes. Note that although the stack-walk restarts we keep track of how many java frames we've visited already and refrain from calling VisitFrame until we are at the same position again. This means that as far as the Visitor writers are concerned the stack-walk is only done once, just like always. Added a test (2011) that forces the race to occur. Also Disabled Dex2oatSwapUseTest#CheckSwapUsage. It seems that the increase in Thread* size has caused it to fail. Disable while we investigate. See b/29259363 Bug: 72608560 Bug: 29259363 Bug: 148166031 Test: ./test.py --host Test: ./test/run-test --host --dev --runtime-option -verbose:deopt,plugin --prebuild --compact-dex-level fast --jit --no-relocate --create-runner --runtime-option -Xcheck:jni 1965-get-set-local-primitive-no-tables parallel_run.py Change-Id: I77349dfc6fa860b7f007dee485e9fea1d8658090
2019-12-18Fix StackVisitor::GetVReg for Nterp. Nicolas Geoffray
If the required type is reference, we should look at the reference array. Test: 686-get-this Bug: 112676029 Change-Id: Iee786723f67c576878d2f5d56f96694b75699cd1
2019-12-18Add an implementation of Nterp for x64. Nicolas Geoffray
And enable it on x64 when runtime and ArtMethod requirements are met (see nterp.cc). Test: test.py Bug: 112676029 Change-Id: I772cd20a20fdc0ff99529df7495801d773091584
2019-12-17Introduce the notion of an nterp frame. Nicolas Geoffray
See comments in nterp_helpers.cc. An nterp frame follows the calling conventions and exception handling of the compiler. There are no ManagedStack transitions, and the compiler and interpreter can just call each other directly. For the stack walker, an nterp frame looks like a compiled frame. This CL introduces an nterp frame, another CL will contain an implementation for x64. Bug: 119800099 Test: test.py Change-Id: Ie9b691f58908b7f283b4cd63b84b651526155d27
2019-12-13Use correct pointer size for stack unwinding. Ulya Trafimovich
This fixes a failed DCHECK_ALIGNED followed by a SIGSEGV when building the 32-bit framework boot image extension with jacoco instrumentation (the coverage build). The crash did not occur for 64-bit image because kRuntimePointerSize was 64 in both cases, which happened to be correct for 64-bit image, but not 32-bit one. The failed alignment check was caused by assuming incorrect pointer size in StackWalk when handling exception in dex2oatd. The crash can only be reproduced under the following conditions: - boot image extension is used for the framework image - this is a coverage build ( EMMA_INSTRUMENT_FRAMEWORK=true) - jacocoagent is added to the primary boot image The fix does not resolve the boot problem (under the above conditions the phone still fails boot due to other errors). The fix only removes the build-time crash on 32-bit framework boot image extension. Test: Manually sync the repos to the state of art that includes boot image extension change (assuming AOSP): I5e417cd2588ae7b88e7b6abf7ae54268d2cce5f8, then: $ lunch aosp_walleye-userdebug $ build/soong/soong_ui.bash \ --make-mode \ SKIP_ABI_CHECKS=true \ TARGET_PRODUCT=aosp_walleye \ TARGET_BUILD_VARIANT=userdebug \ EMMA_INSTRUMENT=true \ EMMA_INSTRUMENT_FRAMEWORK=true \ NATIVE_COVERAGE=true \ SKIP_BOOT_JARS_CHECK=true \ droid Maybe not all the variables are needed, I used the build command from the failed coverage build. Before the patch, the build would fail with a dex2oat crash on out/soong/walleye/dex_bootjars/system/framework/arm/boot.art target. After the patch, the build finishes successfully. Bug: 145749668 Change-Id: Ic3f5459d20b9b30534d60aa2e96a440209b08c50
2019-12-04Helpers and refactorings to prepare for interpreter optimizations (x64) Nicolas Geoffray
- Add data structure offsets that will be used in assembly code. - Be explicit about a stack overflow in a fault handler. - Move assembly helper code in asm_support so interpreter can use it. - Support putting literals in InterpreterCache. - Fix artHandleFillArrayDataFromCode for x64. Bug: 119800099 Test: test.py Change-Id: I2729f87fe5d09c04ae2e7081636f0cd89ac14c21