Revert "[framework] Compile secondary dex files in isolation"

This reverts commit 8a5a708df1.
ART does not compile secondary dex files in the user process
any more. The original issue of a large overhead of providing
a class loader context is therefore not relevant any more and
we can start passing the context to installd.

Note that this also partially reverts commit
6dba50d633 which restricted
visibility of methods in PackageDexUsage. The commit also
removed data collection for unsupported class loaders. The
logic in PackageDexOptimizer was adjusted accordingly.

Bug: 64530081
Bug: 111174995
Test: manual
Change-Id: Id78b5a6d8841b199c12a63a8d45d12efbcc32275
This commit is contained in:
David Brazdil
2018-12-18 13:43:55 +00:00
parent 3176e8be7a
commit 22217f6a51
2 changed files with 13 additions and 10 deletions

View File

@@ -404,12 +404,17 @@ public class PackageDexOptimizer {
+ " dexoptFlags=" + printDexoptFlags(dexoptFlags)
+ " target-filter=" + compilerFilter);
// TODO(calin): b/64530081 b/66984396. Use SKIP_SHARED_LIBRARY_CHECK for the context
// (instead of dexUseInfo.getClassLoaderContext()) in order to compile secondary dex files
// in isolation (and avoid to extract/verify the main apk if it's in the class path).
// Note this trades correctness for performance since the resulting slow down is
// unacceptable in some cases until b/64530081 is fixed.
String classLoaderContext = SKIP_SHARED_LIBRARY_CHECK;
String classLoaderContext;
if (dexUseInfo.isUnknownClassLoaderContext() || dexUseInfo.isVariableClassLoaderContext()) {
// If we have an unknown (not yet set), or a variable class loader chain, compile
// without a context and mark the oat file with SKIP_SHARED_LIBRARY_CHECK. Note that
// this might lead to a incorrect compilation.
// TODO(calin): We should just extract in this case.
classLoaderContext = SKIP_SHARED_LIBRARY_CHECK;
} else {
classLoaderContext = dexUseInfo.getClassLoaderContext();
}
int reason = options.getCompilationReason();
try {
for (String isa : dexUseInfo.getLoaderIsas()) {

View File

@@ -863,15 +863,13 @@ public class PackageDexUsage extends AbstractStatsBase<Void> {
public String getClassLoaderContext() { return mClassLoaderContext; }
@VisibleForTesting
/* package */ boolean isUnknownClassLoaderContext() {
public boolean isUnknownClassLoaderContext() {
// The class loader context may be unknown if we loaded the data from a previous version
// which didn't save the context.
return UNKNOWN_CLASS_LOADER_CONTEXT.equals(mClassLoaderContext);
}
@VisibleForTesting
/* package */ boolean isVariableClassLoaderContext() {
public boolean isVariableClassLoaderContext() {
return VARIABLE_CLASS_LOADER_CONTEXT.equals(mClassLoaderContext);
}
}