JitBackpatch: fix NOP padding

The new NOP emitter breaks when called with a negative count. As it
turns out, it did happen when deoptimizing 8 bit MOVs because they are
only 4 bytes long and need no BSWAP.
This commit is contained in:
Tillmann Karras
2014-04-30 10:12:15 +02:00
parent a40ea4e26a
commit e659f5ac58
4 changed files with 18 additions and 6 deletions

View File

@ -6,6 +6,7 @@
#include "Common/Common.h"
#include "Common/CPUDetect.h"
#include "Common/Log.h"
#include "Common/x64Emitter.h"
namespace Gen
@ -516,8 +517,9 @@ void XEmitter::RET() {Write8(0xC3);}
void XEmitter::RET_FAST() {Write8(0xF3); Write8(0xC3);} //two-byte return (rep ret) - recommended by AMD optimization manual for the case of jumping to a ret
// The first sign of decadence: optimized NOPs.
void XEmitter::NOP(int size)
void XEmitter::NOP(size_t size)
{
_dbg_assert_(DYNA_REC, (int)size > 0);
while (true)
{
switch (size)