mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 18:53:58 +01:00
x86jit: Reduce block link padding.
Reduces bloat a good bit.
This commit is contained in:
1 parent
f698623645
commit
b370a89ef2
2 files changed
+7
-5
No files matched your search
@@ -64,7 +64,7 @@ void X64JitBackend::CompIR_Arith(IRInst inst) {
|
||||
|
||||
case IROp::Sub:
|
||||
regs_.Map(inst);
|
||||
if (inst.dest == inst.src2 && inst.dest == inst.src1) {
|
||||
if (inst.src1 == inst.src2) {
|
||||
regs_.SetGPRImm(inst.dest, 0);
|
||||
} else if (inst.dest == inst.src2) {
|
||||
NEG(32, regs_.R(inst.src2));
|
||||
|
||||
@@ -29,9 +29,10 @@ namespace MIPSComp {
|
||||
using namespace Gen;
|
||||
using namespace X64IRJitConstants;
|
||||
|
||||
// This should be enough for exits and invalidations.
|
||||
static constexpr int MIN_BLOCK_NORMAL_LEN = 16;
|
||||
static constexpr int MIN_BLOCK_EXIT_LEN = 16;
|
||||
// Invalidations just need a MOV and JMP.
|
||||
static constexpr int MIN_BLOCK_NORMAL_LEN = 10;
|
||||
// As long as we can fit a JMP, we should be fine.
|
||||
static constexpr int MIN_BLOCK_EXIT_LEN = 5;
|
||||
|
||||
X64JitBackend::X64JitBackend(JitOptions &jitopt, IRBlockCache &blocks)
|
||||
: IRNativeBackend(blocks), jo(jitopt), regs_(&jo) {
|
||||
@@ -109,7 +110,7 @@ bool X64JitBackend::CompileBlock(IRBlock *block, int block_num, bool preload) {
|
||||
|
||||
int len = (int)GetOffset(GetCodePointer()) - block->GetTargetOffset();
|
||||
if (len < MIN_BLOCK_NORMAL_LEN) {
|
||||
// We need at least 16 bytes to invalidate blocks with, but larger doesn't need to align.
|
||||
// We need at least 10 bytes to invalidate blocks with.
|
||||
ReserveCodeSpace(MIN_BLOCK_NORMAL_LEN - len);
|
||||
}
|
||||
|
||||
@@ -198,6 +199,7 @@ void X64JitBackend::OverwriteExit(int srcOffset, int len, int block_num) {
|
||||
XEmitter emitter(writable);
|
||||
emitter.JMP(GetBasePtr() + nativeBlock->checkedOffset, true);
|
||||
int bytesWritten = (int)(emitter.GetWritableCodePtr() - writable);
|
||||
_dbg_assert_(bytesWritten <= MIN_BLOCK_EXIT_LEN);
|
||||
if (bytesWritten < len)
|
||||
emitter.ReserveCodeSpace(len - bytesWritten);
|
||||
|
||||
|
||||
Reference in new issue
Block a user