From e659f5ac58e704295f2459b77030536707415298 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Wed, 30 Apr 2014 10:12:15 +0200 Subject: 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. --- Source/Core/Common/x64Emitter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/Core/Common/x64Emitter.cpp') diff --git a/Source/Core/Common/x64Emitter.cpp b/Source/Core/Common/x64Emitter.cpp index 23c3d2647e..89d5ddf564 100644 --- a/Source/Core/Common/x64Emitter.cpp +++ b/Source/Core/Common/x64Emitter.cpp @@ -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) -- cgit v1.2.3