summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-05-03 15:20:23 -0700
committerMathieu Chartier <mathieuc@google.com>2015-05-04 09:39:23 -0700
commit414369a2e3f23e1408fc1cbf4f623014bd95cb8f (patch)
tree6baba5e4eb1d274c85b03c6c1e036643a0bfb84f
parent6f1be4493a558e8dabdc981b37852a2008f7bef1 (diff)
downloadart-414369a2e3f23e1408fc1cbf4f623014bd95cb8f.tar.gz
art-414369a2e3f23e1408fc1cbf4f623014bd95cb8f.tar.bz2
art-414369a2e3f23e1408fc1cbf4f623014bd95cb8f.zip
Add some more DISALLOW_COPY_AND_ASSIGN
May help prevent bugs maybe. (cherry picked from commit 3130cdf29eb203be0c38d1107a65d920ec39c106) Change-Id: Ie73d469dfcd078492ecb3aa28682b42707221202
-rw-r--r--compiler/jit/jit_compiler.h3
-rw-r--r--runtime/gc/accounting/bitmap.h4
-rw-r--r--runtime/gc/accounting/card_table.h2
-rw-r--r--runtime/gc/collector/concurrent_copying.h2
-rw-r--r--runtime/gc/collector/garbage_collector.h3
-rw-r--r--runtime/gc/collector/mark_compact.h2
-rw-r--r--runtime/gc/collector/mark_sweep.h2
-rw-r--r--runtime/gc/collector/partial_mark_sweep.h2
-rw-r--r--runtime/gc/collector/semi_space.h2
-rw-r--r--runtime/gc/collector/sticky_mark_sweep.h2
-rw-r--r--runtime/gc/heap-inl.h7
-rw-r--r--runtime/gc/heap.h32
-rw-r--r--runtime/gc/reference_processor.h5
-rw-r--r--runtime/gc/reference_queue.h2
-rw-r--r--runtime/gc/space/space.h10
-rw-r--r--runtime/gc/task_processor.h3
-rw-r--r--runtime/jit/jit.h7
-rw-r--r--runtime/jit/jit_code_cache.h2
-rw-r--r--runtime/jit/jit_instrumentation.cc2
-rw-r--r--runtime/jit/jit_instrumentation.h4
-rw-r--r--runtime/linear_alloc.h2
21 files changed, 53 insertions, 47 deletions
diff --git a/compiler/jit/jit_compiler.h b/compiler/jit/jit_compiler.h
index 08764991e..d9a5ac63b 100644
--- a/compiler/jit/jit_compiler.h
+++ b/compiler/jit/jit_compiler.h
@@ -67,10 +67,11 @@ class JitCompiler {
const uint8_t* mapping_table, const uint8_t* vmap_table, const uint8_t* gc_map);
bool MakeExecutable(CompiledMethod* compiled_method, mirror::ArtMethod* method)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+ DISALLOW_COPY_AND_ASSIGN(JitCompiler);
};
} // namespace jit
-
} // namespace art
#endif // ART_COMPILER_JIT_JIT_COMPILER_H_
diff --git a/runtime/gc/accounting/bitmap.h b/runtime/gc/accounting/bitmap.h
index b294d4932..eb004726d 100644
--- a/runtime/gc/accounting/bitmap.h
+++ b/runtime/gc/accounting/bitmap.h
@@ -121,7 +121,7 @@ class Bitmap {
const size_t bitmap_size_;
private:
- DISALLOW_COPY_AND_ASSIGN(Bitmap);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Bitmap);
};
// One bit per kAlignment in range (start, end]
@@ -184,6 +184,8 @@ class MemoryRangeBitmap : public Bitmap {
uintptr_t const cover_begin_;
uintptr_t const cover_end_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryRangeBitmap);
};
} // namespace accounting
diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h
index 75ef58a21..34e6aa31f 100644
--- a/runtime/gc/accounting/card_table.h
+++ b/runtime/gc/accounting/card_table.h
@@ -146,6 +146,8 @@ class CardTable {
// Card table doesn't begin at the beginning of the mem_map_, instead it is displaced by offset
// to allow the byte value of biased_begin_ to equal GC_CARD_DIRTY
const size_t offset_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(CardTable);
};
} // namespace accounting
diff --git a/runtime/gc/collector/concurrent_copying.h b/runtime/gc/collector/concurrent_copying.h
index 93de03594..60ea6b644 100644
--- a/runtime/gc/collector/concurrent_copying.h
+++ b/runtime/gc/collector/concurrent_copying.h
@@ -279,7 +279,7 @@ class ConcurrentCopying : public GarbageCollector {
friend class FlipCallback;
friend class ConcurrentCopyingComputeUnevacFromSpaceLiveRatioVisitor;
- DISALLOW_COPY_AND_ASSIGN(ConcurrentCopying);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ConcurrentCopying);
};
} // namespace collector
diff --git a/runtime/gc/collector/garbage_collector.h b/runtime/gc/collector/garbage_collector.h
index c5a8d5d98..9b76d1aee 100644
--- a/runtime/gc/collector/garbage_collector.h
+++ b/runtime/gc/collector/garbage_collector.h
@@ -190,6 +190,9 @@ class GarbageCollector : public RootVisitor {
int64_t total_freed_bytes_;
CumulativeLogger cumulative_timings_;
mutable Mutex pause_histogram_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(GarbageCollector);
};
} // namespace collector
diff --git a/runtime/gc/collector/mark_compact.h b/runtime/gc/collector/mark_compact.h
index 43376441e..f59a2cd93 100644
--- a/runtime/gc/collector/mark_compact.h
+++ b/runtime/gc/collector/mark_compact.h
@@ -251,7 +251,7 @@ class MarkCompact : public GarbageCollector {
friend class UpdateReferenceVisitor;
friend class UpdateRootVisitor;
- DISALLOW_COPY_AND_ASSIGN(MarkCompact);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MarkCompact);
};
} // namespace collector
diff --git a/runtime/gc/collector/mark_sweep.h b/runtime/gc/collector/mark_sweep.h
index fad340343..7e1af7b5d 100644
--- a/runtime/gc/collector/mark_sweep.h
+++ b/runtime/gc/collector/mark_sweep.h
@@ -336,7 +336,7 @@ class MarkSweep : public GarbageCollector {
friend class VerifyRootMarkedVisitor;
friend class VerifyRootVisitor;
- DISALLOW_COPY_AND_ASSIGN(MarkSweep);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MarkSweep);
};
} // namespace collector
diff --git a/runtime/gc/collector/partial_mark_sweep.h b/runtime/gc/collector/partial_mark_sweep.h
index ac0d06819..1a211cd3b 100644
--- a/runtime/gc/collector/partial_mark_sweep.h
+++ b/runtime/gc/collector/partial_mark_sweep.h
@@ -40,7 +40,7 @@ class PartialMarkSweep : public MarkSweep {
virtual void BindBitmaps() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
private:
- DISALLOW_COPY_AND_ASSIGN(PartialMarkSweep);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PartialMarkSweep);
};
} // namespace collector
diff --git a/runtime/gc/collector/semi_space.h b/runtime/gc/collector/semi_space.h
index 61fbeade8..3c25f539f 100644
--- a/runtime/gc/collector/semi_space.h
+++ b/runtime/gc/collector/semi_space.h
@@ -278,7 +278,7 @@ class SemiSpace : public GarbageCollector {
private:
friend class BitmapSetSlowPathVisitor;
- DISALLOW_COPY_AND_ASSIGN(SemiSpace);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SemiSpace);
};
} // namespace collector
diff --git a/runtime/gc/collector/sticky_mark_sweep.h b/runtime/gc/collector/sticky_mark_sweep.h
index 4f9dabf6a..b9ef137e8 100644
--- a/runtime/gc/collector/sticky_mark_sweep.h
+++ b/runtime/gc/collector/sticky_mark_sweep.h
@@ -47,7 +47,7 @@ class StickyMarkSweep FINAL : public PartialMarkSweep {
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
private:
- DISALLOW_COPY_AND_ASSIGN(StickyMarkSweep);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StickyMarkSweep);
};
} // namespace collector
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index 3e5620544..9b5d57762 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -371,11 +371,8 @@ inline mirror::Object* Heap::TryToAllocate(Thread* self, AllocatorType allocator
}
inline Heap::AllocationTimer::AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr)
- : heap_(heap), allocated_obj_ptr_(allocated_obj_ptr) {
- if (kMeasureAllocationTime) {
- allocation_start_time_ = NanoTime() / kTimeAdjust;
- }
-}
+ : heap_(heap), allocated_obj_ptr_(allocated_obj_ptr),
+ allocation_start_time_(kMeasureAllocationTime ? NanoTime() / kTimeAdjust : 0u) { }
inline Heap::AllocationTimer::~AllocationTimer() {
if (kMeasureAllocationTime) {
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 565687c5b..2ce2b3a54 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -1201,41 +1201,23 @@ class Heap {
friend class VerifyReferenceVisitor;
friend class VerifyObjectVisitor;
friend class ScopedHeapFill;
- friend class ScopedHeapLock;
friend class space::SpaceTest;
class AllocationTimer {
+ public:
+ ALWAYS_INLINE AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr);
+ ALWAYS_INLINE ~AllocationTimer();
private:
- Heap* heap_;
+ Heap* const heap_;
mirror::Object** allocated_obj_ptr_;
- uint64_t allocation_start_time_;
- public:
- AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr);
- ~AllocationTimer();
+ const uint64_t allocation_start_time_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationTimer);
};
DISALLOW_IMPLICIT_CONSTRUCTORS(Heap);
};
-// ScopedHeapFill changes the bytes allocated counter to be equal to the growth limit. This
-// causes the next allocation to perform a GC and possibly an OOM. It can be used to ensure that a
-// GC happens in specific methods such as ThrowIllegalMonitorStateExceptionF in Monitor::Wait.
-class ScopedHeapFill {
- public:
- explicit ScopedHeapFill(Heap* heap)
- : heap_(heap),
- delta_(heap_->GetMaxMemory() - heap_->GetBytesAllocated()) {
- heap_->num_bytes_allocated_.FetchAndAddSequentiallyConsistent(delta_);
- }
- ~ScopedHeapFill() {
- heap_->num_bytes_allocated_.FetchAndSubSequentiallyConsistent(delta_);
- }
-
- private:
- Heap* const heap_;
- const int64_t delta_;
-};
-
} // namespace gc
} // namespace art
diff --git a/runtime/gc/reference_processor.h b/runtime/gc/reference_processor.h
index c67fd9803..a44319ba5 100644
--- a/runtime/gc/reference_processor.h
+++ b/runtime/gc/reference_processor.h
@@ -81,6 +81,9 @@ class ReferenceProcessor {
IsHeapReferenceMarkedCallback* is_marked_callback_;
MarkObjectCallback* mark_callback_;
void* arg_;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessReferencesArgs);
};
bool SlowPathEnabled() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Called by ProcessReferences.
@@ -105,6 +108,8 @@ class ReferenceProcessor {
ReferenceQueue finalizer_reference_queue_;
ReferenceQueue phantom_reference_queue_;
ReferenceQueue cleared_references_;
+
+ DISALLOW_COPY_AND_ASSIGN(ReferenceProcessor);
};
} // namespace gc
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h
index f7d89d054..c45be8591 100644
--- a/runtime/gc/reference_queue.h
+++ b/runtime/gc/reference_queue.h
@@ -106,7 +106,7 @@ class ReferenceQueue {
// GC types.
mirror::Reference* list_;
- DISALLOW_COPY_AND_ASSIGN(ReferenceQueue);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ReferenceQueue);
};
} // namespace gc
diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h
index f2378d9ff..871ebac8a 100644
--- a/runtime/gc/space/space.h
+++ b/runtime/gc/space/space.h
@@ -187,7 +187,7 @@ class Space {
private:
friend class art::gc::Heap;
- DISALLOW_COPY_AND_ASSIGN(Space);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Space);
};
std::ostream& operator<<(std::ostream& os, const Space& space);
@@ -337,7 +337,7 @@ class ContinuousSpace : public Space {
uint8_t* limit_;
private:
- DISALLOW_COPY_AND_ASSIGN(ContinuousSpace);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ContinuousSpace);
};
// A space where objects may be allocated higgledy-piggledy throughout virtual memory. Currently
@@ -366,7 +366,7 @@ class DiscontinuousSpace : public Space {
std::unique_ptr<accounting::LargeObjectBitmap> mark_bitmap_;
private:
- DISALLOW_COPY_AND_ASSIGN(DiscontinuousSpace);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DiscontinuousSpace);
};
class MemMapSpace : public ContinuousSpace {
@@ -400,7 +400,7 @@ class MemMapSpace : public ContinuousSpace {
std::unique_ptr<MemMap> mem_map_;
private:
- DISALLOW_COPY_AND_ASSIGN(MemMapSpace);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MemMapSpace);
};
// Used by the heap compaction interface to enable copying from one type of alloc space to another.
@@ -453,7 +453,7 @@ class ContinuousMemMapAllocSpace : public MemMapSpace, public AllocSpace {
private:
friend class gc::Heap;
- DISALLOW_COPY_AND_ASSIGN(ContinuousMemMapAllocSpace);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ContinuousMemMapAllocSpace);
};
} // namespace space
diff --git a/runtime/gc/task_processor.h b/runtime/gc/task_processor.h
index 67e3a549a..5f486192f 100644
--- a/runtime/gc/task_processor.h
+++ b/runtime/gc/task_processor.h
@@ -46,6 +46,7 @@ class HeapTask : public SelfDeletingTask {
uint64_t target_run_time_;
friend class TaskProcessor;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(HeapTask);
};
// Used to process GC tasks (heap trim, heap transitions, concurrent GC).
@@ -78,6 +79,8 @@ class TaskProcessor {
std::unique_ptr<ConditionVariable> cond_ GUARDED_BY(lock_);
std::multiset<HeapTask*, CompareByTargetRunTime> tasks_ GUARDED_BY(lock_);
Thread* running_thread_ GUARDED_BY(lock_);
+
+ DISALLOW_COPY_AND_ASSIGN(TaskProcessor);
};
} // namespace gc
diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h
index 3e80aef4c..f5ad8b837 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -86,6 +86,8 @@ class Jit {
std::unique_ptr<jit::JitInstrumentationCache> instrumentation_cache_;
std::unique_ptr<jit::JitCodeCache> code_cache_;
CompilerCallbacks* compiler_callbacks_; // Owned by the jit compiler.
+
+ DISALLOW_COPY_AND_ASSIGN(Jit);
};
class JitOptions {
@@ -114,8 +116,9 @@ class JitOptions {
bool dump_info_on_shutdown_;
JitOptions() : use_jit_(false), code_cache_capacity_(0), compile_threshold_(0),
- dump_info_on_shutdown_(false) {
- }
+ dump_info_on_shutdown_(false) { }
+
+ DISALLOW_COPY_AND_ASSIGN(JitOptions);
};
} // namespace jit
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index da891fed7..8b7664716 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -130,7 +130,7 @@ class JitCodeCache {
// required since we have to implement ClassLinker::GetQuickOatCodeFor for walking stacks.
SafeMap<mirror::ArtMethod*, const void*> method_code_map_ GUARDED_BY(lock_);
- DISALLOW_COPY_AND_ASSIGN(JitCodeCache);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JitCodeCache);
};
diff --git a/runtime/jit/jit_instrumentation.cc b/runtime/jit/jit_instrumentation.cc
index 160e6789b..e2f9cec2c 100644
--- a/runtime/jit/jit_instrumentation.cc
+++ b/runtime/jit/jit_instrumentation.cc
@@ -47,6 +47,8 @@ class JitCompileTask : public Task {
private:
mirror::ArtMethod* const method_;
JitInstrumentationCache* const cache_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JitCompileTask);
};
JitInstrumentationCache::JitInstrumentationCache(size_t hot_method_threshold)
diff --git a/runtime/jit/jit_instrumentation.h b/runtime/jit/jit_instrumentation.h
index 9d5d74f3f..72acaef2a 100644
--- a/runtime/jit/jit_instrumentation.h
+++ b/runtime/jit/jit_instrumentation.h
@@ -58,6 +58,8 @@ class JitInstrumentationCache {
std::unordered_map<jmethodID, size_t> samples_;
size_t hot_method_threshold_;
std::unique_ptr<ThreadPool> thread_pool_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JitInstrumentationCache);
};
class JitInstrumentationListener : public instrumentation::InstrumentationListener {
@@ -97,6 +99,8 @@ class JitInstrumentationListener : public instrumentation::InstrumentationListen
private:
JitInstrumentationCache* const instrumentation_cache_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JitInstrumentationListener);
};
} // namespace jit
diff --git a/runtime/linear_alloc.h b/runtime/linear_alloc.h
index 6d8eda649..fcabcc803 100644
--- a/runtime/linear_alloc.h
+++ b/runtime/linear_alloc.h
@@ -42,6 +42,8 @@ class LinearAlloc {
private:
mutable Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
ArenaAllocator allocator_ GUARDED_BY(lock_);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(LinearAlloc);
};
} // namespace art