From 4c3e98754ea567d6db2a8d6492671d09fb066e11 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 28 Nov 2016 09:14:13 +0100 Subject: [PATCH] vif JIT: increment based on sizeof(T) Struct on x64 will be 32B so +2 instead of +1 --- pcsx2/x86/newVif.h | 3 +-- pcsx2/x86/newVif_HashBucket.h | 15 +++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pcsx2/x86/newVif.h b/pcsx2/x86/newVif.h index e44f8da4ac..bdef4c468c 100644 --- a/pcsx2/x86/newVif.h +++ b/pcsx2/x86/newVif.h @@ -69,8 +69,7 @@ struct __aligned16 nVifBlock { }; // 16 bytes #define _hSize 0x4000 // [usn*1:mask*1:upk*4:num*8] hash... -#define _cmpS (sizeof(nVifBlock) - (4)) -#define _tParams nVifBlock, _hSize, _cmpS +#define _tParams nVifBlock, _hSize struct nVifStruct { __aligned16 nVifBlock block; diff --git a/pcsx2/x86/newVif_HashBucket.h b/pcsx2/x86/newVif_HashBucket.h index 18a55b9b52..7467005823 100644 --- a/pcsx2/x86/newVif_HashBucket.h +++ b/pcsx2/x86/newVif_HashBucket.h @@ -41,11 +41,10 @@ struct SizeChain // to perform quick searches. // T is a struct data type (note: size must be in multiples of 16 bytes!) // hSize determines the number of buckets HashBucket will use for sorting. -// cmpSize is the size of data to consider 2 structs equal (see find()) // The hash function is determined by taking the first bytes of data and // performing a modulus the size of hSize. So the most diverse-data should // be in the first bytes of the struct. (hence why nVifBlock is specifically sorted) -template +template class HashBucket { protected: SizeChain mBucket[hSize]; @@ -68,18 +67,14 @@ public: const __m128i* endpos = (__m128i*)&bucket.Chain[bucket.Size]; const __m128i data128( _mm_load_si128((__m128i*)dataPtr) ); -#ifdef __x86_64__ - pxAssertMsg(0, "Code is likely not compatible with 64 bits\n" - "Vif structure is 16 bytes in ia32 bits but contains an uptr to the x86 buffer. So 20 bytes in x64\n" - "Code below increments the iterator by 16 bytes, potentially we could put the x86 buffer in the first 2GB\n" - "Another improvement could be a port to std::unordered_map"); -#endif + for( const __m128i* chainpos = (__m128i*)bucket.Chain; chainpos