From 66d92503aad3c374f78080d6cd18cbd192f0c69d Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sat, 24 Oct 2009 16:28:48 +0000 Subject: [PATCH] Attempted fix for GCC compilation errors in previous revision. Also: * Removed some unused sealed class container mess that liked to cause compilation errors on GCC 4.2 * Added a macro for efficient invocation of static recompiled code buffers. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2065 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/Utilities/Dependencies.h | 23 ------------------ common/include/Utilities/EventSource.h | 2 +- common/include/x86emitter/x86emitter.h | 32 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/common/include/Utilities/Dependencies.h b/common/include/Utilities/Dependencies.h index 4875f1d7b7..7f5a37d003 100644 --- a/common/include/Utilities/Dependencies.h +++ b/common/include/Utilities/Dependencies.h @@ -46,28 +46,6 @@ classname& operator=(const classname&) #endif -////////////////////////////////////////////////////////////////////////////////////////// -// __BaseSealed -// Base class used to implement type-safe sealed classes. -// This class should never be used directly. Use the Sealed macro instead, which ensures -// all sealed classes derive from a unique BaseSealed (preventing them from accidentally -// circumventing sealing by inheriting from multiple sealed classes. -// -template < int T > -class __BaseSealed -{ -protected: - __BaseSealed() - { - } -}; - -// Use this macro/class as a base to seal a class from being derived from. -// This macro works by providing a unique base class with a protected constructor -// for every class that derives from it. -#define Sealed private virtual __BaseSealed<__COUNTER__> - - ////////////////////////////////////////////////////////////////////////////////////////// // macro provided for tagging translation strings, without actually running them through the // translator (which the _() does automatically, and sometimes we don't want that). This is @@ -83,7 +61,6 @@ class wxString; #include "Pcsx2Defs.h" #include -//#include #include // for wxPoint/wxRect stuff #include #include diff --git a/common/include/Utilities/EventSource.h b/common/include/Utilities/EventSource.h index af6473059b..65eced950a 100644 --- a/common/include/Utilities/EventSource.h +++ b/common/include/Utilities/EventSource.h @@ -26,7 +26,7 @@ class wxCommandEvent; template< typename EvtType > struct EventListener { - typedef void __fastcall FuncType( void* object, EvtType& evt ); + typedef void __fastcall FuncType( void* object, typename EvtType& evt ); void* object; FuncType* OnEvent; diff --git a/common/include/x86emitter/x86emitter.h b/common/include/x86emitter/x86emitter.h index a77e70786e..d5077f2075 100644 --- a/common/include/x86emitter/x86emitter.h +++ b/common/include/x86emitter/x86emitter.h @@ -50,3 +50,35 @@ // once most code is no longer dependent on them. #include "legacy_types.h" #include "legacy_instructions.h" + +// -------------------------------------------------------------------------------------- +// CallAddress Macros -- An Optimization work-around hack! +// -------------------------------------------------------------------------------------- +// MSVC 2008 fails to optimize direct invocation of static recompiled code buffers, instead +// insisting on "mov eax, immaddr; call eax". Likewise, GCC fails to optimize it also, unless +// the typecast is explicitly inlined. These macros account for these problems. +// + +#ifdef _MSC_VER + +# define CallAddress( ptr ) \ + __asm{ call offset ptr } + +# define FastCallAddress( ptr, param ) \ + __asm{ __asm mov ecx, param1 __asm call offset ptr } + +# define FastCallAddress2( ptr, param1, param2 ) \ + __asm{ __asm mov ecx, param1 __asm mov edx, param2 __asm call offset ptr } + +#else + +# define CallAddress( ptr ) \ + ( (void (*)()) &(ptr)[0] )() + +# define FastCallAddress( ptr, param ) + ( (void (*)( int )) &(ptr)[0] )( param ) + +# define FastCallAddress2( ptr, param1, param2 ) + ( (void (*)( int, int )) &(ptr)[0] )( param1, param2 ) + +#endif \ No newline at end of file