[pypy-svn] r76411 - pypy/branch/call-method-kwarg/pypy/objspace/std

agaynor at codespeak.net agaynor at codespeak.net
Fri Jul 30 22:01:01 CEST 2010


Author: agaynor
Date: Fri Jul 30 22:00:58 2010
New Revision: 76411

Modified:
   pypy/branch/call-method-kwarg/pypy/objspace/std/callmethod.py
Log:
reinclude a fastpath, this also fixes the test_gateway tests

Modified: pypy/branch/call-method-kwarg/pypy/objspace/std/callmethod.py
==============================================================================
--- pypy/branch/call-method-kwarg/pypy/objspace/std/callmethod.py	(original)
+++ pypy/branch/call-method-kwarg/pypy/objspace/std/callmethod.py	Fri Jul 30 22:00:58 2010
@@ -62,8 +62,15 @@
     n_kwargs = (oparg >> 8) & 0xff
     w_self = f.peekvalue(n_args + (2 * n_kwargs))
     w_callable = f.peekvalue(n_args + (2 * n_kwargs) + 1)
+    n = n_args + (w_self is not None)
     
-    if n_kwargs:
+    if not n_kwargs:
+        try:
+            w_result = f.space.call_valuestack(w_callable, n, f)
+            rstack.resume_point("CALL_METHOD", f, n_args, returns=w_result)
+        finally:
+            f.dropvalues(n_args + 2)
+    else:
         keywords = [None] * n_kwargs
         keywords_w = [None] * n_kwargs
         while True:
@@ -75,18 +82,15 @@
             key = f.space.str_w(w_key)
             keywords[n_kwargs] = key
             keywords_w[n_kwargs] = w_value
-    else:
-        keywords = None
-        keywords_w = None
-    
-    arguments = f.popvalues(n_args + (w_self is not None))
-    args = f.argument_factory(arguments, keywords, keywords_w, None, None)
     
-    try:
-        w_result = f.space.call_args(w_callable, args)
-        rstack.resume_point("CALL_METHOD", f, returns=w_result)
-    finally:
-        f.dropvalues(1 + (w_self is None))
+        arguments = f.popvalues(n)
+        args = f.argument_factory(arguments, keywords, keywords_w, None, None)
+        
+        try:
+            w_result = f.space.call_args(w_callable, args)
+            rstack.resume_point("CALL_METHOD", f, returns=w_result)
+        finally:
+            f.dropvalues(1 + (w_self is None))
     f.pushvalue(w_result)
 
 



More information about the Pypy-commit mailing list