[pypy-svn] r35224 - in pypy/branch/jit-real-world/pypy/jit/codegen/i386: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Dec 3 20:18:06 CET 2006
Author: arigo
Date: Sun Dec 3 20:18:03 2006
New Revision: 35224
Modified:
pypy/branch/jit-real-world/pypy/jit/codegen/i386/ri386setup.py
pypy/branch/jit-real-world/pypy/jit/codegen/i386/test/test_operation.py
Log:
(pedronis, arigo)
Added missing encoding for LEA. Changed the multimethd installer
version used around here so that tests show the problem -- not just
fully-compiled pypy-c's :-(
Modified: pypy/branch/jit-real-world/pypy/jit/codegen/i386/ri386setup.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/codegen/i386/ri386setup.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/codegen/i386/ri386setup.py Sun Dec 3 20:18:03 2006
@@ -5,7 +5,7 @@
"""
from ri386 import *
-from pypy.objspace.std.multimethod import MultiMethodTable
+from pypy.objspace.std.multimethod import MultiMethodTable, InstallerVersion2
from pypy.tool.sourcetools import compile2
def reg2modrm(builder, reg):
@@ -193,7 +193,11 @@
assert issubclass(cls, OPERAND)
encoder1 = generate_function(sig, opcodes)
table.register(encoder1, *sig)
- encoder = table.install('__encode' + name, [type_order] * arity)
+ # always use the InstallerVersion2, including for testing,
+ # because it produces code that is more sensitive to
+ # registration errors
+ encoder = table.install('__encode' + name, [type_order] * arity,
+ installercls = InstallerVersion2)
mmmin = min([len(mm) for mm in self.modes])
if mmmin < arity:
encoder.func_defaults = (missing,) * (arity - mmmin)
@@ -384,10 +388,10 @@
XCHG.mode2(REG8, MODRM8, ['\x86', register(1,8,'b'), modrm(2,'b')])
LEA = Instruction()
-LEA.mode2(REG, MODRM, ['\x8D', register(1,8), modrm(2)])
-#for key in LEA.encodings.keys():
-# if key[1] != MODRM:
-# del LEA.encodings[key]
+LEA.mode2(REG, MODRM, ['\x8D', register(1,8), modrm(2)])
+LEA.mode2(REG, MODRM8, ['\x8D', register(1,8), modrm(2)])
+# some cases produce a MODRM8, but the result is always a 32-bit REG
+# and the encoding is the same
SHL = Instruction()
SHL.mode2(MODRM, IMM8, ['\xC1', orbyte(4<<3), modrm(1), immediate(2,'b')])
Modified: pypy/branch/jit-real-world/pypy/jit/codegen/i386/test/test_operation.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/codegen/i386/test/test_operation.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/codegen/i386/test/test_operation.py Sun Dec 3 20:18:03 2006
@@ -148,6 +148,19 @@
for i in range(5):
assert fp(i) == fn(i)
+ def test_char_varsize_array(self):
+ A = lltype.GcArray(lltype.Char)
+ def fn(n):
+ a = lltype.malloc(A, n)
+ a[4] = 'H'
+ a[3] = 'e'
+ a[2] = 'l'
+ a[1] = 'l'
+ a[0] = 'o'
+ return ord(a[n-1])
+ fp = self.rgen(fn, [int])
+ assert fp(5) == fn(5)
+
def test_unichar_array(self):
A = lltype.GcArray(lltype.UniChar)
def fn(n):
More information about the Pypy-commit
mailing list