[Patches] [ python-Patches-429024 ] Deal with some unary ops at compile time
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 09 Aug 2001 11:13:50 -0700
Patches item #429024, was opened at 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.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-08-09 11:13
Message:
Logged In: YES
user_id=31435
Back to Jeremy.
Fred's patch is fine by me, but I'd like to see a comment
before the 20 lines of mallocs and frees and strcpys
explaining what the *intent* of all that stuff is (it's a
lot of code to stick "-" at the front of a string <wink>).
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-06-03 21:24
Message:
Logged In: YES
user_id=3066
Re-assigned to Tim since Jeremy's on a new assignment.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=429024&group_id=5470