[pypy-svn] r79695 - pypy/branch/jit-free-asm2/pypy/jit/backend/x86
arigo at codespeak.net
arigo at codespeak.net
Tue Nov 30 18:15:41 CET 2010
Author: arigo
Date: Tue Nov 30 18:15:40 2010
New Revision: 79695
Modified:
pypy/branch/jit-free-asm2/pypy/jit/backend/x86/assembler.py
pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regalloc.py
pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regloc.py
Log:
Kill code, using the datablockwrapper instead.
Modified: pypy/branch/jit-free-asm2/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/jit-free-asm2/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/jit-free-asm2/pypy/jit/backend/x86/assembler.py Tue Nov 30 18:15:40 2010
@@ -56,7 +56,6 @@
DEBUG_COUNTER = lltype.Struct('DEBUG_COUNTER', ('i', lltype.Signed))
class Assembler386(object):
- _float_constants = None
_regalloc = None
_output_loop_log = None
Modified: pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regalloc.py Tue Nov 30 18:15:40 2010
@@ -60,32 +60,6 @@
r15: 5,
}
-class FloatConstants(object):
- BASE_CONSTANT_SIZE = 1000
-
- def __init__(self):
- self.cur_array_free = 0
- self.const_id = 0
-
- def _get_new_array(self):
- n = self.BASE_CONSTANT_SIZE
- # known to leak
- self.cur_array = lltype.malloc(rffi.CArray(lltype.Float), n, # YYY leak
- flavor='raw', track_allocation=False)
- self.cur_array_free = n
- _get_new_array._dont_inline_ = True
-
- def record_float(self, floatval):
- if self.cur_array_free == 0:
- self._get_new_array()
- arr = self.cur_array
- n = self.cur_array_free - 1
- arr[n] = floatval
- self.cur_array_free = n
- self.const_id += 1
- return (self.const_id, rffi.cast(lltype.Signed, arr) + n * 8)
-
-
class X86XMMRegisterManager(RegisterManager):
box_types = [FLOAT]
@@ -93,20 +67,11 @@
# we never need lower byte I hope
save_around_call_regs = all_regs
- def __init__(self, longevity, frame_manager=None, assembler=None):
- RegisterManager.__init__(self, longevity, frame_manager=frame_manager,
- assembler=assembler)
- if assembler is None:
- self.float_constants = FloatConstants()
- else:
- if assembler._float_constants is None:
- assembler._float_constants = FloatConstants()
- self.float_constants = assembler._float_constants
-
def convert_to_imm(self, c):
- const_id, adr = self.float_constants.record_float(c.getfloat())
- return ConstFloatLoc(adr, const_id)
-
+ adr = self.assembler.datablockwrapper.malloc_aligned(8, 8)
+ rffi.cast(rffi.CArrayPtr(rffi.DOUBLE), adr)[0] = c.getfloat()
+ return ConstFloatLoc(adr)
+
def after_call(self, v):
# the result is stored in st0, but we don't have this around,
# so genop_call will move it to some frame location immediately
Modified: pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regloc.py
==============================================================================
--- pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regloc.py (original)
+++ pypy/branch/jit-free-asm2/pypy/jit/backend/x86/regloc.py Tue Nov 30 18:15:40 2010
@@ -177,24 +177,15 @@
class ConstFloatLoc(AssemblerLocation):
# XXX: We have to use this class instead of just AddressLoc because
- # AddressLoc is "untyped" and also we to have need some sort of unique
- # identifier that we can use in _getregkey (for jump.py)
-
+ # we want a width of 8 (... I think. Check this!)
_immutable_ = True
-
width = 8
- def __init__(self, address, const_id):
+ def __init__(self, address):
self.value = address
- self.const_id = const_id
def __repr__(self):
- return '<ConstFloatLoc(%s, %s)>' % (self.value, self.const_id)
-
- def _getregkey(self):
- # XXX: 1000 is kind of magic: We just don't want to be confused
- # with any registers
- return 1000 + self.const_id
+ return '<ConstFloatLoc @%s>' % (self.value,)
def location_code(self):
return 'j'
More information about the Pypy-commit
mailing list