From 730156116f4be758c8d3cab7f225e7729a14c110 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Fri, 18 Jun 2021 17:45:04 +0000 Subject: [PATCH] [vm] Cleanup unused variables in anticipation of switching to new clang. Extracted from https://dart-review.googlesource.com/c/sdk/+/201862 that switches clang to Fuchsia toolchain. TEST=ci Change-Id: Icd4e985a433f81862e681332dfcf905b8ec7ba4c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204060 Reviewed-by: Martin Kustermann Commit-Queue: Alexander Aprelev --- runtime/bin/process_win.cc | 4 ++-- runtime/vm/compiler/backend/code_statistics.cc | 2 -- runtime/vm/debugger.cc | 3 +-- runtime/vm/heap/compactor.cc | 3 --- runtime/vm/heap/freelist.cc | 8 -------- runtime/vm/object.cc | 4 ---- 6 files changed, 3 insertions(+), 21 deletions(-) diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc index b3bc9a9dbc2..3567d214ba8 100644 --- a/runtime/bin/process_win.cc +++ b/runtime/bin/process_win.cc @@ -96,7 +96,7 @@ class ProcessInfoList { MutexLocker locker(mutex_); HANDLE wait_handle = INVALID_HANDLE_VALUE; BOOL success = RegisterWaitForSingleObject( - &wait_handle, handle, &ExitCodeCallback, reinterpret_cast(pid), + &wait_handle, handle, &ExitCodeCallback, reinterpret_cast(pid), INFINITE, WT_EXECUTEONLYONCE); if (!success) { FATAL("Failed to register exit code wait operation."); @@ -151,7 +151,7 @@ class ProcessInfoList { if (timed_out) { return; } - DWORD pid = reinterpret_cast(data); + DWORD pid = reinterpret_cast(data); HANDLE handle; HANDLE wait_handle; HANDLE exit_pipe; diff --git a/runtime/vm/compiler/backend/code_statistics.cc b/runtime/vm/compiler/backend/code_statistics.cc index f18339cbcff..3a0621b8a0b 100644 --- a/runtime/vm/compiler/backend/code_statistics.cc +++ b/runtime/vm/compiler/backend/code_statistics.cc @@ -175,7 +175,6 @@ void CodeStatistics::Finalize() { } void CodeStatistics::AppendTo(CombinedCodeStatistics* stat) { - intptr_t sum = 0; bool returns_constant = true; bool returns_const_with_load_field_ = true; @@ -183,7 +182,6 @@ void CodeStatistics::AppendTo(CombinedCodeStatistics* stat) { intptr_t bytes = entries_[i].bytes; stat->entries_[i].count += entries_[i].count; if (bytes > 0) { - sum += bytes; stat->entries_[i].bytes += bytes; if (i != CombinedCodeStatistics::kTagParallelMove && i != CombinedCodeStatistics::kTagReturn && diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc index 0f18a4756f4..8f0ed32a017 100644 --- a/runtime/vm/debugger.cc +++ b/runtime/vm/debugger.cc @@ -1331,8 +1331,7 @@ TypeArgumentsPtr ActivationFrame::BuildParameters( TypeParameters& type_params = TypeParameters::Handle(); Function& current = Function::Handle(function().ptr()); intptr_t mapping_offset = num_vars; - for (intptr_t i = 0; !current.IsNull(); i += current.NumTypeParameters(), - current = current.parent_function()) { + for (; !current.IsNull(); current = current.parent_function()) { type_params = current.type_parameters(); if (type_params.IsNull()) continue; intptr_t size = current.NumTypeParameters(); diff --git a/runtime/vm/heap/compactor.cc b/runtime/vm/heap/compactor.cc index 462a9d24655..a4bd2199719 100644 --- a/runtime/vm/heap/compactor.cc +++ b/runtime/vm/heap/compactor.cc @@ -473,7 +473,6 @@ uword CompactorTask::PlanBlock(uword first_object, // 1. Compute bitvector of surviving allocation units in the block. intptr_t block_live_size = 0; - intptr_t block_dead_size = 0; uword current = first_object; while (current < block_end) { ObjectPtr obj = UntaggedObject::FromAddr(current); @@ -483,8 +482,6 @@ uword CompactorTask::PlanBlock(uword first_object, ASSERT(static_cast(forwarding_block->Lookup(current)) == block_live_size); block_live_size += size; - } else { - block_dead_size += size; } current += size; } diff --git a/runtime/vm/heap/freelist.cc b/runtime/vm/heap/freelist.cc index edc9534bbfc..881e595109d 100644 --- a/runtime/vm/heap/freelist.cc +++ b/runtime/vm/heap/freelist.cc @@ -220,16 +220,12 @@ intptr_t FreeList::LengthLocked(int index) const { } void FreeList::PrintSmall() const { - int small_sizes = 0; - int small_objects = 0; intptr_t small_bytes = 0; for (int i = 0; i < kNumLists; ++i) { if (free_lists_[i] == NULL) { continue; } - small_sizes += 1; intptr_t list_length = LengthLocked(i); - small_objects += list_length; intptr_t list_bytes = list_length * i * kObjectAlignment; small_bytes += list_bytes; OS::PrintErr( @@ -265,20 +261,16 @@ class IntptrPair { }; void FreeList::PrintLarge() const { - int large_sizes = 0; - int large_objects = 0; intptr_t large_bytes = 0; MallocDirectChainedHashMap > map; FreeListElement* node; for (node = free_lists_[kNumLists]; node != NULL; node = node->next()) { IntptrPair* pair = map.Lookup(node->HeapSize()); if (pair == NULL) { - large_sizes += 1; map.Insert(IntptrPair(node->HeapSize(), 1)); } else { pair->set_second(pair->second() + 1); } - large_objects += 1; } MallocDirectChainedHashMap >::Iterator it = diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 7f084c29990..07f818812e3 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -313,7 +313,6 @@ const char* String::ScrubName(const String& name, bool is_extension) { printer.Clear(); intptr_t start = 0; - intptr_t final_len = 0; intptr_t len = sum_segment_len; bool is_setter = false; if (is_extension) { @@ -323,7 +322,6 @@ const char* String::ScrubName(const String& name, bool is_extension) { intptr_t slen = i + 1; intptr_t plen = slen - start; AppendSubString(&printer, unmangled_name, start, plen); - final_len = plen; unmangled_name += slen; len -= slen; break; @@ -379,13 +377,11 @@ const char* String::ScrubName(const String& name, bool is_extension) { intptr_t end = ((dot_pos + 1) == len) ? dot_pos : len; intptr_t substr_len = end - start; - final_len += substr_len; AppendSubString(&printer, unmangled_name, start, substr_len); if (is_setter) { const char* equals = Symbols::Equals().ToCString(); const intptr_t equals_len = strlen(equals); AppendSubString(&printer, equals, 0, equals_len); - final_len += equals_len; } return printer.buffer();