py: Allow bytecode/native to put iter_buf on stack for simple for loops.

So that the "for x in it: ..." statement can now work without using the
heap (so long as the iterator argument fits in an iter_buf structure).
This commit is contained in:
Damien George
2016-01-09 23:59:52 +00:00
parent ae8d867586
commit f4df3aaa72
9 changed files with 57 additions and 19 deletions

View File

@@ -387,6 +387,10 @@ const byte *mp_bytecode_print_str(const byte *ip) {
printf("GET_ITER");
break;
case MP_BC_GET_ITER_STACK:
printf("GET_ITER_STACK");
break;
case MP_BC_FOR_ITER:
DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward
printf("FOR_ITER " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));