[pypy-commit] pypy default: don't import rtyper from the bookkeeper

rlamy noreply at buildbot.pypy.org
Thu May 15 05:02:19 CEST 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r71525:d45b68facb24
Date: 2014-05-15 04:01 +0100
http://bitbucket.org/pypy/pypy/changeset/d45b68facb24/

Log:	don't import rtyper from the bookkeeper

diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -13,8 +13,6 @@
     s_None, s_ImpossibleValue, SomeBool, SomeTuple,
     SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked,
     SomeWeakRef, SomeByteArray, SomeConstantType)
-from rpython.rtyper.llannotation import (
-    SomeAddress, SomePtr, SomeLLADTMeth, lltype_to_annotation)
 from rpython.annotator.classdef import InstanceSource, ClassDef
 from rpython.annotator.listdef import ListDef, ListItem
 from rpython.annotator.dictdef import DictDef
@@ -23,7 +21,6 @@
 from rpython.annotator.argument import ArgumentsForTranslation
 from rpython.rlib.objectmodel import r_dict, Symbolic
 from rpython.tool.algo.unionfind import UnionFind
-from rpython.rtyper.lltypesystem import lltype, llmemory
 from rpython.rtyper import extregistry
 
 
@@ -145,6 +142,7 @@
             check_no_flags(clsdef)
 
     def consider_call_site(self, call_op):
+        from rpython.rtyper.llannotation import SomeLLADTMeth, lltype_to_annotation
         binding = self.annotator.binding
         s_callable = binding(call_op.args[0])
         args_s = [binding(arg) for arg in call_op.args[1:]]
@@ -305,10 +303,6 @@
         elif extregistry.is_registered(x):
             entry = extregistry.lookup(x)
             result = entry.compute_annotation_bk(self)
-        elif isinstance(x, lltype._ptr):
-            result = SomePtr(lltype.typeOf(x))
-        elif isinstance(x, llmemory.fakeaddress):
-            result = SomeAddress()
         elif tp is type:
             result = SomeConstantType(x, self)
         elif callable(x):
diff --git a/rpython/rtyper/lltypesystem/llmemory.py b/rpython/rtyper/lltypesystem/llmemory.py
--- a/rpython/rtyper/lltypesystem/llmemory.py
+++ b/rpython/rtyper/lltypesystem/llmemory.py
@@ -9,6 +9,7 @@
 from rpython.rtyper.lltypesystem import lltype
 from rpython.tool.uid import uid
 from rpython.rlib.rarithmetic import is_valid_int
+from rpython.rtyper.extregistry import ExtRegistryEntry
 
 
 class AddressOffset(Symbolic):
@@ -529,6 +530,13 @@
         else:
             return self
 
+class fakeaddressEntry(ExtRegistryEntry):
+    _type_ = fakeaddress
+
+    def compute_annotation(self):
+        from rpython.rtyper.llannotation import SomeAddress
+        return SomeAddress()
+
 # ____________________________________________________________
 
 class AddressAsInt(Symbolic):
@@ -899,7 +907,6 @@
     else:
         raise TypeError(T)
 
-from rpython.rtyper.extregistry import ExtRegistryEntry
 
 class RawMemmoveEntry(ExtRegistryEntry):
     _about_ = raw_memmove
diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -7,6 +7,7 @@
 from types import NoneType
 from rpython.rlib.rarithmetic import maxint, is_valid_int, is_emulated_long
 import weakref
+from rpython.rtyper.extregistry import ExtRegistryEntry
 
 class State(object):
     pass
@@ -1407,6 +1408,14 @@
 
 assert not '__dict__' in dir(_ptr)
 
+class _ptrEntry(ExtRegistryEntry):
+    _type_ = _ptr
+
+    def compute_annotation(self):
+        from rpython.rtyper.llannotation import SomePtr
+        return SomePtr(typeOf(self.instance))
+
+
 class _interior_ptr(_abstract_ptr):
     __slots__ = ('_parent', '_offsets')
     def _set_parent(self, _parent):


More information about the pypy-commit mailing list