[pypy-commit] pypy remove-getfield-pure: Merge with default

sbauman pypy.commits at gmail.com
Tue Jan 12 23:42:22 EST 2016


Author: Spenser Andrew Bauman <sabauma at gmail.com>
Branch: remove-getfield-pure
Changeset: r81735:2351ba72df1e
Date: 2016-01-12 21:55 -0500
http://bitbucket.org/pypy/pypy/changeset/2351ba72df1e/

Log:	Merge with default

diff --git a/rpython/jit/codewriter/effectinfo.py b/rpython/jit/codewriter/effectinfo.py
--- a/rpython/jit/codewriter/effectinfo.py
+++ b/rpython/jit/codewriter/effectinfo.py
@@ -331,11 +331,8 @@
 
 class RandomEffectsAnalyzer(BoolGraphAnalyzer):
     def analyze_external_call(self, funcobj, seen=None):
-        try:
-            if funcobj.random_effects_on_gcobjs:
-                return True
-        except AttributeError:
-            return True   # better safe than sorry
+        if funcobj.random_effects_on_gcobjs:
+            return True
         return super(RandomEffectsAnalyzer, self).analyze_external_call(
             funcobj, seen)
 
diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -36,7 +36,7 @@
         return graphanalyze.BoolGraphAnalyzer.analyze_direct_call(self, graph,
                                                                   seen)
     def analyze_external_call(self, funcobj, seen=None):
-        if getattr(funcobj, 'random_effects_on_gcobjs', False):
+        if funcobj.random_effects_on_gcobjs:
             return True
         return graphanalyze.BoolGraphAnalyzer.analyze_external_call(
             self, funcobj, seen)
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -22,7 +22,7 @@
 from rpython.rtyper.error import TyperError
 from rpython.rtyper.exceptiondata import ExceptionData
 from rpython.rtyper.lltypesystem.lltype import (Signed, Void, LowLevelType,
-    Ptr, ContainerType, FuncType, functionptr, typeOf, RuntimeTypeInfo,
+    Ptr, ContainerType, FuncType, typeOf, RuntimeTypeInfo,
     attachRuntimeTypeInfo, Primitive, getfunctionptr)
 from rpython.rtyper.rmodel import Repr, inputconst, BrokenReprTyperError
 from rpython.rtyper import rclass
@@ -876,18 +876,6 @@
         return self.genop('direct_call', [c]+newargs_v,
                           resulttype = typeOf(fobj).RESULT)
 
-    def genexternalcall(self, fnname, args_v, resulttype=None, **flags):
-        if isinstance(resulttype, Repr):
-            resulttype = resulttype.lowleveltype
-        argtypes = [v.concretetype for v in args_v]
-        FUNCTYPE = FuncType(argtypes, resulttype or Void)
-        f = functionptr(FUNCTYPE, fnname, **flags)
-        cf = inputconst(typeOf(f), f)
-        return self.genop('direct_call', [cf]+list(args_v), resulttype)
-
-    def gencapicall(self, cfnname, args_v, resulttype=None, **flags):
-        return self.genexternalcall(cfnname, args_v, resulttype=resulttype, external="CPython", **flags)
-
     def genconst(self, ll_value):
         return inputconst(typeOf(ll_value), ll_value)
 
diff --git a/rpython/translator/backendopt/graphanalyze.py b/rpython/translator/backendopt/graphanalyze.py
--- a/rpython/translator/backendopt/graphanalyze.py
+++ b/rpython/translator/backendopt/graphanalyze.py
@@ -1,5 +1,4 @@
 from rpython.rtyper.lltypesystem.lltype import DelayedPointer
-from rpython.translator.simplify import get_graph
 from rpython.tool.algo.unionfind import UnionFind
 
 
@@ -90,8 +89,10 @@
                 if self.verbose and x:
                     self.dump_info('analyze_external_call %s: %r' % (op, x))
                 return x
-            graph = funcobj.graph
-            assert graph is not None
+            try:
+                graph = funcobj.graph
+            except AttributeError:
+                return self.top_result()
             x = self.analyze_direct_call(graph, seen)
             if self.verbose and x:
                 self.dump_info('analyze_direct_call(%s): %r' % (graph, x))
diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
--- a/rpython/translator/simplify.py
+++ b/rpython/translator/simplify.py
@@ -24,22 +24,13 @@
     if not isinstance(f, lltype._ptr):
         return None
     try:
-        funcobj = f._getobj()
+        funcobj = f._obj
     except lltype.DelayedPointer:
         return None
     try:
-        callable = funcobj._callable
-    except (AttributeError, KeyError, AssertionError):
-        return None
-    try:
         return funcobj.graph
     except AttributeError:
         return None
-    try:
-        callable = funcobj._callable
-        return translator._graphof(callable)
-    except (AttributeError, KeyError, AssertionError):
-        return None
 
 
 def replace_exitswitch_by_constant(block, const):


More information about the pypy-commit mailing list