[pypy-svn] r67103 - in pypy/branch/pyjitpl5/pypy/jit/backend/x86: . test
fijal at codespeak.net
fijal at codespeak.net
Sun Aug 23 11:42:05 CEST 2009
Author: fijal
Date: Sun Aug 23 11:42:04 2009
New Revision: 67103
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py
Log:
A tiny performance fix about not using registers for moving away
vars. Should not matter too much but at least was easy
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py Sun Aug 23 11:42:04 2009
@@ -475,8 +475,13 @@
def move_variable_away(self, v, prev_loc):
reg = None
- loc = self.stack_loc(v)
- self.Store(v, prev_loc, loc)
+ if self.free_regs:
+ loc = self.free_regs.pop()
+ self.reg_bindings[v] = loc
+ self.Load(v, prev_loc, loc)
+ else:
+ loc = self.stack_loc(v)
+ self.Store(v, prev_loc, loc)
def force_result_in_reg(self, result_v, v, forbidden_vars):
""" Make sure that result is in the same register as v
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_regalloc.py Sun Aug 23 11:42:04 2009
@@ -130,6 +130,20 @@
None), None)
regalloc._check_invariants()
+ def test_move_away_does_not_spill(self):
+ regalloc = RegAlloc(MockAssembler(), DummyTree())
+ regalloc.position = 0
+ resbox = BoxInt()
+ box = BoxInt()
+ regalloc.reg_bindings = {box: eax}
+ regalloc.free_regs = [ebx, ecx, edx, esi, edi]
+ regalloc._check_invariants()
+ regalloc.longevity = {resbox: (0, 1), box: (0, 1)}
+ regalloc.consider_int_add(ResOperation(rop.INT_ADD, [box, ConstInt(1)],
+ resbox), None)
+ regalloc._check_invariants()
+ assert len(regalloc.assembler.stores) == 0
+
class BaseTestRegalloc(object):
cpu = CPU(None, None)
More information about the Pypy-commit
mailing list