[pypy-svn] r22547 - in pypy/dist/pypy: rpython translator/c/src

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Jan 23 19:28:17 CET 2006


Author: cfbolz
Date: Mon Jan 23 19:28:13 2006
New Revision: 22547

Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/raddress.py
   pypy/dist/pypy/translator/c/src/address.h
Log:
cfbolz, arigo and samuele around

replace some of the operations that are obsole now that Offsets are Signeds on
l2 level with the regular int version


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Mon Jan 23 19:28:13 2006
@@ -662,6 +662,14 @@
                 return func(x, y)
         """ % locals()).compile()
     
+    op_original_int_add = op_int_add
+
+    def op_int_add(self, x, y):
+        if isinstance(x, llmemory.OffsetOf):
+            return x + y
+        else:
+            return self.op_original_int_add(x, y)
+    
     def op_unichar_eq(self, x, y):
         assert isinstance(x, unicode) and len(x) == 1
         assert isinstance(y, unicode) and len(y) == 1

Modified: pypy/dist/pypy/rpython/raddress.py
==============================================================================
--- pypy/dist/pypy/rpython/raddress.py	(original)
+++ pypy/dist/pypy/rpython/raddress.py	Mon Jan 23 19:28:13 2006
@@ -127,9 +127,9 @@
 class __extend__(pairtype(OffsetRepr, OffsetRepr)):
     def rtype_add((r_offset1, r_offset2), hop):
         v_offset1, v_offset2 = hop.inputargs(offset_repr, offset_repr)
-        return hop.genop('offset_add', [v_offset1, v_offset2], resulttype=lltype.Signed)
+        return hop.genop('int_add', [v_offset1, v_offset2], resulttype=lltype.Signed)
 
 class __extend__(pairtype(AddressRepr, OffsetRepr)):
     def rtype_add((r_offset1, r_offset2), hop):
         v_offset1, v_offset2 = hop.inputargs(Address, offset_repr)
-        return hop.genop('adr_offset_add', [v_offset1, v_offset2], resulttype=Address)
+        return hop.genop('adr_add', [v_offset1, v_offset2], resulttype=Address)

Modified: pypy/dist/pypy/translator/c/src/address.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/address.h	(original)
+++ pypy/dist/pypy/translator/c/src/address.h	Mon Jan 23 19:28:13 2006
@@ -8,7 +8,6 @@
 #define OP_ADR_DELTA(x,y,r,err) r = ((char *)(x) - (char *)(y))
 #define OP_ADR_SUB(x,y,r,err)   r = ((char *)(x) - (y))
 #define OP_ADR_ADD(x,y,r,err)   r = ((char *)(x) + (y))
-#define OP_ADR_OFFSET_ADD(x,y,r,err)   r = ((char *)(x) + (y))
 
 #define OP_ADR_EQ(x,y,r,err)	  r = ((x) == (y))
 #define OP_ADR_NE(x,y,r,err)	  r = ((x) != (y))



More information about the Pypy-commit mailing list