--- old/src/hotspot/os/aix/os_perf_aix.cpp 2019-12-01 18:04:35.641158446 -0500 +++ new/src/hotspot/os/aix/os_perf_aix.cpp 2019-12-01 18:04:35.397145372 -0500 @@ -28,6 +28,7 @@ #include "os_aix.inline.hpp" #include "runtime/os.hpp" #include "runtime/os_perf.hpp" +#include "utilities/macros.hpp" #include CPU_HEADER(vm_version_ext) @@ -884,8 +885,7 @@ friend class NetworkPerformanceInterface; private: NetworkPerformance(); - NetworkPerformance(const NetworkPerformance& rhs); // no impl - NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl + NONCOPYABLE(NetworkPerformance); bool initialize(); ~NetworkPerformance(); int network_utilization(NetworkInterface** network_interfaces) const; --- old/src/hotspot/os/bsd/os_perf_bsd.cpp 2019-12-01 18:04:36.645212243 -0500 +++ new/src/hotspot/os/bsd/os_perf_bsd.cpp 2019-12-01 18:04:36.393198740 -0500 @@ -26,6 +26,7 @@ #include "memory/resourceArea.hpp" #include "runtime/os.hpp" #include "runtime/os_perf.hpp" +#include "utilities/macros.hpp" #include CPU_HEADER(vm_version_ext) #ifdef __APPLE__ @@ -72,8 +73,8 @@ int cpu_load_total_process(double* cpu_load); int cpu_loads_process(double* pjvmUserLoad, double* pjvmKernelLoad, double* psystemTotalLoad); - CPUPerformance(const CPUPerformance& rhs); // no impl - CPUPerformance& operator=(const CPUPerformance& rhs); // no impl + NONCOPYABLE(CPUPerformance); + public: CPUPerformance(); bool initialize(); @@ -264,8 +265,7 @@ private: SystemProcesses(); bool initialize(); - SystemProcesses(const SystemProcesses& rhs); // no impl - SystemProcesses& operator=(const SystemProcesses& rhs); // no impl + NONCOPYABLE(SystemProcesses); ~SystemProcesses(); //information about system processes @@ -407,8 +407,7 @@ friend class NetworkPerformanceInterface; private: NetworkPerformance(); - NetworkPerformance(const NetworkPerformance& rhs); // no impl - NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl + NONCOPYABLE(NetworkPerformance); bool initialize(); ~NetworkPerformance(); int network_utilization(NetworkInterface** network_interfaces) const; --- old/src/hotspot/os/bsd/semaphore_bsd.hpp 2019-12-01 18:04:37.645265827 -0500 +++ new/src/hotspot/os/bsd/semaphore_bsd.hpp 2019-12-01 18:04:37.397252538 -0500 @@ -25,6 +25,8 @@ #ifndef OS_BSD_SEMAPHORE_BSD_HPP #define OS_BSD_SEMAPHORE_BSD_HPP +#include "utilities/macros.hpp" + #ifndef __APPLE__ // Use POSIX semaphores. # include "semaphore_posix.hpp" @@ -37,9 +39,7 @@ class OSXSemaphore : public CHeapObj{ semaphore_t _semaphore; - // Prevent copying and assignment. - OSXSemaphore(const OSXSemaphore&); - OSXSemaphore& operator=(const OSXSemaphore&); + NONCOPYABLE(OSXSemaphore); public: OSXSemaphore(uint value = 0); --- old/src/hotspot/os/linux/os_perf_linux.cpp 2019-12-01 18:04:38.625318338 -0500 +++ new/src/hotspot/os/linux/os_perf_linux.cpp 2019-12-01 18:04:38.373304835 -0500 @@ -28,6 +28,7 @@ #include "os_linux.inline.hpp" #include "runtime/os.hpp" #include "runtime/os_perf.hpp" +#include "utilities/macros.hpp" #include CPU_HEADER(vm_version_ext) @@ -948,8 +949,7 @@ friend class NetworkPerformanceInterface; private: NetworkPerformance(); - NetworkPerformance(const NetworkPerformance& rhs); // no impl - NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl + NONCOPYABLE(NetworkPerformance); bool initialize(); ~NetworkPerformance(); int64_t read_counter(const char* iface, const char* counter) const; --- old/src/hotspot/os/linux/waitBarrier_linux.hpp 2019-12-01 18:04:39.613371278 -0500 +++ new/src/hotspot/os/linux/waitBarrier_linux.hpp 2019-12-01 18:04:39.361357775 -0500 @@ -26,13 +26,12 @@ #define OS_LINUX_WAITBARRIER_LINUX_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" class LinuxWaitBarrier : public CHeapObj { volatile int _futex_barrier; - // Prevent copying and assignment of LinuxWaitBarrier instances. - LinuxWaitBarrier(const LinuxWaitBarrier&); - LinuxWaitBarrier& operator=(const LinuxWaitBarrier&); + NONCOPYABLE(LinuxWaitBarrier); public: LinuxWaitBarrier() : _futex_barrier(0) {}; --- old/src/hotspot/os/posix/os_posix.hpp 2019-12-01 18:04:40.593423790 -0500 +++ new/src/hotspot/os/posix/os_posix.hpp 2019-12-01 18:04:40.341410287 -0500 @@ -285,10 +285,8 @@ #endif // PLATFORM_MONITOR_IMPL_INDIRECT -private: - // Disable copying - PlatformMutex(const PlatformMutex&); - PlatformMutex& operator=(const PlatformMutex&); + private: + NONCOPYABLE(PlatformMutex); public: void lock(); @@ -329,9 +327,7 @@ #endif // PLATFORM_MONITOR_IMPL_INDIRECT private: - // Disable copying - PlatformMonitor(const PlatformMonitor&); - PlatformMonitor& operator=(const PlatformMonitor&); + NONCOPYABLE(PlatformMonitor); public: int wait(jlong millis); --- old/src/hotspot/os/posix/semaphore_posix.hpp 2019-12-01 18:04:41.565475873 -0500 +++ new/src/hotspot/os/posix/semaphore_posix.hpp 2019-12-01 18:04:41.321462799 -0500 @@ -26,15 +26,14 @@ #define OS_POSIX_SEMAPHORE_POSIX_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" #include class PosixSemaphore : public CHeapObj { sem_t _semaphore; - // Prevent copying and assignment. - PosixSemaphore(const PosixSemaphore&); - PosixSemaphore& operator=(const PosixSemaphore&); + NONCOPYABLE(PosixSemaphore); public: PosixSemaphore(uint value = 0); --- old/src/hotspot/os/solaris/os_perf_solaris.cpp 2019-12-01 18:04:42.497525813 -0500 +++ new/src/hotspot/os/solaris/os_perf_solaris.cpp 2019-12-01 18:04:42.261513167 -0500 @@ -737,8 +737,7 @@ friend class NetworkPerformanceInterface; private: NetworkPerformance(); - NetworkPerformance(const NetworkPerformance& rhs); // no impl - NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl + NONCOPYABLE(NetworkPerformance); bool initialize(); ~NetworkPerformance(); int network_utilization(NetworkInterface** network_interfaces) const; --- old/src/hotspot/os/solaris/os_solaris.hpp 2019-12-01 18:04:43.425575538 -0500 +++ new/src/hotspot/os/solaris/os_solaris.hpp 2019-12-01 18:04:43.185562678 -0500 @@ -334,9 +334,7 @@ // Platform specific implementations that underpin VM Mutex/Monitor classes class PlatformMutex : public CHeapObj { - // Disable copying - PlatformMutex(const PlatformMutex&); - PlatformMutex& operator=(const PlatformMutex&); + NONCOPYABLE(PlatformMutex); protected: mutex_t _mutex; // Native mutex for locking @@ -352,9 +350,8 @@ class PlatformMonitor : public PlatformMutex { private: cond_t _cond; // Native condition variable for blocking - // Disable copying - PlatformMonitor(const PlatformMonitor&); - PlatformMonitor& operator=(const PlatformMonitor&); + + NONCOPYABLE(PlatformMonitor); public: PlatformMonitor(); --- old/src/hotspot/os/windows/os_perf_windows.cpp 2019-12-01 18:04:44.389627193 -0500 +++ new/src/hotspot/os/windows/os_perf_windows.cpp 2019-12-01 18:04:44.141613904 -0500 @@ -1355,8 +1355,7 @@ bool _iphlp_attached; NetworkPerformance(); - NetworkPerformance(const NetworkPerformance& rhs); // no impl - NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl + NONCOPYABLE(NetworkPerformance); bool initialize(); ~NetworkPerformance(); int network_utilization(NetworkInterface** network_interfaces) const; --- old/src/hotspot/os/windows/os_windows.hpp 2019-12-01 18:04:45.401681419 -0500 +++ new/src/hotspot/os/windows/os_windows.hpp 2019-12-01 18:04:45.149667916 -0500 @@ -190,9 +190,7 @@ // Platform specific implementations that underpin VM Mutex/Monitor classes class PlatformMutex : public CHeapObj { - // Disable copying - PlatformMutex(const PlatformMutex&); - PlatformMutex& operator=(const PlatformMutex&); + NONCOPYABLE(PlatformMutex); protected: CRITICAL_SECTION _mutex; // Native mutex for locking @@ -208,9 +206,7 @@ class PlatformMonitor : public PlatformMutex { private: CONDITION_VARIABLE _cond; // Native condition variable for blocking - // Disable copying - PlatformMonitor(const PlatformMonitor&); - PlatformMonitor& operator=(const PlatformMonitor&); + NONCOPYABLE(PlatformMonitor); public: PlatformMonitor(); --- old/src/hotspot/os/windows/semaphore_windows.hpp 2019-12-01 18:04:46.369733288 -0500 +++ new/src/hotspot/os/windows/semaphore_windows.hpp 2019-12-01 18:04:46.117719785 -0500 @@ -26,15 +26,14 @@ #define OS_WINDOWS_SEMAPHORE_WINDOWS_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" #include class WindowsSemaphore : public CHeapObj { HANDLE _semaphore; - // Prevent copying and assignment. - WindowsSemaphore(const WindowsSemaphore&); - WindowsSemaphore& operator=(const WindowsSemaphore&); + NONCOPYABLE(WindowsSemaphore); public: WindowsSemaphore(uint value = 0); --- old/src/hotspot/share/gc/g1/g1FreeIdSet.hpp 2019-12-01 18:04:47.293782799 -0500 +++ new/src/hotspot/share/gc/g1/g1FreeIdSet.hpp 2019-12-01 18:04:47.041769296 -0500 @@ -27,6 +27,7 @@ #include "runtime/semaphore.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" // Represents a set of small integer ids, from which elements can be // temporarily allocated for exclusive use. The ids are in a @@ -44,9 +45,7 @@ uint head_index(uintx head) const; uintx make_head(uint index, uintx old_head) const; - // Noncopyable. - G1FreeIdSet(const G1FreeIdSet&); - G1FreeIdSet& operator=(const G1FreeIdSet&); + NONCOPYABLE(G1FreeIdSet); public: G1FreeIdSet(uint start, uint size); --- old/src/hotspot/share/gc/g1/g1SharedDirtyCardQueue.hpp 2019-12-01 18:04:48.241833596 -0500 +++ new/src/hotspot/share/gc/g1/g1SharedDirtyCardQueue.hpp 2019-12-01 18:04:48.001820736 -0500 @@ -26,6 +26,7 @@ #define SHARE_GC_G1_G1SHAREDDIRTYCARDQUEUE_HPP #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" class G1DirtyCardQueueSet; @@ -37,9 +38,7 @@ void** _buffer; size_t _index; - // Noncopyable - G1SharedDirtyCardQueue(const G1SharedDirtyCardQueue&); - G1SharedDirtyCardQueue& operator=(const G1SharedDirtyCardQueue&); + NONCOPYABLE(G1SharedDirtyCardQueue); public: G1SharedDirtyCardQueue(G1DirtyCardQueueSet* qset); --- old/src/hotspot/share/gc/shared/oopStorage.hpp 2019-12-01 18:04:49.189884394 -0500 +++ new/src/hotspot/share/gc/shared/oopStorage.hpp 2019-12-01 18:04:48.941871105 -0500 @@ -193,9 +193,7 @@ const Block* _head; const Block* _tail; - // Noncopyable. - AllocationList(const AllocationList&); - AllocationList& operator=(const AllocationList&); + NONCOPYABLE(AllocationList); public: AllocationList(); --- old/src/hotspot/share/gc/shared/oopStorage.inline.hpp 2019-12-01 18:04:50.157936263 -0500 +++ new/src/hotspot/share/gc/shared/oopStorage.inline.hpp 2019-12-01 18:04:49.905922759 -0500 @@ -34,6 +34,7 @@ #include "utilities/count_trailing_zeros.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" // Array of all active blocks. Refcounted for lock-free reclaim of // old array when a new array is allocated for expansion. @@ -48,9 +49,7 @@ ActiveArray(size_t size); ~ActiveArray(); - // Noncopyable - ActiveArray(const ActiveArray&); - ActiveArray& operator=(const ActiveArray&); + NONCOPYABLE(ActiveArray); static size_t blocks_offset(); Block* const* base_ptr() const; @@ -118,9 +117,7 @@ mutable const Block* _prev; mutable const Block* _next; - // Noncopyable. - AllocationListEntry(const AllocationListEntry&); - AllocationListEntry& operator=(const AllocationListEntry&); + NONCOPYABLE(AllocationListEntry); public: AllocationListEntry(); @@ -153,9 +150,7 @@ template static bool iterate_impl(F f, BlockPtr b); - // Noncopyable. - Block(const Block&); - Block& operator=(const Block&); + NONCOPYABLE(Block); public: const AllocationListEntry& allocation_list_entry() const; --- old/src/hotspot/share/gc/shared/oopStorageParState.hpp 2019-12-01 18:04:51.125988132 -0500 +++ new/src/hotspot/share/gc/shared/oopStorageParState.hpp 2019-12-01 18:04:50.873974628 -0500 @@ -134,9 +134,7 @@ uint _estimated_thread_count; bool _concurrent; - // Noncopyable. - BasicParState(const BasicParState&); - BasicParState& operator=(const BasicParState&); + NONCOPYABLE(BasicParState); struct IterationData; --- old/src/hotspot/share/gc/shared/ptrQueue.hpp 2019-12-01 18:04:52.082039358 -0500 +++ new/src/hotspot/share/gc/shared/ptrQueue.hpp 2019-12-01 18:04:51.834026069 -0500 @@ -29,6 +29,7 @@ #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/lockFreeStack.hpp" +#include "utilities/macros.hpp" #include "utilities/sizes.hpp" class Mutex; @@ -44,9 +45,7 @@ class PtrQueue { friend class VMStructs; - // Noncopyable - not defined. - PtrQueue(const PtrQueue&); - PtrQueue& operator=(const PtrQueue&); + NONCOPYABLE(PtrQueue); // The ptr queue set to which this queue belongs. PtrQueueSet* const _qset; @@ -205,6 +204,8 @@ BufferNode() : _index(0), _next(NULL) { } ~BufferNode() { } + NONCOPYABLE(BufferNode); + static size_t buffer_offset() { return offset_of(BufferNode, _buffer); } @@ -273,6 +274,8 @@ void delete_list(BufferNode* list); bool try_transfer_pending(); + NONCOPYABLE(Allocator); + public: Allocator(const char* name, size_t buffer_size); ~Allocator(); @@ -295,9 +298,7 @@ class PtrQueueSet { BufferNode::Allocator* _allocator; - // Noncopyable - not defined. - PtrQueueSet(const PtrQueueSet&); - PtrQueueSet& operator=(const PtrQueueSet&); + NONCOPYABLE(PtrQueueSet); protected: bool _all_active; --- old/src/hotspot/share/gc/shared/taskqueue.hpp 2019-12-01 18:04:53.054091441 -0500 +++ new/src/hotspot/share/gc/shared/taskqueue.hpp 2019-12-01 18:04:52.802077938 -0500 @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" #include "memory/padded.hpp" #include "oops/oopsHierarchy.hpp" +#include "utilities/macros.hpp" #include "utilities/ostream.hpp" #include "utilities/stack.hpp" @@ -514,9 +515,8 @@ private: ParallelTaskTerminator* _terminator; - // Noncopyable. - TaskTerminator(const TaskTerminator&); - TaskTerminator& operator=(const TaskTerminator&); + NONCOPYABLE(TaskTerminator); + public: TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set); ~TaskTerminator(); --- old/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp 2019-12-01 18:04:54.050144810 -0500 +++ new/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp 2019-12-01 18:04:53.786130664 -0500 @@ -29,6 +29,7 @@ #include "gc/shenandoah/shenandoahLock.hpp" #include "memory/allocation.hpp" #include "memory/iterator.hpp" +#include "utilities/macros.hpp" class ShenandoahHeap; class ShenandoahHeapRegion; @@ -52,10 +53,8 @@ ShenandoahParallelCodeHeapIterator* _iters; int _length; -private: - // Noncopyable. - ShenandoahParallelCodeCacheIterator(const ShenandoahParallelCodeCacheIterator& o); - ShenandoahParallelCodeCacheIterator& operator=(const ShenandoahParallelCodeCacheIterator& o); + NONCOPYABLE(ShenandoahParallelCodeCacheIterator); + public: ShenandoahParallelCodeCacheIterator(const GrowableArray* heaps); ~ShenandoahParallelCodeCacheIterator(); --- old/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp 2019-12-01 18:04:55.010196251 -0500 +++ new/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp 2019-12-01 18:04:54.762182962 -0500 @@ -33,6 +33,7 @@ #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" #include "gc/shenandoah/shenandoahSharedVariables.hpp" #include "services/memoryManager.hpp" +#include "utilities/macros.hpp" class ConcurrentGCTimer; class ReferenceProcessor; @@ -69,8 +70,7 @@ DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0); // No implicit copying: iterators should be passed by reference to capture the state - ShenandoahRegionIterator(const ShenandoahRegionIterator& that); - ShenandoahRegionIterator& operator=(const ShenandoahRegionIterator& o); + NONCOPYABLE(ShenandoahRegionIterator); public: ShenandoahRegionIterator(); --- old/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.hpp 2019-12-01 18:04:55.978248120 -0500 +++ new/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.hpp 2019-12-01 18:04:55.726234617 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" +#include "utilities/macros.hpp" class ShenandoahHeapRegionSet; @@ -40,8 +41,7 @@ DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0); // No implicit copying: iterators should be passed by reference to capture the state - ShenandoahHeapRegionSetIterator(const ShenandoahHeapRegionSetIterator& that); - ShenandoahHeapRegionSetIterator& operator=(const ShenandoahHeapRegionSetIterator& o); + NONCOPYABLE(ShenandoahHeapRegionSetIterator); public: ShenandoahHeapRegionSetIterator(const ShenandoahHeapRegionSet* const set); --- old/src/hotspot/share/gc/z/zArray.hpp 2019-12-01 18:04:56.950300204 -0500 +++ new/src/hotspot/share/gc/z/zArray.hpp 2019-12-01 18:04:56.694286486 -0500 @@ -25,6 +25,7 @@ #define SHARE_GC_Z_ZARRAY_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" template class ZArray { @@ -35,9 +36,7 @@ size_t _size; size_t _capacity; - // Copy and assignment are not allowed - ZArray(const ZArray& array); - ZArray& operator=(const ZArray& array); + NONCOPYABLE(ZArray); void expand(size_t new_capacity); --- old/src/hotspot/share/gc/z/zList.hpp 2019-12-01 18:04:57.882350144 -0500 +++ new/src/hotspot/share/gc/z/zList.hpp 2019-12-01 18:04:57.642337284 -0500 @@ -25,6 +25,7 @@ #define SHARE_GC_Z_ZLIST_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" template class ZList; @@ -55,9 +56,7 @@ ZListNode _head; size_t _size; - // Passing by value and assignment is not allowed - ZList(const ZList& list); - ZList& operator=(const ZList& list); + NONCOPYABLE(ZList); void verify() const; --- old/src/hotspot/share/jfr/jni/jfrJavaCall.hpp 2019-12-01 18:04:58.822400513 -0500 +++ new/src/hotspot/share/jfr/jni/jfrJavaCall.hpp 2019-12-01 18:04:58.574387224 -0500 @@ -28,6 +28,7 @@ #include "jni.h" #include "jfr/utilities/jfrAllocation.hpp" #include "utilities/exceptions.hpp" +#include "utilities/macros.hpp" class JavaCallArguments; class JavaThread; @@ -86,8 +87,7 @@ int _java_stack_slots; Parameters(); - Parameters(const Parameters&); // no impl - Parameters& operator=(const Parameters&); // no impl + NONCOPYABLE(Parameters); void push(const JavaValue& value); void push_large(const JavaValue& value); --- old/src/hotspot/share/memory/metaspaceClosure.hpp 2019-12-01 18:04:59.762450882 -0500 +++ new/src/hotspot/share/memory/metaspaceClosure.hpp 2019-12-01 18:04:59.514437593 -0500 @@ -30,6 +30,7 @@ #include "oops/array.hpp" #include "utilities/growableArray.hpp" #include "utilities/hashtable.inline.hpp" +#include "utilities/macros.hpp" // The metadata hierarchy is separate from the oop hierarchy class MetaspaceObj; // no C++ vtable @@ -108,9 +109,8 @@ class Ref : public CHeapObj { Writability _writability; Ref* _next; - // Noncopyable. - Ref(const Ref&); - Ref& operator=(const Ref&); + NONCOPYABLE(Ref); + protected: virtual void** mpp() const = 0; Ref(Writability w) : _writability(w), _next(NULL) {} --- old/src/hotspot/share/oops/array.hpp 2019-12-01 18:05:00.734502966 -0500 +++ new/src/hotspot/share/oops/array.hpp 2019-12-01 18:05:00.486489677 -0500 @@ -29,6 +29,7 @@ #include "memory/metaspace.hpp" #include "runtime/atomic.hpp" #include "utilities/align.hpp" +#include "utilities/macros.hpp" // Array for metadata allocation @@ -49,9 +50,7 @@ } private: - // Turn off copy constructor and assignment operator. - Array(const Array&); - void operator=(const Array&); + NONCOPYABLE(Array); void* operator new(size_t size, ClassLoaderData* loader_data, int length, TRAPS) throw() { size_t word_size = Array::size(length); --- old/src/hotspot/share/runtime/os_perf.hpp 2019-12-01 18:05:01.694554406 -0500 +++ new/src/hotspot/share/runtime/os_perf.hpp 2019-12-01 18:05:01.454541546 -0500 @@ -190,9 +190,8 @@ uint64_t _bytes_out; NetworkInterface* _next; - NetworkInterface(); // no impl - NetworkInterface(const NetworkInterface& rhs); // no impl - NetworkInterface& operator=(const NetworkInterface& rhs); // no impl + NONCOPYABLE(NetworkInterface); + public: NetworkInterface(const char* name, uint64_t bytes_in, uint64_t bytes_out, NetworkInterface* next) : _name(NULL), @@ -268,8 +267,8 @@ private: class NetworkPerformance; NetworkPerformance* _impl; - NetworkPerformanceInterface(const NetworkPerformanceInterface& rhs); // no impl - NetworkPerformanceInterface& operator=(const NetworkPerformanceInterface& rhs); // no impl + NONCOPYABLE(NetworkPerformanceInterface); + public: NetworkPerformanceInterface(); bool initialize(); --- old/src/hotspot/share/runtime/semaphore.hpp 2019-12-01 18:05:02.642605204 -0500 +++ new/src/hotspot/share/runtime/semaphore.hpp 2019-12-01 18:05:02.394591915 -0500 @@ -26,6 +26,7 @@ #define SHARE_RUNTIME_SEMAPHORE_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" #if defined(LINUX) || defined(SOLARIS) || defined(AIX) # include "semaphore_posix.hpp" @@ -43,9 +44,7 @@ class Semaphore : public CHeapObj { SemaphoreImpl _impl; - // Prevent copying and assignment of Semaphore instances. - Semaphore(const Semaphore&); - Semaphore& operator=(const Semaphore&); + NONCOPYABLE(Semaphore); public: Semaphore(uint value = 0) : _impl(value) {} --- old/src/hotspot/share/runtime/thread.hpp 2019-12-01 18:05:03.634658360 -0500 +++ new/src/hotspot/share/runtime/thread.hpp 2019-12-01 18:05:03.382644856 -0500 @@ -874,9 +874,7 @@ uint _protect_enter; NonJavaThread* _current; - // Noncopyable. - Iterator(const Iterator&); - Iterator& operator=(const Iterator&); + NONCOPYABLE(Iterator); public: Iterator(); --- old/src/hotspot/share/utilities/bitMap.hpp 2019-12-01 18:05:04.650712801 -0500 +++ new/src/hotspot/share/utilities/bitMap.hpp 2019-12-01 18:05:04.398699298 -0500 @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" #include "runtime/atomic.hpp" #include "utilities/align.hpp" +#include "utilities/macros.hpp" // Forward decl; class BitMapClosure; @@ -368,9 +369,7 @@ ArenaBitMap(Arena* arena, idx_t size_in_bits); private: - // Don't allow copy or assignment. - ArenaBitMap(const ArenaBitMap&); - ArenaBitMap& operator=(const ArenaBitMap&); + NONCOPYABLE(ArenaBitMap); }; // A BitMap with storage in the CHeap. @@ -379,8 +378,7 @@ private: // Don't allow copy or assignment, to prevent the // allocated memory from leaking out to other instances. - CHeapBitMap(const CHeapBitMap&); - CHeapBitMap& operator=(const CHeapBitMap&); + NONCOPYABLE(CHeapBitMap); // NMT memory type MEMFLAGS _flags; --- old/src/hotspot/share/utilities/lockFreeStack.hpp 2019-12-01 18:05:05.610764242 -0500 +++ new/src/hotspot/share/utilities/lockFreeStack.hpp 2019-12-01 18:05:05.358750739 -0500 @@ -69,9 +69,7 @@ } while (old != cur); } - // Noncopyable. - LockFreeStack(const LockFreeStack&); - LockFreeStack& operator=(const LockFreeStack&); + NONCOPYABLE(LockFreeStack); public: LockFreeStack() : _top(NULL) {} --- old/src/hotspot/share/utilities/macros.hpp 2019-12-01 18:05:06.558815040 -0500 +++ new/src/hotspot/share/utilities/macros.hpp 2019-12-01 18:05:06.306801537 -0500 @@ -46,6 +46,19 @@ #define PASTE_TOKENS_AUX(x, y) PASTE_TOKENS_AUX2(x, y) #define PASTE_TOKENS_AUX2(x, y) x ## y +// Declare the named class to be noncopyable. This macro must be used in +// a private part of the class's definition, followed by a semi-colon. +// Doing so provides private declarations for the class's copy constructor +// and assignment operator. Because these operations are private, most +// potential callers will fail to compile because they are inaccessible. +// The operations intentionally lack a definition, to provoke link-time +// failures for calls from contexts where they are accessible, e.g. from +// within the class or from a friend of the class. +// Note: The lack of definitions is still not completely bullet-proof, as +// an apparent call might be optimized away by copy elision. +// For C++11 the declarations should be changed to deleted definitions. +#define NONCOPYABLE(C) C(C const&); C& operator=(C const&) /* next token must be ; */ + // -DINCLUDE_=0 | 1 can be specified on the command line to include // or exclude functionality. --- old/src/hotspot/share/utilities/ostream.hpp 2019-12-01 18:05:07.478864338 -0500 +++ new/src/hotspot/share/utilities/ostream.hpp 2019-12-01 18:05:07.238851477 -0500 @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" #include "runtime/timer.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" DEBUG_ONLY(class ResourceMark;) @@ -43,8 +44,7 @@ // -XX:+DisplayVMOutputToStderr class outputStream : public ResourceObj { private: - outputStream(const outputStream&); - outputStream& operator=(const outputStream&); + NONCOPYABLE(outputStream); protected: int _indentation; // current indentation --- old/src/hotspot/share/utilities/singleWriterSynchronizer.hpp 2019-12-01 18:05:08.450916422 -0500 +++ new/src/hotspot/share/utilities/singleWriterSynchronizer.hpp 2019-12-01 18:05:08.198902918 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,9 +55,7 @@ DEBUG_ONLY(volatile uint _writers;) - // Noncopyable. - SingleWriterSynchronizer(const SingleWriterSynchronizer&); - SingleWriterSynchronizer& operator=(const SingleWriterSynchronizer&); + NONCOPYABLE(SingleWriterSynchronizer); public: SingleWriterSynchronizer(); --- old/src/hotspot/share/utilities/waitBarrier.hpp 2019-12-01 18:05:09.426968720 -0500 +++ new/src/hotspot/share/utilities/waitBarrier.hpp 2019-12-01 18:05:09.178955431 -0500 @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" #include "runtime/thread.hpp" #include "utilities/debug.hpp" +#include "utilities/macros.hpp" #include "utilities/waitBarrier_generic.hpp" #if defined(LINUX) @@ -81,9 +82,7 @@ class WaitBarrierType : public CHeapObj { WaitBarrierImpl _impl; - // Prevent copying and assignment of WaitBarrier instances. - WaitBarrierType(const WaitBarrierDefault&); - WaitBarrierType& operator=(const WaitBarrierDefault&); + NONCOPYABLE(WaitBarrierType); #ifdef ASSERT int _last_arm_tag; --- old/src/hotspot/share/utilities/waitBarrier_generic.hpp 2019-12-01 18:05:10.403021018 -0500 +++ new/src/hotspot/share/utilities/waitBarrier_generic.hpp 2019-12-01 18:05:10.151007515 -0500 @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "runtime/semaphore.hpp" +#include "utilities/macros.hpp" // In addition to the barrier tag, it uses two counters to keep the semaphore // count correct and not leave any late thread waiting. @@ -39,9 +40,7 @@ volatile int _barrier_threads; Semaphore _sem_barrier; - // Prevent copying and assignment of GenericWaitBarrier instances. - GenericWaitBarrier(const GenericWaitBarrier&); - GenericWaitBarrier& operator=(const GenericWaitBarrier&); + NONCOPYABLE(GenericWaitBarrier); int wake_if_needed();