Hello, What is the purpose of SETUP_LOOP instruction? From a quick look it seems like it just pushes the size of the loop into blocks stack; that size is only used by BREAK_LOOP instruction. BREAK_LOOP could just contain the target address directly, like CONTINUE_LOOP does. This would avoid SETUP_LOOP/POP_BLOCK overhead for all loops. Am I missing something? Does SETUP_LOOP serve any other purpose?
Similarly, it looks like BREAK_LOOP and CONTINUE_LOOP are just jumps that respect try/finally blocks (i.e. jumping out of try executes finally). Is there more semantics to them than this? If not, this can be simplified to: 1) If not in try/finally, simply generate a direct jump outside of the loop (break) or to the start of the loop (continue). 2) If in try/finally, generate a new instruction JUMP_FROM_TRY which replaces both BREAK_LOOP and CONTINUE_LOOP. It behaves the same way as CONTINUE_LOOP but without restriction to only jump backwards (could reuse CONTINUE_LOOP, but the name would be misleading). continue statement is already handled this way, but break always uses BREAK_LOOP. Any comments are appreciated. Regards, Eugene _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com