[Patches] [ python-Patches-429024 ] Deal with some unary ops at compile time

noreply@sourceforge.net noreply@sourceforge.net
Thu, 31 May 2001 07:27:50 -0700


Patches item #429024, was updated on 2001-05-31 07:27
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=429024&group_id=5470

Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Fred L. Drake, Jr. (fdrake)
Assigned to: Jeremy Hylton (jhylton)
Summary: Deal with some unary ops at compile time

Initial Comment:
This patch makes unary + and - operations with numeric
literals compile to a constant reference instead of a
constant reference and UNARY_POSITIVE or UNARY_NEGATIVE
opcode.  This could be extended to support UNARY_INVERT
as well, but that would be a little more complicated.

Folding unary + only affects one case in the regression
test, but folding the - affects 817 places (on a Linux
system with pretty much everything enabled).  I don't
know that this makes much difference at runtime, but
certainly reduces the number of opcodes evaluated.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=429024&group_id=5470