summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_unit_test.h
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2023-03-06 15:54:38 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2023-03-06 18:37:19 +0000
commitb8a0d8b7fc4735ce20107a4f4a6a09dbcb2a6198 (patch)
tree30bce3c03fe020227108e822926586acb4eac2bd /compiler/optimizing/optimizing_unit_test.h
parent92181e6b4622d456b9266eed43bf97ef6bd83784 (diff)
Add DexFileContainer for all DexFiles.
Ensure that all DexFiles have a container for consistency. Enforce that the container shall contain exactly one dex file, as specified the by file_size entry in the de header (that is, the memory range should not be truncated or too big). Bug: 266950186 Test: test.py -b --host --optimizing --64 Change-Id: I73ff074a980f9a9d5a0f4a9b51ac1a496971374f
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r--compiler/optimizing/optimizing_unit_test.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h
index 98ba38a59a..d0df4b89e5 100644
--- a/compiler/optimizing/optimizing_unit_test.h
+++ b/compiler/optimizing/optimizing_unit_test.h
@@ -241,13 +241,14 @@ class OptimizingUnitTestHelper {
// Create the dex file based on the fake data. Call the constructor so that we can use virtual
// functions. Don't use the arena for the StandardDexFile otherwise the dex location leaks.
- dex_files_.emplace_back(new StandardDexFile(
- dex_data,
- sizeof(StandardDexFile::Header),
- "no_location",
- /*location_checksum*/ 0,
- /*oat_dex_file*/ nullptr,
- /*container*/ nullptr));
+ auto container =
+ std::make_shared<MemoryDexFileContainer>(dex_data, sizeof(StandardDexFile::Header));
+ dex_files_.emplace_back(new StandardDexFile(dex_data,
+ sizeof(StandardDexFile::Header),
+ "no_location",
+ /*location_checksum*/ 0,
+ /*oat_dex_file*/ nullptr,
+ std::move(container)));
graph_ = new (allocator) HGraph(
allocator,