From cc2bd63c57a72ec37d839965c6bb61cd1fa202fc Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 1 Oct 2018 13:07:04 +1000 Subject: py/emitnative: Implement yield and yield-from in native emitter. This commit adds first class support for yield and yield-from in the native emitter, including send and throw support, and yields enclosed in exception handlers (which requires pulling down the NLR stack before yielding, then rebuilding it when resuming). This has been fully tested and is working on unix x86 and x86-64, and stm32. Also basic tests have been done with the esp8266 port. Performance of existing native code is unchanged. --- py/emitnx86.c | 1 + 1 file changed, 1 insertion(+) (limited to 'py/emitnx86.c') diff --git a/py/emitnx86.c b/py/emitnx86.c index 597a0fd4a8..7c96c3b82b 100644 --- a/py/emitnx86.c +++ b/py/emitnx86.c @@ -66,6 +66,7 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = { [MP_F_SETUP_CODE_STATE] = 4, [MP_F_SMALL_INT_FLOOR_DIVIDE] = 2, [MP_F_SMALL_INT_MODULO] = 2, + [MP_F_NATIVE_YIELD_FROM] = 3, }; #define N_X86 (1) -- cgit v1.2.3