blob: bb7b40828e1e1df837e3e591ad42e980be924ea9 [file] [log] [blame]
Richard Uhler66d874d2015-01-15 09:37:19 -08001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_RUNTIME_OAT_FILE_ASSISTANT_H_
18#define ART_RUNTIME_OAT_FILE_ASSISTANT_H_
19
20#include <cstdint>
21#include <memory>
Narayan Kamath8943c1d2016-05-02 13:14:48 +010022#include <sstream>
Richard Uhler66d874d2015-01-15 09:37:19 -080023#include <string>
24
25#include "arch/instruction_set.h"
26#include "base/scoped_flock.h"
27#include "base/unix_file/fd_file.h"
Andreas Gampe29d38e72016-03-23 15:31:51 +000028#include "compiler_filter.h"
Richard Uhler66d874d2015-01-15 09:37:19 -080029#include "oat_file.h"
30#include "os.h"
31#include "profiler.h"
32
33namespace art {
34
Mathieu Chartierfbc31082016-01-24 11:59:56 -080035namespace gc {
36namespace space {
37class ImageSpace;
38} // namespace space
39} // namespace gc
40
Richard Uhler66d874d2015-01-15 09:37:19 -080041// Class for assisting with oat file management.
42//
43// This class collects common utilities for determining the status of an oat
44// file on the device, updating the oat file, and loading the oat file.
45//
46// The oat file assistant is intended to be used with dex locations not on the
47// boot class path. See the IsInBootClassPath method for a way to check if the
48// dex location is in the boot class path.
Richard Uhler66d874d2015-01-15 09:37:19 -080049class OatFileAssistant {
50 public:
Richard Uhler95abd042015-03-24 09:51:28 -070051 enum DexOptNeeded {
52 // kNoDexOptNeeded - The code for this dex location is up to date and can
53 // be used as is.
54 // Matches Java: dalvik.system.DexFile.NO_DEXOPT_NEEDED = 0
55 kNoDexOptNeeded = 0,
Richard Uhler66d874d2015-01-15 09:37:19 -080056
Richard Uhler95abd042015-03-24 09:51:28 -070057 // kDex2OatNeeded - In order to make the code for this dex location up to
58 // date, dex2oat must be run on the dex file.
59 // Matches Java: dalvik.system.DexFile.DEX2OAT_NEEDED = 1
60 kDex2OatNeeded = 1,
Richard Uhler66d874d2015-01-15 09:37:19 -080061
Richard Uhler95abd042015-03-24 09:51:28 -070062 // kPatchOatNeeded - In order to make the code for this dex location up to
63 // date, patchoat must be run on the odex file.
64 // Matches Java: dalvik.system.DexFile.PATCHOAT_NEEDED = 2
65 kPatchOatNeeded = 2,
66
67 // kSelfPatchOatNeeded - In order to make the code for this dex location
68 // up to date, patchoat must be run on the oat file.
69 // Matches Java: dalvik.system.DexFile.SELF_PATCHOAT_NEEDED = 3
70 kSelfPatchOatNeeded = 3,
71 };
72
73 enum OatStatus {
74 // kOatOutOfDate - An oat file is said to be out of date if the file does
Calin Juravleb077e152016-02-18 18:47:37 +000075 // not exist, is out of date with respect to the dex file or boot image,
76 // or does not meet the target compilation type.
Richard Uhler95abd042015-03-24 09:51:28 -070077 kOatOutOfDate,
78
79 // kOatNeedsRelocation - An oat file is said to need relocation if the
80 // code is up to date, but not yet properly relocated for address space
81 // layout randomization (ASLR). In this case, the oat file is neither
82 // "out of date" nor "up to date".
83 kOatNeedsRelocation,
84
85 // kOatUpToDate - An oat file is said to be up to date if it is not out of
Richard Uhler66d874d2015-01-15 09:37:19 -080086 // date and has been properly relocated for the purposes of ASLR.
Richard Uhler95abd042015-03-24 09:51:28 -070087 kOatUpToDate,
Richard Uhler66d874d2015-01-15 09:37:19 -080088 };
89
90 // Constructs an OatFileAssistant object to assist the oat file
91 // corresponding to the given dex location with the target instruction set.
92 //
Mathieu Chartier2cebb242015-04-21 16:50:40 -070093 // The dex_location must not be null and should remain available and
Richard Uhler66d874d2015-01-15 09:37:19 -080094 // unchanged for the duration of the lifetime of the OatFileAssistant object.
95 // Typically the dex_location is the absolute path to the original,
96 // un-optimized dex file.
97 //
Richard Uhler66d874d2015-01-15 09:37:19 -080098 // Note: Currently the dex_location must have an extension.
99 // TODO: Relax this restriction?
100 //
101 // The isa should be either the 32 bit or 64 bit variant for the current
102 // device. For example, on an arm device, use arm or arm64. An oat file can
103 // be loaded executable only if the ISA matches the current runtime.
Andreas Gampe29d38e72016-03-23 15:31:51 +0000104 //
105 // profile_changed should be true if the profile has recently changed
106 // for this dex location.
107 //
108 // load_executable should be true if the caller intends to try and load
109 // executable code for this dex location.
Calin Juravleb077e152016-02-18 18:47:37 +0000110 OatFileAssistant(const char* dex_location,
Calin Juravleb077e152016-02-18 18:47:37 +0000111 const InstructionSet isa,
Andreas Gampe29d38e72016-03-23 15:31:51 +0000112 bool profile_changed,
Richard Uhler66d874d2015-01-15 09:37:19 -0800113 bool load_executable);
114
115 // Constructs an OatFileAssistant, providing an explicit target oat_location
116 // to use instead of the standard oat location.
Calin Juravleb077e152016-02-18 18:47:37 +0000117 OatFileAssistant(const char* dex_location,
118 const char* oat_location,
Calin Juravleb077e152016-02-18 18:47:37 +0000119 const InstructionSet isa,
Andreas Gampe29d38e72016-03-23 15:31:51 +0000120 bool profile_changed,
Calin Juravleb077e152016-02-18 18:47:37 +0000121 bool load_executable);
Richard Uhler66d874d2015-01-15 09:37:19 -0800122
123 ~OatFileAssistant();
124
125 // Returns true if the dex location refers to an element of the boot class
126 // path.
127 bool IsInBootClassPath();
128
129 // Obtains a lock on the target oat file.
130 // Only one OatFileAssistant object can hold the lock for a target oat file
131 // at a time. The Lock is released automatically when the OatFileAssistant
132 // object goes out of scope. The Lock() method must not be called if the
133 // lock has already been acquired.
134 //
135 // Returns true on success.
136 // Returns false on error, in which case error_msg will contain more
137 // information on the error.
138 //
139 // The 'error_msg' argument must not be null.
140 //
141 // This is intended to be used to avoid race conditions when multiple
142 // processes generate oat files, such as when a foreground Activity and
143 // a background Service both use DexClassLoaders pointing to the same dex
144 // file.
145 bool Lock(std::string* error_msg);
146
Richard Uhler95abd042015-03-24 09:51:28 -0700147 // Return what action needs to be taken to produce up-to-date code for this
Andreas Gampe29d38e72016-03-23 15:31:51 +0000148 // dex location that is at least as good as an oat file generated with the
149 // given compiler filter.
150 DexOptNeeded GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter);
Richard Uhler66d874d2015-01-15 09:37:19 -0800151
Richard Uhler01be6812016-05-17 10:34:52 -0700152 // Returns true if there is up-to-date code for this dex location,
153 // irrespective of the compiler filter of the up-to-date code.
154 bool IsUpToDate();
155
Richard Uhler1e860612016-03-30 12:17:55 -0700156 // Return code used when attempting to generate updated code.
157 enum ResultOfAttemptToUpdate {
158 kUpdateFailed, // We tried making the code up to date, but
159 // encountered an unexpected failure.
160 kUpdateNotAttempted, // We wanted to update the code, but determined we
161 // should not make the attempt.
162 kUpdateSucceeded // We successfully made the code up to date
163 // (possibly by doing nothing).
164 };
165
Richard Uhler66d874d2015-01-15 09:37:19 -0800166 // Attempts to generate or relocate the oat file as needed to make it up to
Richard Uhlerf4b34872016-04-13 11:03:46 -0700167 // date based on the current runtime and compiler options.
Richard Uhler66d874d2015-01-15 09:37:19 -0800168 //
Richard Uhler1e860612016-03-30 12:17:55 -0700169 // If the result is not kUpdateSucceeded, the value of error_msg will be set
170 // to a string describing why there was a failure or the update was not
171 // attempted. error_msg must not be null.
Richard Uhlerf4b34872016-04-13 11:03:46 -0700172 ResultOfAttemptToUpdate MakeUpToDate(std::string* error_msg);
Richard Uhler66d874d2015-01-15 09:37:19 -0800173
174 // Returns an oat file that can be used for loading dex files.
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700175 // Returns null if no suitable oat file was found.
Richard Uhler66d874d2015-01-15 09:37:19 -0800176 //
177 // After this call, no other methods of the OatFileAssistant should be
178 // called, because access to the loaded oat file has been taken away from
179 // the OatFileAssistant object.
180 std::unique_ptr<OatFile> GetBestOatFile();
181
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800182 // Open and returns an image space associated with the oat file.
183 gc::space::ImageSpace* OpenImageSpace(const OatFile* oat_file);
184
Richard Uhler66d874d2015-01-15 09:37:19 -0800185 // Loads the dex files in the given oat file for the given dex location.
186 // The oat file should be up to date for the given dex location.
187 // This loads multiple dex files in the case of multidex.
188 // Returns an empty vector if no dex files for that location could be loaded
189 // from the oat file.
190 //
191 // The caller is responsible for freeing the dex_files returned, if any. The
192 // dex_files will only remain valid as long as the oat_file is valid.
193 static std::vector<std::unique_ptr<const DexFile>> LoadDexFiles(
194 const OatFile& oat_file, const char* dex_location);
195
Richard Uhler9b994ea2015-06-24 08:44:19 -0700196 // Returns true if there are dex files in the original dex location that can
197 // be compiled with dex2oat for this dex location.
198 // Returns false if there is no original dex file, or if the original dex
199 // file is an apk/zip without a classes.dex entry.
200 bool HasOriginalDexFiles();
201
Richard Uhler63434112015-03-16 14:32:16 -0700202 // If the dex file has been installed with a compiled oat file alongside
203 // it, the compiled oat file will have the extension .odex, and is referred
204 // to as the odex file. It is called odex for legacy reasons; the file is
205 // really an oat file. The odex file will often, but not always, have a
206 // patch delta of 0 and need to be relocated before use for the purposes of
207 // ASLR. The odex file is treated as if it were read-only.
Richard Uhler66d874d2015-01-15 09:37:19 -0800208 // These methods return the location and status of the odex file for the dex
209 // location.
210 // Notes:
211 // * OdexFileName may return null if the odex file name could not be
212 // determined.
213 const std::string* OdexFileName();
214 bool OdexFileExists();
Richard Uhler95abd042015-03-24 09:51:28 -0700215 OatStatus OdexFileStatus();
Richard Uhler66d874d2015-01-15 09:37:19 -0800216 bool OdexFileIsOutOfDate();
217 bool OdexFileNeedsRelocation();
218 bool OdexFileIsUpToDate();
Narayan Kamath8943c1d2016-05-02 13:14:48 +0100219 // Must only be called if the associated odex file exists, i.e, if
220 // |OdexFileExists() == true|.
221 CompilerFilter::Filter OdexFileCompilerFilter();
Richard Uhler66d874d2015-01-15 09:37:19 -0800222
223 // When the dex files is compiled on the target device, the oat file is the
224 // result. The oat file will have been relocated to some
225 // (possibly-out-of-date) offset for ASLR.
226 // These methods return the location and status of the target oat file for
227 // the dex location.
228 //
229 // Notes:
Richard Uhler66d874d2015-01-15 09:37:19 -0800230 // * OatFileName may return null if the oat file name could not be
231 // determined.
232 const std::string* OatFileName();
233 bool OatFileExists();
Richard Uhler95abd042015-03-24 09:51:28 -0700234 OatStatus OatFileStatus();
Richard Uhler66d874d2015-01-15 09:37:19 -0800235 bool OatFileIsOutOfDate();
236 bool OatFileNeedsRelocation();
237 bool OatFileIsUpToDate();
Narayan Kamath8943c1d2016-05-02 13:14:48 +0100238 // Must only be called if the associated oat file exists, i.e, if
239 // |OatFileExists() == true|.
240 CompilerFilter::Filter OatFileCompilerFilter();
Richard Uhler66d874d2015-01-15 09:37:19 -0800241
Mathieu Chartierfbc31082016-01-24 11:59:56 -0800242 // Return image file name. Does not cache since it relies on the oat file.
243 std::string ArtFileName(const OatFile* oat_file) const;
244
Richard Uhler66d874d2015-01-15 09:37:19 -0800245 // These methods return the status for a given opened oat file with respect
246 // to the dex location.
Richard Uhler95abd042015-03-24 09:51:28 -0700247 OatStatus GivenOatFileStatus(const OatFile& file);
Richard Uhler66d874d2015-01-15 09:37:19 -0800248 bool GivenOatFileIsOutOfDate(const OatFile& file);
249 bool GivenOatFileNeedsRelocation(const OatFile& file);
250 bool GivenOatFileIsUpToDate(const OatFile& file);
251
Richard Uhler95abd042015-03-24 09:51:28 -0700252 // Generates the oat file by relocation from the named input file.
Richard Uhler66d874d2015-01-15 09:37:19 -0800253 // This does not check the current status before attempting to relocate the
254 // oat file.
Richard Uhler66d874d2015-01-15 09:37:19 -0800255 //
Richard Uhler1e860612016-03-30 12:17:55 -0700256 // If the result is not kUpdateSucceeded, the value of error_msg will be set
257 // to a string describing why there was a failure or the update was not
258 // attempted. error_msg must not be null.
259 ResultOfAttemptToUpdate RelocateOatFile(const std::string* input_file, std::string* error_msg);
Richard Uhler66d874d2015-01-15 09:37:19 -0800260
Richard Uhlerf4b34872016-04-13 11:03:46 -0700261 // Generate the oat file from the dex file using the current runtime
262 // compiler options.
Richard Uhler66d874d2015-01-15 09:37:19 -0800263 // This does not check the current status before attempting to generate the
264 // oat file.
Richard Uhler66d874d2015-01-15 09:37:19 -0800265 //
Richard Uhler1e860612016-03-30 12:17:55 -0700266 // If the result is not kUpdateSucceeded, the value of error_msg will be set
267 // to a string describing why there was a failure or the update was not
268 // attempted. error_msg must not be null.
Richard Uhlerf4b34872016-04-13 11:03:46 -0700269 ResultOfAttemptToUpdate GenerateOatFile(std::string* error_msg);
Richard Uhler66d874d2015-01-15 09:37:19 -0800270
271 // Executes dex2oat using the current runtime configuration overridden with
272 // the given arguments. This does not check to see if dex2oat is enabled in
273 // the runtime configuration.
274 // Returns true on success.
275 //
276 // If there is a failure, the value of error_msg will be set to a string
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700277 // describing why there was failure. error_msg must not be null.
Richard Uhler66d874d2015-01-15 09:37:19 -0800278 //
279 // TODO: The OatFileAssistant probably isn't the right place to have this
280 // function.
281 static bool Dex2Oat(const std::vector<std::string>& args, std::string* error_msg);
282
283 // Constructs the odex file name for the given dex location.
284 // Returns true on success, in which case odex_filename is set to the odex
285 // file name.
286 // Returns false on error, in which case error_msg describes the error.
287 // Neither odex_filename nor error_msg may be null.
288 static bool DexFilenameToOdexFilename(const std::string& location,
289 InstructionSet isa, std::string* odex_filename, std::string* error_msg);
290
Jeff Haofd336c32016-04-07 19:46:31 -0700291 static uint32_t CalculateCombinedImageChecksum(InstructionSet isa = kRuntimeISA);
Jeff Haob11ffb72016-04-07 15:40:54 -0700292
Richard Uhler66d874d2015-01-15 09:37:19 -0800293 private:
294 struct ImageInfo {
295 uint32_t oat_checksum = 0;
296 uintptr_t oat_data_begin = 0;
297 int32_t patch_delta = 0;
298 std::string location;
299 };
300
301 // Returns the path to the dalvik cache directory.
302 // Does not check existence of the cache or try to create it.
303 // Includes the trailing slash.
304 // Returns an empty string if we can't get the dalvik cache directory path.
305 std::string DalvikCacheDirectory();
306
Richard Uhler66d874d2015-01-15 09:37:19 -0800307 // Returns the current image location.
308 // Returns an empty string if the image location could not be retrieved.
309 //
310 // TODO: This method should belong with an image file manager, not
311 // the oat file assistant.
312 static std::string ImageLocation();
313
314 // Gets the dex checksum required for an up-to-date oat file.
315 // Returns dex_checksum if a required checksum was located. Returns
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700316 // null if the required checksum was not found.
Richard Uhler66d874d2015-01-15 09:37:19 -0800317 // The caller shouldn't clean up or free the returned pointer.
Richard Uhler9b994ea2015-06-24 08:44:19 -0700318 // This sets the has_original_dex_files_ field to true if a checksum was
319 // found for the dex_location_ dex file.
Richard Uhler66d874d2015-01-15 09:37:19 -0800320 const uint32_t* GetRequiredDexChecksum();
321
322 // Returns the loaded odex file.
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700323 // Loads the file if needed. Returns null if the file failed to load.
Richard Uhler66d874d2015-01-15 09:37:19 -0800324 // The caller shouldn't clean up or free the returned pointer.
325 const OatFile* GetOdexFile();
326
Andreas Gampe29d38e72016-03-23 15:31:51 +0000327 // Returns true if the compiler filter used to generate the odex file is at
328 // least as good as the given target filter.
329 bool OdexFileCompilerFilterIsOkay(CompilerFilter::Filter target);
330
Richard Uhler5f946da2015-07-17 12:28:32 -0700331 // Returns true if the odex file is opened executable.
332 bool OdexFileIsExecutable();
333
Richard Uhlerd1537b52016-03-29 13:27:41 -0700334 // Returns true if the odex file has patch info required to run patchoat.
335 bool OdexFileHasPatchInfo();
336
Richard Uhler66d874d2015-01-15 09:37:19 -0800337 // Clear any cached information about the odex file that depends on the
338 // contents of the file.
339 void ClearOdexFileCache();
340
341 // Returns the loaded oat file.
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700342 // Loads the file if needed. Returns null if the file failed to load.
Richard Uhler66d874d2015-01-15 09:37:19 -0800343 // The caller shouldn't clean up or free the returned pointer.
344 const OatFile* GetOatFile();
345
Andreas Gampe29d38e72016-03-23 15:31:51 +0000346 // Returns true if the compiler filter used to generate the oat file is at
347 // least as good as the given target filter.
348 bool OatFileCompilerFilterIsOkay(CompilerFilter::Filter target);
349
Richard Uhler5f946da2015-07-17 12:28:32 -0700350 // Returns true if the oat file is opened executable.
351 bool OatFileIsExecutable();
352
Richard Uhlerd1537b52016-03-29 13:27:41 -0700353 // Returns true if the oat file has patch info required to run patchoat.
354 bool OatFileHasPatchInfo();
355
Richard Uhler66d874d2015-01-15 09:37:19 -0800356 // Clear any cached information about the oat file that depends on the
357 // contents of the file.
358 void ClearOatFileCache();
359
360 // Returns the loaded image info.
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700361 // Loads the image info if needed. Returns null if the image info failed
Richard Uhler66d874d2015-01-15 09:37:19 -0800362 // to load.
363 // The caller shouldn't clean up or free the returned pointer.
364 const ImageInfo* GetImageInfo();
365
Jeff Haob11ffb72016-04-07 15:40:54 -0700366 uint32_t GetCombinedImageChecksum();
367
Richard Uhler66d874d2015-01-15 09:37:19 -0800368 // To implement Lock(), we lock a dummy file where the oat file would go
369 // (adding ".flock" to the target file name) and retain the lock for the
370 // remaining lifetime of the OatFileAssistant object.
Richard Uhler66d874d2015-01-15 09:37:19 -0800371 ScopedFlock flock_;
372
Richard Uhler740eec92015-10-15 15:12:23 -0700373 std::string dex_location_;
Richard Uhler66d874d2015-01-15 09:37:19 -0800374
375 // In a properly constructed OatFileAssistant object, isa_ should be either
376 // the 32 or 64 bit variant for the current device.
377 const InstructionSet isa_ = kNone;
378
Andreas Gampe29d38e72016-03-23 15:31:51 +0000379 // Whether the profile has recently changed.
380 bool profile_changed_ = false;
381
Richard Uhler66d874d2015-01-15 09:37:19 -0800382 // Whether we will attempt to load oat files executable.
383 bool load_executable_ = false;
384
385 // Cached value of the required dex checksum.
386 // This should be accessed only by the GetRequiredDexChecksum() method.
Richard Uhler9b994ea2015-06-24 08:44:19 -0700387 uint32_t cached_required_dex_checksum_;
388 bool required_dex_checksum_attempted_ = false;
389 bool required_dex_checksum_found_;
390 bool has_original_dex_files_;
Richard Uhler66d874d2015-01-15 09:37:19 -0800391
392 // Cached value of the odex file name.
393 // This should be accessed only by the OdexFileName() method.
394 bool cached_odex_file_name_attempted_ = false;
395 bool cached_odex_file_name_found_;
396 std::string cached_odex_file_name_;
397
398 // Cached value of the loaded odex file.
399 // Use the GetOdexFile method rather than accessing this directly, unless you
400 // know the odex file isn't out of date.
401 bool odex_file_load_attempted_ = false;
402 std::unique_ptr<OatFile> cached_odex_file_;
403
404 // Cached results for OdexFileIsOutOfDate
405 bool odex_file_is_out_of_date_attempted_ = false;
406 bool cached_odex_file_is_out_of_date_;
407
408 // Cached results for OdexFileIsUpToDate
409 bool odex_file_is_up_to_date_attempted_ = false;
410 bool cached_odex_file_is_up_to_date_;
411
412 // Cached value of the oat file name.
413 // This should be accessed only by the OatFileName() method.
414 bool cached_oat_file_name_attempted_ = false;
415 bool cached_oat_file_name_found_;
416 std::string cached_oat_file_name_;
417
Richard Uhlerb361d942015-05-07 10:52:28 -0700418 // Cached value of the loaded oat file.
Richard Uhler66d874d2015-01-15 09:37:19 -0800419 // Use the GetOatFile method rather than accessing this directly, unless you
Richard Uhlerb361d942015-05-07 10:52:28 -0700420 // know the oat file isn't out of date.
Richard Uhler66d874d2015-01-15 09:37:19 -0800421 bool oat_file_load_attempted_ = false;
422 std::unique_ptr<OatFile> cached_oat_file_;
423
424 // Cached results for OatFileIsOutOfDate
425 bool oat_file_is_out_of_date_attempted_ = false;
426 bool cached_oat_file_is_out_of_date_;
427
428 // Cached results for OatFileIsUpToDate
429 bool oat_file_is_up_to_date_attempted_ = false;
430 bool cached_oat_file_is_up_to_date_;
431
432 // Cached value of the image info.
433 // Use the GetImageInfo method rather than accessing these directly.
434 // TODO: The image info should probably be moved out of the oat file
435 // assistant to an image file manager.
436 bool image_info_load_attempted_ = false;
437 bool image_info_load_succeeded_ = false;
438 ImageInfo cached_image_info_;
Jeff Haob11ffb72016-04-07 15:40:54 -0700439 uint32_t combined_image_checksum_ = 0;
Richard Uhler66d874d2015-01-15 09:37:19 -0800440
Richard Uhler66d874d2015-01-15 09:37:19 -0800441 // For debugging only.
442 // If this flag is set, the oat or odex file has been released to the user
443 // of the OatFileAssistant object and the OatFileAssistant object is in a
444 // bad state and should no longer be used.
445 bool oat_file_released_ = false;
446
447 DISALLOW_COPY_AND_ASSIGN(OatFileAssistant);
448};
449
Narayan Kamath8943c1d2016-05-02 13:14:48 +0100450std::ostream& operator << (std::ostream& stream, const OatFileAssistant::OatStatus status);
451
Richard Uhler66d874d2015-01-15 09:37:19 -0800452} // namespace art
453
454#endif // ART_RUNTIME_OAT_FILE_ASSISTANT_H_