diff options
author | 2018-10-16 13:09:32 -0700 | |
---|---|---|
committer | 2018-10-17 12:17:28 -0700 | |
commit | 6e8977690147b75096c0a993efb53ae329e3fd2c (patch) | |
tree | dd2e653b893e2d91a9c238a3468f66a3def98743 | |
parent | 0de385f9eb5f8c066121ea2d43e8b8eea6a726fa (diff) |
ART: Refactor for bugprone-argument-comment
Handles openjdkjvmti.
Bug: 116054210
Test: WITH_TIDY=1 mmma art
Change-Id: Ic73e3f32b08f3b6d9300428ad95d12a696db0458
-rw-r--r-- | openjdkjvmti/OpenjdkJvmTi.cc | 4 | ||||
-rw-r--r-- | openjdkjvmti/deopt_manager.cc | 2 | ||||
-rw-r--r-- | openjdkjvmti/events.cc | 16 | ||||
-rw-r--r-- | openjdkjvmti/fixed_up_dex_file.cc | 22 | ||||
-rw-r--r-- | openjdkjvmti/ti_class.cc | 4 | ||||
-rw-r--r-- | openjdkjvmti/ti_class_definition.cc | 8 | ||||
-rw-r--r-- | openjdkjvmti/ti_extension.cc | 2 | ||||
-rw-r--r-- | openjdkjvmti/ti_heap.cc | 8 | ||||
-rw-r--r-- | openjdkjvmti/ti_method.cc | 2 | ||||
-rw-r--r-- | openjdkjvmti/ti_monitor.cc | 6 | ||||
-rw-r--r-- | openjdkjvmti/ti_object.cc | 2 | ||||
-rw-r--r-- | openjdkjvmti/ti_redefine.cc | 20 | ||||
-rw-r--r-- | openjdkjvmti/ti_search.cc | 8 | ||||
-rw-r--r-- | openjdkjvmti/ti_stack.cc | 8 | ||||
-rw-r--r-- | openjdkjvmti/ti_thread.cc | 2 | ||||
-rw-r--r-- | openjdkjvmti/transform.cc | 2 |
16 files changed, 62 insertions, 54 deletions
diff --git a/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc index 48f326a54d..4bc33b68ca 100644 --- a/openjdkjvmti/OpenjdkJvmTi.cc +++ b/openjdkjvmti/OpenjdkJvmTi.cc @@ -1195,7 +1195,7 @@ class JvmtiFunctions { #undef ADD_CAPABILITY gEventHandler->HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env), changed, - /*added*/true); + /*added=*/true); return ret; } @@ -1219,7 +1219,7 @@ class JvmtiFunctions { #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 d20c756522..8bac38a355 100644 --- a/openjdkjvmti/deopt_manager.cc +++ b/openjdkjvmti/deopt_manager.cc @@ -289,7 +289,7 @@ class ScopedDeoptimizationContext : public art::ValueObject { 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 300a0094d4..48df53a143 100644 --- a/openjdkjvmti/events.cc +++ b/openjdkjvmti/events.cc @@ -517,7 +517,7 @@ class JvmtiMethodTraceListener final : public art::instrumentation::Instrumentat 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 @@ class JvmtiMethodTraceListener final : public art::instrumentation::Instrumentat 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 @@ class JvmtiMethodTraceListener final : public art::instrumentation::Instrumentat 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 @@ class JvmtiMethodTraceListener final : public art::instrumentation::Instrumentat 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 @@ class JvmtiMethodTraceListener final : public art::instrumentation::Instrumentat 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 @@ class JvmtiMethodTraceListener final : public art::instrumentation::Instrumentat 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 aedec270b5..6745d91d53 100644 --- a/openjdkjvmti/fixed_up_dex_file.cc +++ b/openjdkjvmti/fixed_up_dex_file.cc @@ -67,7 +67,9 @@ static void DoDexUnquicken(const art::DexFile& new_dex_file, 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 @@ static void DCheckVerifyDexFile(const art::DexFile& dex) { 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 @@ std::unique_ptr<FixedUpDexFile> FixedUpDexFile::Create(const art::DexFile& origi 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 @@ std::unique_ptr<FixedUpDexFile> FixedUpDexFile::Create(const art::DexFile& origi 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 f6113dfecc..3d33487970 100644 --- a/openjdkjvmti/ti_class.cc +++ b/openjdkjvmti/ti_class.cc @@ -113,8 +113,8 @@ static std::unique_ptr<const art::DexFile> MakeSingleDexFile(art::Thread* self, 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 895e73450e..9e8288f997 100644 --- a/openjdkjvmti/ti_class_definition.cc +++ b/openjdkjvmti/ti_class_definition.cc @@ -246,17 +246,17 @@ void ArtClassDefinition::InitWithDex(GetOriginalDexFile get_original, 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 c61d6e585c..c628a325eb 100644 --- a/openjdkjvmti/ti_extension.cc +++ b/openjdkjvmti/ti_extension.cc @@ -424,7 +424,7 @@ jvmtiError ExtensionUtil::SetExtensionEventCallback(jvmtiEnv* env, } } 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 6c79a602c3..559ee0d427 100644 --- a/openjdkjvmti/ti_heap.cc +++ b/openjdkjvmti/ti_heap.cc @@ -981,7 +981,9 @@ class FollowReferencesHelper final { // 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 @@ class FollowReferencesHelper final { 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::GetLoadedClasses(jvmtiEnv* env, } 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 295894157c..7d69c89d1e 100644 --- a/openjdkjvmti/ti_method.cc +++ b/openjdkjvmti/ti_method.cc @@ -547,7 +547,7 @@ class CommonLocalVariableClosure : public art::Closure { 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 f71328a6b6..aac7233303 100644 --- a/openjdkjvmti/ti_monitor.cc +++ b/openjdkjvmti/ti_monitor.cc @@ -191,7 +191,7 @@ class JvmtiMonitor { // 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 @@ jvmtiError MonitorUtil::RawMonitorEnterNoSuspend(jvmtiEnv* env ATTRIBUTE_UNUSED, 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 @@ jvmtiError MonitorUtil::RawMonitorEnter(jvmtiEnv* env ATTRIBUTE_UNUSED, jrawMoni 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 89ce35256d..344ae88546 100644 --- a/openjdkjvmti/ti_object.cc +++ b/openjdkjvmti/ti_object.cc @@ -92,7 +92,7 @@ jvmtiError ObjectUtil::GetObjectMonitorUsage( { 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 db2b143022..a908ef042a 100644 --- a/openjdkjvmti/ti_redefine.cc +++ b/openjdkjvmti/ti_redefine.cc @@ -152,7 +152,7 @@ class ObsoleteMethodStackVisitor : public art::StackVisitor { 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 @@ art::MemMap Redefiner::MoveDataToMemMap(const std::string& original_location, 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 @@ jvmtiError Redefiner::AddRedefinition(ArtJvmTiEnv* env, const ArtClassDefinition 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 @@ bool Redefiner::ClassRedefinition::CheckVerification(const RedefinitionDataIter& 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); @@ -1367,7 +1367,7 @@ jvmtiError Redefiner::Run() { // 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 1189b1dec5..427869e798 100644 --- a/openjdkjvmti/ti_search.cc +++ b/openjdkjvmti/ti_search.cc @@ -229,8 +229,12 @@ jvmtiError SearchUtil::AddToBootstrapClassLoaderSearch(jvmtiEnv* env ATTRIBUTE_U 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 5a98755c67..1279f3bde5 100644 --- a/openjdkjvmti/ti_stack.cc +++ b/openjdkjvmti/ti_stack.cc @@ -150,7 +150,7 @@ struct GetStackTraceVectorClosure : public art::Closure { 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 @@ struct GetStackTraceDirectClosure : public art::Closure { ++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 @@ struct GetAllStackTracesVectorClosure : public art::Closure { 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 @@ struct MonitorInfoClosure : public art::Closure { 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 a0e5b5c926..12b9546635 100644 --- a/openjdkjvmti/ti_thread.cc +++ b/openjdkjvmti/ti_thread.cc @@ -857,7 +857,7 @@ jvmtiError ThreadUtil::SuspendOther(art::Thread* self, 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 d87ca56b85..653f944d7c 100644 --- a/openjdkjvmti/transform.cc +++ b/openjdkjvmti/transform.cc @@ -76,7 +76,7 @@ class TransformationFaultHandler final : public art::FaultHandler { 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() { |