[Python-checkins] CVS: python/nondist/peps pep-0280.txt,1.10,1.11

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 11 Feb 2002 08:24:12 -0800


Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv5403

Modified Files:
	pep-0280.txt 
Log Message:
Add Ping's "always doubly-indirect" idea.  Remove mistaken pseudo-C
for Tim's ideal.


Index: pep-0280.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0280.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pep-0280.txt	11 Feb 2002 15:48:50 -0000	1.10
--- pep-0280.txt	11 Feb 2002 16:24:10 -0000	1.11
***************
*** 438,453 ****
             continue;
  
!        With Tim's "more aggressive" alternative added, it could look
!        like this:
  
         case LOAD_GLOBAL_CELL:
             cell = func_cells[oparg];
!            x = cell->objptr;
!            if (x == NULL) {
!                ... error recovery ...
!                break;
             }
!            Py_INCREF(x);
!            continue;
  
      Q. What happens in the module's top-level code where there is
--- 438,458 ----
             continue;
  
!        We could even write it like this (idea courtesy of Ka-Ping Yee):
  
         case LOAD_GLOBAL_CELL:
             cell = func_cells[oparg];
!            x = cell->cellptr->objptr;
!            if (x != NULL) {
!                Py_INCREF(x);
!                continue;
             }
!            ... error recovery ...
!            break;
! 
!        In modern CPU architectures, this reduces the number of
!        branches taken for built-ins, which might be a really good
!        thing, while any decent memory cache should realize that
!        cell->cellptr is the same as cell for regular globals and hence
!        this should be very fast in that case too.
  
      Q. What happens in the module's top-level code where there is