[pypy-svn] r17094 - in pypy/dist/pypy: interpreter objspace

arigo at codespeak.net arigo at codespeak.net
Tue Aug 30 19:09:23 CEST 2005


Author: arigo
Date: Tue Aug 30 19:09:21 2005
New Revision: 17094

Modified:
   pypy/dist/pypy/interpreter/eval.py
   pypy/dist/pypy/objspace/descroperation.py
Log:
A variant of the fastcall() shortcuts that are less Pythonic :-(  no storing
of None in the class to mean "this method is missing".  Makes the rtyper
unhappy at the moment, and it's messy to translate to non-C targets in
general.



Modified: pypy/dist/pypy/interpreter/eval.py
==============================================================================
--- pypy/dist/pypy/interpreter/eval.py	(original)
+++ pypy/dist/pypy/interpreter/eval.py	Tue Aug 30 19:09:21 2005
@@ -50,9 +50,13 @@
     def getdocstring(self):
         return None
 
-    fastcall_1 = None
-    fastcall_2 = None
-    fastcall_3 = None
+    # a performance hack (see gateway.BuiltinCode1/2/3)
+    def fastcall_1(self, space, w1):
+        return None
+    def fastcall_2(self, space, w1, w2):
+        return None
+    def fastcall_3(self, space, w1, w2, w3):
+        return None
 
 class Frame(Wrappable):
     """A frame is an environment supporting the execution of a code object.

Modified: pypy/dist/pypy/objspace/descroperation.py
==============================================================================
--- pypy/dist/pypy/objspace/descroperation.py	(original)
+++ pypy/dist/pypy/objspace/descroperation.py	Tue Aug 30 19:09:21 2005
@@ -86,17 +86,18 @@
             # the fastcall paths are purely for performance, but the resulting
             # increase of speed is huge
             if len(args_w) == 0:
-                fastcall_1 = descr.code.fastcall_1
-                if fastcall_1:
-                    return fastcall_1(space, w_obj)
+                w_res = descr.code.fastcall_1(space, w_obj)
+                if w_res is not None:
+                    return w_res
             elif len(args_w) == 1:
-                fastcall_2 = descr.code.fastcall_2
-                if fastcall_2:
-                    return fastcall_2(space, w_obj, args_w[0])
+                w_res = descr.code.fastcall_2(space, w_obj, args_w[0])
+                if w_res is not None:
+                    return w_res
             elif len(args_w) == 2:
-                fastcall_3 = descr.code.fastcall_3
-                if fastcall_3:
-                    return fastcall_3(space, w_obj, args_w[0], args_w[1])
+                w_res = descr.code.fastcall_3(space, w_obj, args_w[0],
+                                                            args_w[1])
+                if w_res is not None:
+                    return w_res
             args = Arguments(space, list(args_w))
             return descr.call_args(args.prepend(w_obj))
         else:



More information about the Pypy-commit mailing list