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
This commit is contained in:
Jake.Stine 2009-10-24 16:28:48 +00:00
parent aa2e053366
commit 66d92503aa
3 changed files with 33 additions and 24 deletions

View File

@ -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 <wx/string.h>
//#include <wx/tokenzr.h>
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
#include <wx/intl.h>
#include <wx/log.h>

View File

@ -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;

View File

@ -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