Skip to content

Commit

Permalink
Refactor fastmem/trampoline code.
Browse files Browse the repository at this point in the history
Simplication to avoid reading back the generated instructions, allowing
us to handle all possible cases.
  • Loading branch information
mmastrac committed Jun 27, 2016
1 parent 4aa5291 commit fcef1a7
Show file tree
Hide file tree
Showing 20 changed files with 382 additions and 896 deletions.
1 change: 0 additions & 1 deletion Source/Core/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ set(SRCS Analytics.cpp
TraversalClient.cpp
Version.cpp
x64ABI.cpp
x64Analyzer.cpp
x64Emitter.cpp
Crypto/bn.cpp
Crypto/ec.cpp
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Common/Common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
<ClInclude Include="TraversalClient.h" />
<ClInclude Include="TraversalProto.h" />
<ClInclude Include="x64ABI.h" />
<ClInclude Include="x64Analyzer.h" />
<ClInclude Include="x64Emitter.h" />
<ClInclude Include="Crypto\bn.h" />
<ClInclude Include="Crypto\ec.h" />
Expand Down Expand Up @@ -178,7 +177,6 @@
<ClCompile Include="ucrtFreadWorkaround.cpp" />
<ClCompile Include="Version.cpp" />
<ClCompile Include="x64ABI.cpp" />
<ClCompile Include="x64Analyzer.cpp" />
<ClCompile Include="x64CPUDetect.cpp" />
<ClCompile Include="x64Emitter.cpp" />
<ClCompile Include="x64FPURoundMode.cpp" />
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Common/Common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<ClInclude Include="Thread.h" />
<ClInclude Include="Timer.h" />
<ClInclude Include="x64ABI.h" />
<ClInclude Include="x64Analyzer.h" />
<ClInclude Include="x64Emitter.h" />
<ClInclude Include="Logging\ConsoleListener.h">
<Filter>Logging</Filter>
Expand Down Expand Up @@ -253,7 +252,6 @@
<ClCompile Include="Timer.cpp" />
<ClCompile Include="Version.cpp" />
<ClCompile Include="x64ABI.cpp" />
<ClCompile Include="x64Analyzer.cpp" />
<ClCompile Include="x64CPUDetect.cpp" />
<ClCompile Include="x64Emitter.cpp" />
<ClCompile Include="x64FPURoundMode.cpp" />
Expand Down
233 changes: 0 additions & 233 deletions Source/Core/Common/x64Analyzer.cpp

This file was deleted.

44 changes: 0 additions & 44 deletions Source/Core/Common/x64Analyzer.h

This file was deleted.

24 changes: 19 additions & 5 deletions Source/Core/Common/x64Emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,14 @@ void XEmitter::MOVBE(int bits, const OpArg& dest, X64Reg src)
WriteMOVBE(bits, 0xF1, src, dest);
}

void XEmitter::LoadAndSwap(int size, X64Reg dst, const OpArg& src, bool sign_extend)
void XEmitter::LoadAndSwap(int size, X64Reg dst, const OpArg& src, bool sign_extend, MovInfo* info)
{
if (info)
{
info->address = GetWritableCodePtr();
info->nonAtomicSwapStore = false;
}

switch (size)
{
case 8:
Expand Down Expand Up @@ -1083,20 +1089,28 @@ void XEmitter::LoadAndSwap(int size, X64Reg dst, const OpArg& src, bool sign_ext
}
}

u8* XEmitter::SwapAndStore(int size, const OpArg& dst, X64Reg src)
void XEmitter::SwapAndStore(int size, const OpArg& dst, X64Reg src, MovInfo* info)
{
u8* mov_location = GetWritableCodePtr();
if (cpu_info.bMOVBE)
{
if (info)
{
info->address = GetWritableCodePtr();
info->nonAtomicSwapStore = false;
}
MOVBE(size, dst, src);
}
else
{
BSWAP(size, src);
mov_location = GetWritableCodePtr();
if (info)
{
info->address = GetWritableCodePtr();
info->nonAtomicSwapStore = true;
info->nonAtomicSwapStoreSrc = src;
}
MOV(size, dst, R(src));
}
return mov_location;
}

void XEmitter::LEA(int bits, X64Reg dest, OpArg src)
Expand Down

0 comments on commit fcef1a7

Please sign in to comment.