-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change refactors the global constants dependent on gPageSize in a way that gPageSize and dependent constants are now internal to the runtime. Also it removes static initialization dependency on gPageSize and disallows accessing gPageSize during the static initialization phase. Consequently, this removes a need in the condition check when accessing gPageSize and allows compiler to recognise the value as a constant that can be cached where used repeatedly. From this point, gPageSize should only be used within libart. For most of the other cases MemMap::GetPageSize() should be used. Where MemMap is unavailable e.g. during static initialization or another stage when MemMap isn't yet initialized, or in a component which might operate without MemMap being initialized, the GetPageSizeSlow() would be generally suitable. For performance-sensitive code, GetPageSizeSlow() shouldn't be used without caching the value to remove repeated calls of the function. - The gPageSize constant is now local to libart. Access to the variable is disallowed until Runtime is initialized, so removing the chance of static initialization order issue related to this value. The initializers for the other constants with initialization that used to depend on the gPageSize value are now referring to GetPageSizeSlow instead, so removing the static initialization dependency, and consequently, possible order issues. This removes the condition check upon each load of the gPageSize. Also as the variable is defined with "hidden" visibility, it isn't exported and so is unavailable to other DSOs. This also removes one indirection level in accessing it as GOT lookup is not required anymore. - Remove gPMDSize and gPUDSize from libartbase Move the constants to gc::Heap in form of functions computing their values. Also move the BestPageTableAlignment function dependent on the values, as it is only used within the GC. Direct accesses to gPMDSize are only performed for assertions and so replacing that with a function call shouldn't matter for performance. gPUDSize isn't accessed directly. The rest the values accesses are done via BestPageTableAlignment, which is called from: - MarkCompact constructor - MarkCompact::AddLinearAllocSpaceData - GcVisitedArenaPool::AddMap In all cases, it's performed in conjunction with MapAnonymousAligned, which involves an mmap system call. The potential slight slowdown in BestPageTableAlignment - due to the dynamic computation of the gPMDSize and gPUDSize values - is expected to be negligible in comparison to the performance cost of mmap system call. - Move gPageSize declaration and definition to the runtime / component Replace the removed uses of gPageSize outside libart with MemMap::GetPageSize() / GetPageSizeSlow(). There is one exception to the above statement in this change - in FdFile, where the page size appears to be used arbitrarily to compute the maximum buffer size: in that case replace the maximum buffer size with a constant which would have matched the value when the page size is 4K. - Make gNumLrtSlots a member variable The gNumLrtSlots global is only used within the SmallLrtAllocator class. Move it inside the class as a member variable. - Remove gStackOverflowProtectedSize global Value of the gStackOverflowProtectedSize is computed as a page size multiplied by a constant dependent on whether the address sanitizer is enabled. If address sanitizer is disabled, the constant is 1, in which case gStackOverflowProtectedSize is equal to the page size. Replace the global with an always-inlined function which is expected to expand into a simple reference to the gPageSize at each call site if the address sanitizer is not enabled. - Remove ART_PAGE_SIZE_AGNOSTIC_DECLARE_* macros The macros aren't used anymore. Remove them and GlobalConst. The tests were run for legacy 4K, page size agnostic 4K and 16K. Co-authored-by: Ruben Ayrapetyan <[email protected]> Co-authored-by: Richard Neill <[email protected]> Test: art/tools/run-gtests.sh Test: art/test/testrunner/testrunner.py --target --64 Test: art/tools/run-libcore-tests.sh --mode=device --variant=X64 Test: art/tools/run-libjdwp-tests.sh --mode=device --variant=X64 Test: cd art && mma Change-Id: I07fd85cd35dd443dee5cff0f7435ab47ba727c6f
- Loading branch information
1 parent
225de25
commit b343f66
Showing
41 changed files
with
528 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.