diff --git a/src/hotspot/os/aix/decoder_aix.hpp b/src/hotspot/os/aix/decoder_aix.hpp index 0389852e4cb..0d87ba87b94 100644 --- a/src/hotspot/os/aix/decoder_aix.hpp +++ b/src/hotspot/os/aix/decoder_aix.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,9 +29,7 @@ // Provide simple AIXDecoder which enables decoding of C frames in VM. class AIXDecoder: public AbstractDecoder { public: - AIXDecoder() { - _decoder_status = no_error; - } + AIXDecoder() : AbstractDecoder(no_error) {} virtual ~AIXDecoder() {} virtual bool demangle(const char* symbol, char* buf, int buflen) { return false; } // use AixSymbols::get_function_name to demangle diff --git a/src/hotspot/os/bsd/decoder_machO.hpp b/src/hotspot/os/bsd/decoder_machO.hpp index 5ceda782c6e..b5bb3d2d5ea 100644 --- a/src/hotspot/os/bsd/decoder_machO.hpp +++ b/src/hotspot/os/bsd/decoder_machO.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2023, 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 @@ -29,11 +29,9 @@ #include "utilities/decoder.hpp" -// Just a placehold for now, a real implementation should derive -// from AbstractDecoder class MachODecoder : public AbstractDecoder { public: - MachODecoder() { } + MachODecoder() : AbstractDecoder(no_error) { } virtual ~MachODecoder() { } virtual bool demangle(const char* symbol, char* buf, int buflen); virtual bool decode(address pc, char* buf, int buflen, int* offset, diff --git a/src/hotspot/share/utilities/decoder.hpp b/src/hotspot/share/utilities/decoder.hpp index cd40408dd3f..fb1d76abc20 100644 --- a/src/hotspot/share/utilities/decoder.hpp +++ b/src/hotspot/share/utilities/decoder.hpp @@ -48,6 +48,8 @@ protected: decoder_status _decoder_status; public: + AbstractDecoder(decoder_status status) : _decoder_status(status) {} + virtual ~AbstractDecoder() {} // decode an pc address to corresponding function name and an offset from the beginning of @@ -84,9 +86,7 @@ public: // Do nothing decoder class NullDecoder : public AbstractDecoder { public: - NullDecoder() { - _decoder_status = not_available; - } + NullDecoder() : AbstractDecoder(not_available) {} virtual ~NullDecoder() {}; diff --git a/src/hotspot/share/utilities/decoder_elf.hpp b/src/hotspot/share/utilities/decoder_elf.hpp index 2f38f3d3c39..0f8342db819 100644 --- a/src/hotspot/share/utilities/decoder_elf.hpp +++ b/src/hotspot/share/utilities/decoder_elf.hpp @@ -33,10 +33,8 @@ class ElfDecoder : public AbstractDecoder { public: - ElfDecoder() { - _opened_elf_files = nullptr; - _decoder_status = no_error; - } + ElfDecoder() : AbstractDecoder(no_error), _opened_elf_files(nullptr) {} + virtual ~ElfDecoder(); bool demangle(const char* symbol, char *buf, int buflen);