Create vdex file for dex loaded with InMemoryDexClassLoader

Previous CL introduced a background verification thread for dex bytecode
loaded with InMemoryDexClassLoader. Extend the logic to collect the
results of class verification into an instance of VerifierDeps and dump
it into a vdex file in the app's data folder.

The background thread does not collect full VerifierDeps (e.g.
assignability dependencies, etc), just a bit vector of whether a class
was successfully verified or not.

The vdex format is extended to include boot classpath checksums and the
class loader context it was created for. These are optional and
currently left empty for regular vdex files.

The generated vdex files are treated as a cache with a limited capacity,
currently capped at 8 files. The least recently used file (in terms of
atime reported by stat()) is unlinked if the cache is full and a new
vdex is about to be generated.

Bug: 72131483
Test: art/tools/run-libcore-tests.sh
Test: art/test.py -b -r -t 692 -t 693
Change-Id: I26080d894d34d8f35f00c7925db569f22f008d2c
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 83ae3cb..1f3f74f 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -245,6 +245,21 @@
                                        std::string* oat_filename,
                                        std::string* error_msg);
 
+  // Computes the location checksum, dex location and vdex filename by combining
+  // the checksums of the individual dex files. If the data directory of the process
+  // is known, creates an absolute path in that directory and tries to infer path
+  // of a corresponding vdex file. Otherwise only creates a basename dex_location
+  // from the combined checksums. Returns true if all out-arguments have been set.
+  static bool AnonymousDexVdexLocation(const std::vector<const DexFile::Header*>& dex_headers,
+                                       InstructionSet isa,
+                                       /* out */ uint32_t* location_checksum,
+                                       /* out */ std::string* dex_location,
+                                       /* out */ std::string* vdex_filename);
+
+  // Returns true if a filename (given as basename) is a name of a vdex for
+  // anonymous dex file(s) created by AnonymousDexVdexLocation.
+  static bool IsAnonymousVdexBasename(const std::string& basename);
+
  private:
   class OatFileInfo {
    public: