[pypy-svn] r64867 - in pypy/branch/pyjitpl5/pypy/jit/backend/x86: . test
afa at codespeak.net
afa at codespeak.net
Thu Apr 30 17:15:39 CEST 2009
Author: afa
Date: Thu Apr 30 17:15:38 2009
New Revision: 64867
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/ri386setup.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_runner.py
Log:
Fix test_runner on Windows, where sizeof(UniChar)==2.
Please check: it's the very first time I touch assembler.
At least this should not change anything if sizeof(UniChar)==4.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py Thu Apr 30 17:15:38 2009
@@ -624,8 +624,13 @@
base_loc, ofs_loc, val_loc = arglocs
basesize, itemsize, ofs_length = symbolic.get_array_token(rstr.UNICODE,
self.cpu.translate_support_code)
- assert itemsize == 4
- self.mc.MOV(addr_add(base_loc, ofs_loc, basesize, 2), val_loc)
+ if itemsize == 4:
+ self.mc.MOV(addr_add(base_loc, ofs_loc, basesize, 2), val_loc)
+ elif itemsize == 2:
+ self.mc.O16()
+ self.mc.MOV(addr_add(base_loc, ofs_loc, basesize, 1), val_loc)
+ else:
+ assert 0, itemsize
genop_discard_setfield_raw = genop_discard_setfield_gc
@@ -656,8 +661,12 @@
base_loc, ofs_loc = arglocs
basesize, itemsize, ofs_length = symbolic.get_array_token(rstr.UNICODE,
self.cpu.translate_support_code)
- assert itemsize == 4
- self.mc.MOV(resloc, addr_add(base_loc, ofs_loc, basesize, 2))
+ if itemsize == 4:
+ self.mc.MOV(resloc, addr_add(base_loc, ofs_loc, basesize, 2))
+ elif itemsize == 2:
+ self.mc.MOVZX(resloc, addr_add(base_loc, ofs_loc, basesize, 1))
+ else:
+ assert 0, itemsize
def make_merge_point(self, tree, locs):
pos = self.mc.tell()
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 Thu Apr 30 17:15:38 2009
@@ -907,9 +907,14 @@
def consider_newunicode(self, op, ignored):
ofs_items, itemsize, ofs = symbolic.get_array_token(rstr.UNICODE, self.translate_support_code)
- assert itemsize == 4
- return self._malloc_varsize(0, ofs_items, ofs, 2, op.args[0],
- op.result)
+ if itemsize == 4:
+ return self._malloc_varsize(0, ofs_items, ofs, 2, op.args[0],
+ op.result)
+ elif itemsize == 2:
+ return self._malloc_varsize(0, ofs_items, ofs, 1, op.args[0],
+ op.result)
+ else:
+ assert False, itemsize
def _malloc_varsize(self, ofs, ofs_items, ofs_length, size, v, res_v):
if isinstance(v, Box):
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/ri386setup.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/ri386setup.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/ri386setup.py Thu Apr 30 17:15:38 2009
@@ -494,8 +494,8 @@
UD2 = Instruction() # reserved as an illegal instruction
UD2.mode0(['\x0F\x0B'])
-o16 = Instruction() # 16-bits instruction prefix (name from 'nasm')
-o16.mode0(['\x66'])
+O16 = Instruction() # 16-bits instruction prefix (name from 'nasm')
+O16.mode0(['\x66'])
Conditions = {
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_runner.py Thu Apr 30 17:15:38 2009
@@ -131,6 +131,7 @@
ConstInt(ord(u'z'))],
'void')
assert u.chars[2] == u'z'
+ assert u.chars[3] == u'd'
def test_allocations(self):
More information about the Pypy-commit
mailing list