summaryrefslogtreecommitdiff
path: root/runtime/obj_ptr.h
Commit message (Collapse)AuthorAgeFilesLines
* Clean up explicit conversions to ObjPtr<>.Vladimir Marko2019-03-291-6/+4
| | | | | | | | | | | | Add an ObjPtr<>::DownCast() overload that takes a plain pointer and remove unnecessary calls to MakeObjPtr(), usually preceding DownCast(). Move the MakeObjPtr() to common_art_test.h . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: I2a243b6d8f3b2e773396dfc53b659c5f7d9ea44a
* ART: Clean up obj_ptr.h and obj_ptr-inl.h .Vladimir Marko2019-03-261-88/+60
| | | | | | | | | | | | | | | | Move ObjPtr<> member function definitions that depend on other functions in obj_ptr-inl.h also to the obj_ptr-inl.h. Use C++14 std::enable_if_t<> and C++17 std::is_base_of_v<>. Improve kObjPtrPoisoningValidateOnCopy code readability (avoid ternary operator). Move relational opeators to namespace scope and reimplement != as negation of ==. Also move PtrCompression<>::Compress(ObjPtr<>) to the object_reference-inl.h which includes obj_ptr-inl.h. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I5116c0e322775c19a88687f30742ef654a8be873
* ART: Use iosfwd moreAndreas Gampe2019-01-091-1/+1
| | | | | | | | | Use iosfwd where an include of ostream is unnecessary. Also move callee_save_type.h to runtime. Bug: 119869270 Test: mmma art Change-Id: Id8995d6f524e4c491eb6f57fdffb940cf35d291f
* ART: Introduce runtime_globalsAndreas Gampe2019-01-091-1/+1
| | | | | | | | | | | | | | Split libartbase's globals.h into actual globals, and runtime- dependent globals which should live in runtime. Blanket-convert all runtime/ inclusions. In future CLs, the number of global constants should be reduced. For example, GC types are only relevant to GC/alloc functionality. Bug: 119869270 Test: mmma art Change-Id: I2d8cd32e0e7ab4084d2f2e96864b5338a78da94e
* ART: Move to using locks.h instead of mutex.hAndreas Gampe2018-12-061-1/+1
| | | | | | | | When only annotating lock requirements, use locks.h. Bug: 119869270 Test: mmma art Change-Id: I1608b03254712feff0072ebad012c3af0cc3dda4
* Inline methods in ObjPtr even in debug builds.David Srbecky2018-11-281-27/+30
| | | | | | | This speeds up the debug runtime. Test: Profile app startup with the debug runtime. Change-Id: Ifbf96e3c54453e66189da6da9824c2465513b19f
* Revert^2 "Load boot image at a random address."Vladimir Marko2018-09-281-3/+1
| | | | | | | | | | | | | | | This reverts commit f3d077373536c54824e4449759dff2f18369eab3. Fixed Heap constructor to reserve extra space for GSS. Change-Id: I6a65be35f4aa183304db5491da4a4810d8e3b266 Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --relocate --no-relocate Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing --relocate --no-relocate Test: art/test/testrunner/run_build_test_target.py -j48 art-gtest-gss-gc-tlab Bug: 77856493
* Revert "Load boot image at a random address."Vladimir Marko2018-09-271-1/+3
| | | | | | | | | This reverts commit 5ad79d85d77a42456728897ac3e2e7d4530e618e. Reason for revert: Breaks GSS garbage collection config. Bug: 77856493 Change-Id: Ifa39966ac2470154f8ba093de4804689d545219b
* Load boot image at a random address.Vladimir Marko2018-09-261-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And perform in-place fixup of references and pointers. This dirties all the boot image memory loaded by zygote, so there shall be no "shared clean" boot image pages anymore, these shall change to "shared dirty". However, as we're using a profile-based boot image, these pages are presumably used often enough and unlikely to be paged out anyway. The in-place fixup takes around 60-120ms when starting the zygote on aosp_taimen-userdebug. However, an experiment with MAP_POPULATE pushes the raw fixup down to around 12-15ms. If we used compressed images, this would be the actual time for fixup as the data would be already present in memory. If we keep using uncompressed images, we shall need to tune the loading with MAP_POPULATE or MADV_WILLNEED. The -Xrelocate/-Xno-relocate option is re-interpreted from "use patchoat if needed" to "relocate the boot image in memory if possible". We do not allow relocation for the AOT compilation to speed up dex2oat execution and help producing deterministic output. The patchoat tool shall be removed in a follow-up CL. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --relocate --no-relocate Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing --relocate --no-relocate Bug: 77856493 Change-Id: I2db1fabefb5d4b85c798cd51e04c78cb232bff4a
* Clean up include pathsDavid Sehr2018-04-261-1/+1
| | | | | | | | | | Remove runtime/globals.h and make clients point to the right globals.h (libartbase/base/globals.h). Also make within-libartbase includes relative rather than using base/, etc. Bug: 22322814 Test: make -j 40 checkbuild Change-Id: I99de63fc851d48946ab401e2369de944419041c7
* Remove extra sizeof().Evgenii Stepanov2018-01-091-1/+1
| | | | | | | Improves code readability. Test: device boots Change-Id: Ia1e834b57e42343dcc5e8005a1c5b03196db50c0
* cpplint: Remove many unnecessary NOLINTIgor Murashkin2017-11-161-5/+4
| | | | | | | | Now that we updated to upstream cpplint, a lot of these NOLINTs are no longer necessary. Bug: 68951293 Change-Id: If8ed5ffe89727f313f907a214b6d8fd2a2eddbad
* ART: Change ObjPtr validationAndreas Gampe2017-10-121-2/+12
| | | | | | | | | | Do not validate for copy constructor and assignment. This is the majority of overhead in practice. Invalid ObjPtrs will still be detected when they are used. Bug: 35644369 Test: m test-art-host Change-Id: I74378afdf69164046d854a0804465b83592f0873
* Remove bits about kPoison in ObjPtr's documentation.Roland Levillain2017-08-221-1/+0
| | | | | | | | Follow-up CL to https://android-review.googlesource.com/342532. Test: mmma art Bug: 35644797 Change-Id: I86c2b74bd25e7d38a684bcb527300fb7e6e5ab29
* ART: Remove ObjPtr kPoison template parameterAndreas Gampe2017-02-221-22/+24
| | | | | | | | | | 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
* Clean up Class::GetDirectInterface().Vladimir Marko2016-12-091-9/+6
| | | | | | | | | | | | | | | | | | | Once the `klass` has been resolved, this function should not need to resolve interface types anymore. Drop the type resolution from this function and pass the Class as ObjPtr<> instead of Handle<>. Make callers that expect non-null result DCHECK() that assumption. For the callers that may actually need to resolve these interface classes, introduce a new function ResolveDirectInterface(). Also improve ObjPtr<> constructors and assignment operator to improve overload resolution. For example, if we have foo(ObjPtr<T1>) and foo(ObjPtr<T2>), calling foo(.) with a T1* would have previously been ambiguous even if T1 is not a base of T2. Test: m test-art-host Change-Id: Iff44a7285f68f0af4507fc9ba37343865422fe84
* ART: Add NOLINT to ObjPtrAndreas Gampe2016-11-041-3/+16
| | | | | | | | | | The ObjPtr constructors are constructed to allow implicit conversion. Also ensure that ObjPtr is trivially copyable. Bug: 32619234 Test: m Change-Id: I022e8d7d5a54c0057e9007bb7c13312b343c23b6
* Move most of class linker to ObjPtrMathieu Chartier2016-10-191-0/+9
| | | | | | | | | | | Return values are still mirror pointer. Fix some failing asserts in compiler driver and tests. Bug: 31113334 Test: test-art-host Change-Id: I4450bf9dfb2541749496b8388616e8aae8488919
* Move mirror::Object setters to ObjPtrMathieu Chartier2016-10-061-2/+1
| | | | | | | | Bug: 31113334 Test: test-art-host Change-Id: I2c4c84645e194c3c435a4a6fd670176b0e98671f
* Move remaining jobject related functions to use ObjPtrMathieu Chartier2016-10-061-0/+8
| | | | | | | | | | Also added ObjPtr::DownCast. Bug: 31113334 Test: test-art-host Change-Id: I59c253211dc435579ffdfd49f856861ab13d262c
* ObjPtr misc cleanupMathieu Chartier2016-10-051-4/+14
| | | | | | | | | | | Check for subtypes in constructor. Remove various calls to MakeObjPtr and ObjPtr::Ptr. Bug: 31113334 Test: test-art-host Change-Id: I8d680d514ea52cd64fc4f7c2e988926bc726174e
* Rename ObjPtr::Decode to ObjPtr::PtrMathieu Chartier2016-10-041-12/+12
| | | | | | | | | Done to prevent ambiguity with ScopedObjectAccess::Decode. Bug: 31113334 Test: test-art-host Change-Id: I07a2497cc9cf66386311798933547471987fc316
* Move ArtField to ObjPtrMathieu Chartier2016-10-031-7/+37
| | | | | | | | | | | | | | | | | | | 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
* Clean up ScopedThreadStateChange to use ObjPtrMathieu Chartier2016-09-291-13/+21
| | | | | | | | | | | | | | | 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
* Use ObjPtr for reflection.cc/h/inlMathieu Chartier2016-09-271-0/+139
Changed Pretty helpers to use this to reduce usage of Decode. The eventual goal is not have almost any calls to ObjPtr::Decode. Moved ObjPtr out of mirror namespace for convenience. Added more PoisonObjectPointers calls in class linker, thread suspension. Bug: 31113334 Test: test-art-host Change-Id: I44d08db5143d95ed1b65e2f00f9749ef5cf379f7