[pypy-svn] r22637 - in pypy/dist/pypy: annotation rpython rpython/lltypesystem rpython/memory/test

mwh at codespeak.net mwh at codespeak.net
Wed Jan 25 11:47:46 CET 2006


Author: mwh
Date: Wed Jan 25 11:47:41 2006
New Revision: 22637

Modified:
   pypy/dist/pypy/annotation/binaryop.py
   pypy/dist/pypy/annotation/builtin.py
   pypy/dist/pypy/annotation/model.py
   pypy/dist/pypy/rpython/lltypesystem/llmemory.py
   pypy/dist/pypy/rpython/memory/test/test_address.py
   pypy/dist/pypy/rpython/raddress.py
   pypy/dist/pypy/rpython/rbuiltin.py
   pypy/dist/pypy/rpython/rint.py
Log:
(cfbolz, mwh)
Kill off SomeOffset.  It's all SomeIntegers now. 


Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py	(original)
+++ pypy/dist/pypy/annotation/binaryop.py	Wed Jan 25 11:47:41 2006
@@ -11,7 +11,7 @@
 from pypy.annotation.model import SomeTuple, SomeImpossibleValue, s_ImpossibleValue
 from pypy.annotation.model import SomeInstance, SomeBuiltin, SomeIterator
 from pypy.annotation.model import SomePBC, SomeSlice, SomeFloat, s_None
-from pypy.annotation.model import SomeExternalObject, SomeOffset
+from pypy.annotation.model import SomeExternalObject
 from pypy.annotation.model import SomeAddress, SomeTypedAddressAccess
 from pypy.annotation.model import unionof, UnionError, set, missing_operation, TLS
 from pypy.annotation.model import add_knowntypedata, merge_knowntypedata
@@ -732,15 +732,3 @@
 class __extend__(pairtype(SomeObject, SomeAddress)):
     def union((s_obj, s_addr)):
         raise UnionError, "union of address and anything else makes no sense"
-
-class __extend__(pairtype(SomeOffset, SomeOffset)):
-    def add((s_off1, s_off2)):
-        return SomeOffset()
-
-class __extend__(pairtype(SomeOffset, SomeInteger)):
-    def mul((s_off1, s_off2)):
-        return SomeOffset()
-
-class __extend__(pairtype(SomeAddress, SomeOffset)):
-    def add((s_addr, s_off)):
-        return SomeAddress()

Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py	(original)
+++ pypy/dist/pypy/annotation/builtin.py	Wed Jan 25 11:47:41 2006
@@ -8,7 +8,7 @@
 from pypy.annotation.model import SomeUnicodeCodePoint, SomeAddress
 from pypy.annotation.model import SomeFloat, unionof
 from pypy.annotation.model import SomePBC, SomeInstance, SomeDict
-from pypy.annotation.model import SomeExternalObject, SomeOffset
+from pypy.annotation.model import SomeExternalObject
 from pypy.annotation.model import annotation_to_lltype, lltype_to_annotation
 from pypy.annotation.model import add_knowntypedata
 from pypy.annotation.model import s_ImpossibleValue
@@ -507,7 +507,7 @@
 from pypy.rpython.lltypesystem import llmemory 
 
 def offsetof(TYPE, fldname):
-    return SomeOffset()
+    return SomeInteger()
 
 BUILTIN_ANALYZERS[llmemory.offsetof] = offsetof
 

Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Wed Jan 25 11:47:41 2006
@@ -452,11 +452,6 @@
     def can_be_none(self):
         return False
 
-class SomeOffset(SomeObject):
-    immutable = True
-    def can_be_none(self):
-        return False
-    
 
 # The following class is used to annotate the intermediate value that
 # appears in expressions of the form:
@@ -514,7 +509,6 @@
 annotation_to_ll_map = [
     (s_None, lltype.Void),   # also matches SomeImpossibleValue()
     (SomeBool(), lltype.Bool),
-    (SomeOffset(), lltype.Signed),
     (SomeInteger(), lltype.Signed),
     (SomeInteger(size=2), lltype.SignedLongLong),    
     (SomeInteger(nonneg=True, unsigned=True), lltype.Unsigned),    

Modified: pypy/dist/pypy/rpython/lltypesystem/llmemory.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/llmemory.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/llmemory.py	Wed Jan 25 11:47:41 2006
@@ -11,7 +11,7 @@
 
     def annotation(self):
         from pypy.annotation import model
-        return model.SomeOffset()
+        return model.SomeInteger()
 
     def lltype(self):
         return lltype.Signed

Modified: pypy/dist/pypy/rpython/memory/test/test_address.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_address.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_address.py	Wed Jan 25 11:47:41 2006
@@ -122,7 +122,7 @@
         f()
         a = RPythonAnnotator()
         s = a.build_types(f, [])
-        assert isinstance(s, annmodel.SomeOffset)
+        assert isinstance(s, annmodel.SomeInteger)
 
         coff = offsetof(S, 'y')
         def f():
@@ -130,7 +130,7 @@
         f()
         a = RPythonAnnotator()
         s = a.build_types(f, [])
-        assert isinstance(s, annmodel.SomeOffset)
+        assert isinstance(s, annmodel.SomeInteger)
 
     def test_offset_addition(self):
         from pypy.rpython.lltypesystem import lltype
@@ -142,7 +142,7 @@
         f()
         a = RPythonAnnotator()
         s = a.build_types(f, [])
-        assert isinstance(s, annmodel.SomeOffset)
+        assert isinstance(s, annmodel.SomeInteger)
 
         coff = offsetof(T, 's2') + offsetof(S, 'y')
         def f():
@@ -150,7 +150,7 @@
         f()
         a = RPythonAnnotator()
         s = a.build_types(f, [])
-        assert isinstance(s, annmodel.SomeOffset)
+        assert isinstance(s, annmodel.SomeInteger)
         
         
 class TestAddressRTyping(object):

Modified: pypy/dist/pypy/rpython/raddress.py
==============================================================================
--- pypy/dist/pypy/rpython/raddress.py	(original)
+++ pypy/dist/pypy/rpython/raddress.py	Wed Jan 25 11:47:41 2006
@@ -111,30 +111,3 @@
         v_addr1, v_addr2 = hop.inputargs(Address, Address)
         return hop.genop('adr_ge', [v_addr1, v_addr2], resulttype=lltype.Bool)
 
-
-class __extend__(annmodel.SomeOffset):
-    def rtyper_makerepr(self, rtyper):
-        return offset_repr
-    
-    def rtyper_makekey(self):
-        return self.__class__,
-
-class OffsetRepr(Repr):
-    lowleveltype = lltype.Signed
-
-offset_repr = OffsetRepr()
-
-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('int_add', [v_offset1, v_offset2], resulttype=lltype.Signed)
-
-class __extend__(pairtype(OffsetRepr, IntegerRepr)):
-    def rtype_mul((r_offset, r_int), hop):
-        v_offset, v_int = hop.inputargs(r_offset, r_int)
-        return hop.genop('int_mul', [v_offset, v_int], 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_add', [v_offset1, v_offset2], resulttype=Address)

Modified: pypy/dist/pypy/rpython/rbuiltin.py
==============================================================================
--- pypy/dist/pypy/rpython/rbuiltin.py	(original)
+++ pypy/dist/pypy/rpython/rbuiltin.py	Wed Jan 25 11:47:41 2006
@@ -392,10 +392,10 @@
 # XXX this next little bit is a monstrous hack.  the Real Thing awaits
 # some kind of proper GC integration
 from pypy.rpython.l3interp import l3interp
-from pypy.rpython.raddress import offset_repr
+#from pypy.rpython.raddress import offset_repr
 
 def rtype_l3malloc(hop):
-    v_list = hop.inputargs(offset_repr)
+    v_list = hop.inputargs(lltype.Signed)
     return hop.genop("call_boehm_gc_alloc", v_list,
                      resulttype=llmemory.Address)
 

Modified: pypy/dist/pypy/rpython/rint.py
==============================================================================
--- pypy/dist/pypy/rpython/rint.py	(original)
+++ pypy/dist/pypy/rpython/rint.py	Wed Jan 25 11:47:41 2006
@@ -10,6 +10,7 @@
 from pypy.rpython.rarithmetic import intmask, r_int, r_uint, r_ulonglong, r_longlong
 from pypy.rpython.error import TyperError
 from pypy.rpython.rmodel import log
+from pypy.rpython import objectmodel
 
 
 class __extend__(annmodel.SomeInteger):
@@ -204,6 +205,8 @@
 class __extend__(IntegerRepr):
 
     def convert_const(self, value):
+        if isinstance(value, objectmodel.Symbolic):
+            return value
         if not isinstance(value, (int, r_uint, r_int, r_longlong, r_ulonglong)):   # can be bool
             raise TyperError("not an integer: %r" % (value,))
         if self.lowleveltype == Signed:



More information about the Pypy-commit mailing list