summaryrefslogtreecommitdiff
path: root/runtime/common_dex_operations.h
AgeCommit message (Collapse)Author
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-01-24Add visibility attributes in runtime/c* Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Id729aca1d8b6d003ff3e9755112f3283e9f2b507
2023-01-17Remove one template argument to the switch interpreter. Nicolas Geoffray
Dynamically check for SkipAccessChecks instead. arm64 apex goes from 49545216 bytes to 49324032, ~200KB savings. Test: test.py Change-Id: Iaa64f56485b15c0e3c0eaa31e469a2795035debe
2022-12-12Fix clinit debug check in instrumentation. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit --interpreter Change-Id: Idae620b0b8f9ed67574f5b785fdac3efcb534cfd
2022-09-13Reland "Ensure we initialize before pushing the method invoked." Nicolas Geoffray
This reverts commit b96054f6f3704dcb039af56532b2ce10896e2b81. Reason for revert: Works now that https://android-review.googlesource.com/c/platform/art/+/2209538 is submitted. Change-Id: I0df2407ecac74df736f9ab23a7b519fcce82192f
2022-08-05Revert "Ensure we initialize before pushing the method invoked." Lokesh Gidra
This reverts commit 9f1a9bcfa320de7b4409cfd85cbe9b192c022f06. Reason for revert: Just to confirm if it resolves presubmit tests on the userfaultfd GC CLs (topic uffd-gc). This CL definitely causes art-test failures (with uffd GC) on local tests due to double reference to same shadow-frame on mutator stack. Test: test/testrunner/testrunner.py --host --debug --interpreter --gcstress Change-Id: I69affec203416aceb6f77e1ea2d1ec9bb1add6a6
2022-07-06Ensure we initialize before pushing the method invoked. Nicolas Geoffray
Test: 839-clinit-throw Change-Id: I4571d2445bc3f3a35fe27757208cfc7bcee4a801
2019-10-07Revert^4 "Walk internal ArtField/ArtMethod pointers" Alex Light
Several of the new tests make use of the invoke-custom opcode. This opcode is not supported by dexter/slicer causing the tests to fail. This reverts commit c34eab45161c51bf63e548e44645cbcc59d01268. Reason for revert: Added tests to redefine-stress known failures Test: ./test.py --host --redefine-stress Bug: 134162467 Change-Id: Ic1b375a0cb1e44d0252c17115af92c269fb8efc5
2019-10-07Revert "Revert^2 "Walk internal ArtField/ArtMethod pointers"" Nicolas Geoffray
This reverts commit ea2a3d949354c8b054983ba629c81bc5ff7163da. Bug: 134162467 Reason for revert: Fails redefine stress Change-Id: If487c0bcacaf3a3f565ff475b6dad8321e3428b9
2019-10-04Revert^2 "Walk internal ArtField/ArtMethod pointers" Alex Light
This reverts commit 712fa800b2b78e527d36c88dc369bf4b723587ea. We incorrectly didn't check if a method was obsolete before giving its class's MethodIds array. We then incorrectly used this array and the (placeholder) -1 index to try to find the previous method-id. Since -1 is not a valid array index we got check failures. To fix this we simply added a check that the method is not obsolete and if it is we go to the slow-path. Reason for revert: Fixed issue causing out-of-bounds array access Test: ./test.py --host --debuggable --ndebuggable Bug: 134162467 Change-Id: Iaffefeab6e889b4fb6554a11452d0af051001cb7
2019-10-04Revert "Walk internal ArtField/ArtMethod pointers" Nicolas Geoffray
This reverts commit c84fc3a742b160ce51cbf01c2e5f971ccc0a2c6c. Bug: 134162467 Reason for revert: Test fails on debuggable. Change-Id: I240d58fafcc7434749947330b64c67d65b9b7a1e
2019-10-03Walk internal ArtField/ArtMethod pointers Alex Light
During structural class redefinition we sometimes need to update some of the ArtMethod/ArtField pointers held by runtime frames. This adds support for doing this through a StackReflectiveHandleScope similar to the StackHandleScope used for holding object references. This also updates various places where reflective-handles to ArtMethods and ArtFields are needed, for example the JniIdManager, field Read/Write operations and events, field resolution, and the old debugger. Test: ./test.py --host Bug: 134162467 Change-Id: I4ea73e85956a07735c6d7b125c5828a4233670bc
2019-06-10JVMTI Force early return Alex Light
Add support for can_force_early_return jvmti capability. This allows one to force java frames to exit early. Exited frames have all of their normal locks released. We implement this by modifying the existing method exit events to allow one to modify the exit value during the callback. This is used to implement ForceEarlyReturn by adding internal-only events that will change the return value of methods once they return (using kForcePopFrame) avoiding the need to modify the actual interpreter very deeply. This also makes it simple to continue to use the standard deoptimization functions to force the actual return. In order to simplify book-keeping the internal event is refcounted, not associated with any specific jvmtiEnv, and only settable on specific threads. The internal event is added by the ForceEarlyReturn function and then removed by the MethodExit event when we update the return value. Bug: 130028055 Test: ./test.py --host Change-Id: Ifa44605b4e8032605f503a654ddf4bd2fc6b60bf
2019-05-08ObjPtr<>-ify instrumentation. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --interpreter Bug: 31113334 Change-Id: I95d9e1c9c9a0c9e460048c686c229618126b66d5
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-06ART: Move to using locks.h instead of mutex.h Andreas Gampe
When only annotating lock requirements, use locks.h. Bug: 119869270 Test: mmma art Change-Id: I1608b03254712feff0072ebad012c3af0cc3dda4
2018-10-11Revert^4 "JVMTI PopFrame support" Alex Light
This reverts commit 202b617acf477e8e8e11915f467120a0bd518e74. This unreverts commit 202b617acf. This unreverts commit 88a2a9d7a1. There were several bugs with the implementation of pop-frame related to interactions between the jit, exception handling, class-loading, and deoptimization. - We were instrumenting the target thread stack in cases where it was unnecessary which caused the exception handler to incorrectly determine that a method was not deoptimizable. This caused the pop-frame to be ignored. - We were incorrectly sending ExceptionCatch events if an exception suppressed by pop-frame would have been caught in the current frame. - We were allowing pop-frame to be used on threads suspended in the ClassLoad or ClassPrepare events despite having surprising semantics in that situation (see b/117615146). Needed to modify test 1953 slightly for inclusion in CTS. I needed to make the CTS entrypoint not run the class-load tests (since the cts configuration means the classes are loaded by the verifier and not the interpreter). I updated the expected.txt and check script to reflect this. Reason for revert: Fixed issue causing Exception events to sometimes eat PopFrame and other issues. Test: ./test.py --host Test: ./art/tools/run-libjdwp-tests.sh --mode=host Bug: 73255278 Bug: 111357976 Bug: 117533193 Bug: 117615146 Change-Id: I655c4fe769938cf41d7589f931d6710cf2001506
2018-10-10Revert "Revert^2 "JVMTI PopFrame support"" Nicolas Geoffray
This reverts commit 1c7b1fcf0ff29d83d13d38d0451a54474ccf5964. Bug: 73255278 Bug: 111357976 bug: 117533193 Reason for revert: Test failures Change-Id: I9da863fd95264007c4efeb85539e704e83499dcf
2018-10-08Revert^2 "JVMTI PopFrame support" Alex Light
This reverts commit f67d0cbf2743b29aa6e1be7ae2f71762b8762785. Redefine-stress causes classes to be loaded at slightly different places due to the deep verification needed to redefine a class. This would cause the parts of tests 1953 and 1954 to fail due to classes loading at unexpected times. We changed the test to skip these test-cases when they cannot be correctly executed. Reason for revert: Fixed issue causing tests to fail under redefine-stress Test: ./test.py --host Test: ./art/tools/run-libjdwp-tests.sh --mode=host Test: ./test/testrunner/testrunner.py --host --redefine-stress Bug: 73255278 Bug: 111357976 Change-Id: I46fb4aed878bcc9398f2b73ad5040d7c97aec3ef
2018-10-05Revert "JVMTI PopFrame support" Alex Light
This reverts commit 88a2a9d7a14b67e10525d93b0ee57d9dd6bc345a. Reason for revert: Fails class-load/prepare tests with jit-at-first-use. Bug: 73255278 Bug: 111357976 Test: None Change-Id: Id8dea6dcf124d56e3a8dfa19e6ed39cc70370c34
2018-10-04JVMTI PopFrame support Alex Light
Implement support for the JVMTI can_pop_frames capability. This works by marking shadow-frames with a bit that forces it to be popped or an instruction to be retried. When a PopFrame is requested the plugin will deoptimize the targeted thread and force the interpreter to deal with the frame pop. If the can_pop_frames capability is enabled the runtime will be forced to handle all exceptions through the interpreter. This is required to support PopFrame during some exception events. Test: ./test.py --host Test: ./art/tools/run-libjdwp-tests.sh --mode=host Bug: 73255278 Bug: 111357976 Change-Id: I62d6b1f4ff387c794ba45093c3d6773aaf642067
2018-05-23ART: Fix missing field type crasher Orion Hodson
Avoids nullptr dereference when a field with a missing field type is assigned. Bug: b/79751666 Test: art/test.py --host -r -t 173 Change-Id: I5868793f57802ed3de60264eefa7eb98845ae126
2018-05-16ART: Fix jvalue includes Andreas Gampe
JValue::SetL is defined in the -inl header. Fix up some clients. Test: mmma art Change-Id: I903532c767873847f7746680cf35083cb3408ecf
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-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-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-06Refactor ArtField::GetType<>() as {Lookup,Resolve}Type(). Vladimir Marko
And add no thread suspension assertion to LookupType() as well as ArtMethod::LookupResolvedClassFromTypeIndex(). Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: If1541ccb0aafeabb6d1dd5566f10afcac98a2ef1
2017-10-23ART: Correct static invariant checks Andreas Gampe
Instances of initializing classes may leak to other threads. It is legal to execute methods and access fields, as long as they are not static. However, the class should still be initializing (or already be erroneous). Replace checks with this weaker invariant. Follow-up to commit 4e99b3d8955131f3fc71aa113f0fa71f0092cb6f. Bug: 15899971 Bug: 62478025 Bug: 67719550 Test: m test-art-host Change-Id: I63190253759df95ca54e40fd4117a24e12e0c069
2017-10-23ART: Fix headers Andreas Gampe
Include required headers. Test: m Change-Id: Ifce6c7b7a977c8db8eb4bb5ca34e354566d552bb
2017-07-29Read and write constraints for clinit Chang Xing
For clinits executed during pre-compile within a transaction, they are constrained to only be able to access their own static fields because the results of iniitialization relying on static fields, either read or write, of other classes are runtiime determined. Further discussion can be found at b/62887449. When SGET and SPUT series instructions are executed, interpreter will check whether fields are static and does the target match with the transaction owner, if not, abort transaction and throw an exception. Test: make test-art-host -j64 Bug: 62887449 Change-Id: I3e655269c8af5f0b3f2c1841fdd2602c827c2757
2017-06-19Add field access & modify JVMTI callbacks Alex Light
This adds support for the FieldAccess and FieldModification callbacks in JVMTI and all other functions and behaviors associated with the can_generate_field_modification_events and can_generate_field_access_events capabilities. Tests follow in the next CL. Bug: 34409228 Test: ./test.py --host -j40 Change-Id: Id18fc53677cc1f96e1460c498ade7607219d5a79
2017-05-25Stop interpreter from accessing code items of compiled code. Jeff Hao
The ArtInterpreterToCompiledCodeBridge accesses the code item in a number of places to handle argument marshalling. However, the code item of a compiled method should have no need to be accessed by the runtime at all, since the code has been compiled. By removing these accesses, there is a drop in the memory footprint of the dex file, since these code items remain untouched by the runtime. Includes fixes for JIT and deopt. For Maps: Systrace vdex memory usage: 19.4/33.4MB -> 18.8/33.4MB Dumpsys meminfo vdex PSS: 9371kB -> 9275kB Bug: 35800981 Test: mm test-art-host Change-Id: I3bf17f8866287d9a8f127c16da23bebb801456dc
2017-05-18Revert "Stop interpreter from accessing code items of compiled code." Nicolas Geoffray
The entrypoint of a method can change concurrently. Bug: 35800981 This reverts commit 178dce79220c16e6f0061bcd12e9e9683ec045ee. Change-Id: I25ae8d0d2830eb8412c52f61736bac7b16281c11
2017-05-16Stop interpreter from accessing code items of compiled code. Jeff Hao
The ArtInterpreterToCompiledCodeBridge accesses the code item in a number of places to handle argument marshalling. However, the code item of a compiled method should have no need to be accessed by the runtime at all, since the code has been compiled. By removing these accesses, there is a drop in the memory footprint of the dex file, since these code items remain untouched by the runtime. Maps Vdex Memory Usage: 19.4/33.4MB -> 18.8/33.4MB Bug: 35800981 Test: mm test-art-host Change-Id: I147a9267ec022547b384374e1449d20bcab1ead2
2017-03-09Revert "Stop interpreter from accessing code items of compiled code." Nicolas Geoffray
Bug: 35800981 This reverts commit df79ddb545f0d6e71d6eebb9cb94aa6916351ee9. Change-Id: I04b1cb8d002ca330c0aa6e68b431c7f80c2779d6
2017-03-09Stop interpreter from accessing code items of compiled code. Jeff Hao
The ArtInterpreterToCompiledCodeBridge accesses the code item in a number of places to handle argument marshalling. However, the code item of a compiled method should have no need to be accessed by the runtime at all, since the code has been compiled. By removing these accesses, there is a drop in the memory footprint of the dex file, since these code items remain untouched by the runtime. Bug: 35800981 Test: mm test-art-host Change-Id: Ib7d29c17e80b1690aa819d083f5b12739492ebd6
2017-01-06ART: Make method handle runtime code callable from compiler. Orion Hodson
Most of this change is moving the existing method handles code, but it also introduces a new header file, common_dex_operations.h, that has some operations taken from interpreter_common.{h,cc} that are also used by method handles (perform call, set field, get field). Bug: 30550796 Test: m test-art-host Change-Id: I2235e13770a5562950f2767f65a25ca273479150