diff options
author | 2018-09-03 09:54:09 +0100 | |
---|---|---|
committer | 2018-09-26 13:08:36 +0100 | |
commit | 5ad79d85d77a42456728897ac3e2e7d4530e618e (patch) | |
tree | ff70d1f12904c718f2f3f721d3846f4305eae53d /runtime/mirror/executable.h | |
parent | 5d7015cd64085068b1685d44339b4b705ef3f065 (diff) |
Load boot image at a random address.
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
Diffstat (limited to 'runtime/mirror/executable.h')
-rw-r--r-- | runtime/mirror/executable.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/runtime/mirror/executable.h b/runtime/mirror/executable.h index bf66d7952a..14c9d4c96f 100644 --- a/runtime/mirror/executable.h +++ b/runtime/mirror/executable.h @@ -18,7 +18,7 @@ #define ART_RUNTIME_MIRROR_EXECUTABLE_H_ #include "accessible_object.h" -#include "object.h" +#include "object-inl.h" #include "read_barrier_option.h" namespace art { @@ -36,10 +36,19 @@ class MANAGED Executable : public AccessibleObject { bool CreateFromArtMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); - ArtMethod* GetArtMethod() REQUIRES_SHARED(Locks::mutator_lock_); - // Only used by the image writer. - template <bool kTransactionActive = false> - void SetArtMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); + template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags> + ArtMethod* GetArtMethod() REQUIRES_SHARED(Locks::mutator_lock_) { + return reinterpret_cast64<ArtMethod*>(GetField64<kVerifyFlags>(ArtMethodOffset())); + } + + template <bool kTransactionActive = false, + bool kCheckTransaction = true, + VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags> + void SetArtMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) { + SetField64<kTransactionActive, kCheckTransaction, kVerifyFlags>( + ArtMethodOffset(), reinterpret_cast64<uint64_t>(method)); + } + mirror::Class* GetDeclaringClass() REQUIRES_SHARED(Locks::mutator_lock_); static MemberOffset ArtMethodOffset() { |