Skip to content

Commit

Permalink
8244162: Additional opportunities to use NONCOPYABLE
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, kbarrett, shade
  • Loading branch information
Harold Seigel committed Jul 12, 2021
1 parent 548bb31 commit 92ae6a5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/asm/assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Label {
int _patch_index;
GrowableArray<int>* _patch_overflow;

Label(const Label&) { ShouldNotReachHere(); }
NONCOPYABLE(Label);
protected:

// The label will be bound to a location near its users.
Expand Down
11 changes: 6 additions & 5 deletions src/hotspot/share/classfile/stackMapTableFormat.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2021, 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
Expand Down Expand Up @@ -41,11 +41,11 @@ class verification_type_info {
address tag_addr() const { return (address)this; }
address cpool_index_addr() const { return tag_addr() + sizeof(u1); }
address bci_addr() const { return cpool_index_addr(); }
NONCOPYABLE(verification_type_info);

protected:
// No constructors - should be 'private', but GCC issues a warning if it is
verification_type_info() {}
verification_type_info(const verification_type_info&) {}

public:

Expand Down Expand Up @@ -169,12 +169,13 @@ FOR_EACH_STACKMAP_FRAME_TYPE(SM_FORWARD_DECL, x, x)
#undef SM_FORWARD_DECL

class stack_map_frame {
NONCOPYABLE(stack_map_frame);

protected:
address frame_type_addr() const { return (address)this; }

// No constructors - should be 'private', but GCC issues a warning if it is
stack_map_frame() {}
stack_map_frame(const stack_map_frame&) {}

public:

Expand Down Expand Up @@ -901,11 +902,11 @@ class stack_map_table {
address entries_addr() const {
return number_of_entries_addr() + sizeof(u2);
}
NONCOPYABLE(stack_map_table);

protected:
// No constructors - should be 'private', but GCC issues a warning if it is
stack_map_table() {}
stack_map_table(const stack_map_table&) {}

public:

Expand Down Expand Up @@ -933,11 +934,11 @@ class stack_map_table_attribute {
return name_index_addr() + sizeof(u2); }
address stack_map_table_addr() const {
return attribute_length_addr() + sizeof(u4); }
NONCOPYABLE(stack_map_table_attribute);

protected:
// No constructors - should be 'private', but GCC issues a warning if it is
stack_map_table_attribute() {}
stack_map_table_attribute(const stack_map_table_attribute&) {}

public:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ class ShenandoahRefProcThreadLocal : public CHeapObj<mtGC> {
Counters _encountered_count;
Counters _discovered_count;
Counters _enqueued_count;
NONCOPYABLE(ShenandoahRefProcThreadLocal);

public:
ShenandoahRefProcThreadLocal();

ShenandoahRefProcThreadLocal(const ShenandoahRefProcThreadLocal&) = delete; // non construction-copyable
ShenandoahRefProcThreadLocal& operator=(const ShenandoahRefProcThreadLocal&) = delete; // non copyable

void reset();

ShenandoahMarkRefsSuperClosure* mark_closure() const {
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/share/logging/logMessageBuffer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
Expand Down Expand Up @@ -54,8 +54,7 @@ class LogMessageBuffer : public StackObj {

private:
// Forbid copy assignment and copy constructor.
void operator=(const LogMessageBuffer& ref) {}
LogMessageBuffer(const LogMessageBuffer& ref) {}
NONCOPYABLE(LogMessageBuffer);

public:
LogMessageBuffer();
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/opto/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ class Node {
friend class VMStructs;

// Lots of restrictions on cloning Nodes
Node(const Node&); // not defined; linker error to use these
Node &operator=(const Node &rhs);
NONCOPYABLE(Node);

public:
friend class Compile;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/utilities/formatBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FormatBuffer : public FormatBufferBase {
int size() { return bufsz; }

private:
FormatBuffer(const FormatBuffer &); // prevent copies
NONCOPYABLE(FormatBuffer);
char _buffer[bufsz];

protected:
Expand Down

1 comment on commit 92ae6a5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.