From a6a2676cc94dfaf06b6a2d343e57cc78f5fccd43 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 1 Nov 2008 06:15:25 +0000 Subject: [PATCH] On Linux, when we say _forceinline, actually force it to inline. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@261 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/Hw.h | 9 ++++++++- pcsx2/Misc.h | 26 +++++++++++++++++++++++--- pcsx2/PS2Etypes.h | 4 ++-- pcsx2/VU.h | 5 +++++ pcsx2/build.sh | 12 ------------ pcsx2/configure.ac | 14 +++++++------- 6 files changed, 45 insertions(+), 25 deletions(-) diff --git a/pcsx2/Hw.h b/pcsx2/Hw.h index 2030b9b974..04cebd9508 100644 --- a/pcsx2/Hw.h +++ b/pcsx2/Hw.h @@ -310,9 +310,11 @@ typedef struct tagDMACh{ #ifdef _WIN32 extern PSMEMORYMAP* memLUT; -#endif extern __forceinline u8* dmaGetAddr(u32 mem) +#else +static __forceinline u8* dmaGetAddr(u32 mem) +#endif { u8* p, *pbase; mem &= ~0xf; @@ -345,7 +347,12 @@ extern __forceinline u8* dmaGetAddr(u32 mem) extern u8 *psS; //0.015 mb, scratch pad extern uptr *memLUTR; + +#ifdef _WIN32 extern __forceinline void *dmaGetAddr(u32 addr) { +#else +static __forceinline void *dmaGetAddr(u32 addr) { +#endif u8 *ptr; /*#ifdef DMA_LOG diff --git a/pcsx2/Misc.h b/pcsx2/Misc.h index 030caceddf..287f9d4a89 100644 --- a/pcsx2/Misc.h +++ b/pcsx2/Misc.h @@ -23,6 +23,8 @@ #include #include +#include "PS2Etypes.h" + #ifndef _WIN32 #include #endif @@ -157,7 +159,11 @@ BOOL Save_Patch_Proc( char * filename ); #include +#ifdef _WIN32 extern __forceinline u32 timeGetTime() +#else +static __forceinline u32 timeGetTime() +#endif { struct timeb t; ftime(&t); @@ -268,7 +274,7 @@ void injectIRX(char *filename); #if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC) // declare linux equivalents -extern __forceinline void* pcsx2_aligned_malloc(size_t size, size_t align) +static __forceinline void* pcsx2_aligned_malloc(size_t size, size_t align) { assert( align < 0x10000 ); char* p = (char*)malloc(size+align); @@ -280,7 +286,7 @@ extern __forceinline void* pcsx2_aligned_malloc(size_t size, size_t align) return p; } -extern __forceinline void pcsx2_aligned_free(void* pmem) +static __forceinline void pcsx2_aligned_free(void* pmem) { if( pmem != NULL ) { char* p = (char*)pmem; @@ -291,6 +297,9 @@ extern __forceinline void pcsx2_aligned_free(void* pmem) #define _aligned_malloc pcsx2_aligned_malloc #define _aligned_free pcsx2_aligned_free +// This might work, too; I'll have to test the two, and see if it makes a difference. +//#define _aligned_malloc(size,align) memalign(align, size) +//#define _aligned_free free #endif // cross-platform atomic operations @@ -325,8 +334,11 @@ typedef void* PVOID; return __test_and_set(__p, (unsigned long)__q); # endif }*/ - +#ifdef _WIN32 extern __forceinline void InterlockedExchangePointer(PVOID volatile* Target, void* Value) +#else +static __forceinline void InterlockedExchangePointer(PVOID volatile* Target, void* Value) +#endif { #ifdef __x86_64__ __asm__ __volatile__(".intel_syntax\n" @@ -339,7 +351,11 @@ extern __forceinline void InterlockedExchangePointer(PVOID volatile* Target, voi #endif } +#ifdef _WIN32 extern __forceinline long InterlockedExchange(long volatile* Target, long Value) +#else +static __forceinline long InterlockedExchange(long volatile* Target, long Value) +#endif { __asm__ __volatile__(".intel_syntax\n" "lock xchg [%0], %%eax\n" @@ -347,7 +363,11 @@ extern __forceinline long InterlockedExchange(long volatile* Target, long Value) return 0; // The only function that even looks at this is a debugging function } +#ifdef _WIN32 extern __forceinline long InterlockedExchangeAdd(long volatile* Addend, long Value) +#else +static __forceinline long InterlockedExchangeAdd(long volatile* Addend, long Value) +#endif { __asm__ __volatile__(".intel_syntax\n" "lock xadd [%0], %%eax\n" diff --git a/pcsx2/PS2Etypes.h b/pcsx2/PS2Etypes.h index 7be69d8f0c..05230979bb 100644 --- a/pcsx2/PS2Etypes.h +++ b/pcsx2/PS2Etypes.h @@ -88,7 +88,7 @@ typedef union _LARGE_INTEGER { long long QuadPart; } LARGE_INTEGER; -#define _inline __inline__ +#define _inline __inline__ __attribute__((unused)) #endif #if defined(__MINGW32__) @@ -100,7 +100,7 @@ typedef union _LARGE_INTEGER #define PCSX2_ALIGNED16_DECL(x) x #ifndef __forceinline -#define __forceinline inline +#define __forceinline __attribute__((always_inline,unused)) #endif #endif // _MSC_VER diff --git a/pcsx2/VU.h b/pcsx2/VU.h index 6076e2e0f5..806f1bfe36 100644 --- a/pcsx2/VU.h +++ b/pcsx2/VU.h @@ -168,7 +168,12 @@ extern PCSX2_ALIGNED16_DECL(VURegs VU0); #define VU1 (*g_pVU1) + +#ifdef _WIN32 extern __forceinline u32* GET_VU_MEM(VURegs* VU, u32 addr) +#else +static __forceinline u32* GET_VU_MEM(VURegs* VU, u32 addr) +#endif { if( VU == g_pVU1 ) return (u32*)(VU1.Mem+(addr&0x3fff)); diff --git a/pcsx2/build.sh b/pcsx2/build.sh index d6404d4960..cd7a95fc81 100644 --- a/pcsx2/build.sh +++ b/pcsx2/build.sh @@ -40,19 +40,7 @@ make clean make install else - make $@ - -#if [ $? -ne 0 ] -#then -#exit 1 -#fi - -#if [ $# -eq 0 ] || [ $1 != "clean" ] -#then -#make install -#fi - fi if [ $? -ne 0 ] diff --git a/pcsx2/configure.ac b/pcsx2/configure.ac index f74e510cb8..12a3c557c6 100644 --- a/pcsx2/configure.ac +++ b/pcsx2/configure.ac @@ -28,16 +28,16 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]), if test "x$debug" == xyes then AC_DEFINE(_DEBUG,1,[_DEBUG]) - CFLAGS+="${DEBUG_FLAGS}" - CPPFLAGS+="${DEBUG_FLAGS}" - CXXFLAGS+="${DEBUG_FLAGS}" - CCASFLAGS+=" -D_DEBUG ${DEBUG_FLAGS}" + CFLAGS+=" ${DEBUG_FLAGS}" + CPPFLAGS+=" ${DEBUG_FLAGS}" + CXXFLAGS+=" ${DEBUG_FLAGS}" + CCASFLAGS+="-D_DEBUG ${DEBUG_FLAGS}" MYOBJDIR="Debug" else AC_DEFINE(NDEBUG,1,[NDEBUG]) - CFLAGS+="${NORMAL_FLAGS}" - CPPFLAGS+="${NORMAL_FLAGS}" - CXXFLAGS+="${NORMAL_FLAGS}" + CFLAGS+=" ${NORMAL_FLAGS}" + CPPFLAGS+=" ${NORMAL_FLAGS}" + CXXFLAGS+=" ${NORMAL_FLAGS}" MYOBJDIR="Release" fi AC_MSG_RESULT($debug)