summaryrefslogtreecommitdiff
path: root/compiler/utils/jni_macro_assembler.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2021-12-06 16:17:52 +0000
committer Vladimir Marko <vmarko@google.com> 2021-12-10 13:38:45 +0000
commit9c0f7640aa6f2118679f5c5353e99f72dbd30040 (patch)
treeaf78e0f37bd076540a10b2ab113d0d7861f1116c /compiler/utils/jni_macro_assembler.h
parentb6c0d1a7f0525421baad63f1c718855d2026cb39 (diff)
Rewrite thread root flip synchronization.
Mark pending "flip function" with a `ThreadFlag` for faster JNI transitions. Use two more `ThreadFlag`s to fix potential race conditions. Some checkpoints were previously running the flip function on behalf of a suspended thread because they relied on the thread roots being flipped, but doing that without any synchronization meant that they could race and one could have executed its own code while another was still running the flip function. Other checkpoints that were peforming a stack walk did not run the flip function at all, so they could have seen from-space references. We now check for a pending or running flip function at the start of the `Thread::RunCheckPointFunction()` and proceed only after it has completed; holding a mutator lock for the duration of the whole function prevents a new flip function from being installed until the checkpoint finishes. Golem results for art-opt-cc (higher is better): linux-ia32 before after NativeDowncallStaticNormal 46.581 46.813 (+0.4980%) NativeDowncallStaticNormal6 42.247 42.268 (+0.0497%) NativeDowncallStaticNormalRefs6 40.918 41.355 (+1.068%) NativeDowncallVirtualNormal 46.292 46.361 (+0.1496%) NativeDowncallVirtualNormal6 41.791 41.791 (0%) NativeDowncallVirtualNormalRefs6 40.500 40.500 (0%) linux-x64 before after NativeDowncallStaticNormal 44.169 43.956 (-0.4815%) NativeDowncallStaticNormal6 43.198 43.198 (0%) NativeDowncallStaticNormalRefs6 38.481 38.481 (0%) NativeDowncallVirtualNormal 43.672 43.672 (0%) NativeDowncallVirtualNormal6 42.247 42.268 (+0.0479%) NativeDowncallVirtualNormalRefs6 41.355 41.355 (0%) linux-armv7 before after NativeDowncallStaticNormal 9.9701 10.443 (+4.739%) NativeDowncallStaticNormal6 9.2457 9.6525 (+4.400%) NativeDowncallStaticNormalRefs6 8.3868 8.7209 (+3.984%) NativeDowncallVirtualNormal 9.8377 10.304 (+4.742%) NativeDowncallVirtualNormal6 9.3596 9.7752 (+4.440%) NativeDowncallVirtualNormalRefs6 8.4367 8.7719 (+3.973%) linux-armv8 before after NativeDowncallStaticNormal 9.8571 10.685 (+8.397%) NativeDowncallStaticNormal6 9.4905 10.249 (+7.991%) NativeDowncallStaticNormalRefs6 8.6705 9.3000 (+7.261%) NativeDowncallVirtualNormal 9.3183 10.053 (+7.881%) NativeDowncallVirtualNormal6 9.2638 9.9850 (+7.786%) NativeDowncallVirtualNormalRefs6 8.2967 8.8714 (+6.926%) (The x86 and x86-64 differences seem to be lost in noise.) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 172332525 Change-Id: I9c2227142010f7fe6ecf07e92273bc65d728c5c6
Diffstat (limited to 'compiler/utils/jni_macro_assembler.h')
0 files changed, 0 insertions, 0 deletions