Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8276337: Use override specifier in HeapDumper #6274

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/hotspot/share/services/heapDumper.cpp
Expand Up @@ -607,23 +607,23 @@ class DumpWriter : public AbstractDumpWriter {
private:
CompressionBackend _backend; // Does the actual writing.
protected:
virtual void flush(bool force = false);
void flush(bool force = false) override;

public:
// Takes ownership of the writer and compressor.
DumpWriter(AbstractWriter* writer, AbstractCompressor* compressor);

// total number of bytes written to the disk
virtual julong bytes_written() const { return (julong) _backend.get_written(); }
julong bytes_written() const override { return (julong) _backend.get_written(); }

virtual char const* error() const { return _backend.error(); }
char const* error() const override { return _backend.error(); }

// Called by threads used for parallel writing.
void writer_loop() { _backend.thread_loop(); }
// Called when finish to release the threads.
virtual void deactivate() { flush(); _backend.deactivate(); }
void deactivate() override { flush(); _backend.deactivate(); }
// Get the backend pointer, used by parallel dump writer.
CompressionBackend* backend_ptr() { return &_backend; }
CompressionBackend* backend_ptr() { return &_backend; }
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated, but could be a const method, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not easily I think, if I make the method const, I would have to return a const pointer, and then I need to do const operations on the backend etc.


};

Expand Down Expand Up @@ -701,7 +701,7 @@ class ParDumpWriter : public AbstractDumpWriter {
bool _split_data;
static const uint BackendFlushThreshold = 2;
protected:
virtual void flush(bool force = false) {
void flush(bool force = false) override {
assert(_pos != 0, "must not be zero");
if (_pos != 0) {
refresh_buffer();
Expand Down Expand Up @@ -742,8 +742,8 @@ class ParDumpWriter : public AbstractDumpWriter {
}

// total number of bytes written to the disk
virtual julong bytes_written() const { return (julong) _backend_ptr->get_written(); }
virtual char const* error() const { return _err == NULL ? _backend_ptr->error() : _err; }
julong bytes_written() const override { return (julong) _backend_ptr->get_written(); }
char const* error() const override { return _err == NULL ? _backend_ptr->error() : _err; }

static void before_work() {
assert(_lock == NULL, "ParDumpWriter lock must be initialized only once");
Expand All @@ -757,7 +757,7 @@ class ParDumpWriter : public AbstractDumpWriter {
}

// write raw bytes
virtual void write_raw(const void* s, size_t len) {
void write_raw(const void* s, size_t len) override {
assert(!_in_dump_segment || (_sub_record_left >= len), "sub-record too large");
debug_only(_sub_record_left -= len);
assert(!_split_data, "Invalid split data");
Expand All @@ -778,7 +778,7 @@ class ParDumpWriter : public AbstractDumpWriter {
set_position(position() + len);
}

virtual void deactivate() { flush(true); _backend_ptr->deactivate(); }
void deactivate() override { flush(true); _backend_ptr->deactivate(); }

private:
void allocate_internal_buffer() {
Expand Down