kernel: Use "final" more in the VM and x86 paging classes.

Since we always compile the kernel with modern GCC, we might as well
take advantage of modern C++ features. In addition to providing
a sanity check, "final" is also an optimization, since it allows
the compiler to devirtualize calls made directly to a "final" class.

Change-Id: Iedb0ee8834637771f5b6113c17342dbf67e99042
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7826
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-07-09 17:52:19 +00:00
committed by waddlesplash
parent 3af5908769
commit 3ea2ee1a40
16 changed files with 16 additions and 21 deletions
@@ -47,7 +47,7 @@ using X86LargePhysicalPageMapper::PhysicalPageSlot;
// #pragma mark - X86PagingMethod32Bit::PhysicalPageSlotPool // #pragma mark - X86PagingMethod32Bit::PhysicalPageSlotPool
struct X86PagingMethod32Bit::PhysicalPageSlotPool struct X86PagingMethod32Bit::PhysicalPageSlotPool final
: X86LargePhysicalPageMapper::PhysicalPageSlotPool { : X86LargePhysicalPageMapper::PhysicalPageSlotPool {
public: public:
virtual ~PhysicalPageSlotPool(); virtual ~PhysicalPageSlotPool();
@@ -15,7 +15,7 @@ class TranslationMapPhysicalPageMapper;
class X86PhysicalPageMapper; class X86PhysicalPageMapper;
class X86PagingMethod32Bit : public X86PagingMethod { class X86PagingMethod32Bit final : public X86PagingMethod {
public: public:
X86PagingMethod32Bit(); X86PagingMethod32Bit();
virtual ~X86PagingMethod32Bit(); virtual ~X86PagingMethod32Bit();
@@ -10,7 +10,7 @@
#include "paging/X86PagingStructures.h" #include "paging/X86PagingStructures.h"
struct X86PagingStructures32Bit : X86PagingStructures { struct X86PagingStructures32Bit final : X86PagingStructures {
page_directory_entry* pgdir_virt; page_directory_entry* pgdir_virt;
X86PagingStructures32Bit(); X86PagingStructures32Bit();
@@ -12,7 +12,7 @@
struct X86PagingStructures32Bit; struct X86PagingStructures32Bit;
struct X86VMTranslationMap32Bit : X86VMTranslationMap { struct X86VMTranslationMap32Bit final : X86VMTranslationMap {
X86VMTranslationMap32Bit(); X86VMTranslationMap32Bit();
virtual ~X86VMTranslationMap32Bit(); virtual ~X86VMTranslationMap32Bit();
@@ -9,11 +9,6 @@
#include <vm/VMTranslationMap.h> #include <vm/VMTranslationMap.h>
#if __GNUC__ < 4
#define final
#endif
#define PAGE_INVALIDATE_CACHE_SIZE 64 #define PAGE_INVALIDATE_CACHE_SIZE 64
@@ -351,7 +351,7 @@ private:
// #pragma mark - PhysicalPageSlotPool // #pragma mark - PhysicalPageSlotPool
struct X86PagingMethodPAE::PhysicalPageSlotPool struct X86PagingMethodPAE::PhysicalPageSlotPool final
: X86LargePhysicalPageMapper::PhysicalPageSlotPool { : X86LargePhysicalPageMapper::PhysicalPageSlotPool {
public: public:
virtual ~PhysicalPageSlotPool(); virtual ~PhysicalPageSlotPool();
@@ -23,7 +23,7 @@ class TranslationMapPhysicalPageMapper;
class X86PhysicalPageMapper; class X86PhysicalPageMapper;
class X86PagingMethodPAE : public X86PagingMethod { class X86PagingMethodPAE final : public X86PagingMethod {
public: public:
X86PagingMethodPAE(); X86PagingMethodPAE();
virtual ~X86PagingMethodPAE(); virtual ~X86PagingMethodPAE();
@@ -15,7 +15,7 @@
struct X86PagingStructuresPAE; struct X86PagingStructuresPAE;
struct X86VMTranslationMapPAE : X86VMTranslationMap { struct X86VMTranslationMapPAE final : X86VMTranslationMap {
X86VMTranslationMapPAE(); X86VMTranslationMapPAE();
virtual ~X86VMTranslationMapPAE(); virtual ~X86VMTranslationMapPAE();
@@ -90,7 +90,7 @@ private:
// #pragma mark - // #pragma mark -
class LargeMemoryTranslationMapPhysicalPageMapper class LargeMemoryTranslationMapPhysicalPageMapper final
: public TranslationMapPhysicalPageMapper { : public TranslationMapPhysicalPageMapper {
public: public:
LargeMemoryTranslationMapPhysicalPageMapper(); LargeMemoryTranslationMapPhysicalPageMapper();
@@ -115,7 +115,7 @@ private:
}; };
class LargeMemoryPhysicalPageMapper : public X86PhysicalPageMapper { class LargeMemoryPhysicalPageMapper final : public X86PhysicalPageMapper {
public: public:
LargeMemoryPhysicalPageMapper(); LargeMemoryPhysicalPageMapper();
+1 -1
View File
@@ -13,7 +13,7 @@
struct file_cache_ref; struct file_cache_ref;
class VMVnodeCache : public VMCache { class VMVnodeCache final : public VMCache {
public: public:
status_t Init(struct vnode* vnode, status_t Init(struct vnode* vnode,
uint32 allocationFlags); uint32 allocationFlags);
+1 -1
View File
@@ -31,7 +31,7 @@ extern "C" {
} }
class VMAnonymousCache : public VMCache { class VMAnonymousCache final : public VMCache {
public: public:
virtual ~VMAnonymousCache(); virtual ~VMAnonymousCache();
@@ -13,7 +13,7 @@
#include <vm/VMCache.h> #include <vm/VMCache.h>
class VMAnonymousNoSwapCache : public VMCache { class VMAnonymousNoSwapCache final : public VMCache {
public: public:
virtual ~VMAnonymousNoSwapCache(); virtual ~VMAnonymousNoSwapCache();
+1 -1
View File
@@ -13,7 +13,7 @@
#include <vm/VMCache.h> #include <vm/VMCache.h>
class VMDeviceCache : public VMCache { class VMDeviceCache final : public VMCache {
public: public:
status_t Init(addr_t baseAddress, status_t Init(addr_t baseAddress,
uint32 allocationFlags); uint32 allocationFlags);
+1 -1
View File
@@ -14,7 +14,7 @@
struct ObjectCache; struct ObjectCache;
struct VMKernelAddressSpace : VMAddressSpace { struct VMKernelAddressSpace final : VMAddressSpace {
public: public:
VMKernelAddressSpace(team_id id, addr_t base, VMKernelAddressSpace(team_id id, addr_t base,
size_t size); size_t size);
+1 -1
View File
@@ -13,7 +13,7 @@
#include <vm/VMCache.h> #include <vm/VMCache.h>
class VMNullCache : public VMCache { class VMNullCache final : public VMCache {
public: public:
status_t Init(uint32 allocationFlags); status_t Init(uint32 allocationFlags);
+1 -1
View File
@@ -11,7 +11,7 @@
#include "VMUserArea.h" #include "VMUserArea.h"
struct VMUserAddressSpace : VMAddressSpace { struct VMUserAddressSpace final : VMAddressSpace {
public: public:
VMUserAddressSpace(team_id id, addr_t base, VMUserAddressSpace(team_id id, addr_t base,
size_t size); size_t size);