More include cleanup. Hoping for very slightly faster compile times..

This commit is contained in:
Henrik Rydgård
2013-12-30 10:49:05 +01:00
parent 00c32ddadb
commit e5e17fbc6e
23 changed files with 125 additions and 137 deletions
+39 -4
View File
@@ -15,14 +15,13 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "ArmEmitter.h"
#include "CPUDetect.h"
#include "base/logging.h"
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
// For cache flushing on Symbian/iOS/Blackberry
#ifdef __SYMBIAN32__
@@ -38,6 +37,10 @@
#include <sys/mman.h>
#endif
#include "MemoryUtil.h"
#include "ArmEmitter.h"
#include "CPUDetect.h"
// __FUNCTION__ is misused a lot below, it's no longer a string literal but a virtual
// variable so this use fails in some compilers. Just define it away for now.
#ifndef _MSC_VER
@@ -115,7 +118,7 @@ bool ARMXEmitter::TrySetValue_TwoOp(ARMReg reg, u32 val)
}
if (ops > 2)
return false;
bool first = true;
for (int i = 0; i < 16; i++, val >>=2) {
if (val & 0x3) {
@@ -2589,4 +2592,36 @@ void ARMXEmitter::VCVTF16F32(ARMReg Dest, ARMReg Src) {
Write32((0xF3B6 << 16) | ((Dest & 0x10) << 18) | ((Dest & 0xF) << 12) | 0x600 | (op << 8) | ((Src & 0x10) << 1) | (Src & 0xF));
}
void ARMXCodeBlock::AllocCodeSpace(int size) {
region_size = size;
region = (u8*)AllocateExecutableMemory(region_size);
SetCodePtr(region);
}
// Always clear code space with breakpoints, so that if someone accidentally executes
// uninitialized, it just breaks into the debugger.
void ARMXCodeBlock::ClearCodeSpace() {
// x86/64: 0xCC = breakpoint
memset(region, 0xCC, region_size);
ResetCodePtr();
}
void ARMXCodeBlock::FreeCodeSpace() {
#ifdef __SYMBIAN32__
ResetExecutableMemory(region);
#else
FreeMemoryPages(region, region_size);
#endif
region = NULL;
region_size = 0;
}
void ARMXCodeBlock::WriteProtect() {
WriteProtectMemory(region, region_size, true);
}
void ARMXCodeBlock::UnWriteProtect() {
UnWriteProtectMemory(region, region_size, false);
}
}
+7 -32
View File
@@ -20,12 +20,12 @@
#ifndef _DOLPHIN_ARM_CODEGEN_
#define _DOLPHIN_ARM_CODEGEN_
#include <vector>
#include "Common.h"
#include "MemoryUtil.h"
#if defined(__SYMBIAN32__) || defined(PANDORA)
#include <signal.h>
#endif
#include <vector>
#undef R0
@@ -808,33 +808,14 @@ public:
virtual ~ARMXCodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code.
void AllocCodeSpace(int size)
{
region_size = size;
region = (u8*)AllocateExecutableMemory(region_size);
SetCodePtr(region);
}
void AllocCodeSpace(int size);
// Always clear code space with breakpoints, so that if someone accidentally executes
// uninitialized, it just breaks into the debugger.
void ClearCodeSpace()
{
// x86/64: 0xCC = breakpoint
memset(region, 0xCC, region_size);
ResetCodePtr();
}
void ClearCodeSpace();
// Call this when shutting down. Don't rely on the destructor, even though it'll do the job.
void FreeCodeSpace()
{
#ifdef __SYMBIAN32__
ResetExecutableMemory(region);
#else
FreeMemoryPages(region, region_size);
#endif
region = NULL;
region_size = 0;
}
void FreeCodeSpace();
bool IsInSpace(const u8 *ptr) const
{
@@ -843,14 +824,8 @@ public:
// Cannot currently be undone. Will write protect the entire code region.
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
void WriteProtect()
{
WriteProtectMemory(region, region_size, true);
}
void UnWriteProtect()
{
UnWriteProtectMemory(region, region_size, false);
}
void WriteProtect();
void UnWriteProtect();
void ResetCodePtr()
{
+1 -1
View File
@@ -317,7 +317,7 @@ public:
if (vec_size > 0)
DoArray(&x[0], vec_size);
}
// Store deques.
template<class T>
void Do(std::deque<T *> &x)
-3
View File
@@ -21,9 +21,6 @@
// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
// since it slows down the build a lot.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#ifdef _MSC_VER
+2
View File
@@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <string>
#include "MemoryUtil.h"
#include "MemArena.h"
+4 -5
View File
@@ -21,7 +21,6 @@
#ifndef _WIN32
#include <sys/mman.h>
#endif
#include <string>
void* AllocateExecutableMemory(size_t size, bool low = true);
void* AllocateMemoryPages(size_t size);
@@ -39,15 +38,15 @@ inline int GetPageSize() { return 4096; }
template <typename T>
class SimpleBuf {
public:
SimpleBuf() : buf_(NULL), size_(0) {
SimpleBuf() : buf_(0), size_(0) {
}
SimpleBuf(size_t size) : buf_(NULL) {
SimpleBuf(size_t size) : buf_(0) {
resize(size);
}
~SimpleBuf() {
if (buf_ != NULL) {
if (buf_ != 0) {
FreeMemoryPages(buf_, size_ * sizeof(T));
}
}
@@ -59,7 +58,7 @@ public:
// Doesn't preserve contents.
void resize(size_t size) {
if (size_ < size) {
if (buf_ != NULL) {
if (buf_ != 0) {
FreeMemoryPages(buf_, size_ * sizeof(T));
}
buf_ = (T *)AllocateMemoryPages(size * sizeof(T));
+2
View File
@@ -17,6 +17,8 @@
#include "Common.h"
#include <string.h>
#if defined(__APPLE__) || defined(__SYMBIAN32__)
#define __thread
#endif
-16
View File
@@ -18,7 +18,6 @@
#ifndef _STRINGUTIL_H_
#define _STRINGUTIL_H_
#include <iomanip>
#include <base/stringutil.h>
#include "Common.h"
@@ -37,21 +36,6 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
va_end(args);
}
// Thousand separator. Turns 12345678 into 12,345,678
template <typename I>
std::string ThousandSeparate(I value, int spaces = 0)
{
std::ostringstream oss;
// std::locale("") seems to be broken on many platforms
#if defined _WIN32 || (defined __linux__ && !defined __clang__)
oss.imbue(std::locale(""));
#endif
oss << std::setw(spaces) << value;
return oss.str();
}
// "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe"
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
+1 -1
View File
@@ -532,4 +532,4 @@ typedef s64 s64_be;
typedef float float_be;
typedef double double_be;
#endif
#endif
+24 -2
View File
@@ -18,6 +18,7 @@
#include "x64Emitter.h"
#include "ABI.h"
#include "CPUDetect.h"
#include "MemoryUtil.h"
namespace Gen
{
@@ -1481,12 +1482,33 @@ void XEmitter::LOCK() { Write8(0xF0); }
void XEmitter::REP() { Write8(0xF3); }
void XEmitter::REPNE() { Write8(0xF2); }
void XEmitter::FWAIT()
{
void XEmitter::FWAIT() {
Write8(0x9B);
}
void XEmitter::RTDSC() { Write8(0x0F); Write8(0x31); }
void XCodeBlock::AllocCodeSpace(int size) {
region_size = size;
region = (u8*)AllocateExecutableMemory(region_size);
SetCodePtr(region);
}
void XCodeBlock::ClearCodeSpace() {
// x86/64: 0xCC = breakpoint
memset(region, 0xCC, region_size);
ResetCodePtr();
}
void XCodeBlock::FreeCodeSpace() {
FreeMemoryPages(region, region_size);
region = NULL;
region_size = 0;
}
void XCodeBlock::WriteProtect() {
WriteProtectMemory(region, region_size, true);
}
} // Gen
+4 -23
View File
@@ -21,7 +21,6 @@
#define _DOLPHIN_INTEL_CODEGEN_
#include "Common.h"
#include "MemoryUtil.h"
#if !defined(_M_IX86) && !defined(_M_X64)
#error "Don't build this on arm."
@@ -740,29 +739,14 @@ public:
virtual ~XCodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code.
void AllocCodeSpace(int size)
{
region_size = size;
region = (u8*)AllocateExecutableMemory(region_size);
SetCodePtr(region);
}
void AllocCodeSpace(int size);
// Always clear code space with breakpoints, so that if someone accidentally executes
// uninitialized, it just breaks into the debugger.
void ClearCodeSpace()
{
// x86/64: 0xCC = breakpoint
memset(region, 0xCC, region_size);
ResetCodePtr();
}
void ClearCodeSpace();
// Call this when shutting down. Don't rely on the destructor, even though it'll do the job.
void FreeCodeSpace()
{
FreeMemoryPages(region, region_size);
region = NULL;
region_size = 0;
}
void FreeCodeSpace();
bool IsInSpace(const u8 *ptr) const
{
@@ -771,10 +755,7 @@ public:
// Cannot currently be undone. Will write protect the entire code region.
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
void WriteProtect()
{
WriteProtectMemory(region, region_size, true);
}
void WriteProtect();
void ResetCodePtr()
{
+1
View File
@@ -18,6 +18,7 @@
#ifndef _CORETIMING_H
#define _CORETIMING_H
#include <string>
#include "Common/CommonTypes.h"
// This is a system to schedule events into the emulated machine's future. Time is measured
+1
View File
@@ -20,6 +20,7 @@
#include <vector>
#include <set>
#include <map>
#include <string>
#include "native/base/mutex.h"
+2
View File
@@ -1,3 +1,5 @@
#include <string.h>
extern "C"
{
#include "ext/libkirk/kirk_engine.h"
+1 -2
View File
@@ -17,7 +17,6 @@
#pragma once
#include <string>
#include "CommonTypes.h"
// This bool is the key to having the HD remasters work.
@@ -28,7 +27,7 @@ extern bool g_RemasterMode;
extern bool g_DoubleTextureCoordinates;
struct HDRemaster {
std::string gameID;
const char *gameID;
u32 MemorySize;
bool DoubleTextureCoordinates;
};
+1
View File
@@ -17,6 +17,7 @@
#pragma once
#include <string>
#include <vector>
// There's a good description of the thread scheduling rules in:
+2
View File
@@ -17,6 +17,8 @@
#pragma once
#include <string>
enum IdentifiedFileType {
FILETYPE_ERROR,
+1
View File
@@ -17,6 +17,7 @@
#pragma once
#include <string>
#include <vector>
#include "Common/CommonTypes.h"
+1 -16
View File
@@ -236,7 +236,7 @@ void Write_Opcode_JIT(const u32 _Address, const Opcode _Value)
}
void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
{
{
u8 *ptr = GetPointer(_Address);
if (ptr != NULL) {
memset(ptr, _iValue, _iLength);
@@ -251,21 +251,6 @@ void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
#endif
}
void GetString(std::string& _string, const u32 em_address)
{
char stringBuffer[2048];
char *string = stringBuffer;
char c;
u32 addr = em_address;
while ((c = Read_U8(addr)))
{
*string++ = c;
addr++;
}
*string++ = '\0';
_string = stringBuffer;
}
const char *GetAddressName(u32 address)
{
// TODO, follow GetPointer
+24 -26
View File
@@ -6,7 +6,7 @@
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
@@ -17,11 +17,11 @@
#pragma once
// Includes
#include <string>
#include "Common.h"
#include "CommonTypes.h"
#include <cstring>
// Includes
#include "Common/Common.h"
#include "Common/CommonTypes.h"
#include "HDRemaster.h"
// PPSSPP is very aggressive about trying to do memory accesses directly, for speed.
@@ -41,7 +41,7 @@ typedef void (*writeFn16)(const u16,const u32);
typedef void (*writeFn32)(const u32,const u32);
typedef void (*writeFn64)(const u64,const u32);
typedef void (*readFn8 )(u8&, const u32);
typedef void (*readFn8 )(u8&, const u32);
typedef void (*readFn16)(u16&, const u32);
typedef void (*readFn32)(u32&, const u32);
typedef void (*readFn64)(u64&, const u32);
@@ -49,7 +49,7 @@ typedef void (*readFn64)(u64&, const u32);
namespace Memory
{
// Base is a pointer to the base of the memory map. Yes, some MMU tricks
// are used to set up a full GC or Wii memory map in process memory. on
// are used to set up a full GC or Wii memory map in process memory. on
// 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that
// some things are mirrored too many times, but eh... it works.
@@ -89,15 +89,15 @@ enum
// Used if the PSP model is PSP-2000 (Slim).
RAM_DOUBLE_SIZE = RAM_NORMAL_SIZE * 2,
VRAM_SIZE = 0x200000,
VRAM_MASK = VRAM_SIZE - 1,
VRAM_SIZE = 0x200000,
VRAM_MASK = VRAM_SIZE - 1,
SCRATCHPAD_SIZE = 0x4000,
SCRATCHPAD_MASK = SCRATCHPAD_SIZE - 1,
#if defined(_M_IX86) || defined(_M_ARM32) || defined (_XBOX)
// This wraparound should work for PSP too.
MEMVIEW32_MASK = 0x3FFFFFFF,
// This wraparound should work for PSP too.
MEMVIEW32_MASK = 0x3FFFFFFF,
#endif
};
@@ -141,7 +141,7 @@ void Write_Opcode_JIT(const u32 _Address, const Opcode _Value);
// Should be used by analyzers, disassemblers etc. Does resolve replacements.
Opcode Read_Instruction(const u32 _Address, bool resolveReplacements = false);
u8 Read_U8(const u32 _Address);
u8 Read_U8(const u32 _Address);
u16 Read_U16(const u32 _Address);
u32 Read_U32(const u32 _Address);
u64 Read_U64(const u32 _Address);
@@ -170,9 +170,9 @@ void WriteUnchecked_U32(const u32 _Data, const u32 _Address);
inline u32 ReadUnchecked_U32(const u32 address) {
#if defined(_M_IX86) || defined(_M_ARM32) || defined (_XBOX)
return *(u32_le *)(base + (address & MEMVIEW32_MASK));
return *(u32_le *)(base + (address & MEMVIEW32_MASK));
#else
return *(u32_le *)(base + address);
return *(u32_le *)(base + address);
#endif
}
@@ -220,10 +220,10 @@ inline void WriteUnchecked_U8(u8 data, u32 address) {
inline float Read_Float(u32 address)
{
u32 ifloat = Read_U32(address);
float f;
memcpy(&f, &ifloat, sizeof(float));
return f;
u32 ifloat = Read_U32(address);
float f;
memcpy(&f, &ifloat, sizeof(float));
return f;
}
// used by JIT. Return zero-extended 32bit values
@@ -237,19 +237,17 @@ void Write_U64(const u64 data, const u32 address);
inline void Write_Float(float f, u32 address)
{
u32 u;
memcpy(&u, &f, sizeof(float));
Write_U32(u, address);
u32 u;
memcpy(&u, &f, sizeof(float));
Write_U32(u, address);
}
// Reads a zero-terminated string from memory at the address.
void GetString(std::string& _string, const u32 _Address);
u8* GetPointer(const u32 address);
bool IsRAMAddress(const u32 address);
bool IsVRAMAddress(const u32 address);
inline const char* GetCharPointer(const u32 address) {
return (const char *)GetPointer(address);
return (const char *)GetPointer(address);
}
void Memset(const u32 _Address, const u8 _Data, const u32 _iLength);
@@ -438,8 +436,8 @@ inline u32 PSP_GetScratchpadMemoryBase() { return 0x00010000;}
inline u32 PSP_GetScratchpadMemoryEnd() { return 0x00014000;}
inline u32 PSP_GetKernelMemoryBase() { return 0x08000000;}
inline u32 PSP_GetUserMemoryEnd() { return PSP_GetKernelMemoryBase() + Memory::g_MemorySize;}
inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;}
inline u32 PSP_GetUserMemoryEnd() { return PSP_GetKernelMemoryBase() + Memory::g_MemorySize;}
inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;}
// "Volatile" RAM is between 0x08400000 and 0x08800000, can be requested by the
// game through sceKernelVolatileMemTryLock.
+3 -2
View File
@@ -17,11 +17,12 @@
#pragma once
#include <vector>
#include <string>
#include "GPU/GPUInterface.h"
#include "GPU/GPUState.h"
#include "Core/MemMap.h"
#include <vector>
#include <string>
struct GPUDebugOp {
u32 pc;
+3 -3
View File
@@ -17,12 +17,12 @@
#pragma once
#include "Globals.h"
#include <list>
#include <string>
#include "GPU/GPUState.h"
#include "Core/HLE/sceKernelThread.h"
#include "Core/HLE/sceGe.h"
#include <list>
#include <string>
class PointerWrap;
+1 -1
View File
@@ -19,7 +19,7 @@
#include "CommonTypes.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "../Math3D.h"
#include "GPU/Math3D.h"
using namespace Math3D;