summaryrefslogtreecommitdiff
path: root/runtime/handle_scope-inl.h
AgeCommit message (Collapse)Author
2024-01-18Add visibility attributes in runtime/h* Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: I80d3813691880564c1e7b641db0af3372f41e8e6
2023-11-20Do not create `MethodType` during early init... Vladimir Marko
... when interpreting `VarHandle` invoke-polymorphic. Use `VariableSizedHandleScope` as a raw method type that can be converted to the managed `MethodType` when desires but can also be used directly without the conversion. Add helper templates that facilitate using either the raw method type or the managed `MethodType` easily by templated code. Change `VarHandleInvokeAccessorWithConversions()` to avoid allocating the `MethodType` (avoid unnecessary work). Change `VarHandle` invokes in the interpreter to avoid allocating the `MethodType` when the `ThreadLocalRandom` is not initialized. This can avoid circular initialization when we reland https://android-review.googlesource.com/2769639 . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 297147201 Change-Id: I6a9372543a547366b28e5bf49d15d6140a75f770
2023-11-13Clean up `HandleScope`. Vladimir Marko
Implement `Size()` and rename `NumberOfReferences()` to `Capacity()`. Replace `Capacity()` with `Size()` where appropriate, for example to avoid visiting unused slots. Remove some obsolete dead code and move some functions from `FixedSizeHandleScope<.>` to `HandleScope`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I1e49fb6144f77692ff22c6fbd0578d995b5a01f1
2023-02-01Reland "Write classes in runtime-generated app image." Nicolas Geoffray
This reverts commit 24b3d648ff6c2c200003f55ac63fc910d7bfd40f. Bug: 260557058 Reason for revert: - Encode class loader context in image, and check it at load time. - Set nterp entrypoint to methods that can. Test: test.py Test: atest com.android.bluetooth.opp.BluetoothOppObexServerSessionTest#onPut_withUnsupportedMimeTypeInHeader_returnsHttpBadRequest Change-Id: Ibf4a8604c4a226d1acc021103668e211446bb53c
2023-01-29Revert "Write classes in runtime-generated app image." Sam Saccone
This reverts commit df68c0a6f0d36728fa728049e5bcec20de2d0d5e. Reason for revert: b/267084527 Change-Id: I2eacf89c23db00c46d56e78009efa11bed31af60
2023-01-28Write classes in runtime-generated app image. Nicolas Geoffray
Test: 845-data-image Bug: 260557058 Change-Id: I640b78942984ac3d3f8d24abda619d78154acd86
2021-06-01Avoid race on Thread::tlsPtr_::top_handle_scope. Vladimir Marko
Require mutator lock for that field and update tests to hold the mutator lock when needed. This prevents GC thread that executes a thread roots flip on behalf of suspended threads from racing against construction or destruction of handle scopes by those threads and possibly seeing invalid values. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 189439174 Change-Id: I268a0ef6e5aa838347956febca0d3b6e02fe3ae5
2021-01-13Minor formatting fixes in handle_scope-inl.h Alex Light
Change-Id: I76139d78303627b83649b0528ee055901e36f952 Test: None
2021-01-12Support null-filled HandleScopes without mutator_lock_ Alex Light
Creating a HandleScope used to always require (via assert) the mutator_lock_ be held. When the scope is filled with null (as it normally is) this is not needed however. Test: ./test.py --host Change-Id: I47acbcaeafc7617f264233a5ab869eded6a22473
2020-02-12Use stack for first scope in VariableSizedHandleScope Mathieu Chartier
VariableSizedHandleScope commonly doesn't have that many handles, avoid doing an allocation for those cases. Test: test-art-host Change-Id: Iaf6c502723a239b1a2e861152efa37f4ef66431b
2019-05-24Partially ObjPtr<>-ify HandleScope. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --interpreter Bug: 31113334 Change-Id: I560683b5345bda9df4b22903d032b593d6c2dd4f
2019-01-09ART: IWYU handle_scope Andreas Gampe
Move wrappers to their own header. Forward-declare handles. Bug: 119869270 Test: m Change-Id: I9fba4df9b589cec07c7f687791ddbed81d188410
2018-10-23ART: Refactor for bugprone-argument-comment Andreas Gampe
Handles runtime. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: Ibc0d5086809d647f0ce4df5452eb84442d27ecf0
2017-06-02ART: Introduce thread-current-inl.h Andreas Gampe
Factor out Thread::Current() code into its own -inl file to remove transitive includes. This requires at the same time correcting mutex.h, i.e., moving some functions into mutex-inl.h. Test: m test-art-host Change-Id: I88f888b604e0897368d9b483edce6ce4332dd9c9
2017-02-22ART: Remove ObjPtr kPoison template parameter Andreas Gampe
Move to a global constexpr, so that object pointer poisoning can be explicitly turned off for lower debug build overhead. Bug: 35644797 Test: m Test: m test-art-host Change-Id: I2412b67cbec144f2aee206fb48591abe581fd00a
2017-02-03ART: Refactor verify_object.h Andreas Gampe
Move the actual VerifyObject check into a new cc file, as we commonly don't enable the check at all. This allows to cut the -inl include from almost all current users. This also exposes missing -inl includes. Also fix up some of our old mess where .h defined functions require -inl.h defined functions. Test: m Change-Id: I3dd821bbe2015564a29bf1ed9be00f7a7276ad61
2016-10-12Replace StackHandleScopeCollection with VariableSizedHandleScope Mathieu Chartier
VariableSizedHandleScope's internal handle scopes are not pushed directly on the thread. This means that it is safe to intermix with other types of handle scopes. Added test. Test: clean-oat-host && test-art-host Change-Id: Id2fd1155788428f394d49615d337d9134824c8f0
2016-10-04Rename ObjPtr::Decode to ObjPtr::Ptr Mathieu Chartier
Done to prevent ambiguity with ScopedObjectAccess::Decode. Bug: 31113334 Test: test-art-host Change-Id: I07a2497cc9cf66386311798933547471987fc316
2016-10-03Move ArtField to ObjPtr Mathieu Chartier
Added EXPECT_OBJ_PTR_EQ and variants to gtests. Fixed moving GC bugs in: ClassLinker::CreatePathClassLoader ClassLinkerTest: StaticFields ObjPtr Decode call sites: 186 -> 181. Some tests fail due to ResolvedFieldAccessTest, will fix in follow up CL. Bug: 31113334 Test: test-art-host CC baker Change-Id: I8b266ad00f3c20c8cbe7cfdf280d175083df0b88
2016-09-29Clean up ScopedThreadStateChange to use ObjPtr Mathieu Chartier
Also fixed inclusion of -inl.h files in .h files by adding scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h Changed AddLocalReference / Decode to use ObjPtr. Changed libartbenchmark to be debug to avoid linkage errors. Bug: 31113334 Test: test-art-host Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
2016-08-01ART: Convert pointer size to enum Andreas Gampe
Move away from size_t to dedicated enum (class). Bug: 30373134 Bug: 30419309 Test: m test-art-host Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
2015-08-28Fix some HandleScope bugs and add corresponding checks Mathieu Chartier
Some places were creating or destroying handle scopes without holding the mutator lock. This can cause GC crashes if thread roots are being marked or hprof dumps to also fail. Also added checks to catch some of these errors. Bug: 23468617 Change-Id: I1a2d615923484cfc25014967656775c445aa3f1f
2015-01-09Fix HandleScope with wrong thread error Mathieu Chartier
Possibly fixes +art F 5127 6995 art/runtime/handle_scope-inl.h:43] Check failed: top_handle_scope == this (top_handle_scope=0x2b449293c770, this=0x2b4492d6a0a8) Seen in tests. A possible cause was that the thread dumping stacks was running checkpoints on a suspended thread but putting a HandleScope on that thread instead of itself. This isn't safe if the suspended thread is doing HandleScope stuff in a non runnable state. Change-Id: Icdaadabca5aff8d380d5cc9570b9e899fe790a62
2015-01-08Add VerifyObject to StackHandleScope::SetReference Mathieu Chartier
Helps catch GC bugs. Also moved some of the HandleScope logic to the inl file. Bug: 13054004 Change-Id: I81b9dd717092b6a467fcd28b4df0089ec075dd44
2014-11-03ART: Replace COMPILE_ASSERT with static_assert (runtime) Andreas Gampe
Replace all occurrences of COMPILE_ASSERT in the runtime tree. Change-Id: I01e420899c760094fb342cc6cb9e692dd670a0b2
2014-10-27Optimize method linking Mathieu Chartier
Added more inlining, removed imt array allocation and replaced it with a handle scope. Removed some un-necessary handle scopes. Added logic to base interface method tables from the superclass so that we dont need to reconstruct for every interface (large win). Facebook launch Dalvik KK MR2: TotalTime: 3165 TotalTime: 3652 TotalTime: 3143 TotalTime: 3298 TotalTime: 3212 TotalTime: 3211 Facebook launch TOT before: WaitTime: 3702 WaitTime: 3616 WaitTime: 3616 WaitTime: 3687 WaitTime: 3742 WaitTime: 3767 After optimizations: WaitTime: 2903 WaitTime: 2953 WaitTime: 2918 WaitTime: 2940 WaitTime: 2879 WaitTime: 2792 LinkInterfaceMethods no longer one of the hottest methods, new list: 4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>) 3.07% art::DexFile::FindClassDef(char const*) const 2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int) 2.90% art::DexFile::FindStringId(char const*) const Bug: 18054905 Bug: 16828525 (cherry picked from commit 1fb463e42cf1d67595cff66d19c0f99e3046f4c4) Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321
2014-10-10Work around ICE bugs with MIPS GCC and O1. Ian Rogers
Also, work around GCC warning bugs where array accesses with explicit bounds checks are flagged as being out-of-bounds. Significantly, clean-up the HandleScope so the array accesses don't appear out-of-bounds at compile time. Change-Id: I5d66567559cc1f97cd0aa02c0df8575ebadbfe3d
2014-07-16Remove object_utils.h. Ian Rogers
Break into object_lock, field_helper and method_helper. Clean up header files following this. Also tidy some of the Handle code in response to compiler errors when resolving the changes in this CL. Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
2014-06-04Fix compiler warnings. Mathieu Chartier
Added GetReference, GetHandle to StackHandleScope to prevent the compiler from optimizing away these loads/stores from inline functions. Change-Id: I4db02dd3194665d844292e74e3a7d7c80e730e06
2014-05-14Address comments from HandleScope change. Mathieu Chartier
For: https://android-review.googlesource.com/#/c/93793 Change-Id: I020d22a1508bf4f1770e6806d70e4fbb9a0fa0ab
2014-05-13Add Handle/HandleScope and delete SirtRef. Mathieu Chartier
Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a