mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
turn goto into do while loop
This commit is contained in:
parent
009b89d22a
commit
cef9782810
1 changed files with 32 additions and 37 deletions
|
@ -3586,12 +3586,12 @@ static void
|
|||
assemble_jump_offsets(struct assembler *a, struct compiler *c)
|
||||
{
|
||||
basicblock *b;
|
||||
int bsize, totsize, extended_arg_count, last_extended_arg_count = 0;
|
||||
int bsize, totsize, extended_arg_count = 0, last_extended_arg_count;
|
||||
int i;
|
||||
|
||||
/* Compute the size of each block and fixup jump args.
|
||||
Replace block pointer with position in bytecode. */
|
||||
start:
|
||||
do {
|
||||
totsize = 0;
|
||||
for (i = a->a_nblocks - 1; i >= 0; i--) {
|
||||
b = a->a_postorder[i];
|
||||
|
@ -3599,6 +3599,7 @@ start:
|
|||
b->b_offset = totsize;
|
||||
totsize += bsize;
|
||||
}
|
||||
last_extended_arg_count = extended_arg_count;
|
||||
extended_arg_count = 0;
|
||||
for (b = c->u->u_blocks; b != NULL; b = b->b_list) {
|
||||
bsize = b->b_offset;
|
||||
|
@ -3626,9 +3627,6 @@ start:
|
|||
on the bright side it should work until we come up
|
||||
with a better solution.
|
||||
|
||||
In the meantime, should the goto be dropped in favor
|
||||
of a loop?
|
||||
|
||||
The issue is that in the first loop blocksize() is called
|
||||
which calls instrsize() which requires i_oparg be set
|
||||
appropriately. There is a bootstrap problem because
|
||||
|
@ -3639,10 +3637,7 @@ start:
|
|||
ones in jump instructions. So this should converge
|
||||
fairly quickly.
|
||||
*/
|
||||
if (last_extended_arg_count != extended_arg_count) {
|
||||
last_extended_arg_count = extended_arg_count;
|
||||
goto start;
|
||||
}
|
||||
} while (last_extended_arg_count != extended_arg_count);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue