mirror of
https://github.com/libretro/Play-.git
synced 2025-02-15 17:18:44 +00:00
MacOS compilation fixes
git-svn-id: http://svn.purei.org/purei/trunk@667 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
34124bd39c
commit
2deae66fb7
@ -1,4 +1,5 @@
|
||||
#include <assert.h>
|
||||
#include <stdexcept>
|
||||
#include "ArmAssembler.h"
|
||||
|
||||
CArmAssembler::CArmAssembler() :
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <assert.h>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include "Jitter.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
@ -690,9 +691,9 @@ void CJitter::HarmonizeBlocks()
|
||||
if(nextBlockIterator == m_basicBlocks.end()) continue;
|
||||
|
||||
BASIC_BLOCK& basicBlock(blockIterator->second);
|
||||
BASIC_BLOCK& nextBlock(nextBlockIterator->second);
|
||||
// BASIC_BLOCK& nextBlock(nextBlockIterator->second);
|
||||
|
||||
StatementList::const_iterator lastStatementIterator(basicBlock.statements.end());
|
||||
StatementList::iterator lastStatementIterator(basicBlock.statements.end());
|
||||
lastStatementIterator--;
|
||||
const STATEMENT& statement(*lastStatementIterator);
|
||||
if(statement.op != OP_JMP) continue;
|
||||
@ -1062,7 +1063,7 @@ void CJitter::ComputeLivenessAndPruneSymbols(BASIC_BLOCK& basicBlock)
|
||||
for(CSymbolTable::SymbolIterator symbolIterator(symbolTable.GetSymbolsBegin());
|
||||
symbolIterator != symbolTable.GetSymbolsEnd(); symbolIterator++)
|
||||
{
|
||||
SymbolPtr& symbol(*symbolIterator);
|
||||
SymbolPtr& symbol(const_cast<SymbolPtr&>(*symbolIterator));
|
||||
symbol->m_useCount = 0;
|
||||
|
||||
unsigned int statementIdx = 0;
|
||||
@ -1163,6 +1164,11 @@ unsigned int CJitter::AllocateStack(BASIC_BLOCK& basicBlock)
|
||||
return stackAlloc;
|
||||
}
|
||||
|
||||
static bool UseCountSymbolComparator(const CSymbol* symbol1, const CSymbol* symbol2)
|
||||
{
|
||||
return symbol1->m_useCount > symbol2->m_useCount;
|
||||
}
|
||||
|
||||
void CJitter::AllocateRegisters(BASIC_BLOCK& basicBlock)
|
||||
{
|
||||
if(basicBlock.statements.size() == 0) return;
|
||||
@ -1172,13 +1178,6 @@ void CJitter::AllocateRegisters(BASIC_BLOCK& basicBlock)
|
||||
CSymbolTable& symbolTable(basicBlock.symbolTable);
|
||||
StatementList& statements(basicBlock.statements);
|
||||
|
||||
struct UseCountSymbolComparator
|
||||
{
|
||||
bool operator()(const CSymbol* symbol1, const CSymbol* symbol2)
|
||||
{
|
||||
return symbol1->m_useCount > symbol2->m_useCount;
|
||||
}
|
||||
};
|
||||
typedef std::list<CSymbol*> UseCountSymbolSortedList;
|
||||
|
||||
UseCountSymbolSortedList sortedSymbols;
|
||||
@ -1187,7 +1186,7 @@ void CJitter::AllocateRegisters(BASIC_BLOCK& basicBlock)
|
||||
{
|
||||
sortedSymbols.push_back(symbolIterator->get());
|
||||
}
|
||||
sortedSymbols.sort(UseCountSymbolComparator());
|
||||
sortedSymbols.sort(UseCountSymbolComparator);
|
||||
|
||||
for(unsigned int i = 0; i < regCount; i++)
|
||||
{
|
||||
@ -1245,7 +1244,7 @@ void CJitter::AllocateRegisters(BASIC_BLOCK& basicBlock)
|
||||
}
|
||||
|
||||
//Find the final instruction where to dump registers to
|
||||
StatementList::const_iterator endInsertionPoint(statements.end());
|
||||
StatementList::iterator endInsertionPoint(statements.end());
|
||||
{
|
||||
StatementList::const_iterator endInstructionIterator(statements.end());
|
||||
endInstructionIterator--;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _JITTER_STATEMENT_H_
|
||||
|
||||
#include <list>
|
||||
#include <functional>
|
||||
#include "Jitter_SymbolRef.h"
|
||||
|
||||
namespace Jitter
|
||||
|
@ -133,8 +133,8 @@ namespace Jitter
|
||||
if(!symbol->IsRelative()) return false;
|
||||
uint32 base1 = m_valueLow;
|
||||
uint32 base2 = symbol->m_valueLow;
|
||||
uint32 end1 = base1 + GetSize();
|
||||
uint32 end2 = base2 + symbol->GetSize();
|
||||
// uint32 end1 = base1 + GetSize();
|
||||
// uint32 end2 = base2 + symbol->GetSize();
|
||||
if(abs(static_cast<int32>(base2 - base1)) < GetSize()) return true;
|
||||
if(abs(static_cast<int32>(base2 - base1)) < symbol->GetSize()) return true;
|
||||
return false;
|
||||
|
@ -1,9 +1,21 @@
|
||||
#ifdef AMD64
|
||||
#include "Jitter_CodeGen_x86_64.h"
|
||||
#else
|
||||
#include "Jitter_CodeGen_x86_32.h"
|
||||
#ifdef WIN32
|
||||
|
||||
#ifdef AMD64
|
||||
#include "Jitter_CodeGen_x86_64.h"
|
||||
#else
|
||||
#include "Jitter_CodeGen_x86_32.h"
|
||||
#endif
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
#include "TargetConditionals.h"
|
||||
#if !(TARGET_IPHONE_SIMULATOR)
|
||||
#include "Jitter_CodeGen_Arm.h"
|
||||
#else
|
||||
#include "Jitter_CodeGen_x86_64.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#include "Jitter_CodeGen_Arm.h"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
@ -33,13 +45,24 @@ TestFactoryFunction s_factories[] =
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#ifdef AMD64
|
||||
// Jitter::CJitter jitter(new Jitter::CCodeGen_x86_64());
|
||||
Jitter::CJitter jitter(new Jitter::CCodeGen_Arm());
|
||||
#elif defined(WIN32)
|
||||
Jitter::CJitter jitter(new Jitter::CCodeGen_x86_32());
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
|
||||
#ifdef AMD64
|
||||
Jitter::CJitter jitter(new Jitter::CCodeGen_x86_64());
|
||||
#else
|
||||
Jitter::CJitter jitter(new Jitter::CCodeGen_x86_32());
|
||||
#endif
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
#if !(TARGET_IPHONE_SIMULATOR)
|
||||
Jitter::CJitter jitter(new Jitter::CCodeGen_Arm());
|
||||
#else
|
||||
Jitter::CJitter jitter(new Jitter::CCodeGen_x86_64());
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
TestFactoryFunction* currentTestFactory = s_factories;
|
||||
while(!currentTestFactory->empty())
|
||||
{
|
||||
|
@ -15,10 +15,13 @@ CMemoryFunction::CMemoryFunction(const void* code, size_t size)
|
||||
{
|
||||
m_code = malloc(size);
|
||||
memcpy(m_code, code, size);
|
||||
|
||||
#ifdef WIN32
|
||||
DWORD oldProtect = 0;
|
||||
BOOL result = VirtualProtect(m_code, size, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
assert(result == TRUE);
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
CMemoryFunction::~CMemoryFunction()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <assert.h>
|
||||
#include <stdexcept>
|
||||
#include "X86Assembler.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "X86Assembler.h"
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -72,7 +72,7 @@ void CCrc32Test::CompileTestFunction(Jitter::CJitter& jitter)
|
||||
jitter.Begin();
|
||||
{
|
||||
jitter.PushCtx();
|
||||
jitter.Call(&CCrc32Test::GetNextByte, 1, true);
|
||||
jitter.Call(reinterpret_cast<void*>(&CCrc32Test::GetNextByte), 1, true);
|
||||
jitter.PullRel(offsetof(CONTEXT, nextByte));
|
||||
|
||||
jitter.PushRel(offsetof(CONTEXT, nextByte));
|
||||
@ -112,7 +112,7 @@ void CCrc32Test::CompileComputeFunction(Jitter::CJitter& jitter)
|
||||
jitter.PushRel(offsetof(CONTEXT, currentCrc));
|
||||
jitter.Xor();
|
||||
|
||||
jitter.Call(&CCrc32Test::GetTableValue, 1, true);
|
||||
jitter.Call(reinterpret_cast<void*>(&CCrc32Test::GetTableValue), 1, true);
|
||||
|
||||
jitter.PushRel(offsetof(CONTEXT, currentCrc));
|
||||
jitter.Srl(8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user