[pypy-svn] r64279 - in pypy/trunk/pypy: annotation annotation/test rpython/ootypesystem rpython/ootypesystem/test tool/test translator/jvm translator/oosupport

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Apr 17 16:11:07 CEST 2009


Author: cfbolz
Date: Fri Apr 17 16:11:06 2009
New Revision: 64279

Removed:
   pypy/trunk/pypy/rpython/ootypesystem/bltregistry.py
   pypy/trunk/pypy/rpython/ootypesystem/extdesc.py
   pypy/trunk/pypy/rpython/ootypesystem/rbltregistry.py
   pypy/trunk/pypy/rpython/ootypesystem/test/test_bltann.py
Modified:
   pypy/trunk/pypy/annotation/annrpython.py
   pypy/trunk/pypy/annotation/binaryop.py
   pypy/trunk/pypy/annotation/bookkeeper.py
   pypy/trunk/pypy/annotation/model.py
   pypy/trunk/pypy/annotation/test/test_annrpython.py
   pypy/trunk/pypy/tool/test/test_error.py
   pypy/trunk/pypy/translator/jvm/database.py
   pypy/trunk/pypy/translator/oosupport/metavm.py
Log:
(cfbolz, pedronis around): merge the kill-bltregistry branch.


Modified: pypy/trunk/pypy/annotation/annrpython.py
==============================================================================
--- pypy/trunk/pypy/annotation/annrpython.py	(original)
+++ pypy/trunk/pypy/annotation/annrpython.py	Fri Apr 17 16:11:06 2009
@@ -23,7 +23,6 @@
 
     def __init__(self, translator=None, policy=None, bookkeeper=None):
         import pypy.rpython.ootypesystem.ooregistry # has side effects
-        import pypy.rpython.ootypesystem.bltregistry # has side effects
         import pypy.rpython.extfuncregistry # has side effects
         import pypy.rlib.nonconst # has side effects
 

Modified: pypy/trunk/pypy/annotation/binaryop.py
==============================================================================
--- pypy/trunk/pypy/annotation/binaryop.py	(original)
+++ pypy/trunk/pypy/annotation/binaryop.py	Fri Apr 17 16:11:06 2009
@@ -19,7 +19,7 @@
 from pypy.annotation.model import read_can_only_throw
 from pypy.annotation.model import add_knowntypedata, merge_knowntypedata
 from pypy.annotation.model import SomeGenericCallable
-from pypy.annotation.model import SomeExternalInstance, SomeUnicodeString
+from pypy.annotation.model import SomeUnicodeString
 from pypy.annotation.bookkeeper import getbookkeeper
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.rlib import rarithmetic
@@ -825,20 +825,6 @@
             return SomeExternalObject(ext1.knowntype)
         return SomeObject()
 
-class __extend__(pairtype(SomeExternalInstance, SomeExternalInstance)):
-    def union((ext1, ext2)):
-        def commonsuperclass(cls1, cls2):
-            cls = cls2
-            while not issubclass(cls1, cls):
-                cls = cls.__bases__[0]
-            return cls
-        
-        from pypy.rpython.ootypesystem.bltregistry import BasicExternal
-        cls = commonsuperclass(ext1.knowntype, ext2.knowntype)
-        if cls is BasicExternal:
-            return SomeObject()
-        return SomeExternalInstance(cls)
-
 # ____________________________________________________________
 # annotation of low-level types
 from pypy.annotation.model import SomePtr, SomeOOInstance, SomeOOClass

Modified: pypy/trunk/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/trunk/pypy/annotation/bookkeeper.py	(original)
+++ pypy/trunk/pypy/annotation/bookkeeper.py	Fri Apr 17 16:11:06 2009
@@ -560,16 +560,6 @@
             access_sets = map[attrname] = UnionFind(description.ClassAttrFamily)
         return access_sets
     
-    def getexternaldesc(self, class_):
-        try:
-            return self.external_class_cache[class_]
-        except KeyError:
-            from  pypy.rpython.ootypesystem import bltregistry
-            next = bltregistry.ExternalInstanceDesc(class_)
-            self.external_class_cache[class_] = next
-            next.setup()
-            return next
-
     def pbc_getattr(self, pbc, s_attr):
         assert s_attr.is_constant()
         attr = s_attr.const

Modified: pypy/trunk/pypy/annotation/model.py
==============================================================================
--- pypy/trunk/pypy/annotation/model.py	(original)
+++ pypy/trunk/pypy/annotation/model.py	Fri Apr 17 16:11:06 2009
@@ -458,11 +458,6 @@
     def can_be_none(self):
         return True
 
-class SomeExternalInstance(SomeExternalObject):
-    """Stands for an object of 'external' type, but with custom access to
-    attributes as well as methods
-    """
-
 class SomeImpossibleValue(SomeObject):
     """The empty set.  Instances are placeholders for objects that
     will never show up at run-time, e.g. elements of an empty list."""
@@ -604,7 +599,6 @@
 ll_to_annotation_map = dict([(ll, ann) for ann, ll in annotation_to_ll_map if ll is not NUMBER])
 
 def lltype_to_annotation(T):
-    from pypy.rpython.ootypesystem.bltregistry import ExternalType
     try:
         s = ll_to_annotation_map.get(T)
     except TypeError:
@@ -618,8 +612,6 @@
             return SomeOOStaticMeth(T)
         elif T == ootype.Class:
             return SomeOOClass(ootype.ROOT)
-        elif isinstance(T, ExternalType):
-            return SomeExternalInstance(T._class_)
         elif isinstance(T, lltype.InteriorPtr):
             return SomeInteriorPtr(T)
         else:

Modified: pypy/trunk/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/trunk/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/trunk/pypy/annotation/test/test_annrpython.py	Fri Apr 17 16:11:06 2009
@@ -2737,30 +2737,6 @@
         s = a.build_types(fun, [bool])
         assert isinstance(s, annmodel.SomeInteger)
 
-    def test_unionof_some_external_builtin(self):
-        from pypy.rpython.ootypesystem.bltregistry import BasicExternal
-        
-        class A(BasicExternal):
-            pass
-
-        class B(A):
-            pass
-
-        class C(A):
-            pass
-
-        def f(x):
-            if x:
-                return B()
-            else:
-                return C()
-
-        P = policy.AnnotatorPolicy()
-        P.allow_someobjects = False
-        a = self.RPythonAnnotator(policy=P)
-        s = a.build_types(f, [bool])
-        assert isinstance(s, annmodel.SomeExternalInstance)        
-
     def test_instance_with_flags(self):
         py.test.skip("not supported any more")
         from pypy.rlib.jit import hint

Modified: pypy/trunk/pypy/tool/test/test_error.py
==============================================================================
--- pypy/trunk/pypy/tool/test/test_error.py	(original)
+++ pypy/trunk/pypy/tool/test/test_error.py	Fri Apr 17 16:11:06 2009
@@ -69,22 +69,6 @@
     
     py.test.raises(AnnotatorError, compile_function, f, [int])
 
-def test_basicexternal_attribute():
-    from pypy.rpython.ootypesystem.bltregistry import BasicExternal
-
-    class A(BasicExternal):
-        pass
-    
-    def f():
-        return A().f
-
-    py.test.raises(NoSuchAttrError, compile_function, f, [])
-
-    def g():
-        return A().g()
-
-    py.test.raises(NoSuchAttrError, compile_function, g, [])
-
 def test_someobject_from_call():
     def one(x):
         return str(x)

Modified: pypy/trunk/pypy/translator/jvm/database.py
==============================================================================
--- pypy/trunk/pypy/translator/jvm/database.py	(original)
+++ pypy/trunk/pypy/translator/jvm/database.py	Fri Apr 17 16:11:06 2009
@@ -11,7 +11,6 @@
 from pypy.translator.jvm.option import getoption
 from pypy.translator.jvm.builtin import JvmBuiltInType
 from pypy.translator.oosupport.database import Database as OODatabase
-from pypy.rpython.ootypesystem.bltregistry import ExternalType
 from pypy.annotation.signature import annotation
 from pypy.annotation.model import annotation_to_lltype
 import pypy.translator.jvm.constant as jvmconst
@@ -463,10 +462,6 @@
         if isinstance(OOT, ootype.StaticMethod):
             return self.record_delegate(OOT)
 
-        # handle externals
-        if isinstance(OOT, ExternalType):
-            return jvm.JvmNativeClass(self, OOT)
-        
         assert False, "Untranslatable type %s!" % OOT
 
     ooitemtype_to_array = {

Modified: pypy/trunk/pypy/translator/oosupport/metavm.py
==============================================================================
--- pypy/trunk/pypy/translator/oosupport/metavm.py	(original)
+++ pypy/trunk/pypy/translator/oosupport/metavm.py	Fri Apr 17 16:11:06 2009
@@ -12,7 +12,6 @@
 """
 
 from pypy.rpython.ootypesystem import ootype
-from pypy.rpython.ootypesystem.bltregistry import ExternalType
 from pypy.rpython.extfunc import ExtFuncEntry, is_external
 
 class Generator(object):
@@ -364,17 +363,10 @@
             return False
         return this._hints.get('_suggested_external')
     
-    def check_external(self, this):
-        if isinstance(this, ExternalType):
-            return True
-        return False
-
 class _MethodDispatcher(_GeneralDispatcher):
     def render(self, generator, op):
         method = op.args[0].value
         this = op.args[1].concretetype
-        if self.check_external(this):
-            return self.class_map['CallExternalObject'].render(generator, op)
         if self.check_builtin(this):
             return self.class_map['CallBuiltinObject'].render(generator, op)
         try:
@@ -403,9 +395,7 @@
     
 class _SetFieldDispatcher(_GeneralDispatcher):
     def render(self, generator, op):
-        if self.check_external(op.args[0].concretetype):
-            return self.class_map['SetExternalField'].render(generator, op)
-        elif self.check_builtin(op.args[0].concretetype):
+        if self.check_builtin(op.args[0].concretetype):
             return self.class_map['SetBuiltinField'].render(generator, op)
         else:
             return self.class_map['SetField'].render(generator, op)



More information about the Pypy-commit mailing list