summaryrefslogtreecommitdiff
path: root/compiler/utils
AgeCommit message (Collapse)Author
2021-03-08arm/arm64: Add comment to JNI assemblers' TestGcMarking.Vladimir Marko
Test: m Bug: 172332525 Change-Id: I6515f326d331e9de3e4c12b48c680dad4272fd60
2021-03-05arm/arm64: Use marking register in JNI stubs.Vladimir Marko
Do not load `is_gc_marking` from the `Thread` when it is already available in r8 on arm and x20 on arm64. Golem results for art-opt-cc on Odroid-C2 (higher is better): linux-armv7 before after NativeDowncallStaticNormal 5.4429 5.5021 (+1.088%) NativeDowncallStaticNormal6 5.1163 5.1498 (+0.6554%) NativeDowncallStaticNormalRefs6 4.8876 4.9188 (+0.6394%) NativeDowncallStaticFast 15.992 16.505 (+3.207%) NativeDowncallStaticFast6 13.466 13.705 (+1.775%) NativeDowncallStaticFastRefs6 11.994 12.183 (+1.578%) linux-armv8 before after NativeDowncallStaticNormal 5.8594 5.9026 (+0.7378) NativeDowncallStaticNormal6 5.5198 5.5607 (+0.7414) NativeDowncallStaticNormalRefs6 5.1498 5.1862 (+0.7072) NativeDowncallStaticFast 17.057 17.439 (+2.242%) NativeDowncallStaticFast6 14.478 14.757 (+1.922%) NativeDowncallStaticFastRefs6 12.183 12.376 (+1.584%) Test: m test-art-host-gtest Test: run-gtests.sh Test: testrunner.py --target --optimizing --gcstress Bug: 172332525 Change-Id: I595cd0e17a480cdfd86c548a4f9853f4b86f4047
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
2021-02-23x86: Fix CriticalNative argument spilling in JNI stubs.Vladimir Marko
Do not move incoming stack arguments before we have spilled the scratch register ECX. Fix JniCompilerTest to initialize classes early so that we really test what we were supposed to. This exposed the x86 bug fixed here. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 172332525 Change-Id: I7c06c8ccf18f5f66772c70f6a9a9a314668ce70d
2021-02-05ARM64: Support SVE VL other than 128-bit.Artem Serov
Arm SVE register size is not fixed and can be a multiple of 128 bits. To support that the patch removes explicit assumptions on the SIMD register size to be 128 bit from the vectorizer and code generators and enables configurable SVE vector length autovectorization, e.g. extends SIMD register save/restore routines. Test: art SIMD tests on VIXL simulator. Test: art tests on FVP (steps in test/README.arm_fvp.md) with FVP arg: -C SVE.ScalableVectorExtension.veclen=[2,4] (SVE vector [128,256] bits wide) Change-Id: Icb46e7eb17f21d3bd38b16dd50f735c29b316427
2021-01-27arm: Fix and improve JNI frame entry/exit.Vladimir Marko
Add workaround for vixl emitting UNPREDICTABLE instruction in frame exit. Pop LR directly to PC when possible and emit previously missing CFI data otherwise. For frames that just save LR and align the stack with one more unused word, make the frame entry a single PUSH (by arbitrarily storing r3) and make exit a single POP (by arbitrarily restoring r3 which we are allowed to clobber as it's a caller-save register not used for return value). Test: m test-art-host-gtest Test: run-gtests.sh Test: testrunner.py --target --32 --optimizing Bug: 178048807 Change-Id: I8752711bfd4bcfc2c1cfa371108de393df00aeb8
2020-11-16Revert^2 "ART: Fix breaking changes from recent VIXL update."Artem Serov
This reverts commit eeaf47f7c9bbad29afab84a0f199a5751d9c616b. Also fixes the gtest failure when VIXL simulator stack was overflown. Test: test-art-target, test-art-host. Test: ART_USE_READ_BARRIER=false \ SANITIZE_HOST=address \ ASAN_OPTIONS='detect_leaks=0' \ SOONG_ALLOW_MISSING_DEPENDENCIES=true \ ART_HEAP_POISONING=true m test-art-host-gtest Change-Id: Ibc1f21204940083879f767d6993127bdde8326af
2020-10-28Revert "ART: Fix breaking changes from recent VIXL update."Ulyana Trafimovich
Revert submission 1331125-VIXL_UPDATE_SVE Reason for revert: broken build git_master-art-host/art-gtest-heap-poisoning @ 6936943 Reverted Changes: Ic10af84a0:Merge remote-tracking branch 'aosp/upstream-master... I752a0b0ba:ART: Fix breaking changes from recent VIXL update.... Bug: 171879890 Change-Id: Idb0d5c2e88948d799a4ef2c828be2828ea2270ea
2020-10-28ART: Fix breaking changes from recent VIXL update.Artem Serov
Also fixes the vixl-related headers includes. Test: test-art-target, test-art-host Change-Id: I752a0b0baf741aa2a0693253155042104c8b3b27
2020-09-23X86: Implement VarHandle.getAndSet, getAndSetAcquire, getAndSetReleaseAndra Danciu
This commit implements VarHandle getAndSet variants. This implied adding xchgb and xchgw instructions and tests for them. Also, all the varType checks were moved to GenerateVarHandleCommonChecks. Test: ART_HEAP_POISONING=true art/test.py --host -r -t 712-varhandle-invocation --32 Test: ART_HEAP_POISONING=false art/test.py --host -r -t 712-varhandle-invocation --32 Test: ART_USE_READ_BARRIER=true art/test.py --host -r -t 712-varhandle-invocation --32 Test: ART_USE_READ_BARRIER=false art/test.py --host -r -t 712-varhandle-invocation --32 Test: m test-art-host-gtest Bug: 65872996 Change-Id: I675f47e1dbb51a5ece42f20ad8ce552cfef63ffe
2020-09-22Fix expected results for clang-r399163 update.Stephen Hines
llvm-objdump changed the format it uses for displaying assembly, so we must also adapt all of the ART tests similarly, since they check for exact matching output. llvm-dwarfdump has similarly changed its outputs, so we adjust our expectations there too. Bug: http://b/155835175 Test: m test-art-host-gtest Change-Id: Iefdb7b98b5f87d9c7bbad1930a4393919d9b9b34
2020-09-22X86: Add the other get VarHandles (getVolatile, getAcquire, getOpaque)Andra Danciu
This commit implements VarHandle.getVolatile, getAcquire and getOpaque intrinsics. Test: ART_HEAP_POISONING=true art/test.py --host -r -t 712-varhandle-invocation --32 Test: ART_HEAP_POISONING=false art/test.py --host -r -t 712-varhandle-invocation --32 Test: ART_USE_READ_BARRIER=true art/test.py --host -r -t 712-varhandle-invocation --32 Test: ART_USE_READ_BARRIER=false art/test.py --host -r -t 712-varhandle-invocation --32 Bug: 65872996 Change-Id: I38501c226c9d5af0a9e5a1230abcb3114aad4737
2020-09-18X86: Implement VarHandle.getAndAdd intrinsicAndra Danciu
This commit implements VarHandle getAndAdd intrinsic. This also implied adding xadd instruction and tests for it. Test: art/test.py --host -r -t 712-varhandle-invocation --32 Test: m test-art-host-gtest Bug: 65872996 Change-Id: I84dd95ba6464c8a73ace03a13817147c7099677a
2020-09-17X86: Add the other set VarHandles (setVolatile, setRelease, setOpaque)Andra Danciu
This commit implements VarHandle.setVolatile, setRelease and setOpaque intrisics. This also implied refactoring HandleFieldSet to be reused in all set VarHandles, as the code is very similar. Test: ART_HEAP_POISONING=true art/test.py --host --all-compiler -r --32 Test: ART_HEAP_POISONING=false art/test.py --host --all-compiler -r --32 Test: ART_USE_READ_BARRIER=true art/test.py --host --all-compiler -r --32 Test: ART_USE_READ_BARRIER=false art/test.py --host --all-compiler -r --32 Bug: 65872996 Change-Id: I9a1d5fec6c5086c1e77ba65c3337da1133b3e3f1
2020-09-16Add andw for memory to x86 assembler.Nicolas Geoffray
Test: assembler_x86_test Change-Id: I5866557f9498f6e5f5713fff2ce58c70e47bd74b
2020-09-14X86: Add tests for cmpxchgw and cmpxchgbAndra Danciu
The two instructions were added in a previous commit and were needed for VarHandle.compareAndSet intrinsic. Test: m art_compiler_host_tests Bug: 65872996 Change-Id: If2a9d8d1a4c40034d16e2082f2e5948bcdfbab21
2020-09-10X86: Add test for movwAndra Danciu
Test: SOONG_ALLOW_MISSING_DEPENDENCIES=true TARGET_BUILD_UNBUNDLED=true m test-art-host-gtest Change-Id: I5296ef734484c6cf3c441f96fc3a64572b5909dc
2020-09-10X86: Implement VarHandle.compareAndSet() for fields.Andra Danciu
This commit implements VarHandle compareAndExchange access mode for fields (both static and instance). Int64 and Float64 are not implemented because ParallelMove might fail when moving register pairs. Test: ART_HEAP_POISONING=true art/test.py --host --32 -r -t 712-varhandle-invocations Test: ART_HEAP_POISONING=false art/test.py --host --32 -r -t 712-varhandle-invocations Bug: 65872996 Change-Id: I92e51c348f076c23413e419948f03197c286a619
2020-08-28Avoid NanoSleep overflowHans Boehm
NanoSleep with a very large argument could cause it to fail on 32 bits. It doesn't appear to me that this was ever exposed to client code. So this was probably not an observable bug. Remove redundant uses of "constexpr inline" instead of adding another one. Bug: 161006928 Test: Treehugger Change-Id: I2ad3b92d01c764915ab2aac17cc72ac5c6907ed4
2020-08-26Add andw to x64 assembler.Nicolas Geoffray
Test: test.py Bug: 112676029 Change-Id: I8918eef519822e35c2c2bb10a13e89bc26cad5b4
2020-07-28Remove deprecated debug_suspend_count TLS valueAlex Light
The debug_suspend_count TLS value has been dead for a while and was accidentally left in. Remove it entirely. Test: ./test.py --host Change-Id: Ie2ead0d30e5ff3885cdd83242cad2c826c7fb732
2020-07-24Update language to comply with Android’s inclusive language guidanceIan Pedowitz
See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Bug: 161850439 Bug: 161336379 Test: m -j checkbuild cts docs tests Change-Id: I32d869c274a5d9a3dac63221e25874fe685d38c4
2020-07-15Revert^2 "Switch to LLVM prebuilt tools for ART gtests"David Srbecky
It is also necessary to adjust the expected output of some tests. This reverts commit ea54b823a3a02f65c865e11bbbccb327a273c039. Bug: 147817558 Test: m test-art-host-gtest Change-Id: Ib244e8b7d43d575299654397a47056f295ab4589
2020-07-10Revert "Switch to LLVM prebuilt tools for ART gtests"Alex Light
This reverts commit 8070443ce4b31a6787c22490f18f838f8f6ed4be. Reason for revert: Failing on chrome buildbots. Test: None Bug: 137817558 Change-Id: I4cbb4898e859ce33560592dd63cbf4a413048662
2020-07-10Switch to LLVM prebuilt tools for ART gtestsDavid Srbecky
It is also necessary to adjust the expected output of some tests. Bug: 147817558 Test: m test-art-host-gtest Change-Id: Ib517169614470193e0c55f566adb72a526ae6902
2020-07-09Refactor arm assembly tests.David Srbecky
Another step in preparation to move to the LLVM toolchain. Bug: 147817558 Test: m test-art-host-gtest Change-Id: Ie5be337165d8f24e04740de0486144fa6a62f063
2020-07-09Rewrite assembler_test_base.hDavid Srbecky
Simplify the code in preparation of move to LLVM prebuilt tools. Bug: 147817558 Test: m test-art-host-gtest Change-Id: Iba277235255fd7d7f0965749b0b2d4a9567ced1f
2020-07-09Add some x86/x86-64 assembler tests.Vladimir Marko
Also add divq() and divl() to x86-64 assembler and clean up a test. This is a follow-up to https://android-review.googlesource.com/1355865 . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing -t 082-inline-execute Bug: 156736938 Change-Id: Iade33a2250cea481249f6b976bc53c86663cb901
2020-07-09Make Integer.divideUnsigned intrinsic for x86.Andra Danciu
Bug: 156736938 Test: Added a test to 082-inline-execute. Test: art/test.py --host --32 -r -t 082-inline-execute Change-Id: Id516126fce10f2fa52b95c1b2b107ca7bf45e347
2020-07-01Fix X86Assembler::repe_cmpsbDavid Srbecky
We were emitting the wrong instruction. This code seems unused in the compiler. Test: m test-art-host-gtest Change-Id: I6d990dd76f8a8a081158f2b5936e734db88fa345
2020-07-01Revert "Support running of host gtests in eng-prod"David Srbecky
This reverts commit 22872da653053bb4b86fbef67163a9f6b7aee25b. Reason for revert: Checking if this CL is cause of b/160132136 Bug: 147817558 Bug: 160132136 Change-Id: Ifb6f2292292a7f69fbd0f2e9204fd37dbca84277
2020-06-26Support running of host gtests in eng-prodDavid Srbecky
Add more libraries and tools to the shared ART directory in testcases. Change the tests environment setup, so that it can find the tools. Vast majority of tests pass. Some individual tests still need fixing. Bug: 147817558 Test: run gtests in forrest Change-Id: I3214f532436828c2a1a5a543e69d6b9bcf1e42af
2020-06-09arm/arm64: Clean up intrinsic slow paths.Vladimir Marko
Generalize and use the slow path template IntrinsicSlowPath from intrinsics_utils.h. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boot image is unchanged. Change-Id: Ia8fa4e1b31c1f190fc5f02671336caec15e4cf4d
2020-03-16Move @CriticalNative arguments in registers.Vladimir Marko
And spill stack arguments directly to the right location. Do not spill to the reserved space in the caller's frame. Preliminary Golem results for art-opt-cc: x86 x86-64 arm arm64 NativeDowncallCritical6: n/a +14.3% +17.2% +26.1% (x86 seems to be currently providing results that are worse than interpreter, so something is not working.) Test: Additional tests in 178-app-image-native-method test. 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: I709c52ab2585a8f5f441f53ad2bf4a01d2b25dca
2020-03-05Minor improvements in JNI assemblers.Vladimir Marko
Address issues identified in https://android-review.googlesource.com/1246286 and clean up a few other things. 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: 12189621 Change-Id: I9ee1a9c113ef756d7aa3bd4d3f17ef1aaa4306f5
2020-03-02Move entry spills determination to JNI compiler.Vladimir Marko
The calling convention no longer describes entry spills as spilling is the JNI compiler's responsibility. This allows future improvements, such as spilling registers directly to the HandleScope or outgoing stack args. Remove the notion of interprocedural scratch register from calling conventions and let assemblers deal with all scratch register uses. The remaining JNI assembler APIs that take scratch registers are currently unused and can be removed. Also fix a bug in disassembly comparison for tests; the contents of two files were considered identical if the second one just contained additional data. This change fully preserves the generated code and adds TODO comments where doing so results in weird or suboptimal code. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Prebuilt boot image is unchanged. Test: aosp_taimen-userdebug boots. Bug: 12189621 Change-Id: Ic26a670276920313cd907a6eda8d982cf0abfd81
2020-02-26Remove MIPS support from libelffile.Vladimir Marko
Test: m Change-Id: I01e6c6abb845baa4763929f5b9b6b3b36ac0e8b0
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-13Remove MIPS support from JNI/trampoline compiler.Vladimir Marko
Also remove MIPS assembler/disassembler support. Test: aosp_taimen-userdebug boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 147346243 Change-Id: Id736074b97cd04987a7902741828b119508df1c0
2020-01-29Remove old JDWP implementation from ARTAlex Light
The old 'internal' JDWP implementation hasn't been used for a few releases and it's a lot of code that's barely being tested and is at risk of bit-rot. To simplify the runtime and remove potentially buggy code this removes it. We also needed to rewrite the DdmThreadNotification code since it relied on the suspension functionality from the old debugger and was generally unsafe. Test: ./test.py --host Test: atest --test-mapping cts/tests/jdwp/TEST_MAPPING Test: atest --test-mapping cts/hostsidetests/jdwptunnel/TEST_MAPPING Test: Manual ddms Bug: 119034743 Change-Id: I775f310a009141296b730e4a6c2503506a329481
2020-01-16jni: Do not create a managed frame for @CriticalNative.Vladimir Marko
Omit managed frame for @CriticalNative methods, do not check for exceptions and and make a tail call when possible. Pass the method pointer in a hidden argument to prepare for implementing late binding for @CriticalNative methods. This changes only the JNI compiler, Generic JNI shall be updated in a separate change. Performance improvements reported by Golem (art-opt-cc): x86 x86-64 arm arm64 NativeDowncallStaticCritical6 +17% +50% +88% +139% NativeDowncallStaticCritical +37% +32% +103% +216% 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: I5758c8f478627f2eee8f615b4537a907c211b9f8
2020-01-08Disable test cases `AssemblerMIPS{32r6,64}Test.Toolchain` in ART gtest.Roland Levillain
These test cases rely on `gcc` (used as reference assembler), which is being removed from Android (b/147240075). This does not affect other test cases in `assembler_mips32r6_test` and `assembler_mips64_test`, as verification against the reference assembler had already been disabled for speed reasons (b/73903608). Test: m test-art-host-gtest-assembler_mips32r6_test Test: m test-art-host-gtest-assembler_mips64_test Bug: 147240075 Bug: 147336214 Bug: 147346243 Change-Id: I99edd834c5e3ca626b36b6cbfecfb551f01e8640
2019-12-11Revert^4 "Allow structural redefinition on non-final classes."Alex Light
This reverts commit 664999a12d6fc8a8ef5c0519b12ec1e8a51bb085. Fixed issues with GC and quickened instructions in parent CLs. Reason for revert: Fixed issues with GC CHECK fail and device SEGVs. Test: ./test.py --host Test: ./test.py --target Bug: 134162467 Bug: 144168550 Change-Id: Ibacddaf45beb72184f97d53d5d048bd442578658
2019-12-05Revert^4 "Implement Dot Product Vectorization for x86"Alex Light
This reverts commit 8e895008a3e2f2813bb46cb0c6bc76884e46e9ac. Reason for revert: The test failure seems unrelated. Bug: 144947842 Change-Id: I7b437f0443d71a5c762e1a8372564ed989971cc9
2019-12-03Revert "Revert^2 "Allow structural redefinition on non-final classes.""Nicolas Geoffray
This reverts commit f1b809ce611e943f926fff97cefe0930226ffcc2. Reason for revert: Tests still fail Bug: 134162467 Bug: 144168550 Change-Id: Icdebc826b8630920b716afbfd6f338a29669fcc2
2019-12-02Revert^2 "Allow structural redefinition on non-final classes."Alex Light
We were incorrectly racing with the rest of the runtime in a couple of places. First we would return an ObjPtr of a newly defined class after holding it over a suspend point. This could lead to DefineClass returning an obsolete class in some cases. We also failed to ensure the class-status was synchronized between the old and new classes during structural redefinition. This could lead to a class appearing to go backwards in status. This reverts commit 88b1c83080afcb2bfb6f781ded1c90fe8f9eab4d. Reason for revert: Fixed issues causing test failures. Test: ./test.py --host Bug: 134162467 Bug: 144168550 Change-Id: I4d0f7718490532f0ef14a9561b8e7000ef292b12
2019-11-26Revert "Allow structural redefinition on non-final classes."Roland Levillain
This reverts commit c47040d31cbcd8cddd5fadb552b4f0f6c94b5bd0. Reason for revert: Breaks ART tests (see e.g. b/145197371). Bug: 145197371 Bug: 134162467 Bug: 144168550 Change-Id: Ia8e5788655057e380fc723a38900d26d69cda938
2019-11-26Revert "Revert^2 "Implement Dot Product Vectorization for x86""Nicolas Geoffray
This reverts commit 7cf5607f472020711e36eedbbfebb25b40d3f90e. Bug: 144947842 Reason for revert: Seems to have broken android.jvmti.cts.JvmtiHostTest1936#testJvmt Change-Id: Ied6ff6ddf1cb2e3e76adcaa0fda5e36af254b7c5
2019-11-26Allow structural redefinition on non-final classes.Alex Light
This adds support for structurally redefining non-final, non-finalizable classes. The only restriction is that one cannot redefine a class at the same time as any of its supertypes, if a structural redefinition is occurring. The structural redefinition may not remove any fields or methods, change the superclass or change the implemented interfaces. Adding new methods or fields, both static or non-static, public, private, protected, or package-private, is supported. Test: ./test.py --host Bug: 134162467 Bug: 144168550 Change-Id: I32e9e854b3e56270170b10e8f5aba9de8f6bfdfa
2019-11-20ARM64: Pass simd half floating point feature to VIXL macroassembler.Usama Arif
VIXL requires NEONHalf CPUFeature to emit half floating points NEON instructions. Test: codegen_test Change-Id: I797d7a27087103491871e86d283f9860d3f20624