[pypy-svn] r68222 - in pypy/trunk/pypy/jit/backend: test x86

benjamin at codespeak.net benjamin at codespeak.net
Wed Oct 7 02:20:57 CEST 2009


Author: benjamin
Date: Wed Oct  7 02:20:56 2009
New Revision: 68222

Modified:
   pypy/trunk/pypy/jit/backend/test/runner_test.py
   pypy/trunk/pypy/jit/backend/x86/assembler.py
   pypy/trunk/pypy/jit/backend/x86/regalloc.py
Log:
(benjamin, fijal advising) generate code for GETFIELD_RAW_PURE


Modified: pypy/trunk/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/test/runner_test.py	(original)
+++ pypy/trunk/pypy/jit/backend/test/runner_test.py	Wed Oct  7 02:20:56 2009
@@ -980,6 +980,20 @@
         assert s.x == chr(190)
         assert s.y == chr(150)
 
+    def test_field_raw_pure(self):
+        # This is really testing the same thing as test_field_basic but can't
+        # hurt...
+        S = lltype.Struct('S', ('x', lltype.Signed))
+        s = lltype.malloc(S, flavor='raw')
+        s_box = BoxInt(rffi.cast(lltype.Signed, s))
+        for get_op, set_op in ((rop.GETFIELD_RAW, rop.SETFIELD_RAW),
+                               (rop.GETFIELD_RAW_PURE, rop.SETFIELD_RAW)):
+            fd = self.cpu.fielddescrof(S, 'x')
+            self.execute_operation(set_op, [s_box, BoxInt(32)], 'void',
+                                   descr=fd)
+            res = self.execute_operation(get_op, [s_box], 'int', descr=fd)
+            assert res.getint()  == 32
+
     def test_new_with_vtable(self):
         cpu = self.cpu
         t_box, T_box = self.alloc_instance(self.T)

Modified: pypy/trunk/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/assembler.py	Wed Oct  7 02:20:56 2009
@@ -558,6 +558,8 @@
         else:
             raise NotImplementedError("getfield size = %d" % size)
 
+    genop_getfield_raw = genop_getfield_gc
+    genop_getfield_raw_pure = genop_getfield_gc
     genop_getfield_gc_pure = genop_getfield_gc
 
     def genop_getarrayitem_gc(self, op, arglocs, resloc):
@@ -578,7 +580,6 @@
                 print "[asmgen]setarrayitem unsupported size: %d" % scale.value
                 raise NotImplementedError()
 
-    genop_getfield_raw = genop_getfield_gc
     genop_getarrayitem_gc_pure = genop_getarrayitem_gc
 
     def genop_discard_setfield_gc(self, op, arglocs):

Modified: pypy/trunk/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/regalloc.py	Wed Oct  7 02:20:56 2009
@@ -766,6 +766,7 @@
         self.Perform(op, [base_loc, ofs_loc, size_loc], result_loc)
 
     consider_getfield_raw = consider_getfield_gc
+    consider_getfield_raw_pure = consider_getfield_gc
     consider_getfield_gc_pure = consider_getfield_gc
 
     def consider_getarrayitem_gc(self, op, ignored):



More information about the Pypy-commit mailing list