summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-02-13 15:44:31 +1100
committerDamien George <damien.p.george@gmail.com>2017-02-16 19:11:34 +1100
commite6003f466e6f5b7eddd01740666230b62ab5a872 (patch)
tree01dabf002737d9960c822623f9f54316a8143c4a /py/runtime.c
parent019048a6dc0783515e7fba4255dd2b22265d1059 (diff)
py: De-optimise some uses of mp_getiter, so they don't use the C stack.
In these cases the heap is anyway used to create a new object so no real need to use the C stack for iterating. It saves a few bytes of code size.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/py/runtime.c b/py/runtime.c
index b792eabe7..db6a6f18f 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -745,8 +745,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_
// get the keys iterable
mp_obj_t dest[3];
mp_load_method(kw_dict, MP_QSTR_keys, dest);
- mp_obj_iter_buf_t iter_buf;
- mp_obj_t iterable = mp_getiter(mp_call_method_n_kw(0, 0, dest), &iter_buf);
+ mp_obj_t iterable = mp_getiter(mp_call_method_n_kw(0, 0, dest), NULL);
mp_obj_t key;
while ((key = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
@@ -877,8 +876,7 @@ void mp_unpack_ex(mp_obj_t seq_in, size_t num_in, mp_obj_t *items) {
// items destination array, then the rest to a dynamically created list. Once the
// iterable is exhausted, we take from this list for the right part of the items.
// TODO Improve to waste less memory in the dynamically created list.
- mp_obj_iter_buf_t iter_buf;
- mp_obj_t iterable = mp_getiter(seq_in, &iter_buf);
+ mp_obj_t iterable = mp_getiter(seq_in, NULL);
mp_obj_t item;
for (seq_len = 0; seq_len < num_left; seq_len++) {
item = mp_iternext(iterable);