summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
AgeCommit message (Collapse)Author
2021-04-28Remove RETURN_VOID_NO_BARRIER byte-code.David Srbecky
Unused and obsolete quickened byte-code. Bug: 170086509 Test: test.py -b --host --64 Change-Id: I1e917c189da7bf64418412522676dc6b081d5c0b
2021-03-27Remove QUICK bytecodes.David Srbecky
Remove the deprecated unofficial (not part of the spec) bytecodes. This frees the 16 bytecodes for future use. Bug: 170086509 Test: m test-art-host-gtest Test: test.py -r -b --host Change-Id: I9f6d8a2c21b88f883c8fdc1eb67b24620f313d56
2021-03-23Remove Vdex::GetQuickenedInfoOf and all its users.Nicolas Geoffray
Test: test.py Bug: 170086509 Change-Id: I1e1a4abf71245c0fd37f951c9af85f62feba18ca
2021-01-21Reland "Improve invokeinterface for nterp."Nicolas Geoffray
This reverts commit f1d06474baa2f7c00761db39099b89ddab71bbe4. Bug: 177554973 Bug: 112676029 Test: test.py Test: 815-invokeinterface-default Test: enable text-to-speech on device, no crash Reason for revert: Fixed issue with recursive default methods Change-Id: I2fb9336adb6c4fc920f39aa19bfe7f0a92ce059a
2021-01-07Handle VERIFY_ERROR_INSTANTIATION in compiler and nterp.Nicolas Geoffray
Nterp always supported it, but the compiler was missing a check. Test: test.py Test: 600-verifier-fails Change-Id: I8675ca6f61c68c4152212c81843da8248781f18a
2021-01-06Handle missing methods in compiler and nterp.Nicolas Geoffray
Nterp already supported it, but there was a missing check in the compiler. Test: test.py Test: 552-invoke-non-existent-super Change-Id: Ife9f3f6782f09bd9780940bcb78160aa11db12d2
2021-01-06Use ResolveFieldJLS in compiler.Nicolas Geoffray
Now that the compiler compiles methods that have IncompatibleClassChangeError, we need to use the right ResolveField method. Missed from previous commit: https://android-review.googlesource.com/c/platform/art/+/1539969 Test: art/test/run-test --host --prebuild --compact-dex-level fast --jit --runtime-option -Xjitthreshold:0 --no-relocate --runtime-option -Xcheck:jni 073-mismatched-field Change-Id: I41bc878f20512f5fb9b7ca3b3e1db7e933a8c672
2020-10-07Change interface conflict stub to take the interface method.Nicolas Geoffray
To avoid doing dex cache lookup, pass the interface method instead. This costs a few hundred KBs on speed compiled APKs (< 0.5% code size), but improves performance when hitting a conflict (as seen on dogfood data). For nterp, we currently pass the conflict method instead of the interface method. We need to handle default methods before optimizing it. This removes our last use of dex cache in compiled code. A follow-up CL will remove the NeedsDexCacheOfDeclaringClass from HInvokeInterface. Test: test.py Change-Id: I3cdd4543ad7d904b3e81950af46a48a48af6991a
2020-09-28Improve codegen for referrer's class...Vladimir Marko
... for unresolved compiling class. Test: Update test 727-checker-unresolved-class. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --host --optimizing --interpreter --jvm -t 727 Bug: 161898207 Change-Id: I1a931179060ae435ca52d5a6eca3c641b9356c03
2020-09-25Move the resolved_method_reference to HInvoke.Nicolas Geoffray
In order to also be used by HInvokeInterface. Test: test.py Change-Id: If72071a5347a13843f2c3ad8da4af4d6aaee6444
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-23Move MethodLoadKind out of HInvokeStaticOrDirect.Nicolas Geoffray
To prepare for using it in HInvokeInterface. For consistency, also move CodePtrLocation. Test: test.py Change-Id: I84f973764275002e2adb71080ebc833b2bafb975
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-11Handle more cases of super calls in the compiler.Nicolas Geoffray
Add support for calling super methods that are not referenced within the compiling dex file. Test: 808-checker-invoke-super Test: 809-checker-invoke-super-bss Change-Id: Ib103f818ac8b612a79b6b18cc8eda81131bb3149
2020-09-08Pass a full MethodReference of the invoke in HInvoke nodes.Nicolas Geoffray
Cleanup to ensure we don't make mistakes when passing a dex method index to the HInvoke constructor, and we know which dex file it relates to. Test: test.py Change-Id: I625949add88a6b97e1dafeb7aed37961e105d6aa
2020-09-07Do not build intrinsic graph for signature polymorphic methods.Vladimir Marko
The InstructionBuilder cannot build HInvokePolymorphic for an intrinsic graph. It would be rather useless to allow this as signature polymorphic method intrinsics always need the slow-path for unhandled cases, and we would therefore reject the compiled code anyway. Instead, prevent the construction of the intrinsic graph for signature polymorphic methods. Test: testrunner.py --host --optimizing -t 712-varhandle-invocations Bug: 65872996 Change-Id: Id82f1f282383dbd45d6db2bd2a96d838b685d7ed
2020-09-07X86: Implement VarHandle.set() for fields.Andra Danciu
This commit implements VarHandle set access mode for fields (both static and instance). This also implied refactorizing the common parts of get and set access modes (e.g. coordinate type checks). Non-constant Int64 set value is not implemented. 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: I384c09e08f7a772fc7ec372b1ebb5f882ecc5586
2020-09-02X86: Extend VarHandle.get() to work with instance fields.Andra Danciu
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: Ie64baf4d7d9bf3422c0e41b30d95ea903c2fabaa
2020-08-28X86: Replace VarHandle.get() return type check with CheckCast nodeAndra Danciu
This commit removes the varType check against the callsite return type. The check is done after by an added HCheckCast node. Test: art/test.py --host --32 -r -t 712-varhandle-invocations Bug: 65872996 Change-Id: If4d966e0087da28349390474188e10dfb6f63832
2020-08-27Optimizing: Improve generated code for HLoadClass...Vladimir Marko
... for resolved package-private class accessed from unresolved compiling class in the same package. Test: Additional tests in 727-checker-unresolved-class. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 161898207 Change-Id: I215dcd9db2297f5c8d9547635d80975d88534579
2020-08-27Optimizing: Improve generated code for field access...Vladimir Marko
... to resolved fields that are package-private or protected and/or defined in a package-private class but still known to be accessible from the unresolved compiling class. Test: Update test 727-checker-unresolved-class Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 161898207 Change-Id: I3c90253014da209fd6a665cc230ac375b5ef1a9b
2020-08-26Revert^2 "X86: VarHandle.get() for reference type static fields."Andra Danciu
This reverts commit 6a6cca588df43a180534db0b49475a8a5ab4c35a. This commit extends the VarHandle.get() implementation to work with reference type fields, not only primitive types. Test: ART_HEAP_POISONING=true art/test.py --host --32 -r -t 712-varhandle-invocations Bug: 65872996 Reason for revert: Fix loading the reference field. Change-Id: Ide1f13fb9c6a4e97876862fb4772e9d543847f1f
2020-08-25Revert "X86: VarHandle.get() for reference type static fields."Andra Danciu
This reverts commit a18ed1bcdb665320c901e1c07b9f92af186077d7. Reason for revert: Fails 712-varhandle-invocations for art-heap-poisoning and art-read-barrier-heap-poisoning in master-art-host Change-Id: I703923e2c7b5bc07c2270d0a0328bac8d02b655d
2020-08-24X86: VarHandle.get() for reference type static fields.Andra Danciu
This commit extends the VarHandle.get() implementation to work with reference type fields, not only primitive types. Test: art/test.py --host --32 -r -t 712-varhandle-invocations Bug: 65872996 Change-Id: I7c0d3487e94ae00d120a5d1167b7a33ffabc6d20
2020-08-24Optimizing: Fix weak method access check.Vladimir Marko
And improve generated code for accessing package private methods from unresolved compiling class in the same package. Test: Additional test in 727-checker-unresolved-class Test: testrunner.py --host --optimizing --interpreter --jvm -t 727 Test: testrunner.py --host --optimizing Bug: 161898207 Change-Id: Ia34552d90620e8e0398099522a5a52b4a45df15d
2020-08-18Optimizing: Fix weak field access check.Vladimir Marko
Test: New test 727-checker-unresolved-class Test: testrunner.py --host --optimizing --interpreter --jvm -t 727 Test: testrunner.py --host --optimizing Bug: 161898207 Change-Id: Iaab9e3fef4775144d533086ec3797ce7d06c50b7
2020-08-10ARM: Allow FP args in core regs for @CriticalNative.Vladimir Marko
If a float or double argument needs to be passed in core register to a @CriticalNative method due to soft-float native ABI, insert a fake call to Float.floatToRawIntBits() or Double.doubleToRawLongBits() to satisfy type checks in the compiler. We cannot do that for intrinsics that expect those inputs in actual FP registers, so we still prevent such intrinsics from using `kCallCriticalNative`. This should be irrelevant if an actual intrinsic implementation is emitted. There are currently two unimplemented intrinsics that are affected by the carve-out, namely MathRoundDouble and FP16ToHalf, and four intrinsics implemented only when ARMv8A is supported, namely MathRint, MathRoundFloat, MathCeil and MathFloor. Test: testrunner.py --target --32 -t 178-app-image-native-method Bug: 112189621 Change-Id: Id14ef4f49f8a0e6489f97dc9588c0e6a5c122632
2020-07-24Prepare compiler for adding VarHandle support.Andra Danciu
This commit prepares the ground for adding VarHandle support in the compiler. The intrinsic locations builder and code generator are now triggered for HInvokePolymorphic nodes. VarHandle and MethodHandle intrinsics are marked as unimplemented rather than unreachable. Since the Varhandle intrinsics are not implemented yet, the functionality is not changed (i.e. the intrinsics are evaluated at runtime and not compiled). I manually tested that the intrinsic Visit* methods are triggered for the VarHandle methods. Bug: b/65872996 Test: art/test.py --host -r -t 713-varhandle-invokers Test: art/test.py --host --all-compiler -r Change-Id: I3333728c5f16d8dc4f92ceae2738ed59b3e31e6a
2020-06-19Direct calls to @CriticalNative methods.Vladimir Marko
Emit direct calls from compiled managed code to the native code registered with the method, avoiding the JNI stub. Golem results: art-opt-cc x86 x86-64 arm arm64 NativeDowncallStaticCritical +12.5% +62.5% +75.9% +41.7% NativeDowncallStaticCritical6 +55.6% +87.5% +72.1% +35.3% art-opt x86 x86-64 arm arm64 NativeDowncallStaticCritical +28.6% +85.6% +76.4% +38.4% NativeDowncallStaticCritical6 +44.6% +44.6% +74.6% +32.2% Test: Covered by 178-app-image-native-method. Test: m test-art-host-gtest Test: testrunner.py --host --debuggable --ndebuggable \ --optimizing --jit --jit-on-first-use Test: run-gtests.sh Test: testrunner.py --target --optimizing Test: testrunner.py --target --debuggable --ndebuggable \ --optimizing --jit --jit-on-first-use -t 178 Test: aosp_cf_x86_phone-userdebug boots. Test: aosp_cf_x86_phone-userdebug/jitzygote boots. Bug: 112189621 Change-Id: I8b37da51e8fe0b7bc513bb81b127fe0416068866
2020-06-18Handle unresolved field type in compiler.Nicolas Geoffray
Make behavior consistent with interpreter, by only resolving field types when the stored value is not null. Note that this differs from RI behavior which throws a NoClassDefFoundError when loading the BadField class. Bug: 79751666 Test: 173-missing-field-type Change-Id: I1e584f3129fd651bee1c9635c90bc30e13190a90
2020-05-20Add compiler type to CompilerOptions.Vladimir Marko
Let CompilerOptions hold the information whether it is AOT or JIT compilation, or Zygote JIT for shared code. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: aosp_taimen-userdebug boots. Change-Id: Id9200572406f8e43d99b8b61ef0e3edf43b52fff
2020-05-15Optimizing: Run gtests without creating the Runtime.Vladimir Marko
The only Optimizing test that actually needs a Runtime is the ReferenceTypePropagationTest, so we make it subclass CommonCompilerTest explicitly and change OptimizingUnitTest to subclass CommonArtTest for the other tests. On host, each test that initializes the Runtime takes ~220ms more than without initializing the Runtime. For example, the ConstantFoldingTest that has 10 individual tests previously took over 2.2s to run but without the Runtime initialization it takes around 3-5ms. On target, running 32-bit gtests on taimen with run-gtests.sh (single-threaded) goes from ~28m47s to ~26m13s, a reduction of ~9%. Test: m test-art-host-gtest Test: run-gtests.sh Change-Id: I43e50ed58e52cc0ad04cdb4d39801bfbae840a3d
2020-05-13Move HandleCache to HGraph.Vladimir Marko
This avoids passing the `VariableSizedHandleScope*` argument around and eliminates HGraph::inexact_object_rti_ and its initialization. The latter shall allow running Optimizing gtests that do not require type information without creating a Runtime in future. (To be implemented in a separate CL.) Test: m test-art-host-gtest Test: testrunner.py --host --optmizing Test: aosp_taimen-userdebug boots. Change-Id: I36fe9bc556c6d610d644c8c14cc74c9985a14d64
2020-04-17Optimizing: Construct intrinsic HIR in builder.Vladimir Marko
To help baseline compiler emit better code, construct intermediate representation for intrinsics that have corresponding HIR classes in the instruction builder, instead of doing it in the instruction simplifier. Note: The generated code is sometimes different than before because GVN uses instruction ids for input ordering for commutative operations. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Change-Id: Ifa3a5774f8f3fbff4e3ca359c38eceee993d62cd
2020-04-09Small cleanup in InstructionBuilder.Vladimir Marko
Refactor BuildInvoke() to reduce runtime state transitions (fewer ScopedObjectAccess objects) and separate the class init check for static methods from the instruction creation in preparation for allocating replacement instructions for intrinsics such as Math.abs(). Delay Handle<> creation in ProcessClinitCheckForInvoke until it's actually needed. Change function parameters to ObjPtr<> instead of Handle<> if they cannot cause thread suspension. Test: aosp_taimen-userdebug boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I8d5ebf5db76f0c8b1fec790a2f8621818d64b4dc
2020-04-09Add more DCHECKs to investigate build bot failure.Nicolas Geoffray
Test: test.py Change-Id: I625564895dd701fb04f1ceb3b7bb21ffa273e776
2020-04-02DCHECK to ensure processing instruction doesn't leave an exception.Nicolas Geoffray
Test: test.py Change-Id: I254355c2e4682a94bea71053a19ea8e682e19871
2020-03-26Add more debugging info around ResolveField.Nicolas Geoffray
To better diagnose the DCHECK that we have hit here: https://android-build.googleplex.com/builds/git_master-art-host-linux-art-jit/6325844/logs/build.log Test: test.py Change-Id: If160b74055c27cd02bde27e29c7e7f731c458f4d
2020-02-17Prevent entering IMT conflict trampoline with j.l.Object methods.Nicolas Geoffray
This ensures that only interface methods enter the trampoline. Test: 725-imt-conflict-object Change-Id: Id730d921f213ee0f6d927dea5df69d57be431df0
2020-01-20Update InstructionBuilder's IsInBootImage for boot image extension.Vladimir Marko
For boot image extension, check both the class being in the boot image space and the descriptor being in image classes. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Bug: 119800099 Change-Id: I56f81d7b7aed20f5ee5c4ffd4d2e01aacd42d243
2019-10-14Revert "Make compiler/optimizing/ symbols hidden."Vladimir Marko
This reverts commit e2727154f25e0db9a5bb92af494d8e47b181dfcf. Reason for revert: Breaks ASAN tests (ODR violation). Bug: 142365358 Change-Id: I38103d74a1297256c81d90872b6902ff1e9ef7a4
2019-10-14Make compiler/optimizing/ symbols hidden.Vladimir Marko
Make symbols in compiler/optimizing hidden by a namespace attribute. The unit intrinsic_objects.{h,cc} is excluded as it is needed by dex2oat. As the symbols are no longer exported, gtests are now linked with the static version of the libartd-compiler library. libart-compiler.so size: - before: arm: 2396152 arm64: 3345280 - after: arm: 2016176 (-371KiB, -15.9%) arm64: 2874480 (-460KiB, -14.1%) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Bug: 142365358 Change-Id: I1fb04a33351f53f00b389a1642e81a68e40912a8
2019-07-15ART: Introduce stackmap with no DexRegInfo.Artem Serov
Some of safepoints don't need to have DexRegisterMap info; this will decrease the stackmap size. .oat file size reduction: - boot.oat: -233 kb (-5.4%) - boot-framework.oat: -704 kb (-4.9%) Test: 461-get-reference-vreg, 466-get-live-vreg. Test: 543-env-long-ref, 616-cha*. Test: test-art-target, +gc-stress. Change-Id: Idbad355770e30a30dcf14127642e03ee666878b8
2019-06-28Revert "Revert "Make the JIT zygote memory shared.""Nicolas Geoffray
This reverts commit 2fef66b294417d447630f9d98de68227eef476d3. Bug: 119800099 Bug: 136110523 Reason for revert: Fixed webview_zygote case. Change-Id: Iaae8c999463d77b7b1e62b55458493bdbc97a104
2019-06-26Revert "Make the JIT zygote memory shared."Nicolas Geoffray
This reverts commit 05f87217ddc9b4b9186710c0135b918f456c5aef. Bug: 119800099 Bug: 136110523 Reason for revert: testWebview flaking Change-Id: I96afa6bc9c56c4aaf5ed72ae370f6f69c096c559
2019-06-26Make the JIT zygote memory shared.Nicolas Geoffray
Test: boots Bug: 119800099 Change-Id: I75ff8a58eea4de5cb833139641b4e15b8394d9b1
2019-01-02ART: Move dex structs into own headerAndreas Gampe
Separating out the structs from DexFile allows them to be forward- declared, which reduces the need to include the dex_file header. Bug: 119869270 Test: m Change-Id: I32dde5a632884bca7435cd584b4a81883de2e7b4
2018-12-27ART: Refactor for bugprone-argument-commentAndreas Gampe
Handles compiler. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: I5cdfe73c31ac39144838a2736146b71de037425e
2018-11-21ART: Some iwyu for logging.hAndreas Gampe
Remove over-broad use in headers. Fix up transitive includes. Bug: 119869270 Test: mmma art Change-Id: I518fa7c8bee014b260818fca1fbde6ec47d126da
2018-11-01Do not cache RequiresConstructorBarrier() results.Vladimir Marko
Avoid caching the results. Caching was broken for JIT in the presence of class unloading; entries for unloaded dex files were leaked and potentially used erroneously with a newly loaded dex file. Test: m test-art-host-gtest Test: testrunner.py --host Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target Bug: 118808764 Change-Id: Ic1163601170364e060c2e3009752f543c9bb37b7