diff options
author | Brian Carlstrom <bdc@google.com> | 2013-07-18 10:50:06 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2013-07-18 10:50:06 -0700 |
commit | b9070095218595a5d6a37ef874df2794c1761030 (patch) | |
tree | cab984d0ac72b8df4915f75277cd7efe0e8c9a3e /runtime | |
parent | 08524597899d0bb021c9165218deff51dc88da50 (diff) | |
parent | df62950e7a32031b82360c407d46a37b94188fbb (diff) | |
download | art-b9070095218595a5d6a37ef874df2794c1761030.zip art-b9070095218595a5d6a37ef874df2794c1761030.tar.gz art-b9070095218595a5d6a37ef874df2794c1761030.tar.bz2 |
resolved conflicts for merge of df62950e to dalvik-dev
Change-Id: I78fbcfc7a2dcbeccb7557ca27302928d7d00debd
Diffstat (limited to 'runtime')
31 files changed, 98 insertions, 104 deletions
diff --git a/runtime/base/mutex-inl.h b/runtime/base/mutex-inl.h index 07157da..b3f5092 100644 --- a/runtime/base/mutex-inl.h +++ b/runtime/base/mutex-inl.h @@ -148,7 +148,7 @@ inline void ReaderWriterMutex::SharedLock(Thread* self) { } android_atomic_dec(&num_pending_readers_); } - } while(!done); + } while (!done); #else CHECK_MUTEX_CALL(pthread_rwlock_rdlock, (&rwlock_)); #endif @@ -176,7 +176,7 @@ inline void ReaderWriterMutex::SharedUnlock(Thread* self) { } else { LOG(FATAL) << "Unexpected state_:" << cur_state << " for " << name_; } - } while(!done); + } while (!done); #else CHECK_MUTEX_CALL(pthread_rwlock_unlock, (&rwlock_)); #endif diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc index 25c0b9e..1df0207 100644 --- a/runtime/base/mutex.cc +++ b/runtime/base/mutex.cc @@ -178,7 +178,7 @@ void BaseMutex::RecordContention(uint64_t blocked_tid, uint64_t owner_tid, uint6 do { slot = cur_content_log_entry_; new_slot = (slot + 1) % kContentionLogSize; - } while(!cur_content_log_entry_.CompareAndSwap(slot, new_slot)); + } while (!cur_content_log_entry_.CompareAndSwap(slot, new_slot)); contention_log_[new_slot].blocked_tid = blocked_tid; contention_log_[new_slot].owner_tid = owner_tid; contention_log_[new_slot].count = 1; @@ -312,7 +312,7 @@ void Mutex::ExclusiveLock(Thread* self) { } android_atomic_dec(&num_contenders_); } - } while(!done); + } while (!done); DCHECK_EQ(state_, 1); exclusive_owner_ = SafeGetTid(self); #else @@ -344,7 +344,7 @@ bool Mutex::ExclusiveTryLock(Thread* self) { } else { return false; } - } while(!done); + } while (!done); DCHECK_EQ(state_, 1); exclusive_owner_ = SafeGetTid(self); #else @@ -404,7 +404,7 @@ void Mutex::ExclusiveUnlock(Thread* self) { _exit(1); } } - } while(!done); + } while (!done); #else CHECK_MUTEX_CALL(pthread_mutex_unlock, (&mutex_)); #endif @@ -513,7 +513,7 @@ void ReaderWriterMutex::ExclusiveLock(Thread* self) { } android_atomic_dec(&num_pending_writers_); } - } while(!done); + } while (!done); DCHECK_EQ(state_, -1); exclusive_owner_ = SafeGetTid(self); #else @@ -545,7 +545,7 @@ void ReaderWriterMutex::ExclusiveUnlock(Thread* self) { } else { LOG(FATAL) << "Unexpected state_:" << cur_state << " for " << name_; } - } while(!done); + } while (!done); #else CHECK_MUTEX_CALL(pthread_rwlock_unlock, (&rwlock_)); #endif @@ -583,7 +583,7 @@ bool ReaderWriterMutex::ExclusiveLockWithTimeout(Thread* self, int64_t ms, int32 } android_atomic_dec(&num_pending_writers_); } - } while(!done); + } while (!done); exclusive_owner_ = SafeGetTid(self); #else timespec ts; @@ -616,7 +616,7 @@ bool ReaderWriterMutex::SharedTryLock(Thread* self) { // Owner holds it exclusively. return false; } - } while(!done); + } while (!done); #else int result = pthread_rwlock_tryrdlock(&rwlock_); if (result == EBUSY) { diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc index 403a2eb..7429ab1 100644 --- a/runtime/check_jni.cc +++ b/runtime/check_jni.cc @@ -401,7 +401,7 @@ class ScopedCheck { * * Use the kFlag_NullableUtf flag where 'u' field(s) are nullable. */ - void Check(bool entry, const char* fmt0, ...) SHARED_LOCKS_REQUIRED (Locks::mutator_lock_) { + void Check(bool entry, const char* fmt0, ...) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { va_list ap; const mirror::AbstractMethod* traceMethod = NULL; diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index e5844b0..3c1cd78 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -937,14 +937,14 @@ TEST_F(ClassLinkerTest, StaticFields) { // TODO: Remove EXPECT_FALSE when GCC can handle EXPECT_EQ // http://code.google.com/p/googletest/issues/detail?id=322 - EXPECT_FALSE( s0->GetBoolean(statics)); - EXPECT_EQ(6, s1->GetByte(statics)); - EXPECT_EQ('b', s2->GetChar(statics)); - EXPECT_EQ(-535, s3->GetShort(statics)); - EXPECT_EQ(2000000001, s4->GetInt(statics)); + EXPECT_FALSE(s0->GetBoolean(statics)); + EXPECT_EQ(6, s1->GetByte(statics)); + EXPECT_EQ('b', s2->GetChar(statics)); + EXPECT_EQ(-535, s3->GetShort(statics)); + EXPECT_EQ(2000000001, s4->GetInt(statics)); EXPECT_EQ(0x34567890abcdef12LL, s5->GetLong(statics)); - EXPECT_EQ(0.75, s6->GetFloat(statics)); - EXPECT_EQ(16777219, s7->GetDouble(statics)); + EXPECT_EQ(0.75, s6->GetFloat(statics)); + EXPECT_EQ(16777219, s7->GetDouble(statics)); EXPECT_TRUE(s8->GetObject(statics)->AsString()->Equals("robot")); } diff --git a/runtime/common_test.h b/runtime/common_test.h index 73c47b5..e735e27 100644 --- a/runtime/common_test.h +++ b/runtime/common_test.h @@ -178,8 +178,7 @@ class CommonTest : public testing::Test { fp_spill_mask, reinterpret_cast<uint32_t>(mapping_table), reinterpret_cast<uint32_t>(vmap_table), - reinterpret_cast<uint32_t>(gc_map) - ); + reinterpret_cast<uint32_t>(gc_map)); } void MakeExecutable(mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -308,7 +307,7 @@ class CommonTest : public testing::Test { options.push_back(std::make_pair("-Xcheck:jni", reinterpret_cast<void*>(NULL))); options.push_back(std::make_pair(min_heap_string.c_str(), reinterpret_cast<void*>(NULL))); options.push_back(std::make_pair(max_heap_string.c_str(), reinterpret_cast<void*>(NULL))); - if(!Runtime::Create(options, false)) { + if (!Runtime::Create(options, false)) { LOG(FATAL) << "Failed to create runtime"; return; } diff --git a/runtime/debugger.cc b/runtime/debugger.cc index b502c9a..4fbee51 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -184,7 +184,7 @@ static Dbg::HpsgWhat gDdmNhsgWhat; static ObjectRegistry* gRegistry = NULL; // Recent allocation tracking. -static Mutex gAllocTrackerLock DEFAULT_MUTEX_ACQUIRED_AFTER ("AllocTracker lock"); +static Mutex gAllocTrackerLock DEFAULT_MUTEX_ACQUIRED_AFTER("AllocTracker lock"); AllocRecord* Dbg::recent_allocation_records_ PT_GUARDED_BY(gAllocTrackerLock) = NULL; // TODO: CircularBuffer<AllocRecord> static size_t gAllocRecordMax GUARDED_BY(gAllocTrackerLock) = 0; static size_t gAllocRecordHead GUARDED_BY(gAllocTrackerLock) = 0; @@ -2761,7 +2761,7 @@ JDWP::JdwpError Dbg::InvokeMethod(JDWP::ObjectId thread_id, JDWP::ObjectId objec VLOG(jdwp) << " Control has returned from event thread"; /* wait for thread to re-suspend itself */ - SuspendThread(thread_id, false /* request_suspension */ ); + SuspendThread(thread_id, false /* request_suspension */); self->TransitionFromSuspendedToRunnable(); } diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 28e06cc..8edeb18 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -1039,7 +1039,7 @@ class ClassDataItemIterator { } InvokeType GetMethodInvokeType(const DexFile::ClassDef& class_def) const { if (HasNextDirectMethod()) { - if ((GetMemberAccessFlags() & kAccStatic) != 0 ) { + if ((GetMemberAccessFlags() & kAccStatic) != 0) { return kStatic; } else { return kDirect; diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc index 427baf2..6b41511 100644 --- a/runtime/dex_instruction.cc +++ b/runtime/dex_instruction.cc @@ -56,12 +56,11 @@ int const Instruction::kInstructionVerifyFlags[] = { int const Instruction::kInstructionSizeInCodeUnits[] = { #define INSTRUCTION_SIZE(opcode, c, p, format, r, i, a, v) \ - (( opcode == NOP ) ? -1 : \ + ((opcode == NOP) ? -1 : \ ((format >= k10x) && (format <= k10t)) ? 1 : \ ((format >= k20t) && (format <= k22c)) ? 2 : \ ((format >= k32x) && (format <= k3rc)) ? 3 : \ - ( format == k51l ) ? 5 : -1 \ - ), + (format == k51l) ? 5 : -1), #include "dex_instruction_list.h" DEX_INSTRUCTION_LIST(INSTRUCTION_SIZE) #undef DEX_INSTRUCTION_LIST diff --git a/runtime/disassembler_arm.cc b/runtime/disassembler_arm.cc index 172bef8..3c9cb6e 100644 --- a/runtime/disassembler_arm.cc +++ b/runtime/disassembler_arm.cc @@ -1184,7 +1184,7 @@ size_t DisassemblerArm::DumpThumb16(std::ostream& os, const uint8_t* instr_ptr) ThumbRegister Rm(instr, 6); ThumbRegister Rn(instr, 3); ThumbRegister Rt(instr, 0); - switch(opB) { + switch (opB) { case 0: opcode << "str"; break; case 1: opcode << "strh"; break; case 2: opcode << "strb"; break; @@ -1206,7 +1206,7 @@ size_t DisassemblerArm::DumpThumb16(std::ostream& os, const uint8_t* instr_ptr) uint16_t opB = (instr >> 11) & 1; ThumbRegister Rn(instr, 3); ThumbRegister Rt(instr, 0); - switch(opA) { + switch (opA) { case 6: imm5 <<= 2; opcode << (opB == 0 ? "str" : "ldr"); diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc index da122e6..6ce36e8 100644 --- a/runtime/elf_file.cc +++ b/runtime/elf_file.cc @@ -366,7 +366,7 @@ static unsigned elfhash(const char *_name) { const unsigned char *name = (const unsigned char *) _name; unsigned h = 0, g; - while(*name) { + while (*name) { h = (h << 4) + *name++; g = h & 0xf0000000; h ^= g; diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h index d677ade..92d9ea2 100644 --- a/runtime/gc/accounting/atomic_stack.h +++ b/runtime/gc/accounting/atomic_stack.h @@ -66,7 +66,7 @@ class AtomicStack { // Stack overflow. return false; } - } while(!back_index_.compare_and_swap(index, index + 1)); + } while (!back_index_.compare_and_swap(index, index + 1)); begin_[index] = value; return true; } diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc index aa02f82..91c9253 100644 --- a/runtime/gc/accounting/mod_union_table.cc +++ b/runtime/gc/accounting/mod_union_table.cc @@ -44,8 +44,8 @@ class MarkIfReachesAllocspaceVisitor { } // Extra parameters are required since we use this same visitor signature for checking objects. - void operator ()(const Object* obj, const Object* ref, const MemberOffset& /* offset */, - bool /* is_static */) const { + void operator()(const Object* obj, const Object* ref, const MemberOffset& /* offset */, + bool /* is_static */) const { // TODO: Optimize? // TODO: C++0x auto const std::vector<space::ContinuousSpace*>& spaces = heap_->GetContinuousSpaces(); @@ -70,7 +70,7 @@ class ModUnionVisitor { bitmap_(bitmap) { } - void operator ()(const Object* obj) const + void operator()(const Object* obj) const SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_, Locks::mutator_lock_) { DCHECK(obj != NULL); @@ -90,7 +90,7 @@ class ModUnionClearCardSetVisitor { : cleared_cards_(cleared_cards) { } - inline void operator ()(byte* card, byte expected_value, byte new_value) const { + inline void operator()(byte* card, byte expected_value, byte new_value) const { if (expected_value == CardTable::kCardDirty) { cleared_cards_->insert(card); } @@ -106,7 +106,7 @@ class ModUnionClearCardVisitor { : cleared_cards_(cleared_cards) { } - void operator ()(byte* card, byte expected_card, byte new_card) const { + void operator()(byte* card, byte expected_card, byte new_card) const { if (expected_card == CardTable::kCardDirty) { cleared_cards_->push_back(card); } @@ -120,7 +120,7 @@ class ModUnionScanImageRootVisitor { explicit ModUnionScanImageRootVisitor(collector::MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {} - void operator ()(const Object* root) const + void operator()(const Object* root) const EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(root != NULL); @@ -147,8 +147,8 @@ class AddToReferenceArrayVisitor { } // Extra parameters are required since we use this same visitor signature for checking objects. - void operator ()(const Object* obj, const Object* ref, const MemberOffset& /* offset */, - bool /* is_static */) const { + void operator()(const Object* obj, const Object* ref, const MemberOffset& /* offset */, + bool /* is_static */) const { // Only add the reference if it is non null and fits our criteria. if (ref != NULL && mod_union_table_->AddReference(obj, ref)) { references_->push_back(ref); @@ -168,7 +168,7 @@ class ModUnionReferenceVisitor { references_(references) { } - void operator ()(const Object* obj) const + void operator()(const Object* obj) const SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_, Locks::mutator_lock_) { DCHECK(obj != NULL); // We don't have an early exit since we use the visitor pattern, an early @@ -191,8 +191,8 @@ class CheckReferenceVisitor { // Extra parameters are required since we use this same visitor signature for checking objects. // TODO: Fixme when anotatalysis works with visitors. - void operator ()(const Object* obj, const Object* ref, const MemberOffset& /* offset */, - bool /* is_static */) const + void operator()(const Object* obj, const Object* ref, const MemberOffset& /* offset */, + bool /* is_static */) const SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_, Locks::mutator_lock_) { Heap* heap = mod_union_table_->GetHeap(); if (ref != NULL && mod_union_table_->AddReference(obj, ref) && @@ -216,13 +216,13 @@ class CheckReferenceVisitor { class ModUnionCheckReferences { public: - explicit ModUnionCheckReferences (ModUnionTableReferenceCache* mod_union_table, - const std::set<const Object*>& references) + explicit ModUnionCheckReferences(ModUnionTableReferenceCache* mod_union_table, + const std::set<const Object*>& references) EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) : mod_union_table_(mod_union_table), references_(references) { } - void operator ()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS { + void operator()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS { Locks::heap_bitmap_lock_->AssertSharedHeld(Thread::Current()); DCHECK(obj != NULL); CheckReferenceVisitor visitor(mod_union_table_, references_); @@ -333,7 +333,7 @@ void ModUnionTableReferenceCache::MarkReferences(collector::MarkSweep* mark_swee typedef SafeMap<const byte*, std::vector<const mirror::Object*> >::const_iterator It; for (It it = references_.begin(); it != references_.end(); ++it) { typedef std::vector<const mirror::Object*>::const_iterator It2; - for (It2 it_ref = it->second.begin(); it_ref != it->second.end(); ++it_ref ) { + for (It2 it_ref = it->second.begin(); it_ref != it->second.end(); ++it_ref) { mark_sweep->MarkRoot(*it_ref); ++count; } diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index bf4c1ed..77f93a2 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -103,7 +103,7 @@ class SpaceBitmap { : bitmap_(bitmap) { } - void operator ()(mirror::Object* obj) const { + void operator()(mirror::Object* obj) const { bitmap_->Clear(obj); } private: @@ -112,7 +112,7 @@ class SpaceBitmap { template <typename Visitor> void VisitRange(uintptr_t visit_begin, uintptr_t visit_end, const Visitor& visitor) const { - for (; visit_begin < visit_end; visit_begin += kAlignment ) { + for (; visit_begin < visit_end; visit_begin += kAlignment) { visitor(reinterpret_cast<mirror::Object*>(visit_begin)); } } diff --git a/runtime/gc/accounting/space_bitmap_test.cc b/runtime/gc/accounting/space_bitmap_test.cc index d00d7c2..516a449 100644 --- a/runtime/gc/accounting/space_bitmap_test.cc +++ b/runtime/gc/accounting/space_bitmap_test.cc @@ -46,7 +46,7 @@ class BitmapVerify { begin_(begin), end_(end) {} - void operator ()(const mirror::Object* obj) { + void operator()(const mirror::Object* obj) { EXPECT_TRUE(obj >= begin_); EXPECT_TRUE(obj <= end_); EXPECT_TRUE(bitmap_->Test(obj) == ((reinterpret_cast<uintptr_t>(obj) & 0xF) != 0)); diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc index 865ee13..8a72b60 100644 --- a/runtime/gc/collector/mark_sweep.cc +++ b/runtime/gc/collector/mark_sweep.cc @@ -72,7 +72,7 @@ class SetFingerVisitor { public: explicit SetFingerVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {} - void operator ()(void* finger) const { + void operator()(void* finger) const { mark_sweep_->SetFinger(reinterpret_cast<Object*>(finger)); } @@ -522,7 +522,7 @@ class CheckObjectVisitor { public: explicit CheckObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {} - void operator ()(const Object* obj, const Object* ref, MemberOffset offset, bool is_static) const + void operator()(const Object* obj, const Object* ref, MemberOffset offset, bool is_static) const NO_THREAD_SAFETY_ANALYSIS { if (kDebugLocking) { Locks::heap_bitmap_lock_->AssertSharedHeld(Thread::Current()); @@ -563,7 +563,7 @@ class ScanObjectVisitor { explicit ScanObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {} // TODO: Fixme when anotatalysis works with visitors. - void operator ()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS { + void operator()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS { if (kDebugLocking) { Locks::mutator_lock_->AssertSharedHeld(Thread::Current()); Locks::heap_bitmap_lock_->AssertExclusiveHeld(Thread::Current()); @@ -607,7 +607,7 @@ class CheckBitmapVisitor { public: explicit CheckBitmapVisitor(MarkSweep* mark_sweep) : mark_sweep_(mark_sweep) {} - void operator ()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS { + void operator()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS { if (kDebugLocking) { Locks::heap_bitmap_lock_->AssertSharedHeld(Thread::Current()); } @@ -1079,8 +1079,8 @@ class MarkObjectVisitor { explicit MarkObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {} // TODO: Fixme when anotatalysis works with visitors. - void operator ()(const Object* /* obj */, const Object* ref, const MemberOffset& /* offset */, - bool /* is_static */) const + void operator()(const Object* /* obj */, const Object* ref, const MemberOffset& /* offset */, + bool /* is_static */) const NO_THREAD_SAFETY_ANALYSIS { if (kDebugLocking) { Locks::mutator_lock_->AssertSharedHeld(Thread::Current()); @@ -1146,8 +1146,8 @@ class MarkStackChunk : public Task { public: explicit MarkObjectParallelVisitor(MarkStackChunk* chunk_task) : chunk_task_(chunk_task) {} - void operator ()(const Object* /* obj */, const Object* ref, - const MemberOffset& /* offset */, bool /* is_static */) const { + void operator()(const Object* /* obj */, const Object* ref, + const MemberOffset& /* offset */, bool /* is_static */) const { if (ref != NULL && chunk_task_->mark_sweep_->MarkObjectParallel(ref)) { chunk_task_->MarkStackPush(ref); } diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 6423a0d..021d8e7 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -232,7 +232,7 @@ void Heap::DeleteThreadPool() { // Sort spaces based on begin address struct ContinuousSpaceSorter { - bool operator ()(const space::ContinuousSpace* a, const space::ContinuousSpace* b) const { + bool operator()(const space::ContinuousSpace* a, const space::ContinuousSpace* b) const { return a->Begin() < b->Begin(); } }; @@ -895,8 +895,8 @@ class ReferringObjectsFinder { } // For MarkSweep::VisitObjectReferences. - void operator ()(const mirror::Object* referrer, const mirror::Object* object, - const MemberOffset&, bool) const { + void operator()(const mirror::Object* referrer, const mirror::Object* object, + const MemberOffset&, bool) const { if (object == object_ && (max_count_ == 0 || referring_objects_.size() < max_count_)) { referring_objects_.push_back(const_cast<mirror::Object*>(referrer)); } @@ -1166,7 +1166,7 @@ static void RootMatchesObjectVisitor(const mirror::Object* root, void* arg) { class ScanVisitor { public: - void operator ()(const mirror::Object* obj) const { + void operator()(const mirror::Object* obj) const { LOG(INFO) << "Would have rescanned object " << obj; } }; @@ -1184,8 +1184,8 @@ class VerifyReferenceVisitor { // TODO: Fix lock analysis to not use NO_THREAD_SAFETY_ANALYSIS, requires support for smarter // analysis on visitors. - void operator ()(const mirror::Object* obj, const mirror::Object* ref, - const MemberOffset& offset, bool /* is_static */) const + void operator()(const mirror::Object* obj, const mirror::Object* ref, + const MemberOffset& offset, bool /* is_static */) const NO_THREAD_SAFETY_ANALYSIS { // Verify that the reference is live. if (UNLIKELY(ref != NULL && !IsLive(ref))) { @@ -1265,7 +1265,7 @@ class VerifyObjectVisitor { public: explicit VerifyObjectVisitor(Heap* heap) : heap_(heap), failed_(false) {} - void operator ()(const mirror::Object* obj) const + void operator()(const mirror::Object* obj) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) { // Note: we are verifying the references in obj but not obj itself, this is because obj must // be live or else how did we find it in the live bitmap? @@ -1312,8 +1312,8 @@ class VerifyReferenceCardVisitor { // TODO: Fix lock analysis to not use NO_THREAD_SAFETY_ANALYSIS, requires support for // annotalysis on visitors. - void operator ()(const mirror::Object* obj, const mirror::Object* ref, const MemberOffset& offset, - bool is_static) const NO_THREAD_SAFETY_ANALYSIS { + void operator()(const mirror::Object* obj, const mirror::Object* ref, const MemberOffset& offset, + bool is_static) const NO_THREAD_SAFETY_ANALYSIS { // Filter out class references since changing an object's class does not mark the card as dirty. // Also handles large objects, since the only reference they hold is a class reference. if (ref != NULL && !ref->IsClass()) { @@ -1379,7 +1379,7 @@ class VerifyLiveStackReferences { : heap_(heap), failed_(false) {} - void operator ()(const mirror::Object* obj) const + void operator()(const mirror::Object* obj) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) { VerifyReferenceCardVisitor visitor(heap_, const_cast<bool*>(&failed_)); collector::MarkSweep::VisitObjectReferences(obj, visitor); diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index aaf449b..feccba3 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -70,7 +70,7 @@ namespace space { class AgeCardVisitor { public: - byte operator ()(byte card) const { + byte operator()(byte card) const { if (card == accounting::CardTable::kCardDirty) { return card - 1; } else { diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 45314c2..376d3be 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -969,11 +969,11 @@ static inline const Instruction* FindNextInstructionFollowingException(Thread* s return JValue(); /* Handled in caller. */ \ } \ } else { \ - inst = inst-> next_function (); \ + inst = inst->next_function(); \ } static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) - __attribute__ ((cold, noreturn, noinline)); + __attribute__((cold, noreturn, noinline)); static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -989,7 +989,7 @@ static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) template<bool do_access_check> static JValue ExecuteImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame& shadow_frame, JValue result_register) - NO_THREAD_SAFETY_ANALYSIS __attribute__ ((hot)); + NO_THREAD_SAFETY_ANALYSIS __attribute__((hot)); template<bool do_access_check> static JValue ExecuteImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, @@ -1254,7 +1254,7 @@ static JValue ExecuteImpl(Thread* self, MethodHelper& mh, const DexFile::CodeIte if (UNLIKELY(s == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { - shadow_frame.SetVRegReference( inst->VRegA_21c(), s); + shadow_frame.SetVRegReference(inst->VRegA_21c(), s); inst = inst->Next_2xx(); } break; @@ -1265,7 +1265,7 @@ static JValue ExecuteImpl(Thread* self, MethodHelper& mh, const DexFile::CodeIte if (UNLIKELY(s == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { - shadow_frame.SetVRegReference( inst->VRegA_31c(), s); + shadow_frame.SetVRegReference(inst->VRegA_31c(), s); inst = inst->Next_3xx(); } break; diff --git a/runtime/oat.h b/runtime/oat.h index fb28962..4bd1871 100644 --- a/runtime/oat.h +++ b/runtime/oat.h @@ -97,8 +97,7 @@ class PACKED(4) OatMethodOffsets { uint32_t fp_spill_mask, uint32_t mapping_table_offset, uint32_t vmap_table_offset, - uint32_t gc_map_offset - ); + uint32_t gc_map_offset); ~OatMethodOffsets(); diff --git a/runtime/reflection.cc b/runtime/reflection.cc index 467575c..359b539 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -206,8 +206,7 @@ bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_r ThrowClassCastException(throw_location, StringPrintf("Couldn't convert result of type %s to %s", PrettyDescriptor(srcType).c_str(), - PrettyDescriptor(dstType).c_str() - ).c_str()); + PrettyDescriptor(dstType).c_str()).c_str()); } return false; } @@ -297,8 +296,7 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object* ThrowClassCastException(throw_location, StringPrintf("Couldn't convert result of type %s to %s", PrettyTypeOf(o).c_str(), - PrettyDescriptor(dst_class).c_str() - ).c_str()); + PrettyDescriptor(dst_class).c_str()).c_str()); } return false; } @@ -359,8 +357,7 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object* StringPrintf("%s has type %s, got %s", UnboxingFailureKind(m, index, f).c_str(), PrettyDescriptor(dst_class).c_str(), - PrettyDescriptor(src_descriptor.c_str()).c_str() - ).c_str()); + PrettyDescriptor(src_descriptor.c_str()).c_str()).c_str()); return false; } diff --git a/runtime/stack.cc b/runtime/stack.cc index f4ae81d..35cd895 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -185,12 +185,12 @@ void StackVisitor::SetVReg(mirror::AbstractMethod* m, uint16_t vreg, uint32_t ne } uintptr_t StackVisitor::GetGPR(uint32_t reg) const { - DCHECK (cur_quick_frame_ != NULL) << "This is a quick frame routine"; + DCHECK(cur_quick_frame_ != NULL) << "This is a quick frame routine"; return context_->GetGPR(reg); } void StackVisitor::SetGPR(uint32_t reg, uintptr_t value) { - DCHECK (cur_quick_frame_ != NULL) << "This is a quick frame routine"; + DCHECK(cur_quick_frame_ != NULL) << "This is a quick frame routine"; context_->SetGPR(reg, value); } @@ -341,7 +341,7 @@ void StackVisitor::WalkStack(bool include_transitions) { } cur_depth_++; cur_shadow_frame_ = cur_shadow_frame_->GetLink(); - } while(cur_shadow_frame_ != NULL); + } while (cur_shadow_frame_ != NULL); } if (include_transitions) { bool should_continue = VisitFrame(); diff --git a/runtime/thread.cc b/runtime/thread.cc index f0d5417..d1e33b8 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1779,7 +1779,7 @@ class CatchBlockStackVisitor : public StackVisitor { m->GetDexMethodIndex(), m, m->GetAccessFlags(), false, true); verifier.Verify(); std::vector<int32_t> kinds = verifier.DescribeVRegs(dex_pc); - for(uint16_t reg = 0; reg < num_regs; reg++) { + for (uint16_t reg = 0; reg < num_regs; reg++) { VRegKind kind = static_cast<VRegKind>(kinds.at(reg * 2)); switch (kind) { case kUndefined: diff --git a/runtime/thread.h b/runtime/thread.h index 3b66943..388178f 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -104,7 +104,7 @@ class PACKED(4) Thread { static Thread* Current() { // We rely on Thread::Current returning NULL for a detached thread, so it's not obvious // that we can replace this with a direct %fs access on x86. - if(!is_started_) { + if (!is_started_) { return NULL; } else { void* thread = pthread_getspecific(Thread::pthread_key_self_); diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 59c38b4..7aa835a 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -468,7 +468,7 @@ void ThreadList::WaitForOtherNonDaemonThreadsToExit() { // Wait for another thread to exit before re-checking. thread_exit_cond_.Wait(self); } - } while(!all_threads_are_daemons); + } while (!all_threads_are_daemons); } void ThreadList::SuspendAllDaemonThreads() { diff --git a/runtime/trace.cc b/runtime/trace.cc index 3293290..2227b8d 100644 --- a/runtime/trace.cc +++ b/runtime/trace.cc @@ -230,7 +230,7 @@ void Trace::Start(const char* trace_filename, int trace_fd, int buffer_size, int // Create Trace object. { MutexLock mu(self, *Locks::trace_lock_); - if(the_trace_ != NULL) { + if (the_trace_ != NULL) { LOG(ERROR) << "Trace already in progress, ignoring this request"; } else { the_trace_ = new Trace(trace_file.release(), buffer_size, flags); diff --git a/runtime/utils.h b/runtime/utils.h index a08e465..72597f5 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -352,18 +352,18 @@ bool IsValidOatFilename(const std::string& filename); class VoidFunctor { public: template <typename A> - inline void operator () (A a) const { + inline void operator() (A a) const { UNUSED(a); } template <typename A, typename B> - inline void operator () (A a, B b) const { + inline void operator() (A a, B b) const { UNUSED(a); UNUSED(b); } template <typename A, typename B, typename C> - inline void operator () (A a, B b, C c) const { + inline void operator() (A a, B b, C c) const { UNUSED(a); UNUSED(b); UNUSED(c); diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index ff7f594..59de9b3 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -1014,12 +1014,12 @@ bool MethodVerifier::VerifyCodeFlow() { verifier::MethodVerifier::SetDexGcMap(ref, *dex_gc_map); MethodVerifier::MethodSafeCastSet* method_to_safe_casts = GenerateSafeCastSet(); - if(method_to_safe_casts != NULL ) { + if (method_to_safe_casts != NULL) { SetSafeCastMap(ref, method_to_safe_casts); } MethodVerifier::PcToConcreteMethodMap* pc_to_concrete_method = GenerateDevirtMap(); - if(pc_to_concrete_method != NULL ) { + if (pc_to_concrete_method != NULL) { SetDevirtMap(ref, pc_to_concrete_method); } return true; @@ -1824,7 +1824,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { uint32_t instance_of_idx = 0; if (0 != work_insn_idx_) { instance_of_idx = work_insn_idx_ - 1; - while(0 != instance_of_idx && !insn_flags_[instance_of_idx].IsOpcode()) { + while (0 != instance_of_idx && !insn_flags_[instance_of_idx].IsOpcode()) { instance_of_idx--; } CHECK(insn_flags_[instance_of_idx].IsOpcode()); @@ -1854,7 +1854,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { // which is not done because of the multiple inheritance implications. const RegType& cast_type = ResolveClassAndCheckAccess(instance_of_inst->VRegC_22c()); - if(!cast_type.IsUnresolvedTypes() && !cast_type.GetClass()->IsInterface()) { + if (!cast_type.IsUnresolvedTypes() && !cast_type.GetClass()->IsInterface()) { RegisterLine* update_line = new RegisterLine(code_item_->registers_size_, this); if (inst->Opcode() == Instruction::IF_EQZ) { fallthrough_line.reset(update_line); @@ -1868,7 +1868,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { // register encoding space of instance-of, and propagate type information to the source // of the move-object. uint32_t move_idx = instance_of_idx - 1; - while(0 != move_idx && !insn_flags_[move_idx].IsOpcode()) { + while (0 != move_idx && !insn_flags_[move_idx].IsOpcode()) { move_idx--; } CHECK(insn_flags_[move_idx].IsOpcode()); @@ -3766,7 +3766,7 @@ MethodVerifier::PcToConcreteMethodMap* MethodVerifier::GenerateDevirtMap() { bool is_interface = (inst->Opcode() == Instruction::INVOKE_INTERFACE) || (inst->Opcode() == Instruction::INVOKE_INTERFACE_RANGE); - if(!is_interface && !is_virtual) { + if (!is_interface && !is_virtual) { continue; } // Get reg type for register holding the reference to the object that will be dispatched upon. @@ -3792,7 +3792,7 @@ MethodVerifier::PcToConcreteMethodMap* MethodVerifier::GenerateDevirtMap() { } mirror::AbstractMethod* abstract_method = dex_cache_->GetResolvedMethod(is_range ? inst->VRegB_3rc() : inst->VRegB_35c()); - if(abstract_method == NULL) { + if (abstract_method == NULL) { // If the method is not found in the cache this means that it was never found // by ResolveMethodAndCheckAccess() called when verifying invoke_*. continue; @@ -3986,7 +3986,7 @@ const MethodReference* MethodVerifier::GetDevirtMap(const MethodReference& ref, // Look up the PC in the map, get the concrete method to execute and return its reference. MethodVerifier::PcToConcreteMethodMap::const_iterator pc_to_concrete_method = it->second->find(dex_pc); - if(pc_to_concrete_method != it->second->end()) { + if (pc_to_concrete_method != it->second->end()) { return &(pc_to_concrete_method->second); } else { return NULL; diff --git a/runtime/verifier/reg_type.cc b/runtime/verifier/reg_type.cc index 1c61a29..8418928 100644 --- a/runtime/verifier/reg_type.cc +++ b/runtime/verifier/reg_type.cc @@ -211,7 +211,7 @@ void LongHiType::Destroy() { } LongLoType* LongLoType::GetInstance() { - CHECK (instance_ != NULL); + CHECK(instance_ != NULL); return instance_; } @@ -355,7 +355,7 @@ BooleanType* BooleanType::GetInstance() { } void BooleanType::Destroy() { - if(BooleanType::instance != NULL) { + if (BooleanType::instance != NULL) { delete instance; instance = NULL; } diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc index 6013250..22c585c 100644 --- a/runtime/verifier/reg_type_cache.cc +++ b/runtime/verifier/reg_type_cache.cc @@ -377,7 +377,7 @@ const RegType& RegTypeCache::FromUninitialized(const RegType& uninit_type) { entry = new UnresolvedReferenceType(descriptor.c_str(), entries_.size()); } else { mirror::Class* klass = uninit_type.GetClass(); - if(uninit_type.IsUninitializedThisReference() && !klass->IsFinal()) { + if (uninit_type.IsUninitializedThisReference() && !klass->IsFinal()) { // For uninitialized "this reference" look for reference types that are not precise. for (size_t i = primitive_count_; i < entries_.size(); i++) { RegType* cur_entry = entries_[i]; diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h index 814dff7..2411758 100644 --- a/runtime/verifier/reg_type_cache.h +++ b/runtime/verifier/reg_type_cache.h @@ -44,7 +44,7 @@ class RegTypeCache { } ~RegTypeCache(); static void Init() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - if(!RegTypeCache::primitive_initialized_) { + if (!RegTypeCache::primitive_initialized_) { CHECK_EQ(RegTypeCache::primitive_count_, 0); CreatePrimitiveTypes(); CHECK_EQ(RegTypeCache::primitive_count_, kNumPrimitives); diff --git a/runtime/verifier/reg_type_test.cc b/runtime/verifier/reg_type_test.cc index d2c9dd6..a24c3c9 100644 --- a/runtime/verifier/reg_type_test.cc +++ b/runtime/verifier/reg_type_test.cc @@ -405,7 +405,7 @@ TEST_F(RegTypeReferenceTest, Dump) { std::string expected = "Unresolved Reference: java.lang.DoesNotExist"; EXPECT_EQ(expected, unresolved_ref.Dump()); expected = "Precise Reference: java.lang.String"; - EXPECT_EQ( expected, resolved_ref.Dump()); + EXPECT_EQ(expected, resolved_ref.Dump()); expected ="Uninitialized Reference: java.lang.String Allocation PC: 10"; EXPECT_EQ(expected, resolved_unintialiesd.Dump()); expected = "Unresolved And Uninitialized Reference: java.lang.DoesNotExist Allocation PC: 12"; |