Merge "Count transitions from interpreter to intrinsic."
diff --git a/adbconnection/adbconnection.cc b/adbconnection/adbconnection.cc
index c716d92..2050133 100644
--- a/adbconnection/adbconnection.cc
+++ b/adbconnection/adbconnection.cc
@@ -251,6 +251,8 @@
runtime->StartThreadBirth();
}
ScopedLocalRef<jobject> thr(soa.Env(), CreateAdbConnectionThread(soa.Self()));
+ // Note: Using pthreads instead of std::thread to not abort when the thread cannot be
+ // created (exception support required).
pthread_t pthread;
std::unique_ptr<CallbackData> data(new CallbackData { this, soa.Env()->NewGlobalRef(thr.get()) });
started_debugger_threads_ = true;
@@ -268,7 +270,7 @@
runtime->EndThreadBirth();
return;
}
- data.release();
+ data.release(); // NOLINT pthreads API.
}
static bool FlagsSet(int16_t data, int16_t flags) {
diff --git a/build/Android.bp b/build/Android.bp
index 9797268..47a540d 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -21,6 +21,7 @@
"bugprone-argument-comment",
"bugprone-lambda-function-name",
"bugprone-unused-raii", // Protect scoped things like MutexLock.
+ "bugprone-unused-return-value",
"bugprone-virtual-near-miss",
"modernize-use-bool-literals",
"modernize-use-nullptr",
@@ -37,6 +38,7 @@
art_clang_tidy_errors_str = "bugprone-argument-comment"
+ ",bugprone-lambda-function-name"
+ ",bugprone-unused-raii"
+ + ",bugprone-unused-return-value"
+ ",bugprone-virtual-near-miss"
+ ",modernize-redundant-void-arg"
+ ",modernize-use-bool-literals"
diff --git a/compiler/dex/verification_results.cc b/compiler/dex/verification_results.cc
index 1e0b94d..dd947d9 100644
--- a/compiler/dex/verification_results.cc
+++ b/compiler/dex/verification_results.cc
@@ -79,7 +79,7 @@
if (inserted) {
// Successfully added, release the unique_ptr since we no longer have ownership.
DCHECK_EQ(GetVerifiedMethod(ref), verified_method.get());
- verified_method.release();
+ verified_method.release(); // NOLINT b/117926937
} else {
// TODO: Investigate why are we doing the work again for this method and try to avoid it.
LOG(WARNING) << "Method processed more than once: " << ref.PrettyMethod();
@@ -117,7 +117,7 @@
/*expected*/ nullptr,
verified_method.get()) ==
AtomicMap::InsertResult::kInsertResultSuccess) {
- verified_method.release();
+ verified_method.release(); // NOLINT b/117926937
}
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 47b434d..f0f2b3e 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -662,21 +662,21 @@
if (!kIsDebugBuild && !(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
// We want to just exit on non-debug builds, not bringing the runtime down
// in an orderly fashion. So release the following fields.
- driver_.release();
- image_writer_.release();
+ driver_.release(); // NOLINT
+ image_writer_.release(); // NOLINT
for (std::unique_ptr<const DexFile>& dex_file : opened_dex_files_) {
- dex_file.release();
+ dex_file.release(); // NOLINT
}
new std::vector<MemMap>(std::move(opened_dex_files_maps_)); // Leak MemMaps.
for (std::unique_ptr<File>& vdex_file : vdex_files_) {
- vdex_file.release();
+ vdex_file.release(); // NOLINT
}
for (std::unique_ptr<File>& oat_file : oat_files_) {
- oat_file.release();
+ oat_file.release(); // NOLINT
}
- runtime_.release();
- verification_results_.release();
- key_value_store_.release();
+ runtime_.release(); // NOLINT
+ verification_results_.release(); // NOLINT
+ key_value_store_.release(); // NOLINT
}
}
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index b945b2a..d153459 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -137,14 +137,13 @@
ASSERT_TRUE(success) << error_msg << std::endl << output_;
// Verify the odex file was generated as expected.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
@@ -157,14 +156,13 @@
if (!test_accepts_odex_file_on_failure) {
// Verify there's no loadable odex file.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() == nullptr);
}
@@ -325,26 +323,26 @@
};
TEST_F(Dex2oatSwapTest, DoNotUseSwapDefaultSingleSmall) {
- RunTest(false /* use_fd */, false /* expect_use */);
- RunTest(true /* use_fd */, false /* expect_use */);
+ RunTest(/*use_fd=*/ false, /*expect_use=*/ false);
+ RunTest(/*use_fd=*/ true, /*expect_use=*/ false);
}
TEST_F(Dex2oatSwapTest, DoNotUseSwapSingle) {
- RunTest(false /* use_fd */, false /* expect_use */, { "--swap-dex-size-threshold=0" });
- RunTest(true /* use_fd */, false /* expect_use */, { "--swap-dex-size-threshold=0" });
+ RunTest(/*use_fd=*/ false, /*expect_use=*/ false, { "--swap-dex-size-threshold=0" });
+ RunTest(/*use_fd=*/ true, /*expect_use=*/ false, { "--swap-dex-size-threshold=0" });
}
TEST_F(Dex2oatSwapTest, DoNotUseSwapSmall) {
- RunTest(false /* use_fd */, false /* expect_use */, { "--swap-dex-count-threshold=0" });
- RunTest(true /* use_fd */, false /* expect_use */, { "--swap-dex-count-threshold=0" });
+ RunTest(/*use_fd=*/ false, /*expect_use=*/ false, { "--swap-dex-count-threshold=0" });
+ RunTest(/*use_fd=*/ true, /*expect_use=*/ false, { "--swap-dex-count-threshold=0" });
}
TEST_F(Dex2oatSwapTest, DoUseSwapSingleSmall) {
- RunTest(false /* use_fd */,
- true /* expect_use */,
+ RunTest(/*use_fd=*/ false,
+ /*expect_use=*/ true,
{ "--swap-dex-size-threshold=0", "--swap-dex-count-threshold=0" });
- RunTest(true /* use_fd */,
- true /* expect_use */,
+ RunTest(/*use_fd=*/ true,
+ /*expect_use=*/ true,
{ "--swap-dex-size-threshold=0", "--swap-dex-count-threshold=0" });
}
@@ -370,7 +368,7 @@
void GrabResult1() {
if (!kIsTargetBuild) {
native_alloc_1_ = ParseNativeAlloc();
- swap_1_ = ParseSwap(false /* expected */);
+ swap_1_ = ParseSwap(/*expected=*/ false);
} else {
native_alloc_1_ = std::numeric_limits<size_t>::max();
swap_1_ = 0;
@@ -380,7 +378,7 @@
void GrabResult2() {
if (!kIsTargetBuild) {
native_alloc_2_ = ParseNativeAlloc();
- swap_2_ = ParseSwap(true /* expected */);
+ swap_2_ = ParseSwap(/*expected=*/ true);
} else {
native_alloc_2_ = 0;
swap_2_ = std::numeric_limits<size_t>::max();
@@ -450,15 +448,15 @@
// investigate (b/29259363).
TEST_DISABLED_FOR_X86();
- RunTest(false /* use_fd */,
- false /* expect_use */);
+ RunTest(/*use_fd=*/ false,
+ /*expect_use=*/ false);
GrabResult1();
std::string output_1 = output_;
output_ = "";
- RunTest(false /* use_fd */,
- true /* expect_use */,
+ RunTest(/*use_fd=*/ false,
+ /*expect_use=*/ true,
{ "--swap-dex-size-threshold=0", "--swap-dex-count-threshold=0" });
GrabResult2();
std::string output_2 = output_;
@@ -514,14 +512,13 @@
}
// Host/target independent checks.
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
EXPECT_GT(app_image_file.length(), 0u);
@@ -663,7 +660,7 @@
std::vector<std::unique_ptr<const DexFile>> dex_files;
const ArtDexFileLoader dex_file_loader;
ASSERT_TRUE(dex_file_loader.Open(
- location, location, /* verify */ true, /* verify_checksum */ true, &error_msg, &dex_files));
+ location, location, /*verify=*/ true, /*verify_checksum=*/ true, &error_msg, &dex_files));
EXPECT_EQ(dex_files.size(), 1U);
std::unique_ptr<const DexFile>& dex_file = dex_files[0];
GenerateProfile(profile_location,
@@ -715,8 +712,8 @@
CompileProfileOdex(dex_location,
odex_location,
app_image_file,
- /* use_fd */ false,
- /* num_profile_classes */ 0);
+ /*use_fd=*/ false,
+ /*num_profile_classes=*/ 0);
CheckValidity();
ASSERT_TRUE(success_);
// Don't check the result since CheckResult relies on the class being in the profile.
@@ -728,8 +725,8 @@
CompileProfileOdex(dex_location,
odex_location,
app_image_file,
- /* use_fd */ false,
- /* num_profile_classes */ 1);
+ /*use_fd=*/ false,
+ /*num_profile_classes=*/ 1);
CheckValidity();
ASSERT_TRUE(success_);
CheckResult(dex_location, odex_location, app_image_file);
@@ -757,8 +754,8 @@
CompileProfileOdex(dex_location,
odex_location,
app_image_file_name,
- /* use_fd */ true,
- /* num_profile_classes */ 1,
+ /*use_fd=*/ true,
+ /*num_profile_classes=*/ 1,
{ input_vdex, output_vdex });
EXPECT_GT(vdex_file1->GetLength(), 0u);
}
@@ -769,10 +766,10 @@
CompileProfileOdex(dex_location,
odex_location,
app_image_file_name,
- /* use_fd */ true,
- /* num_profile_classes */ 1,
+ /*use_fd=*/ true,
+ /*num_profile_classes=*/ 1,
{ input_vdex, output_vdex },
- /* expect_success */ true);
+ /*expect_success=*/ true);
EXPECT_GT(vdex_file2.GetFile()->GetLength(), 0u);
}
ASSERT_EQ(vdex_file1->FlushCloseOrErase(), 0) << "Could not flush and close vdex file";
@@ -785,14 +782,13 @@
const std::string& app_image_file_name) {
// Host/target independent checks.
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
@@ -800,7 +796,7 @@
std::vector<std::unique_ptr<const DexFile>> dex_files;
const ArtDexFileLoader dex_file_loader;
ASSERT_TRUE(dex_file_loader.Open(
- location, location, /* verify */ true, /* verify_checksum */ true, &error_msg, &dex_files));
+ location, location, /*verify=*/ true, /*verify_checksum=*/ true, &error_msg, &dex_files));
EXPECT_EQ(dex_files.size(), 1U);
std::unique_ptr<const DexFile>& old_dex_file = dex_files[0];
@@ -853,11 +849,11 @@
};
TEST_F(Dex2oatLayoutTest, TestLayout) {
- RunTest(/* app-image */ false);
+ RunTest(/*app_image=*/ false);
}
TEST_F(Dex2oatLayoutTest, TestLayoutAppImage) {
- RunTest(/* app-image */ true);
+ RunTest(/*app_image=*/ true);
}
TEST_F(Dex2oatLayoutTest, TestVdexLayout) {
@@ -882,8 +878,8 @@
odex_location,
CompilerFilter::kQuicken,
{ input_vdex, output_vdex },
- /* expect_success */ true,
- /* use_fd */ true);
+ /*expect_success=*/ true,
+ /*use_fd=*/ true);
EXPECT_GT(vdex_file1->GetLength(), 0u);
}
// Unquicken by running the verify compiler filter on the vdex file.
@@ -894,8 +890,8 @@
odex_location,
CompilerFilter::kVerify,
{ input_vdex, output_vdex, kDisableCompactDex },
- /* expect_success */ true,
- /* use_fd */ true);
+ /*expect_success=*/ true,
+ /*use_fd=*/ true);
}
ASSERT_EQ(vdex_file1->FlushCloseOrErase(), 0) << "Could not flush and close vdex file";
CheckResult(dex_location, odex_location);
@@ -923,8 +919,8 @@
odex_location,
CompilerFilter::kQuicken,
{ input_vdex, output_vdex, "--compact-dex-level=fast"},
- /* expect_success */ true,
- /* use_fd */ true);
+ /*expect_success=*/ true,
+ /*use_fd=*/ true);
EXPECT_GT(vdex_file1->GetLength(), 0u);
}
@@ -936,8 +932,8 @@
odex_location2,
CompilerFilter::kVerify,
{ input_vdex, output_vdex, "--compact-dex-level=none"},
- /* expect_success */ true,
- /* use_fd */ true);
+ /*expect_success=*/ true,
+ /*use_fd=*/ true);
}
ASSERT_EQ(vdex_file1->FlushCloseOrErase(), 0) << "Could not flush and close vdex file";
ASSERT_EQ(vdex_file2->FlushCloseOrErase(), 0) << "Could not flush and close vdex file";
@@ -947,14 +943,13 @@
void CheckResult(const std::string& dex_location, const std::string& odex_location) {
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
ASSERT_GE(odex_file->GetOatDexFiles().size(), 1u);
@@ -1327,14 +1322,13 @@
EXPECT_EQ(res, 0);
// Open our generated oat file.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename.c_str(),
oat_filename.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex->GetLocation().c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1437,14 +1431,13 @@
{"--compact-dex-level=fast"});
EXPECT_EQ(res, 0);
// Open our generated oat file.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename.c_str(),
oat_filename.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1682,14 +1675,13 @@
});
// Open our generated oat file.
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename.c_str(),
oat_filename.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
temp_dex.GetFilename().c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1760,14 +1752,13 @@
{ "--compilation-reason=install" },
true);
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ASSERT_STREQ("install", odex_file->GetCompilationReason());
@@ -1786,14 +1777,13 @@
{},
true);
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ASSERT_EQ(nullptr, odex_file->GetCompilationReason());
@@ -1817,21 +1807,20 @@
{
// Check the vdex doesn't have dex.
std::unique_ptr<VdexFile> vdex(VdexFile::Open(vdex_location.c_str(),
- /*writable*/ false,
- /*low_4gb*/ false,
- /*unquicken*/ false,
+ /*writable=*/ false,
+ /*low_4gb=*/ false,
+ /*unquicken=*/ false,
&error_msg));
ASSERT_TRUE(vdex != nullptr);
EXPECT_FALSE(vdex->HasDexSection()) << output_;
}
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr) << dex_location;
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1930,8 +1919,8 @@
// Disable cdex since we want to compare against the original dex file
// after unquickening.
{ input_vdex, output_vdex, kDisableCompactDex },
- /* expect_success */ true,
- /* use_fd */ true);
+ /*expect_success=*/ true,
+ /*use_fd=*/ true);
}
// Unquicken by running the verify compiler filter on the vdex file and verify it matches.
std::string odex_location2 = GetOdexDir() + "/unquickened.odex";
@@ -1945,8 +1934,8 @@
CompilerFilter::kVerify,
// Disable cdex to avoid needing to write out the shared section.
{ input_vdex, output_vdex, kDisableCompactDex },
- /* expect_success */ true,
- /* use_fd */ true);
+ /*expect_success=*/ true,
+ /*use_fd=*/ true);
}
ASSERT_EQ(vdex_unquickened->Flush(), 0) << "Could not flush and close vdex file";
ASSERT_TRUE(success_);
@@ -2063,14 +2052,13 @@
[](const OatFile&) {});
// Open our generated oat file.
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
odex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ImageHeader header = {};
@@ -2114,19 +2102,18 @@
{ "--app-image-file=" + app_image_location,
"--resolve-startup-const-strings=true",
"--profile-file=" + profile_file.GetFilename()},
- /* expect_success= */ true,
- /* use_fd= */ false,
+ /*expect_success=*/ true,
+ /*use_fd=*/ false,
[](const OatFile&) {});
// Open our generated oat file.
std::string error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
odex_location.c_str(),
odex_location.c_str(),
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
odex_location.c_str(),
- /* reservation= */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
// Check the strings in the app image intern table only contain the "startup" strigs.
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index f764b42..7382208 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -87,7 +87,7 @@
void SetupCompiler(const std::vector<std::string>& compiler_options) {
std::string error_msg;
if (!compiler_options_->ParseCompilerOptions(compiler_options,
- false /* ignore_unrecognized */,
+ /*ignore_unrecognized=*/ false,
&error_msg)) {
LOG(FATAL) << error_msg;
UNREACHABLE();
@@ -176,7 +176,7 @@
oat_rodata,
&key_value_store,
verify,
- /* update_input_vdex */ false,
+ /*update_input_vdex=*/ false,
CopyOption::kOnlyIfCompressed,
&opened_dex_files_maps,
&opened_dex_files)) {
@@ -236,7 +236,7 @@
}
if (!oat_writer.WriteHeader(elf_writer->GetStream(),
- /* image_file_location_oat_checksum */ 42U)) {
+ /*image_file_location_oat_checksum=*/ 42U)) {
return false;
}
@@ -404,14 +404,13 @@
if (kCompile) { // OatWriter strips the code, regenerate to compare
compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings);
}
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
tmp_oat.GetFilename(),
tmp_oat.GetFilename(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ true,
- /* abs_dex_location */ nullptr,
- /* reservation */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ true,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(oat_file.get() != nullptr) << error_msg;
const OatHeader& oat_header = oat_file->GetOatHeader();
@@ -522,18 +521,17 @@
tmp_oat.GetFile(),
dex_files,
key_value_store,
- /* verify */ false);
+ /*verify=*/ false);
ASSERT_TRUE(success);
std::string error_msg;
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
tmp_oat.GetFilename(),
tmp_oat.GetFilename(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
- /* abs_dex_location */ nullptr,
- /* reservation */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(oat_file != nullptr);
EXPECT_LT(static_cast<size_t>(oat_file->Size()),
@@ -604,14 +602,13 @@
ASSERT_TRUE(success);
std::string error_msg;
- std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/*zip_fd=*/ -1,
tmp_oat.GetFilename(),
tmp_oat.GetFilename(),
- /* requested_base */ nullptr,
- /* executable */ false,
+ /*executable=*/ false,
low_4gb,
- /* abs_dex_location */ nullptr,
- /* reservation */ nullptr,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(opened_oat_file != nullptr) << error_msg;
if (low_4gb) {
@@ -727,7 +724,7 @@
input_filenames,
key_value_store,
verify,
- /* profile_compilation_info */ nullptr);
+ /*profile_compilation_info=*/ nullptr);
if (verify) {
ASSERT_FALSE(success);
@@ -735,14 +732,13 @@
ASSERT_TRUE(success);
std::string error_msg;
- std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/*zip_fd=*/ -1,
tmp_oat.GetFilename(),
tmp_oat.GetFilename(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
- /* abs_dex_location */ nullptr,
- /* reservation */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(opened_oat_file != nullptr) << error_msg;
ASSERT_EQ(2u, opened_oat_file->GetOatDexFiles().size());
@@ -769,7 +765,7 @@
{
// Test using the AddZipDexFileSource() interface with the zip file handle.
- File zip_fd(dup(zip_file.GetFd()), /* check_usage */ false);
+ File zip_fd(dup(zip_file.GetFd()), /*check_usage=*/ false);
ASSERT_NE(-1, zip_fd.Fd());
ScratchFile tmp_base, tmp_oat(tmp_base, ".oat"), tmp_vdex(tmp_base, ".vdex");
@@ -785,14 +781,13 @@
ASSERT_TRUE(success);
std::string error_msg;
- std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> opened_oat_file(OatFile::Open(/*zip_fd=*/ -1,
tmp_oat.GetFilename(),
tmp_oat.GetFilename(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
- /* abs_dex_location */ nullptr,
- /* reservation */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(opened_oat_file != nullptr) << error_msg;
ASSERT_EQ(2u, opened_oat_file->GetOatDexFiles().size());
@@ -843,7 +838,7 @@
oat_file.GetFile(),
input_filenames,
key_value_store,
- /* verify */ false,
+ /*verify=*/ false,
profile_compilation_info.get());
ASSERT_FALSE(success);
}
diff --git a/dexlayout/dexdiag_test.cc b/dexlayout/dexdiag_test.cc
index d3bfd14..47ef0a5 100644
--- a/dexlayout/dexdiag_test.cc
+++ b/dexlayout/dexdiag_test.cc
@@ -68,14 +68,13 @@
EXPECT_TRUE(!oat_location.empty());
std::cout << "==" << oat_location << std::endl;
std::string error_msg;
- std::unique_ptr<OatFile> oat(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat(OatFile::Open(/*zip_fd=*/ -1,
oat_location.c_str(),
oat_location.c_str(),
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ false,
- /* abs_dex_location= */ nullptr,
- /* reservation= */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
EXPECT_TRUE(oat != nullptr) << error_msg;
return oat;
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index db6945f..8905aa3 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -1554,7 +1554,7 @@
// Overwrite the existing vector with the new ordering, note that the sets of objects are
// equivalent, but the order changes. This is why this is not a memory leak.
// TODO: Consider cleaning this up with a shared_ptr.
- class_datas[class_data_index].release();
+ class_datas[class_data_index].release(); // NOLINT b/117926937
class_datas[class_data_index].reset(class_data);
++class_data_index;
}
@@ -1570,7 +1570,7 @@
// Overwrite the existing vector with the new ordering, note that the sets of objects are
// equivalent, but the order changes. This is why this is not a memory leak.
// TODO: Consider cleaning this up with a shared_ptr.
- class_defs[i].release();
+ class_defs[i].release(); // NOLINT b/117926937
class_defs[i].reset(new_class_def_order[i]);
}
}
@@ -1671,7 +1671,7 @@
// Now we know what order we want the string data, reorder them.
size_t data_index = 0;
for (dex_ir::StringId* string_id : string_ids) {
- string_datas[data_index].release();
+ string_datas[data_index].release(); // NOLINT b/117926937
string_datas[data_index].reset(string_id->DataItem());
++data_index;
}
diff --git a/libartbase/base/bit_string_test.cc b/libartbase/base/bit_string_test.cc
index 89a71a1..45f4d4e 100644
--- a/libartbase/base/bit_string_test.cc
+++ b/libartbase/base/bit_string_test.cc
@@ -110,17 +110,17 @@
ASSERT_EQ(BitString::kCapacity, 3u);
EXPECT_BITSTRING_STR("BitString[]", bs);
- bs = SetBitStringCharAt(bs, /*i*/0, /*val*/1u);
+ bs = SetBitStringCharAt(bs, /*i=*/0, /*val=*/1u);
EXPECT_BITSTRING_STR("BitString[1]", bs);
- bs = SetBitStringCharAt(bs, /*i*/1, /*val*/2u);
+ bs = SetBitStringCharAt(bs, /*i=*/1, /*val=*/2u);
EXPECT_BITSTRING_STR("BitString[1,2]", bs);
- bs = SetBitStringCharAt(bs, /*i*/2, /*val*/3u);
+ bs = SetBitStringCharAt(bs, /*i=*/2, /*val=*/3u);
EXPECT_BITSTRING_STR("BitString[1,2,3]", bs);
// There should be at least "kCapacity" # of checks here, 1 for each unique position.
- EXPECT_EQ(MakeBitStringChar(/*idx*/0, /*val*/1u), bs[0]);
- EXPECT_EQ(MakeBitStringChar(/*idx*/1, /*val*/2u), bs[1]);
- EXPECT_EQ(MakeBitStringChar(/*idx*/2, /*val*/3u), bs[2]);
+ EXPECT_EQ(MakeBitStringChar(/*idx=*/0, /*val=*/1u), bs[0]);
+ EXPECT_EQ(MakeBitStringChar(/*idx=*/1, /*val=*/2u), bs[1]);
+ EXPECT_EQ(MakeBitStringChar(/*idx=*/2, /*val=*/3u), bs[2]);
// Each maximal value should be tested here for each position.
uint32_t max_bitstring_ints[] = {
diff --git a/libartbase/base/bit_struct_test.cc b/libartbase/base/bit_struct_test.cc
index 577682c..a2389eb 100644
--- a/libartbase/base/bit_struct_test.cc
+++ b/libartbase/base/bit_struct_test.cc
@@ -73,7 +73,7 @@
TEST(BitStructs, Custom) {
CustomBitStruct expected(0b1111);
- BitStructField<CustomBitStruct, /*lsb*/4, /*width*/4> f{};
+ BitStructField<CustomBitStruct, /*lsb=*/4, /*width=*/4> f{};
EXPECT_EQ(1u, sizeof(f));
@@ -85,9 +85,9 @@
EXPECT_EQ(AsUint(f), 0b11110000u);
}
-BITSTRUCT_DEFINE_START(TestTwoCustom, /* size */ 8)
- BitStructField<CustomBitStruct, /*lsb*/0, /*width*/4> f4_a;
- BitStructField<CustomBitStruct, /*lsb*/4, /*width*/4> f4_b;
+BITSTRUCT_DEFINE_START(TestTwoCustom, /* size= */ 8)
+ BitStructField<CustomBitStruct, /*lsb=*/0, /*width=*/4> f4_a;
+ BitStructField<CustomBitStruct, /*lsb=*/4, /*width=*/4> f4_b;
BITSTRUCT_DEFINE_END(TestTwoCustom);
TEST(BitStructs, TwoCustom) {
@@ -122,7 +122,7 @@
}
TEST(BitStructs, Number) {
- BitStructNumber<uint16_t, /*lsb*/4, /*width*/4> bsn{};
+ BitStructNumber<uint16_t, /*lsb=*/4, /*width=*/4> bsn{};
EXPECT_EQ(2u, sizeof(bsn));
bsn = 0b1111;
@@ -135,20 +135,20 @@
EXPECT_EQ(AsUint(bsn), 0b11110000u);
}
-BITSTRUCT_DEFINE_START(TestBitStruct, /* size */ 8)
- BitStructInt</*lsb*/0, /*width*/3> i3;
- BitStructUint</*lsb*/3, /*width*/4> u4;
+BITSTRUCT_DEFINE_START(TestBitStruct, /* size= */ 8)
+ BitStructInt</*lsb=*/0, /*width=*/3> i3;
+ BitStructUint</*lsb=*/3, /*width=*/4> u4;
- BitStructUint</*lsb*/0, /*width*/7> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/7> alias_all;
BITSTRUCT_DEFINE_END(TestBitStruct);
TEST(BitStructs, Test1) {
{
// Check minimal size selection is correct.
- BitStructInt</*lsb*/0, /*width*/3> i3;
- BitStructUint</*lsb*/3, /*width*/4> u4;
+ BitStructInt</*lsb=*/0, /*width=*/3> i3;
+ BitStructUint</*lsb=*/3, /*width=*/4> u4;
- BitStructUint</*lsb*/0, /*width*/7> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/7> alias_all;
EXPECT_EQ(1u, sizeof(i3));
EXPECT_EQ(1u, sizeof(u4));
@@ -216,12 +216,12 @@
}
}
-BITSTRUCT_DEFINE_START(MixedSizeBitStruct, /* size */ 32)
- BitStructUint</*lsb*/0, /*width*/3> u3;
- BitStructUint</*lsb*/3, /*width*/10> u10;
- BitStructUint</*lsb*/13, /*width*/19> u19;
+BITSTRUCT_DEFINE_START(MixedSizeBitStruct, /* size= */ 32)
+ BitStructUint</*lsb=*/0, /*width=*/3> u3;
+ BitStructUint</*lsb=*/3, /*width=*/10> u10;
+ BitStructUint</*lsb=*/13, /*width=*/19> u19;
- BitStructUint</*lsb*/0, /*width*/32> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/32> alias_all;
BITSTRUCT_DEFINE_END(MixedSizeBitStruct);
// static_assert(sizeof(MixedSizeBitStruct) == sizeof(uint32_t), "TestBitStructs#MixedSize");
@@ -255,11 +255,11 @@
EXPECT_EQ(0b10101010101010101011111010100111u, AsUint(tst));
}
-BITSTRUCT_DEFINE_START(TestBitStruct_u8, /* size */ 8)
- BitStructInt</*lsb*/0, /*width*/3> i3;
- BitStructUint</*lsb*/3, /*width*/4> u4;
+BITSTRUCT_DEFINE_START(TestBitStruct_u8, /* size= */ 8)
+ BitStructInt</*lsb=*/0, /*width=*/3> i3;
+ BitStructUint</*lsb=*/3, /*width=*/4> u4;
- BitStructUint</*lsb*/0, /*width*/8> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/8> alias_all;
BITSTRUCT_DEFINE_END(TestBitStruct_u8);
TEST(BitStructs, FieldAssignment) {
@@ -283,11 +283,11 @@
}
}
-BITSTRUCT_DEFINE_START(NestedStruct, /* size */ 64)
- BitStructField<MixedSizeBitStruct, /*lsb*/0> mixed_lower;
- BitStructField<MixedSizeBitStruct, /*lsb*/32> mixed_upper;
+BITSTRUCT_DEFINE_START(NestedStruct, /* size= */ 64)
+ BitStructField<MixedSizeBitStruct, /*lsb=*/0> mixed_lower;
+ BitStructField<MixedSizeBitStruct, /*lsb=*/32> mixed_upper;
- BitStructUint</*lsb*/0, /*width*/64> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/64> alias_all;
BITSTRUCT_DEFINE_END(NestedStruct);
TEST(BitStructs, NestedFieldAssignment) {
diff --git a/libartbase/base/bit_utils_test.cc b/libartbase/base/bit_utils_test.cc
index 3a80600..91fc3b0 100644
--- a/libartbase/base/bit_utils_test.cc
+++ b/libartbase/base/bit_utils_test.cc
@@ -353,89 +353,92 @@
static_assert(MaskLeastSignificant<uint64_t>(63) == (std::numeric_limits<uint64_t>::max() >> 1u),
"TestMaskLeastSignificant#6");
-static_assert(BitFieldClear(0xFF, /*lsb*/0, /*width*/0) == 0xFF, "TestBitFieldClear#1");
-static_assert(BitFieldClear(std::numeric_limits<uint32_t>::max(), /*lsb*/0, /*width*/32) == 0x0,
+static_assert(BitFieldClear(0xFF, /*lsb=*/0, /*width=*/0) == 0xFF, "TestBitFieldClear#1");
+static_assert(BitFieldClear(std::numeric_limits<uint32_t>::max(), /*lsb=*/0, /*width=*/32) == 0x0,
"TestBitFieldClear#2");
-static_assert(BitFieldClear(std::numeric_limits<int32_t>::max(), /*lsb*/0, /*width*/32) == 0x0,
+static_assert(BitFieldClear(std::numeric_limits<int32_t>::max(), /*lsb=*/0, /*width=*/32) == 0x0,
"TestBitFieldClear#3");
-static_assert(BitFieldClear(0xFF, /*lsb*/0, /*width*/2) == 0b11111100, "TestBitFieldClear#4");
-static_assert(BitFieldClear(0xFF, /*lsb*/0, /*width*/3) == 0b11111000, "TestBitFieldClear#5");
-static_assert(BitFieldClear(0xFF, /*lsb*/1, /*width*/3) == 0b11110001, "TestBitFieldClear#6");
-static_assert(BitFieldClear(0xFF, /*lsb*/2, /*width*/3) == 0b11100011, "TestBitFieldClear#7");
+static_assert(BitFieldClear(0xFF, /*lsb=*/0, /*width=*/2) == 0b11111100, "TestBitFieldClear#4");
+static_assert(BitFieldClear(0xFF, /*lsb=*/0, /*width=*/3) == 0b11111000, "TestBitFieldClear#5");
+static_assert(BitFieldClear(0xFF, /*lsb=*/1, /*width=*/3) == 0b11110001, "TestBitFieldClear#6");
+static_assert(BitFieldClear(0xFF, /*lsb=*/2, /*width=*/3) == 0b11100011, "TestBitFieldClear#7");
-static_assert(BitFieldExtract(0xFF, /*lsb*/0, /*width*/0) == 0x0, "TestBitFieldExtract#1");
-static_assert(BitFieldExtract(std::numeric_limits<uint32_t>::max(), /*lsb*/0, /*width*/32)
+static_assert(BitFieldExtract(0xFF, /*lsb=*/0, /*width=*/0) == 0x0, "TestBitFieldExtract#1");
+static_assert(BitFieldExtract(std::numeric_limits<uint32_t>::max(), /*lsb=*/0, /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldExtract#2");
-static_assert(BitFieldExtract(std::numeric_limits<int32_t>::max(), /*lsb*/0, /*width*/32)
+static_assert(BitFieldExtract(std::numeric_limits<int32_t>::max(), /*lsb=*/0, /*width=*/32)
== std::numeric_limits<int32_t>::max(),
"TestBitFieldExtract#3");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/0, /*width*/2) == 0b00000011,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/0, /*width=*/2) == 0b00000011,
"TestBitFieldExtract#4");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/0, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/0, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#5");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/1, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/1, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#6");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/2, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/2, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#7");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/3, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/3, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#8");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/8, /*width*/3) == 0b00000000,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/8, /*width=*/3) == 0b00000000,
"TestBitFieldExtract#9");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/7, /*width*/3) == 0b00000001,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/7, /*width=*/3) == 0b00000001,
"TestBitFieldExtract#10");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/6, /*width*/3) == 0b00000011,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/6, /*width=*/3) == 0b00000011,
"TestBitFieldExtract#11");
-static_assert(BitFieldExtract(0xFF, /*lsb*/0, /*width*/2) == -1, "TestBitFieldExtract#12");
-static_assert(BitFieldExtract(0xFF, /*lsb*/0, /*width*/3) == -1, "TestBitFieldExtract#13");
-static_assert(BitFieldExtract(0xFF, /*lsb*/1, /*width*/3) == -1, "TestBitFieldExtract#14");
-static_assert(BitFieldExtract(0xFF, /*lsb*/2, /*width*/3) == -1, "TestBitFieldExtract#15");
-static_assert(BitFieldExtract(0xFF, /*lsb*/3, /*width*/3) == -1, "TestBitFieldExtract#16");
-static_assert(BitFieldExtract(0xFF, /*lsb*/8, /*width*/3) == 0b00000000, "TestBitFieldExtract#17");
-static_assert(BitFieldExtract(0xFF, /*lsb*/7, /*width*/3) == 0b00000001, "TestBitFieldExtract#18");
-static_assert(BitFieldExtract(0xFF, /*lsb*/6, /*width*/3) == 0b00000011, "TestBitFieldExtract#19");
-static_assert(BitFieldExtract(static_cast<uint8_t>(0b01101010), /*lsb*/2, /*width*/4)
+static_assert(BitFieldExtract(0xFF, /*lsb=*/0, /*width=*/2) == -1, "TestBitFieldExtract#12");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/0, /*width=*/3) == -1, "TestBitFieldExtract#13");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/1, /*width=*/3) == -1, "TestBitFieldExtract#14");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/2, /*width=*/3) == -1, "TestBitFieldExtract#15");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/3, /*width=*/3) == -1, "TestBitFieldExtract#16");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/8, /*width=*/3) == 0b00000000,
+ "TestBitFieldExtract#17");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/7, /*width=*/3) == 0b00000001,
+ "TestBitFieldExtract#18");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/6, /*width=*/3) == 0b00000011,
+ "TestBitFieldExtract#19");
+static_assert(BitFieldExtract(static_cast<uint8_t>(0b01101010), /*lsb=*/2, /*width=*/4)
== 0b00001010,
"TestBitFieldExtract#20");
-static_assert(BitFieldExtract(static_cast<int8_t>(0b01101010), /*lsb*/2, /*width*/4)
+static_assert(BitFieldExtract(static_cast<int8_t>(0b01101010), /*lsb=*/2, /*width=*/4)
== static_cast<int8_t>(0b11111010),
"TestBitFieldExtract#21");
-static_assert(BitFieldInsert(0xFF, /*data*/0x0, /*lsb*/0, /*width*/0) == 0xFF,
+static_assert(BitFieldInsert(0xFF, /*data=*/0x0, /*lsb=*/0, /*width=*/0) == 0xFF,
"TestBitFieldInsert#1");
static_assert(BitFieldInsert(std::numeric_limits<uint32_t>::max(),
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#2");
static_assert(BitFieldInsert(std::numeric_limits<int32_t>::max(),
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#3");
static_assert(BitFieldInsert(0u,
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#4");
static_assert(BitFieldInsert(-(-0),
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#5");
-static_assert(BitFieldInsert(0x00, /*data*/0b11u, /*lsb*/0, /*width*/2) == 0b00000011,
+static_assert(BitFieldInsert(0x00, /*data=*/0b11u, /*lsb=*/0, /*width=*/2) == 0b00000011,
"TestBitFieldInsert#6");
-static_assert(BitFieldInsert(0x00, /*data*/0b111u, /*lsb*/0, /*width*/3) == 0b00000111,
+static_assert(BitFieldInsert(0x00, /*data=*/0b111u, /*lsb=*/0, /*width=*/3) == 0b00000111,
"TestBitFieldInsert#7");
-static_assert(BitFieldInsert(0x00, /*data*/0b111u, /*lsb*/1, /*width*/3) == 0b00001110,
+static_assert(BitFieldInsert(0x00, /*data=*/0b111u, /*lsb=*/1, /*width=*/3) == 0b00001110,
"TestBitFieldInsert#8");
-static_assert(BitFieldInsert(0x00, /*data*/0b111u, /*lsb*/2, /*width*/3) == 0b00011100,
+static_assert(BitFieldInsert(0x00, /*data=*/0b111u, /*lsb=*/2, /*width=*/3) == 0b00011100,
"TestBitFieldInsert#9");
-static_assert(BitFieldInsert(0b01011100, /*data*/0b1101u, /*lsb*/4, /*width*/4) == 0b11011100,
+static_assert(BitFieldInsert(0b01011100, /*data=*/0b1101u, /*lsb=*/4, /*width=*/4) == 0b11011100,
"TestBitFieldInsert#10");
template <typename Container>
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index b65710b..9485fca 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -251,7 +251,7 @@
static constexpr bool kVerifyChecksum = true;
const ArtDexFileLoader dex_file_loader;
if (!dex_file_loader.Open(
- location, location, /* verify */ true, kVerifyChecksum, &error_msg, &dex_files)) {
+ location, location, /* verify= */ true, kVerifyChecksum, &error_msg, &dex_files)) {
LOG(FATAL) << "Could not open .dex file '" << location << "': " << error_msg << "\n";
UNREACHABLE();
} else {
diff --git a/libartbase/base/file_magic.cc b/libartbase/base/file_magic.cc
index d8d843b..1471c59 100644
--- a/libartbase/base/file_magic.cc
+++ b/libartbase/base/file_magic.cc
@@ -31,7 +31,7 @@
File OpenAndReadMagic(const char* filename, uint32_t* magic, std::string* error_msg) {
CHECK(magic != nullptr);
- File fd(filename, O_RDONLY, /* check_usage */ false);
+ File fd(filename, O_RDONLY, /* check_usage= */ false);
if (fd.Fd() == -1) {
*error_msg = StringPrintf("Unable to open '%s' : %s", filename, strerror(errno));
return File();
diff --git a/libartbase/base/file_utils_test.cc b/libartbase/base/file_utils_test.cc
index 2a7273b..f7c9c5e 100644
--- a/libartbase/base/file_utils_test.cc
+++ b/libartbase/base/file_utils_test.cc
@@ -71,12 +71,12 @@
// Set ANDROID_ROOT to something else (but the directory must exist). So use dirname.
UniqueCPtr<char> root_dup(strdup(android_root_env.c_str()));
char* dir = dirname(root_dup.get());
- ASSERT_EQ(0, setenv("ANDROID_ROOT", dir, 1 /* overwrite */));
+ ASSERT_EQ(0, setenv("ANDROID_ROOT", dir, /* overwrite */ 1));
std::string android_root2 = GetAndroidRootSafe(&error_msg);
EXPECT_STREQ(dir, android_root2.c_str());
// Set a bogus value for ANDROID_ROOT. This should be an error.
- ASSERT_EQ(0, setenv("ANDROID_ROOT", "/this/is/obviously/bogus", 1 /* overwrite */));
+ ASSERT_EQ(0, setenv("ANDROID_ROOT", "/this/is/obviously/bogus", /* overwrite */ 1));
EXPECT_EQ(GetAndroidRootSafe(&error_msg), "");
// Unset ANDROID_ROOT and see that it still returns something (as libart code is running).
@@ -90,7 +90,7 @@
// Reset ANDROID_ROOT, as other things may depend on it.
- ASSERT_EQ(0, setenv("ANDROID_ROOT", android_root_env.c_str(), 1 /* overwrite */));
+ ASSERT_EQ(0, setenv("ANDROID_ROOT", android_root_env.c_str(), /* overwrite */ 1));
}
TEST_F(FileUtilsTest, ReplaceFileExtension) {
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc
index 06a168d..532ca28 100644
--- a/libartbase/base/mem_map.cc
+++ b/libartbase/base/mem_map.cc
@@ -394,7 +394,7 @@
return Invalid();
}
const size_t page_aligned_byte_count = RoundUp(byte_count, kPageSize);
- return MemMap(name, addr, byte_count, addr, page_aligned_byte_count, 0, true /* reuse */);
+ return MemMap(name, addr, byte_count, addr, page_aligned_byte_count, 0, /* reuse= */ true);
}
template<typename A, typename B>
@@ -696,8 +696,8 @@
tail_name,
tail_prot,
MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
- /* fd */ -1,
- /* offset */ 0,
+ /* fd= */ -1,
+ /* offset= */ 0,
error_msg,
use_debug_name);
}
@@ -771,7 +771,7 @@
uint8_t* begin = Begin();
ReleaseReservedMemory(byte_count); // Performs necessary DCHECK()s on this reservation.
size_t base_size = RoundUp(byte_count, kPageSize);
- return MemMap(name_, begin, byte_count, begin, base_size, prot_, /* reuse */ false);
+ return MemMap(name_, begin, byte_count, begin, base_size, prot_, /* reuse= */ false);
}
void MemMap::ReleaseReservedMemory(size_t byte_count) {
diff --git a/libartbase/base/mem_map_test.cc b/libartbase/base/mem_map_test.cc
index bf143d4..5815cf9 100644
--- a/libartbase/base/mem_map_test.cc
+++ b/libartbase/base/mem_map_test.cc
@@ -53,7 +53,7 @@
// Find a valid map address and unmap it before returning.
std::string error_msg;
MemMap map = MemMap::MapAnonymous("temp",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
size,
PROT_READ,
low_4gb,
@@ -68,7 +68,7 @@
const size_t page_size = static_cast<size_t>(kPageSize);
// Map a two-page memory region.
MemMap m0 = MemMap::MapAnonymous("MemMapTest_RemapAtEndTest_map0",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
2 * page_size,
PROT_READ | PROT_WRITE,
low_4gb,
@@ -165,17 +165,17 @@
TEST_F(MemMapTest, ReplaceMapping_SameSize) {
std::string error_msg;
MemMap dest = MemMap::MapAnonymous("MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
MemMap source = MemMap::MapAnonymous("MapAnonymous-atomic-replace-source",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
void* source_addr = source.Begin();
@@ -200,21 +200,21 @@
TEST_F(MemMapTest, ReplaceMapping_MakeLarger) {
std::string error_msg;
MemMap dest = MemMap::MapAnonymous("MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
5 * kPageSize, // Need to make it larger
// initially so we know
// there won't be mappings
// in the way we we move
// source.
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
MemMap source = MemMap::MapAnonymous("MapAnonymous-atomic-replace-source",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
3 * kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
uint8_t* source_addr = source.Begin();
@@ -246,17 +246,17 @@
TEST_F(MemMapTest, ReplaceMapping_MakeSmaller) {
std::string error_msg;
MemMap dest = MemMap::MapAnonymous("MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
3 * kPageSize,
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
MemMap source = MemMap::MapAnonymous("MapAnonymous-atomic-replace-source",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
uint8_t* source_addr = source.Begin();
@@ -285,11 +285,11 @@
MemMap dest =
MemMap::MapAnonymous(
"MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
3 * kPageSize, // Need to make it larger initially so we know there won't be mappings in
// the way we we move source.
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
// Resize down to 1 page so we can remap the rest.
@@ -299,7 +299,7 @@
dest.Begin() + kPageSize,
2 * kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
ASSERT_EQ(dest.Begin() + kPageSize, source.Begin());
@@ -332,20 +332,20 @@
CommonInit();
std::string error_msg;
MemMap map = MemMap::MapAnonymous("MapAnonymousEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
0,
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_FALSE(map.IsValid()) << error_msg;
ASSERT_FALSE(error_msg.empty());
error_msg.clear();
map = MemMap::MapAnonymous("MapAnonymousNonEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -358,7 +358,7 @@
reinterpret_cast<uint8_t*>(kPageSize),
0x20000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
nullptr);
ASSERT_FALSE(map.IsValid());
}
@@ -368,20 +368,20 @@
CommonInit();
std::string error_msg;
MemMap map = MemMap::MapAnonymous("MapAnonymousEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
0,
PROT_READ,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_FALSE(map.IsValid()) << error_msg;
ASSERT_FALSE(error_msg.empty());
error_msg.clear();
map = MemMap::MapAnonymous("MapAnonymousNonEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -394,12 +394,12 @@
constexpr size_t kMapSize = kPageSize;
std::unique_ptr<uint8_t[]> data(new uint8_t[kMapSize]());
ASSERT_TRUE(scratch_file.GetFile()->WriteFully(&data[0], kMapSize));
- MemMap map = MemMap::MapFile(/*byte_count*/kMapSize,
+ MemMap map = MemMap::MapFile(/*byte_count=*/kMapSize,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /*start*/0,
- /*low_4gb*/true,
+ /*start=*/0,
+ /*low_4gb=*/true,
scratch_file.GetFilename().c_str(),
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
@@ -413,23 +413,23 @@
CommonInit();
std::string error_msg;
// Find a valid address.
- uint8_t* valid_address = GetValidMapAddress(kPageSize, /*low_4gb*/false);
+ uint8_t* valid_address = GetValidMapAddress(kPageSize, /*low_4gb=*/false);
// Map at an address that should work, which should succeed.
MemMap map0 = MemMap::MapAnonymous("MapAnonymous0",
valid_address,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map0.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
ASSERT_TRUE(map0.BaseBegin() == valid_address);
// Map at an unspecified address, which should succeed.
MemMap map1 = MemMap::MapAnonymous("MapAnonymous1",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map1.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -439,7 +439,7 @@
reinterpret_cast<uint8_t*>(map1.BaseBegin()),
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_FALSE(map2.IsValid()) << error_msg;
ASSERT_TRUE(!error_msg.empty());
@@ -469,12 +469,12 @@
memset(&data[2 * kPageSize], 0xaa, kPageSize);
ASSERT_TRUE(scratch_file.GetFile()->WriteFully(&data[0], kMapSize));
- MemMap map = MemMap::MapFile(/*byte_count*/kMapSize,
+ MemMap map = MemMap::MapFile(/*byte_count=*/kMapSize,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /*start*/0,
- /*low_4gb*/true,
+ /*start=*/0,
+ /*low_4gb=*/true,
scratch_file.GetFilename().c_str(),
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
@@ -522,7 +522,7 @@
reinterpret_cast<uint8_t*>(start_addr),
size,
PROT_READ | PROT_WRITE,
- /*low_4gb*/ true,
+ /*low_4gb=*/ true,
&error_msg);
if (map.IsValid()) {
break;
@@ -543,7 +543,7 @@
reinterpret_cast<uint8_t*>(ptr),
2 * kPageSize, // brings it over the top.
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_FALSE(map.IsValid());
ASSERT_FALSE(error_msg.empty());
@@ -558,7 +558,7 @@
reinterpret_cast<uint8_t*>(UINT64_C(0x100000000)),
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_FALSE(map.IsValid());
ASSERT_FALSE(error_msg.empty());
@@ -571,7 +571,7 @@
reinterpret_cast<uint8_t*>(0xF0000000),
0x20000000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_FALSE(map.IsValid());
ASSERT_FALSE(error_msg.empty());
@@ -585,9 +585,9 @@
nullptr,
0x20000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
- /* reuse */ false,
- /* reservation */ nullptr,
+ /* low_4gb= */ false,
+ /* reuse= */ false,
+ /* reservation= */ nullptr,
&error_msg);
ASSERT_TRUE(map.IsValid());
ASSERT_TRUE(error_msg.empty());
@@ -595,9 +595,9 @@
reinterpret_cast<uint8_t*>(map.BaseBegin()),
0x10000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
- /* reuse */ true,
- /* reservation */ nullptr,
+ /* low_4gb= */ false,
+ /* reuse= */ true,
+ /* reservation= */ nullptr,
&error_msg);
ASSERT_TRUE(map2.IsValid());
ASSERT_TRUE(error_msg.empty());
@@ -609,10 +609,10 @@
constexpr size_t kNumPages = 3;
// Map a 3-page mem map.
MemMap map = MemMap::MapAnonymous("MapAnonymous0",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize * kNumPages,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -627,7 +627,7 @@
map_base,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map0.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -635,7 +635,7 @@
map_base + kPageSize,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map1.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -643,7 +643,7 @@
map_base + kPageSize * 2,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map2.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -672,10 +672,10 @@
const size_t page_size = static_cast<size_t>(kPageSize);
// Map a region.
MemMap m0 = MemMap::MapAnonymous("MemMapTest_AlignByTest_map0",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
14 * page_size,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(m0.IsValid());
uint8_t* base0 = m0.Begin();
@@ -778,10 +778,10 @@
ASSERT_TRUE(scratch_file.GetFile()->WriteFully(&data[0], kMapSize));
MemMap reservation = MemMap::MapAnonymous("Test reservation",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kMapSize,
PROT_NONE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(reservation.IsValid());
ASSERT_TRUE(error_msg.empty());
@@ -791,14 +791,14 @@
static_assert(kChunk1Size < kMapSize, "We want to split the reservation.");
uint8_t* addr1 = reservation.Begin();
MemMap map1 = MemMap::MapFileAtAddress(addr1,
- /* byte_count */ kChunk1Size,
+ /* byte_count= */ kChunk1Size,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /* start */ 0,
- /* low_4gb */ false,
+ /* start= */ 0,
+ /* low_4gb= */ false,
scratch_file.GetFilename().c_str(),
- /* reuse */ false,
+ /* reuse= */ false,
&reservation,
&error_msg);
ASSERT_TRUE(map1.IsValid()) << error_msg;
@@ -816,10 +816,10 @@
uint8_t* addr2 = reservation.Begin();
MemMap map2 = MemMap::MapAnonymous("MiddleReservation",
addr2,
- /* byte_count */ kChunk2Size,
+ /* byte_count= */ kChunk2Size,
PROT_READ,
- /* low_4gb */ false,
- /* reuse */ false,
+ /* low_4gb= */ false,
+ /* reuse= */ false,
&reservation,
&error_msg);
ASSERT_TRUE(map2.IsValid()) << error_msg;
@@ -833,14 +833,14 @@
const size_t kChunk3Size = reservation.Size() - 1u;
uint8_t* addr3 = reservation.Begin();
MemMap map3 = MemMap::MapFileAtAddress(addr3,
- /* byte_count */ kChunk3Size,
+ /* byte_count= */ kChunk3Size,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /* start */ dchecked_integral_cast<size_t>(addr3 - addr1),
- /* low_4gb */ false,
+ /* start= */ dchecked_integral_cast<size_t>(addr3 - addr1),
+ /* low_4gb= */ false,
scratch_file.GetFilename().c_str(),
- /* reuse */ false,
+ /* reuse= */ false,
&reservation,
&error_msg);
ASSERT_TRUE(map3.IsValid()) << error_msg;
diff --git a/libartbase/base/scoped_flock.cc b/libartbase/base/scoped_flock.cc
index d679328..beee501 100644
--- a/libartbase/base/scoped_flock.cc
+++ b/libartbase/base/scoped_flock.cc
@@ -40,7 +40,7 @@
// to acquire a lock, and the unlock / close in the corresponding
// destructor. Callers should explicitly flush files they're writing to if
// that is the desired behaviour.
- std::unique_ptr<File> file(OS::OpenFileWithFlags(filename, flags, false /* check_usage */));
+ std::unique_ptr<File> file(OS::OpenFileWithFlags(filename, flags, /* auto_flush= */ false));
if (file.get() == nullptr) {
*error_msg = StringPrintf("Failed to open file '%s': %s", filename, strerror(errno));
return nullptr;
@@ -98,7 +98,7 @@
// destructor. Callers should explicitly flush files they're writing to if
// that is the desired behaviour.
ScopedFlock locked_file(
- new LockedFile(dup(fd), path, false /* check_usage */, read_only_mode));
+ new LockedFile(dup(fd), path, /* check_usage= */ false, read_only_mode));
if (locked_file->Fd() == -1) {
*error_msg = StringPrintf("Failed to duplicate open file '%s': %s",
locked_file->GetPath().c_str(), strerror(errno));
diff --git a/libartbase/base/scoped_flock_test.cc b/libartbase/base/scoped_flock_test.cc
index f9ac1e0..22356cd 100644
--- a/libartbase/base/scoped_flock_test.cc
+++ b/libartbase/base/scoped_flock_test.cc
@@ -38,7 +38,7 @@
// Attempt to acquire a second lock on the same file. This must fail.
ScopedFlock second_lock = LockedFile::Open(scratch_file.GetFilename().c_str(),
O_RDONLY,
- /* block */ false,
+ /* block= */ false,
&error_msg);
ASSERT_TRUE(second_lock.get() == nullptr);
ASSERT_TRUE(!error_msg.empty());
diff --git a/libartbase/base/zip_archive.cc b/libartbase/base/zip_archive.cc
index 174d227..f5761cf 100644
--- a/libartbase/base/zip_archive.cc
+++ b/libartbase/base/zip_archive.cc
@@ -75,10 +75,10 @@
name += " extracted in memory from ";
name += zip_filename;
MemMap map = MemMap::MapAnonymous(name.c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
GetUncompressedLength(),
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
error_msg);
if (!map.IsValid()) {
DCHECK(!error_msg->empty());
@@ -138,7 +138,7 @@
MAP_PRIVATE,
zip_fd,
offset,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
name.c_str(),
error_msg);
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc
index 4f73967..20a519b 100644
--- a/libdexfile/dex/art_dex_file_loader.cc
+++ b/libdexfile/dex/art_dex_file_loader.cc
@@ -95,7 +95,7 @@
File fd;
if (zip_fd != -1) {
if (ReadMagicAndReset(zip_fd, &magic, error_msg)) {
- fd = File(DupCloexec(zip_fd), false /* check_usage */);
+ fd = File(DupCloexec(zip_fd), /* check_usage= */ false);
}
} else {
fd = OpenAndReadMagic(filename, &magic, error_msg);
@@ -142,9 +142,9 @@
if (IsMagicValid(magic)) {
std::unique_ptr<const DexFile> dex_file(OpenFile(fd.Release(),
filename,
- /* verify */ false,
- /* verify_checksum */ false,
- /* mmap_shared */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
+ /* mmap_shared= */ false,
error_msg));
if (dex_file == nullptr) {
return false;
@@ -167,16 +167,16 @@
ScopedTrace trace(std::string("Open dex file from RAM ") + location);
return OpenCommon(base,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
location_checksum,
oat_dex_file,
verify,
verify_checksum,
error_msg,
- /*container*/ nullptr,
- /*verify_result*/ nullptr);
+ /*container=*/ nullptr,
+ /*verify_result=*/ nullptr);
}
std::unique_ptr<const DexFile> ArtDexFileLoader::Open(const std::string& location,
@@ -199,8 +199,8 @@
uint8_t* begin = map.Begin();
std::unique_ptr<DexFile> dex_file = OpenCommon(begin,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
location_checksum,
kNoOatDexFile,
@@ -208,7 +208,7 @@
verify_checksum,
error_msg,
std::make_unique<MemMapContainer>(std::move(map)),
- /*verify_result*/ nullptr);
+ /*verify_result=*/ nullptr);
// Opening CompactDex is only supported from vdex files.
if (dex_file != nullptr && dex_file->IsCompactDexFile()) {
*error_msg = StringPrintf("Opening CompactDex file '%s' is only supported from vdex files",
@@ -240,7 +240,7 @@
location,
verify,
verify_checksum,
- /* mmap_shared */ false,
+ /* mmap_shared= */ false,
error_msg));
if (dex_file.get() != nullptr) {
dex_files->push_back(std::move(dex_file));
@@ -290,7 +290,7 @@
CHECK(!location.empty());
MemMap map;
{
- File delayed_close(fd, /* check_usage */ false);
+ File delayed_close(fd, /* check_usage= */ false);
struct stat sbuf;
memset(&sbuf, 0, sizeof(sbuf));
if (fstat(fd, &sbuf) == -1) {
@@ -308,7 +308,7 @@
mmap_shared ? MAP_SHARED : MAP_PRIVATE,
fd,
0,
- /*low_4gb*/false,
+ /*low_4gb=*/false,
location.c_str(),
error_msg);
if (!map.IsValid()) {
@@ -330,8 +330,8 @@
std::unique_ptr<DexFile> dex_file = OpenCommon(begin,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
dex_header->checksum_,
kNoOatDexFile,
@@ -339,7 +339,7 @@
verify_checksum,
error_msg,
std::make_unique<MemMapContainer>(std::move(map)),
- /*verify_result*/ nullptr);
+ /*verify_result=*/ nullptr);
// Opening CompactDex is only supported from vdex files.
if (dex_file != nullptr && dex_file->IsCompactDexFile()) {
@@ -407,8 +407,8 @@
size_t size = map.Size();
std::unique_ptr<DexFile> dex_file = OpenCommon(begin,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
zip_entry->GetCrc32(),
kNoOatDexFile,
diff --git a/libdexfile/dex/art_dex_file_loader_test.cc b/libdexfile/dex/art_dex_file_loader_test.cc
index a7d0363..f7a2062 100644
--- a/libdexfile/dex/art_dex_file_loader_test.cc
+++ b/libdexfile/dex/art_dex_file_loader_test.cc
@@ -217,9 +217,9 @@
std::string plain_method = std::string("GetMethodSignature.") + r.name;
ASSERT_EQ(plain_method,
- raw->PrettyMethod(cur_method->GetIndex(), /* with_signature */ false));
+ raw->PrettyMethod(cur_method->GetIndex(), /* with_signature= */ false));
ASSERT_EQ(r.pretty_method,
- raw->PrettyMethod(cur_method->GetIndex(), /* with_signature */ true));
+ raw->PrettyMethod(cur_method->GetIndex(), /* with_signature= */ true));
}
}
@@ -332,8 +332,8 @@
std::string error_msg;
bool success = loader.Open(data_location_path.c_str(),
data_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -360,8 +360,8 @@
std::string error_msg;
bool success = loader.Open(system_location_path.c_str(),
system_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -388,8 +388,8 @@
std::string error_msg;
bool success = loader.Open(system_framework_location_path.c_str(),
system_framework_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -416,8 +416,8 @@
std::string error_msg;
bool success = loader.Open(data_multi_location_path.c_str(),
data_multi_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -445,8 +445,8 @@
std::string error_msg;
bool success = loader.Open(system_multi_location_path.c_str(),
system_multi_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -474,8 +474,8 @@
std::string error_msg;
bool success = loader.Open(system_framework_multi_location_path.c_str(),
system_framework_multi_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
diff --git a/libdexfile/dex/code_item_accessors_test.cc b/libdexfile/dex/code_item_accessors_test.cc
index 2bb4dde..87f4bab 100644
--- a/libdexfile/dex/code_item_accessors_test.cc
+++ b/libdexfile/dex/code_item_accessors_test.cc
@@ -45,10 +45,10 @@
std::unique_ptr<const DexFile> dex(dex_file_loader.Open(data->data(),
data->size(),
"location",
- /*location_checksum*/ 123,
- /*oat_dex_file*/nullptr,
- /*verify*/false,
- /*verify_checksum*/false,
+ /*location_checksum=*/ 123,
+ /*oat_dex_file=*/nullptr,
+ /*verify=*/false,
+ /*verify_checksum=*/false,
&error_msg));
CHECK(dex != nullptr) << error_msg;
return dex;
@@ -56,11 +56,11 @@
TEST(CodeItemAccessorsTest, TestDexInstructionsAccessor) {
std::vector<uint8_t> standard_dex_data;
- std::unique_ptr<const DexFile> standard_dex(CreateFakeDex(/*compact_dex*/false,
+ std::unique_ptr<const DexFile> standard_dex(CreateFakeDex(/*compact_dex=*/false,
&standard_dex_data));
ASSERT_TRUE(standard_dex != nullptr);
std::vector<uint8_t> compact_dex_data;
- std::unique_ptr<const DexFile> compact_dex(CreateFakeDex(/*compact_dex*/true,
+ std::unique_ptr<const DexFile> compact_dex(CreateFakeDex(/*compact_dex=*/true,
&compact_dex_data));
ASSERT_TRUE(compact_dex != nullptr);
static constexpr uint16_t kRegisterSize = 2;
diff --git a/libdexfile/dex/compact_dex_file.cc b/libdexfile/dex/compact_dex_file.cc
index 302b59e..641c523 100644
--- a/libdexfile/dex/compact_dex_file.cc
+++ b/libdexfile/dex/compact_dex_file.cc
@@ -100,7 +100,7 @@
location_checksum,
oat_dex_file,
std::move(container),
- /*is_compact_dex*/ true),
+ /*is_compact_dex=*/ true),
debug_info_offsets_(DataBegin() + GetHeader().debug_info_offsets_pos_,
GetHeader().debug_info_base_,
GetHeader().debug_info_offsets_table_offset_) {}
diff --git a/libdexfile/dex/compact_dex_file_test.cc b/libdexfile/dex/compact_dex_file_test.cc
index 517c587..799967e 100644
--- a/libdexfile/dex/compact_dex_file_test.cc
+++ b/libdexfile/dex/compact_dex_file_test.cc
@@ -68,11 +68,11 @@
uint16_t out_outs_size;
uint16_t out_tries_size;
uint32_t out_insns_size_in_code_units;
- code_item->DecodeFields</*kDecodeOnlyInstructionCount*/false>(&out_insns_size_in_code_units,
- &out_registers_size,
- &out_ins_size,
- &out_outs_size,
- &out_tries_size);
+ code_item->DecodeFields</*kDecodeOnlyInstructionCount=*/false>(&out_insns_size_in_code_units,
+ &out_registers_size,
+ &out_ins_size,
+ &out_outs_size,
+ &out_tries_size);
ASSERT_EQ(registers_size, out_registers_size);
ASSERT_EQ(ins_size, out_ins_size);
ASSERT_EQ(outs_size, out_outs_size);
@@ -80,11 +80,11 @@
ASSERT_EQ(insns_size_in_code_units, out_insns_size_in_code_units);
++out_insns_size_in_code_units; // Force value to change.
- code_item->DecodeFields</*kDecodeOnlyInstructionCount*/true>(&out_insns_size_in_code_units,
- /*registers_size*/ nullptr,
- /*ins_size*/ nullptr,
- /*outs_size*/ nullptr,
- /*tries_size*/ nullptr);
+ code_item->DecodeFields</*kDecodeOnlyInstructionCount=*/true>(&out_insns_size_in_code_units,
+ /*registers_size=*/ nullptr,
+ /*ins_size=*/ nullptr,
+ /*outs_size=*/ nullptr,
+ /*tries_size=*/ nullptr);
ASSERT_EQ(insns_size_in_code_units, out_insns_size_in_code_units);
};
static constexpr uint32_t kMax32 = std::numeric_limits<uint32_t>::max();
diff --git a/libdexfile/dex/dex_file_loader.cc b/libdexfile/dex/dex_file_loader.cc
index 4aafc66..3667c8c 100644
--- a/libdexfile/dex/dex_file_loader.cc
+++ b/libdexfile/dex/dex_file_loader.cc
@@ -222,16 +222,16 @@
std::string* error_msg) const {
return OpenCommon(base,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0,
location,
location_checksum,
oat_dex_file,
verify,
verify_checksum,
error_msg,
- /*container*/ nullptr,
- /*verify_result*/ nullptr);
+ /*container=*/ nullptr,
+ /*verify_result=*/ nullptr);
}
std::unique_ptr<const DexFile> DexFileLoader::OpenWithDataSection(
@@ -255,8 +255,8 @@
verify,
verify_checksum,
error_msg,
- /*container*/ nullptr,
- /*verify_result*/ nullptr);
+ /*container=*/ nullptr,
+ /*verify_result=*/ nullptr);
}
bool DexFileLoader::OpenAll(
@@ -290,7 +290,7 @@
size,
location,
dex_header->checksum_,
- /*oat_dex_file*/ nullptr,
+ /*oat_dex_file=*/ nullptr,
verify,
verify_checksum,
error_msg));
@@ -410,11 +410,11 @@
std::unique_ptr<const DexFile> dex_file = OpenCommon(
map.data(),
map.size(),
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
zip_entry->GetCrc32(),
- /*oat_dex_file*/ nullptr,
+ /*oat_dex_file=*/ nullptr,
verify,
verify_checksum,
error_msg,
diff --git a/libdexfile/dex/dex_file_loader_test.cc b/libdexfile/dex/dex_file_loader_test.cc
index 5378617..9c61d1a 100644
--- a/libdexfile/dex/dex_file_loader_test.cc
+++ b/libdexfile/dex/dex_file_loader_test.cc
@@ -221,7 +221,7 @@
bool success = dex_file_loader.OpenAll(dex_bytes->data(),
dex_bytes->size(),
location,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
error_code,
error_msg,
@@ -256,9 +256,9 @@
dex_bytes->size(),
location,
location_checksum,
- /* oat_dex_file */ nullptr,
- /* verify */ true,
- /* verify_checksum */ true,
+ /* oat_dex_file= */ nullptr,
+ /* verify= */ true,
+ /* verify_checksum= */ true,
&error_message));
if (expect_success) {
CHECK(dex_file != nullptr) << error_message;
@@ -348,7 +348,7 @@
ASSERT_FALSE(dex_file_loader.OpenAll(dex_bytes.data(),
dex_bytes.size(),
kLocationString,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
&error_code,
&error_msg,
@@ -367,7 +367,7 @@
ASSERT_FALSE(dex_file_loader.OpenAll(dex_bytes.data(),
dex_bytes.size(),
kLocationString,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
&error_code,
&error_msg,
@@ -386,7 +386,7 @@
ASSERT_FALSE(dex_file_loader.OpenAll(dex_bytes.data(),
dex_bytes.size(),
kLocationString,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
&error_code,
&error_msg,
diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc
index f273c84..499a89b 100644
--- a/libdexfile/dex/dex_file_verifier.cc
+++ b/libdexfile/dex/dex_file_verifier.cc
@@ -341,42 +341,43 @@
bool result =
CheckValidOffsetAndSize(header_->link_off_,
header_->link_size_,
- 0 /* unaligned */,
+ /* alignment= */ 0,
"link") &&
CheckValidOffsetAndSize(header_->map_off_,
header_->map_off_,
- 4,
+ /* alignment= */ 4,
"map") &&
CheckValidOffsetAndSize(header_->string_ids_off_,
header_->string_ids_size_,
- 4,
+ /* alignment= */ 4,
"string-ids") &&
CheckValidOffsetAndSize(header_->type_ids_off_,
header_->type_ids_size_,
- 4,
+ /* alignment= */ 4,
"type-ids") &&
CheckSizeLimit(header_->type_ids_size_, DexFile::kDexNoIndex16, "type-ids") &&
CheckValidOffsetAndSize(header_->proto_ids_off_,
header_->proto_ids_size_,
- 4,
+ /* alignment= */ 4,
"proto-ids") &&
CheckSizeLimit(header_->proto_ids_size_, DexFile::kDexNoIndex16, "proto-ids") &&
CheckValidOffsetAndSize(header_->field_ids_off_,
header_->field_ids_size_,
- 4,
+ /* alignment= */ 4,
"field-ids") &&
CheckValidOffsetAndSize(header_->method_ids_off_,
header_->method_ids_size_,
- 4,
+ /* alignment= */ 4,
"method-ids") &&
CheckValidOffsetAndSize(header_->class_defs_off_,
header_->class_defs_size_,
- 4,
+ /* alignment= */ 4,
"class-defs") &&
CheckValidOffsetAndSize(header_->data_off_,
header_->data_size_,
- 0, // Unaligned, spec doesn't talk about it, even though size
- // is supposed to be a multiple of 4.
+ // Unaligned, spec doesn't talk about it, even though size
+ // is supposed to be a multiple of 4.
+ /* alignment= */ 0,
"data");
return result;
}
@@ -1197,7 +1198,7 @@
ClassAccessor::Method method(*dex_file_, field.ptr_pos_);
if (!CheckIntraClassDataItemMethods(&method,
accessor.NumDirectMethods(),
- nullptr /* direct_it */,
+ /* direct_method= */ nullptr,
0u,
&have_class,
&class_type_index,
diff --git a/libdexfile/dex/dex_file_verifier_test.cc b/libdexfile/dex/dex_file_verifier_test.cc
index a22a457..c3180f0 100644
--- a/libdexfile/dex/dex_file_verifier_test.cc
+++ b/libdexfile/dex/dex_file_verifier_test.cc
@@ -107,8 +107,8 @@
bool success = dex_file_loader.OpenAll(dex_bytes.get(),
length,
location,
- /* verify */ true,
- /* verify_checksum */ true,
+ /* verify= */ true,
+ /* verify_checksum= */ true,
&error_code,
error_msg,
&tmp);
@@ -1621,13 +1621,13 @@
dex_file->Begin(),
dex_file->Size(),
"good checksum, no verify",
- /*verify_checksum*/ false,
+ /*verify_checksum=*/ false,
&error_msg));
EXPECT_TRUE(DexFileVerifier::Verify(dex_file.get(),
dex_file->Begin(),
dex_file->Size(),
"good checksum, verify",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
// Bad checksum: !verify_checksum passes verify_checksum fails.
@@ -1638,13 +1638,13 @@
dex_file->Begin(),
dex_file->Size(),
"bad checksum, no verify",
- /*verify_checksum*/ false,
+ /*verify_checksum=*/ false,
&error_msg));
EXPECT_FALSE(DexFileVerifier::Verify(dex_file.get(),
dex_file->Begin(),
dex_file->Size(),
"bad checksum, verify",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
EXPECT_NE(error_msg.find("Bad checksum"), std::string::npos) << error_msg;
}
@@ -1691,7 +1691,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad static method name",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1735,7 +1735,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad virtual method name",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1779,7 +1779,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad clinit signature",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1823,7 +1823,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad clinit signature",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1860,7 +1860,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad init signature",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -2063,7 +2063,7 @@
dex_file->Begin(),
dex_file->Size(),
"good checksum, verify",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
// TODO(oth): Test corruptions (b/35308502)
}
@@ -2110,7 +2110,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad static field initial values array",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -2166,7 +2166,7 @@
dex_file->Begin(),
dex_file->Size(),
"good static field initial values array",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
diff --git a/libdexfile/dex/dex_instruction_test.cc b/libdexfile/dex/dex_instruction_test.cc
index 6ce9dba..02400f4 100644
--- a/libdexfile/dex/dex_instruction_test.cc
+++ b/libdexfile/dex/dex_instruction_test.cc
@@ -71,10 +71,13 @@
TEST(Instruction, PropertiesOf45cc) {
uint16_t instruction[4];
- Build45cc(4u /* num_vregs */, 16u /* method_idx */, 32u /* proto_idx */,
- 0xcafe /* arg_regs */, instruction);
+ Build45cc(/* num_args= */ 4u,
+ /* method_idx= */ 16u,
+ /* proto_idx= */ 32u,
+ /* arg_regs= */ 0xcafe,
+ instruction);
- DexInstructionIterator ins(instruction, /*dex_pc*/ 0u);
+ DexInstructionIterator ins(instruction, /*dex_pc=*/ 0u);
ASSERT_EQ(4u, ins->SizeInCodeUnits());
ASSERT_TRUE(ins->HasVRegA());
@@ -106,10 +109,13 @@
TEST(Instruction, PropertiesOf4rcc) {
uint16_t instruction[4];
- Build4rcc(4u /* num_vregs */, 16u /* method_idx */, 32u /* proto_idx */,
- 0xcafe /* arg_regs */, instruction);
+ Build4rcc(/* num_args= */ 4u,
+ /* method_idx= */ 16u,
+ /* proto_idx= */ 32u,
+ /* arg_regs_start= */ 0xcafe,
+ instruction);
- DexInstructionIterator ins(instruction, /*dex_pc*/ 0u);
+ DexInstructionIterator ins(instruction, /*dex_pc=*/ 0u);
ASSERT_EQ(4u, ins->SizeInCodeUnits());
ASSERT_TRUE(ins->HasVRegA());
diff --git a/libdexfile/dex/type_lookup_table.cc b/libdexfile/dex/type_lookup_table.cc
index 00ec358..7d80a2e 100644
--- a/libdexfile/dex/type_lookup_table.cc
+++ b/libdexfile/dex/type_lookup_table.cc
@@ -94,7 +94,7 @@
DCHECK_ALIGNED(raw_data, alignof(Entry));
const Entry* entries = reinterpret_cast<const Entry*>(raw_data);
size_t mask_bits = CalculateMaskBits(num_class_defs);
- return TypeLookupTable(dex_data_pointer, mask_bits, entries, /* owned_entries */ nullptr);
+ return TypeLookupTable(dex_data_pointer, mask_bits, entries, /* owned_entries= */ nullptr);
}
uint32_t TypeLookupTable::Lookup(const char* str, uint32_t hash) const {
diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc
index 2ebde5e..6bd49a4 100644
--- a/libprofile/profile/profile_compilation_info.cc
+++ b/libprofile/profile/profile_compilation_info.cc
@@ -190,8 +190,8 @@
bool ProfileCompilationInfo::MergeWith(const std::string& filename) {
std::string error;
int flags = O_RDONLY | O_NOFOLLOW | O_CLOEXEC;
- ScopedFlock profile_file = LockedFile::Open(filename.c_str(), flags,
- /*block*/false, &error);
+ ScopedFlock profile_file =
+ LockedFile::Open(filename.c_str(), flags, /*block=*/false, &error);
if (profile_file.get() == nullptr) {
LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error;
@@ -221,8 +221,8 @@
// There's no need to fsync profile data right away. We get many chances
// to write it again in case something goes wrong. We can rely on a simple
// close(), no sync, and let to the kernel decide when to write to disk.
- ScopedFlock profile_file = LockedFile::Open(filename.c_str(), flags,
- /*block*/false, &error);
+ ScopedFlock profile_file =
+ LockedFile::Open(filename.c_str(), flags, /*block=*/false, &error);
if (profile_file.get() == nullptr) {
LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error;
@@ -259,8 +259,8 @@
// There's no need to fsync profile data right away. We get many chances
// to write it again in case something goes wrong. We can rely on a simple
// close(), no sync, and let to the kernel decide when to write to disk.
- ScopedFlock profile_file = LockedFile::Open(filename.c_str(), flags,
- /*block*/false, &error);
+ ScopedFlock profile_file =
+ LockedFile::Open(filename.c_str(), flags, /*block=*/false, &error);
if (profile_file.get() == nullptr) {
LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error;
return false;
@@ -1393,8 +1393,8 @@
// verify_checksum is false because we want to differentiate between a missing dex data and
// a mismatched checksum.
const DexFileData* dex_data = FindDexData(other_profile_line_header.dex_location,
- 0u,
- false /* verify_checksum */);
+ /* checksum= */ 0u,
+ /* verify_checksum= */ false);
if ((dex_data != nullptr) && (dex_data->checksum != other_profile_line_header.checksum)) {
LOG(WARNING) << "Checksum mismatch for dex " << other_profile_line_header.dex_location;
return false;
@@ -1481,8 +1481,8 @@
// verify_checksum is false because we want to differentiate between a missing dex data and
// a mismatched checksum.
const DexFileData* dex_data = FindDexData(other_dex_data->profile_key,
- 0u,
- /* verify_checksum */ false);
+ /* checksum= */ 0u,
+ /* verify_checksum= */ false);
if ((dex_data != nullptr) && (dex_data->checksum != other_dex_data->checksum)) {
LOG(WARNING) << "Checksum mismatch for dex " << other_dex_data->profile_key;
return false;
@@ -1829,7 +1829,7 @@
flags |= ((m & 1) != 0) ? MethodHotness::kFlagPostStartup : MethodHotness::kFlagStartup;
info.AddMethodIndex(static_cast<MethodHotness::Flag>(flags),
profile_key,
- /*method_idx*/ 0,
+ /*checksum=*/ 0,
method_idx,
max_method);
}
@@ -1975,20 +1975,20 @@
MethodHotness::Flag flags) {
DCHECK_LT(index, num_method_ids);
if ((flags & MethodHotness::kFlagStartup) != 0) {
- method_bitmap.StoreBit(MethodBitIndex(/*startup*/ true, index), /*value*/ true);
+ method_bitmap.StoreBit(MethodBitIndex(/*startup=*/ true, index), /*value=*/ true);
}
if ((flags & MethodHotness::kFlagPostStartup) != 0) {
- method_bitmap.StoreBit(MethodBitIndex(/*startup*/ false, index), /*value*/ true);
+ method_bitmap.StoreBit(MethodBitIndex(/*startup=*/ false, index), /*value=*/ true);
}
}
ProfileCompilationInfo::MethodHotness ProfileCompilationInfo::DexFileData::GetHotnessInfo(
uint32_t dex_method_index) const {
MethodHotness ret;
- if (method_bitmap.LoadBit(MethodBitIndex(/*startup*/ true, dex_method_index))) {
+ if (method_bitmap.LoadBit(MethodBitIndex(/*startup=*/ true, dex_method_index))) {
ret.AddFlag(MethodHotness::kFlagStartup);
}
- if (method_bitmap.LoadBit(MethodBitIndex(/*startup*/ false, dex_method_index))) {
+ if (method_bitmap.LoadBit(MethodBitIndex(/*startup=*/ false, dex_method_index))) {
ret.AddFlag(MethodHotness::kFlagPostStartup);
}
auto it = method_map.find(dex_method_index);
diff --git a/libprofile/profile/profile_compilation_info_test.cc b/libprofile/profile/profile_compilation_info_test.cc
index 417abaa..a2bfe50 100644
--- a/libprofile/profile/profile_compilation_info_test.cc
+++ b/libprofile/profile/profile_compilation_info_test.cc
@@ -43,22 +43,22 @@
protected:
bool AddMethod(const std::string& dex_location,
uint32_t checksum,
- uint16_t method_index,
+ uint16_t method_idx,
ProfileCompilationInfo* info) {
return info->AddMethodIndex(Hotness::kFlagHot,
dex_location,
checksum,
- method_index,
+ method_idx,
kMaxMethodIds);
}
bool AddMethod(const std::string& dex_location,
uint32_t checksum,
- uint16_t method_index,
+ uint16_t method_idx,
const ProfileCompilationInfo::OfflineProfileMethodInfo& pmi,
ProfileCompilationInfo* info) {
return info->AddMethod(
- dex_location, checksum, method_index, kMaxMethodIds, pmi, Hotness::kFlagPostStartup);
+ dex_location, checksum, method_idx, kMaxMethodIds, pmi, Hotness::kFlagPostStartup);
}
bool AddClass(const std::string& dex_location,
@@ -115,9 +115,9 @@
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */1, kMaxMethodIds);
- pmi.dex_references.emplace_back("dex_location2", /* checksum */2, kMaxMethodIds);
- pmi.dex_references.emplace_back("dex_location3", /* checksum */3, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location2", /* checksum= */2, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location3", /* checksum= */3, kMaxMethodIds);
return pmi;
}
@@ -148,8 +148,8 @@
ScratchFile profile;
ProfileCompilationInfo saved_info;
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
ASSERT_EQ(0, profile.GetFile()->Flush());
@@ -207,8 +207,8 @@
ProfileCompilationInfo saved_info;
// Save a few methods.
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
ASSERT_EQ(0, profile.GetFile()->Flush());
@@ -221,9 +221,9 @@
// Save more methods.
for (uint16_t i = 0; i < 100; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location3", /* checksum */ 3, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location3", /* checksum= */ 3, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(profile.GetFile()->ResetOffset());
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -240,19 +240,19 @@
ScratchFile profile;
ProfileCompilationInfo info;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 1, /* method_idx */ 1, &info));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 1, /* method_idx= */ 1, &info));
// Trying to add info for an existing file but with a different checksum.
- ASSERT_FALSE(AddMethod("dex_location", /* checksum */ 2, /* method_idx */ 2, &info));
+ ASSERT_FALSE(AddMethod("dex_location", /* checksum= */ 2, /* method_idx= */ 2, &info));
}
TEST_F(ProfileCompilationInfoTest, MergeFail) {
ScratchFile profile;
ProfileCompilationInfo info1;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 1, /* method_idx */ 1, &info1));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 1, /* method_idx= */ 1, &info1));
// Use the same file, change the checksum.
ProfileCompilationInfo info2;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 2, /* method_idx */ 2, &info2));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 2, /* method_idx= */ 2, &info2));
ASSERT_FALSE(info1.MergeWith(info2));
}
@@ -262,10 +262,10 @@
ScratchFile profile;
ProfileCompilationInfo info1;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 1, /* method_idx */ 1, &info1));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 1, /* method_idx= */ 1, &info1));
// Use the same file, change the checksum.
ProfileCompilationInfo info2;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 2, /* method_idx */ 2, &info2));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 2, /* method_idx= */ 2, &info2));
ASSERT_TRUE(info1.Save(profile.GetFd()));
ASSERT_EQ(0, profile.GetFile()->Flush());
@@ -280,13 +280,13 @@
ProfileCompilationInfo saved_info;
// Save the maximum number of methods
for (uint16_t i = 0; i < std::numeric_limits<uint16_t>::max(); i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
}
// Save the maximum number of classes
for (uint16_t i = 0; i < std::numeric_limits<uint16_t>::max(); i++) {
- ASSERT_TRUE(AddClass("dex_location1", /* checksum */ 1, dex::TypeIndex(i), &saved_info));
- ASSERT_TRUE(AddClass("dex_location2", /* checksum */ 2, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location1", /* checksum= */ 1, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location2", /* checksum= */ 2, dex::TypeIndex(i), &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -390,7 +390,7 @@
ProfileCompilationInfo saved_info;
// Save the maximum number of methods
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -415,9 +415,9 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the
// class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -431,11 +431,11 @@
ASSERT_TRUE(loaded_info.Equals(saved_info));
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi);
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi2 =
- loaded_info.GetMethod("dex_location4", /* checksum */ 4, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location4", /* dex_checksum= */ 4, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi2 != nullptr);
ASSERT_TRUE(*loaded_pmi2 == pmi);
}
@@ -448,7 +448,7 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -459,7 +459,7 @@
ProfileCompilationInfo::OfflineProfileMethodInfo pmi_extra = GetOfflineProfileMethodInfo();
MakeMegamorphic(&pmi_extra);
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info_extra));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info_extra));
}
ASSERT_TRUE(profile.GetFile()->ResetOffset());
@@ -477,7 +477,7 @@
ASSERT_TRUE(loaded_info.Equals(saved_info));
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi_extra);
@@ -491,7 +491,7 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -502,7 +502,7 @@
ProfileCompilationInfo::OfflineProfileMethodInfo pmi_extra = GetOfflineProfileMethodInfo();
MakeMegamorphic(&pmi_extra);
for (uint16_t method_idx = 5; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info_extra));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info_extra));
}
// Mark all inline caches with missing types and add them to the profile again.
@@ -510,7 +510,7 @@
ProfileCompilationInfo::OfflineProfileMethodInfo missing_types = GetOfflineProfileMethodInfo();
SetIsMissingTypes(&missing_types);
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info_extra));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info_extra));
}
ASSERT_TRUE(profile.GetFile()->ResetOffset());
@@ -528,7 +528,7 @@
ASSERT_TRUE(loaded_info.Equals(saved_info));
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi_extra);
}
@@ -542,8 +542,8 @@
// Modify the checksum to trigger a mismatch.
pmi2.dex_references[0].dex_checksum++;
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /*method_idx*/ 0, pmi1, &info));
- ASSERT_FALSE(AddMethod("dex_location2", /* checksum */ 2, /*method_idx*/ 0, pmi2, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /*method_idx=*/ 0, pmi1, &info));
+ ASSERT_FALSE(AddMethod("dex_location2", /* checksum= */ 2, /*method_idx=*/ 0, pmi2, &info));
}
// Verify that profiles behave correctly even if the methods are added in a different
@@ -556,8 +556,8 @@
ProfileCompilationInfo::InlineCacheMap* ic_map = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
- pmi.dex_references.emplace_back("dex_location2", /* checksum */ 2, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location2", /* checksum= */ 2, kMaxMethodIds);
for (uint16_t dex_pc = 1; dex_pc < 5; dex_pc++) {
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.AddClass(0, dex::TypeIndex(0));
@@ -567,8 +567,8 @@
ProfileCompilationInfo::InlineCacheMap* ic_map_reindexed = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi_reindexed(ic_map_reindexed);
- pmi_reindexed.dex_references.emplace_back("dex_location2", /* checksum */ 2, kMaxMethodIds);
- pmi_reindexed.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
+ pmi_reindexed.dex_references.emplace_back("dex_location2", /* checksum= */ 2, kMaxMethodIds);
+ pmi_reindexed.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
for (uint16_t dex_pc = 1; dex_pc < 5; dex_pc++) {
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.AddClass(1, dex::TypeIndex(0));
@@ -579,15 +579,15 @@
// Profile 1 and Profile 2 get the same methods but in different order.
// This will trigger a different dex numbers.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, method_idx, pmi, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, method_idx, pmi, &info));
}
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
ASSERT_TRUE(AddMethod(
- "dex_location2", /* checksum */ 2, method_idx, pmi_reindexed, &info_reindexed));
+ "dex_location2", /* checksum= */ 2, method_idx, pmi_reindexed, &info_reindexed));
ASSERT_TRUE(AddMethod(
- "dex_location1", /* checksum */ 1, method_idx, pmi_reindexed, &info_reindexed));
+ "dex_location1", /* checksum= */ 1, method_idx, pmi_reindexed, &info_reindexed));
}
ProfileCompilationInfo info_backup;
@@ -597,11 +597,11 @@
ASSERT_TRUE(info.Equals(info_backup));
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- info.GetMethod("dex_location1", /* checksum */ 1, method_idx);
+ info.GetMethod("dex_location1", /* dex_checksum= */ 1, method_idx);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi);
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi2 =
- info.GetMethod("dex_location2", /* checksum */ 2, method_idx);
+ info.GetMethod("dex_location2", /* dex_checksum= */ 2, method_idx);
ASSERT_TRUE(loaded_pmi2 != nullptr);
ASSERT_TRUE(*loaded_pmi2 == pmi);
}
@@ -612,34 +612,34 @@
// Save a few methods.
for (uint16_t i = 0; i < std::numeric_limits<uint8_t>::max(); i++) {
std::string dex_location = std::to_string(i);
- ASSERT_TRUE(AddMethod(dex_location, /* checksum */ 1, /* method_idx */ i, &info));
+ ASSERT_TRUE(AddMethod(dex_location, /* checksum= */ 1, /* method_idx= */ i, &info));
}
// We only support at most 255 dex files.
ASSERT_FALSE(AddMethod(
- /*dex_location*/ "256", /* checksum */ 1, /* method_idx */ 0, &info));
+ /*dex_location=*/ "256", /* checksum= */ 1, /* method_idx= */ 0, &info));
}
TEST_F(ProfileCompilationInfoTest, MegamorphicInlineCachesMerge) {
// Create a megamorphic inline cache.
ProfileCompilationInfo::InlineCacheMap* ic_map = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.SetIsMegamorphic();
ic_map->Put(/*dex_pc*/ 0, dex_pc_data);
ProfileCompilationInfo info_megamorphic;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
pmi,
&info_megamorphic));
// Create a profile with no inline caches (for the same method).
ProfileCompilationInfo info_no_inline_cache;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
&info_no_inline_cache));
// Merge the megamorphic cache into the empty one.
@@ -653,23 +653,23 @@
// Create an inline cache with missing types
ProfileCompilationInfo::InlineCacheMap* ic_map = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.SetIsMissingTypes();
ic_map->Put(/*dex_pc*/ 0, dex_pc_data);
ProfileCompilationInfo info_megamorphic;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
pmi,
&info_megamorphic));
// Create a profile with no inline caches (for the same method).
ProfileCompilationInfo info_no_inline_cache;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
&info_no_inline_cache));
// Merge the missing type cache into the empty one.
@@ -766,26 +766,26 @@
TEST_F(ProfileCompilationInfoTest, LoadFromZipCompress) {
TestProfileLoadFromZip("primary.prof",
ZipWriter::kCompress | ZipWriter::kAlign32,
- /*should_succeed*/true);
+ /*should_succeed=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipUnCompress) {
TestProfileLoadFromZip("primary.prof",
ZipWriter::kAlign32,
- /*should_succeed*/true);
+ /*should_succeed=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipUnAligned) {
TestProfileLoadFromZip("primary.prof",
0,
- /*should_succeed*/true);
+ /*should_succeed=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipFailBadZipEntry) {
TestProfileLoadFromZip("invalid.profile.entry",
0,
- /*should_succeed*/true,
- /*should_succeed_with_empty_profile*/true);
+ /*should_succeed=*/true,
+ /*should_succeed_with_empty_profile=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipFailBadProfile) {
@@ -835,7 +835,7 @@
info.AddMethodIndex(Hotness::kFlagHot,
old_name,
dex->GetLocationChecksum(),
- /* method_idx */ 0,
+ /* method_idx= */ 0,
dex->NumMethodIds());
}
@@ -845,7 +845,7 @@
// Verify that we find the methods when searched with the original dex files.
for (const std::unique_ptr<const DexFile>& dex : dex_files) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi =
- info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* method_idx */ 0);
+ info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* dex_method_index= */ 0);
ASSERT_TRUE(loaded_pmi != nullptr);
}
}
@@ -856,9 +856,9 @@
ProfileCompilationInfo info;
info.AddMethodIndex(Hotness::kFlagHot,
"my.app",
- /* checksum */ 123,
- /* method_idx */ 0,
- /* num_method_ids */ 10);
+ /* checksum= */ 123,
+ /* method_idx= */ 0,
+ /* num_method_ids= */ 10);
// Update the profile keys based on the original dex files
ASSERT_TRUE(info.UpdateProfileKeys(dex_files));
@@ -867,13 +867,13 @@
// location.
for (const std::unique_ptr<const DexFile>& dex : dex_files) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi =
- info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* method_idx */ 0);
+ info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* dex_method_index= */ 0);
ASSERT_TRUE(loaded_pmi == nullptr);
}
// Verify that we can find the original entry.
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi =
- info.GetMethod("my.app", /* checksum */ 123, /* method_idx */ 0);
+ info.GetMethod("my.app", /* dex_checksum= */ 123, /* dex_method_index= */ 0);
ASSERT_TRUE(loaded_pmi != nullptr);
}
@@ -892,7 +892,7 @@
info.AddMethodIndex(Hotness::kFlagHot,
old_name,
dex->GetLocationChecksum(),
- /* method_idx */ 0,
+ /* method_idx= */ 0,
dex->NumMethodIds());
}
@@ -900,8 +900,8 @@
// This will cause the rename to fail because an existing entry would already have that name.
info.AddMethodIndex(Hotness::kFlagHot,
dex_files[0]->GetLocation(),
- /* checksum */ 123,
- /* method_idx */ 0,
+ /* checksum= */ 123,
+ /* method_idx= */ 0,
dex_files[0]->NumMethodIds());
ASSERT_FALSE(info.UpdateProfileKeys(dex_files));
@@ -916,10 +916,10 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -941,8 +941,12 @@
// Dex location 2 and 4 should have been filtered out
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location2", /* checksum */ 2, method_idx));
- ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location4", /* checksum */ 4, method_idx));
+ ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location2",
+ /* dex_checksum= */ 2,
+ method_idx));
+ ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location4",
+ /* dex_checksum= */ 4,
+ method_idx));
}
// Dex location 1 should have all all the inline caches referencing dex location 2 set to
@@ -950,7 +954,7 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// The methods for dex location 1 should be in the profile data.
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ method_idx);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, method_idx);
ASSERT_TRUE(loaded_pmi1 != nullptr);
// Verify the inline cache.
@@ -989,8 +993,8 @@
ProfileCompilationInfo::OfflineProfileMethodInfo expected_pmi(ic_map);
// The dex references should not have dex_location2 in the list.
- expected_pmi.dex_references.emplace_back("dex_location1", /* checksum */1, kMaxMethodIds);
- expected_pmi.dex_references.emplace_back("dex_location3", /* checksum */3, kMaxMethodIds);
+ expected_pmi.dex_references.emplace_back("dex_location1", /* checksum= */1, kMaxMethodIds);
+ expected_pmi.dex_references.emplace_back("dex_location3", /* checksum= */3, kMaxMethodIds);
// Now check that we get back what we expect.
ASSERT_TRUE(*loaded_pmi1 == expected_pmi);
@@ -1006,10 +1010,10 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -1038,9 +1042,9 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the
// class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -1060,13 +1064,13 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, method_idx);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, method_idx);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi);
}
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi2 =
- loaded_info.GetMethod("dex_location4", /* checksum */ 4, method_idx);
+ loaded_info.GetMethod("dex_location4", /* dex_checksum= */ 4, method_idx);
ASSERT_TRUE(loaded_pmi2 != nullptr);
ASSERT_TRUE(*loaded_pmi2 == pmi);
}
@@ -1081,8 +1085,8 @@
ProfileCompilationInfo saved_info;
uint16_t item_count = 1000;
for (uint16_t i = 0; i < item_count; i++) {
- ASSERT_TRUE(AddClass("dex_location1", /* checksum */ 1, dex::TypeIndex(i), &saved_info));
- ASSERT_TRUE(AddClass("dex_location2", /* checksum */ 2, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location1", /* checksum= */ 1, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location2", /* checksum= */ 2, dex::TypeIndex(i), &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -1101,7 +1105,7 @@
// Compute the expectation.
ProfileCompilationInfo expected_info;
for (uint16_t i = 0; i < item_count; i++) {
- ASSERT_TRUE(AddClass("dex_location2", /* checksum */ 2, dex::TypeIndex(i), &expected_info));
+ ASSERT_TRUE(AddClass("dex_location2", /* checksum= */ 2, dex::TypeIndex(i), &expected_info));
}
// Validate the expectation.
@@ -1112,7 +1116,7 @@
TEST_F(ProfileCompilationInfoTest, ClearData) {
ProfileCompilationInfo info;
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &info));
}
ASSERT_FALSE(IsEmpty(info));
info.ClearData();
@@ -1122,7 +1126,7 @@
TEST_F(ProfileCompilationInfoTest, ClearDataAndSave) {
ProfileCompilationInfo info;
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &info));
}
info.ClearData();
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index feb05d6..793245b 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1860,14 +1860,13 @@
oat_file = runtime->GetOatFileManager().FindOpenedOatFileFromOatLocation(oat_location);
}
if (oat_file == nullptr) {
- oat_file = OatFile::Open(/* zip_fd= */ -1,
+ oat_file = OatFile::Open(/*zip_fd=*/ -1,
oat_location,
oat_location,
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ false,
- /* abs_dex_location= */ nullptr,
- /* reservation= */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg);
}
if (oat_file == nullptr) {
@@ -2758,14 +2757,13 @@
// We need to map the oat file in the low 4gb or else the fixup wont be able to fit oat file
// pointers into 32 bit pointer sized ArtMethods.
std::string error_msg;
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
options->app_oat_,
options->app_oat_,
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ true,
- /* abs_dex_location= */ nullptr,
- /* reservation= */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ true,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
if (oat_file == nullptr) {
LOG(ERROR) << "Failed to open oat file " << options->app_oat_ << " with error " << error_msg;
@@ -2882,14 +2880,13 @@
<< "oatdump might fail if the oat file does not contain the dex code.";
}
std::string error_msg;
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename,
oat_filename,
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_filename,
- /* reservation= */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
if (oat_file == nullptr) {
LOG(ERROR) << "Failed to open oat file from '" << oat_filename << "': " << error_msg;
@@ -2908,14 +2905,13 @@
std::string& output_name,
bool no_bits) {
std::string error_msg;
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename,
oat_filename,
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_filename,
- /* reservation= */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
if (oat_file == nullptr) {
LOG(ERROR) << "Failed to open oat file from '" << oat_filename << "': " << error_msg;
@@ -2956,14 +2952,13 @@
if (oat_filename != nullptr) {
std::string error_msg;
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename,
oat_filename,
- /* requested_base= */ nullptr,
- /* executable= */ false,
+ /*executable=*/ false,
/*low_4gb=*/false,
dex_filename,
- /* reservation= */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
if (oat_file == nullptr) {
LOG(ERROR) << "Failed to open oat file from '" << oat_filename << "': " << error_msg;
diff --git a/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc
index 48f326a..4bc33b6 100644
--- a/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/openjdkjvmti/OpenjdkJvmTi.cc
@@ -1195,7 +1195,7 @@
#undef ADD_CAPABILITY
gEventHandler->HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env),
changed,
- /*added*/true);
+ /*added=*/true);
return ret;
}
@@ -1219,7 +1219,7 @@
#undef DEL_CAPABILITY
gEventHandler->HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env),
changed,
- /*added*/false);
+ /*added=*/false);
return OK;
}
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc
index d20c756..8bac38a 100644
--- a/openjdkjvmti/deopt_manager.cc
+++ b/openjdkjvmti/deopt_manager.cc
@@ -289,7 +289,7 @@
uninterruptible_cause_ = critical_section_.Enter(art::gc::kGcCauseInstrumentation,
art::gc::kCollectorTypeCriticalSection);
art::Runtime::Current()->GetThreadList()->SuspendAll("JMVTI Deoptimizing methods",
- /*long_suspend*/ false);
+ /*long_suspend=*/ false);
}
~ScopedDeoptimizationContext()
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 300a009..48df53a 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -517,7 +517,7 @@
self,
jnienv,
art::jni::EncodeArtMethod(method),
- /*was_popped_by_exception*/ static_cast<jboolean>(JNI_FALSE),
+ /*was_popped_by_exception=*/ static_cast<jboolean>(JNI_FALSE),
val);
}
}
@@ -545,7 +545,7 @@
self,
jnienv,
art::jni::EncodeArtMethod(method),
- /*was_popped_by_exception*/ static_cast<jboolean>(JNI_FALSE),
+ /*was_popped_by_exception=*/ static_cast<jboolean>(JNI_FALSE),
val);
}
}
@@ -572,7 +572,7 @@
self,
jnienv,
art::jni::EncodeArtMethod(method),
- /*was_popped_by_exception*/ static_cast<jboolean>(JNI_TRUE),
+ /*was_popped_by_exception=*/ static_cast<jboolean>(JNI_TRUE),
val);
// Match RI behavior of just throwing away original exception if a new one is thrown.
if (LIKELY(!self->IsExceptionPending())) {
@@ -777,7 +777,7 @@
context.get(),
/*out*/ out_method,
/*out*/ dex_pc);
- clf.WalkStack(/* include_transitions */ false);
+ clf.WalkStack(/* include_transitions= */ false);
}
// Call-back when an exception is thrown.
@@ -793,8 +793,8 @@
FindCatchMethodsFromThrow(self, exception_object, &catch_method, &catch_pc);
uint32_t dex_pc = 0;
art::ArtMethod* method = self->GetCurrentMethod(&dex_pc,
- /* check_suspended */ true,
- /* abort_on_error */ art::kIsDebugBuild);
+ /* check_suspended= */ true,
+ /* abort_on_error= */ art::kIsDebugBuild);
ScopedLocalRef<jobject> exception(jnienv,
AddLocalRef<jobject>(jnienv, exception_object.Get()));
RunEventCallback<ArtJvmtiEvent::kException>(
@@ -819,8 +819,8 @@
art::JNIEnvExt* jnienv = self->GetJniEnv();
uint32_t dex_pc;
art::ArtMethod* method = self->GetCurrentMethod(&dex_pc,
- /* check_suspended */ true,
- /* abort_on_error */ art::kIsDebugBuild);
+ /* check_suspended= */ true,
+ /* abort_on_error= */ art::kIsDebugBuild);
ScopedLocalRef<jobject> exception(jnienv,
AddLocalRef<jobject>(jnienv, exception_object.Get()));
RunEventCallback<ArtJvmtiEvent::kExceptionCatch>(
diff --git a/openjdkjvmti/fixed_up_dex_file.cc b/openjdkjvmti/fixed_up_dex_file.cc
index aedec27..6745d91 100644
--- a/openjdkjvmti/fixed_up_dex_file.cc
+++ b/openjdkjvmti/fixed_up_dex_file.cc
@@ -67,7 +67,9 @@
const art::DexFile& original_dex_file) {
const art::VdexFile* vdex = GetVdex(original_dex_file);
if (vdex != nullptr) {
- vdex->UnquickenDexFile(new_dex_file, original_dex_file, /* decompile_return_instruction */true);
+ vdex->UnquickenDexFile(new_dex_file,
+ original_dex_file,
+ /* decompile_return_instruction= */ true);
}
new_dex_file.UnhideApis();
}
@@ -79,7 +81,7 @@
dex.Begin(),
dex.Size(),
"FixedUpDexFile_Verification.dex",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error)) {
LOG(FATAL) << "Failed to verify de-quickened dex file: " << error;
}
@@ -113,9 +115,9 @@
options.class_filter_.insert(descriptor);
}
art::DexLayout dex_layout(options,
- /*info*/ nullptr,
- /*out_file*/ nullptr,
- /*header*/ nullptr);
+ /*info=*/ nullptr,
+ /*out_file=*/ nullptr,
+ /*header=*/ nullptr);
std::unique_ptr<art::DexContainer> dex_container;
bool result = dex_layout.ProcessDexFile(
original.GetLocation().c_str(),
@@ -136,11 +138,11 @@
new_dex_file = dex_file_loader.Open(
data.data(),
data.size(),
- /*location*/"Unquickening_dexfile.dex",
- /*location_checksum*/0,
- /*oat_dex_file*/nullptr,
- /*verify*/false,
- /*verify_checksum*/false,
+ /*location=*/"Unquickening_dexfile.dex",
+ /*location_checksum=*/0,
+ /*oat_dex_file=*/nullptr,
+ /*verify=*/false,
+ /*verify_checksum=*/false,
&error);
if (new_dex_file == nullptr) {
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index f6113df..3d33487 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -113,8 +113,8 @@
std::unique_ptr<const art::DexFile> dex_file(dex_file_loader.Open(map_name,
checksum,
std::move(map),
- /*verify*/true,
- /*verify_checksum*/true,
+ /*verify=*/true,
+ /*verify_checksum=*/true,
&error_msg));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Unable to load modified dex file for " << descriptor << ": " << error_msg;
diff --git a/openjdkjvmti/ti_class_definition.cc b/openjdkjvmti/ti_class_definition.cc
index 895e734..9e8288f 100644
--- a/openjdkjvmti/ti_class_definition.cc
+++ b/openjdkjvmti/ti_class_definition.cc
@@ -246,17 +246,17 @@
mmap_name += name_;
std::string error;
dex_data_mmap_ = art::MemMap::MapAnonymous(mmap_name.c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
dequick_size,
PROT_NONE,
- /*low_4gb*/ false,
+ /*low_4gb=*/ false,
&error);
mmap_name += "-TEMP";
temp_mmap_ = art::MemMap::MapAnonymous(mmap_name.c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
dequick_size,
PROT_READ | PROT_WRITE,
- /*low_4gb*/ false,
+ /*low_4gb=*/ false,
&error);
if (UNLIKELY(dex_data_mmap_.IsValid() && temp_mmap_.IsValid())) {
// Need to save the initial dexfile so we don't need to search for it in the fault-handler.
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc
index c61d6e5..c628a32 100644
--- a/openjdkjvmti/ti_extension.cc
+++ b/openjdkjvmti/ti_extension.cc
@@ -424,7 +424,7 @@
}
}
return event_handler->SetEvent(art_env,
- /*event_thread*/nullptr,
+ /*thread=*/nullptr,
static_cast<ArtJvmtiEvent>(extension_event_index),
mode);
}
diff --git a/openjdkjvmti/ti_heap.cc b/openjdkjvmti/ti_heap.cc
index 6c79a60..559ee0d 100644
--- a/openjdkjvmti/ti_heap.cc
+++ b/openjdkjvmti/ti_heap.cc
@@ -981,7 +981,9 @@
// TODO: We don't have this info.
if (thread != nullptr) {
ref_info->jni_local.depth = 0;
- art::ArtMethod* method = thread->GetCurrentMethod(nullptr, false /* abort_on_error */);
+ art::ArtMethod* method = thread->GetCurrentMethod(nullptr,
+ /* check_suspended= */ true,
+ /* abort_on_error= */ false);
if (method != nullptr) {
ref_info->jni_local.method = art::jni::EncodeArtMethod(method);
}
@@ -1012,7 +1014,7 @@
ref_info->stack_local.slot = static_cast<jint>(java_info.GetVReg());
const art::StackVisitor* visitor = java_info.GetVisitor();
ref_info->stack_local.location =
- static_cast<jlocation>(visitor->GetDexPc(false /* abort_on_failure */));
+ static_cast<jlocation>(visitor->GetDexPc(/* abort_on_failure= */ false));
ref_info->stack_local.depth = static_cast<jint>(visitor->GetFrameDepth());
art::ArtMethod* method = visitor->GetMethod();
if (method != nullptr) {
@@ -1447,7 +1449,7 @@
}
jvmtiError HeapUtil::ForceGarbageCollection(jvmtiEnv* env ATTRIBUTE_UNUSED) {
- art::Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
+ art::Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references= */ false);
return ERR(NONE);
}
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 2958941..7d69c89 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -547,7 +547,7 @@
return;
}
bool needs_instrument = !visitor.IsShadowFrame();
- uint32_t pc = visitor.GetDexPc(/*abort_on_failure*/ false);
+ uint32_t pc = visitor.GetDexPc(/*abort_on_failure=*/ false);
if (pc == art::dex::kDexNoIndex) {
// Cannot figure out current PC.
result_ = ERR(OPAQUE_FRAME);
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index f71328a..aac7233 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -191,7 +191,7 @@
// Reaquire the mutex/monitor, also go to sleep if we were suspended.
// TODO Give an extension to wait without suspension as well.
- MonitorEnter(self, /*suspend*/ true);
+ MonitorEnter(self, /*suspend=*/ true);
CHECK(owner_.load(std::memory_order_relaxed) == self);
DCHECK_EQ(1u, count_);
// Reset the count.
@@ -261,7 +261,7 @@
JvmtiMonitor* monitor = DecodeMonitor(id);
art::Thread* self = art::Thread::Current();
- monitor->MonitorEnter(self, /*suspend*/false);
+ monitor->MonitorEnter(self, /*suspend=*/false);
return ERR(NONE);
}
@@ -274,7 +274,7 @@
JvmtiMonitor* monitor = DecodeMonitor(id);
art::Thread* self = art::Thread::Current();
- monitor->MonitorEnter(self, /*suspend*/true);
+ monitor->MonitorEnter(self, /*suspend=*/true);
return ERR(NONE);
}
diff --git a/openjdkjvmti/ti_object.cc b/openjdkjvmti/ti_object.cc
index 89ce352..344ae88 100644
--- a/openjdkjvmti/ti_object.cc
+++ b/openjdkjvmti/ti_object.cc
@@ -92,7 +92,7 @@
{
art::ScopedObjectAccess soa(self); // Now we know we have the shared lock.
art::ScopedThreadSuspension sts(self, art::kNative);
- art::ScopedSuspendAll ssa("GetObjectMonitorUsage", /*long_suspend*/false);
+ art::ScopedSuspendAll ssa("GetObjectMonitorUsage", /*long_suspend=*/false);
art::ObjPtr<art::mirror::Object> target(self->DecodeJObject(obj));
// This gets the list of threads trying to lock or wait on the monitor.
art::MonitorInfo info(target.Ptr());
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index db2b143..7525c02 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -152,7 +152,7 @@
const std::unordered_set<art::ArtMethod*>& obsoleted_methods,
ObsoleteMap* obsolete_maps)
: StackVisitor(thread,
- /*context*/nullptr,
+ /*context=*/nullptr,
StackVisitor::StackWalkKind::kIncludeInlinedFrames),
allocator_(allocator),
obsoleted_methods_(obsoleted_methods),
@@ -305,10 +305,10 @@
std::string* error_msg) {
art::MemMap map = art::MemMap::MapAnonymous(
StringPrintf("%s-transformed", original_location.c_str()).c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
data.size(),
PROT_READ|PROT_WRITE,
- /*low_4gb*/ false,
+ /*low_4gb=*/ false,
error_msg);
if (LIKELY(map.IsValid())) {
memcpy(map.Begin(), data.data(), data.size());
@@ -445,8 +445,8 @@
std::unique_ptr<const art::DexFile> dex_file(dex_file_loader.Open(name,
checksum,
std::move(map),
- /*verify*/true,
- /*verify_checksum*/true,
+ /*verify=*/true,
+ /*verify_checksum=*/true,
error_msg_));
if (dex_file.get() == nullptr) {
os << "Unable to load modified dex file for " << def.GetName() << ": " << *error_msg_;
@@ -1117,10 +1117,10 @@
dex_file_.get(),
hs.NewHandle(iter.GetNewDexCache()),
hs.NewHandle(GetClassLoader()),
- dex_file_->GetClassDef(0), /*class_def*/
- nullptr, /*compiler_callbacks*/
- true, /*allow_soft_failures*/
- /*log_level*/
+ /*class_def=*/ dex_file_->GetClassDef(0),
+ /*callbacks=*/ nullptr,
+ /*allow_soft_failures=*/ true,
+ /*log_level=*/
art::verifier::HardFailLogMode::kLogWarning,
art::Runtime::Current()->GetTargetSdkVersion(),
&error);
@@ -1288,7 +1288,7 @@
}
void Redefiner::ClassRedefinition::ReleaseDexFile() {
- dex_file_.release();
+ dex_file_.release(); // NOLINT b/117926937
}
void Redefiner::ReleaseAllDexFiles() {
@@ -1367,7 +1367,7 @@
// TODO We might want to give this its own suspended state!
// TODO This isn't right. We need to change state without any chance of suspend ideally!
art::ScopedThreadSuspension sts(self_, art::ThreadState::kNative);
- art::ScopedSuspendAll ssa("Final installation of redefined Classes!", /*long_suspend*/true);
+ art::ScopedSuspendAll ssa("Final installation of redefined Classes!", /*long_suspend=*/true);
for (RedefinitionDataIter data = holder.begin(); data != holder.end(); ++data) {
art::ScopedAssertNoThreadSuspension nts("Updating runtime objects for redefinition");
ClassRedefinition& redef = data.GetRedefinition();
diff --git a/openjdkjvmti/ti_search.cc b/openjdkjvmti/ti_search.cc
index 1189b1d..427869e 100644
--- a/openjdkjvmti/ti_search.cc
+++ b/openjdkjvmti/ti_search.cc
@@ -229,8 +229,12 @@
std::string error_msg;
std::vector<std::unique_ptr<const art::DexFile>> dex_files;
const art::ArtDexFileLoader dex_file_loader;
- if (!dex_file_loader.Open(
- segment, segment, /* verify */ true, /* verify_checksum */ true, &error_msg, &dex_files)) {
+ if (!dex_file_loader.Open(segment,
+ segment,
+ /* verify= */ true,
+ /* verify_checksum= */ true,
+ &error_msg,
+ &dex_files)) {
LOG(WARNING) << "Could not open " << segment << " for boot classpath extension: " << error_msg;
return ERR(ILLEGAL_ARGUMENT);
}
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index 5a98755..1279f3b 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -150,7 +150,7 @@
frames.push_back(info);
};
auto visitor = MakeStackTraceVisitor(self, start_input, stop_input, frames_fn);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
start_result = visitor.start;
stop_result = visitor.stop;
@@ -218,7 +218,7 @@
++index;
};
auto visitor = MakeStackTraceVisitor(self, start_input, stop_input, frames_fn);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
}
jvmtiFrameInfo* frame_buffer;
@@ -330,7 +330,7 @@
thread_frames->push_back(info);
};
auto visitor = MakeStackTraceVisitor(thread, 0u, stop_input, frames_fn);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
}
art::Barrier barrier;
@@ -910,7 +910,7 @@
art::Locks::mutator_lock_->AssertSharedHeld(art::Thread::Current());
// Find the monitors on the stack.
MonitorVisitor visitor(target);
- visitor.WalkStack(/* include_transitions */ false);
+ visitor.WalkStack(/* include_transitions= */ false);
// Find any other monitors, including ones acquired in native code.
art::RootInfo root_info(art::kRootVMInternal);
target->GetJniEnv()->VisitMonitorRoots(&visitor, root_info);
diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc
index a0e5b5c92..2131120 100644
--- a/openjdkjvmti/ti_thread.cc
+++ b/openjdkjvmti/ti_thread.cc
@@ -812,7 +812,7 @@
runtime->EndThreadBirth();
return ERR(INTERNAL);
}
- data.release();
+ data.release(); // NOLINT pthreads API.
return ERR(NONE);
}
@@ -857,7 +857,7 @@
bool timeout = true;
art::Thread* ret_target = art::Runtime::Current()->GetThreadList()->SuspendThreadByPeer(
target_jthread,
- /* request_suspension */ true,
+ /* request_suspension= */ true,
art::SuspendReason::kForUserCode,
&timeout);
if (ret_target == nullptr && !timeout) {
diff --git a/openjdkjvmti/transform.cc b/openjdkjvmti/transform.cc
index d87ca56..653f944 100644
--- a/openjdkjvmti/transform.cc
+++ b/openjdkjvmti/transform.cc
@@ -76,7 +76,7 @@
art::LockLevel::kSignalHandlingLock),
class_definition_initialized_cond_("JVMTI Initialized class definitions condition",
uninitialized_class_definitions_lock_) {
- manager->AddHandler(this, /* generated_code */ false);
+ manager->AddHandler(this, /* generated_code= */ false);
}
~TransformationFaultHandler() {
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 4da0091..5c8d685 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -64,10 +64,10 @@
// make sure we do not de-allocate them.
for (ClassLoaderInfo& info : class_loader_chain_) {
for (std::unique_ptr<OatFile>& oat_file : info.opened_oat_files) {
- oat_file.release();
+ oat_file.release(); // NOLINT b/117926937
}
for (std::unique_ptr<const DexFile>& dex_file : info.opened_dex_files) {
- dex_file.release();
+ dex_file.release(); // NOLINT b/117926937
}
}
}
diff --git a/runtime/dexopt_test.cc b/runtime/dexopt_test.cc
index 462620f..429ecd3 100644
--- a/runtime/dexopt_test.cc
+++ b/runtime/dexopt_test.cc
@@ -123,14 +123,13 @@
ASSERT_TRUE(Dex2Oat(args, &error_msg)) << error_msg;
// Verify the odex file was generated as expected.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_location.c_str(),
oat_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
EXPECT_EQ(filter, odex_file->GetCompilerFilter());
@@ -159,7 +158,7 @@
GenerateOatForTest(dex_location,
odex_location,
filter,
- /* with_alternate_image */ false,
+ /*with_alternate_image=*/ false,
compilation_reason);
}
@@ -177,7 +176,7 @@
}
void DexoptTest::GenerateOatForTest(const char* dex_location, CompilerFilter::Filter filter) {
- GenerateOatForTest(dex_location, filter, /* with_alternate_image */ false);
+ GenerateOatForTest(dex_location, filter, /*with_alternate_image=*/ false);
}
void DexoptTest::ReserveImageSpace() {
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 8ba8e33..1b3cb40 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -184,7 +184,7 @@
bool have_android_data = false;
*dalvik_cache_exists = false;
GetDalvikCache(GetInstructionSetString(image_isa),
- /* create_if_absent */ true,
+ /*create_if_absent=*/ true,
dalvik_cache,
&have_android_data,
dalvik_cache_exists,
@@ -389,7 +389,7 @@
/*inout*/MemMap* oat_reservation,
/*out*/std::string* error_msg)
REQUIRES_SHARED(Locks::mutator_lock_) {
- TimingLogger logger(__PRETTY_FUNCTION__, /* precise= */ true, VLOG_IS_ON(image));
+ TimingLogger logger(__PRETTY_FUNCTION__, /*precise=*/ true, VLOG_IS_ON(image));
std::unique_ptr<ImageSpace> space = Init(image_filename,
image_location,
validate_oat_file,
@@ -554,7 +554,7 @@
MAP_PRIVATE,
file->Fd(),
image_bitmap_offset,
- /* low_4gb */ false,
+ /*low_4gb=*/ false,
image_filename,
error_msg);
if (!image_bitmap_map.IsValid()) {
@@ -640,10 +640,10 @@
PROT_READ | PROT_WRITE,
MAP_PRIVATE,
fd,
- /* start= */ 0,
- /* low_4gb= */ true,
+ /*start=*/ 0,
+ /*low_4gb=*/ true,
image_filename,
- /* reuse= */ false,
+ /*reuse=*/ false,
image_reservation,
error_msg);
}
@@ -662,8 +662,8 @@
address,
image_header.GetImageSize(),
PROT_READ | PROT_WRITE,
- /* low_4gb= */ true,
- /* reuse= */ false,
+ /*low_4gb=*/ true,
+ /*reuse=*/ false,
image_reservation,
error_msg);
if (map.IsValid()) {
@@ -673,8 +673,8 @@
PROT_READ,
MAP_PRIVATE,
fd,
- /* start= */ 0,
- /* low_4gb= */ false,
+ /*start=*/ 0,
+ /*low_4gb=*/ false,
image_filename,
error_msg);
if (!temp_map.IsValid()) {
@@ -1261,13 +1261,12 @@
if (oat_reservation != nullptr) {
oat_data_begin += oat_reservation->Begin() - image_header.GetOatFileBegin();
}
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename,
oat_filename,
- oat_data_begin,
!Runtime::Current()->IsAotCompiler(),
- /* low_4gb= */ false,
- /* abs_dex_location= */ nullptr,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
oat_reservation,
error_msg));
if (oat_file == nullptr) {
@@ -1277,6 +1276,7 @@
error_msg->c_str());
return nullptr;
}
+ CHECK(oat_data_begin == oat_file->Begin());
uint32_t oat_checksum = oat_file->GetOatHeader().GetChecksum();
uint32_t image_oat_checksum = image_header.GetOatChecksum();
if (oat_checksum != image_oat_checksum) {
@@ -1341,7 +1341,7 @@
/*out*/std::vector<std::unique_ptr<space::ImageSpace>>* boot_image_spaces,
/*out*/MemMap* extra_reservation,
/*out*/std::string* error_msg) REQUIRES_SHARED(Locks::mutator_lock_) {
- TimingLogger logger(__PRETTY_FUNCTION__, /* precise= */ true, VLOG_IS_ON(image));
+ TimingLogger logger(__PRETTY_FUNCTION__, /*precise=*/ true, VLOG_IS_ON(image));
std::string filename = GetSystemImageFilename(image_location_.c_str(), image_isa_);
std::vector<std::string> locations;
if (!GetBootClassPathImageLocations(image_location_, filename, &locations, error_msg)) {
@@ -1380,7 +1380,7 @@
filename = GetSystemImageFilename(location.c_str(), image_isa_);
spaces.push_back(Load(location,
filename,
- /* validate_oat_file= */ false,
+ /*validate_oat_file=*/ false,
&logger,
&image_reservation,
&oat_reservation,
@@ -1411,7 +1411,7 @@
/*out*/std::vector<std::unique_ptr<space::ImageSpace>>* boot_image_spaces,
/*out*/MemMap* extra_reservation,
/*out*/std::string* error_msg) REQUIRES_SHARED(Locks::mutator_lock_) {
- TimingLogger logger(__PRETTY_FUNCTION__, /* precise= */ true, VLOG_IS_ON(image));
+ TimingLogger logger(__PRETTY_FUNCTION__, /*precise=*/ true, VLOG_IS_ON(image));
DCHECK(DalvikCacheExists());
std::vector<std::string> locations;
if (!GetBootClassPathImageLocations(image_location_, cache_filename_, &locations, error_msg)) {
@@ -1528,7 +1528,7 @@
PatchedObjectsMap(uint8_t* image_space_begin, size_t size)
: image_space_begin_(image_space_begin),
data_(new uint8_t[BitsToBytesRoundUp(NumLocations(size))]),
- visited_objects_(data_.get(), /* bit_start= */ 0u, NumLocations(size)) {
+ visited_objects_(data_.get(), /*bit_start=*/ 0u, NumLocations(size)) {
DCHECK_ALIGNED(image_space_begin_, kObjectAlignment);
std::memset(data_.get(), 0, BitsToBytesRoundUp(NumLocations(size)));
}
@@ -1539,7 +1539,7 @@
ALWAYS_INLINE void MarkVisited(mirror::Object* object) {
DCHECK(!IsVisited(object));
- visited_objects_.StoreBit(GetIndex(object), /* value= */ true);
+ visited_objects_.StoreBit(GetIndex(object), /*value=*/ true);
}
private:
@@ -1564,7 +1564,7 @@
: diff_(diff) {}
void Visit(ArtField* field) override REQUIRES_SHARED(Locks::mutator_lock_) {
- PatchGcRoot</* kMayBeNull */ false>(diff_, &field->DeclaringClassRoot());
+ PatchGcRoot</*kMayBeNull=*/ false>(diff_, &field->DeclaringClassRoot());
}
private:
@@ -1629,7 +1629,7 @@
static_assert(IsAligned<kHeapReferenceSize>(kObjectAlignment), "Object alignment check.");
// First, patch the `klass->klass_`, known to be a reference to the j.l.Class.class.
// This should be the only reference field in j.l.Object and we assert that below.
- PatchReferenceField</* kMayBeNull */ false>(klass, mirror::Object::ClassOffset());
+ PatchReferenceField</*kMayBeNull=*/ false>(klass, mirror::Object::ClassOffset());
// Then patch the reference instance fields described by j.l.Class.class.
// Use the sizeof(Object) to determine where these reference fields start;
// this is the same as `class_class->GetFirstReferenceInstanceFieldOffset()`
@@ -1682,19 +1682,19 @@
void VisitPointerArray(mirror::PointerArray* pointer_array)
REQUIRES_SHARED(Locks::mutator_lock_) {
// Fully patch the pointer array, including the `klass_` field.
- PatchReferenceField</* kMayBeNull */ false>(pointer_array, mirror::Object::ClassOffset());
+ PatchReferenceField</*kMayBeNull=*/ false>(pointer_array, mirror::Object::ClassOffset());
int32_t length = pointer_array->GetLength<kVerifyNone>();
for (int32_t i = 0; i != length; ++i) {
ArtMethod** method_entry = reinterpret_cast<ArtMethod**>(
pointer_array->ElementAddress<kVerifyNone>(i, kPointerSize));
- PatchNativePointer<kPointerSize, /* kMayBeNull */ false>(diff_, method_entry);
+ PatchNativePointer<kPointerSize, /*kMayBeNull=*/ false>(diff_, method_entry);
}
}
void VisitObject(mirror::Object* object) REQUIRES_SHARED(Locks::mutator_lock_) {
// Visit all reference fields.
- object->VisitReferences</* kVisitNativeRoots */ false,
+ object->VisitReferences</*kVisitNativeRoots=*/ false,
kVerifyNone,
kWithoutReadBarrier>(*this, *this);
// This function should not be called for classes.
@@ -1711,7 +1711,7 @@
ALWAYS_INLINE void operator()(ObjPtr<mirror::Class> klass, mirror::Reference* ref) const
REQUIRES_SHARED(Locks::mutator_lock_) {
DCHECK(klass->IsTypeOfReferenceClass());
- this->operator()(ref, mirror::Reference::ReferentOffset(), /* is_static= */ false);
+ this->operator()(ref, mirror::Reference::ReferentOffset(), /*is_static=*/ false);
}
// Ignore class native roots; not called from VisitReferences() for kVisitNativeRoots == false.
void VisitRootIfNonNull(mirror::CompressedReference<mirror::Object>* root ATTRIBUTE_UNUSED)
@@ -1750,8 +1750,8 @@
DCHECK(kMayBeNull || old_value != nullptr);
if (!kMayBeNull || old_value != nullptr) {
mirror::Object* new_value = RelocatedAddress(old_value, diff_);
- object->SetFieldObjectWithoutWriteBarrier</* kTransactionActive */ false,
- /* kCheckTransaction */ true,
+ object->SetFieldObjectWithoutWriteBarrier</*kTransactionActive=*/ false,
+ /*kCheckTransaction=*/ true,
kVerifyNone>(offset, new_value);
}
}
@@ -1836,9 +1836,9 @@
if (image_header.GetInternedStringsSection().Size() != 0u) {
const uint8_t* data = space->Begin() + image_header.GetInternedStringsSection().Offset();
size_t read_count;
- InternTable::UnorderedSet temp_set(data, /* make_copy_of_data= */ false, &read_count);
+ InternTable::UnorderedSet temp_set(data, /*make_copy_of_data=*/ false, &read_count);
for (GcRoot<mirror::String>& slot : temp_set) {
- PatchGcRoot</* kMayBeNull */ false>(diff, &slot);
+ PatchGcRoot</*kMayBeNull=*/ false>(diff, &slot);
}
}
@@ -1847,7 +1847,7 @@
if (image_header.GetClassTableSection().Size() != 0u) {
uint8_t* data = space->Begin() + image_header.GetClassTableSection().Offset();
size_t read_count;
- ClassTable::ClassSet temp_set(data, /* make_copy_of_data= */ false, &read_count);
+ ClassTable::ClassSet temp_set(data, /*make_copy_of_data=*/ false, &read_count);
DCHECK(!temp_set.empty());
ClassTableVisitor class_table_visitor(diff);
for (ClassTable::TableSlot& slot : temp_set) {
@@ -1935,8 +1935,8 @@
ObjPtr<mirror::Executable>::DownCast(MakeObjPtr(object));
ArtMethod* unpatched_method = as_executable->GetArtMethod<kVerifyNone>();
ArtMethod* patched_method = RelocatedAddress(unpatched_method, diff);
- as_executable->SetArtMethod</* kTransactionActive */ false,
- /* kCheckTransaction */ true,
+ as_executable->SetArtMethod</*kTransactionActive=*/ false,
+ /*kCheckTransaction=*/ true,
kVerifyNone>(patched_method);
}
}
@@ -2019,8 +2019,8 @@
// descriptor (and the associated exclusive lock) to be released when
// we leave Create.
ScopedFlock image = LockedFile::Open(image_filename.c_str(),
- rw_lock ? (O_CREAT | O_RDWR) : O_RDONLY /* flags */,
- true /* block */,
+ /*flags=*/ rw_lock ? (O_CREAT | O_RDWR) : O_RDONLY,
+ /*block=*/ true,
error_msg);
VLOG(startup) << "Using image file " << image_filename.c_str() << " for image location "
@@ -2034,7 +2034,7 @@
return Loader::Init(image_filename.c_str(),
image_location.c_str(),
validate_oat_file,
- /* oat_file= */ nullptr,
+ /*oat_file=*/ nullptr,
logger,
image_reservation,
oat_reservation,
@@ -2048,14 +2048,13 @@
/*out*/ std::vector<std::string>* all_locations,
/*out*/ std::string* error_msg) {
std::string oat_filename = ImageHeader::GetOatLocationFromImageLocation(image_filename);
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/* zip_fd= */ -1,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
oat_filename,
oat_filename,
- /* requested_base= */ nullptr,
- /* executable= */ false,
- /* low_4gb= */ false,
- /* abs_dex_location= */ nullptr,
- /* reservation= */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
error_msg));
if (oat_file == nullptr) {
*error_msg = StringPrintf("Failed to open oat file '%s' for image file %s: %s",
@@ -2109,9 +2108,9 @@
reinterpret_cast32<uint8_t*>(addr),
total_size,
PROT_NONE,
- /* low_4gb= */ true,
- /* reuse= */ false,
- /* reservation= */ nullptr,
+ /*low_4gb=*/ true,
+ /*reuse=*/ false,
+ /*reservation=*/ nullptr,
error_msg);
if (!image_reservation->IsValid()) {
return false;
@@ -2284,7 +2283,7 @@
// Step 2: Check if we have an existing image in the dalvik cache.
if (loader.HasCache()) {
std::string local_error_msg;
- if (loader.LoadFromDalvikCache(/* validate_oat_file= */ true,
+ if (loader.LoadFromDalvikCache(/*validate_oat_file=*/ true,
extra_reservation_size,
boot_image_spaces,
extra_reservation,
@@ -2304,7 +2303,7 @@
bool compilation_success =
GenerateImage(loader.GetCacheFilename(), image_isa, &local_error_msg);
if (compilation_success) {
- if (loader.LoadFromDalvikCache(/* validate_oat_file= */ false,
+ if (loader.LoadFromDalvikCache(/*validate_oat_file=*/ false,
extra_reservation_size,
boot_image_spaces,
extra_reservation,
@@ -2365,10 +2364,10 @@
std::string* error_msg) {
return Loader::InitAppImage(image,
image,
- /* validate_oat_file= */ false,
+ /*validate_oat_file=*/ false,
oat_file,
- /* image_reservation= */ nullptr,
- /* oat_reservation= */ nullptr,
+ /*image_reservation=*/ nullptr,
+ /*oat_reservation=*/ nullptr,
error_msg);
}
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 4db6fdc..b940d88 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -148,16 +148,6 @@
return Begin() + GetImageHeader().GetImageSize();
}
- // Return the start of the associated oat file.
- uint8_t* GetOatFileBegin() const {
- return GetImageHeader().GetOatFileBegin();
- }
-
- // Return the end of the associated oat file.
- uint8_t* GetOatFileEnd() const {
- return GetImageHeader().GetOatFileEnd();
- }
-
void DumpSections(std::ostream& os) const;
// De-initialize the image-space by undoing the effects in Init().
diff --git a/runtime/gc/space/image_space_test.cc b/runtime/gc/space/image_space_test.cc
index cc70788..0a35bce 100644
--- a/runtime/gc/space/image_space_test.cc
+++ b/runtime/gc/space/image_space_test.cc
@@ -43,14 +43,13 @@
args.push_back("--oat-file=" + oat_location);
ASSERT_TRUE(Dex2Oat(args, &error_msg)) << error_msg;
- std::unique_ptr<OatFile> oat(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> oat(OatFile::Open(/*zip_fd=*/ -1,
oat_location.c_str(),
oat_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
- /* abs_dex_location */ nullptr,
- /* reservation */ nullptr,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ /*abs_dex_location=*/ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(oat != nullptr) << error_msg;
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc
index 0a54e38..d31f166 100644
--- a/runtime/jdwp/jdwp_handler.cc
+++ b/runtime/jdwp/jdwp_handler.cc
@@ -1344,13 +1344,14 @@
VLOG(jdwp) << StringPrintf(" --> event requestId=%#x", requestId);
/* add it to the list */
+ // TODO: RegisterEvent() should take std::unique_ptr<>.
JdwpError err = state->RegisterEvent(pEvent.get());
if (err != ERR_NONE) {
/* registration failed, probably because event is bogus */
LOG(WARNING) << "WARNING: event request rejected";
return err;
}
- pEvent.release();
+ pEvent.release(); // NOLINT b/117926937
return ERR_NONE;
}
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 36f9b1a..6becd36 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -112,7 +112,7 @@
// Now release all the unique_ptrs.
for (auto& dex_file : vec) {
- dex_file.release();
+ dex_file.release(); // NOLINT
}
return long_array;
@@ -295,7 +295,7 @@
ScopedObjectAccess soa(env);
for (auto& dex_file : dex_files) {
if (linker->IsDexFileRegistered(soa.Self(), *dex_file)) {
- dex_file.release();
+ dex_file.release(); // NOLINT
}
}
}
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 5b96509..f16c46b 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -101,7 +101,6 @@
const std::string& vdex_filename,
const std::string& elf_filename,
const std::string& location,
- uint8_t* requested_base,
bool writable,
bool executable,
bool low_4gb,
@@ -115,7 +114,6 @@
int oat_fd,
const std::string& vdex_filename,
const std::string& oat_filename,
- uint8_t* requested_base,
bool writable,
bool executable,
bool low_4gb,
@@ -156,9 +154,7 @@
/*inout*/MemMap* reservation, // Where to load if not null.
/*out*/std::string* error_msg) = 0;
- bool ComputeFields(uint8_t* requested_base,
- const std::string& file_path,
- std::string* error_msg);
+ bool ComputeFields(const std::string& file_path, std::string* error_msg);
virtual void PreSetup(const std::string& elf_filename) = 0;
@@ -187,7 +183,6 @@
const std::string& vdex_filename,
const std::string& elf_filename,
const std::string& location,
- uint8_t* requested_base,
bool writable,
bool executable,
bool low_4gb,
@@ -207,7 +202,7 @@
return nullptr;
}
- if (!ret->ComputeFields(requested_base, elf_filename, error_msg)) {
+ if (!ret->ComputeFields(elf_filename, error_msg)) {
return nullptr;
}
@@ -230,7 +225,6 @@
int oat_fd,
const std::string& vdex_location,
const std::string& oat_location,
- uint8_t* requested_base,
bool writable,
bool executable,
bool low_4gb,
@@ -248,7 +242,7 @@
return nullptr;
}
- if (!ret->ComputeFields(requested_base, oat_location, error_msg)) {
+ if (!ret->ComputeFields(oat_location, error_msg)) {
return nullptr;
}
@@ -271,7 +265,7 @@
std::string* error_msg) {
vdex_ = VdexFile::OpenAtAddress(vdex_begin_,
vdex_end_ - vdex_begin_,
- vdex_begin_ != nullptr /* mmap_reuse */,
+ /*mmap_reuse=*/ vdex_begin_ != nullptr,
vdex_filename,
writable,
low_4gb,
@@ -299,13 +293,13 @@
} else {
vdex_ = VdexFile::OpenAtAddress(vdex_begin_,
vdex_end_ - vdex_begin_,
- vdex_begin_ != nullptr /* mmap_reuse */,
+ /*mmap_reuse=*/ vdex_begin_ != nullptr,
vdex_fd,
s.st_size,
vdex_filename,
writable,
low_4gb,
- false /* unquicken */,
+ /*unquicken=*/ false,
error_msg);
if (vdex_.get() == nullptr) {
*error_msg = "Failed opening vdex file.";
@@ -316,9 +310,7 @@
return true;
}
-bool OatFileBase::ComputeFields(uint8_t* requested_base,
- const std::string& file_path,
- std::string* error_msg) {
+bool OatFileBase::ComputeFields(const std::string& file_path, std::string* error_msg) {
std::string symbol_error_msg;
begin_ = FindDynamicSymbolAddress("oatdata", &symbol_error_msg);
if (begin_ == nullptr) {
@@ -327,16 +319,6 @@
symbol_error_msg.c_str());
return false;
}
- if (requested_base != nullptr && begin_ != requested_base) {
- // Host can fail this check. Do not dump there to avoid polluting the output.
- if (kIsTargetBuild && (kIsDebugBuild || VLOG_IS_ON(oat))) {
- PrintFileToLog("/proc/self/maps", android::base::LogSeverity::WARNING);
- }
- *error_msg = StringPrintf("Failed to find oatdata symbol at expected address: "
- "oatdata=%p != expected=%p. See process maps in the log.",
- begin_, requested_base);
- return false;
- }
end_ = FindDynamicSymbolAddress("oatlastword", &symbol_error_msg);
if (end_ == nullptr) {
*error_msg = StringPrintf("Failed to find oatlastword symbol in '%s' %s",
@@ -649,15 +631,15 @@
if (zip_fd != -1) {
loaded = dex_file_loader.OpenZip(zip_fd,
dex_file_location,
- /* verify */ false,
- /* verify_checksum */ false,
+ /*verify=*/ false,
+ /*verify_checksum=*/ false,
error_msg,
uncompressed_dex_files_.get());
} else {
loaded = dex_file_loader.Open(dex_file_location.c_str(),
dex_file_location,
- /* verify */ false,
- /* verify_checksum */ false,
+ /*verify=*/ false,
+ /*verify_checksum=*/ false,
error_msg,
uncompressed_dex_files_.get());
}
@@ -1323,7 +1305,7 @@
}
// Complete the setup.
- if (!oat_file->ComputeFields(/* requested_base */ nullptr, file->GetPath(), error_msg)) {
+ if (!oat_file->ComputeFields(file->GetPath(), error_msg)) {
return nullptr;
}
@@ -1407,10 +1389,9 @@
/*inout*/MemMap* reservation,
/*out*/std::string* error_msg) {
ScopedTrace trace(__PRETTY_FUNCTION__);
- // TODO: rename requested_base to oat_data_begin
elf_file_.reset(ElfFile::Open(file,
writable,
- /*program_header_only*/true,
+ /*program_header_only=*/ true,
low_4gb,
error_msg));
if (elf_file_ == nullptr) {
@@ -1458,7 +1439,7 @@
const std::string& location,
const char* abs_dex_location,
std::string* error_msg) {
- std::unique_ptr<ElfOatFile> oat_file(new ElfOatFile(location, false /* executable */));
+ std::unique_ptr<ElfOatFile> oat_file(new ElfOatFile(location, /*executable=*/ false));
return oat_file->InitializeFromElfFile(zip_fd, elf_file, vdex_file, abs_dex_location, error_msg)
? oat_file.release()
: nullptr;
@@ -1467,7 +1448,6 @@
OatFile* OatFile::Open(int zip_fd,
const std::string& oat_filename,
const std::string& oat_location,
- uint8_t* requested_base,
bool executable,
bool low_4gb,
const char* abs_dex_location,
@@ -1494,8 +1474,7 @@
vdex_filename,
oat_filename,
oat_location,
- requested_base,
- false /* writable */,
+ /*writable=*/ false,
executable,
low_4gb,
abs_dex_location,
@@ -1524,8 +1503,7 @@
vdex_filename,
oat_filename,
oat_location,
- requested_base,
- false /* writable */,
+ /*writable=*/ false,
executable,
low_4gb,
abs_dex_location,
@@ -1538,7 +1516,6 @@
int vdex_fd,
int oat_fd,
const std::string& oat_location,
- uint8_t* requested_base,
bool executable,
bool low_4gb,
const char* abs_dex_location,
@@ -1553,8 +1530,7 @@
oat_fd,
vdex_location,
oat_location,
- requested_base,
- false /* writable */,
+ /*writable=*/ false,
executable,
low_4gb,
abs_dex_location,
@@ -1572,11 +1548,11 @@
return ElfOatFile::OpenElfFile(zip_fd,
file,
location,
- /* writable */ true,
- /* executable */ false,
- /*low_4gb*/false,
+ /*writable=*/ true,
+ /*executable=*/ false,
+ /*low_4gb=*/false,
abs_dex_location,
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
error_msg);
}
@@ -1589,11 +1565,11 @@
return ElfOatFile::OpenElfFile(zip_fd,
file,
location,
- /* writable */ false,
- /* executable */ false,
- /*low_4gb*/false,
+ /*writable=*/ false,
+ /*executable=*/ false,
+ /*low_4gb=*/false,
abs_dex_location,
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
error_msg);
}
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index b3736e6..ba08e5e 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -85,7 +85,6 @@
static OatFile* Open(int zip_fd,
const std::string& filename,
const std::string& location,
- uint8_t* requested_base,
bool executable,
bool low_4gb,
const char* abs_dex_location,
@@ -99,7 +98,6 @@
int vdex_fd,
int oat_fd,
const std::string& oat_location,
- uint8_t* requested_base,
bool executable,
bool low_4gb,
const char* abs_dex_location,
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 009abdb..754aa40 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -76,9 +76,9 @@
isa,
load_executable,
only_load_system_executable,
- -1 /* vdex_fd */,
- -1 /* oat_fd */,
- -1 /* zip_fd */) {}
+ /*vdex_fd=*/ -1,
+ /*oat_fd=*/ -1,
+ /*zip_fd=*/ -1) {}
OatFileAssistant::OatFileAssistant(const char* dex_location,
@@ -124,7 +124,7 @@
// Get the oat filename.
std::string oat_file_name;
if (DexLocationToOatFilename(dex_location_, isa_, &oat_file_name, &error_msg)) {
- oat_.Reset(oat_file_name, false /* use_fd */);
+ oat_.Reset(oat_file_name, /*use_fd=*/ false);
} else {
LOG(WARNING) << "Failed to determine oat file name for dex location "
<< dex_location_ << ": " << error_msg;
@@ -575,7 +575,6 @@
}
info->oat_checksum = image_header->GetOatChecksum();
- info->oat_data_begin = reinterpret_cast<uintptr_t>(image_header->GetOatDataBegin());
info->patch_delta = image_header->GetPatchDelta();
return info;
}
@@ -693,9 +692,9 @@
vdex = VdexFile::Open(vdex_fd_,
s.st_size,
vdex_filename,
- false /*writable*/,
- false /*low_4gb*/,
- false /* unquicken */,
+ /*writable=*/ false,
+ /*low_4gb=*/ false,
+ /*unquicken=*/ false,
&error_msg);
}
}
@@ -779,22 +778,20 @@
vdex_fd_,
oat_fd_,
filename_.c_str(),
- /* requested_base */ nullptr,
executable,
- /* low_4gb */ false,
+ /*low_4gb=*/ false,
oat_file_assistant_->dex_location_.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
}
} else {
- file_.reset(OatFile::Open(/* zip_fd */ -1,
+ file_.reset(OatFile::Open(/*zip_fd=*/ -1,
filename_.c_str(),
filename_.c_str(),
- /* requested_base */ nullptr,
executable,
- /* low_4gb */ false,
+ /*low_4gb=*/ false,
oat_file_assistant_->dex_location_.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
}
if (file_.get() == nullptr) {
@@ -924,7 +921,7 @@
std::string* out_compilation_reason) {
// It may not be possible to load an oat file executable (e.g., selinux restrictions). Load
// non-executable and check the status manually.
- OatFileAssistant oat_file_assistant(filename.c_str(), isa, false /* load_executable */);
+ OatFileAssistant oat_file_assistant(filename.c_str(), isa, /*load_executable=*/ false);
std::unique_ptr<OatFile> oat_file = oat_file_assistant.GetBestOatFile();
if (oat_file == nullptr) {
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 3da1a22..590ae22 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -247,7 +247,6 @@
private:
struct ImageInfo {
uint32_t oat_checksum = 0;
- uintptr_t oat_data_begin = 0;
int32_t patch_delta = 0;
std::string location;
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index a9ef9a3..b9e9d38 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -84,7 +84,7 @@
auto it = oat_files_.find(compare);
CHECK(it != oat_files_.end());
oat_files_.erase(it);
- compare.release();
+ compare.release(); // NOLINT b/117926937
}
const OatFile* OatFileManager::FindOpenedOatFileFromDexLocation(
@@ -567,7 +567,7 @@
if (added_image_space) {
// Successfully added image space to heap, release the map so that it does not get
// freed.
- image_space.release();
+ image_space.release(); // NOLINT b/117926937
// Register for tracking.
for (const auto& dex_file : dex_files) {
diff --git a/runtime/oat_file_test.cc b/runtime/oat_file_test.cc
index 51d8fca..b547113 100644
--- a/runtime/oat_file_test.cc
+++ b/runtime/oat_file_test.cc
@@ -74,14 +74,13 @@
std::string error_msg;
ASSERT_TRUE(OatFileAssistant::DexLocationToOatFilename(
dex_location, kRuntimeISA, &oat_location, &error_msg)) << error_msg;
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_location.c_str(),
oat_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr);
@@ -102,14 +101,13 @@
// Ensure we can load that file. Just a precondition.
{
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_location.c_str(),
oat_location.c_str(),
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ASSERT_EQ(2u, odex_file->GetOatDexFiles().size());
@@ -119,14 +117,13 @@
Copy(GetTestDexFileName("MainUncompressed"), dex_location);
// And try to load again.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(/* zip_fd */ -1,
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1,
oat_location,
oat_location,
- /* requested_base */ nullptr,
- /* executable */ false,
- /* low_4gb */ false,
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
dex_location.c_str(),
- /* reservation */ nullptr,
+ /*reservation=*/ nullptr,
&error_msg));
EXPECT_TRUE(odex_file == nullptr);
EXPECT_NE(std::string::npos, error_msg.find("expected 2 uncompressed dex files, but found 1"))
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 51775c6..b3492e1 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -729,7 +729,7 @@
// JNIEnvExt we created.
// Note: we can't check for tmp_jni_env == nullptr, as that would require synchronization
// between the threads.
- child_jni_env_ext.release();
+ child_jni_env_ext.release(); // NOLINT pthreads API.
return;
}
}