diff options
author | Vas Crabb <vas@vastheman.com> | 2021-09-20 03:03:26 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2021-09-20 03:03:26 +1000 |
commit | 401b22bbf50dbddc45fa99fb92249fd0c86c1bed (patch) | |
tree | 76cce80eccf1f99272551fb234d7783d36a6962e /src/osd | |
parent | 566a741f4fda9be53504eb9bc965bd9f1649ae2d (diff) |
util/delegate.h: Try to catch issues earlier, and some cleanup.
Optimised generation of late bind helper functions. The late bind
helper function doesn't depend on the delegate signature - only on the
late bind base class and function target class. Having it inside the
delegate base class means it needs to be instantiated for every
combination of late bind base class, function target class and delegate
signature. In a typical driver file, there is only one late bind base
class (delegate_late_bind), and there will be delegates with multiple
signatures bound to function members of the same class (e.g. read and
write handlers, possibly of different widths, bound to members of the
driver state class). By moving the late bind helper out of the delegate
base class, the number of required instantiations can be reduced. By
moving the body out of the enclosing class declaration, the compiler can
be encouraged to coalese instantiations across translation units. While
this won't give a further reduction in compile time, it should at least
reduce the output binary size by reducing duplication for devices that
frequently have handlers installed in memory maps.
Added an additional template parameter to delegates allowing the late
bind base class to be changed if desired.
Moved the MSVC implementation "this" pointer optimisation out-of-line
and added logging. Also cleaned up the Itanium "this" pointer
adjustment and code pointer resolution implementation to reduce
duplication and conditional compilation.
Made binding_type_exception give a more meaningful what() message than
"std::exception".
Added extensive validity tests for delegate functionality. Pointers to
member functions are tested, including multiple inheritance, virtual and
non-virtual member functions, and checking for generational loss across
copying/assigning delegates. This should properly exercise "this"
pointer adjustment for the Itanium and MSVC implementations, and vtable
lookup for the Itanium implementation. So-called late binding
functionality is tested, including exceptions on failure. Functoids are
tested, although given the encapsulation it's not possible to check that
an apator isn't generated when it shouldn't be.
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/eigccppc.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/osd/eigccppc.h b/src/osd/eigccppc.h index de1372ff39b..b1f0fc638a7 100644 --- a/src/osd/eigccppc.h +++ b/src/osd/eigccppc.h @@ -204,7 +204,7 @@ _recip_approx(float value) multiply and return the full 128 bit result -------------------------------------------------*/ -#if defined(__ppc64__) +#if defined(__ppc64__) || defined(__PPC64___) || defined(_ARCH_PPC64) #define mul_64x64 _mul_64x64 inline int64_t ATTR_FORCE_INLINE _mul_64x64(int64_t a, int64_t b, int64_t &hi) @@ -221,7 +221,7 @@ _mul_64x64(int64_t a, int64_t b, int64_t &hi) bit multiply and return the full 128 bit result -------------------------------------------------*/ -#if defined(__ppc64__) +#if defined(__ppc64__) || defined(__PPC64___) || defined(_ARCH_PPC64) #define mulu_64x64 _mulu_64x64 inline uint64_t ATTR_FORCE_INLINE _mulu_64x64(uint64_t a, uint64_t b, uint64_t &hi) @@ -285,7 +285,7 @@ _count_leading_ones_32(uint32_t value) leading zero bits in a 64-bit value -------------------------------------------------*/ -#if defined(__ppc64__) +#if defined(__ppc64__) || defined(__PPC64___) || defined(_ARCH_PPC64) #define count_leading_zeros_64 _count_leading_zeros_64 inline uint8_t ATTR_CONST ATTR_FORCE_INLINE _count_leading_zeros_64(uint64_t value) @@ -308,7 +308,7 @@ _count_leading_zeros_64(uint64_t value) leading one bits in a 64-bit value -------------------------------------------------*/ -#if defined(__ppc64__) +#if defined(__ppc64__) || defined(__PPC64___) || defined(_ARCH_PPC64) #define count_leading_ones_64 _count_leading_ones_64 inline uint8_t ATTR_CONST ATTR_FORCE_INLINE _count_leading_ones_64(uint64_t value) |