diff options
| author | 2018-03-23 21:51:54 -0700 | |
|---|---|---|
| committer | 2018-04-18 10:12:19 -0700 | |
| commit | 8548de1c9f403b917eb2ad74a9922127da61171d (patch) | |
| tree | 38beeaaa5dbdae8d2084b878a78e23ca354e3712 /runtime/class_loader_context.cc | |
| parent | 1264d80ad53649796283053cb773aaaa521f638f (diff) | |
Add stored class loader context option
Motivation: Enable having a different class loader context during
preopt vs the one stored in the oat file.
Added test.
Bug: 70934104
Bug: 67345922
Test: test-art-host
(cherry picked from commit f5abfc42f0d986b9f8eb782d7e761f1a08784210)
Merged-In: I6c0851370e0740e5f47faf25a5494022034f6fa4
Change-Id: I6c0851370e0740e5f47faf25a5494022034f6fa4
Diffstat (limited to 'runtime/class_loader_context.cc')
| -rw-r--r-- | runtime/class_loader_context.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc index e646520f3d..216ad8f794 100644 --- a/runtime/class_loader_context.cc +++ b/runtime/class_loader_context.cc @@ -649,12 +649,16 @@ static bool IsAbsoluteLocation(const std::string& location) { return !location.empty() && location[0] == '/'; } -bool ClassLoaderContext::VerifyClassLoaderContextMatch(const std::string& context_spec) const { - DCHECK(dex_files_open_attempted_); - DCHECK(dex_files_open_result_); +bool ClassLoaderContext::VerifyClassLoaderContextMatch(const std::string& context_spec, + bool verify_names, + bool verify_checksums) const { + if (verify_names || verify_checksums) { + DCHECK(dex_files_open_attempted_); + DCHECK(dex_files_open_result_); + } ClassLoaderContext expected_context; - if (!expected_context.Parse(context_spec, /*parse_checksums*/ true)) { + if (!expected_context.Parse(context_spec, verify_checksums)) { LOG(WARNING) << "Invalid class loader context: " << context_spec; return false; } @@ -693,8 +697,14 @@ bool ClassLoaderContext::VerifyClassLoaderContextMatch(const std::string& contex return false; } - DCHECK_EQ(info.classpath.size(), info.checksums.size()); - DCHECK_EQ(expected_info.classpath.size(), expected_info.checksums.size()); + if (verify_checksums) { + DCHECK_EQ(info.classpath.size(), info.checksums.size()); + DCHECK_EQ(expected_info.classpath.size(), expected_info.checksums.size()); + } + + if (!verify_names) { + continue; + } for (size_t k = 0; k < info.classpath.size(); k++) { // Compute the dex location that must be compared. |