Skip to content

Commit

Permalink
Merge pull request #4626 from lioncash/size
Browse files Browse the repository at this point in the history
CodeBlock: Get rid of implicit sign-conversion in AllocCodeSpace
  • Loading branch information
Parlane committed Jan 8, 2017
2 parents 27d7c26 + 9d8e865 commit c89aa79
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Source/Core/Common/CodeBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

#pragma once

#include <cstddef>

#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/MemoryUtil.h"
#include "Common/NonCopyable.h"

Expand Down Expand Up @@ -39,7 +42,7 @@ class CodeBlock : public T, NonCopyable
}

// Call this before you generate any code.
void AllocCodeSpace(int size, bool need_low = true)
void AllocCodeSpace(size_t size, bool need_low = true)
{
region_size = size;
region = static_cast<u8*>(Common::AllocateExecutableMemory(region_size, need_low));
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/Jit64Common/FarCodeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Core/PowerPC/Jit64Common/FarCodeCache.h"

void FarCodeCache::Init(int size)
void FarCodeCache::Init(size_t size)
{
AllocCodeSpace(size);
m_enabled = true;
Expand Down
7 changes: 4 additions & 3 deletions Source/Core/Core/PowerPC/Jit64Common/FarCodeCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@

#pragma once

#include <cstddef>
#include "Common/x64Emitter.h"

// a bit of a hack; the MMU results in a vast amount more code ending up in the far cache,
// mostly exception handling, so give it a whole bunch more space if the MMU is on.
constexpr int FARCODE_SIZE = 1024 * 1024 * 8;
constexpr int FARCODE_SIZE_MMU = 1024 * 1024 * 48;
constexpr size_t FARCODE_SIZE = 1024 * 1024 * 8;
constexpr size_t FARCODE_SIZE_MMU = 1024 * 1024 * 48;

// A place to throw blocks of code we don't want polluting the cache, e.g. rarely taken
// exception branches.
class FarCodeCache : public Gen::X64CodeBlock
{
public:
void Init(int size);
void Init(size_t size);
void Shutdown();

bool Enabled() const;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/PowerPC/Jit64Common/Jit64Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <cstddef>
#include <cstdint>

#include "Common/CommonTypes.h"
Expand Down Expand Up @@ -32,7 +33,7 @@ constexpr Gen::X64Reg RMEM = Gen::RBX;
// to address as much as possible in a one-byte offset form.
constexpr Gen::X64Reg RPPCSTATE = Gen::RBP;

constexpr int CODE_SIZE = 1024 * 1024 * 32;
constexpr size_t CODE_SIZE = 1024 * 1024 * 32;

class Jitx86Base : public JitBase, public QuantizedMemoryRoutines
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/Jit64Common/TrampolineCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

using namespace Gen;

void TrampolineCache::Init(int size)
void TrampolineCache::Init(size_t size)
{
AllocCodeSpace(size);
}
Expand Down
7 changes: 4 additions & 3 deletions Source/Core/Core/PowerPC/Jit64Common/TrampolineCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

#pragma once

#include <cstddef>
#include "Common/CommonTypes.h"
#include "Core/PowerPC/Jit64Common/EmuCodeBlock.h"

struct TrampolineInfo;

// a bit of a hack; the MMU results in more code ending up in the trampoline cache,
// because fastmem results in far more backpatches in MMU mode
constexpr int TRAMPOLINE_CODE_SIZE = 1024 * 1024 * 8;
constexpr int TRAMPOLINE_CODE_SIZE_MMU = 1024 * 1024 * 32;
constexpr size_t TRAMPOLINE_CODE_SIZE = 1024 * 1024 * 8;
constexpr size_t TRAMPOLINE_CODE_SIZE_MMU = 1024 * 1024 * 32;

// We need at least this many bytes for backpatching.
constexpr int BACKPATCH_SIZE = 5;
Expand All @@ -23,7 +24,7 @@ class TrampolineCache : public EmuCodeBlock
const u8* GenerateWriteTrampoline(const TrampolineInfo& info);

public:
void Init(int size);
void Init(size_t size);
void Shutdown();
const u8* GenerateTrampoline(const TrampolineInfo& info);
void ClearCodeSpace();
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/PowerPC/JitArm64/Jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <cstddef>
#include <map>
#include <tuple>

Expand All @@ -17,8 +18,8 @@
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/PPCAnalyst.h"

constexpr int CODE_SIZE = 1024 * 1024 * 32;
constexpr int FARCODE_SIZE_MMU = 1024 * 1024 * 48;
constexpr size_t CODE_SIZE = 1024 * 1024 * 32;
constexpr size_t FARCODE_SIZE_MMU = 1024 * 1024 * 48;

class JitArm64 : public JitBase, public Arm64Gen::ARM64CodeBlock, public CommonAsmRoutinesBase
{
Expand Down

0 comments on commit c89aa79

Please sign in to comment.