return false;
}
std::string error_msg;
- oat_file_ = OatFile::OpenReadable(oat_file.get(), oat_location, nullptr, &error_msg);
+ oat_file_ = OatFile::OpenReadable(oat_file.get(), oat_location, nullptr, outof(error_msg));
if (oat_file_ == nullptr) {
PLOG(ERROR) << "Failed to open writable oat file " << oat_filename << " for " << oat_location
<< ": " << error_msg;
#include "arch/instruction_set_features.h"
#include "art_method-inl.h"
+#include "base/out.h"
#include "class_linker.h"
#include "common_compiler_test.h"
#include "compiled_method.h"
std::string error_msg;
std::unique_ptr<const InstructionSetFeatures> insn_features(
- InstructionSetFeatures::FromVariant(insn_set, "default", &error_msg));
+ InstructionSetFeatures::FromVariant(insn_set, "default", outof(error_msg)));
ASSERT_TRUE(insn_features.get() != nullptr) << error_msg;
compiler_options_.reset(new CompilerOptions);
verification_results_.reset(new VerificationResults(compiler_options_.get()));
compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings);
}
std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), nullptr,
- nullptr, false, nullptr, &error_msg));
+ nullptr, false, nullptr, outof(error_msg)));
ASSERT_TRUE(oat_file.get() != nullptr) << error_msg;
const OatHeader& oat_header = oat_file->GetOatHeader();
ASSERT_TRUE(oat_header.IsValid());
InstructionSet insn_set = kX86;
std::string error_msg;
std::unique_ptr<const InstructionSetFeatures> insn_features(
- InstructionSetFeatures::FromVariant(insn_set, "default", &error_msg));
+ InstructionSetFeatures::FromVariant(insn_set, "default", outof(error_msg)));
ASSERT_TRUE(insn_features.get() != nullptr) << error_msg;
std::vector<const DexFile*> dex_files;
uint32_t image_file_location_oat_checksum = 0;
void WalkOatDexFile(const OatFile::OatDexFile* oat_dex_file, Callback callback) {
std::string error_msg;
- std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(outof(error_msg)));
if (dex_file.get() == nullptr) {
return;
}
const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
CHECK(oat_dex_file != nullptr);
std::string error_msg;
- std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(outof(error_msg)));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Failed to open dex file '" << oat_dex_file->GetDexFileLocation()
<< "': " << error_msg;
const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
CHECK(oat_dex_file != nullptr);
std::string error_msg;
- std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(outof(error_msg)));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Failed to open dex file '" << oat_dex_file->GetDexFileLocation()
<< "': " << error_msg;
// Create the verifier early.
std::string error_msg;
- std::unique_ptr<const DexFile> dex_file(oat_dex_file.OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file.OpenDexFile(outof(error_msg)));
if (dex_file.get() == nullptr) {
os << "NOT FOUND: " << error_msg << "\n\n";
os << std::flush;
std::string error_msg;
std::string dex_file_location = oat_dex_file.GetDexFileLocation();
- std::unique_ptr<const DexFile> dex_file(oat_dex_file.OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file.OpenDexFile(outof(error_msg)));
if (dex_file == nullptr) {
os << "Failed to open dex file '" << dex_file_location << "': " << error_msg;
return false;
if (oat_file == nullptr) {
oat_file = OatFile::Open(oat_location, oat_location,
nullptr, nullptr, false, nullptr,
- &error_msg);
+ outof(error_msg));
if (oat_file == nullptr) {
os << "NOT FOUND: " << error_msg << "\n";
return false;
std::vector<std::unique_ptr<const DexFile>> dex_files;
for (const OatFile::OatDexFile* odf : oat_file->GetOatDexFiles()) {
std::string error_msg;
- std::unique_ptr<const DexFile> dex_file = odf->OpenDexFile(&error_msg);
+ std::unique_ptr<const DexFile> dex_file = odf->OpenDexFile(outof(error_msg));
CHECK(dex_file != nullptr) << error_msg;
class_linker->RegisterDexFile(*dex_file);
dex_files.push_back(std::move(dex_file));
std::ostream* os) {
std::string error_msg;
OatFile* oat_file = OatFile::Open(oat_filename, oat_filename, nullptr, nullptr, false,
- nullptr, &error_msg);
+ nullptr, outof(error_msg));
if (oat_file == nullptr) {
fprintf(stderr, "Failed to open oat file from '%s': %s\n", oat_filename, error_msg.c_str());
return EXIT_FAILURE;
static int SymbolizeOat(const char* oat_filename, std::string& output_name) {
std::string error_msg;
OatFile* oat_file = OatFile::Open(oat_filename, oat_filename, nullptr, nullptr, false,
- nullptr, &error_msg);
+ nullptr, outof(error_msg));
if (oat_file == nullptr) {
fprintf(stderr, "Failed to open oat file from '%s': %s\n", oat_filename, error_msg.c_str());
return EXIT_FAILURE;
const std::vector<const OatDexFile*>& oat_dex_files = oat_file->GetOatDexFiles();
for (const OatDexFile* oat_dex_file : oat_dex_files) {
std::string error;
- std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(&error);
+ std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(outof(error));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Could not create dex file from oat file: " << error;
} else {
nullptr);
CHECK(oat_dex_file != nullptr) << oat_file.GetLocation() << " " << dex_file_location;
std::string error_msg;
- std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(&error_msg);
+ std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(outof(error_msg));
if (dex_file.get() == nullptr) {
LOG(FATAL) << "Failed to open dex file " << dex_file_location
<< " from within oat file " << oat_file.GetLocation()
#include "art_method.h"
#include "base/macros.h"
+#include "base/out.h"
#include "base/stl_util.h"
#include "base/scoped_flock.h"
#include "base/time_utils.h"
// Note: we do not generate a fully debuggable boot image so we do not pass the
// compiler flag --debuggable here.
- Runtime::Current()->AddCurrentRuntimeFeaturesAsDex2OatArguments(&arg_vector);
+ Runtime::Current()->AddCurrentRuntimeFeaturesAsDex2OatArguments(outof(arg_vector));
CHECK_EQ(image_isa, kRuntimeISA)
<< "We should always be generating an image for the current isa.";
CHECK(image_header.GetOatDataBegin() != nullptr);
- OatFile* oat_file = OatFile::Open(oat_filename, oat_filename, image_header.GetOatDataBegin(),
+ OatFile* oat_file = OatFile::Open(oat_filename,
+ oat_filename,
+ image_header.GetOatDataBegin(),
image_header.GetOatFileBegin(),
!Runtime::Current()->IsAotCompiler(),
- nullptr, error_msg);
+ nullptr /* no abs dex location */,
+ outof_ptr(error_msg));
if (oat_file == nullptr) {
*error_msg = StringPrintf("Failed to open oat file '%s' referenced from image %s: %s",
oat_filename.c_str(), GetName(), error_msg->c_str());
#endif
#include "art_method-inl.h"
+#include "base/out.h"
#include "base/bit_vector.h"
#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
OatFile* OatFile::OpenWithElfFile(ElfFile* elf_file,
const std::string& location,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
std::unique_ptr<OatFile> oat_file(new OatFile(location, false));
oat_file->elf_file_.reset(elf_file);
uint64_t offset, size;
- bool has_section = elf_file->GetSectionOffsetAndSize(".rodata", &offset, &size);
+ bool has_section = elf_file->GetSectionOffsetAndSize(".rodata", outof(offset), outof(size));
CHECK(has_section);
oat_file->begin_ = elf_file->Begin() + offset;
oat_file->end_ = elf_file->Begin() + size + offset;
// Ignore the optional .bss section when opening non-executable.
- return oat_file->Setup(abs_dex_location, error_msg) ? oat_file.release() : nullptr;
+ return oat_file->Setup(abs_dex_location, outof_forward(error_msg)) ? oat_file.release() : nullptr;
}
OatFile* OatFile::Open(const std::string& filename,
uint8_t* oat_file_begin,
bool executable,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
CHECK(!filename.empty()) << location;
CheckLocation(location);
std::unique_ptr<OatFile> ret;
return ret.release();
}
-OatFile* OatFile::OpenWritable(File* file, const std::string& location,
+OatFile* OatFile::OpenWritable(File* file,
+ const std::string& location,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
CheckLocation(location);
- return OpenElfFile(file, location, nullptr, nullptr, true, false, abs_dex_location, error_msg);
+ return OpenElfFile(file, location, nullptr, nullptr, true, false, abs_dex_location,
+ outof_forward(error_msg));
}
-OatFile* OatFile::OpenReadable(File* file, const std::string& location,
+OatFile* OatFile::OpenReadable(File* file,
+ const std::string& location,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
CheckLocation(location);
- return OpenElfFile(file, location, nullptr, nullptr, false, false, abs_dex_location, error_msg);
+ return OpenElfFile(file, location, nullptr, nullptr, false, false, abs_dex_location,
+ outof_forward(error_msg));
}
OatFile* OatFile::OpenDlopen(const std::string& elf_filename,
const std::string& location,
uint8_t* requested_base,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
std::unique_ptr<OatFile> oat_file(new OatFile(location, true));
- bool success = oat_file->Dlopen(elf_filename, requested_base, abs_dex_location, error_msg);
+ bool success = oat_file->Dlopen(elf_filename,
+ requested_base,
+ abs_dex_location,
+ outof_forward(error_msg));
if (!success) {
return nullptr;
}
bool writable,
bool executable,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
std::unique_ptr<OatFile> oat_file(new OatFile(location, executable));
bool success = oat_file->ElfFileOpen(file, requested_base, oat_file_begin, writable, executable,
- abs_dex_location, error_msg);
+ abs_dex_location, outof_forward(error_msg));
if (!success) {
CHECK(!error_msg->empty());
return nullptr;
}
OatFile::OatFile(const std::string& location, bool is_executable)
- : location_(location), begin_(nullptr), end_(nullptr), bss_begin_(nullptr), bss_end_(nullptr),
- is_executable_(is_executable), dlopen_handle_(nullptr),
+ : location_(location),
+ begin_(nullptr),
+ end_(nullptr),
+ bss_begin_(nullptr),
+ bss_end_(nullptr),
+ is_executable_(is_executable),
+ dlopen_handle_(nullptr),
secondary_lookup_lock_("OatFile secondary lookup lock", kOatFileSecondaryLookupLock) {
CHECK(!location_.empty());
}
}
}
-bool OatFile::Dlopen(const std::string& elf_filename, uint8_t* requested_base,
- const char* abs_dex_location, std::string* error_msg) {
+bool OatFile::Dlopen(const std::string& elf_filename,
+ uint8_t* requested_base,
+ const char* abs_dex_location,
+ out<std::string> error_msg) {
#ifdef __APPLE__
// The dl_iterate_phdr syscall is missing. There is similar API on OSX,
// but let's fallback to the custom loading code for the time being.
LOG(ERROR) << "File " << elf_filename << " loaded with dlopen but can not find its mmaps.";
}
- return Setup(abs_dex_location, error_msg);
+ return Setup(abs_dex_location, outof_forward(error_msg));
#endif // __APPLE__
}
-bool OatFile::ElfFileOpen(File* file, uint8_t* requested_base, uint8_t* oat_file_begin,
- bool writable, bool executable,
+bool OatFile::ElfFileOpen(File* file,
+ uint8_t* requested_base,
+ uint8_t* oat_file_begin,
+ bool writable,
+ bool executable,
const char* abs_dex_location,
- std::string* error_msg) {
+ out<std::string> error_msg) {
// TODO: rename requested_base to oat_data_begin
- elf_file_.reset(ElfFile::Open(file, writable, /*program_header_only*/true, error_msg,
+ elf_file_.reset(ElfFile::Open(file,
+ writable,
+ /*program_header_only*/true,
+ outof_forward(error_msg),
oat_file_begin));
if (elf_file_ == nullptr) {
DCHECK(!error_msg->empty());
return false;
}
- bool loaded = elf_file_->Load(executable, error_msg);
+ bool loaded = elf_file_->Load(executable, outof_forward(error_msg));
if (!loaded) {
DCHECK(!error_msg->empty());
return false;
bss_end_ += sizeof(uint32_t);
}
- return Setup(abs_dex_location, error_msg);
+ return Setup(abs_dex_location, outof_forward(error_msg));
}
-bool OatFile::Setup(const char* abs_dex_location, std::string* error_msg) {
+bool OatFile::Setup(const char* abs_dex_location, out<std::string> error_msg) {
if (!GetOatHeader().IsValid()) {
std::string cause = GetOatHeader().GetValidationErrorMessage();
*error_msg = StringPrintf("Invalid oat header for '%s': %s", GetLocation().c_str(),
return reinterpret_cast<const DexFile::Header*>(dex_file_pointer_)->file_size_;
}
-std::unique_ptr<const DexFile> OatFile::OatDexFile::OpenDexFile(std::string* error_msg) const {
+std::unique_ptr<const DexFile> OatFile::OatDexFile::OpenDexFile(out<std::string> error_msg) const {
return DexFile::Open(dex_file_pointer_, FileSize(), dex_file_location_,
- dex_file_location_checksum_, this, error_msg);
+ dex_file_location_checksum_, this, outof_forward(error_msg));
}
uint32_t OatFile::OatDexFile::GetOatClassOffset(uint16_t class_def_index) const {
return out.str();
}
-bool OatFile::CheckStaticDexFileDependencies(const char* dex_dependencies, std::string* msg) {
+bool OatFile::CheckStaticDexFileDependencies(const char* dex_dependencies, out<std::string> msg) {
if (dex_dependencies == nullptr || dex_dependencies[0] == 0) {
// No dependencies.
return true;
// Assumption: this is not performance-critical. So it's OK to do this with a std::string and
// Split() instead of manual parsing of the combined char*.
std::vector<std::string> split;
- Split(dex_dependencies, kDexClassPathEncodingSeparator, &split);
+ Split(dex_dependencies, kDexClassPathEncodingSeparator, outof(split));
if (split.size() % 2 != 0) {
// Expected pairs of location and checksum.
*msg = StringPrintf("Odd number of elements in dependency list %s", dex_dependencies);
uint32_t dex_checksum;
std::string error_msg;
if (DexFile::GetChecksum(DexFile::GetDexCanonicalLocation(location.c_str()).c_str(),
- &dex_checksum,
- &error_msg)) {
+ outof(dex_checksum),
+ outof(error_msg))) {
if (converted != dex_checksum) {
*msg = StringPrintf("Checksums don't match for %s: %" PRId64 " vs %u",
location.c_str(), converted, dex_checksum);
}
bool OatFile::GetDexLocationsFromDependencies(const char* dex_dependencies,
- std::vector<std::string>* locations) {
- DCHECK(locations != nullptr);
+ out<std::vector<std::string>> locations) {
if (dex_dependencies == nullptr || dex_dependencies[0] == 0) {
return true;
}
// Assumption: this is not performance-critical. So it's OK to do this with a std::string and
// Split() instead of manual parsing of the combined char*.
std::vector<std::string> split;
- Split(dex_dependencies, kDexClassPathEncodingSeparator, &split);
+ Split(dex_dependencies, kDexClassPathEncodingSeparator, outof(split));
if (split.size() % 2 != 0) {
// Expected pairs of location and checksum.
return false;
#include <vector>
#include "base/mutex.h"
+#include "base/out_fwd.h"
#include "base/stringpiece.h"
#include "dex_file.h"
#include "invoke_type.h"
// Opens an oat file contained within the given elf file. This is always opened as
// non-executable at the moment.
- static OatFile* OpenWithElfFile(ElfFile* elf_file, const std::string& location,
+ static OatFile* OpenWithElfFile(ElfFile* elf_file,
+ const std::string& location,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
// Open an oat file. Returns null on failure. Requested base can
// optionally be used to request where the file should be loaded.
// See the ResolveRelativeEncodedDexLocation for a description of how the
uint8_t* oat_file_begin,
bool executable,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
// Open an oat file from an already opened File.
// Does not use dlopen underneath so cannot be used for runtime use
// where relocations may be required. Currently used from
// ImageWriter which wants to open a writable version from an existing
// file descriptor for patching.
- static OatFile* OpenWritable(File* file, const std::string& location,
+ static OatFile* OpenWritable(File* file,
+ const std::string& location,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
// Opens an oat file from an already opened File. Maps it PROT_READ, MAP_PRIVATE.
- static OatFile* OpenReadable(File* file, const std::string& location,
+ static OatFile* OpenReadable(File* file,
+ const std::string& location,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
~OatFile();
// Check the given dependency list against their dex files - thus the name "Static," this does
// not check the class-loader environment, only whether there have been file updates.
- static bool CheckStaticDexFileDependencies(const char* dex_dependencies, std::string* msg);
+ static bool CheckStaticDexFileDependencies(const char* dex_dependencies,
+ out<std::string> error_msg);
// Get the dex locations of a dependency list. Note: this is *not* cleaned for synthetic
// locations of multidex files.
static bool GetDexLocationsFromDependencies(const char* dex_dependencies,
- std::vector<std::string>* locations);
+ out<std::vector<std::string>> locations);
private:
static void CheckLocation(const std::string& location);
const std::string& location,
uint8_t* requested_base,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
static OatFile* OpenElfFile(File* file,
const std::string& location,
bool writable,
bool executable,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
explicit OatFile(const std::string& filename, bool executable);
- bool Dlopen(const std::string& elf_filename, uint8_t* requested_base,
- const char* abs_dex_location, std::string* error_msg);
- bool ElfFileOpen(File* file, uint8_t* requested_base,
+ bool Dlopen(const std::string& elf_filename,
+ uint8_t* requested_base,
+ const char* abs_dex_location,
+ out<std::string> error_msg);
+ bool ElfFileOpen(File* file,
+ uint8_t* requested_base,
uint8_t* oat_file_begin, // Override where the file is loaded to if not null
- bool writable, bool executable,
+ bool writable,
+ bool executable,
const char* abs_dex_location,
- std::string* error_msg);
+ out<std::string> error_msg);
- bool Setup(const char* abs_dex_location, std::string* error_msg);
+ bool Setup(const char* abs_dex_location, out<std::string> error_msg);
// The oat file name.
//
class OatDexFile FINAL {
public:
// Opens the DexFile referred to by this OatDexFile from within the containing OatFile.
- std::unique_ptr<const DexFile> OpenDexFile(std::string* error_msg) const;
+ std::unique_ptr<const DexFile> OpenDexFile(out<std::string> error_msg) const;
const OatFile* GetOatFile() const {
return oat_file_;
#include <set>
#include "base/logging.h"
+#include "base/out.h"
#include "base/stringprintf.h"
#include "class_linker.h"
#include "gc/heap.h"
return std::vector<std::unique_ptr<const DexFile>>();
}
- std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(&error_msg);
+ std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(outof(error_msg));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Failed to open dex file from oat dex file: " << error_msg;
return std::vector<std::unique_ptr<const DexFile>>();
break;
}
- dex_file = oat_dex_file->OpenDexFile(&error_msg);
+ dex_file = oat_dex_file->OpenDexFile(outof(error_msg));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Failed to open dex file from oat dex file: " << error_msg;
return std::vector<std::unique_ptr<const DexFile>>();
std::string error_msg;
cached_odex_file_name_found_ = DexFilenameToOdexFilename(
- dex_location_, isa_, &cached_odex_file_name_, &error_msg);
+ dex_location_, isa_, &cached_odex_file_name_, outof(error_msg));
if (!cached_odex_file_name_found_) {
// If we can't figure out the odex file, we treat it as if the odex
// file was inaccessible.
DalvikCacheDirectory().c_str(), GetInstructionSetString(isa_));
std::string error_msg;
cached_oat_file_name_found_ = GetDalvikCacheFilename(dex_location_,
- cache_dir.c_str(), &cached_oat_file_name_, &error_msg);
+ cache_dir.c_str(), &cached_oat_file_name_, outof(error_msg));
if (!cached_oat_file_name_found_) {
// If we can't determine the oat file name, we treat the oat file as
// inaccessible.
std::string error_msg;
uint32_t expected_secondary_checksum = 0;
if (DexFile::GetChecksum(secondary_dex_location.c_str(),
- &expected_secondary_checksum, &error_msg)) {
+ &expected_secondary_checksum, outof(error_msg))) {
uint32_t actual_secondary_checksum
= secondary_oat_dex_file->GetDexFileLocationChecksum();
if (expected_secondary_checksum != actual_secondary_checksum) {
if (runtime->IsDebuggable()) {
argv.push_back("--debuggable");
}
- runtime->AddCurrentRuntimeFeaturesAsDex2OatArguments(&argv);
+ runtime->AddCurrentRuntimeFeaturesAsDex2OatArguments(outof(argv));
if (!runtime->IsVerificationEnabled()) {
argv.push_back("--compiler-filter=verify-none");
std::string error_msg;
cached_odex_file_.reset(OatFile::Open(odex_file_name.c_str(),
odex_file_name.c_str(), nullptr, nullptr, load_executable_,
- dex_location_, &error_msg));
+ dex_location_, outof(error_msg)));
if (cached_odex_file_.get() == nullptr) {
VLOG(oat) << "OatFileAssistant test for existing pre-compiled oat file "
<< odex_file_name << ": " << error_msg;
std::string error_msg;
cached_oat_file_.reset(OatFile::Open(oat_file_name.c_str(),
oat_file_name.c_str(), nullptr, nullptr, load_executable_,
- dex_location_, &error_msg));
+ dex_location_, outof(error_msg)));
if (cached_oat_file_.get() == nullptr) {
VLOG(oat) << "OatFileAssistant test for existing oat file "
<< oat_file_name << ": " << error_msg;
<< "Expected dex file to be at: " << GetDexSrc1();
ASSERT_TRUE(OS::FileExists(GetStrippedDexSrc1().c_str()))
<< "Expected stripped dex file to be at: " << GetStrippedDexSrc1();
- ASSERT_FALSE(DexFile::GetChecksum(GetStrippedDexSrc1().c_str(), &checksum, &error_msg))
+ ASSERT_FALSE(DexFile::GetChecksum(GetStrippedDexSrc1().c_str(), &checksum, outof(error_msg)))
<< "Expected stripped dex file to be stripped: " << GetStrippedDexSrc1();
ASSERT_TRUE(OS::FileExists(GetDexSrc2().c_str()))
<< "Expected dex file to be at: " << GetDexSrc2();
// GetMultiDexSrc1, but a different secondary dex checksum.
std::vector<std::unique_ptr<const DexFile>> multi1;
ASSERT_TRUE(DexFile::Open(GetMultiDexSrc1().c_str(),
- GetMultiDexSrc1().c_str(), &error_msg, &multi1)) << error_msg;
+ GetMultiDexSrc1().c_str(), outof(error_msg), &multi1)) << error_msg;
ASSERT_GT(multi1.size(), 1u);
std::vector<std::unique_ptr<const DexFile>> multi2;
ASSERT_TRUE(DexFile::Open(GetMultiDexSrc2().c_str(),
- GetMultiDexSrc2().c_str(), &error_msg, &multi2)) << error_msg;
+ GetMultiDexSrc2().c_str(), outof(error_msg), &multi2)) << error_msg;
ASSERT_GT(multi2.size(), 1u);
ASSERT_EQ(multi1[0]->GetLocationChecksum(), multi2[0]->GetLocationChecksum());
args.push_back("--runtime-arg");
args.push_back("-Xnorelocate");
std::string error_msg;
- ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, &error_msg)) << error_msg;
+ ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, outof(error_msg))) << error_msg;
setenv("ANDROID_DATA", android_data_.c_str(), 1);
// Verify the odex file was generated as expected.
std::unique_ptr<OatFile> odex_file(OatFile::Open(
odex_location.c_str(), odex_location.c_str(), nullptr, nullptr,
- false, dex_location.c_str(), &error_msg));
+ false, dex_location.c_str(), outof(error_msg)));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
if (!pic) {
image_reservation_.push_back(std::unique_ptr<MemMap>(
MemMap::MapAnonymous("image reservation",
reinterpret_cast<uint8_t*>(start), end - start,
- PROT_NONE, false, false, &error_msg)));
+ PROT_NONE, false, false, outof(error_msg))));
ASSERT_TRUE(image_reservation_.back().get() != nullptr) << error_msg;
LOG(INFO) << "Reserved space for image " <<
reinterpret_cast<void*>(image_reservation_.back()->Begin()) << "-" <<
OatFileAssistant oat_file_assistant(dex_location, kRuntimeISA, false);
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.GenerateOatFile(&error_msg)) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.GenerateOatFile(outof(error_msg))) << error_msg;
}
// Case: We have a DEX file, but no OAT file for it.
// Trying to make the oat file up to date should not fail or crash.
std::string error_msg;
- EXPECT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg));
+ EXPECT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg)));
// Trying to get the best oat file should fail, but not crash.
std::unique_ptr<OatFile> oat_file = oat_file_assistant.GetBestOatFile();
args.push_back("--oat-file=" + oat_location);
std::string error_msg;
- ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, &error_msg)) << error_msg;
+ ASSERT_TRUE(OatFileAssistant::Dex2Oat(args, outof(error_msg))) << error_msg;
// Verify we can load both dex files.
OatFileAssistant oat_file_assistant(dex_location.c_str(),
// Make the oat file up to date.
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
// Make the oat file up to date.
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
// Make the oat file up to date. This should have no effect.
std::string error_msg;
- EXPECT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
+ EXPECT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
// Make the oat file up to date.
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded());
OatFileAssistant oat_file_assistant(
dex_location.c_str(), oat_location.c_str(), kRuntimeISA, true);
std::string error_msg;
- ASSERT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg)) << error_msg;
+ ASSERT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg))) << error_msg;
std::unique_ptr<OatFile> oat_file = oat_file_assistant.GetBestOatFile();
ASSERT_TRUE(oat_file.get() != nullptr);
// Trying to make it up to date should have no effect.
std::string error_msg;
- EXPECT_TRUE(oat_file_assistant.MakeUpToDate(&error_msg));
+ EXPECT_TRUE(oat_file_assistant.MakeUpToDate(outof(error_msg)));
EXPECT_TRUE(error_msg.empty());
}
std::string odex_file;
EXPECT_TRUE(OatFileAssistant::DexFilenameToOdexFilename(
- "/foo/bar/baz.jar", kArm, &odex_file, &error_msg)) << error_msg;
+ "/foo/bar/baz.jar", kArm, &odex_file, outof(error_msg))) << error_msg;
EXPECT_EQ("/foo/bar/oat/arm/baz.odex", odex_file);
EXPECT_TRUE(OatFileAssistant::DexFilenameToOdexFilename(
- "/foo/bar/baz.funnyext", kArm, &odex_file, &error_msg)) << error_msg;
+ "/foo/bar/baz.funnyext", kArm, &odex_file, outof(error_msg))) << error_msg;
EXPECT_EQ("/foo/bar/oat/arm/baz.odex", odex_file);
EXPECT_FALSE(OatFileAssistant::DexFilenameToOdexFilename(
- "nopath.jar", kArm, &odex_file, &error_msg));
+ "nopath.jar", kArm, &odex_file, outof(error_msg)));
EXPECT_FALSE(OatFileAssistant::DexFilenameToOdexFilename(
- "/foo/bar/baz_noext", kArm, &odex_file, &error_msg));
+ "/foo/bar/baz_noext", kArm, &odex_file, outof(error_msg)));
}
// Verify the dexopt status values from dalvik.system.DexFile
#include <gtest/gtest.h>
+#include "base/out.h"
#include "common_runtime_test.h"
#include "scoped_thread_state_change.h"
std::string error_msg;
// No dependencies.
- EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies(nullptr, &error_msg)) << error_msg;
- EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies("", &error_msg)) << error_msg;
+ EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies(nullptr, outof(error_msg))) << error_msg;
+ EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies("", outof(error_msg))) << error_msg;
// Ill-formed dependencies.
- EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc", &error_msg));
- EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc*123*def", &error_msg));
- EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc*def*", &error_msg));
+ EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc", outof(error_msg)));
+ EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc*123*def", outof(error_msg)));
+ EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc*def*", outof(error_msg)));
// Unsatisfiable dependency.
- EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc*123*", &error_msg));
+ EXPECT_FALSE(OatFile::CheckStaticDexFileDependencies("abc*123*", outof(error_msg)));
// Load some dex files to be able to do a real test.
ScopedObjectAccess soa(Thread::Current());
std::vector<std::unique_ptr<const DexFile>> dex_files1 = OpenTestDexFiles("Main");
std::vector<const DexFile*> dex_files_const1 = ToConstDexFiles(dex_files1);
std::string encoding1 = OatFile::EncodeDexFileDependencies(dex_files_const1);
- EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies(encoding1.c_str(), &error_msg))
+ EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies(encoding1.c_str(), outof(error_msg)))
<< error_msg << " " << encoding1;
std::vector<std::string> split1;
- EXPECT_TRUE(OatFile::GetDexLocationsFromDependencies(encoding1.c_str(), &split1));
+ EXPECT_TRUE(OatFile::GetDexLocationsFromDependencies(encoding1.c_str(), outof(split1)));
ASSERT_EQ(split1.size(), 1U);
EXPECT_EQ(split1[0], dex_files_const1[0]->GetLocation());
EXPECT_GT(dex_files2.size(), 1U);
std::vector<const DexFile*> dex_files_const2 = ToConstDexFiles(dex_files2);
std::string encoding2 = OatFile::EncodeDexFileDependencies(dex_files_const2);
- EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies(encoding2.c_str(), &error_msg))
+ EXPECT_TRUE(OatFile::CheckStaticDexFileDependencies(encoding2.c_str(), outof(error_msg)))
<< error_msg << " " << encoding2;
std::vector<std::string> split2;
- EXPECT_TRUE(OatFile::GetDexLocationsFromDependencies(encoding2.c_str(), &split2));
+ EXPECT_TRUE(OatFile::GetDexLocationsFromDependencies(encoding2.c_str(), outof(split2)));
ASSERT_EQ(split2.size(), 2U);
EXPECT_EQ(split2[0], dex_files_const2[0]->GetLocation());
EXPECT_EQ(split2[1], dex_files_const2[1]->GetLocation());
#include <sstream>
+#include "base/out.h"
#include "base/stringpiece.h"
#include "debugger.h"
#include "gc/heap.h"
// Runtime::Abort
}
-ParsedOptions* ParsedOptions::Create(const RuntimeOptions& options, bool ignore_unrecognized,
- RuntimeArgumentMap* runtime_options) {
- CHECK(runtime_options != nullptr);
-
+ParsedOptions* ParsedOptions::Create(const RuntimeOptions& options,
+ bool ignore_unrecognized,
+ out<RuntimeArgumentMap> runtime_options) {
std::unique_ptr<ParsedOptions> parsed(new ParsedOptions());
- if (parsed->Parse(options, ignore_unrecognized, runtime_options)) {
+ if (parsed->Parse(options, ignore_unrecognized, outof_forward(runtime_options))) {
return parsed.release();
}
return nullptr;
// As a side-effect, populate the hooks from options.
bool ParsedOptions::ProcessSpecialOptions(const RuntimeOptions& options,
RuntimeArgumentMap* runtime_options,
+ // TODO: should be an optional_out here.
std::vector<std::string>* out_options) {
using M = RuntimeArgumentMap;
}
bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognized,
- RuntimeArgumentMap* runtime_options) {
+ out<RuntimeArgumentMap> runtime_options) {
for (size_t i = 0; i < options.size(); ++i) {
if (true && options[0].first == "-Xzygote") {
LOG(INFO) << "option[" << i << "]=" << options[i].first;
// Convert to a simple string list (without the magic pointer options)
std::vector<std::string> argv_list;
- if (!ProcessSpecialOptions(options, nullptr, &argv_list)) {
+ if (!ProcessSpecialOptions(options,
+ nullptr, // No runtime argument map
+ outof(argv_list))) {
return false;
}
#include <jni.h>
+#include "base/out_fwd.h"
#include "globals.h"
#include "gc/collector_type.h"
#include "gc/space/large_object_space.h"
static std::unique_ptr<RuntimeParser> MakeParser(bool ignore_unrecognized);
// returns true if parsing succeeds, and stores the resulting options into runtime_options
- static ParsedOptions* Create(const RuntimeOptions& options, bool ignore_unrecognized,
- RuntimeArgumentMap* runtime_options);
+ static ParsedOptions* Create(const RuntimeOptions& options,
+ bool ignore_unrecognized,
+ out<RuntimeArgumentMap> runtime_options);
bool (*hook_is_sensitive_thread_)();
jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap);
bool ProcessSpecialOptions(const RuntimeOptions& options,
RuntimeArgumentMap* runtime_options,
+ // Optional out:
std::vector<std::string>* out_options);
void Usage(const char* fmt, ...);
void Exit(int status);
void Abort();
- bool Parse(const RuntimeOptions& options, bool ignore_unrecognized,
- RuntimeArgumentMap* runtime_options);
+ bool Parse(const RuntimeOptions& options,
+ bool ignore_unrecognized,
+ out<RuntimeArgumentMap> runtime_options);
};
} // namespace art
#include <memory>
+#include "base/out.h"
#include "common_runtime_test.h"
namespace art {
options.push_back(std::make_pair("exit", test_exit));
RuntimeArgumentMap map;
- std::unique_ptr<ParsedOptions> parsed(ParsedOptions::Create(options, false, &map));
+ std::unique_ptr<ParsedOptions> parsed(ParsedOptions::Create(options, false, outof(map)));
ASSERT_TRUE(parsed.get() != nullptr);
ASSERT_NE(0u, map.Size());
options.push_back(std::make_pair("-Xgc:MC", nullptr));
RuntimeArgumentMap map;
- std::unique_ptr<ParsedOptions> parsed(ParsedOptions::Create(options, false, &map));
+ std::unique_ptr<ParsedOptions> parsed(ParsedOptions::Create(options, false, outof(map)));
ASSERT_TRUE(parsed.get() != nullptr);
ASSERT_NE(0u, map.Size());
#include "atomic.h"
#include "base/arena_allocator.h"
#include "base/dumpable.h"
+#include "base/out.h"
#include "base/unix_file/fd_file.h"
#include "class_linker-inl.h"
#include "compiler_callbacks.h"
Thread* self = Thread::Current();
if (self == nullptr) {
os << "(Aborting thread was not attached to runtime!)\n";
- DumpKernelStack(os, GetTid(), " kernel: ", false);
- DumpNativeStack(os, GetTid(), " native: ", nullptr);
+ DumpKernelStack(os, GetTid(), " kernel: ", false /* don't include count */);
+ DumpNativeStack(os, GetTid(), " native: ", nullptr /* no ucontext ptr */);
} else {
os << "Aborting thread:\n";
if (Locks::mutator_lock_->IsExclusiveHeld(self) || Locks::mutator_lock_->IsSharedHeld(self)) {
if (Runtime::instance_ != nullptr) {
return false;
}
- InitLogging(nullptr); // Calls Locks::Init() as a side effect.
+ InitLogging(nullptr /* no argv */); // Calls Locks::Init() as a side effect.
instance_ = new Runtime;
if (!instance_->Init(options, ignore_unrecognized)) {
// TODO: Currently deleting the instance will abort the runtime on destruction. Now This will
// before fork aren't attributed to an app.
heap_->ResetGcPerformanceInfo();
- if (jit_.get() == nullptr && jit_options_->UseJIT()) {
+ if (jit_ == nullptr && jit_options_->UseJIT()) {
// Create the JIT if the flag is set and we haven't already create it (happens for run-tests).
CreateJit();
}
}
static bool OpenDexFilesFromImage(const std::string& image_location,
- std::vector<std::unique_ptr<const DexFile>>* dex_files,
- size_t* failures) {
- DCHECK(dex_files != nullptr) << "OpenDexFilesFromImage: out-param is nullptr";
+ out<std::vector<std::unique_ptr<const DexFile>>> dex_files,
+ out<size_t> failures) {
std::string system_filename;
bool has_system = false;
std::string cache_filename_unused;
bool is_global_cache_unused;
bool found_image = gc::space::ImageSpace::FindImageFilename(image_location.c_str(),
kRuntimeISA,
- &system_filename,
- &has_system,
- &cache_filename_unused,
- &dalvik_cache_exists_unused,
- &has_cache_unused,
- &is_global_cache_unused);
+ outof(system_filename),
+ outof(has_system),
+ outof(cache_filename_unused),
+ outof(dalvik_cache_exists_unused),
+ outof(has_cache_unused),
+ outof(is_global_cache_unused));
*failures = 0;
if (!found_image || !has_system) {
return false;
if (file.get() == nullptr) {
return false;
}
- std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file.release(), false, false, &error_msg));
+ std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file.release(), false, false, outof(error_msg)));
if (elf_file.get() == nullptr) {
return false;
}
std::unique_ptr<OatFile> oat_file(OatFile::OpenWithElfFile(elf_file.release(), oat_location,
- nullptr, &error_msg));
+ nullptr, outof(error_msg)));
if (oat_file.get() == nullptr) {
LOG(INFO) << "Unable to use '" << oat_filename << "' because " << error_msg;
return false;
*failures += 1;
continue;
}
- std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(&error_msg);
+ std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(outof(error_msg));
if (dex_file.get() == nullptr) {
*failures += 1;
} else {
static size_t OpenDexFiles(const std::vector<std::string>& dex_filenames,
const std::vector<std::string>& dex_locations,
const std::string& image_location,
- std::vector<std::unique_ptr<const DexFile>>* dex_files) {
- DCHECK(dex_files != nullptr) << "OpenDexFiles: out-param is nullptr";
+ out<std::vector<std::unique_ptr<const DexFile>>> dex_files) {
size_t failure_count = 0;
- if (!image_location.empty() && OpenDexFilesFromImage(image_location, dex_files, &failure_count)) {
+ if (!image_location.empty() && OpenDexFilesFromImage(image_location,
+ outof_forward(dex_files),
+ outof(failure_count))) {
return failure_count;
}
failure_count = 0;
LOG(WARNING) << "Skipping non-existent dex file '" << dex_filename << "'";
continue;
}
- if (!DexFile::Open(dex_filename, dex_location, &error_msg, dex_files)) {
+ if (!DexFile::Open(dex_filename, dex_location, outof(error_msg), outof_forward(dex_files))) {
LOG(WARNING) << "Failed to open .dex from file '" << dex_filename << "': " << error_msg;
++failure_count;
}
using Opt = RuntimeArgumentMap;
RuntimeArgumentMap runtime_options;
std::unique_ptr<ParsedOptions> parsed_options(
- ParsedOptions::Create(raw_options, ignore_unrecognized, &runtime_options));
+ ParsedOptions::Create(raw_options, ignore_unrecognized, outof(runtime_options)));
if (parsed_options.get() == nullptr) {
LOG(ERROR) << "Failed to parse options";
ATRACE_END();
OpenDexFiles(dex_filenames,
dex_locations,
runtime_options.GetOrDefault(Opt::Image),
- &boot_class_path);
+ outof(boot_class_path));
instruction_set_ = runtime_options.GetOrDefault(Opt::ImageInstructionSet);
class_linker_->InitWithoutImage(std::move(boot_class_path));
// the library that implements System.loadLibrary!
{
std::string reason;
- if (!java_vm_->LoadNativeLibrary(env, "libjavacore.so", nullptr, &reason)) {
+ if (!java_vm_->LoadNativeLibrary(env, "libjavacore.so", nullptr, outof(reason))) {
LOG(FATAL) << "LoadNativeLibrary failed for \"libjavacore.so\": " << reason;
}
}
signals.Block();
}
-bool Runtime::AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group,
+bool Runtime::AttachCurrentThread(const char* thread_name,
+ bool as_daemon,
+ jobject thread_group,
bool create_peer) {
return Thread::Attach(thread_name, as_daemon, thread_group, create_peer) != nullptr;
}
thread_list_->VisitRoots(visitor);
}
-size_t Runtime::FlipThreadRoots(Closure* thread_flip_visitor, Closure* flip_callback,
+size_t Runtime::FlipThreadRoots(Closure* thread_flip_visitor,
+ Closure* flip_callback,
gc::collector::GarbageCollector* collector) {
return thread_list_->FlipThreadRoots(thread_flip_visitor, flip_callback, collector);
}
preinitialization_transaction_->ThrowAbortError(self, nullptr);
}
-void Runtime::RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset,
- uint8_t value, bool is_volatile) const {
+void Runtime::RecordWriteFieldBoolean(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint8_t value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteFieldBoolean(obj, field_offset, value, is_volatile);
}
-void Runtime::RecordWriteFieldByte(mirror::Object* obj, MemberOffset field_offset,
- int8_t value, bool is_volatile) const {
+void Runtime::RecordWriteFieldByte(mirror::Object* obj,
+ MemberOffset field_offset,
+ int8_t value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteFieldByte(obj, field_offset, value, is_volatile);
}
-void Runtime::RecordWriteFieldChar(mirror::Object* obj, MemberOffset field_offset,
- uint16_t value, bool is_volatile) const {
+void Runtime::RecordWriteFieldChar(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint16_t value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteFieldChar(obj, field_offset, value, is_volatile);
}
-void Runtime::RecordWriteFieldShort(mirror::Object* obj, MemberOffset field_offset,
- int16_t value, bool is_volatile) const {
+void Runtime::RecordWriteFieldShort(mirror::Object* obj,
+ MemberOffset field_offset,
+ int16_t value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteFieldShort(obj, field_offset, value, is_volatile);
}
-void Runtime::RecordWriteField32(mirror::Object* obj, MemberOffset field_offset,
- uint32_t value, bool is_volatile) const {
+void Runtime::RecordWriteField32(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint32_t value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteField32(obj, field_offset, value, is_volatile);
}
-void Runtime::RecordWriteField64(mirror::Object* obj, MemberOffset field_offset,
- uint64_t value, bool is_volatile) const {
+void Runtime::RecordWriteField64(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint64_t value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteField64(obj, field_offset, value, is_volatile);
}
-void Runtime::RecordWriteFieldReference(mirror::Object* obj, MemberOffset field_offset,
- mirror::Object* value, bool is_volatile) const {
+void Runtime::RecordWriteFieldReference(mirror::Object* obj,
+ MemberOffset field_offset,
+ mirror::Object* value,
+ bool is_volatile) const {
DCHECK(IsAotCompiler());
DCHECK(IsActiveTransaction());
preinitialization_transaction_->RecordWriteFieldReference(obj, field_offset, value, is_volatile);
fault_message_ = message;
}
-void Runtime::AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* argv)
+void Runtime::AddCurrentRuntimeFeaturesAsDex2OatArguments(out<std::vector<std::string>> argv)
const {
if (GetInstrumentation()->InterpretOnly() || UseJit()) {
argv->push_back("--compiler-filter=interpret-only");
#include "arch/instruction_set.h"
#include "base/macros.h"
+#include "base/out.h"
#include "gc_root.h"
#include "instrumentation.h"
#include "jobject_comparator.h"
jobject GetSystemClassLoader() const;
// Attaches the calling native thread to the runtime.
- bool AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group,
+ bool AttachCurrentThread(const char* thread_name,
+ bool as_daemon,
+ jobject thread_group,
bool create_peer);
void CallExitHook(jint status);
mirror::Throwable* GetPreAllocatedOutOfMemoryError() SHARED_REQUIRES(Locks::mutator_lock_);
- mirror::Throwable* GetPreAllocatedNoClassDefFoundError()
- SHARED_REQUIRES(Locks::mutator_lock_);
+ mirror::Throwable* GetPreAllocatedNoClassDefFoundError() SHARED_REQUIRES(Locks::mutator_lock_);
const std::vector<std::string>& GetProperties() const {
return properties_;
void VisitImageRoots(RootVisitor* visitor) SHARED_REQUIRES(Locks::mutator_lock_);
// Visit all of the roots we can do safely do concurrently.
- void VisitConcurrentRoots(RootVisitor* visitor,
- VisitRootFlags flags = kVisitRootFlagAllRoots)
+ void VisitConcurrentRoots(RootVisitor* visitor, VisitRootFlags flags = kVisitRootFlagAllRoots)
SHARED_REQUIRES(Locks::mutator_lock_);
// Visit all of the non thread roots, we can do this with mutators unpaused.
void VisitThreadRoots(RootVisitor* visitor) SHARED_REQUIRES(Locks::mutator_lock_);
// Flip thread roots from from-space refs to to-space refs.
- size_t FlipThreadRoots(Closure* thread_flip_visitor, Closure* flip_callback,
+ size_t FlipThreadRoots(Closure* thread_flip_visitor,
+ Closure* flip_callback,
gc::collector::GarbageCollector* collector)
REQUIRES(!Locks::mutator_lock_);
void ThrowTransactionAbortError(Thread* self)
SHARED_REQUIRES(Locks::mutator_lock_);
- void RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset, uint8_t value,
+ void RecordWriteFieldBoolean(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint8_t value,
bool is_volatile) const;
- void RecordWriteFieldByte(mirror::Object* obj, MemberOffset field_offset, int8_t value,
+ void RecordWriteFieldByte(mirror::Object* obj,
+ MemberOffset field_offset,
+ int8_t value,
bool is_volatile) const;
- void RecordWriteFieldChar(mirror::Object* obj, MemberOffset field_offset, uint16_t value,
+ void RecordWriteFieldChar(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint16_t value,
bool is_volatile) const;
- void RecordWriteFieldShort(mirror::Object* obj, MemberOffset field_offset, int16_t value,
+ void RecordWriteFieldShort(mirror::Object* obj,
+ MemberOffset field_offset,
+ int16_t value,
bool is_volatile) const;
- void RecordWriteField32(mirror::Object* obj, MemberOffset field_offset, uint32_t value,
+ void RecordWriteField32(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint32_t value,
bool is_volatile) const;
- void RecordWriteField64(mirror::Object* obj, MemberOffset field_offset, uint64_t value,
+ void RecordWriteField64(mirror::Object* obj,
+ MemberOffset field_offset,
+ uint64_t value,
bool is_volatile) const;
- void RecordWriteFieldReference(mirror::Object* obj, MemberOffset field_offset,
- mirror::Object* value, bool is_volatile) const;
+ void RecordWriteFieldReference(mirror::Object* obj,
+ MemberOffset field_offset,
+ mirror::Object* value,
+ bool is_volatile) const;
void RecordWriteArray(mirror::Array* array, size_t index, uint64_t value) const
SHARED_REQUIRES(Locks::mutator_lock_);
void RecordStrongStringInsertion(mirror::String* s) const
return fault_message_;
}
- void AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* arg_vector) const;
+ void AddCurrentRuntimeFeaturesAsDex2OatArguments(out<std::vector<std::string>> arg_vector) const;
bool ExplicitStackOverflowChecks() const {
return !implicit_so_checks_;