Add support for processing class loader contexts

Initial support for recognizing the class loader contexts.

In order to correctly compile dex files which at runtime are loaded with
a non-trivial class loader chain we need to make dex2oat aware of the
precise runtime context.

This CL adds the infrastructure to process arbitrary and arbitrary chain
of class loaders. ClassLoaderContext is able to parse a class loader
spec from a string and create the runtime structure based on it.

The integration with dex2oat and oat file assistant will follow up.

The string specification looks like
"PCL[lib1.dex:lib2.dex];DLC[lib3.dex]"

It describes how the class loader chain should be build in order to
ensure classes are resolved during dex2aot as they would be resolved at
runtime. This spec will be encoded in the oat file. If at runtime the
dex file will be loaded in a different context, the oat file will be
rejected.

The chain is interpreted in the natural 'parent order', meaning that
class loader 'i+1' will be the parent of class loader 'i'. The
compilation sources will be added to the classpath of the last class
loader. This allows the compiled dex files to be loaded at runtime in a
class loader that contains other dex files as well (e.g. shared
libraries).

Note that we accept chains for which the source dex files specified
with --dex-file are found in the classpath. In this case the source dex
files will be removed from the any class loader's classpath possibly
resulting in empty class loaders.

* This is the first CL, which adds the infrastructure for processing
a class loader context. Currently it CHECKS that only a single
PathClassLoader is created.

Test: m test-art-host
Bug: 38138251
Change-Id: I312aa12b5732288f3c1df4746b5775a32e0bfb04
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 03d9ca3..92d87ea 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -207,6 +207,13 @@
   static std::vector<std::unique_ptr<const DexFile>> LoadDexFiles(
       const OatFile& oat_file, const char* dex_location);
 
+  // Same as `std::vector<std::unique_ptr<const DexFile>> LoadDexFiles(...)` with the difference:
+  //   - puts the dex files in the given vector
+  //   - returns whether or not all dex files were successfully opened
+  static bool LoadDexFiles(const OatFile& oat_file,
+                           const std::string& dex_location,
+                           std::vector<std::unique_ptr<const DexFile>>* out_dex_files);
+
   // Returns true if there are dex files in the original dex location that can
   // be compiled with dex2oat for this dex location.
   // Returns false if there is no original dex file, or if the original dex