summaryrefslogtreecommitdiff
path: root/runtime/art_method.cc
AgeCommit message (Collapse)Author
2025-02-17Pass the instance type in the AbstractMethodError message. Nicolas Geoffray
Test: test.py Bug: 392159044 Change-Id: I01ed6971da50ea0ffc3494e00d1eb8fd78c98b02
2025-02-07Remove cdex support from `ArtMethod`... Vladimir Marko
... and a few other places in `runtime/`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 325430813 Change-Id: Ied837bffed78b1fe4c4d381772b8c1933b76f6c0
2024-11-11Revert^2 "Check that the API level is set correctly for all intrinsics" Santiago Aboy Solanes
This reverts commit ec561332d974688e1d3d0724e92ae28cc853c881. Reason for revert: For host builds, the api list might not be set correctly, leading to false conclusions. Bug: 376736704 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Test: LUCI run https://ci.chromium.org/b/8731571385634658065 Change-Id: I9ba31c5bab41d88c463c74a727412c98bd9ddddb
2024-11-08Revert "Check that the API level is set correctly for all intrinsics" Vladimír Marko
This reverts commit 8cb3e137f7ee567cfb885fcd6345e27e4b99e4a5. Reason for revert: LUCI failures. Bug: 376736704 Change-Id: Iac33a41761e99313a85be7a4ab872f24ea099267
2024-11-08Check that the API level is set correctly for all intrinsics Santiago Aboy Solanes
Remove the need of kIsDebugBuild for the DCHECK to take place. Bug: 376736704 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: Ib5ec7d7afca1150a85d5a204c3fd26c5222382cb
2024-11-07Revert^4 "IsMemorySharedMethod fix for intrinsics" Santiago Aboy Solanes
This reverts commit a5557d9da3e603a0531e566abf4d08579b9b8141. Reason for revert: Fixed adding SetHotCounter in SetIntrinsic. We are expecting both intrinsics and memory shared methods to have that set as 0 i.e. hot. Intrinsics are always considered hot, and memory shared methods use another counter. This is now DCHECKed in `Jit::AddSamples`. Changes can be seen in patchsets 1..5. I also noticed that there were comments in x86(_64) `s` files that needed to be moved to the right place. Test: art/test/testrunner/testrunner.py --host --64 -b --jit Test: No timeout in presubmit-cts-deviceside-cloud (see b/78151261) Test: No timeout in nexus_unit_test_multi_device_platform Bug: 78151261 Bug: 162110941 Change-Id: Iee99f0d42fcdb3f5ab2b20b4b7a8126c7c03b358
2024-09-24Add stack type Chris Jones
Add a stack type enum to allow thread stack methods to determine which stack they should operate on. This stack type is used to get/set the tlsPtr_.stack_<end|begin> variables. Note: these getters/ setters should always be used instead of directly using the tlsPtr_ stack variables so that both native and simulated stacks can be maintained. An additional constexpr is introduced: kQuickStackType which follows the type of the stack used for executing quick code. This is used for functions operating on the quick stack, e.g: artThrowStackOverflowFromCode which will operate on the simulated stack when running the simulator and the native stack when not running the simulator. One semantic change is also made to SetStackEndForStackOverflow by refactoring the call to UnprotectStack out and into SetStackEndForStackOverflow's only caller ThrowStackOverflowError. This is done because: - Semantically it makes sense that "SetStackEnd" should not also be implicitly unprotecting the stack. - It makes the function more consistent with the semantics of ResetDefaultStackEnd. - It simplifies making SetStackEndForStackOverflow into a template as it can be put into thread.h with no dependency on Runtime::Current. This patch aims to refactor thread stack code to allow for other types of stacks (e.g: simulated) to be better supported in future. Subsequent patches will utilise this refactor to e.g: install thread protections on a simulated stack. Test: ./test.py --host --target Test: 018-stack-overflow. Change-Id: I77c4f2a74d4226277533e1088767a1b0153c184f
2024-09-02cleanup: change Set/GetIntrinsic in ArtMethod to use Intrinsics Santiago Aboy Solanes
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I253a6bfe6bba7e02e527722c4632cb60938fe1c6
2024-08-01Rework exception delivery and deoptimization Chris Jones
Both exception delivery (various methods calling Thread::QuickDeliverException()) and deoptimization (via artDeoptimizeImpl) use QuickExceptionHandler to find the target context and do a long jump to it via QuickExceptionHandler::DoLongJump. The long jump is done directly from the C++ code, so the frames of the related C++ method are still on the stack before the change of the pc. Note that all those methods are marked as NO_RETURN to reflect that. This patch changes the approach; instead of having the long jump directly from the C++ methods related to exceptions and deoptimization, those methods now only prepare the long jump context and return. So their callers (mainly .S quick entry points and stubs) now need to do a long jump explicitly; thus there will be no C++ frames on the stack before the jump. This approach makes it possible to support exceptions and deoptimization in simulator mode; so we don't need to unwind native (C++ methods' frames) and simulated stacks at the same. Authors: Artem Serov <artem.serov@linaro.org>, Chris Jones <christopher.jones@arm.com> Test: test.py --host --target Change-Id: I5f90e6b5ba152fc2205728f1e814bbe3d609af9d
2024-06-25Remove a failing DCHECK for IAE in an edge case. Vladimir Marko
Also address some other late comments on https://android-review.googlesource.com/2146626 . Test: m test-art-host-gtest Test: testrunnerpy.py --host --optimizing Change-Id: Ib43ff9b959431e74a6ada6213780b400bbf265a2
2024-06-21Make SetEntryPointFromQuickCompileCode just update the field. Nicolas Geoffray
So that most uses that won't have zombie JIT code do not need to do compare and exchange. Test: test.py Change-Id: I40e4175a9b536177d52a21c193c7c5af7dd81d7c
2024-06-03Use compare_exchange instead of exchange when updating entrypoint. Nicolas Geoffray
Otherwise, two threads could compete updating the entrypoint with the same new JIT code (which happens in the case of JIT zygote), and we would erroneously try to add JIT zygote code to the zombie list. Test: test.py Bug: 343565030 Change-Id: I1c5cbab8d72df8c2b58b1f56def1d663e18a11f6
2024-05-28Fix a discrepancy in JNI entrypoint expectations. Nicolas Geoffray
We could be running generic JNI but have the entrypoint be a shared boot image JNI Stub. Test: 855-native Bug: 342077744 Bug: 288983053 Change-Id: Ibf798da7c10b8a8fd09e74714ed0da6db99843ef
2024-05-21Reland^3 "Revamp JIT GC." Nicolas Geoffray
This reverts commit b3d88b3f4b47b7635cbdab54dfdcbf866b9813ff. Reason for revert: Do an atomic exchange when updating an entrypoint. Change-Id: Idff00e87c2ef57d870975f7c63c06c672fd3279e
2024-05-14Faster `DexFile::FindTypeId()`. Vladimir Marko
Work with `std::string_view::compare()` instead of slower `CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues()`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 338123769 Change-Id: I4c3cc131da457c0a73f83fa2f864491eb2bc7a03
2024-05-14Add `ArtField::GetDeclaringClassDescriptor{,View}()`. Vladimir Marko
And clean up related `ArtField` and `ArtMethod` functions for dex file descriptor and name access. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 338123769 Change-Id: I3bf9c3b6135ea8e6b018ec41c93c847446918169
2024-05-03Revert "Reland^2 "Revamp JIT GC."" Nicolas Geoffray
This reverts commit eac7cd76d9a39a61c7fecbd3c3eb4f2932a3d55c. Reason for revert: Bot failure Change-Id: Ia4632c06ec88cff218d64a8087f762337cabc79e
2024-04-29Reland^2 "Revamp JIT GC." Nicolas Geoffray
This reverts commit 030a225ade89e2eaf34ac0072b6b1f9ac02ddda7. Reason for revert: Prevent zombie code being added in the middle of a JIT GC. Change-Id: I89157e4d4130896665a11a930d87635f4883db79
2024-04-22Revert "Reland "Revamp JIT GC."" Nicolas Geoffray
This reverts commit 16567ac3d6925c0b84c819f2e475c2cadbde5dc3. Reason for revert: Flakes on bots. Change-Id: Ibfc5280132425318c1669e04c77822a95f62bacd
2024-04-18Reland "Revamp JIT GC." Nicolas Geoffray
This reverts commit de8e6689cb3f829b73e921d843cfa38bbfe996bf. Reason for revert: - Adjust test for new behavior - Enter MarkCompiledCodeOnThreadStacks with the mutator lock, as expected by the checkpoint. Change-Id: Ic9fca3e5fd04da62081701f4deccbc68bee56c2f
2024-04-17Revert "Revamp JIT GC." Nicolas Geoffray
This reverts commit f9bde507475075b52e5b1a5665c0fde9aa9215c6. Reason for revert: Bot failures. Change-Id: Ic689cf199f3bdd15c7358daa311bc0d90e9a2d7d
2024-04-15Revamp JIT GC. Nicolas Geoffray
Run it after a threshold of compiled code that entered zombie state, ie are not entrypoints anymore. Tet: test.py Change-Id: Ifbccda5881be6cf3e11d6772d4c4f64b3e9db698
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-04-08Move some code from `ArtMethod` to run-test 664. Vladimir Marko
The code was originally introduced in https://android-review.googlesource.com/181131 but it has not been used outside testing since https://android-review.googlesource.com/1216803 . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I22f44e13d96f891a5a5c631def78d7604c7f85bf
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
2024-01-18Add visibility attributes in runtime/a* Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Iacec568941c5baee57088e67ed410ba18f6abff2
2023-10-27Log information about JITed JNI stubs in GetOatQuickMethodHeader Mythri Alle
We added some logs to debug crashes in GetOatQuickMethodHeader. Crashes from b/307702425 suggest that the method failing the check is a native method. So also log JITed JNI stubs to identify the problem. Test: art/test.py Change-Id: I7f92f88be4fe86aa3ca1b1e5dcd83096f54113ff
2023-10-26Make few checks debug only in GetOatQuickMethodHeader Mythri Alle
https://android-review.googlesource.com/2796296 Added more information to debug crashes in tests but made these checks enabled for non-debug builds too. These started causing crashes so making them debug only checks. Ideally these shouldn't fail but making them debug only while we look into the root cause of these failures. Bug: 307702425 Test: art/test.py Change-Id: I2693401383fcb2a8e22737816bed9057d08428f8
2023-10-20Add more debug info for recent flakes in run-test. Nicolas Geoffray
Test: test.py Change-Id: I6fddea822c0b2a83a10311363203c05314adb29d
2023-10-13Add debugging output to ArtMethod::GetOatQuickMethodHeader. Nicolas Geoffray
Test: test.py Change-Id: I983a8c5386f424a789db93f823202cd945f04567
2023-10-10Add debugging info for crash on bots. Nicolas Geoffray
Test: test.py Change-Id: I08674ce18031c3bb0cfdd150e3265132f7f946a7
2023-09-29Use OatQuickMethodHeader::IsStub for finding entry points. Nicolas Geoffray
This is needed for the pattern match compiler, where we set C++ methods as ArtMethod entrypoints. Test: test.py Change-Id: I488253bda374f460590c02a459af85a3842ef0cc
2023-08-08Add `ArtMethod::GetShortyView()`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I2d1a8309c7417d6cdf545b0d036e1a29c721d25c
2023-07-06Remove code related to quicken Santiago Aboy Solanes
It was obsolete (and in some cases dead code). Update our code to use `verify` instead of `quicken` for compiler filters. Bug: 289199192 Change-Id: I39048d50b4d8a3f48e0e88e752a2fd7ad73559a7
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-07Pass read barrier option to `ArtMethod::GetObsoleteDexCache()`. Vladimir Marko
This is needed for calling `PrettyMethod()` from contexts where read barrier is not allowed, for example when removing methods in `JitCodeCache::RemoveMethodsIn()`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I9465239137e51c1208b25790e503ba0d20cb9a94
2022-07-07Fix one edge case at method linking to throw at runtime. Nicolas Geoffray
If we could not find a public implementation for a public method, throw an IllegalAccessError at runtime, when the method is actually called, instead of when the class is being created. Test: 840-resolution Test: 182-method-linking Change-Id: I741c7d0f6fc3b90a5d1614e1a9b76985a2eb32e2
2022-07-07Introduce a nterp with clinit check entrypoint. Nicolas Geoffray
It will be used post-zygote fork, so that methods whose class is not initialized yet keep the same entrypoint even after initialization. This avoids dirtying shared pages. Test: imgdiag Bug: 162110941 Change-Id: Idb861f23b368604e79f6d3efa7ad0dff287e0209
2022-06-21Remove stack protector from some interpreter functions Chris Wailes
This CL removes stack protection from several functions in the interpreter to allow us to re-set the stack protector cookie when new processes fork from any of the zygotes. Test: boot Test: atest UidAtomTests Bug: 236398669 Bug: 236399082 Bug: 168258494 Change-Id: I4c9db1934b848b60d636bb82b6855c8a8a6e8383
2022-06-17Revert "Remove stack protector from some interpreter functions" Chris Wilson
Revert submission 2099076-stack-protector-2022 Reason for revert: CTS failures b/236399082 Reverted Changes: Id65d0d96b:Remove stack protector from some interpreter funct... Ia68cd0bf5:Reset stack guard after fork from Zygote Bug: 236399082 Change-Id: Ic32449e4db3fe2499bb5669c6d9c23ad9943f89f
2022-06-17Remove stack protector from some interpreter functions Chris Wailes
This CL removes stack protection from several functions in the interpreter to allow us to re-set the stack protector cookie when new processes fork from any of the zygotes. Test: boot Bug: 168258494 Change-Id: Id65d0d96b028599f27f74c25e279a03b85e52651
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-05-04Revert "Reland "Don't use AOT code for native methods for java debuggable ↵ Mythri Alle
runtime""" This reverts commit 9d1413803e5be6746264e47b951e02f409c100a3. Reason for revert: Failures mostly on 096-array-copy-concurrent-gc but also a couple of others. Example failure: https://logs.chromium.org/logs/art/buildbucket/cr-buildbucket/8815176149292612577/+/u/test_debuggable/stdout Change-Id: Ia197d6094b4a4a744c7da5f120b59597db11747c
2022-04-29Reland "Don't use AOT code for native methods for java debuggable runtime"" Mythri Alle
This reverts commit 249e881d3990a625f68b2d942c723e8fbd4d41a5. Reason for revert: Reland after a fix. We should keep the behaviour of boot class profiles same w.r.t. native methods i.e. continue using AOT code for native boot class methods. The original CL changed this behaviour which causes problems because instrumentation doesn't consider this when deciding if AOT code could be used. These two should be in sync. Change-Id: Id5e2dff41589622d9f1c8ca0f5619f0971ffe2a5
2022-04-27Revert "Don't use AOT code for native methods for java debuggable runtime" Mythri Alle
This reverts commit 7d30cee9872527ecedb07dc32099e24cf4a657ce. Reason for revert: https://android-build.googleplex.com/builds/submitted/8501823/art-tracing/latest/view/logs/build_error.log Change-Id: Ibdd3abcd468573193d293db20c84941d3517948d
2022-04-26Don't use AOT code for native methods for java debuggable runtime Mythri Alle
For java debuggable runtimes we need the capability to deoptimize the caller to support debug features such as method redefinitions. To support this we need the ability to call method entry / exit hooks. Currently this is supported by instrumenting the stack by updating the return pcs to instrumentation return pcs and installing instrumentation entry points. This adds additional complexity when walking the stack and in other places. We want to avoid this by adding capability to call method entry / exit hooks directly from JITed code / generic stubs. For generic stubs it is OK to check if method entry / exit hooks are required always since generic stubs are on slow path anyway. For JITed code we would enable this support only for debuggable runtime to avoid any overhead for regular runtime. Since AOT compiled code doesn't have the capability to call method entry / exit hooks we want don't want to use them for debuggable runtime. For non-native methods we don't use AOT code This CL avoids using AOT code for native methods too. Test: art/test.py Bug: 206029744 Change-Id: I566401ebea6d866e818287ede6f000876cb24240
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