[pypy-svn] r50003 - in pypy/dist/pypy/jit/hintannotator: . test

antocuni at codespeak.net antocuni at codespeak.net
Sat Dec 22 11:49:15 CET 2007


Author: antocuni
Date: Sat Dec 22 11:49:14 2007
New Revision: 50003

Modified:
   pypy/dist/pypy/jit/hintannotator/model.py
   pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
Log:
when ananlyzing an oosend, it doesn't matter whether the hs_self is a
variable or a constant to determine the list of possible graphs; it's
only the type that matters, so move oosend from SomeLLAbstractConstat
to SomeLLAbstractValue



Modified: pypy/dist/pypy/jit/hintannotator/model.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/model.py	(original)
+++ pypy/dist/pypy/jit/hintannotator/model.py	Sat Dec 22 11:49:14 2007
@@ -443,47 +443,6 @@
         # function
         return annmodel.unionof(hs_res, bookkeeper.current_op_binding())
 
-    def oosend(hs_v1, hs_name, *args_hs):
-        RESTYPE = getbookkeeper().current_op_concretetype()
-        return variableoftype(RESTYPE)
-
-class __extend__(SomeLLAbstractConstant):
-
-    def same_as(hs_c1):
-        # this is here to prevent setup() below from adding a different
-        # version of same_as()
-        return hs_c1
-
-    def hint(hs_c1, hs_flags):
-        if hs_flags.const.get('concrete', False):
-            for o in hs_c1.origins:
-                o.set_fixed()
-            hs_concrete = reorigin(hs_c1)
-            hs_concrete.eager_concrete = True
-            return hs_concrete 
-        if hs_flags.const.get('forget', False):
-            assert isinstance(hs_c1, SomeLLAbstractConstant)
-            return reorigin(hs_c1)
-        return SomeLLAbstractValue.hint(hs_c1, hs_flags)
-
-    def direct_call(hs_f1, *args_hs):
-        bookkeeper = getbookkeeper()
-        fnobj = get_funcobj(hs_f1.const)
-        if (bookkeeper.annotator.policy.oopspec and
-            hasattr(fnobj._callable, 'oopspec')):
-            # try to handle the call as a high-level operation
-            try:
-                return handle_highlevel_operation(bookkeeper, fnobj._callable,
-                                                  *args_hs)
-            except NotImplementedError:
-                pass
-
-        # normal call
-        if not hasattr(fnobj, 'graph'):
-            raise NotImplementedError("XXX call to externals or primitives")
-
-        return hs_f1._call_single_graph(fnobj.graph, lltype.typeOf(fnobj).RESULT, *args_hs)
-
     def _call_single_graph(hs_f1, graph, RESULT, *args_hs):
         bookkeeper = getbookkeeper()
         if not bookkeeper.annotator.policy.look_inside_graph(graph):
@@ -529,6 +488,43 @@
             # like an indirect_call
             return hs_c1._call_multiple_graphs(graph_list, METH.RESULT, hs_c1, *args_hs) # prepend hs_c1 to the args
 
+class __extend__(SomeLLAbstractConstant):
+
+    def same_as(hs_c1):
+        # this is here to prevent setup() below from adding a different
+        # version of same_as()
+        return hs_c1
+
+    def hint(hs_c1, hs_flags):
+        if hs_flags.const.get('concrete', False):
+            for o in hs_c1.origins:
+                o.set_fixed()
+            hs_concrete = reorigin(hs_c1)
+            hs_concrete.eager_concrete = True
+            return hs_concrete 
+        if hs_flags.const.get('forget', False):
+            assert isinstance(hs_c1, SomeLLAbstractConstant)
+            return reorigin(hs_c1)
+        return SomeLLAbstractValue.hint(hs_c1, hs_flags)
+
+    def direct_call(hs_f1, *args_hs):
+        bookkeeper = getbookkeeper()
+        fnobj = get_funcobj(hs_f1.const)
+        if (bookkeeper.annotator.policy.oopspec and
+            hasattr(fnobj._callable, 'oopspec')):
+            # try to handle the call as a high-level operation
+            try:
+                return handle_highlevel_operation(bookkeeper, fnobj._callable,
+                                                  *args_hs)
+            except NotImplementedError:
+                pass
+
+        # normal call
+        if not hasattr(fnobj, 'graph'):
+            raise NotImplementedError("XXX call to externals or primitives")
+
+        return hs_f1._call_single_graph(fnobj.graph, lltype.typeOf(fnobj).RESULT, *args_hs)
+
     def getfield(hs_c1, hs_fieldname):
         S = hs_c1.concretetype.TO
         FIELD_TYPE = getattr(S, hs_fieldname.const)

Modified: pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/test/test_annotator.py	(original)
+++ pypy/dist/pypy/jit/hintannotator/test/test_annotator.py	Sat Dec 22 11:49:14 2007
@@ -1113,6 +1113,3 @@
             f = Foo()
             f.bar()
         hs = self.hannotate(fn, [], policy=P_OOPSPEC_NOVIRTUAL)
-
-    def test_simple_method_call_var(self):
-        py.test.skip('fixme!')



More information about the Pypy-commit mailing list