Commit fbbfa7ea authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

Orderfile: Simplify prefetch logic.

The current logic in library_loader_hooks.cc for when to fork and
prefetch the native library has gotten complicated. This CL simplifies
it to current best practice: The prefetching is always done, restricted
to the ordered code if --orderfile-memory-optimization is set.

Bug: 758566
Change-Id: I86ecfff37b18eb7bda1edadfa5399db97b8be53e
Reviewed-on: https://chromium-review.googlesource.com/1095256Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567274}
parent 2c68fcee
......@@ -211,13 +211,8 @@ static void JNI_LibraryLoader_ForkAndPrefetchNativeLibrary(
JNIEnv* env,
const JavaParamRef<jclass>& clazz) {
#if BUILDFLAG(SUPPORTS_CODE_ORDERING)
if (!ShouldDoOrderfileMemoryOptimization() ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kForceNativePrefetch)) {
NativeLibraryPrefetcher::ForkAndPrefetchNativeLibrary(
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNativePrefetchOrderedOnly));
}
return NativeLibraryPrefetcher::ForkAndPrefetchNativeLibrary(
ShouldDoOrderfileMemoryOptimization());
#endif
}
......
......@@ -116,12 +116,6 @@ const char kEnableCrashReporterForTesting[] =
// given in base/android/library_loader/anchor_functions.h, via madvise and
// changing the library prefetch behavior.
const char kOrderfileMemoryOptimization[] = "orderfile-memory-optimization";
// Force prefetching of the native library even if otherwise disabled, eg by
// --orderfile-memory-optimization.
const char kForceNativePrefetch[] = "force-native-prefetch";
// If prefetching is enabled, only prefetch the ordered part of the native
// library. Has no effect if prefetching is disabled.
const char kNativePrefetchOrderedOnly[] = "native-prefetch-ordered-only";
#endif
} // namespace switches
......@@ -44,8 +44,6 @@ extern const char kEnableCrashReporterForTesting[];
#if defined(OS_ANDROID)
extern const char kOrderfileMemoryOptimization[];
extern const char kForceNativePrefetch[];
extern const char kNativePrefetchOrderedOnly[];
#endif
} // namespace switches
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment