This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: generic and more efficient removal of unreachable code
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: doublep, rhettinger
Priority: normal Keywords: patch

Created on 2007-07-31 22:44 by doublep, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
unreachable-code.diff doublep, 2007-07-31 22:44 patch
Messages (2)
msg52972 - (view) Author: Paul Pogonyshev (doublep) Date: 2007-07-31 22:44
The attached patch removed unreachable code after RAISE_VARARGS, BREAK_LOOP and RETURN_VALUE in generic way (no more tests for LOAD_CONST None RETURN_VALUE, etc.)

It is possible to generalize it more for some other bytecodes.  The only problem they are already used in switch() in question as labels.  Probably not important enough to warrant another switch() or break this out into a function/macro.

No speedup is expected, but I think the patch is good with no drawbacks anyway.
msg67565 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-05-31 04:59
Not too excited about this.  It adds to compilation time but doesn't 
save any runtime.  It's not at all common for production code to have 
unreachable code at RAISE_VARARGS or BREAK_LOOP, so I see no reason to 
complexify to the peepholer to handle this case.
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45264
2008-05-31 04:59:27rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg67565
nosy: + rhettinger
2007-08-24 11:49:53georg.brandlsetassignee: rhettinger
2007-07-31 22:44:17doublepcreate