[Python-checkins] CVS: python/dist/src/Python ceval.c,2.238,2.238.2.1

Thomas Wouters twouters@users.sourceforge.net
Wed, 27 Jun 2001 06:09:47 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv18077/Python

Modified Files:
      Tag: release21-maint
	ceval.c 
Log Message:

Backport Jeremy's checkin 2.244:

Add a second special case to the inline function call code in eval_code2().

If we have a PyCFunction (builtin) and it is METH_VARARGS only, load
the args and dispatch to call_cfunction() directly.  This provides a
small speedup for perhaps the most common function calls -- builtins.



Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.238
retrieving revision 2.238.2.1
diff -C2 -r2.238 -r2.238.2.1
*** ceval.c	2001/04/13 16:51:46	2.238
--- ceval.c	2001/06/27 13:09:44	2.238.2.1
***************
*** 1942,1946 ****
  		    */
  		    if (PyCFunction_Check(func)) {
! 			    if (PyCFunction_GET_FLAGS(func) == 0) {
  				    x = fast_cfunction(func,
  						       &stack_pointer, na);
--- 1942,1952 ----
  		    */
  		    if (PyCFunction_Check(func)) {
! 			    int flags = PyCFunction_GET_FLAGS(func);
! 			    if (flags == METH_VARARGS) {
! 				    PyObject *callargs;
! 				    callargs = load_args(&stack_pointer, na);
! 				    x = call_cfunction(func, callargs, NULL);
! 				    Py_XDECREF(callargs); 
! 			    } else if (flags == 0) {
  				    x = fast_cfunction(func,
  						       &stack_pointer, na);