From 5822e284f3300eeedb2f8d3524c1055b6df69d91 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 8 Feb 2009 13:09:58 +0000 Subject: [PATCH] Add Release_JITIL configuration to use magumagu's JIT instead under windows (currently 32-bit only) (this is intended to be temporary). Add comment about crashes with JITIL in Burnout2 and Animal Crossing. Some warning disables and cleanups. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2145 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/MappedFile.h | 26 +- Source/Core/Core/Core.vcproj | 1440 ++++++++++++++++- Source/Core/Core/Src/Core.cpp | 8 + .../Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 5 +- Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 4 + Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp | 26 +- Source/Core/Core/Src/PowerPC/Jit64IL/IR.h | 9 +- Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp | 4 + .../Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp | 4 +- .../Core/Src/PowerPC/Jit64IL/Jit_Integer.cpp | 8 +- .../Src/PowerPC/Jit64IL/Jit_LoadStore.cpp | 4 +- Source/Core/Core/Src/PowerPC/PPCTables.cpp | 4 - Source/Core/DolphinWX/DolphinWX.vcproj | 275 +++- Source/Dolphin.sln | 88 + .../Plugin_VideoOGL/Plugin_VideoOGL.vcproj | 2 +- 15 files changed, 1864 insertions(+), 43 deletions(-) diff --git a/Source/Core/Common/Src/MappedFile.h b/Source/Core/Common/Src/MappedFile.h index fe1ddd704a..45627cc7d2 100644 --- a/Source/Core/Common/Src/MappedFile.h +++ b/Source/Core/Common/Src/MappedFile.h @@ -23,29 +23,25 @@ #ifndef _MAPPED_FILE_H #define _MAPPED_FILE_H -// #pragma warning (disable: 4786) - #include namespace Common { class IMappedFile { - public: +public: + virtual ~IMappedFile() {} - virtual ~IMappedFile() {} + virtual bool Open(const char* _szFilename) = 0; + virtual bool IsOpen(void) = 0; + virtual void Close(void) = 0; + virtual u64 GetSize(void) = 0; + virtual u8* Lock(u64 _offset, u64 _size) = 0; + virtual void Unlock(u8* ptr) = 0; - - virtual bool Open(const char* _szFilename) = 0; - virtual bool IsOpen(void) = 0; - virtual void Close(void) = 0; - virtual u64 GetSize(void) = 0; - virtual u8* Lock(u64 _offset, u64 _size) = 0; - virtual void Unlock(u8* ptr) = 0; - - static IMappedFile* CreateMappedFileDEPRECATED(); + static IMappedFile* CreateMappedFileDEPRECATED(); }; -} // end of namespace DiscIO + +} // namespace #endif - diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index 5a66fd159a..6e7aaa5404 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -865,6 +1017,14 @@ AssemblerOutput="4" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GetImmValue(AI); if (Memory::IsRAMAddress(addr)) { +#ifdef _M_IX86 + // 32-bit if (dest) *dest = regFindFreeReg(RI); if (Profiled) return M((void*)((u32)Memory::base + (addr & Memory::MEMVIEW32_MASK))); return M((void*)addr); +#else + // 64-bit + if (Profiled) + return M((void*)((u32)Memory::base + addr)); + return M((void*)addr); +#endif } } unsigned offset; @@ -1186,10 +1198,10 @@ static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile) { RI.MakeProfile = false;//!RI.UseProfile; // Pass to compute liveness ibuild->StartBackPass(); - for (unsigned index = RI.IInfo.size() - 1; index != -1U; --index) { + for (unsigned int index = RI.IInfo.size() - 1; index != -1U; --index) { InstLoc I = ibuild->ReadBackward(); - unsigned op = getOpcode(*I); - bool thisUsed = regReadUse(RI, I); + unsigned int op = getOpcode(*I); + bool thisUsed = regReadUse(RI, I) ? true : false; switch (op) { default: PanicAlert("Unexpected inst!"); @@ -1331,7 +1343,7 @@ static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile) { ibuild->StartForwardPass(); for (unsigned i = 0; i != RI.IInfo.size(); i++) { InstLoc I = ibuild->ReadForward(); - bool thisUsed = regReadUse(RI, I); + bool thisUsed = regReadUse(RI, I) ? true : false; switch (getOpcode(*I)) { case InterpreterFallback: { unsigned InstCode = ibuild->GetImmValue(getOp1(I)); @@ -2063,13 +2075,15 @@ static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile) { exit(1); } } + for (unsigned i = 0; i < 8; i++) { if (RI.regs[i]) { - PanicAlert("Incomplete cleanup!"); + // Start a game in Burnout 2 to get this. Or animal crossing. + PanicAlert("Incomplete cleanup! (regs)"); exit(1); } if (RI.fregs[i]) { - PanicAlert("Incomplete cleanup!"); + PanicAlert("Incomplete cleanup! (fregs)"); exit(1); } } diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h index 9c6de955b3..21aff2b279 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h @@ -22,7 +22,6 @@ #include namespace IREmitter { - enum Opcode { Nop = 0, @@ -484,9 +483,9 @@ namespace IREmitter { InstLoc ReadForward() { return curReadPtr++; } InstLoc ReadBackward() { return --curReadPtr; } InstLoc getFirstInst() { return &InstList[0]; } - unsigned getNumInsts() { return InstList.size(); } - unsigned ReadInst(InstLoc I) { return *I; } - unsigned GetImmValue(InstLoc I); + unsigned int getNumInsts() { return (unsigned int)InstList.size(); } + unsigned int ReadInst(InstLoc I) { return *I; } + unsigned int GetImmValue(InstLoc I); void Reset() { InstList.clear(); @@ -509,7 +508,7 @@ namespace IREmitter { IRBuilder() { Reset(); } - private: + private: IRBuilder(IRBuilder&); // DO NOT IMPLEMENT std::vector InstList; // FIXME: We must ensure this is // continuous! diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp index 53ad8c8127..0bd4f43e09 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp @@ -37,6 +37,10 @@ #include "JitCache.h" #include "JitRegCache.h" +#ifndef JITTEST +#error JitIL needs JITTEST define +#endif + using namespace Gen; using namespace PowerPC; diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp index 154a8ef467..a7a22a8efd 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp @@ -220,7 +220,7 @@ void AsmRoutineManager::GenQuantizedStores() { const u8* storePairedFloat = AlignCode4(); #ifdef _M_X64 MOVQ_xmm(R(RAX), XMM0); - ROL(64, RAX, Imm8(32)); + ROL(64, R(RAX), Imm8(32)); TEST(32, R(ECX), Imm32(0x0C000000)); FixupBranch argh = J_CC(CC_NZ); BSWAP(64, RAX); @@ -350,7 +350,7 @@ void AsmRoutineManager::GenQuantizedLoads() { #ifdef _M_X64 MOV(64, R(RCX), MComplex(RBX, RCX, 1, 0)); BSWAP(64, RCX); - ROL(64, RCX, Imm8(32)); + ROL(64, R(RCX), Imm8(32)); MOVQ_xmm(XMM0, R(RCX)); #else #if 0 diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_Integer.cpp index 2cfcebb985..5c040c1d17 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_Integer.cpp @@ -15,6 +15,10 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#ifdef _MSC_VER +#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned +#endif + #include "../../Core.h" // include "Common.h", "CoreParameter.h", SCoreStartupParameter #include "../PowerPC.h" #include "../PPCTables.h" @@ -398,7 +402,7 @@ void Jit64::rlwnmx(UGeckoInstruction inst) { INSTRUCTION_START - unsigned mask = Helper_Mask(inst.MB, inst.ME); + unsigned int mask = Helper_Mask(inst.MB, inst.ME); IREmitter::InstLoc val = ibuild.EmitLoadGReg(inst.RS); val = ibuild.EmitRol(val, ibuild.EmitLoadGReg(inst.RB)); val = ibuild.EmitAnd(val, ibuild.EmitIntConst(mask)); @@ -481,7 +485,7 @@ IREmitter::InstLoc val = ibuild.EmitLoadGReg(inst.RS), test; val = ibuild.EmitSarl(val, ibuild.EmitIntConst(inst.SH)); ibuild.EmitStoreGReg(val, inst.RA); - unsigned mask = -1u << inst.SH; + unsigned int mask = -1u << inst.SH; test = ibuild.EmitOr(val, ibuild.EmitIntConst(mask & 0x7FFFFFFF)); test = ibuild.EmitICmpUgt(test, ibuild.EmitIntConst(mask)); diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_LoadStore.cpp index b897977164..d7ed89aa3f 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit_LoadStore.cpp @@ -108,9 +108,9 @@ void Jit64::lXzx(UGeckoInstruction inst) switch (inst.SUBOP10 & ~32) { default: PanicAlert("lXzx: invalid access size"); - case 23: val = ibuild.EmitLoad32(addr); break; //lwzx + case 23: val = ibuild.EmitLoad32(addr); break; //lwzx case 279: val = ibuild.EmitLoad16(addr); break; //lhzx - case 87: val = ibuild.EmitLoad8(addr); break; //lbzx + case 87: val = ibuild.EmitLoad8(addr); break; //lbzx } ibuild.EmitStoreGReg(val, inst.RD); } diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp index 2b667320dc..c4a717d10b 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp @@ -311,11 +311,7 @@ static GekkoOPTemplate table31[] = {24, Interpreter::slwx, &Jit64::slwx, {"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}}, {54, Interpreter::dcbst, &Jit64::Default, {"dcbst", OPTYPE_DCACHE, 0, 4}}, -#if JITTEST {86, Interpreter::dcbf, &Jit64::DoNothing, {"dcbf", OPTYPE_DCACHE, 0, 4}}, -#else - {86, Interpreter::dcbf, &Jit64::Default, {"dcbf", OPTYPE_DCACHE, 0, 4}}, -#endif {246, Interpreter::dcbtst, &Jit64::Default, {"dcbtst", OPTYPE_DCACHE, 0, 1}}, {278, Interpreter::dcbt, &Jit64::Default, {"dcbt", OPTYPE_DCACHE, 0, 1}}, {470, Interpreter::dcbi, &Jit64::Default, {"dcbi", OPTYPE_DCACHE, 0, 4}}, diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index 3901955fd7..80a3c0b635 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -859,6 +1086,14 @@ WarnAsError="false" /> + + + + + + + + + + + + + + +