summaryrefslogtreecommitdiff
path: root/compiler/exception_test.cc
AgeCommit message (Collapse)Author
2024-11-11Avoid `strlen()` for `ClassLinker::FindClass()`... Vladimir Marko
... and related functions in most cases. Note that the `CompilerDriver` previously resolved the `ClassLoader` and `TransactionAbortError` using the provided class loaders. We're now using the `ClassLoader` from the class roots and resolving the `TransactionAbortError` in the BCP class loader. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Bug: 338123769 Change-Id: I38e480cdcdb8bf02c958e4d0773437f5766f6be0
2024-06-20Change CreateInternalStackTrace to return a mirror::Object. Nicolas Geoffray
It might be called in a context where there isn't a JNI frame (for example when throwing in the runtime). So return a mirror::Object instead of jobject. Test: 107-int-math2 with gcstress Change-Id: I72ea87db8cf5092e636901d1114034e81de13146
2024-04-11Clean up string data access in `DexFile`. Vladimir Marko
The `*ByIdx()` and `*ByTypeIdx()` functions were doing validity checks that were needed only for processing the debug data, so move the checks to these callers. Replace these functions with new overloads of other functions to provide consistent naming. In a few cases, rewrite calls to these functions to fetch and work with a `string_view` instead. Rename `GetStringLength()` to `GetStringUtf16Length()` and change its return type to `uint32_t`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I561899606f6e5ec5f23aa4be617349dacdb376e3
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-01-19Move files related to compiled code into oat/ directory Dmitrii Ishcheikin
Test: art/test.py -b --host Change-Id: Icedd3a82c6bca5147c3bc9dc50de5a729003d66f
2023-06-19Remove HWASanUntag Florian Mayer
The pointer passed to it was never tagged in the first place. Add DCHECK to codify this assumption. Test: art/tools/run-gtests.sh Change-Id: Ib8ebc242d44b0599dccb80758198d1255426a7c6
2022-11-18Make remaining compiler/ symbols hidden. Vladimir Marko
And mark required symbols with EXPORT. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Change-Id: I1b4e3c1ef9006924456dc36ec906bf74b62adab4
2022-11-07Fix ExceptionTest to properly untag when setting up a fake stack Mythri Alle
ExceptionTest.StackTraceElement sets up a fake stack to test stack walking. When setting up this stack, the return pc is obtained from ToNativeQuickPc which returns HWAsan tagged pointers. We don't expect tagged values on stack so untag before setting it as return pc. Bug: 230392320 Test: gtest.py --gtest_filter=ExceptionTest.StackTrace (on hwasan) Change-Id: Ic4783e37b4d5d46fbe5c3817eb094a04d97fd565
2022-10-25Disable ExceptionTest#StackTraceElement on HWASan. Florian Mayer
Test: atest art_standalone_compiler_tests on flame_hwasan Bug: 230392320 Change-Id: Iec7b895e942bae8bd6247589e92b10dda0225a70
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-09-29Rename `GetInstructionSet{,Code}Alignment`. Vladimir Marko
Update the `GetInstructionSetAlignment()` function name to `GetInstructionSetCodeAlignment()` in line with renames from https://android-review.googlesource.com/2229498 . Move the function to `instruction_set.h` and change the handling of unknown instruction sets to the approach used in other functions in the header file. Test: buildbot-build.sh --target Change-Id: I8239b94b56bf24f4e99a2d72ba10ec1f5a055d36
2022-07-14Reland "Introduce a flag to check if JITed code has instrumentation support" Mythri Alle
This reverts commit 26aef1213dbdd7ab03688d898cf802c8c8d7e610. Reason for revert: Relanding after a fix. When checking if the caller is deoptimizaeble we should consider the outer caller and not the inlined method that we could be executing currently. Bug: 222479430 Change-Id: I37cbc8f1b34113a36a92c3801db72b16d2b9c81a
2022-07-13Revert "Introduce a flag to check if JITed code has instrumentation support" Mythri Alle
This reverts commit fc067a360d14db5f84fd4b58e0dee6cb04ee759b. Reason for revert: test failures on jit-on-first-use: https://android-build.googleplex.com/builds/submitted/8821659/art-jit-on-first-use/latest/view/logs/build_error.log Change-Id: Ie9bc243baac777ecc4f47cc961494ca6ab3ef4c6
2022-07-12Introduce a flag to check if JITed code has instrumentation support Mythri Alle
Introduce a new flag to identify if JITed code was compiled with instrumentation support. We used to check if the runtime is java debuggable to check for instrumentation support of JITed code. We only set the java debuggable at runtime init and never changed it after. So this check was sufficient since we always JIT code with instrumentation support in debuggable runtimes. We want to be able to change the runtime to debuggable after the runtime has started. As a first step, introduce a new flag to explicitly check if JITed code was compiled with instrumentation support. Use this flag to check if code needs entry / exit stubs and to check if code is async deoptimizeable. Bug: 222479430 Test: art/test.py Change-Id: Ibcaeab869aa8ce153920a801dcc60988411c775b
2022-04-25Reland "Add additional checks for ArtMethod::GetOatQuickMethodHeader" Mythri Alle
This reverts commit 4762546c0566f0ef727a5025c16c1abf593a4139. Reason for revert: relanding with a fix to build failures Change-Id: I1cf9152d4fb48878b6df89e6c8a2cb6d5949c5ee
2022-04-22Revert "Add additional checks for ArtMethod::GetOatQuickMethodHeader" Mythri Alle
This reverts commit bbbcea9ec41513a439283a6d7ad9798d7c4faa83. Reason for revert: https://android-build.googleplex.com/builds/submitted/8490058/aosp_x86-eng/latest/view/logs/build_error.log Change-Id: Ibca5761f7893d1c8e81dc6f67b2a2b513675f4cc
2022-04-22Add additional checks for ArtMethod::GetOatQuickMethodHeader Mythri Alle
We expect a non zero pc for all cases apart from runtime methods and proxy invoke handlers. Add a DCHECK to assert this case. Also assert that we would always find AOT code for non-native methods on the fallback path. This requires fixing a unit test that was passing a pc value of 0 to get the method header of existing entry point. Test: art/test.py Change-Id: I10cfa84c5b9019227d278dd511a4ea09f6aff5b2
2021-03-09Move code size from OatQuickMethodHeader to CodeInfo. David Srbecky
This saves 0.5% of oat file size. (0.8% saving from this CL minus 0.3% due to go/aog/1614482) Bug: 123510633 Test: m dump-oat Test: m test-art-host-gtest Test: ./art/test.py -b -r --host Change-Id: I035b54a47b300a5808aa8c2992f87eae009fd245
2021-03-05Add code size to CodeInfo. David Srbecky
This is in preparation of removing it from OatQuickMethodHeader. Bug: 123510633 Test: m test-art-host-gtest Test: ./art/test.py -b -r --host Change-Id: I5c5adb4c040e329b81c1393aa1b80ee017729c8a
2020-09-07Move code item to the data pointer and remove code_item_offset. Nicolas Geoffray
This saves 4 bytes on 32bit and 8 bytes on 64bit on ArtMethod. Also update nterp to directly fetch the code item from the data pointer. Test: test.py Bug: 112676029 Change-Id: Ic01f43c7ccf2cbce1ec517478e81362232d36371
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
2019-04-01ObjPtr<>-ify StackTraceElement and ClassLoader. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: I457eeda55bbfb905dd2de0abd68451ab42ef9c1f
2019-03-06Revert "Revert^2 "Add code size to CodeInfo"" Nicolas Geoffray
This reverts commit e1412dacbf1d2a809bd1fca658cc8cb8f61f8ee6. Bug: 123510633 Bug: 127305289 Reason for revert: b/127305289 Change-Id: I54557b05a44777f1fa2c15bde4fa648980f42eed
2019-03-05Revert "Remove code size from OatQuickMethodHeader" Nicolas Geoffray
This reverts commit 131f23a4c2c34b689c07e6efd05cea74190f0113. Bug: 123510633 Bug: 127305289 Reason for revert: b/127305289 Change-Id: I59905779fe8c7d7551c0fa6c8693fb64eb6760b2
2019-02-14Remove code size from OatQuickMethodHeader David Srbecky
This saves from 0.75% from oat file size. Bug: 123510633 Change-Id: Ibf0d45d5d84057ee45a3584a4b69a7c0487443bf
2019-02-14Revert^2 "Add code size to CodeInfo" David Srbecky
This temporarily adds 0.25% to oat file size. The space will be reclaimed back in follow-up CL. This reverts commit 8f20a23a35fa6fbe4dcb4ff70268a24dc7fb2a24. Reason for revert: Reland as-is after CL/903819 Bug: 123510633 Test: DCHECK compare the two stored code sizes. Change-Id: Ia3ab31c208948f4996188764fcdcba13d9977d19
2019-02-12Revert "Add code size to CodeInfo" David Srbecky
This reverts commit 68efa7b1128486e08ae60cd27181645b27bbd2e4. Reason for revert: Breaks tests Change-Id: I28fb143990f58e0d5f0b106bea9d9a159f19297e
2019-02-11Add code size to CodeInfo David Srbecky
This temporarily adds 0.25% to oat file size. The space will be reclaimed back in follow-up CL. Bug: 123510633 Test: DCHECK compare the two stored code sizes. Change-Id: I15340824ca637fd075a4cef87771b06cb96bb9f4
2019-01-02ART: Move dex structs into own header Andreas 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-comment Andreas Gampe
Handles compiler. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: I5cdfe73c31ac39144838a2736146b71de037425e
2018-09-07ART: Continue adding override annotations Andreas 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-08-03Simplify StackMapStream encoding. David Srbecky
Test: test-art-host-gtest-stack_map_test Change-Id: Ife021d03e4e486043ec609f9af8673ace7bde497
2018-08-01Move MethodInfo to CodeInfo. David Srbecky
There is no need to treat it specially any more, because of the de-duplication at BitTable level. This saves 0.6% of oat file size. Test: test-art-host-gtest Change-Id: Ife7927d736243879a41d6f325d49ebf6930a63f6
2018-07-27Fix exception_test. David Srbecky
Ensure that code_ptr is properly aligned, regardless whether the vector is aligned. Test: test-art-host-gtest-exception_test Change-Id: I06f7af525323499be23c36e9720f669e98421415
2018-07-27Remove frame info from OatQuickMethodHeader. David Srbecky
The information has been moved to CodeInfo, where it is stored in much more compact way. The old CL which added the data to CodeInfo cost 0.7%. This CL saves 2.5% of .oat file size so a win overall. Test: test-art-host-gtest Change-Id: I07fcf6f2776c96218f995ba3b57a1e6ccbf5e317
2018-06-26Add method frame info to CodeInfo. David Srbecky
The stored information will be used in follow-up CLs. This temporarily increases .oat file size by 0.7%. Test: test-art-host-gtest Change-Id: Ie7d898b06398ae44287bb1e8153861ab112a216c
2018-06-20ART: Ensure OatQuickMethodHeader is trivially copyable Andreas Gampe
Remove empty constructor. Test: mmma art Change-Id: Ie58721299a6675797e9a525f4eb7e6df82abed50
2018-05-31ObjPtr<>-ify ClassLinker::FindClass(), fix 1 stale reference use. Vladimir Marko
Thread::CreateAnnotatedStackTrace() was using a stale reference `aste_array_class`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: I191907c0053456bb57de425aa6ccd9668df818a2
2018-05-30Cleanup stackmap generation in exception_test David Srbecky
The alignment code was unnecessarily complicated, and the final alignment check was incorrect. Test: test-art-target-gtest-exception_test32 Change-Id: I34e17af11d59b93bc445d7a2a5bd76552675fe3a
2018-04-04Separate Malloc and MemMap ArenaPools David Sehr
Make ArenaPool an abstract base class and leave MallocArenaPool implementation with it. This enables arena_allocator to be free of MemMap, Mutex, etc., in preparation to move the remaining collections out of runtime/base to libartbase/base. Bug: 22322814 Test: make -j 50 test-art-host build and boot Change-Id: Ief84dcbfb749165d9bc82000c6b8f96f93052422
2018-02-28Header library to remove dependence on runtime/ David Sehr
Add a new header library to remove libdexfile and others' dependence on runtime (typically runtime/base) includes in libdexfile. Also a small step to tease dexlayout and profman away from relying on these as well. Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host-gtest Change-Id: I38e2fe399a75f4bc6318c77a71954c00ea73ec2b
2018-02-08Make exception test more robust against dex changes. Aart Bik
Rationale: With the shift from dx to d8, dex bytecode may be layed out slightly different. The exception test was not particularly robust against this, as it was looking for instruction at dex_pc == 3 in method g(). Incidentialy, the way it was setup, it would even use that dex_pc for querying f(), which seemed unintentional (and makes it hard to make the test more robust by e.g. looking up the new instance instruction). Therefore, test was made more robust by simply assuming dex_pc == 0, which consistently maps to first statement in source. Bug: 73050355 Test: exception_test Change-Id: Ic5b2784a48ae10d139c0b77a3bbfcc53b58a5b42
2018-01-08Clean up CodeItemAccessors and Compact/StandardDexFile Mathieu Chartier
Change constructor to use a reference to a dex file. Remove duplicated logic for GetCodeItemSize. Bug: 63756964 Test: test-art-host Change-Id: I69af8b93abdf6bdfa4454e16db8f4e75883bca46
2018-01-05Create dex subdirectory David Sehr
Move all the DexFile related source to a common subdirectory dex/ of runtime. Bug: 71361973 Test: make -j 50 test-art-host Change-Id: I59e984ed660b93e0776556308be3d653722f5223
2017-12-27Move dex exception helpers to their own file and use dex accessor Mathieu Chartier
Also change the input argument to be a code item accessor instead of a code item pointer. This removes the dependency on the code item layout. Bug: 63756964 Test: test-art-host Change-Id: If75a168d0b5a77d08fa3c6ba38d00705158911db
2017-12-22Make CodeItem fields private Mathieu Chartier
Make code item fields private and use accessors. Added a hand full of friend classes to reduce the size of the change. Changed default to be nullable and removed CreateNullable. CreateNullable was a bad API since it defaulted to the unsafe, may add a CreateNonNullable if it's important for performance. Motivation: Have a different layout for code items in cdex. Bug: 63756964 Test: test-art-host-gtest Test: test/testrunner/testrunner.py --host Test: art/tools/run-jdwp-tests.sh '--mode=host' '--variant=X32' --debug Change-Id: I42bc7435e20358682075cb6de52713b595f95bf9
2017-11-02ART: Make InstructionSet an enum class and add kLast. Vladimir Marko
Adding InstructionSet::kLast shall make it easier to encode the InstructionSet in fewer bits using BitField<>. However, introducing `kLast` into the `art` namespace is not a good idea, so we change the InstructionSet to an enum class. This also uncovered a case of InstructionSet::kNone being erroneously used instead of vixl32::Condition::None(), so it's good to remove `kNone` from the `art` namespace. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I6fa6168dfba4ed6da86d021a69c80224f09997a6
2017-10-17Use ScopedArenaAllocator for code generation. Vladimir Marko
Reuse the memory previously allocated on the ArenaStack by optimization passes. This CL handles only the architecture-independent codegen and slow paths, architecture-dependent codegen allocations shall be moved to the ScopedArenaAllocator in a follow-up. Memory needed to compile the two most expensive methods for aosp_angler-userdebug boot image: BatteryStats.dumpCheckinLocked() : 19.6MiB -> 18.5MiB (-1189KiB) BatteryStats.dumpLocked(): 39.3MiB -> 37.0MiB (-2379KiB) Also move definitions of functions that use bit_vector-inl.h from bit_vector.h also to bit_vector-inl.h . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 64312607 Change-Id: I84688c3a5a95bf90f56bd3a150bc31fedc95f29c
2017-07-24ART: Include cleanup Andreas 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-20ART: Change method lookup to be more consistent to JLS and the RI. Vladimir Marko
The method lookup for different invoke types was previously widely different and didn't work well with the dex cache method array where we have only a single slot for each MethodId. The new behavior is to perform the same lookup for all cases, distinguishing only between interface and non-interface referencing class, and to further align the behavior with the JLS and the RI. Where the JLS conflicts with the RI, we follow the JLS semantics. The new lookup for class methods first searches the methods declared in the superclass chain (ignoring "copied" methods) and only then looks in the "copied" methods. If the search in the superclass chain finds a method that has not been inherited (i.e. either a private method or a package-access method where one of the classes in the chain does not belong to the same package, see JLS 8.4.8), we still search the "copied" methods as there may actually be a method inherited from an interface. This follows the JLS semantics where inherited methods are included in the search (JLS 15.12.2.1) but conflicts with the RI where the private or package-access method takes precedence over methods inherited from interfaces. Note that this search can find an accessible method that is not inherited by the qualifying type, either for a package access method when the referrer is in the same package but the qualifying type is in another package, or for a private method where the referrer is in the same class but the qualifying type is actually a subclass. For the moment we allow such calls and we shall consider whether to throw an IncompatibleClassChangeError in this situation in future to comply with JLS 15.12.4.3. The new lookup for interface methods searches the interface class, then all the superinterfaces and then the java.lang.Object class, see implicitly declared methods in interfaces, JLS 9.2. The search for the maximally-specific non-abstract superinterface method is not yet implemented, but the difference should be difficult to observe as the usual subsequent call to FindVirtualMethodForInterface() should yield the same result for any matching method. The new test 162-method-idx-clash exposes several cases where we previously completely messed up due to the effects of the DexCache, or where we were out of line with the RI. It also tests a case where the JLS and the RI disagree and we follow the JLS. Test: art/test/run-test --host --jvm 162-method-resolution Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --host --interp-ac Test: Nexus 6P boots. Test: testrunner.py --target Bug: 62855082 Bug: 30627598 Change-Id: If450c8cff2751369011d649c25d28a482a2c61a3